|
@@ -186,47 +186,54 @@
|
|
|
});
|
|
|
const inviteUserId = uni.getStorageSync('inviteCode') == 'undefined' ? null : uni.getStorageSync('inviteCode')
|
|
|
getLoginToken({phoneNum:this.userInfo.phoneNum,platformType:1,inviteUserId}).then(res=>{
|
|
|
- let userInfo = this.userInfo
|
|
|
- userInfo.loginToken = res.content
|
|
|
- if(res.state != 'Success') return
|
|
|
- validLogin(this.userInfo).then(res=>{
|
|
|
- uni.hideLoading()
|
|
|
- if(res.state == 'Success'){
|
|
|
- uni.setStorageSync('isAuth', res.content
|
|
|
- .isAuth) //登录状态
|
|
|
- uni.setStorageSync('token', res.content
|
|
|
- .token) //登录状态
|
|
|
- uni.setStorageSync('refreshToken', res.content
|
|
|
- .refreshToken) //refreshToken
|
|
|
- getUserDetail().then(res => {
|
|
|
- uni.setStorageSync('userInfo', JSON.stringify(res.content))
|
|
|
- if(this.redirect){
|
|
|
- uni.reLaunch({
|
|
|
- // url:`${this.redirect}?scene=${this.scene}&id=${this.id}`
|
|
|
- url:`${this.redirect}?${this.params}`
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.reLaunch({
|
|
|
- url: '../../pages/index/index'
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success(r) {
|
|
|
+ let userInfo = that.userInfo
|
|
|
+ userInfo.loginToken = res.content
|
|
|
+ userInfo.scene = inviteUserId
|
|
|
+ userInfo.jsCode = r.code
|
|
|
+ if(res.state != 'Success') return
|
|
|
+ validLogin(userInfo).then(res=>{
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.state == 'Success'){
|
|
|
+ uni.setStorageSync('isAuth', res.content
|
|
|
+ .isAuth) //登录状态
|
|
|
+ uni.setStorageSync('token', res.content
|
|
|
+ .token) //登录状态
|
|
|
+ uni.setStorageSync('refreshToken', res.content
|
|
|
+ .refreshToken) //refreshToken
|
|
|
+ getUserDetail().then(res => {
|
|
|
+ uni.setStorageSync('userInfo', JSON.stringify(res.content))
|
|
|
+ if(that.redirect){
|
|
|
+ uni.reLaunch({
|
|
|
+ // url:`${that.redirect}?scene=${that.scene}&id=${that.id}`
|
|
|
+ url:`${that.redirect}?${that.params}`
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '../../pages/index/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // if (res.content.isAuth == 1) {
|
|
|
+ // if(that.redirect && that.redirect != "undefined"){
|
|
|
+ // uni.reLaunch({
|
|
|
+ // // url:`${that.redirect}?scene=${that.scene}&id=${that.id}`
|
|
|
+ // url:`${that.redirect}?${that.params}`
|
|
|
+ // })
|
|
|
+ // }else{
|
|
|
+ // uni.switchTab({
|
|
|
+ // url: '../../pages/index/index'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // } else { //未实名认证
|
|
|
+ // that.show = true
|
|
|
+ // }
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- // if (res.content.isAuth == 1) {
|
|
|
- // if(that.redirect && that.redirect != "undefined"){
|
|
|
- // uni.reLaunch({
|
|
|
- // // url:`${that.redirect}?scene=${that.scene}&id=${that.id}`
|
|
|
- // url:`${that.redirect}?${that.params}`
|
|
|
- // })
|
|
|
- // }else{
|
|
|
- // uni.switchTab({
|
|
|
- // url: '../../pages/index/index'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // } else { //未实名认证
|
|
|
- // that.show = true
|
|
|
- // }
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
})
|