多模块重构 12:修改项目名字,按照新的规则

This commit is contained in:
YunaiV
2022-02-02 22:33:39 +08:00
parent 352a67c530
commit 0773a4c4d7
1040 changed files with 12 additions and 190 deletions

View File

@ -0,0 +1,73 @@
export default{
// #ifdef APP-PLUS
methods: {
/**
* 微信App登录
* "openId": "o0yywwGWxtBCvBuE8vH4Naof0cqU",
* "nickName": "S .",
* "gender": 1,
* "city": "临沂",
* "province": "山东",
* "country": "中国",
* "avatarUrl": "http://thirdwx.qlogo.cn/mmopen/vi_32/xqpCtHRBBmdlf201Fykhtx7P7JcicIbgV3Weic1oOvN6iaR3tEbuu74f2fkKQWXvzK3VDgNTZzgf0g8FqPvq8LCNQ/132",
* "unionId": "oYqy4wmMcs78x9P-tsyMeM3MQ1PU"
*/
loginByWxApp(userInfoData){
if(!this.agreement){
this.$util.msg('请阅读并同意用户服务及隐私协议');
return;
}
this.$util.throttle(async ()=>{
let [err, res] = await uni.login({
provider: 'weixin'
})
if(err){
console.log(err);
return;
}
uni.getUserInfo({
provider: 'weixin',
success: async res=>{
const response = await this.$request('user', 'loginByWeixin', {
userInfo: res.userInfo,
}, {
showLoading: true
});
if(response.status === 0){
this.$util.msg(response.msg);
return;
}
if(response.hasBindMobile && response.data.token){
this.loginSuccessCallBack({
token: response.data.token,
tokenExpired: response.data.tokenExpired
});
}else{
this.navTo('/pages/auth/bindMobile?data='+JSON.stringify(response.data))
}
plus.oauth.getServices(oauthRes=>{
oauthRes[0].logout(logoutRes => {
console.log(logoutRes);
}, error => {
console.log(error);
})
})
},
fail(err) {
console.log(err);
}
})
})
}
}
// #endif
}

View File

@ -0,0 +1,81 @@
export default{
// #ifdef MP-WEIXIN
data(){
return {
mpCodeTimer: 0,
mpWxCode: '',
}
},
computed: {
timerIdent(){
return this.$store.state.timerIdent;
}
},
watch: {
timerIdent(){
this.mpCodeTimer ++;
if(this.mpCodeTimer % 30 === 0){
this.getMpWxCode();
}
}
},
onShow(){
this.getMpWxCode();
},
methods: {
//微信小程序登录
mpWxGetUserInfo(){
if(!this.agreement){
this.$util.msg('请阅读并同意用户服务及隐私协议');
return;
}
this.$util.throttle(()=>{
uni.getUserProfile({
desc: '用于展示您的头像及昵称',
success: async profileRes=> {
const res = await this.$request('user', 'loginByWeixin', {
code: this.mpWxCode,
...profileRes.userInfo
}, {
showLoading: true
});
if(res.status === 0){
this.$util.msg(res.msg);
return;
}
if(res.hasBindMobile && res.data.token){
this.loginSuccessCallBack({
token: res.data.token,
tokenExpired: res.data.tokenExpired
});
}else{
this.navTo('/pages/auth/bindMobile?data='+JSON.stringify(res.data))
}
console.log(res)
}
})
})
},
//获取code
getMpWxCode(){
uni.login({
provider: 'weixin',
success: res=> {
this.mpWxCode = res.code;
}
})
},
}
// #endif
}