feat(M08-C): 建立管理员房态运营入口
This commit is contained in:
@@ -7,6 +7,8 @@ Page({
|
||||
loading: false,
|
||||
errorMessage: '',
|
||||
stores: [],
|
||||
showManagerEntry: false,
|
||||
showCleanerEntry: false,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -15,6 +17,27 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.loadRoleEntrances()
|
||||
},
|
||||
|
||||
async loadRoleEntrances() {
|
||||
if (!wx.getStorageSync('qipai_access_token')) {
|
||||
this.setData({ showManagerEntry: false, showCleanerEntry: false })
|
||||
return
|
||||
}
|
||||
try {
|
||||
const response = await request('/auth/me')
|
||||
const roles = response.data?.access?.roles || []
|
||||
this.setData({
|
||||
showManagerEntry: roles.some((role) => ['STAFF', 'STORE_ADMIN', 'TENANT_ADMIN', 'PLATFORM_ADMIN'].includes(role)),
|
||||
showCleanerEntry: roles.includes('CLEANER'),
|
||||
})
|
||||
} catch (_) {
|
||||
this.setData({ showManagerEntry: false, showCleanerEntry: false })
|
||||
}
|
||||
},
|
||||
|
||||
onCityInput(event) {
|
||||
this.setData({ city: event.detail.value })
|
||||
},
|
||||
@@ -73,6 +96,14 @@ Page({
|
||||
wx.navigateTo({ url: '/pages/profile/index' })
|
||||
},
|
||||
|
||||
openManager() {
|
||||
wx.navigateTo({ url: '/pages/manager/dashboard' })
|
||||
},
|
||||
|
||||
openCleaner() {
|
||||
wx.navigateTo({ url: '/pages/cleaner/tasks' })
|
||||
},
|
||||
|
||||
async resolveScene(code, sourceType) {
|
||||
this.setData({ loading: true, errorMessage: '' })
|
||||
try {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<view class="quick-actions">
|
||||
<button bindtap="openOrders">我的订单</button>
|
||||
<button bindtap="openProfile">个人中心</button>
|
||||
<button wx:if="{{showManagerEntry}}" type="primary" bindtap="openManager">门店管理</button>
|
||||
<button wx:if="{{showCleanerEntry}}" bindtap="openCleaner">保洁任务</button>
|
||||
</view>
|
||||
<button loading="{{locating}}" bindtap="locateNearby">定位附近门店</button>
|
||||
<view class="city-search">
|
||||
|
||||
Reference in New Issue
Block a user