功能:收口小程序前后台安全与防重复提交

This commit is contained in:
xiaowang
2026-04-20 16:02:57 +08:00
parent eb1c209d79
commit a3df262fae
237 changed files with 14068 additions and 728 deletions
@@ -0,0 +1,44 @@
const navigation = require('../../utils/navigation')
const permission = require('../../utils/permission')
Page({
data: {
userInfo: null,
currentShop: null,
modules: []
},
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,
modules: permission.getManageModules(userInfo, permissionCodes, currentShop)
})
},
handleOpenModule(event) {
const module = event.currentTarget.dataset.module
if (!module) {
return
}
if (!module.allowed) {
wx.showToast({
title: module.disabledReason || '当前账号没有进入该模块的权限',
icon: 'none'
})
return
}
navigation.navigate(module.path).catch(() => undefined)
}
})
@@ -0,0 +1,5 @@
{
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar"
}
}
@@ -0,0 +1,26 @@
<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.allowed ? '可进入' : '待解锁'}}</text>
</view>
<view wx:if="{{!item.allowed}}" class="hint-card">{{item.disabledReason}}</view>
</view>
</block>
</view>
</view>
@@ -0,0 +1,3 @@
.page-shell {
background: transparent;
}