dev-hxf
脆皮鸭 11 months ago
commit 79236493e6
  1. 12
      src/App.vue
  2. 47
      src/jtools/store/user.js
  3. 19
      src/pages/index/videoVip.vue
  4. 8
      src/pages/login/login.vue
  5. 9
      src/pages/me/index.vue

@ -1,8 +1,13 @@
<script>
import useUserStore from '@/jtools/store/user'
import useQuestionStore from '@/jtools/store/question' //store
import storage from './jtools/storage'
export default {
onLaunch: function () {
onLaunch: function (options) {
// id
if (options.query?.scene) {
storage.set('companyId', options.query?.scene)
}
useUserStore().queryVipList()
if (useUserStore().isLogin) {
useUserStore().getUserInfo()
@ -23,5 +28,8 @@ export default {
/*每个页面公共css */
@import "uni_modules/uview-plus/index.scss";
@import "static/style/index.scss";
button::after{ border: none;}
button::after {
border: none;
}
</style>

@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
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 storage from '@/jtools/storage';
@ -23,10 +23,11 @@ const useUserStore = defineStore({
// 保存登录信息,用于重新登录
this.isLogin = true;
this.token = resp.data.token;
this.userInfo = resp.data
storage.set('isLogin', true)
storage.set('token', resp.data.token)
storage.set('userInfo', resp.data)
this.userInfo = resp.data;
storage.set('isLogin', true);
storage.set('token', resp.data.token);
storage.set('userInfo', resp.data);
storage.remove('companyId');
resolve(resp.data);
} else {
reject();
@ -39,53 +40,53 @@ const useUserStore = defineStore({
this.resetUserData();
uni.redirectTo({
url: '/pages/login/login'
})
});
resolve();
})
});
},
//过期登出
logoutWithoutToken(force = false) {
return new Promise((resolve, reject) => {
this.resetUserData();
resolve();
})
});
},
// 获取用户信息
getUserInfo() {
getInfo().then(resp => {
if (resp.code == '0000') {
this.userInfo = resp.data
storage.set('userInfo', resp.data)
this.userInfo = resp.data;
storage.set('userInfo', resp.data);
}
})
});
},
resetUserData() {
this.isLogin = false;
this.token = '';
this.userInfo = {}
this.vipOnList = []
storage.remove('isLogin')
storage.remove('token')
storage.remove('userInfo')
this.userInfo = {};
this.vipOnList = [];
storage.remove('isLogin');
storage.remove('token');
storage.remove('userInfo');
},
// 查询当前用户的vip开通情况
async searchUserVip() {
this.currentCartype=storage.get('carType') || '1001'
const resp=await queryVip({ carTypeId: this.currentCartype,memberId: null, subject:'' })
this.currentCartype = storage.get('carType') || '1001';
const resp = await queryVip({ carTypeId: this.currentCartype, memberId: null, subject: '' });
if (resp.code == '0000') {
this.vipOnList = resp.data
this.vipOnList = resp.data;
}
},
// 查询所有的vip
queryVipList() {
this.currentCartype= storage.get('carType') || '1001'
this.currentCartype = storage.get('carType') || '1001';
getVipList({ carTypeId: this.currentCartype, memberId: null, subject: '' }).then(resp => {
if (resp.code == '0000') {
this.vipAllList = resp.data
this.vipAllList = resp.data;
}
});
}
})
}
},
});
export default useUserStore;

@ -7,10 +7,13 @@
<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)">
<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="fs30 fw600" style="color: #FF6E02;">{{ item.price }}</text>
</view>
<view v-else class="mt5">
<text class="fs14" style="color: #FF6E02;">iOS暂不支持</text>
</view>
<text class="fs12 cor-999">一年有效</text>
<!-- <view class="bottom_box fs12 cor-333" :class="checkedId===item.memberId?'checked_bottom':''">赠送vip题库</view> -->
<view class="tag" v-if="item.all">
@ -64,7 +67,7 @@
</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">
<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>
@ -96,10 +99,12 @@
order: {
money: 0,
description: '会员充值'
}
},
isIOS: true
}
},
onLoad(op) {
this.isIOS = this.$platform.device().includes('ios')
if (op.subject) {
this.subject = op.subject
}
@ -184,10 +189,12 @@
border-radius: 16rpx 46rpx 16rpx 16rpx;
padding: 14px;
}
.checked_item {
background: #FFF0E5;
border: 4px solid #FF6E02;
}
.bottom_box {
width: 214rpx;
height: 40rpx;
@ -199,12 +206,14 @@
bottom: 0;
left: 0;
}
.checked_bottom {
width: 218rpx;
border-radius: 0 0 16rpx 5rpx;
background-color: #FF6E02;
color: #fff
}
.tag {
padding: 0 5px;
height: 36rpx;
@ -218,6 +227,7 @@
left: 10rpx;
top: -18rpx
}
.intr_box {
width: 100%;
text-align: center;
@ -225,6 +235,7 @@
background: #FFF0E5;
border-radius: 16rpx;
}
.vip_item {
width: 208rpx;
height: 54rpx;
@ -234,6 +245,7 @@
background: #F3D7C2;
border-radius: 0rpx 10rpx 10rpx 10rpx;
}
.sub_btn {
width: 100%;
height: 110rpx;
@ -243,6 +255,7 @@
border-radius: 55rpx;
padding: 14rpx;
}
.contain-box {
width: 344rpx;
height: 196rpx;

@ -35,6 +35,7 @@
login
} from '@/jtools/api/login'
import useUserStore from '@/jtools/store/user'
import storage from '@/jtools/storage';
export default {
data() {
return {
@ -80,7 +81,11 @@
},
bindLogin() {
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) {
useUserStore().getUserInfo()
useUserStore().searchUserVip()
@ -160,5 +165,4 @@
margin-left: auto;
margin-right: auto;
}
</style>

@ -40,7 +40,7 @@
<view v-if="!isLogin || !vipOn.length" class="text-center">
<view class="fs18 fwb" style="color: #7E4012FF;">开通VIP尊享以下权益</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 v-else-if="vipOn.length" class="text-center">
<view class="fs18 fwb" style="color: #7E4012FF;">{{ vipText }}</view>
@ -137,10 +137,12 @@ export default {
},
data() {
return {
carName:storage.get('carName') || '小车C1/C2/C3'
carName: storage.get('carName') || '小车C1/C2/C3',
isIOS: true
}
},
onShow() {
this.isIOS = this.$platform.device().includes('ios')
this.carName = storage.get('carName') || '小车C1/C2/C3'
},
methods: {
@ -150,6 +152,9 @@ export default {
})
},
handleVip() {
if (this.isIOS) {
return
}
if (this.isLogin) {
// if (this.vipOn.length) {
uni.navigateTo({

Loading…
Cancel
Save