完成Salon小程序合规整改
This commit is contained in:
@@ -173,15 +173,6 @@ const visibleModules = computed(() => {
|
||||
icon: MessageOutlined,
|
||||
permissionCode: 'announcement:view'
|
||||
},
|
||||
{
|
||||
key: 'vip-plans',
|
||||
title: 'VIP充值配置',
|
||||
description: '维护充值档位和 VIP 等级来源。',
|
||||
path: '/admin/vip-recharge-plans',
|
||||
icon: GiftOutlined,
|
||||
permissionCode: 'user:vip:manage',
|
||||
requireShopContext: true
|
||||
},
|
||||
{
|
||||
key: 'parameters',
|
||||
title: '参数管理',
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<div class="privacy-page">
|
||||
<a-alert
|
||||
type="warning"
|
||||
show-icon
|
||||
message="内容审核当前为本地模拟流程,不会调用微信内容安全接口。正式上线前需接入审核服务并复核隐私指引。"
|
||||
class="page-notice"
|
||||
/>
|
||||
|
||||
<a-tabs v-model:active-key="activeTab" @change="loadActiveTab">
|
||||
<a-tab-pane key="closures" tab="账号注销申请">
|
||||
<a-table :columns="closureColumns" :data-source="closures" :loading="closureLoading" row-key="id" :scroll="{ x: 'max-content' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'account'">{{ record.nickname }}({{ record.userType === 2 ? '店长' : '员工' }})</template>
|
||||
<template v-else-if="column.key === 'shops'">{{ (record.shopNames || []).join('、') || '无关联门店' }}</template>
|
||||
<template v-else-if="column.key === 'time'">{{ record.requestedAt || '-' }}</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link" @click="openClosure(record as AccountClosureRequestVO, 'APPROVE')">处理</a-button>
|
||||
<a-button type="link" danger @click="openClosure(record as AccountClosureRequestVO, 'REJECT')">驳回</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane key="moderation" tab="内容复核">
|
||||
<a-table :columns="moderationColumns" :data-source="moderation" :loading="moderationLoading" row-key="id" :scroll="{ x: 'max-content' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'type'">{{ moderationType(record.contentType) }}</template>
|
||||
<template v-else-if="column.key === 'content'">
|
||||
<pre class="payload-preview">{{ formatPayload(record.payloadJson) }}</pre>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">{{ record.status === 'RETRY' ? '待复核(模拟服务故障)' : '待复核' }}</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link" @click="openModeration(record as ContentModerationRecordVO, true)">通过</a-button>
|
||||
<a-button type="link" danger @click="openModeration(record as ContentModerationRecordVO, false)">拒绝</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane key="backfill" tab="手机号加密回填">
|
||||
<a-space direction="vertical" size="middle" class="backfill-panel">
|
||||
<p>先查看冲突和待处理记录数。正式回填仅在 Nacos 显式启用后可执行;检测到重复数据时会整批停止,不覆盖冲突记录。</p>
|
||||
<a-space>
|
||||
<a-button :loading="backfillLoading" @click="loadBackfillReport">检查数据</a-button>
|
||||
<a-button type="primary" danger :disabled="!backfillReport || hasBackfillConflicts" :loading="backfillLoading" @click="runBackfill">执行回填</a-button>
|
||||
</a-space>
|
||||
<a-descriptions v-if="backfillReport" bordered :column="2" size="small">
|
||||
<a-descriptions-item label="待处理账号">{{ backfillReport.userRowsToUpdate }}</a-descriptions-item>
|
||||
<a-descriptions-item label="待处理订单">{{ backfillReport.orderRowsToUpdate }}</a-descriptions-item>
|
||||
<a-descriptions-item label="账号冲突">{{ backfillReport.accountConflictRows }}</a-descriptions-item>
|
||||
<a-descriptions-item label="手机号冲突">{{ backfillReport.phoneConflictRows }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<a-alert v-if="backfillReport?.conflictingUserIds?.length" type="error" show-icon message="发现冲突,已禁止执行回填" :description="`涉及账号 ID:${backfillReport.conflictingUserIds.join('、')}`" />
|
||||
</a-space>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
<a-modal v-model:open="closureOpen" :title="closureDecision === 'APPROVE' ? '处理注销申请' : '驳回注销申请'" :confirm-loading="actionLoading" :mask-closable="false" @ok="submitClosure">
|
||||
<template v-if="closureTarget && closureDecision === 'APPROVE'">
|
||||
<div v-if="closureTarget.userType === 2 && closureTarget.shopIds?.length" class="closure-shops">
|
||||
<p>关联门店:{{ (closureTarget.shopNames || []).join('、') }}</p>
|
||||
<a-radio-group v-model:value="closureMode">
|
||||
<a-radio value="transfer">移交门店</a-radio>
|
||||
<a-radio value="archive">归档全部门店</a-radio>
|
||||
</a-radio-group>
|
||||
<a-select v-if="closureMode === 'transfer'" v-model:value="successorManagerId" class="full-width" placeholder="选择接手店长" :options="successorOptions" />
|
||||
</div>
|
||||
<p v-else>确认清理该账号资料并撤销其会话?必要业务记录会保留并去除账号身份关联。</p>
|
||||
</template>
|
||||
<a-form-item :label="closureDecision === 'REJECT' ? '驳回原因' : '处理说明'">
|
||||
<a-textarea v-model:value="closureNote" :rows="3" :placeholder="closureDecision === 'REJECT' ? '请填写驳回原因' : '可填写处理说明'" />
|
||||
</a-form-item>
|
||||
</a-modal>
|
||||
|
||||
<a-modal v-model:open="moderationOpen" :title="moderationApproved ? '通过内容复核' : '拒绝内容'" :confirm-loading="actionLoading" :mask-closable="false" @ok="submitModeration">
|
||||
<p v-if="moderationTarget">{{ moderationType(moderationTarget.contentType) }}内容,记录号 {{ moderationTarget.id }}</p>
|
||||
<a-form-item label="复核说明"><a-textarea v-model:value="moderationReason" :rows="3" placeholder="说明本次模拟复核结果" /></a-form-item>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import {
|
||||
adminPrivacyComplianceApi,
|
||||
type AccountClosureRequestVO,
|
||||
type ClosureSuccessorManagerVO,
|
||||
type ContentModerationRecordVO,
|
||||
type PhoneBackfillReportVO
|
||||
} from '@/api/admin'
|
||||
|
||||
const activeTab = ref('closures')
|
||||
const closures = ref<AccountClosureRequestVO[]>([])
|
||||
const moderation = ref<ContentModerationRecordVO[]>([])
|
||||
const successorManagers = ref<ClosureSuccessorManagerVO[]>([])
|
||||
const backfillReport = ref<PhoneBackfillReportVO | null>(null)
|
||||
const closureLoading = ref(false)
|
||||
const moderationLoading = ref(false)
|
||||
const backfillLoading = ref(false)
|
||||
const actionLoading = ref(false)
|
||||
const closureOpen = ref(false)
|
||||
const closureTarget = ref<AccountClosureRequestVO | null>(null)
|
||||
const closureDecision = ref<'APPROVE' | 'REJECT'>('APPROVE')
|
||||
const closureMode = ref<'transfer' | 'archive'>('transfer')
|
||||
const successorManagerId = ref<string | number>()
|
||||
const closureNote = ref('')
|
||||
const moderationOpen = ref(false)
|
||||
const moderationTarget = ref<ContentModerationRecordVO | null>(null)
|
||||
const moderationApproved = ref(false)
|
||||
const moderationReason = ref('')
|
||||
const hasBackfillConflicts = computed(() => Boolean(backfillReport.value?.accountConflictRows || backfillReport.value?.phoneConflictRows))
|
||||
const successorOptions = computed(() => successorManagers.value.map(manager => ({ label: `${manager.nickname || '店长'}(${manager.id})`, value: manager.id })))
|
||||
|
||||
const closureColumns = [
|
||||
{ title: '申请人', key: 'account' },
|
||||
{ title: '关联门店', key: 'shops' },
|
||||
{ title: '申请时间', key: 'time' },
|
||||
{ title: '处理', key: 'action', width: 140 }
|
||||
]
|
||||
const moderationColumns = [
|
||||
{ title: '类型', key: 'type', width: 120 },
|
||||
{ title: '隔离内容', key: 'content', width: 420 },
|
||||
{ title: '状态', key: 'status', width: 180 },
|
||||
{ title: '提交时间', dataIndex: 'createTime', key: 'createTime' },
|
||||
{ title: '复核', key: 'action', width: 140 }
|
||||
]
|
||||
|
||||
async function loadClosures() {
|
||||
closureLoading.value = true
|
||||
try {
|
||||
const [items, managers] = await Promise.all([
|
||||
adminPrivacyComplianceApi.listClosures(),
|
||||
adminPrivacyComplianceApi.listSuccessorManagers()
|
||||
])
|
||||
closures.value = items || []
|
||||
successorManagers.value = managers || []
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '获取注销申请失败')
|
||||
} finally {
|
||||
closureLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadModeration() {
|
||||
moderationLoading.value = true
|
||||
try { moderation.value = await adminPrivacyComplianceApi.listModeration() || [] }
|
||||
catch (error) { message.error(error instanceof Error ? error.message : '获取复核列表失败') }
|
||||
finally { moderationLoading.value = false }
|
||||
}
|
||||
|
||||
function loadActiveTab() {
|
||||
if (activeTab.value === 'closures') void loadClosures()
|
||||
if (activeTab.value === 'moderation') void loadModeration()
|
||||
if (activeTab.value === 'backfill') void loadBackfillReport()
|
||||
}
|
||||
|
||||
function openClosure(record: AccountClosureRequestVO, decision: 'APPROVE' | 'REJECT') {
|
||||
closureTarget.value = record
|
||||
closureDecision.value = decision
|
||||
closureMode.value = 'transfer'
|
||||
successorManagerId.value = undefined
|
||||
closureNote.value = decision === 'REJECT' ? '' : '已完成门店交接或归档,并按要求清理账号资料。'
|
||||
closureOpen.value = true
|
||||
}
|
||||
|
||||
async function submitClosure() {
|
||||
if (!closureTarget.value) return
|
||||
if (closureDecision.value === 'REJECT' && !closureNote.value.trim()) {
|
||||
message.warning('请填写驳回原因')
|
||||
return
|
||||
}
|
||||
const managerHasShops = closureDecision.value === 'APPROVE' && closureTarget.value.userType === 2 && (closureTarget.value.shopIds || []).length > 0
|
||||
if (managerHasShops && closureMode.value === 'transfer' && !successorManagerId.value) {
|
||||
message.warning('请选择接手店长')
|
||||
return
|
||||
}
|
||||
if (managerHasShops && closureMode.value === 'archive' && !(await confirmArchive())) return
|
||||
actionLoading.value = true
|
||||
try {
|
||||
await adminPrivacyComplianceApi.processClosure(closureTarget.value.id, {
|
||||
decision: closureDecision.value,
|
||||
successorManagerId: managerHasShops && closureMode.value === 'transfer' ? successorManagerId.value : undefined,
|
||||
archiveShopIds: managerHasShops && closureMode.value === 'archive' ? closureTarget.value.shopIds : undefined,
|
||||
note: closureNote.value.trim() || undefined
|
||||
})
|
||||
message.success(closureDecision.value === 'APPROVE' ? '账号资料已处理' : '申请已驳回')
|
||||
closureOpen.value = false
|
||||
await loadClosures()
|
||||
} catch (error) { message.error(error instanceof Error ? error.message : '处理失败') }
|
||||
finally { actionLoading.value = false }
|
||||
}
|
||||
|
||||
function confirmArchive() {
|
||||
return new Promise<boolean>(resolve => Modal.confirm({
|
||||
title: '确认归档全部门店?',
|
||||
content: '归档后关联门店将停止营业,请确认已完成必要交接。',
|
||||
okText: '确认归档',
|
||||
cancelText: '返回',
|
||||
onOk: () => resolve(true),
|
||||
onCancel: () => resolve(false)
|
||||
}))
|
||||
}
|
||||
|
||||
function openModeration(record: ContentModerationRecordVO, approved: boolean) {
|
||||
moderationTarget.value = record
|
||||
moderationApproved.value = approved
|
||||
moderationReason.value = approved ? '本地模拟复核通过。' : ''
|
||||
moderationOpen.value = true
|
||||
}
|
||||
|
||||
async function submitModeration() {
|
||||
if (!moderationTarget.value) return
|
||||
if (!moderationReason.value.trim()) {
|
||||
message.warning('请填写复核说明')
|
||||
return
|
||||
}
|
||||
actionLoading.value = true
|
||||
try {
|
||||
await adminPrivacyComplianceApi.reviewContent(moderationTarget.value.id, { approved: moderationApproved.value, reason: moderationReason.value.trim() })
|
||||
message.success(moderationApproved.value ? '内容已通过复核' : '内容已拒绝')
|
||||
moderationOpen.value = false
|
||||
await loadModeration()
|
||||
} catch (error) { message.error(error instanceof Error ? error.message : '复核失败') }
|
||||
finally { actionLoading.value = false }
|
||||
}
|
||||
|
||||
async function loadBackfillReport() {
|
||||
backfillLoading.value = true
|
||||
try { backfillReport.value = await adminPrivacyComplianceApi.phoneBackfillReport() }
|
||||
catch (error) { message.error(error instanceof Error ? error.message : '检查失败') }
|
||||
finally { backfillLoading.value = false }
|
||||
}
|
||||
|
||||
function runBackfill() {
|
||||
Modal.confirm({
|
||||
title: '执行手机号加密回填?',
|
||||
content: '该操作只更新无重复冲突的历史账号和订单手机号。请确认已在目标环境 Nacos 显式开启回填开关。',
|
||||
okText: '执行回填',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
backfillLoading.value = true
|
||||
try {
|
||||
backfillReport.value = await adminPrivacyComplianceApi.runPhoneBackfill()
|
||||
message.success(`回填完成:账号 ${backfillReport.value.userRowsUpdated} 条,订单 ${backfillReport.value.orderRowsUpdated} 条`)
|
||||
} catch (error) { message.error(error instanceof Error ? error.message : '回填失败') }
|
||||
finally { backfillLoading.value = false }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function moderationType(type: string) {
|
||||
return ({ USER_PROFILE: '个人资料', USER_AVATAR: '头像', PRODUCT: '作品', COMMENT: '评论' } as Record<string, string>)[type] || type
|
||||
}
|
||||
|
||||
function formatPayload(value?: string) {
|
||||
if (!value) return '无待复核载荷'
|
||||
try { return JSON.stringify(JSON.parse(value), null, 2) } catch { return value }
|
||||
}
|
||||
|
||||
onMounted(loadActiveTab)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.privacy-page { display: grid; gap: 16px; }
|
||||
.page-notice { border-radius: 8px; }
|
||||
.payload-preview { max-width: 420px; max-height: 180px; margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12px; }
|
||||
.backfill-panel { width: 100%; padding: 8px 0; }
|
||||
.closure-shops { display: grid; gap: 12px; margin-bottom: 16px; }
|
||||
.closure-shops p { margin: 0; }
|
||||
.full-width { width: 100%; margin-top: 12px; }
|
||||
</style>
|
||||
@@ -220,7 +220,7 @@
|
||||
<a-form-item label="账号" name="account">
|
||||
<a-input
|
||||
v-model:value="formState.account"
|
||||
placeholder="请输入账号"
|
||||
:placeholder="isEdit && isMaskedSensitiveValue(currentUser?.account) ? '已设置账号,留空保持不变' : '请输入账号'"
|
||||
@input="handleAccountInput"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -230,7 +230,7 @@
|
||||
<a-form-item label="手机号" name="phone">
|
||||
<a-input
|
||||
v-model:value="formState.phone"
|
||||
placeholder="请输入手机号"
|
||||
:placeholder="isEdit && isMaskedSensitiveValue(currentUser?.phone) ? '已设置手机号,留空保持不变' : '请输入手机号'"
|
||||
:maxlength="11"
|
||||
inputmode="numeric"
|
||||
autocomplete="off"
|
||||
@@ -964,6 +964,8 @@ const validatePhoneUniqueness = async (value: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isMaskedSensitiveValue = (value?: string | null) => /^1[3-9]\d\*{4}\d{4}$/.test(String(value || '').trim())
|
||||
|
||||
const validateOptionalPasswordStrength = (value?: string) => {
|
||||
const password = value?.trim()
|
||||
if (!password) {
|
||||
@@ -1089,14 +1091,21 @@ const handleClearVipDraft = (showMessage = true) => {
|
||||
*/
|
||||
const formRules = {
|
||||
account: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' },
|
||||
{ pattern: ACCOUNT_REGEX, message: ACCOUNT_RULE_MESSAGE, trigger: 'blur' }
|
||||
{
|
||||
validator: (_rule: unknown, value: string) => {
|
||||
if (isEdit.value && !value?.trim()) return Promise.resolve()
|
||||
if (!value?.trim()) return Promise.reject('请输入账号')
|
||||
if (!ACCOUNT_REGEX.test(value.trim())) return Promise.reject(ACCOUNT_RULE_MESSAGE)
|
||||
return Promise.resolve()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
if (isEdit.value && !value?.trim()) return Promise.resolve()
|
||||
await validatePhoneUniqueness(value)
|
||||
return Promise.resolve()
|
||||
},
|
||||
@@ -1480,10 +1489,10 @@ const showEditModal = (record: any) => {
|
||||
isEdit.value = true
|
||||
currentUser.value = record
|
||||
Object.assign(formState, {
|
||||
account: record.account,
|
||||
account: isMaskedSensitiveValue(record.account) ? '' : record.account,
|
||||
nickname: record.nickname,
|
||||
phone: record.phone || record.contactPhone || '',
|
||||
contactPhone: record.phone || record.contactPhone || '',
|
||||
phone: isMaskedSensitiveValue(record.phone || record.contactPhone) ? '' : (record.phone || record.contactPhone || ''),
|
||||
contactPhone: isMaskedSensitiveValue(record.phone || record.contactPhone) ? '' : (record.phone || record.contactPhone || ''),
|
||||
birthday: record.birthday || '',
|
||||
wechatId: record.wechatId || '',
|
||||
wechatQrCode: record.wechatQrCode || '',
|
||||
@@ -1492,6 +1501,11 @@ const showEditModal = (record: any) => {
|
||||
shopIds: resolveEditableShopIds(record)
|
||||
})
|
||||
restoreDraft()
|
||||
if (isMaskedSensitiveValue(formState.account)) formState.account = ''
|
||||
if (isMaskedSensitiveValue(formState.phone)) {
|
||||
formState.phone = ''
|
||||
formState.contactPhone = ''
|
||||
}
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
@@ -1584,6 +1598,12 @@ const handleModalOk = async () => {
|
||||
...(formState.password.trim() ? { password: formState.password.trim() } : {})
|
||||
}
|
||||
|
||||
if (isEdit.value && !formState.account.trim()) delete requestData.account
|
||||
if (isEdit.value && !primaryPhone) {
|
||||
delete requestData.phone
|
||||
delete requestData.contactPhone
|
||||
}
|
||||
|
||||
if (isEdit.value && currentUserType.value !== 4) {
|
||||
delete requestData.shopIds
|
||||
delete requestData.shopId
|
||||
|
||||
Reference in New Issue
Block a user