|
|
@ -2,6 +2,7 @@ |
|
|
import { getBaseInfo, getBalanceInfo } from "../../api/saas" |
|
|
import { getBaseInfo, getBalanceInfo } from "../../api/saas" |
|
|
const util = require('../../../utils/util') |
|
|
const util = require('../../../utils/util') |
|
|
const math = require('../../../utils/math') |
|
|
const math = require('../../../utils/math') |
|
|
|
|
|
const event = require('../../../utils/event') |
|
|
const app = getApp() |
|
|
const app = getApp() |
|
|
|
|
|
|
|
|
Component({ |
|
|
Component({ |
|
|
@ -9,6 +10,15 @@ Component({ |
|
|
addGlobalClass: true, |
|
|
addGlobalClass: true, |
|
|
multipleSlots: true |
|
|
multipleSlots: true |
|
|
}, |
|
|
}, |
|
|
|
|
|
lifetimes: { |
|
|
|
|
|
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
|
|
|
|
attached: function () { |
|
|
|
|
|
event.on('EventMessage', this, this.onEvent) |
|
|
|
|
|
}, |
|
|
|
|
|
detached: function () { |
|
|
|
|
|
event.remove('EventMessage', this) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* 页面的初始数据 |
|
|
* 页面的初始数据 |
|
|
*/ |
|
|
*/ |
|
|
@ -16,6 +26,7 @@ Component({ |
|
|
firstShow: false, |
|
|
firstShow: false, |
|
|
token: app.globalData.token, |
|
|
token: app.globalData.token, |
|
|
userInfo: null, |
|
|
userInfo: null, |
|
|
|
|
|
userName: null, |
|
|
avatarUrl: null, |
|
|
avatarUrl: null, |
|
|
accountMoney: 0 |
|
|
accountMoney: 0 |
|
|
}, |
|
|
}, |
|
|
@ -25,6 +36,9 @@ Component({ |
|
|
this.data.firstShow = true |
|
|
this.data.firstShow = true |
|
|
}, |
|
|
}, |
|
|
fetchUserInfo: function () { |
|
|
fetchUserInfo: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
getBaseInfo().then(result => { |
|
|
getBaseInfo().then(result => { |
|
|
app.globalData.userInfo = result.data |
|
|
app.globalData.userInfo = result.data |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
@ -39,10 +53,23 @@ Component({ |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
onEvent: function (message) { |
|
|
|
|
|
if (message.what == 888) { |
|
|
|
|
|
this.setData({ userInfo: app.globalData.userInfo, accountMoney: 0, avatarUrl: '/assets/image/ygImg.png', userName: null }) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
checkout: function () { |
|
|
checkout: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
wx.navigateTo({ url: '/pages/withdrawal/checkout/index' }) |
|
|
wx.navigateTo({ url: '/pages/withdrawal/checkout/index' }) |
|
|
}, |
|
|
}, |
|
|
toUserInfo: function () { |
|
|
toUserInfo: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ |
|
|
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ |
|
|
wx.navigateTo({ url: '/pages/home/pauthory/index' }) |
|
|
wx.navigateTo({ url: '/pages/home/pauthory/index' }) |
|
|
} else { |
|
|
} else { |
|
|
@ -50,11 +77,43 @@ Component({ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
toAuthor: function () { |
|
|
toAuthor: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ |
|
|
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ |
|
|
wx.navigateTo({ url: '/pages/home/pauthory/index' }) |
|
|
wx.navigateTo({ url: '/pages/home/pauthory/index' }) |
|
|
} else { |
|
|
} else { |
|
|
wx.navigateTo({ url: '/pages/home/pinfo/index' }) |
|
|
wx.navigateTo({ url: '/pages/home/pinfo/index' }) |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
toBankCard: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
wx.navigateTo({ url: '/pages/bank/index/index' }) |
|
|
|
|
|
}, |
|
|
|
|
|
toWithdrawal: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
wx.navigateTo({ url: '/pages/withdrawal/index/index' }) |
|
|
|
|
|
}, |
|
|
|
|
|
toBalance: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
wx.navigateTo({ url: '/pages/balance/index/index' }) |
|
|
|
|
|
}, |
|
|
|
|
|
toSetting: function () { |
|
|
|
|
|
if(!app.globalData.userInfo){ |
|
|
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
wx.navigateTo({ url: '/pages/home/setting/index' }) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |