|
|
|
@ -2,7 +2,7 @@ import { config, getUserInfo} from "../api/user" |
|
|
|
import { zconfig, loginToken, getPopupInfo } from "../api/ztb" |
|
|
|
import { pconfig } from "../api/payment" |
|
|
|
import { mconfig } from "../api/moment" |
|
|
|
import { sconfig } from "../api/saas" |
|
|
|
import { sconfig, getOrderExists } from "../api/saas" |
|
|
|
const util = require('../../utils/util') |
|
|
|
const event = require('../../utils/event') |
|
|
|
const storage = require('../../utils/storage') |
|
|
|
@ -104,46 +104,53 @@ Page({ |
|
|
|
wx.hideLoading() |
|
|
|
}) |
|
|
|
}, |
|
|
|
defaultIndex: function(){ |
|
|
|
this.onResume() |
|
|
|
if(this.data.path){ |
|
|
|
wx.navigateTo({ url: this.data.path }) |
|
|
|
} |
|
|
|
getPopupInfo().then(result => { |
|
|
|
if(result.data){ |
|
|
|
this.setData({ landInfo: result.data }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
toIndex: function(){ |
|
|
|
if(!app.globalData.token){ |
|
|
|
wx.hideLoading() |
|
|
|
this.onResume() |
|
|
|
if(this.data.path){ |
|
|
|
wx.navigateTo({ url: this.data.path }) |
|
|
|
} |
|
|
|
getPopupInfo().then(result => { |
|
|
|
if(result.data){ |
|
|
|
this.setData({ landInfo: result.data }) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.defaultIndex() |
|
|
|
return |
|
|
|
} |
|
|
|
loginToken({loginToken: app.globalData.token}).then(result => { |
|
|
|
zconfig.header = { 'Authorization': 'QNT ' + result.data.token } |
|
|
|
pconfig.header = { 'Authorization': 'QNT ' + result.data.token } |
|
|
|
mconfig.header = { 'Authorization': 'QNT ' + result.data.token } |
|
|
|
// pconfig.header = { 'Authorization': 'QNT ' + result.data }
|
|
|
|
|
|
|
|
// 登录流程完成;
|
|
|
|
if(!util.isEmpty(result.data.userToken)){ |
|
|
|
this.handleUserToken(result.data.userToken) |
|
|
|
return |
|
|
|
} |
|
|
|
wx.hideLoading() |
|
|
|
this.onResume() |
|
|
|
if(this.data.path){ |
|
|
|
wx.navigateTo({ url: this.data.path }) |
|
|
|
} |
|
|
|
getPopupInfo().then(result => { |
|
|
|
if(result.data){ |
|
|
|
this.setData({ landInfo: result.data }) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.defaultIndex() |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |
|
|
|
this.onResume() |
|
|
|
if(this.data.path){ |
|
|
|
wx.navigateTo({ url: this.data.path }) |
|
|
|
this.defaultIndex() |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleUserToken: function(userToken){ |
|
|
|
sconfig.header = {'user-token': userToken } |
|
|
|
getOrderExists().then(result => { |
|
|
|
wx.hideLoading() |
|
|
|
if (Number(result.data) != 1 || !app.release) { |
|
|
|
wx.navigateBack() |
|
|
|
} else { |
|
|
|
wx.reLaunch({ url: '/pages/paper/index' }) |
|
|
|
} |
|
|
|
getPopupInfo().then(result => { |
|
|
|
if(result.data){ |
|
|
|
this.setData({ landInfo: result.data }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |
|
|
|
util.showToast(err) |
|
|
|
this.defaultIndex() |
|
|
|
}) |
|
|
|
}, |
|
|
|
onResume: function(){ |
|
|
|
|