feat: implement audit mode functionality in article editor and user pages

- Added audit mode checks to restrict access to certain features and UI elements in the article editor and user pages.
- Updated the UI to disable input fields and display a mask when in audit mode, enhancing user feedback.
- Ensured that actions like submitting articles and inserting content are blocked in audit mode to prevent unauthorized usage.

This update aims to improve content management and user experience by enforcing stricter access controls during the audit process.
This commit is contained in:
乘风
2026-05-06 14:32:38 +08:00
parent 8abd0280b7
commit 5a88e87654
5 changed files with 53 additions and 5 deletions

View File

@@ -944,7 +944,7 @@ Page({
return
}
const auditBlockedIds = { giftPay: true, wallet: true, withdrawRecords: true }
const auditBlockedIds = { giftPay: true, wallet: true, withdrawRecords: true, superArticle: true }
if (app.globalData.auditMode && auditBlockedIds[id]) {
wx.showToast({ title: '当前为体验版,暂无法访问', icon: 'none' })
return

View File

@@ -95,7 +95,7 @@
<image class="card-icon-img" src="/assets/icons/eye-teal.svg" mode="aspectFit"/>
<text class="card-title">快捷入口</text>
</view>
<view class="stats-grid {{showSuperCrmEntry && showSuperArticleEntry ? 'stats-grid-5' : (showSuperCrmEntry || showSuperArticleEntry ? 'stats-grid-4' : '')}}">
<view class="stats-grid {{showSuperCrmEntry && showSuperArticleEntry && !auditMode ? 'stats-grid-5' : (showSuperCrmEntry || (showSuperArticleEntry && !auditMode) ? 'stats-grid-4' : '')}}">
<view class="stat-box" bindtap="handleMenuTap" data-id="orders">
<image class="stat-icon-img" src="/assets/icons/list-teal.svg" mode="aspectFit"/>
<text class="stat-num">订单</text>
@@ -116,7 +116,7 @@
<text class="stat-num">客资</text>
<text class="stat-label">链接与轨迹</text>
</view>
<view class="stat-box" wx:if="{{showSuperArticleEntry}}" bindtap="handleMenuTap" data-id="superArticle">
<view class="stat-box" wx:if="{{showSuperArticleEntry && !auditMode}}" bindtap="handleMenuTap" data-id="superArticle">
<image class="stat-icon-img" src="/assets/icons/book-arrow-teal.svg" mode="aspectFit"/>
<text class="stat-num">发文</text>
<text class="stat-label">发布文章</text>

View File

@@ -3,20 +3,41 @@ const app = getApp()
Page({
data: {
statusBarHeight: 44,
auditMode: false,
title: '',
content: '',
saving: false,
meNickname: '',
},
/** 遮挡层拦截滚动穿透 */
preventMove() {},
syncAuditMode() {
const audit = !!app.globalData.auditMode
this.setData({ auditMode: audit })
return audit
},
onLoad() {
this.setData({
statusBarHeight: app.globalData.statusBarHeight || 44,
meNickname: String(app.globalData.userInfo?.nickname || '我').trim() || '我',
})
this.syncAuditMode()
try {
app.getAuditMode && app.getAuditMode().catch(() => {})
} catch (_) {}
this.ensureSuperIdentity()
},
onShow() {
this.syncAuditMode()
try {
app.getAuditMode && app.getAuditMode().catch(() => {})
} catch (_) {}
},
async ensureSuperIdentity() {
const userId = app.globalData.userInfo?.id
if (!app.globalData.isLoggedIn || !userId) {
@@ -48,15 +69,18 @@ Page({
},
insertMentionSelf() {
if (this.data.auditMode) return
const nick = this.data.meNickname || '我'
this.setData({ content: `${this.data.content}@${nick} ` })
},
insertHashLink() {
if (this.data.auditMode) return
this.setData({ content: `${this.data.content}#链接(https://)` })
},
async submitArticle() {
if (this.data.auditMode || app.globalData.auditMode) return
if (this.data.saving) return
const userId = app.globalData.userInfo?.id
const title = String(this.data.title || '').trim()

View File

@@ -11,7 +11,7 @@
<view class="card">
<text class="label">标题</text>
<view class="input-wrap">
<input class="input" maxlength="40" placeholder="写个标题最多40字" value="{{title}}" bindinput="onTitleInput"/>
<input class="input" maxlength="40" placeholder="写个标题最多40字" value="{{title}}" bindinput="onTitleInput" disabled="{{auditMode}}"/>
</view>
<text class="label">正文</text>
@@ -20,10 +20,14 @@
<view class="tool-btn" bindtap="insertHashLink">#超链接</view>
</view>
<view class="textarea-wrap">
<textarea class="textarea" maxlength="5000" placeholder="输入正文内容..." value="{{content}}" bindinput="onContentInput"/>
<textarea class="textarea" maxlength="5000" placeholder="输入正文内容..." value="{{content}}" bindinput="onContentInput" disabled="{{auditMode}}"/>
</view>
<text class="hint">提示:可直接输入 @昵称 或 #链接(https://xxx)</text>
<view class="submit-btn" bindtap="submitArticle">{{saving ? '发布中...' : '发布文章'}}</view>
</view>
<view wx:if="{{auditMode}}" class="audit-mode-mask" catchtouchmove="preventMove">
<text class="audit-mode-text">开发中...</text>
</view>
</view>

View File

@@ -26,3 +26,23 @@
color: #032b35; font-size: 30rpx; font-weight: 700;
display: flex; align-items: center; justify-content: center;
}
/* 审核模式:盖住整页(含自定义导航),高于 .nav-bar 的 z-index: 10 */
.audit-mode-mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 10000;
display: flex;
align-items: center;
justify-content: center;
background: rgba(11, 18, 32, 0.94);
}
.audit-mode-text {
font-size: 36rpx;
font-weight: 600;
color: rgba(255, 255, 255, 0.88);
letter-spacing: 4rpx;
}