Commit 8efb97a2 by 赵雅纹

登陆

parent 73af0c8c
...@@ -56,6 +56,7 @@ Component({ ...@@ -56,6 +56,7 @@ Component({
const userInfo = res.detail || {} const userInfo = res.detail || {}
if (res.detail.userInfo) { if (res.detail.userInfo) {
utils.getUserInfoByBtn(userInfo).then( (data = {} ) => { utils.getUserInfoByBtn(userInfo).then( (data = {} ) => {
console.log('----',data)
const {token} = data const {token} = data
wx.setStorageSync('_accreditUserInfo', userInfo) wx.setStorageSync('_accreditUserInfo', userInfo)
wx.hideNavigationBarLoading() wx.hideNavigationBarLoading()
......
...@@ -37,13 +37,18 @@ Component({ ...@@ -37,13 +37,18 @@ Component({
}, },
preview(e) { preview(e) {
const {appid, path} = e.currentTarget.dataset const {appid, path} = e.currentTarget.dataset
const {memberActivateStatus} = wx.getStorageSync('_baseUserInfo')
// 获取当前帐号信息 // 获取当前帐号信息
const accountInfo = utils.getAccountInfo() const accountInfo = utils.getAccountInfo()
const userInfo = wx.getStorageSync('_baseUserInfo') const userInfo = wx.getStorageSync('_baseUserInfo')
if (userInfo){ if (userInfo){
// 是当前小程序 直接跳转
if(accountInfo.miniProgram.appId == appid){ if(accountInfo.miniProgram.appId == appid){
if (!memberActivateStatus){
wxService.openCard()
}else{
wxService.router(`${path}`) wxService.router(`${path}`)
}
} else { } else {
// 跳转其他小程序 // 跳转其他小程序
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
...@@ -59,9 +64,10 @@ Component({ ...@@ -59,9 +64,10 @@ Component({
console.log(e) console.log(e)
}, },
}) })
} }
// 是当前小程序 直接跳转
}else{ }else{
console.log('222')
this.setData({ this.setData({
isAuthorization: true isAuthorization: true
}) })
......
...@@ -148,7 +148,7 @@ class Http { ...@@ -148,7 +148,7 @@ class Http {
content: '请求数据超时' content: '请求数据超时'
}) })
} }
if(error.msg){ if (error.msg && error.msg !='用户未登录'){
wx.showToast({ wx.showToast({
title: `${error.msg}`, title: `${error.msg}`,
icon: 'none' icon: 'none'
......
...@@ -47,15 +47,9 @@ class WXService extends Http { ...@@ -47,15 +47,9 @@ class WXService extends Http {
this.setPageLoadStatus() this.setPageLoadStatus()
wx.hideLoading() wx.hideLoading()
}).catch(res => { }).catch(res => {
console.log('res', res) console.log(res)
if (res.state === 401) { if (res.msg === '用户未登录') {
// this.openCard()
var _this = this var _this = this
wx.showModal({
title: '温馨提示',
content: '登录已过期,请重新登录',
success(res) {
if (res.confirm) {
let userInfo = wx.getStorageSync('_baseUserInfo') let userInfo = wx.getStorageSync('_baseUserInfo')
_this.login().then(result=>{ _this.login().then(result=>{
if(result.code){ if(result.code){
...@@ -63,22 +57,14 @@ class WXService extends Http { ...@@ -63,22 +57,14 @@ class WXService extends Http {
code: result.code, code: result.code,
wechatInfo: userInfo, wechatInfo: userInfo,
brandId: 2005, brandId: 2005,
}).then(data=>{ }).then(response=>{
const { token } = data let dataResp = response.data.data
if (token) { wx.setStorageSync('token', dataResp.token)
wx.setStorageSync('token', token) wx.setStorageSync('_baseUserInfo', dataResp)
} else {
wx.setStorageSync('token', '')
}
wx.setStorageSync('_baseUserInfo', data)
}) })
} }
}) })
} else if (res.cancel) {
}
}
})
} else if (res.state === 402) { } else if (res.state === 402) {
return this.getUserInfo().then(() => { return this.getUserInfo().then(() => {
if (!this.getUserInfoLimitCount) { if (!this.getUserInfoLimitCount) {
...@@ -508,6 +494,7 @@ class WXService extends Http { ...@@ -508,6 +494,7 @@ class WXService extends Http {
if(memberActivateStatus) { if(memberActivateStatus) {
resolve(baseUserInfo) resolve(baseUserInfo)
} else { } else {
console.log('开卡', baseUserInfo)
return this.navigateToMiniProgram({ return this.navigateToMiniProgram({
biz: baseUserInfo.biz, biz: baseUserInfo.biz,
encrypt_card_id: baseUserInfo.encryptCardId, encrypt_card_id: baseUserInfo.encryptCardId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment