|
@@ -80,45 +80,11 @@
|
|
|
|
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState(['hasLogin','userInfo','identity','isActivity'])
|
|
|
|
|
|
+ ...mapState(['hasLogin','userInfo','identity','isActivity','isWxAuthorize'])
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(['login','logout']),
|
|
...mapMutations(['login','logout']),
|
|
- GetWxAuthorize(){
|
|
|
|
- authorize.getCode('weixin').then(wechatcode =>{// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
|
|
|
|
- authorize.getUserInfo('weixin').then(getUserInfo =>{
|
|
|
|
- this.UserService.UserLoginAuthApplets({
|
|
|
|
- code:wechatcode,
|
|
|
|
- encryptedData:getUserInfo.encryptedData,
|
|
|
|
- iv:getUserInfo.iv ,
|
|
|
|
- })
|
|
|
|
- .then(response =>{
|
|
|
|
- this.isLogin = true;
|
|
|
|
- this.userID = response.data.userId;
|
|
|
|
- this.userIdentity = response.data.userIdentity;
|
|
|
|
- this.clubStatus = response.data.clubStatus;
|
|
|
|
- this.$store.commit('updateStatus',response.data)
|
|
|
|
- this.login(response.data);
|
|
|
|
- uni.setStorageSync('token',response.data.token)
|
|
|
|
- uni.setStorageSync('unionId',response.data.unionId)
|
|
|
|
- if(response.data.userIdentity ==1){
|
|
|
|
- this.$api.redirectTo('/seller/pages/index/index')
|
|
|
|
- }else if(response.data.userIdentity === 3){
|
|
|
|
- this.$api.redirectTo('/supplier/pages/index/index')
|
|
|
|
- }
|
|
|
|
- this.getHomeInformation()
|
|
|
|
- })
|
|
|
|
- .catch(error =>{
|
|
|
|
- this.isLogin = false;
|
|
|
|
- this.logout()
|
|
|
|
- uni.setStorageSync('unionId',error.data.unionId)
|
|
|
|
- this.$store.commit('updateStatus',error.data)
|
|
|
|
- this.getHomeInformation()
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- async getWxAuthorize(){
|
|
|
|
|
|
+ async GetWxAuthorize(){
|
|
const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
|
|
const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
|
|
const getUserInfo = await authorize.getUserInfo('weixin');
|
|
const getUserInfo = await authorize.getUserInfo('weixin');
|
|
this.UserService.UserLoginAuthApplets({
|
|
this.UserService.UserLoginAuthApplets({
|
|
@@ -203,19 +169,17 @@
|
|
uni.setStorageSync('lockTime',Date.now())
|
|
uni.setStorageSync('lockTime',Date.now())
|
|
uni.setStorageSync('isActivityStatus',true)
|
|
uni.setStorageSync('isActivityStatus',true)
|
|
},
|
|
},
|
|
- async InitAuthorize(){ //是否已授权 0:为取消授权 1:为已授权 2:为未操作
|
|
|
|
- authorize.checkLogin()
|
|
|
|
- .then(res => {
|
|
|
|
|
|
+ InitAuthorize(){ //是否已授权
|
|
|
|
+ if(this.isWxAuthorize){
|
|
this.GetWxAuthorize()
|
|
this.GetWxAuthorize()
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
|
|
+ }else{
|
|
this.$api.getComStorage('userInfo').then((resolve) =>{
|
|
this.$api.getComStorage('userInfo').then((resolve) =>{
|
|
this.userID = resolve.userId ? resolve.userId :0;
|
|
this.userID = resolve.userId ? resolve.userId :0;
|
|
this.getHomeInformation()
|
|
this.getHomeInformation()
|
|
}).catch(error =>{
|
|
}).catch(error =>{
|
|
this.getHomeInformation()
|
|
this.getHomeInformation()
|
|
})
|
|
})
|
|
- })
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onPageScroll(e){//实时获取到滚动的值
|
|
onPageScroll(e){//实时获取到滚动的值
|