Merge branch 'master' of http://114.55.169.15:3000/huxiaofeng666/jwl-applet into dev-hxf
This commit is contained in:
12
src/App.vue
12
src/App.vue
@@ -1,8 +1,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import useUserStore from '@/jtools/store/user'
|
import useUserStore from '@/jtools/store/user'
|
||||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import storage from './jtools/storage'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function (options) {
|
||||||
|
// 如果是二维码扫描过来的,需要保存公司id
|
||||||
|
if (options.query?.scene) {
|
||||||
|
storage.set('companyId', options.query?.scene)
|
||||||
|
}
|
||||||
useUserStore().queryVipList()
|
useUserStore().queryVipList()
|
||||||
if (useUserStore().isLogin) {
|
if (useUserStore().isLogin) {
|
||||||
useUserStore().getUserInfo()
|
useUserStore().getUserInfo()
|
||||||
@@ -23,5 +28,8 @@ export default {
|
|||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "uni_modules/uview-plus/index.scss";
|
@import "uni_modules/uview-plus/index.scss";
|
||||||
@import "static/style/index.scss";
|
@import "static/style/index.scss";
|
||||||
button::after{ border: none;}
|
|
||||||
|
button::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { login, logout, getInfo } from '@/jtools/api/login';
|
import { login, logout, getInfo } from '@/jtools/api/login';
|
||||||
import { queryVip,getVipList } from '@/jtools/api/vip'
|
import { queryVip, getVipList } from '@/jtools/api/vip';
|
||||||
import constants from '@/jtools/constants';
|
import constants from '@/jtools/constants';
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
|
|
||||||
@@ -23,10 +23,11 @@ const useUserStore = defineStore({
|
|||||||
// 保存登录信息,用于重新登录
|
// 保存登录信息,用于重新登录
|
||||||
this.isLogin = true;
|
this.isLogin = true;
|
||||||
this.token = resp.data.token;
|
this.token = resp.data.token;
|
||||||
this.userInfo = resp.data
|
this.userInfo = resp.data;
|
||||||
storage.set('isLogin', true)
|
storage.set('isLogin', true);
|
||||||
storage.set('token', resp.data.token)
|
storage.set('token', resp.data.token);
|
||||||
storage.set('userInfo', resp.data)
|
storage.set('userInfo', resp.data);
|
||||||
|
storage.remove('companyId');
|
||||||
resolve(resp.data);
|
resolve(resp.data);
|
||||||
} else {
|
} else {
|
||||||
reject();
|
reject();
|
||||||
@@ -39,53 +40,53 @@ const useUserStore = defineStore({
|
|||||||
this.resetUserData();
|
this.resetUserData();
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
});
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
//过期登出
|
//过期登出
|
||||||
logoutWithoutToken(force = false) {
|
logoutWithoutToken(force = false) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.resetUserData();
|
this.resetUserData();
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
getInfo().then(resp => {
|
getInfo().then(resp => {
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.userInfo = resp.data
|
this.userInfo = resp.data;
|
||||||
storage.set('userInfo', resp.data)
|
storage.set('userInfo', resp.data);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
resetUserData() {
|
resetUserData() {
|
||||||
this.isLogin = false;
|
this.isLogin = false;
|
||||||
this.token = '';
|
this.token = '';
|
||||||
this.userInfo = {}
|
this.userInfo = {};
|
||||||
this.vipOnList = []
|
this.vipOnList = [];
|
||||||
storage.remove('isLogin')
|
storage.remove('isLogin');
|
||||||
storage.remove('token')
|
storage.remove('token');
|
||||||
storage.remove('userInfo')
|
storage.remove('userInfo');
|
||||||
},
|
},
|
||||||
// 查询当前用户的vip开通情况
|
// 查询当前用户的vip开通情况
|
||||||
async searchUserVip() {
|
async searchUserVip() {
|
||||||
this.currentCartype=storage.get('carType') || '1001'
|
this.currentCartype = storage.get('carType') || '1001';
|
||||||
const resp=await queryVip({ carTypeId: this.currentCartype,memberId: null, subject:'' })
|
const resp = await queryVip({ carTypeId: this.currentCartype, memberId: null, subject: '' });
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.vipOnList = resp.data
|
this.vipOnList = resp.data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查询所有的vip
|
// 查询所有的vip
|
||||||
queryVipList() {
|
queryVipList() {
|
||||||
this.currentCartype= storage.get('carType') || '1001'
|
this.currentCartype = storage.get('carType') || '1001';
|
||||||
getVipList({ carTypeId: this.currentCartype, memberId: null, subject: '' }).then(resp => {
|
getVipList({ carTypeId: this.currentCartype, memberId: null, subject: '' }).then(resp => {
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.vipAllList = resp.data
|
this.vipAllList = resp.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default useUserStore;
|
export default useUserStore;
|
||||||
|
|||||||
@@ -7,10 +7,13 @@
|
|||||||
<view style="width: 33.3%;" v-for="(item, index) of priceList" :key="index">
|
<view style="width: 33.3%;" v-for="(item, index) of priceList" :key="index">
|
||||||
<view class="option_tem relative" :class="checkedId === item.memberId ? 'checked_item' : ''" @click="checkPrice(item.memberId, item.price)">
|
<view class="option_tem relative" :class="checkedId === item.memberId ? 'checked_item' : ''" @click="checkPrice(item.memberId, item.price)">
|
||||||
<text class="fw600 fs12 cor-333">{{ item.memberName }}</text>
|
<text class="fw600 fs12 cor-333">{{ item.memberName }}</text>
|
||||||
<view class="mt5">
|
<view class="mt5" v-if="!isIOS">
|
||||||
<text class="fs14" style="color: #FF6E02;">¥</text>
|
<text class="fs14" style="color: #FF6E02;">¥</text>
|
||||||
<text class="fs30 fw600" style="color: #FF6E02;">{{ item.price }}</text>
|
<text class="fs30 fw600" style="color: #FF6E02;">{{ item.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else class="mt5">
|
||||||
|
<text class="fs14" style="color: #FF6E02;">iOS暂不支持</text>
|
||||||
|
</view>
|
||||||
<text class="fs12 cor-999">一年有效</text>
|
<text class="fs12 cor-999">一年有效</text>
|
||||||
<!-- <view class="bottom_box fs12 cor-333" :class="checkedId===item.memberId?'checked_bottom':''">赠送vip题库</view> -->
|
<!-- <view class="bottom_box fs12 cor-333" :class="checkedId===item.memberId?'checked_bottom':''">赠送vip题库</view> -->
|
||||||
<view class="tag" v-if="item.all">
|
<view class="tag" v-if="item.all">
|
||||||
@@ -64,7 +67,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp100 p14" style="position: absolute;left: 0;bottom:20px" @tap="handlePay()">
|
<view v-if="!isIOS" class="wp100 p14" style="position: absolute;left: 0;bottom:20px" @tap="handlePay()">
|
||||||
<view class="sub_btn flex ai-c jc-sb">
|
<view class="sub_btn flex ai-c jc-sb">
|
||||||
<text class="cor-fff fs14">¥<text class="fs24 cor-fff">{{ nowPrice }}</text></text>
|
<text class="cor-fff fs14">¥<text class="fs24 cor-fff">{{ nowPrice }}</text></text>
|
||||||
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
|
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
|
||||||
@@ -96,10 +99,12 @@
|
|||||||
order: {
|
order: {
|
||||||
money: 0,
|
money: 0,
|
||||||
description: '会员充值'
|
description: '会员充值'
|
||||||
}
|
},
|
||||||
|
isIOS: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(op) {
|
onLoad(op) {
|
||||||
|
this.isIOS = this.$platform.device().includes('ios')
|
||||||
if (op.subject) {
|
if (op.subject) {
|
||||||
this.subject = op.subject
|
this.subject = op.subject
|
||||||
}
|
}
|
||||||
@@ -184,10 +189,12 @@
|
|||||||
border-radius: 16rpx 46rpx 16rpx 16rpx;
|
border-radius: 16rpx 46rpx 16rpx 16rpx;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checked_item {
|
.checked_item {
|
||||||
background: #FFF0E5;
|
background: #FFF0E5;
|
||||||
border: 4px solid #FF6E02;
|
border: 4px solid #FF6E02;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom_box {
|
.bottom_box {
|
||||||
width: 214rpx;
|
width: 214rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
@@ -199,12 +206,14 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checked_bottom {
|
.checked_bottom {
|
||||||
width: 218rpx;
|
width: 218rpx;
|
||||||
border-radius: 0 0 16rpx 5rpx;
|
border-radius: 0 0 16rpx 5rpx;
|
||||||
background-color: #FF6E02;
|
background-color: #FF6E02;
|
||||||
color: #fff
|
color: #fff
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
@@ -218,6 +227,7 @@
|
|||||||
left: 10rpx;
|
left: 10rpx;
|
||||||
top: -18rpx
|
top: -18rpx
|
||||||
}
|
}
|
||||||
|
|
||||||
.intr_box {
|
.intr_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -225,6 +235,7 @@
|
|||||||
background: #FFF0E5;
|
background: #FFF0E5;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vip_item {
|
.vip_item {
|
||||||
width: 208rpx;
|
width: 208rpx;
|
||||||
height: 54rpx;
|
height: 54rpx;
|
||||||
@@ -234,6 +245,7 @@
|
|||||||
background: #F3D7C2;
|
background: #F3D7C2;
|
||||||
border-radius: 0rpx 10rpx 10rpx 10rpx;
|
border-radius: 0rpx 10rpx 10rpx 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_btn {
|
.sub_btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
@@ -243,6 +255,7 @@
|
|||||||
border-radius: 55rpx;
|
border-radius: 55rpx;
|
||||||
padding: 14rpx;
|
padding: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contain-box {
|
.contain-box {
|
||||||
width: 344rpx;
|
width: 344rpx;
|
||||||
height: 196rpx;
|
height: 196rpx;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
login
|
login
|
||||||
} from '@/jtools/api/login'
|
} from '@/jtools/api/login'
|
||||||
import useUserStore from '@/jtools/store/user'
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -80,7 +81,11 @@
|
|||||||
},
|
},
|
||||||
bindLogin() {
|
bindLogin() {
|
||||||
if (isPhone(this.login.phone) && this.login.code) {
|
if (isPhone(this.login.phone) && this.login.code) {
|
||||||
useUserStore().login(this.login).then(resp => {
|
let params = { ...this.login }
|
||||||
|
if (storage.get('companyId')) {
|
||||||
|
params.id = storage.get('companyId')
|
||||||
|
}
|
||||||
|
useUserStore().login(params).then(resp => {
|
||||||
if (resp.userId) {
|
if (resp.userId) {
|
||||||
useUserStore().getUserInfo()
|
useUserStore().getUserInfo()
|
||||||
useUserStore().searchUserVip()
|
useUserStore().searchUserVip()
|
||||||
@@ -160,5 +165,4 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<view v-if="!isLogin || !vipOn.length" class="text-center">
|
<view v-if="!isLogin || !vipOn.length" class="text-center">
|
||||||
<view class="fs18 fwb" style="color: #7E4012FF;">开通VIP尊享以下权益</view>
|
<view class="fs18 fwb" style="color: #7E4012FF;">开通VIP尊享以下权益</view>
|
||||||
<view class="fs15" style="color: #7E4012FF;">精选500题 / 真是模考 / 考前密卷</view>
|
<view class="fs15" style="color: #7E4012FF;">精选500题 / 真是模考 / 考前密卷</view>
|
||||||
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">立即开通</view>
|
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">{{ isIOS ? 'iOS暂不可用' : '立即开通' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="vipOn.length" class="text-center">
|
<view v-else-if="vipOn.length" class="text-center">
|
||||||
<view class="fs18 fwb" style="color: #7E4012FF;">{{ vipText }}</view>
|
<view class="fs18 fwb" style="color: #7E4012FF;">{{ vipText }}</view>
|
||||||
@@ -137,10 +137,12 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
carName:storage.get('carName') || '小车C1/C2/C3'
|
carName: storage.get('carName') || '小车C1/C2/C3',
|
||||||
|
isIOS: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
this.isIOS = this.$platform.device().includes('ios')
|
||||||
this.carName = storage.get('carName') || '小车C1/C2/C3'
|
this.carName = storage.get('carName') || '小车C1/C2/C3'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -150,6 +152,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleVip() {
|
handleVip() {
|
||||||
|
if (this.isIOS) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.isLogin) {
|
if (this.isLogin) {
|
||||||
// if (this.vipOn.length) {
|
// if (this.vipOn.length) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
Reference in New Issue
Block a user