|
@@ -89,6 +89,8 @@
|
|
|
count: '', //倒计时
|
|
|
mobileCodeText: '获取验证码',
|
|
|
codeTime: null,
|
|
|
+ nickName:'',
|
|
|
+ avatarUrl:'',
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
@@ -98,7 +100,7 @@
|
|
|
...mapState(['isWxAuthorize','isLoginType','isLoginProductId','isLoginOrderId'])
|
|
|
},
|
|
|
methods:{
|
|
|
- ...mapMutations(['login']),
|
|
|
+ ...mapMutations(['login','wxLogin']),
|
|
|
bindWechatInfo(){
|
|
|
if( this.bindLinkName == ''){
|
|
|
this.$util.msg('请输入姓名',2000)
|
|
@@ -120,7 +122,59 @@
|
|
|
this.$util.msg('验证码格式不正确',2000)
|
|
|
return
|
|
|
}
|
|
|
- this.bindingWechatLogin()
|
|
|
+ this.isUserInfo = false;
|
|
|
+ this.GetUserProfile()
|
|
|
+ },
|
|
|
+ GetUserProfile(){//获取用户微信个人信息
|
|
|
+ const self = this
|
|
|
+ wx.getUserProfile({
|
|
|
+ desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
+ success(res) {
|
|
|
+ console.log('微信获取用户信息新API',res)
|
|
|
+ self.wxLogin(res.userInfo)
|
|
|
+ self.nickName = res.userInfo.nickName
|
|
|
+ self.avatarUrl = res.userInfo.avatarUrl
|
|
|
+ self.BindingWechat()
|
|
|
+ },
|
|
|
+ fail() {
|
|
|
+ self.$util.msg('授权失败', 2000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ BindingWechat(){//绑定微信并登陆
|
|
|
+ this.UserService.BindingWechat(
|
|
|
+ {
|
|
|
+ userId:this.userId,
|
|
|
+ mobile:this.bindLinkPhone,
|
|
|
+ linkName:this.bindLinkName,
|
|
|
+ smsCode:this.smsCode,
|
|
|
+ unionId:this.unionId,
|
|
|
+ nickName:this.nickName,
|
|
|
+ avatarUrl:this.avatarUrl,
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(response =>{
|
|
|
+ if(this.userIdentity === 3){
|
|
|
+ this.$api.navigateTo('/supplier/pages/index/index')
|
|
|
+ }else{
|
|
|
+ switch(this.isLoginType){
|
|
|
+ case 9:
|
|
|
+ this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ this.$api.switchTabTo('/pages/tabBar/user/user')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error =>{
|
|
|
+ this.$util.msg(error.msg,2000)
|
|
|
+ })
|
|
|
},
|
|
|
getVerificationCode(){//图形验证
|
|
|
this.PublicService.GetImgVerifyCode().then(res => {
|
|
@@ -175,42 +229,6 @@
|
|
|
this.isMobileDisabled = false;
|
|
|
})
|
|
|
},
|
|
|
- bindingWechatLogin(){//获取用户基本信息登录
|
|
|
- const userInfo = uni.getStorageSync('wechatUserInfo')
|
|
|
- this.isUserInfo = false;
|
|
|
- let params ={
|
|
|
- userId:this.userId,
|
|
|
- mobile:this.bindLinkPhone,
|
|
|
- linkName:this.bindLinkName,
|
|
|
- smsCode:this.smsCode,
|
|
|
- unionId:this.unionId,
|
|
|
- nickName:userInfo.nickName,
|
|
|
- avatarUrl:userInfo.avatarUrl,
|
|
|
- }
|
|
|
- this.UserService.BindingWechat(params)
|
|
|
- .then(response =>{
|
|
|
- if(this.userIdentity === 3){
|
|
|
- this.$api.navigateTo('/supplier/pages/index/index')
|
|
|
- }else{
|
|
|
- switch(this.isLoginType){
|
|
|
- case 9:
|
|
|
- this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
|
|
|
- break;
|
|
|
- default:
|
|
|
- this.$api.switchTabTo('/pages/tabBar/user/user')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(error =>{
|
|
|
- this.$util.msg(error.msg,2000)
|
|
|
- })
|
|
|
- },
|
|
|
//关闭未授权用户授权提示弹窗
|
|
|
hideModel(){
|
|
|
this.isUserInfo = false;
|