Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | <script setup lang="ts">
import { computed, onMounted, watch } from "vue";
import type { ReviewReport } from "@plain-journal/foundation";
import {
PjActionGroup,
PjButton,
PjField,
PjPageContainer,
PjStatusNotice,
PjSurface,
} from "@plain-journal/ui";
import {
useAdminReviewStore,
type ReviewGovernanceCommandPhase,
} from "../entities/admin-review";
import { useStaffSessionStore } from "../stores/session";
const session = useStaffSessionStore();
const review = useAdminReviewStore();
const roles = computed(() => session.profile?.roles ?? []);
const accessContext = computed(() => ({
authorized: Boolean(
session.authenticated
&& roles.value.some((role) => ["ADMIN", "OPERATOR"].includes(role)),
),
operatorId: session.profile?.id ?? null,
accessToken: session.accessToken,
}));
const reasonPresentation = {
SPAM: {
label: "垃圾或重复内容",
next: "核对是否存在批量、重复或与商品无关的内容。",
},
ABUSE: {
label: "攻击或不当表达",
next: "只判断公开内容是否越过平台规则,不改写顾客观点。",
},
FALSE_INFORMATION: {
label: "疑似错误信息",
next: "优先核对不可变订单行、商品规格与可验证服务事实。",
},
OTHER: {
label: "其他原因",
next: "依据举报说明补充核对,不用主观偏好替代事实。",
},
} as const;
function reasonFor(report: ReviewReport) {
return reasonPresentation[report.reasonCode];
}
function formatTimestamp(value: string | null): string {
return value ? new Date(value).toLocaleString("zh-CN") : "—";
}
function fieldId(prefix: string, reportId: string) {
return `${prefix}-${reportId.replace(/[^A-Za-z0-9_-]/gu, "-")}`;
}
function noticeTone(phase: ReviewGovernanceCommandPhase) {
return {
idle: "neutral",
processing: "processing",
unknown: "unknown",
accepted: "success",
rejected: "danger",
}[phase] as
| "neutral"
| "processing"
| "unknown"
| "success"
| "danger";
}
function noticeTitle(phase: ReviewGovernanceCommandPhase) {
return {
idle: "评价治理命令",
processing: "命令正在处理中",
unknown: "命令结果未知",
accepted: "命令结果已确认",
rejected: "命令未被接受",
}[phase];
}
function loadReports() {
return review.loadReports(accessContext.value);
}
watch(accessContext, (context) => {
review.synchronizeAccess(context);
});
onMounted(() => {
review.synchronizeAccess(accessContext.value);
void loadReports();
});
</script>
<template>
<PjPageContainer as="section" size="wide" class="review-page">
<header class="review-hero">
<div>
<p class="eyebrow">Catalog 公开评价治理</p>
<h1>评价治理</h1>
<p>
运营人员可以给公开评价追加一次平台回复,并对顾客举报作出审核结论。
页面只呈现 Catalog 已确认的回复、审核审计和评价可见性事实。
</p>
</div>
<span class="status-label">ADMIN / OPERATOR</span>
</header>
<PjStatusNotice tone="neutral" title="回复与审核的恢复边界">
<p>
两类写入都有稳定命令 ID。网络、超时、非法响应或 5xx 后,页面冻结原命令和
完整载荷,只允许原样重放。举报列表不返回命令 ID 或审核原因,公开评价也不能
证明是哪条命令生效,因此它们不能替代 Catalog 幂等重放。
</p>
</PjStatusNotice>
<PjSurface tone="soft" padding="large">
<div class="review-filter">
<PjField label="举报状态" for-id="review-report-status">
<select
id="review-report-status"
v-model="review.status"
class="pj-control"
:disabled="review.loading"
@change="loadReports"
>
<option value="OPEN">等待审核</option>
<option value="RESOLVED">已完成审核</option>
</select>
</PjField>
<div class="review-filter__summary">
<span>{{ review.total }} 条当前举报</span>
<small v-if="review.refreshedAt">
最近读取 {{ formatTimestamp(review.refreshedAt) }}
</small>
</div>
<PjButton
type="button"
variant="text"
:loading="review.loading"
@click="loadReports"
>
重新读取
</PjButton>
</div>
</PjSurface>
<PjStatusNotice
v-if="review.commandPhase !== 'idle' && review.commandMessage"
class="review-command-notice"
:tone="noticeTone(review.commandPhase)"
:title="noticeTitle(review.commandPhase)"
:assertive="review.commandPhase === 'rejected'"
>
<p>{{ review.commandMessage }}</p>
<p v-if="review.pendingReportId">
待确认举报:<code>{{ review.pendingReportId }}</code>;
命令:{{ review.pendingCommandLabel }};
ID:<code>{{ review.pendingCommandId }}</code>。
</p>
<template #actions>
<PjActionGroup>
<PjButton
v-if="review.canRetryPending"
type="button"
:loading="review.submitting"
@click="review.retryPending(accessContext)"
>
使用原命令 ID 重试
</PjButton>
<PjButton
v-if="!review.pendingCommand"
type="button"
variant="text"
@click="review.resetCommandNotice"
>
关闭提示
</PjButton>
</PjActionGroup>
</template>
</PjStatusNotice>
<PjStatusNotice
v-if="review.loadError"
tone="danger"
title="评价举报读取未完成"
assertive
>
<p>{{ review.loadError }}</p>
<p v-if="review.reports.length > 0">
页面保留上一次已经显示的 Catalog 举报事实,没有把读取失败伪装成空队列。
</p>
</PjStatusNotice>
<div
v-if="review.loading && review.reports.length === 0"
class="review-state"
role="status"
>
正在读取 Catalog 评价举报…
</div>
<div
v-else-if="!review.loading && review.reports.length === 0"
class="review-state"
>
当前筛选下没有评价举报。
</div>
<section
v-else
class="review-list"
aria-label="评价举报事实列表"
>
<PjSurface
v-for="report in review.reports"
:key="report.id"
as="article"
tone="plain"
padding="none"
class="review-record"
>
<header class="review-record__header">
<div>
<p class="eyebrow">{{ reasonFor(report).label }}</p>
<h2>举报 {{ report.id }}</h2>
</div>
<span
class="review-status"
:data-tone="report.status === 'OPEN' ? 'warning' : 'neutral'"
>
{{ report.status === "OPEN" ? "等待审核" : "审核完成" }}
</span>
</header>
<div class="review-record__journey">
<div>
<span>核对重点</span>
<strong>{{ reasonFor(report).label }}</strong>
</div>
<p>{{ reasonFor(report).next }}</p>
</div>
<dl class="review-facts">
<div>
<dt>评价 ID</dt>
<dd><code>{{ report.reviewId }}</code></dd>
</div>
<div>
<dt>商品 ID</dt>
<dd><code>{{ report.productId }}</code></dd>
</div>
<div>
<dt>顾客评分</dt>
<dd>{{ report.rating }} / 5</dd>
</div>
<div>
<dt>举报时间</dt>
<dd>{{ formatTimestamp(report.createdAt) }}</dd>
</div>
<div>
<dt>举报状态</dt>
<dd>{{ report.status }}</dd>
</div>
<div>
<dt>审核结论</dt>
<dd>{{ report.resolution || "尚未审核" }}</dd>
</div>
<div>
<dt>完成时间</dt>
<dd>{{ formatTimestamp(report.resolvedAt) }}</dd>
</div>
</dl>
<section class="review-evidence">
<div>
<span>顾客公开评价</span>
<blockquote>{{ report.reviewContent }}</blockquote>
</div>
<div>
<span>举报补充说明</span>
<p>{{ report.detail || "举报人未补充说明。" }}</p>
</div>
</section>
<template v-if="report.status === 'OPEN'">
<PjSurface
tone="soft"
padding="medium"
class="review-action"
>
<form @submit.prevent="review.reply(report, accessContext)">
<header>
<div>
<p class="eyebrow">一次性平台回复</p>
<h3>补充可核实事实</h3>
</div>
<span>回复不会改变举报状态,也不能替代审核结论。</span>
</header>
<PjStatusNotice
v-if="review.confirmedReplies[report.reviewId]"
tone="success"
title="平台回复已确认"
>
<p>{{ review.confirmedReplies[report.reviewId]?.content }}</p>
</PjStatusNotice>
<template v-else>
<PjField
label="平台公开回复"
:for-id="fieldId('review-reply', report.id)"
hint="1–1000 字;结果未知时正文和命令 ID 会被冻结。"
required
>
<textarea
:id="fieldId('review-reply', report.id)"
v-model="review.reviewForm(report.id).replyContent"
class="pj-control"
maxlength="1000"
rows="4"
required
:readonly="review.commandBlocked"
placeholder="仅记录商品、订单、履约或服务中可核实的事实"
></textarea>
</PjField>
<div class="review-command-identity">
<span>回复命令 ID</span>
<code>{{ review.reviewForm(report.id).replyCommandId }}</code>
</div>
<PjButton
type="submit"
variant="secondary"
:loading="
review.submitting
&& review.pendingReportId === report.id
&& review.pendingCommand?.kind === 'reply'
"
:disabled="review.commandBlocked"
>
保存平台回复
</PjButton>
</template>
</form>
</PjSurface>
<PjSurface
tone="soft"
padding="medium"
class="review-action"
>
<form @submit.prevent="review.moderate(report, accessContext)">
<header>
<div>
<p class="eyebrow">Catalog 审核审计</p>
<h3>记录举报结论</h3>
</div>
<span>
UPHELD 隐藏公开评价;REJECTED 只驳回举报,不会重新发布已隐藏评价。
</span>
</header>
<div class="review-action__fields">
<PjField
label="审核结论"
:for-id="fieldId('review-resolution', report.id)"
required
>
<select
:id="fieldId('review-resolution', report.id)"
v-model="review.reviewForm(report.id).resolution"
class="pj-control"
:disabled="review.commandBlocked"
>
<option value="REJECTED">举报不成立</option>
<option value="UPHELD">举报成立并隐藏评价</option>
</select>
</PjField>
<PjField
label="审核说明"
:for-id="fieldId('review-resolution-reason', report.id)"
hint="8–500 字;说明核对了哪些事实以及结论依据。"
required
>
<textarea
:id="fieldId('review-resolution-reason', report.id)"
v-model="review.reviewForm(report.id).resolutionReason"
class="pj-control"
minlength="8"
maxlength="500"
rows="4"
required
:readonly="review.commandBlocked"
></textarea>
</PjField>
</div>
<div class="review-command-identity">
<span>审核命令 ID</span>
<code>{{ review.reviewForm(report.id).moderationCommandId }}</code>
</div>
<PjButton
type="submit"
:loading="
review.submitting
&& review.pendingReportId === report.id
&& review.pendingCommand?.kind === 'moderation'
"
:disabled="review.commandBlocked"
>
提交审核结论
</PjButton>
</form>
</PjSurface>
</template>
</PjSurface>
</section>
</PjPageContainer>
</template>
<style scoped>
.review-page {
min-width: 0;
display: grid;
gap: var(--pj-space-7);
padding-block: var(--pj-space-7) var(--pj-space-8);
}
.review-hero,
.review-filter,
.review-record__header,
.review-action header {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: var(--pj-space-5);
}
.review-hero h1,
.review-record h2,
.review-record h3 {
margin: 0;
}
.review-hero h1 {
font-size: var(--pj-font-size-xl);
font-weight: 520;
letter-spacing: -0.04em;
}
.review-hero p:last-child {
max-width: var(--pj-layout-reading);
margin-bottom: 0;
color: var(--pj-color-muted);
line-height: var(--pj-line-height-relaxed);
}
.review-filter {
align-items: center;
}
.review-filter .pj-field {
width: min(100%, 22rem);
}
.review-filter__summary {
min-width: 0;
display: grid;
gap: var(--pj-space-1);
margin-left: auto;
color: var(--pj-color-muted);
text-align: right;
}
.review-filter__summary span {
color: var(--pj-color-text);
}
.review-state {
min-height: 14rem;
display: grid;
place-items: center;
color: var(--pj-color-muted);
border-block: 1px solid var(--pj-color-line);
}
.review-list {
min-width: 0;
display: grid;
gap: var(--pj-space-7);
}
.review-record {
min-width: 0;
overflow: hidden;
border-block: 1px solid var(--pj-color-line);
}
.review-record__header,
.review-record__journey,
.review-facts,
.review-evidence,
.review-action {
padding-inline: var(--pj-space-6);
}
.review-record__header {
padding-block: var(--pj-space-6);
}
.review-record__header h2 {
overflow-wrap: anywhere;
font-size: var(--pj-font-size-xl);
font-weight: 540;
}
.review-status {
flex: 0 0 auto;
padding: var(--pj-space-1) var(--pj-space-3);
border: 1px solid var(--pj-color-line);
color: var(--pj-color-muted);
font-size: var(--pj-font-size-sm);
}
.review-status[data-tone="warning"] {
border-color: var(--pj-status-warning-line);
color: var(--pj-status-warning-text);
}
.review-record__journey {
display: grid;
grid-template-columns: minmax(12rem, 0.35fr) minmax(0, 1fr);
gap: var(--pj-space-6);
padding-block: var(--pj-space-5);
border-block: 1px solid var(--pj-color-line);
background: var(--pj-color-surface-soft);
}
.review-record__journey div {
display: grid;
gap: var(--pj-space-1);
}
.review-record__journey span,
.review-evidence span,
.review-command-identity span {
color: var(--pj-color-muted);
font-size: var(--pj-font-size-xs);
}
.review-record__journey p {
margin: 0;
color: var(--pj-color-muted);
line-height: var(--pj-line-height-relaxed);
}
.review-facts {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: var(--pj-space-4) var(--pj-space-5);
margin: 0;
padding-block: var(--pj-space-6);
}
.review-facts div {
min-width: 0;
padding-top: var(--pj-space-3);
border-top: 1px solid var(--pj-color-line);
}
.review-facts dt {
color: var(--pj-color-muted);
font-size: var(--pj-font-size-xs);
}
.review-facts dd {
margin: var(--pj-space-1) 0 0;
overflow-wrap: anywhere;
}
.review-evidence {
display: grid;
grid-template-columns: minmax(0, 1.2fr) minmax(16rem, 0.8fr);
gap: var(--pj-space-6);
padding-block: var(--pj-space-6);
border-top: 1px solid var(--pj-color-line);
}
.review-evidence > div {
min-width: 0;
display: grid;
align-content: start;
gap: var(--pj-space-3);
}
.review-evidence blockquote,
.review-evidence p {
margin: 0;
white-space: pre-wrap;
overflow-wrap: anywhere;
line-height: var(--pj-line-height-relaxed);
}
.review-evidence blockquote {
padding-left: var(--pj-space-4);
border-left: 2px solid var(--pj-color-accent);
font-size: var(--pj-font-size-lg);
}
.review-evidence p {
color: var(--pj-color-muted);
}
.review-action {
border-top: 1px solid var(--pj-color-line);
}
.review-action form {
display: grid;
gap: var(--pj-space-5);
}
.review-action header {
align-items: flex-start;
}
.review-action header > span {
max-width: 30rem;
color: var(--pj-color-muted);
font-size: var(--pj-font-size-sm);
text-align: right;
}
.review-action__fields {
display: grid;
grid-template-columns: minmax(12rem, 0.35fr) minmax(0, 1fr);
gap: var(--pj-space-5);
}
.review-action textarea {
resize: vertical;
line-height: var(--pj-line-height-relaxed);
}
.review-command-identity {
min-width: 0;
display: grid;
gap: var(--pj-space-1);
}
.review-command-identity code {
overflow-wrap: anywhere;
}
@media (max-width: 64rem) {
.review-facts {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 48rem) {
.review-hero,
.review-filter,
.review-record__header,
.review-action header {
align-items: flex-start;
flex-direction: column;
}
.review-filter .pj-field {
width: 100%;
}
.review-filter__summary {
margin-left: 0;
text-align: left;
}
.review-record__journey,
.review-evidence,
.review-action__fields {
grid-template-columns: minmax(0, 1fr);
}
.review-action header > span {
text-align: left;
}
}
@media (max-width: 32rem) {
.review-record__header,
.review-record__journey,
.review-facts,
.review-evidence,
.review-action {
padding-inline: var(--pj-space-4);
}
.review-facts {
grid-template-columns: minmax(0, 1fr);
}
}
</style>
|