重构项目文件夹目录

This commit is contained in:
2026-06-15 15:53:55 +08:00
parent 8093e07190
commit 7cbe5b3de5
1098 changed files with 34 additions and 4441 deletions
@@ -0,0 +1,100 @@
/**
* Purpose: navigation supports index.js by holding or executing the navigation page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const navigation = require('../../utils/navigation')
/**
* Purpose: permission supports index.js by holding or executing the permission page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permission = require('../../utils/permission')
Page({
/**
* Purpose: data supports index.js by holding or executing the data page or API role.
* Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow.
*/
data: {
/**
* Purpose: userInfo supports index.js by holding or executing the user info page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
userInfo: null,
/**
* Purpose: currentShop supports index.js by holding or executing the current shop page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
currentShop: null,
/**
* Purpose: modules supports index.js by holding or executing the modules page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
modules: []
},
/**
* Purpose: onShow supports index.js by holding or executing the on show page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
onShow() {
if (!navigation.ensureLogin('进入经营模块')) {
return
}
const app = getApp()
const userInfo = app.globalData.userInfo
const currentShop = app.globalData.currentShop
const permissionCodes = app.globalData.permissionCodes || []
this.setData({
userInfo,
currentShop,
/**
* Purpose: modules supports index.js by holding or executing the modules page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
modules: permission.getManageModules(userInfo, permissionCodes, currentShop)
})
},
handleOpenWorkbench() {
navigation.switchTab('/pages/workbench/index').catch(() => undefined)
},
handleOpenOrders() {
navigation.switchTab('/pages/orders/index').catch(() => undefined)
},
handleOpenProfile() {
navigation.switchTab('/pages/profile/index').catch(() => undefined)
},
/**
* Purpose: handleOpenModule supports index.js by holding or executing the handle open module page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
handleOpenModule(event) {
const module = event.currentTarget.dataset.module
if (!module) {
return
}
if (!module.allowed) {
wx.showToast({
/**
* Purpose: title supports index.js by holding or executing the title page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
title: module.disabledReason || '当前账号没有进入该模块的权限',
/**
* Purpose: icon supports index.js by holding or executing the icon page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
icon: 'none'
})
return
}
navigation.navigate(module.path).catch(() => undefined)
}
})
@@ -0,0 +1,5 @@
{
"usingComponents": {
"navigation-bar": "/admin/components/navigation-bar/navigation-bar"
}
}
@@ -0,0 +1,32 @@
<navigation-bar title="经营" back="{{false}}" color="#f6efe7" background="#081518"></navigation-bar>
<view class="page-shell">
<view class="page-stack">
<view class="hero-panel">
<text class="hero-kicker">按权限展示</text>
<text class="hero-title">{{currentShop ? currentShop.shopName : '平台级入口'}}</text>
<text class="hero-desc">这里不复刻网页后台的大表格首页,而是把可用模块拆成移动端更好点到的入口卡片。</text>
</view>
<view wx:if="{{!currentShop && userInfo && userInfo.type === 4}}" class="hint-card">当前是平台总览模式。用户、作品、订单、优惠券、标签、美甲师等店铺业务可以查看,编辑操作由服务端关闭。</view>
<block wx:for="{{modules}}" wx:key="key">
<view class="list-card" data-module="{{item}}" bindtap="handleOpenModule">
<view class="list-head">
<view>
<text class="list-title">{{item.title}}</text>
<text class="list-subtitle">{{item.description}}</text>
</view>
<text class="{{item.allowed ? 'badge' : 'soft-badge'}}">{{item.readonly ? '仅查看' : (item.allowed ? '可进入' : '待解锁')}}</text>
</view>
<view wx:if="{{!item.allowed}}" class="hint-card">{{item.disabledReason}}</view>
</view>
</block>
<view class="admin-bottom-nav">
<view class="admin-bottom-link" bindtap="handleOpenWorkbench">工作台</view>
<view class="admin-bottom-link" bindtap="handleOpenOrders">订单</view>
<view class="admin-bottom-link active">经营</view>
<view class="admin-bottom-link" bindtap="handleOpenProfile">我的</view>
</view>
</view>
</view>
@@ -0,0 +1,4 @@
@import "../../app.wxss";
.page-shell {
background: transparent;
}