增加:强制绑定手机号功能

This commit is contained in:
wuhui_zzw 2024-05-31 10:19:09 +08:00
parent 0dbfd12c82
commit f393e8aba4
3 changed files with 48 additions and 22 deletions

12
App.vue
View File

@ -203,8 +203,16 @@
// #ifdef H5
this.setOpenShare(res.data);
// #endif
}).catch(err => {});
//
if(this.globalData.is_phone_login == 1 && checkLogin()) {
this.$util.isBindPhone();
}
}).catch(err => {});
},
},
onHide: function() {
//console.log('App Hide')
@ -219,7 +227,7 @@
}).then(() => {});
}
},
}
},
}
</script>
<style lang="scss">

View File

@ -41,10 +41,6 @@
<view class="text1">昵称</view>
<input type="nickname" class="weui-input" :value="nickname" placeholder="请输入昵称" @change="changeNickname"/>
</view>
</view>
</view>
<!--#endif-->
@ -134,6 +130,8 @@
//
avatar: '',
nickname: '',
is_trigger: true,
}
},
computed: {
@ -142,7 +140,8 @@
},
watch: {
isLogin(n) {
n === true && this.$emit('onLoadFun', this.userInfo);
// n === true && this.$emit('onLoadFun', this.userInfo);
n === true && this.runOnLoadFun(this.userInfo);
},
isShowAuth(n) {
this.getCode(this.isShowAuth)
@ -179,7 +178,9 @@
self.$store.commit('SETUID', res.data.result.user.uid);
Cache.set(EXPIRES_TIME,res.data.result.expires_time,time);
Cache.set(USER_INFO,res.data.result.user,time);
self.$emit('onLoadFun', res.data.result.user);
self.runOnLoadFun(res.data.result.user);
// self.$emit('onLoadFun', res.data.result.user);
if(res.data.result.user.isNew && self.mp_is_new && self.first_avatar_switch==1 && self.wechat_phone_switch == 1){
self.editModal = true;
}
@ -206,7 +207,8 @@
// #ifdef MP
editSuccess() {
this.editModal = false
this.$emit('onLoadFun', this.userInfo);
// this.$emit('onLoadFun', this.userInfo);
this.runOnLoadFun(this.userInfo);
},
closeEdit() {
this.editModal = false
@ -215,8 +217,8 @@
setAuthStatus() {
//#ifdef MP
Routine.authorize().then(res => {
if (res.islogin === false)
this.$emit('onLoadFun', this.userInfo);
if (res.islogin === false) this.runOnLoadFun(this.userInfo);
// this.$emit('onLoadFun', this.userInfo);
}).catch(res => {
if (this.isAuto)
this.$emit('authColse', true);
@ -288,8 +290,6 @@
// this.$emit('authColse', false);
// }
},
//
onChooseAvatar(e) {
const {avatarUrl} = e.detail
@ -301,6 +301,14 @@
},
changeNickname(e){
this.nickname = e.detail.value || e.target.value;
},
//
runOnLoadFun(userInfo){
if(this.isLogin && app.globalData.is_phone_login == 1 && this.is_trigger) {
this.is_trigger = false;
this.$util.isBindPhone();
}
this.$emit('onLoadFun', userInfo);
}
}

View File

@ -1,15 +1,13 @@
import {
TOKENNAME,
HTTP_REQUEST_URL
} from '../config/app.js';
import {TOKENNAME, HTTP_REQUEST_URL} from '../config/app.js';
import store from '../store';
import {
pathToBase64
} from '@/plugin/image-tools/index.js';
import { pathToBase64 } from '@/plugin/image-tools/index.js';
// #ifdef APP-PLUS
import permision from "./permission.js"
// #endif
import {getUserInfo} from '@/api/user.js';
export default {
/**
* 字符串截取
@ -1055,8 +1053,20 @@ export default {
};
return typeList[is_sys] || '门店';
},
// 判断:用户是否需要绑定手机号
isBindPhone(){
let _this = this;
getUserInfo().then(res => {
let data = res.data || {};
let phone = data.phone || '';
if(phone.length <= 0){
uni.navigateTo({
url: '/pages/users/user_phone/index'
})
}
});
}
}