|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
// 判断Openid是否为空
|
|
|
- if(!this.$isDataEmpty(option)){
|
|
|
+ if(option != undefined){
|
|
|
this.userInfo = JSON.parse(option.data);
|
|
|
}
|
|
|
},
|
|
|
@@ -133,16 +133,14 @@ export default {
|
|
|
wechatRegister(){
|
|
|
const that = this;
|
|
|
// 新微信新手机注册账号
|
|
|
- wechatRegister(null,{data:this.userInfo}).then((res)=>{
|
|
|
- console.log(res)
|
|
|
- console.log(res.access_token)
|
|
|
- if(!this.$isDataEmpty(res.access_token)){
|
|
|
- that.setUserData(res);
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: "用户注册失败"
|
|
|
- })
|
|
|
- }
|
|
|
+ this.$api.wechatRegister({...this.userInfo}).then((res)=>{
|
|
|
+ if(res.data.code == 200){
|
|
|
+ that.setUserData(res);
|
|
|
+ }else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "用户注册失败"
|
|
|
+ })
|
|
|
+ }
|
|
|
}).catch(() =>{
|
|
|
uni.showToast({
|
|
|
title: "操作失败"
|
|
|
@@ -150,17 +148,16 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
realNameAuthLogin(){
|
|
|
+ const that = this;
|
|
|
// 新微信老手机注册账号
|
|
|
- realNameAuthLogin(null,{data:this.userInfo}).then((res)=>{
|
|
|
- console.log(res)
|
|
|
- console.log(res.access_token)
|
|
|
- if(!this.$isDataEmpty(res.access_token)){
|
|
|
- that.setUserData(res);
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: "用户注册失败"
|
|
|
- })
|
|
|
- }
|
|
|
+ this.$api.realNameAuthLogin({...this.userInfo}).then((res)=>{
|
|
|
+ if(res.data.code == 200){
|
|
|
+ that.setUserData(res);
|
|
|
+ }else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "用户注册失败"
|
|
|
+ })
|
|
|
+ }
|
|
|
}).catch(() =>{
|
|
|
uni.showToast({
|
|
|
title: "操作失败"
|
|
|
@@ -174,15 +171,12 @@ export default {
|
|
|
accessToken: ""
|
|
|
}
|
|
|
// 数据获取token
|
|
|
- loginState.accessToken = res.access_token;
|
|
|
+ loginState.accessToken = res.data.access_token;
|
|
|
this.$store.commit('updateLoginState', loginState);
|
|
|
- this.$store.commit('updateLoginUserInfo', res.userInfo)
|
|
|
- uni.$u.route({
|
|
|
- url: '/pages/index/tabbar',
|
|
|
- params: {
|
|
|
- PageCur: 'index'
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$store.commit('updateLoginUserInfo', res.data.userInfo)
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/index/index',
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
}
|