feat(compliance): add content compliance detection across tenant, ops, and clients
Implements the Revision 8/9 compliance design: tenant + ops backends, ops-web content-safety pages, admin-web editor/publish gate integration, desktop publish block surfacing, and supporting migrations / shared types / config plumbing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { ComplianceViolation } from '@geo/shared-types'
|
||||
import {
|
||||
AlignCenterOutlined,
|
||||
AlignLeftOutlined,
|
||||
@@ -20,7 +21,7 @@ import {
|
||||
UnorderedListOutlined,
|
||||
} from '@ant-design/icons-vue'
|
||||
import { Crepe, CrepeFeature } from '@milkdown/crepe'
|
||||
import { commandsCtx, editorViewCtx, parserCtx } from '@milkdown/kit/core'
|
||||
import { commandsCtx, editorViewCtx, parserCtx, prosePluginsCtx } from '@milkdown/kit/core'
|
||||
import type { Ctx } from '@milkdown/kit/ctx'
|
||||
import { redoCommand, undoCommand } from '@milkdown/kit/plugin/history'
|
||||
import {
|
||||
@@ -45,9 +46,16 @@ import {
|
||||
setAlignCommand,
|
||||
toggleStrikethroughCommand,
|
||||
} from '@milkdown/kit/preset/gfm'
|
||||
import { Slice } from '@milkdown/kit/prose/model'
|
||||
import { NodeSelection, TextSelection, type Selection } from '@milkdown/kit/prose/state'
|
||||
import type { EditorView } from '@milkdown/kit/prose/view'
|
||||
import { Slice, type Node as ProseNode } from '@milkdown/kit/prose/model'
|
||||
import {
|
||||
NodeSelection,
|
||||
Plugin,
|
||||
PluginKey,
|
||||
TextSelection,
|
||||
type Selection,
|
||||
type Transaction,
|
||||
} from '@milkdown/kit/prose/state'
|
||||
import { Decoration, DecorationSet, type EditorView } from '@milkdown/kit/prose/view'
|
||||
import { callCommand, replaceAll } from '@milkdown/kit/utils'
|
||||
import { message } from 'ant-design-vue'
|
||||
// NOTE: import each common stylesheet explicitly instead of the aggregate
|
||||
@@ -103,6 +111,7 @@ const props = defineProps<{
|
||||
title: string
|
||||
modelValue: string
|
||||
disabled?: boolean
|
||||
complianceViolations?: ComplianceViolation[]
|
||||
uploadImage?: (file: File) => Promise<string>
|
||||
}>()
|
||||
|
||||
@@ -122,6 +131,7 @@ const tablePickerRef = ref<HTMLElement | null>(null)
|
||||
|
||||
const AI_OPTIMIZE_PANEL_GAP = 18
|
||||
const AI_OPTIMIZE_SELECTION_HIGHLIGHT_NAME = 'article-editor-ai-optimize-selection'
|
||||
const COMPLIANCE_HIGHLIGHT_CLASS = 'article-editor-compliance-hit'
|
||||
const AI_OPTIMIZE_TOOLBAR_ICON = `
|
||||
<svg
|
||||
class="svgfont"
|
||||
@@ -228,6 +238,230 @@ type SelectedImageSnapshot = {
|
||||
|
||||
type MilkdownEditorInstance = Awaited<ReturnType<Crepe['create']>>
|
||||
|
||||
type ComplianceHighlightRequest = {
|
||||
key: string
|
||||
text: string
|
||||
level: ComplianceViolation['level']
|
||||
startOffset: number
|
||||
}
|
||||
|
||||
type ComplianceHighlightSpec = ComplianceHighlightRequest & {
|
||||
from: number
|
||||
to: number
|
||||
}
|
||||
|
||||
type ComplianceHighlightPluginState = {
|
||||
specs: ComplianceHighlightSpec[]
|
||||
decorations: DecorationSet
|
||||
}
|
||||
|
||||
type ComplianceHighlightMeta =
|
||||
| { type: 'set'; requests: ComplianceHighlightRequest[] }
|
||||
| { type: 'clear' }
|
||||
|
||||
type EditorTextIndex = {
|
||||
text: string
|
||||
startPosByChar: number[]
|
||||
endPosByChar: number[]
|
||||
}
|
||||
|
||||
const complianceHighlightPluginKey = new PluginKey<ComplianceHighlightPluginState>(
|
||||
'article-editor-compliance-highlights',
|
||||
)
|
||||
|
||||
function createComplianceHighlightPlugin(): Plugin<ComplianceHighlightPluginState> {
|
||||
return new Plugin<ComplianceHighlightPluginState>({
|
||||
key: complianceHighlightPluginKey,
|
||||
state: {
|
||||
init: () => ({
|
||||
specs: [],
|
||||
decorations: DecorationSet.empty,
|
||||
}),
|
||||
apply: (transaction, previous, _oldState, newState) => {
|
||||
const meta = transaction.getMeta(complianceHighlightPluginKey) as
|
||||
| ComplianceHighlightMeta
|
||||
| undefined
|
||||
|
||||
if (meta?.type === 'clear') {
|
||||
return {
|
||||
specs: [],
|
||||
decorations: DecorationSet.empty,
|
||||
}
|
||||
}
|
||||
|
||||
if (meta?.type === 'set') {
|
||||
const specs = resolveComplianceHighlightSpecs(newState.doc, meta.requests)
|
||||
return createComplianceHighlightState(newState.doc, specs)
|
||||
}
|
||||
|
||||
if (!transaction.docChanged || previous.specs.length === 0) {
|
||||
return previous
|
||||
}
|
||||
|
||||
const specs = previous.specs
|
||||
.filter((spec) => !complianceHighlightWasTouched(transaction, spec))
|
||||
.map((spec) => ({
|
||||
...spec,
|
||||
from: transaction.mapping.map(spec.from, 1),
|
||||
to: transaction.mapping.map(spec.to, -1),
|
||||
}))
|
||||
.filter((spec) => complianceHighlightStillMatches(newState.doc, spec))
|
||||
|
||||
return createComplianceHighlightState(newState.doc, specs)
|
||||
},
|
||||
},
|
||||
props: {
|
||||
decorations: (state) =>
|
||||
complianceHighlightPluginKey.getState(state)?.decorations ?? DecorationSet.empty,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function createComplianceHighlightState(
|
||||
doc: ProseNode,
|
||||
specs: ComplianceHighlightSpec[],
|
||||
): ComplianceHighlightPluginState {
|
||||
const decorations = specs.map((spec) =>
|
||||
Decoration.inline(
|
||||
spec.from,
|
||||
spec.to,
|
||||
{
|
||||
class: `${COMPLIANCE_HIGHLIGHT_CLASS} ${COMPLIANCE_HIGHLIGHT_CLASS}--${spec.level}`,
|
||||
},
|
||||
{
|
||||
inclusiveStart: false,
|
||||
inclusiveEnd: false,
|
||||
key: spec.key,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
return {
|
||||
specs,
|
||||
decorations: decorations.length ? DecorationSet.create(doc, decorations) : DecorationSet.empty,
|
||||
}
|
||||
}
|
||||
|
||||
function resolveComplianceHighlightSpecs(
|
||||
doc: ProseNode,
|
||||
requests: ComplianceHighlightRequest[],
|
||||
): ComplianceHighlightSpec[] {
|
||||
if (!requests.length) {
|
||||
return []
|
||||
}
|
||||
|
||||
const index = buildEditorTextIndex(doc)
|
||||
const usedRanges = new Set<string>()
|
||||
const specs: ComplianceHighlightSpec[] = []
|
||||
|
||||
for (const request of requests) {
|
||||
const match = findComplianceHighlightRange(index, request, usedRanges)
|
||||
if (!match) {
|
||||
continue
|
||||
}
|
||||
|
||||
usedRanges.add(`${match.from}:${match.to}`)
|
||||
specs.push({
|
||||
...request,
|
||||
from: match.from,
|
||||
to: match.to,
|
||||
})
|
||||
}
|
||||
|
||||
return specs
|
||||
}
|
||||
|
||||
function buildEditorTextIndex(doc: ProseNode): EditorTextIndex {
|
||||
let text = ''
|
||||
const startPosByChar: number[] = []
|
||||
const endPosByChar: number[] = []
|
||||
|
||||
doc.descendants((node, pos) => {
|
||||
if (!node.isText || !node.text) {
|
||||
return true
|
||||
}
|
||||
|
||||
const nodeText = node.text
|
||||
const charStart = text.length
|
||||
for (let index = 0; index < nodeText.length; index += 1) {
|
||||
startPosByChar[charStart + index] = pos + index
|
||||
endPosByChar[charStart + index + 1] = pos + index + 1
|
||||
}
|
||||
text += nodeText
|
||||
return true
|
||||
})
|
||||
|
||||
return { text, startPosByChar, endPosByChar }
|
||||
}
|
||||
|
||||
function findComplianceHighlightRange(
|
||||
index: EditorTextIndex,
|
||||
request: ComplianceHighlightRequest,
|
||||
usedRanges: Set<string>,
|
||||
): { from: number; to: number } | null {
|
||||
const candidates: Array<{ from: number; to: number; textIndex: number; used: boolean }> = []
|
||||
let textIndex = index.text.indexOf(request.text)
|
||||
|
||||
while (textIndex >= 0) {
|
||||
const from = index.startPosByChar[textIndex]
|
||||
const to = index.endPosByChar[textIndex + request.text.length]
|
||||
if (Number.isInteger(from) && Number.isInteger(to) && from < to) {
|
||||
candidates.push({
|
||||
from,
|
||||
to,
|
||||
textIndex,
|
||||
used: usedRanges.has(`${from}:${to}`),
|
||||
})
|
||||
}
|
||||
textIndex = index.text.indexOf(request.text, textIndex + Math.max(request.text.length, 1))
|
||||
}
|
||||
|
||||
if (!candidates.length) {
|
||||
return null
|
||||
}
|
||||
|
||||
candidates.sort((a, b) => {
|
||||
if (a.used !== b.used) {
|
||||
return a.used ? 1 : -1
|
||||
}
|
||||
return (
|
||||
Math.abs(a.textIndex - request.startOffset) - Math.abs(b.textIndex - request.startOffset)
|
||||
)
|
||||
})
|
||||
|
||||
const selected = candidates[0]
|
||||
return { from: selected.from, to: selected.to }
|
||||
}
|
||||
|
||||
function complianceHighlightStillMatches(doc: ProseNode, spec: ComplianceHighlightSpec): boolean {
|
||||
if (spec.from >= spec.to || spec.from < 0 || spec.to > doc.content.size) {
|
||||
return false
|
||||
}
|
||||
|
||||
return doc.textBetween(spec.from, spec.to, '') === spec.text
|
||||
}
|
||||
|
||||
function complianceHighlightWasTouched(
|
||||
transaction: Transaction,
|
||||
spec: ComplianceHighlightSpec,
|
||||
): boolean {
|
||||
let touched = false
|
||||
|
||||
transaction.mapping.maps.forEach((stepMap) => {
|
||||
if (touched) {
|
||||
return
|
||||
}
|
||||
|
||||
stepMap.forEach((oldStart, oldEnd) => {
|
||||
if (oldStart < spec.to && oldEnd > spec.from) {
|
||||
touched = true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return touched
|
||||
}
|
||||
|
||||
function createDefaultTableContextMenuState(): TableContextMenuState {
|
||||
return {
|
||||
open: false,
|
||||
@@ -306,6 +540,9 @@ function createCrepe(root: HTMLElement): Crepe {
|
||||
},
|
||||
},
|
||||
})
|
||||
crepe.editor.config((ctx) => {
|
||||
ctx.update(prosePluginsCtx, (plugins) => [...plugins, createComplianceHighlightPlugin()])
|
||||
})
|
||||
crepe.addFeature(richImageBlockFeature, {
|
||||
onUpload: props.uploadImage,
|
||||
proxyDomURL: (url) => url,
|
||||
@@ -543,6 +780,50 @@ function syncMarkdownFromProps(nextValue: string): void {
|
||||
editor.action(replaceAll(resolvedValue, true))
|
||||
queueMicrotask(() => {
|
||||
syncingExternalMarkdown.value = false
|
||||
syncComplianceHighlightsFromProps()
|
||||
})
|
||||
}
|
||||
|
||||
function resolveComplianceHighlightRequests(): ComplianceHighlightRequest[] {
|
||||
return (props.complianceViolations ?? [])
|
||||
.map((violation, index) => {
|
||||
const text = String(violation.matched_text ?? '')
|
||||
if (!text.trim()) {
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
key: [
|
||||
index,
|
||||
violation.id || 0,
|
||||
violation.source,
|
||||
violation.platform_code ?? 'all',
|
||||
violation.start_offset,
|
||||
violation.end_offset,
|
||||
text,
|
||||
].join(':'),
|
||||
text,
|
||||
level: violation.level,
|
||||
startOffset: Number.isFinite(violation.start_offset) ? violation.start_offset : 0,
|
||||
} satisfies ComplianceHighlightRequest
|
||||
})
|
||||
.filter((request): request is ComplianceHighlightRequest => request !== null)
|
||||
}
|
||||
|
||||
function syncComplianceHighlightsFromProps(): void {
|
||||
const editor = getEditor()
|
||||
if (!editor) {
|
||||
return
|
||||
}
|
||||
|
||||
const requests = resolveComplianceHighlightRequests()
|
||||
const meta: ComplianceHighlightMeta = requests.length
|
||||
? { type: 'set', requests }
|
||||
: { type: 'clear' }
|
||||
|
||||
editor.action((ctx) => {
|
||||
const view = ctx.get(editorViewCtx)
|
||||
view.dispatch(view.state.tr.setMeta(complianceHighlightPluginKey, meta))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -574,6 +855,18 @@ watch(
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
[() => props.complianceViolations, loading],
|
||||
([_violations, editorLoading]) => {
|
||||
if (editorLoading) {
|
||||
return
|
||||
}
|
||||
|
||||
syncComplianceHighlightsFromProps()
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
)
|
||||
|
||||
async function mountEditor(): Promise<void> {
|
||||
const root = editorRootRef.value
|
||||
if (!root || crepeRef.value) {
|
||||
@@ -586,6 +879,7 @@ async function mountEditor(): Promise<void> {
|
||||
|
||||
try {
|
||||
editorRef.value = await crepe.create()
|
||||
syncComplianceHighlightsFromProps()
|
||||
} catch (error) {
|
||||
crepeRef.value = null
|
||||
console.error(error)
|
||||
@@ -846,6 +1140,60 @@ function resolveEditorDOMRange(view: EditorView, from: number, to: number): Rang
|
||||
}
|
||||
}
|
||||
|
||||
function scrollToText(text: string): boolean {
|
||||
const target = stringsTrim(text)
|
||||
if (!target) {
|
||||
return false
|
||||
}
|
||||
|
||||
let found = false
|
||||
const editor = getEditor()
|
||||
if (!editor) {
|
||||
return false
|
||||
}
|
||||
|
||||
editor.action((ctx) => {
|
||||
const view = ctx.get(editorViewCtx)
|
||||
const match = { found: false, from: 0, to: 0 }
|
||||
view.state.doc.descendants((node, pos) => {
|
||||
if (match.found || !node.isText || !node.text) {
|
||||
return !match.found
|
||||
}
|
||||
const index = node.text.indexOf(target)
|
||||
if (index < 0) {
|
||||
return true
|
||||
}
|
||||
match.found = true
|
||||
match.from = pos + index
|
||||
match.to = pos + index + target.length
|
||||
return false
|
||||
})
|
||||
if (!match.found) {
|
||||
return
|
||||
}
|
||||
|
||||
view.dispatch(
|
||||
view.state.tr
|
||||
.setSelection(TextSelection.create(view.state.doc, match.from, match.to))
|
||||
.scrollIntoView(),
|
||||
)
|
||||
requestAnimationFrame(() => {
|
||||
view.focus()
|
||||
})
|
||||
found = true
|
||||
})
|
||||
|
||||
return found
|
||||
}
|
||||
|
||||
function stringsTrim(value: string): string {
|
||||
return String(value ?? '').trim()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
scrollToText,
|
||||
})
|
||||
|
||||
function getCSSHighlightsRegistry(): {
|
||||
set: (name: string, value: unknown) => void
|
||||
delete: (name: string) => void
|
||||
@@ -2178,6 +2526,20 @@ function runTableContextAction(action: TableContextMenuAction): void {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.article-editor-canvas__surface :deep(.article-editor-compliance-hit) {
|
||||
color: #dc2626;
|
||||
background: rgba(254, 226, 226, 0.95);
|
||||
border-radius: 3px;
|
||||
box-shadow: inset 0 -2px 0 rgba(220, 38, 38, 0.32);
|
||||
}
|
||||
|
||||
.article-editor-canvas__surface :deep(.article-editor-compliance-hit--block),
|
||||
.article-editor-canvas__surface :deep(.article-editor-compliance-hit--high),
|
||||
.article-editor-canvas__surface :deep(.article-editor-compliance-hit--medium),
|
||||
.article-editor-canvas__surface :deep(.article-editor-compliance-hit--info) {
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.article-editor-canvas__surface :deep(.milkdown-image-block) {
|
||||
margin: 18px 0;
|
||||
text-align: center;
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { MinusCircleFilled } from '@ant-design/icons-vue'
|
||||
import type { ArticleDetail } from '@geo/shared-types'
|
||||
import { ApiClientError } from '@geo/http-client'
|
||||
import type {
|
||||
ArticleDetail,
|
||||
ComplianceCheckResult,
|
||||
ComplianceRuntimeStatus,
|
||||
GateDecisionLiteral,
|
||||
} from '@geo/shared-types'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query'
|
||||
import { message, notification } from 'ant-design-vue'
|
||||
import { computed, ref, watch, watchEffect } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import CoverPickerModal from '@/components/CoverPickerModal.vue'
|
||||
import { articlesApi, mediaApi, publishJobsApi, resolveApiURL, tenantAccountsApi } from '@/lib/api'
|
||||
import {
|
||||
articlesApi,
|
||||
complianceApi,
|
||||
mediaApi,
|
||||
publishJobsApi,
|
||||
resolveApiURL,
|
||||
tenantAccountsApi,
|
||||
} from '@/lib/api'
|
||||
import { coverUploadRequired, deriveCoverFileName } from '@/lib/cover-requirements'
|
||||
import { formatError } from '@/lib/errors'
|
||||
import {
|
||||
@@ -43,6 +56,12 @@ const coverImageAssetId = ref<number | null>(null)
|
||||
const coverPickerOpen = ref(false)
|
||||
const selectionHydrated = ref(false)
|
||||
const coverHydrated = ref(false)
|
||||
const complianceResult = ref<ComplianceCheckResult | null>(null)
|
||||
const publishAdmissionResult = ref<ComplianceCheckResult | null>(null)
|
||||
const publishAdmissionLoading = ref(false)
|
||||
const publishAdmissionError = ref<string | null>(null)
|
||||
let publishAdmissionRunId = 0
|
||||
const ackInProgress = ref(false)
|
||||
|
||||
const detailQuery = useQuery({
|
||||
queryKey: computed(() => ['articles', 'detail', props.articleId, 'publish-modal']),
|
||||
@@ -62,6 +81,12 @@ const platformsQuery = useQuery({
|
||||
queryFn: () => mediaApi.platforms(),
|
||||
})
|
||||
|
||||
const complianceStatusQuery = useQuery({
|
||||
queryKey: ['compliance', 'runtime-status', 'publish-modal'],
|
||||
enabled: computed(() => props.open),
|
||||
queryFn: () => complianceApi.runtimeStatus(),
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
async (open) => {
|
||||
@@ -73,6 +98,10 @@ watch(
|
||||
coverEnabled.value = false
|
||||
selectionHydrated.value = false
|
||||
coverHydrated.value = false
|
||||
complianceResult.value = null
|
||||
publishAdmissionResult.value = null
|
||||
publishAdmissionLoading.value = false
|
||||
publishAdmissionError.value = null
|
||||
return
|
||||
}
|
||||
|
||||
@@ -83,6 +112,7 @@ watch(
|
||||
props.articleId ? detailQuery.refetch() : Promise.resolve(),
|
||||
accountsQuery.refetch(),
|
||||
platformsQuery.refetch(),
|
||||
complianceStatusQuery.refetch(),
|
||||
])
|
||||
},
|
||||
{ immediate: true },
|
||||
@@ -145,6 +175,9 @@ const modalTitle = computed(() => detailQuery.data.value?.title || t('article.un
|
||||
const selectedPlatformIds = computed(() =>
|
||||
Array.from(new Set(selectedCards.value.map((card) => card.platformId))),
|
||||
)
|
||||
watch(selectedPlatformIds, () => {
|
||||
complianceResult.value = null
|
||||
})
|
||||
const selectedImmediateCount = computed(
|
||||
() => selectedCards.value.filter((card) => card.publishState === 'immediate').length,
|
||||
)
|
||||
@@ -157,6 +190,209 @@ const effectiveCoverEnabled = computed(() => coverRequired.value || coverEnabled
|
||||
const normalizedCoverValue = computed(() =>
|
||||
effectiveCoverEnabled.value ? coverAssetUrl.value.trim() : '',
|
||||
)
|
||||
const publishMutation = useMutation({
|
||||
mutationFn: () => runPublishFlow(),
|
||||
onSuccess: handlePublishSuccess,
|
||||
onError: handlePublishError,
|
||||
})
|
||||
const complianceStatus = computed<ComplianceRuntimeStatus | null>(
|
||||
() => complianceStatusQuery.data.value ?? null,
|
||||
)
|
||||
const publishComplianceEnabled = computed(
|
||||
() =>
|
||||
complianceStatus.value?.enabled === true &&
|
||||
complianceStatus.value.enforcement_mode !== 'disabled',
|
||||
)
|
||||
const publishComplianceMode = computed(() => complianceStatus.value?.enforcement_mode ?? 'disabled')
|
||||
const publishComplianceMandatory = computed(
|
||||
() => publishComplianceEnabled.value && publishComplianceMode.value === 'mandatory',
|
||||
)
|
||||
const publishAdmissionPassed = computed(
|
||||
() => complianceDisplayDecision(publishAdmissionResult.value) === 'pass',
|
||||
)
|
||||
const mandatoryAdmissionBlocking = computed(
|
||||
() => publishComplianceMandatory.value && !publishAdmissionPassed.value,
|
||||
)
|
||||
const accountSelectionLocked = computed(
|
||||
() =>
|
||||
publishMutation.isPending.value || ackInProgress.value || mandatoryAdmissionBlocking.value,
|
||||
)
|
||||
const accountSelectionLockSpinning = computed(
|
||||
() =>
|
||||
publishAdmissionLoading.value ||
|
||||
(publishComplianceMandatory.value &&
|
||||
!publishAdmissionResult.value &&
|
||||
!publishAdmissionError.value &&
|
||||
!publishAdmissionPassed.value),
|
||||
)
|
||||
const accountSelectionLockMessage = computed(() => {
|
||||
if (publishMutation.isPending.value || ackInProgress.value) {
|
||||
return '发布任务提交中,请稍候。'
|
||||
}
|
||||
if (accountSelectionLockSpinning.value) {
|
||||
return '强制敏感词检测中,检测通过后可选择目标账号。'
|
||||
}
|
||||
if (publishAdmissionError.value) {
|
||||
return '强制敏感词检测暂时不可用,当前不能选择目标账号。'
|
||||
}
|
||||
return '当前文章未通过强制敏感词检测,暂不能选择目标账号。'
|
||||
})
|
||||
const okText = computed(() => {
|
||||
if (publishComplianceMandatory.value && publishAdmissionLoading.value) {
|
||||
return '检测中'
|
||||
}
|
||||
if (publishComplianceMandatory.value && publishAdmissionError.value) {
|
||||
return '检测失败'
|
||||
}
|
||||
if (
|
||||
publishComplianceMandatory.value &&
|
||||
publishAdmissionResult.value &&
|
||||
complianceDisplayDecision(publishAdmissionResult.value) !== 'pass'
|
||||
) {
|
||||
return '检测未通过'
|
||||
}
|
||||
if (
|
||||
publishComplianceMandatory.value &&
|
||||
complianceResult.value &&
|
||||
complianceDisplayDecision(complianceResult.value) !== 'pass'
|
||||
) {
|
||||
return '检测未通过'
|
||||
}
|
||||
if (publishComplianceMandatory.value && !publishAdmissionPassed.value) {
|
||||
return '检测中'
|
||||
}
|
||||
if (complianceDisplayDecision(complianceResult.value) === 'needs_ack') {
|
||||
return '已了解风险,继续发布'
|
||||
}
|
||||
if (complianceDisplayDecision(complianceResult.value) === 'block') {
|
||||
return '无法发布'
|
||||
}
|
||||
return '提交发布'
|
||||
})
|
||||
const okDisabled = computed(() => {
|
||||
if (mandatoryAdmissionBlocking.value) {
|
||||
return true
|
||||
}
|
||||
if (
|
||||
publishComplianceMandatory.value &&
|
||||
complianceResult.value &&
|
||||
complianceDisplayDecision(complianceResult.value) !== 'pass'
|
||||
) {
|
||||
return true
|
||||
}
|
||||
return complianceDisplayDecision(complianceResult.value) === 'block'
|
||||
})
|
||||
const compliancePanelTitle = computed(() => {
|
||||
if (complianceDisplayDecision(complianceResult.value) === 'needs_ack') {
|
||||
return '发布前需要确认合规风险'
|
||||
}
|
||||
if (complianceDisplayDecision(complianceResult.value) === 'block') {
|
||||
return '检测到敏感词,已阻断发布'
|
||||
}
|
||||
return ''
|
||||
})
|
||||
const publishCompliancePanelVisible = computed(
|
||||
() =>
|
||||
publishComplianceEnabled.value &&
|
||||
(publishAdmissionLoading.value ||
|
||||
Boolean(publishAdmissionResult.value) ||
|
||||
Boolean(publishAdmissionError.value) ||
|
||||
Boolean(complianceResult.value)),
|
||||
)
|
||||
const publishCompliancePanelTone = computed(() => {
|
||||
const finalDecision = complianceDisplayDecision(complianceResult.value)
|
||||
const admissionDecision = complianceDisplayDecision(publishAdmissionResult.value)
|
||||
if (publishAdmissionError.value || finalDecision === 'block' || admissionDecision === 'block') {
|
||||
return 'error'
|
||||
}
|
||||
if (publishAdmissionLoading.value) {
|
||||
return 'info'
|
||||
}
|
||||
if (
|
||||
admissionDecision === 'needs_ack' ||
|
||||
finalDecision === 'needs_ack'
|
||||
) {
|
||||
return publishComplianceMandatory.value ? 'error' : 'warning'
|
||||
}
|
||||
return 'success'
|
||||
})
|
||||
const publishCompliancePanelTitle = computed(() => {
|
||||
if (publishAdmissionLoading.value) {
|
||||
return publishComplianceMandatory.value ? '正在进行强制敏感词检测' : '正在加载敏感词检测状态'
|
||||
}
|
||||
if (publishAdmissionError.value) {
|
||||
return '敏感词检测暂时不可用'
|
||||
}
|
||||
const finalDecision = complianceDisplayDecision(complianceResult.value)
|
||||
const admissionDecision = complianceDisplayDecision(publishAdmissionResult.value)
|
||||
if (finalDecision === 'block') {
|
||||
return publishComplianceMandatory.value ? '检测到敏感词,已阻断发布' : '检测到敏感词风险'
|
||||
}
|
||||
if (finalDecision === 'needs_ack') {
|
||||
return publishComplianceMandatory.value ? '检测到敏感词,已阻断发布' : '检测到敏感词风险'
|
||||
}
|
||||
if (finalDecision === 'pass') {
|
||||
return '敏感词检测通过'
|
||||
}
|
||||
if (admissionDecision === 'block') {
|
||||
return publishComplianceMandatory.value ? '检测到敏感词,已阻断发布' : '检测到敏感词风险'
|
||||
}
|
||||
if (admissionDecision === 'needs_ack') {
|
||||
return publishComplianceMandatory.value ? '检测到敏感词,已阻断发布' : '检测到敏感词风险'
|
||||
}
|
||||
if (admissionDecision === 'pass') {
|
||||
return '敏感词检测通过'
|
||||
}
|
||||
return compliancePanelTitle.value
|
||||
})
|
||||
const publishCompliancePanelDescription = computed(() => {
|
||||
if (publishAdmissionLoading.value) {
|
||||
return publishComplianceMandatory.value
|
||||
? '检测完成前暂时不能选择目标账号或提交发布。'
|
||||
: '仅提示确认模式不会阻断目标账号选择和发布操作。'
|
||||
}
|
||||
if (publishAdmissionError.value) {
|
||||
return publishComplianceMandatory.value
|
||||
? '当前为强制阻断模式,请稍后重试或联系运营处理。'
|
||||
: '当前为仅提示确认模式,仍可继续选择账号并发布。'
|
||||
}
|
||||
const finalDecision = complianceDisplayDecision(complianceResult.value)
|
||||
const admissionDecision = complianceDisplayDecision(publishAdmissionResult.value)
|
||||
if (finalDecision === 'block') {
|
||||
return publishComplianceMandatory.value
|
||||
? '请回到文章编辑页,使用合规检测查看全部命中词并逐项修改。'
|
||||
: '请回到文章编辑页,使用合规检测查看全部命中词。'
|
||||
}
|
||||
if (finalDecision === 'needs_ack') {
|
||||
return publishComplianceMandatory.value
|
||||
? '请回到文章编辑页,使用合规检测查看全部命中词并逐项修改。'
|
||||
: '请回到文章编辑页,使用合规检测查看全部命中词;确认风险后仍可继续发布。'
|
||||
}
|
||||
if (finalDecision === 'pass') {
|
||||
return '当前文章未命中敏感词风险。'
|
||||
}
|
||||
if (admissionDecision === 'block') {
|
||||
return publishComplianceMandatory.value
|
||||
? '请回到文章编辑页,使用合规检测查看全部命中词并逐项修改。'
|
||||
: '请回到文章编辑页,使用合规检测查看全部命中词。'
|
||||
}
|
||||
if (admissionDecision === 'needs_ack') {
|
||||
return publishComplianceMandatory.value
|
||||
? '请回到文章编辑页,使用合规检测查看全部命中词并逐项修改。'
|
||||
: '请回到文章编辑页,使用合规检测查看全部命中词;确认风险后仍可继续发布。'
|
||||
}
|
||||
if (admissionDecision === 'pass') {
|
||||
return '当前文章未命中敏感词风险。'
|
||||
}
|
||||
return '请回到文章编辑页,使用合规检测查看全部命中词。'
|
||||
})
|
||||
const displayedComplianceResult = computed(
|
||||
() => complianceResult.value ?? publishAdmissionResult.value,
|
||||
)
|
||||
const complianceAcknowledgedViolationIds = computed(() =>
|
||||
(complianceResult.value?.violations ?? [])
|
||||
.map((item) => item.id),
|
||||
)
|
||||
|
||||
watch(
|
||||
coverRequired,
|
||||
@@ -168,64 +404,109 @@ watch(
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const publishMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
if (!props.articleId || !detailQuery.data.value) {
|
||||
throw new Error('missing_article')
|
||||
}
|
||||
if (!selectedAccountIds.value.length) {
|
||||
throw new Error('no_accounts_selected')
|
||||
}
|
||||
if (coverRequired.value && !normalizedCoverValue.value) {
|
||||
throw new Error('cover_required_for_selected_platforms')
|
||||
}
|
||||
watch(
|
||||
[
|
||||
() => props.open,
|
||||
() => detailQuery.data.value?.id,
|
||||
() => detailQuery.data.value?.current_version_id,
|
||||
() => complianceStatusQuery.data.value?.enabled,
|
||||
() => complianceStatusQuery.data.value?.enforcement_mode,
|
||||
],
|
||||
() => {
|
||||
void runPublishAdmissionCheck()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const article = await persistCoverIfNeeded(detailQuery.data.value)
|
||||
return publishJobsApi.create({
|
||||
title: article.title?.trim() || t('article.untitled'),
|
||||
content_ref: {
|
||||
article_id: article.id,
|
||||
},
|
||||
accounts: selectedAccountIds.value.map((accountId) => ({
|
||||
account_id: accountId,
|
||||
})),
|
||||
async function runPublishFlow(ackRecordId?: number) {
|
||||
if (!props.articleId || !detailQuery.data.value) {
|
||||
throw new Error('missing_article')
|
||||
}
|
||||
if (!selectedAccountIds.value.length) {
|
||||
throw new Error('no_accounts_selected')
|
||||
}
|
||||
if (coverRequired.value && !normalizedCoverValue.value) {
|
||||
throw new Error('cover_required_for_selected_platforms')
|
||||
}
|
||||
|
||||
const article = await persistCoverIfNeeded(detailQuery.data.value)
|
||||
const articleVersionId = article.current_version_id ?? detailQuery.data.value.current_version_id
|
||||
if (!articleVersionId) {
|
||||
throw new Error('invalid_article_version')
|
||||
}
|
||||
if (
|
||||
publishComplianceEnabled.value &&
|
||||
!ackRecordId
|
||||
) {
|
||||
const result = await complianceApi.checkArticle(article.id, {
|
||||
article_version_id: articleVersionId,
|
||||
title: article.title,
|
||||
plaintext: article.markdown_content ?? '',
|
||||
target_platforms: selectedPlatformIds.value,
|
||||
trigger_source: 'publish_gate',
|
||||
})
|
||||
},
|
||||
onSuccess: async () => {
|
||||
notification.success({
|
||||
message: '已提交发布任务',
|
||||
description: successDescription(),
|
||||
placement: 'topRight',
|
||||
duration: 5,
|
||||
})
|
||||
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ['articles'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['workspace'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['tenant', 'desktop-accounts'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['articles', 'detail', props.articleId] }),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['articles', 'detail', props.articleId, 'publish-modal'],
|
||||
}),
|
||||
queryClient.invalidateQueries({ queryKey: ['articles', 'publish-records', props.articleId] }),
|
||||
])
|
||||
|
||||
emit('published')
|
||||
emit('update:open', false)
|
||||
},
|
||||
onError: (error) => {
|
||||
const normalized = error instanceof Error ? error.message : ''
|
||||
if (normalized === 'no_accounts_selected') {
|
||||
message.warning('请先选择至少一个可发布账号')
|
||||
return
|
||||
complianceResult.value = result
|
||||
const decision = complianceDisplayDecision(result)
|
||||
if (decision === 'block' || decision === 'needs_ack') {
|
||||
throw new Error(`compliance_${decision}`)
|
||||
}
|
||||
if (normalized === 'cover_required_for_selected_platforms') {
|
||||
message.warning(t('media.publish.messages.coverRequired'))
|
||||
return
|
||||
}
|
||||
message.error(formatError(error))
|
||||
},
|
||||
})
|
||||
}
|
||||
return publishJobsApi.create({
|
||||
title: article.title?.trim() || t('article.untitled'),
|
||||
content_ref: {
|
||||
article_id: article.id,
|
||||
},
|
||||
article_version_id: articleVersionId,
|
||||
ack_record_id: ackRecordId,
|
||||
accounts: selectedAccountIds.value.map((accountId) => ({
|
||||
account_id: accountId,
|
||||
})),
|
||||
})
|
||||
}
|
||||
|
||||
async function handlePublishSuccess() {
|
||||
notification.success({
|
||||
message: '已提交发布任务',
|
||||
description: successDescription(),
|
||||
placement: 'topRight',
|
||||
duration: 5,
|
||||
})
|
||||
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ['articles'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['workspace'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['tenant', 'desktop-accounts'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['articles', 'detail', props.articleId] }),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['articles', 'detail', props.articleId, 'publish-modal'],
|
||||
}),
|
||||
queryClient.invalidateQueries({ queryKey: ['articles', 'publish-records', props.articleId] }),
|
||||
])
|
||||
|
||||
emit('published')
|
||||
emit('update:open', false)
|
||||
}
|
||||
|
||||
function handlePublishError(error: unknown) {
|
||||
const gate = parseComplianceResultFromError(error)
|
||||
if (gate) {
|
||||
complianceResult.value = gate
|
||||
return
|
||||
}
|
||||
const normalized = error instanceof Error ? error.message : ''
|
||||
if (normalized === 'no_accounts_selected') {
|
||||
message.warning('请先选择至少一个可发布账号')
|
||||
return
|
||||
}
|
||||
if (normalized === 'cover_required_for_selected_platforms') {
|
||||
message.warning(t('media.publish.messages.coverRequired'))
|
||||
return
|
||||
}
|
||||
if (normalized === 'compliance_needs_ack' || normalized === 'compliance_block') {
|
||||
return
|
||||
}
|
||||
message.error(formatError(error))
|
||||
}
|
||||
|
||||
async function persistCoverIfNeeded(detail: ArticleDetail): Promise<ArticleDetail> {
|
||||
const currentUrl = resolveApiURL(detail.cover_asset_url).trim()
|
||||
@@ -259,7 +540,7 @@ function successDescription(): string {
|
||||
}
|
||||
|
||||
function toggleAccount(accountId: string, selectable: boolean): void {
|
||||
if (!selectable || publishMutation.isPending.value) {
|
||||
if (!selectable || accountSelectionLocked.value) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -299,6 +580,131 @@ function handleRemoveCover(): void {
|
||||
coverFileName.value = ''
|
||||
coverImageAssetId.value = null
|
||||
}
|
||||
|
||||
async function handleModalOk(): Promise<void> {
|
||||
if (okDisabled.value) {
|
||||
return
|
||||
}
|
||||
if (complianceDisplayDecision(complianceResult.value) === 'needs_ack') {
|
||||
await publishWithAck()
|
||||
return
|
||||
}
|
||||
publishMutation.mutate()
|
||||
}
|
||||
|
||||
async function runPublishAdmissionCheck(): Promise<void> {
|
||||
const runId = ++publishAdmissionRunId
|
||||
if (!props.open) {
|
||||
return
|
||||
}
|
||||
const status = complianceStatusQuery.data.value
|
||||
if (!status || status.enabled !== true || status.enforcement_mode === 'disabled') {
|
||||
publishAdmissionResult.value = null
|
||||
publishAdmissionError.value = null
|
||||
publishAdmissionLoading.value = false
|
||||
return
|
||||
}
|
||||
const article = detailQuery.data.value
|
||||
const articleVersionId = article?.current_version_id
|
||||
if (!article || !props.articleId || !articleVersionId) {
|
||||
publishAdmissionResult.value = null
|
||||
publishAdmissionError.value = null
|
||||
publishAdmissionLoading.value =
|
||||
detailQuery.isPending.value || detailQuery.isFetching.value || complianceStatusQuery.isFetching.value
|
||||
return
|
||||
}
|
||||
|
||||
publishAdmissionLoading.value = true
|
||||
publishAdmissionError.value = null
|
||||
try {
|
||||
const result = await complianceApi.checkArticle(article.id, {
|
||||
article_version_id: articleVersionId,
|
||||
title: article.title,
|
||||
plaintext: article.markdown_content ?? '',
|
||||
target_platforms: [],
|
||||
trigger_source: 'publish_gate',
|
||||
})
|
||||
if (runId === publishAdmissionRunId && props.open) {
|
||||
publishAdmissionResult.value = result
|
||||
}
|
||||
} catch (error) {
|
||||
if (runId === publishAdmissionRunId && props.open) {
|
||||
publishAdmissionError.value = formatError(error)
|
||||
publishAdmissionResult.value = null
|
||||
}
|
||||
} finally {
|
||||
if (runId === publishAdmissionRunId && props.open) {
|
||||
publishAdmissionLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function publishWithAck(): Promise<void> {
|
||||
const result = complianceResult.value
|
||||
if (!result || complianceDisplayDecision(result) !== 'needs_ack' || !result.record_id) {
|
||||
publishMutation.mutate()
|
||||
return
|
||||
}
|
||||
ackInProgress.value = true
|
||||
try {
|
||||
const ack = await complianceApi.createAck(result.record_id, {
|
||||
acknowledged_violation_ids: complianceAcknowledgedViolationIds.value,
|
||||
})
|
||||
await runPublishFlow(ack.id)
|
||||
await handlePublishSuccess()
|
||||
} catch (error) {
|
||||
handlePublishError(error)
|
||||
} finally {
|
||||
ackInProgress.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function parseComplianceResultFromError(error: unknown): ComplianceCheckResult | null {
|
||||
if (!(error instanceof ApiClientError) || typeof error.detail !== 'string') {
|
||||
return null
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(error.detail) as Partial<ComplianceCheckResult>
|
||||
if (typeof parsed.record_id === 'number' && typeof parsed.decision === 'string') {
|
||||
return parsed as ComplianceCheckResult
|
||||
}
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function hasComplianceHits(result: ComplianceCheckResult | null | undefined): boolean {
|
||||
return Boolean(
|
||||
result && ((result.hit_count ?? 0) > 0 || (result.violations?.length ?? 0) > 0),
|
||||
)
|
||||
}
|
||||
|
||||
function complianceDisplayDecision(
|
||||
result: ComplianceCheckResult | null | undefined,
|
||||
): GateDecisionLiteral | undefined {
|
||||
if (!result) {
|
||||
return undefined
|
||||
}
|
||||
if (result.decision === 'pass' && (result.passed === false || hasComplianceHits(result))) {
|
||||
if (result.enforcement_mode === 'mandatory') {
|
||||
return 'block'
|
||||
}
|
||||
return 'needs_ack'
|
||||
}
|
||||
return result.decision
|
||||
}
|
||||
|
||||
function decisionAlertType(result: ComplianceCheckResult | null | undefined) {
|
||||
const decision = complianceDisplayDecision(result)
|
||||
if (decision === 'block') {
|
||||
return 'error'
|
||||
}
|
||||
if (decision === 'needs_ack') {
|
||||
return 'warning'
|
||||
}
|
||||
return 'info'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -306,10 +712,11 @@ function handleRemoveCover(): void {
|
||||
:open="publishModalVisible"
|
||||
title="发布"
|
||||
:width="980"
|
||||
:confirm-loading="publishMutation.isPending.value"
|
||||
ok-text="提交发布"
|
||||
:confirm-loading="publishMutation.isPending.value || ackInProgress"
|
||||
:ok-text="okText"
|
||||
:ok-button-props="{ disabled: okDisabled }"
|
||||
:cancel-text="t('common.cancel')"
|
||||
@ok="publishMutation.mutate()"
|
||||
@ok="handleModalOk"
|
||||
@cancel="emit('update:open', false)"
|
||||
>
|
||||
<div class="publish-modal">
|
||||
@@ -339,6 +746,35 @@ function handleRemoveCover(): void {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="publishCompliancePanelVisible"
|
||||
class="publish-modal__section publish-modal__compliance"
|
||||
:class="`publish-modal__compliance--${publishCompliancePanelTone}`"
|
||||
>
|
||||
<a-alert
|
||||
v-if="publishAdmissionLoading"
|
||||
type="info"
|
||||
show-icon
|
||||
:message="publishCompliancePanelTitle"
|
||||
:description="publishCompliancePanelDescription"
|
||||
/>
|
||||
<a-alert
|
||||
v-else-if="publishAdmissionError"
|
||||
:type="publishComplianceMandatory ? 'error' : 'warning'"
|
||||
show-icon
|
||||
:message="publishCompliancePanelTitle"
|
||||
:description="publishCompliancePanelDescription"
|
||||
/>
|
||||
<a-alert
|
||||
v-else-if="displayedComplianceResult"
|
||||
:type="decisionAlertType(displayedComplianceResult)"
|
||||
show-icon
|
||||
:message="publishCompliancePanelTitle"
|
||||
:description="publishCompliancePanelDescription"
|
||||
/>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="publish-modal__section">
|
||||
<div class="publish-modal__section-header">
|
||||
<h3>
|
||||
@@ -357,81 +793,89 @@ function handleRemoveCover(): void {
|
||||
<a-skeleton active :paragraph="{ rows: 5 }" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="accountCards.length" class="publish-modal__list">
|
||||
<button
|
||||
v-for="account in accountCards"
|
||||
:key="account.id"
|
||||
type="button"
|
||||
class="publish-modal__card"
|
||||
:class="{
|
||||
'publish-modal__card--active': isSelected(account.id),
|
||||
'publish-modal__card--disabled': !account.selectable,
|
||||
}"
|
||||
@click="toggleAccount(account.id, account.selectable)"
|
||||
>
|
||||
<div class="publish-modal__card-header">
|
||||
<div class="publish-modal__card-identity">
|
||||
<span class="publish-modal__avatar" :style="{ background: account.platformAccent }">
|
||||
<img
|
||||
v-if="account.avatarUrl"
|
||||
:src="account.avatarUrl"
|
||||
:alt="account.displayName"
|
||||
referrerpolicy="no-referrer"
|
||||
/>
|
||||
<span v-else>{{ accountInitial(account) }}</span>
|
||||
</span>
|
||||
<div class="publish-modal__identity-copy">
|
||||
<strong :title="account.displayName">{{ account.displayName }}</strong>
|
||||
<span
|
||||
class="publish-modal__platform-line"
|
||||
:title="`${account.platformName} · ${account.platformUid}`"
|
||||
>
|
||||
<template v-else>
|
||||
<div v-if="accountSelectionLocked" class="publish-modal__account-lock">
|
||||
<a-spin v-if="accountSelectionLockSpinning" size="small" />
|
||||
<span>{{ accountSelectionLockMessage }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="accountCards.length" class="publish-modal__list">
|
||||
<button
|
||||
v-for="account in accountCards"
|
||||
:key="account.id"
|
||||
type="button"
|
||||
class="publish-modal__card"
|
||||
:class="{
|
||||
'publish-modal__card--active': isSelected(account.id),
|
||||
'publish-modal__card--disabled': !account.selectable || accountSelectionLocked,
|
||||
}"
|
||||
:disabled="!account.selectable || accountSelectionLocked"
|
||||
@click="toggleAccount(account.id, account.selectable)"
|
||||
>
|
||||
<div class="publish-modal__card-header">
|
||||
<div class="publish-modal__card-identity">
|
||||
<span class="publish-modal__avatar" :style="{ background: account.platformAccent }">
|
||||
<img
|
||||
v-if="account.platformLogoUrl"
|
||||
class="publish-modal__platform-logo"
|
||||
:src="account.platformLogoUrl"
|
||||
:alt="account.platformName"
|
||||
v-if="account.avatarUrl"
|
||||
:src="account.avatarUrl"
|
||||
:alt="account.displayName"
|
||||
referrerpolicy="no-referrer"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
class="publish-modal__platform-logo publish-modal__platform-logo--fallback"
|
||||
:style="{ background: account.platformAccent }"
|
||||
>
|
||||
{{ account.platformShortName }}
|
||||
</span>
|
||||
<span class="publish-modal__platform-text">
|
||||
{{ account.platformName }} · {{ account.platformUid }}
|
||||
</span>
|
||||
<span v-else>{{ accountInitial(account) }}</span>
|
||||
</span>
|
||||
<div class="publish-modal__identity-copy">
|
||||
<strong :title="account.displayName">{{ account.displayName }}</strong>
|
||||
<span
|
||||
class="publish-modal__platform-line"
|
||||
:title="`${account.platformName} · ${account.platformUid}`"
|
||||
>
|
||||
<img
|
||||
v-if="account.platformLogoUrl"
|
||||
class="publish-modal__platform-logo"
|
||||
:src="account.platformLogoUrl"
|
||||
:alt="account.platformName"
|
||||
referrerpolicy="no-referrer"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
class="publish-modal__platform-logo publish-modal__platform-logo--fallback"
|
||||
:style="{ background: account.platformAccent }"
|
||||
>
|
||||
{{ account.platformShortName }}
|
||||
</span>
|
||||
<span class="publish-modal__platform-text">
|
||||
{{ account.platformName }} · {{ account.platformUid }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="publish-modal__check">
|
||||
<span v-if="isSelected(account.id)" class="publish-modal__check-inner"></span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="publish-modal__card-footer">
|
||||
<div class="publish-modal__tags">
|
||||
<a-tag :color="healthColor(account.health)">
|
||||
{{ healthLabel(account.health) }}
|
||||
</a-tag>
|
||||
<a-tag :color="clientStatusColor(account)">{{ clientStatusLabel(account) }}</a-tag>
|
||||
</div>
|
||||
|
||||
<a-tooltip :title="account.statusText" placement="top">
|
||||
<span
|
||||
class="publish-modal__state-pill"
|
||||
:class="`publish-modal__state-pill--${account.publishState}`"
|
||||
>
|
||||
{{ publishStateLabel(account.publishState) }}
|
||||
<span class="publish-modal__check">
|
||||
<span v-if="isSelected(account.id)" class="publish-modal__check-inner"></span>
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-empty v-else description="当前还没有可用的桌面媒体账号,请先在桌面端绑定。" />
|
||||
<div class="publish-modal__card-footer">
|
||||
<div class="publish-modal__tags">
|
||||
<a-tag :color="healthColor(account.health)">
|
||||
{{ healthLabel(account.health) }}
|
||||
</a-tag>
|
||||
<a-tag :color="clientStatusColor(account)">{{ clientStatusLabel(account) }}</a-tag>
|
||||
</div>
|
||||
|
||||
<a-tooltip :title="account.statusText" placement="top">
|
||||
<span
|
||||
class="publish-modal__state-pill"
|
||||
:class="`publish-modal__state-pill--${account.publishState}`"
|
||||
>
|
||||
{{ publishStateLabel(account.publishState) }}
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<a-empty v-else description="当前还没有可用的桌面媒体账号,请先在桌面端绑定。" />
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<section class="publish-modal__section">
|
||||
@@ -580,6 +1024,58 @@ function handleRemoveCover(): void {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.publish-modal__compliance {
|
||||
gap: 16px;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid transparent;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.publish-modal__compliance--error {
|
||||
border-color: #fecaca;
|
||||
background: linear-gradient(to bottom, #fff5f5, #ffffff);
|
||||
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
|
||||
}
|
||||
|
||||
.publish-modal__compliance--warning {
|
||||
border-color: #fde68a;
|
||||
background: linear-gradient(to bottom, #fffbeb, #ffffff);
|
||||
box-shadow: 0 4px 12px rgba(245, 158, 11, 0.05);
|
||||
}
|
||||
|
||||
.publish-modal__compliance--success {
|
||||
border-color: #bbf7d0;
|
||||
background: linear-gradient(to bottom, #f0fdf4, #ffffff);
|
||||
box-shadow: 0 4px 12px rgba(34, 197, 94, 0.05);
|
||||
}
|
||||
|
||||
.publish-modal__compliance--info {
|
||||
border-color: #bfdbfe;
|
||||
background: linear-gradient(to bottom, #eff6ff, #ffffff);
|
||||
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.05);
|
||||
}
|
||||
|
||||
.publish-modal__compliance :deep(.ant-alert) {
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
.publish-modal__compliance :deep(.ant-alert-icon) {
|
||||
font-size: 20px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.publish-modal__compliance :deep(.ant-alert-message) {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.publish-modal__compliance :deep(.ant-alert-description) {
|
||||
font-size: 14px;
|
||||
color: #4b5563;
|
||||
}
|
||||
|
||||
.publish-modal__section-header {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
@@ -617,6 +1113,22 @@ function handleRemoveCover(): void {
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.publish-modal__account-lock {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
margin-bottom: 12px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #fed7aa;
|
||||
border-radius: 8px;
|
||||
background: #fff7ed;
|
||||
color: #9a3412;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.publish-modal__list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
|
||||
|
||||
@@ -632,6 +632,7 @@ const enUS = {
|
||||
publish_success: 'Published',
|
||||
publish_failed: 'Failed',
|
||||
pending_review: 'Pending Review',
|
||||
blocked_by_compliance: 'Blocked by compliance',
|
||||
},
|
||||
sourceType: {
|
||||
template: 'Template generation',
|
||||
|
||||
+1112
-1127
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,13 @@ import type {
|
||||
CreateArticleRequest,
|
||||
CreateKolPackageRequest,
|
||||
CreateKolPromptRequest,
|
||||
CreateAckRequest,
|
||||
ComplianceAckRecord,
|
||||
ComplianceCheckArticleRequest,
|
||||
ComplianceCheckPlainRequest,
|
||||
ComplianceCheckResult,
|
||||
ComplianceManualReview,
|
||||
ComplianceRuntimeStatus,
|
||||
CreatePluginSessionRequest,
|
||||
CreatePluginSessionResponse,
|
||||
CreatePublishBatchRequest,
|
||||
@@ -1081,6 +1088,53 @@ export const publishJobsApi = {
|
||||
},
|
||||
}
|
||||
|
||||
export const complianceApi = {
|
||||
runtimeStatus() {
|
||||
return apiClient.get<ComplianceRuntimeStatus>('/api/tenant/compliance/runtime-status')
|
||||
},
|
||||
checkPlain(payload: ComplianceCheckPlainRequest) {
|
||||
return apiClient.post<ComplianceCheckResult, ComplianceCheckPlainRequest>(
|
||||
'/api/tenant/compliance/check',
|
||||
payload,
|
||||
)
|
||||
},
|
||||
checkArticle(articleId: number, payload: ComplianceCheckArticleRequest) {
|
||||
return apiClient.post<ComplianceCheckResult, ComplianceCheckArticleRequest>(
|
||||
`/api/tenant/articles/${articleId}/compliance/check`,
|
||||
payload,
|
||||
)
|
||||
},
|
||||
latestArticleCheck(articleId: number) {
|
||||
return apiClient.get<ComplianceCheckResult>(`/api/tenant/articles/${articleId}/compliance/latest`)
|
||||
},
|
||||
createAck(recordId: number, payload: CreateAckRequest) {
|
||||
return apiClient.post<ComplianceAckRecord, CreateAckRequest>(
|
||||
`/api/tenant/compliance/check-records/${recordId}/ack`,
|
||||
payload,
|
||||
)
|
||||
},
|
||||
submitManualReview(articleId: number, payload: { check_record_id: number; note: string }) {
|
||||
return apiClient.post<ComplianceManualReview, typeof payload>(
|
||||
`/api/tenant/articles/${articleId}/compliance/manual-reviews`,
|
||||
payload,
|
||||
)
|
||||
},
|
||||
latestManualReview(articleId: number, articleVersionId?: number | null) {
|
||||
return apiClient.get<ComplianceManualReview>(
|
||||
`/api/tenant/articles/${articleId}/compliance/manual-reviews/latest`,
|
||||
{
|
||||
params: articleVersionId ? { article_version_id: articleVersionId } : undefined,
|
||||
},
|
||||
)
|
||||
},
|
||||
cancelManualReview(articleId: number, reviewId: number, payload: { reason?: string }) {
|
||||
return apiClient.post<ComplianceManualReview, typeof payload>(
|
||||
`/api/tenant/articles/${articleId}/compliance/manual-reviews/${reviewId}/cancel`,
|
||||
payload,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
function removedMediaApi<T>(action: string): Promise<T> {
|
||||
return Promise.reject(
|
||||
new ApiClientError({
|
||||
|
||||
@@ -20,7 +20,8 @@ const publishStatusMap: Record<string, { label: string; color: string }> = {
|
||||
published: { label: 'status.publish.published', color: 'success' },
|
||||
publish_success: { label: 'status.publish.publish_success', color: 'success' },
|
||||
publish_failed: { label: 'status.publish.publish_failed', color: 'error' },
|
||||
pending_review: { label: 'status.publish.failed', color: 'error' },
|
||||
pending_review: { label: 'status.publish.pending_review', color: 'warning' },
|
||||
blocked_by_compliance: { label: 'status.publish.blocked_by_compliance', color: 'error' },
|
||||
}
|
||||
|
||||
export function formatDateTime(value?: string | null, pattern = 'YYYY-MM-DD HH:mm'): string {
|
||||
|
||||
@@ -61,6 +61,14 @@ const errorMessageMap: Record<string, string> = {
|
||||
desktop_account_not_found: '所选桌面账号不存在,请刷新后重试',
|
||||
desktop_client_offline: '当前登录账号的桌面客户端未在线,请先打开 desktop-client',
|
||||
desktop_publish_job_store_unavailable: '发布队列暂时不可用,请稍后重试',
|
||||
compliance_blocked: '内容合规检测已阻断本次发布',
|
||||
compliance_needs_ack: '内容合规检测需要确认风险后才能发布',
|
||||
compliance_ack_mismatch: '合规确认已失效,请重新检测并确认',
|
||||
compliance_engine_unavailable: '合规检测服务暂时不可用',
|
||||
compliance_manual_review_pending: '该版本正在等待运营审阅',
|
||||
compliance_manual_review_rejected: '该版本已被运营驳回,请修改后重新保存',
|
||||
compliance_manual_review_terminal: '该版本已有终态审阅结果',
|
||||
compliance_manual_review_not_cancellable: '当前审阅状态不能撤回',
|
||||
desktop_media_api_removed: '旧版媒体接口已下线,请刷新页面后重试',
|
||||
publisher_plugin_timeout: '浏览器插件响应超时,请刷新当前页面后重试',
|
||||
publisher_plugin_empty_response: '浏览器插件未返回数据,请刷新当前页面后重试',
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { LeftOutlined } from '@ant-design/icons-vue'
|
||||
import {
|
||||
CloseOutlined,
|
||||
LeftOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
SearchOutlined,
|
||||
} from '@ant-design/icons-vue'
|
||||
import type { ComplianceCheckResult, ComplianceViolation } from '@geo/shared-types'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
@@ -8,9 +14,13 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import ArticleEditorCanvas from '@/components/ArticleEditorCanvas.vue'
|
||||
import PublishArticleModal from '@/components/PublishArticleModal.vue'
|
||||
import { articlesApi } from '@/lib/api'
|
||||
import { articlesApi, complianceApi } from '@/lib/api'
|
||||
import { formatError } from '@/lib/errors'
|
||||
|
||||
type EditorCanvasPublic = InstanceType<typeof ArticleEditorCanvas> & {
|
||||
scrollToText?: (text: string) => boolean
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const queryClient = useQueryClient()
|
||||
@@ -23,6 +33,9 @@ const initialTitle = ref('')
|
||||
const initialMarkdown = ref('')
|
||||
const leaveModalOpen = ref(false)
|
||||
const publishModalOpen = ref(false)
|
||||
const compliancePanelOpen = ref(false)
|
||||
const editorComplianceResult = ref<ComplianceCheckResult | null>(null)
|
||||
const editorCanvasRef = ref<EditorCanvasPublic | null>(null)
|
||||
|
||||
const detailQuery = useQuery({
|
||||
queryKey: computed(() => ['articles', 'detail', articleId.value]),
|
||||
@@ -91,6 +104,18 @@ const saveDisabled = computed(
|
||||
title.value.trim() === '' ||
|
||||
!hasChanges.value,
|
||||
)
|
||||
const complianceCheckLoading = ref(false)
|
||||
const editorComplianceViolations = computed(() =>
|
||||
compliancePanelOpen.value ? (editorComplianceResult.value?.violations ?? []) : [],
|
||||
)
|
||||
const complianceGroups = computed(() => groupViolations(editorComplianceResult.value?.violations ?? []))
|
||||
const complianceElapsedLabel = computed(() => {
|
||||
const duration = editorComplianceResult.value?.duration_ms ?? 0
|
||||
return duration > 0 ? `${duration} ms` : '< 1 ms'
|
||||
})
|
||||
const complianceDecisionTone = computed(() =>
|
||||
(editorComplianceResult.value?.hit_count ?? 0) > 0 ? 'warning' : 'success',
|
||||
)
|
||||
const leaveSaveDisabled = computed(
|
||||
() => editorLocked.value || saveMutation.isPending.value || title.value.trim() === '',
|
||||
)
|
||||
@@ -146,6 +171,120 @@ async function handlePublish(): Promise<void> {
|
||||
publishModalOpen.value = true
|
||||
}
|
||||
|
||||
async function handleComplianceCheck(): Promise<void> {
|
||||
if (editorLocked.value || complianceCheckLoading.value) {
|
||||
return
|
||||
}
|
||||
|
||||
if (hasChanges.value && !saveMutation.isPending.value) {
|
||||
try {
|
||||
await saveMutation.mutateAsync()
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
complianceCheckLoading.value = true
|
||||
try {
|
||||
const currentDetail = (await detailQuery.refetch()).data ?? detail.value
|
||||
const versionId = currentDetail?.current_version_id ?? null
|
||||
const result = await complianceApi.checkArticle(articleId.value, {
|
||||
article_version_id: versionId,
|
||||
title: title.value.trim(),
|
||||
plaintext: markdown.value,
|
||||
target_platforms: [],
|
||||
trigger_source: 'editor_manual',
|
||||
})
|
||||
editorComplianceResult.value = result
|
||||
compliancePanelOpen.value = true
|
||||
if (result.hit_count > 0) {
|
||||
message.warning(`发现 ${result.hit_count} 条合规风险`)
|
||||
} else {
|
||||
message.success('合规检测通过')
|
||||
}
|
||||
} catch (error) {
|
||||
message.error(formatError(error))
|
||||
} finally {
|
||||
complianceCheckLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function closeCompliancePanel(): void {
|
||||
compliancePanelOpen.value = false
|
||||
}
|
||||
|
||||
function focusViolation(violation: ComplianceViolation): void {
|
||||
const ok = editorCanvasRef.value?.scrollToText?.(violation.matched_text)
|
||||
if (!ok) {
|
||||
message.info('未能在当前编辑器内容中定位该命中片段')
|
||||
}
|
||||
}
|
||||
|
||||
function groupViolations(violations: ComplianceViolation[]) {
|
||||
const groups = new Map<string, ComplianceViolation[]>()
|
||||
for (const violation of violations) {
|
||||
const key = violation.platform_code || 'all'
|
||||
const list = groups.get(key) ?? []
|
||||
list.push(violation)
|
||||
groups.set(key, list)
|
||||
}
|
||||
return Array.from(groups.entries()).map(([key, items]) => ({ key, items }))
|
||||
}
|
||||
|
||||
function violationGroupTitle(key: string): string {
|
||||
return key === 'all' ? '全部平台共用规则' : `平台规则:${key}`
|
||||
}
|
||||
|
||||
function violationKey(violation: ComplianceViolation): string {
|
||||
return [
|
||||
violation.id || 0,
|
||||
violation.source,
|
||||
violation.platform_code ?? 'all',
|
||||
violation.start_offset,
|
||||
violation.end_offset,
|
||||
violation.matched_text,
|
||||
].join(':')
|
||||
}
|
||||
|
||||
function levelColor(level: ComplianceViolation['level']): string {
|
||||
switch (level) {
|
||||
case 'block':
|
||||
return 'red'
|
||||
case 'high':
|
||||
return 'orange'
|
||||
case 'medium':
|
||||
return 'gold'
|
||||
default:
|
||||
return 'blue'
|
||||
}
|
||||
}
|
||||
|
||||
function levelLabel(level: ComplianceViolation['level']): string {
|
||||
switch (level) {
|
||||
case 'block':
|
||||
return '重点风险'
|
||||
case 'high':
|
||||
return '高风险'
|
||||
case 'medium':
|
||||
return '中风险'
|
||||
default:
|
||||
return '提示'
|
||||
}
|
||||
}
|
||||
|
||||
function sourceLabel(source: ComplianceViolation['source']): string {
|
||||
switch (source) {
|
||||
case 'dict':
|
||||
return '词库'
|
||||
case 'regex':
|
||||
return '正则'
|
||||
case 'llm':
|
||||
return 'LLM'
|
||||
default:
|
||||
return source
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadEditorImage(file: File): Promise<string> {
|
||||
const result = await articlesApi.uploadImage(articleId.value, file)
|
||||
return result.url
|
||||
@@ -287,6 +426,14 @@ onBeforeUnmount(() => {
|
||||
</button>
|
||||
|
||||
<div class="article-editor-view__actions">
|
||||
<a-button
|
||||
:disabled="editorLocked"
|
||||
:loading="complianceCheckLoading"
|
||||
@click="handleComplianceCheck"
|
||||
>
|
||||
<template #icon><SafetyCertificateOutlined /></template>
|
||||
合规检测
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="saveDisabled"
|
||||
:loading="saveMutation.isPending.value"
|
||||
@@ -314,17 +461,101 @@ onBeforeUnmount(() => {
|
||||
show-icon
|
||||
:message="t('article.editor.messages.locked')"
|
||||
/>
|
||||
<div class="article-editor-view__layout">
|
||||
<div
|
||||
class="article-editor-view__layout"
|
||||
:class="{ 'article-editor-view__layout--with-compliance': compliancePanelOpen }"
|
||||
>
|
||||
<section class="article-editor-view__main">
|
||||
<ArticleEditorCanvas
|
||||
ref="editorCanvasRef"
|
||||
:key="String(articleId)"
|
||||
v-model:title="title"
|
||||
v-model="markdown"
|
||||
:article-id="articleId"
|
||||
:disabled="editorLocked"
|
||||
:upload-image="uploadEditorImage"
|
||||
:compliance-violations="editorComplianceViolations"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<aside
|
||||
v-if="compliancePanelOpen"
|
||||
class="article-editor-view__compliance-panel"
|
||||
aria-label="内容合规检测"
|
||||
>
|
||||
<div class="article-editor-view__compliance-panel-head">
|
||||
<h2>内容合规检测</h2>
|
||||
<a-button
|
||||
type="text"
|
||||
shape="circle"
|
||||
aria-label="关闭合规检测"
|
||||
@click="closeCompliancePanel"
|
||||
>
|
||||
<template #icon><CloseOutlined /></template>
|
||||
</a-button>
|
||||
</div>
|
||||
|
||||
<template v-if="editorComplianceResult">
|
||||
<a-alert
|
||||
show-icon
|
||||
:type="complianceDecisionTone"
|
||||
:message="
|
||||
editorComplianceResult.hit_count > 0
|
||||
? `发现 ${editorComplianceResult.hit_count} 条风险,仅供编辑参考`
|
||||
: '当前版本未发现合规风险'
|
||||
"
|
||||
:description="
|
||||
editorComplianceResult.truncated
|
||||
? '命中明细已达到保存上限,请优先处理高风险词条后重新检测。'
|
||||
: undefined
|
||||
"
|
||||
/>
|
||||
|
||||
<div class="article-editor-view__compliance-meta">
|
||||
<a-tag :color="editorComplianceResult.hit_count > 0 ? 'orange' : 'green'">
|
||||
{{ editorComplianceResult.hit_count > 0 ? '发现风险' : '检测通过' }}
|
||||
</a-tag>
|
||||
<span>耗时 {{ complianceElapsedLabel }}</span>
|
||||
</div>
|
||||
|
||||
<a-empty v-if="!complianceGroups.length" description="没有命中项" />
|
||||
|
||||
<section
|
||||
v-for="group in complianceGroups"
|
||||
v-else
|
||||
:key="group.key"
|
||||
class="article-editor-view__violation-group"
|
||||
>
|
||||
<h3>{{ violationGroupTitle(group.key) }}</h3>
|
||||
<article
|
||||
v-for="violation in group.items"
|
||||
:key="violationKey(violation)"
|
||||
class="article-editor-view__violation"
|
||||
>
|
||||
<div class="article-editor-view__violation-head">
|
||||
<a-tag :color="levelColor(violation.level)">
|
||||
{{ levelLabel(violation.level) }}
|
||||
</a-tag>
|
||||
<a-tag>{{ sourceLabel(violation.source) }}</a-tag>
|
||||
<strong>{{ violation.matched_text }}</strong>
|
||||
</div>
|
||||
<p v-if="violation.dictionary_name || violation.term_pattern">
|
||||
{{ violation.dictionary_name || '词库规则' }}
|
||||
<span v-if="violation.term_pattern"> · {{ violation.term_pattern }}</span>
|
||||
</p>
|
||||
<p v-if="violation.hint">{{ violation.hint }}</p>
|
||||
<div class="article-editor-view__violation-actions">
|
||||
<a-button size="small" @click="focusViolation(violation)">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
定位
|
||||
</a-button>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<a-empty v-else description="还没有检测结果" />
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -433,14 +664,112 @@ onBeforeUnmount(() => {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.article-editor-view__layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.article-editor-view__layout--with-compliance {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.article-editor-view__compliance-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
height: calc(100vh - 180px);
|
||||
overflow-y: auto;
|
||||
padding: 18px;
|
||||
border: 1px solid rgba(216, 225, 237, 0.9);
|
||||
border-radius: 24px;
|
||||
background: rgba(255, 255, 255, 0.94);
|
||||
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
|
||||
backdrop-filter: blur(14px);
|
||||
}
|
||||
|
||||
.article-editor-view__compliance-panel-head {
|
||||
position: sticky;
|
||||
top: -18px;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: -18px -18px 16px;
|
||||
padding: 16px 16px 14px 18px;
|
||||
border-bottom: 1px solid #eef2f8;
|
||||
background: rgba(255, 255, 255, 0.96);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.article-editor-view__compliance-panel-head h2 {
|
||||
margin: 0;
|
||||
color: #111827;
|
||||
font-size: 16px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.article-editor-view__leave-copy {
|
||||
margin: 0;
|
||||
color: #475467;
|
||||
line-height: 1.75;
|
||||
}
|
||||
|
||||
.article-editor-view__layout {
|
||||
min-width: 0;
|
||||
.article-editor-view__compliance-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin: 16px 0 18px;
|
||||
color: #667085;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.article-editor-view__violation-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.article-editor-view__violation-group h3 {
|
||||
margin: 0;
|
||||
color: #111827;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.article-editor-view__violation {
|
||||
padding: 14px;
|
||||
border: 1px solid #e6edf5;
|
||||
border-radius: 12px;
|
||||
background: #fbfcff;
|
||||
}
|
||||
|
||||
.article-editor-view__violation-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.article-editor-view__violation-head strong {
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.article-editor-view__violation p {
|
||||
margin: 10px 0 0;
|
||||
color: #667085;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.article-editor-view__violation-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.article-editor-view__main {
|
||||
@@ -449,6 +778,22 @@ onBeforeUnmount(() => {
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.article-editor-view__layout--with-compliance {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.article-editor-view__layout--with-compliance {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.article-editor-view__compliance-panel {
|
||||
height: min(560px, calc(100vh - 180px));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.article-editor-view__topbar {
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user