From 5a88e876542d174f5dd5c3ad957fd50affda7aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=98=E9=A3=8E?= Date: Wed, 6 May 2026 14:32:38 +0800 Subject: [PATCH] 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. --- miniprogram/pages/my/my.js | 2 +- miniprogram/pages/my/my.wxml | 4 ++-- .../super-article-editor.js | 24 +++++++++++++++++++ .../super-article-editor.wxml | 8 +++++-- .../super-article-editor.wxss | 20 ++++++++++++++++ 5 files changed, 53 insertions(+), 5 deletions(-) diff --git a/miniprogram/pages/my/my.js b/miniprogram/pages/my/my.js index b9bbda6c..01c46c33 100644 --- a/miniprogram/pages/my/my.js +++ b/miniprogram/pages/my/my.js @@ -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 diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml index 130a4803..9ec30bff 100644 --- a/miniprogram/pages/my/my.wxml +++ b/miniprogram/pages/my/my.wxml @@ -95,7 +95,7 @@ 快捷入口 - + 订单 @@ -116,7 +116,7 @@ 客资 链接与轨迹 - + 发文 发布文章 diff --git a/miniprogram/pages/super-article-editor/super-article-editor.js b/miniprogram/pages/super-article-editor/super-article-editor.js index b24da970..4401b154 100644 --- a/miniprogram/pages/super-article-editor/super-article-editor.js +++ b/miniprogram/pages/super-article-editor/super-article-editor.js @@ -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() diff --git a/miniprogram/pages/super-article-editor/super-article-editor.wxml b/miniprogram/pages/super-article-editor/super-article-editor.wxml index ee8528d3..61b1ef7a 100644 --- a/miniprogram/pages/super-article-editor/super-article-editor.wxml +++ b/miniprogram/pages/super-article-editor/super-article-editor.wxml @@ -11,7 +11,7 @@ 标题 - + 正文 @@ -20,10 +20,14 @@ #超链接 -