重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
const userApi = require('../../api/user')
|
||||
const navigation = require('../../utils/navigation')
|
||||
const theme = require('../../utils/theme')
|
||||
|
||||
Page({
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
loading: false,
|
||||
contact: null
|
||||
}),
|
||||
|
||||
onShow() {
|
||||
this.loadContact()
|
||||
},
|
||||
|
||||
handleBack() {
|
||||
navigation.goBack('/pages/profile/index')
|
||||
},
|
||||
|
||||
async loadContact() {
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const contact = await userApi.getPlatformContact()
|
||||
this.setData({ contact })
|
||||
} catch (error) {
|
||||
this.setData({ contact: null })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
openRoute(event) {
|
||||
const route = event.currentTarget.dataset.route
|
||||
const pureRoute = String(route || '').split('?')[0]
|
||||
if (navigation.isTabPage(pureRoute)) {
|
||||
navigation.switchTab(pureRoute)
|
||||
return
|
||||
}
|
||||
navigation.navigate(route)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user