feat(admin): redesign ticket handling dialog as conversation workspace
Render the original question and replies as one chat-style timeline, merge editor and toolbar into a shared composer for replies and notes, and refresh sidebar cards. Remove superseded renderers and selectors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
09f3a94cea
commit
d7616b193e
3 files changed
+182
-139
No files matched your search
+107
-72
@@ -12,7 +12,8 @@
|
||||
.aksrt-tickets-admin__table .row-title { text-align: left; font-size: 14px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
|
||||
.aksrt-tickets-admin__sub { margin-top: 4px; color: var(--an-text-2); font-size: 12px; overflow-wrap: anywhere; }
|
||||
.aksrt-native .aksrt-tickets-admin__row.is-awaiting td:first-child { box-shadow: inset 3px 0 0 var(--an-primary); }
|
||||
.aksrt-ticket-hint { color: var(--an-text-2); font-size: 12px; font-weight: 400; }
|
||||
.aksrt-ticket-hint { color: var(--an-muted); font-size: 12px; font-weight: 400; }
|
||||
.aksrt-ticket-pill { display: inline-flex; align-items: center; min-width: 18px; height: 18px; padding: 0 6px; color: var(--an-text-2); background: var(--an-bg-soft); border-radius: 9px; font-size: 11px; font-weight: 500; line-height: 1; justify-content: center; font-variant-numeric: tabular-nums; vertical-align: 1px; }
|
||||
.aksrt-ticket-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--aksrt-ticket-color); }
|
||||
.aksrt-ticket-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; color: var(--an-text); background: var(--an-bg-soft); border: 1px solid var(--an-border); border-radius: 6px; font-size: 12px; line-height: 20px; white-space: nowrap; }
|
||||
.aksrt-ticket-badge::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--aksrt-ticket-color, var(--an-muted)); }
|
||||
@@ -25,120 +26,154 @@
|
||||
html.aksrt-ticket-modal-open { overflow: hidden; scrollbar-gutter: stable; }
|
||||
.aksrt-ticket-dialog {
|
||||
box-sizing: border-box;
|
||||
width: min(1180px, calc(100vw - 48px));
|
||||
width: min(1200px, calc(100vw - 48px));
|
||||
max-width: none;
|
||||
max-height: calc(100dvh - 48px);
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
color: var(--an-text);
|
||||
background: var(--an-card);
|
||||
border: 1px solid var(--an-border);
|
||||
border: 0;
|
||||
border-radius: var(--an-radius);
|
||||
box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
|
||||
box-shadow: 0 0 0 1px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .12), 0 32px 80px rgba(15, 23, 42, .16);
|
||||
overflow: hidden;
|
||||
font: inherit;
|
||||
}
|
||||
.aksrt-ticket-dialog:not([open]) { display: none; }
|
||||
.aksrt-ticket-dialog[open] { animation: aksrt-ticket-dialog-in .18s ease-out; }
|
||||
.aksrt-ticket-dialog[open]::backdrop { animation: aksrt-ticket-fade-in .18s ease-out; }
|
||||
@keyframes aksrt-ticket-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
|
||||
@keyframes aksrt-ticket-fade-in { from { opacity: 0; } }
|
||||
.aksrt-ticket-dialog--create { width: min(720px, calc(100vw - 48px)); }
|
||||
.aksrt-ticket-dialog::backdrop { background: rgba(25, 32, 39, .48); }
|
||||
.aksrt-ticket-dialog__frame { display: flex; flex-direction: column; max-height: calc(100dvh - 50px); margin: 0; }
|
||||
.aksrt-ticket-dialog__head { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--an-border); }
|
||||
.aksrt-ticket-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
|
||||
.aksrt-ticket-dialog__frame { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); margin: 0; }
|
||||
.aksrt-ticket-dialog__head { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 24px; border-bottom: 1px solid var(--an-border-soft); }
|
||||
.aksrt-ticket-dialog__head > div { min-width: 0; }
|
||||
.aksrt-ticket-dialog__head h2 { margin: 0; color: var(--an-text); font-size: 19px; line-height: 1.5; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-dialog__head p { margin: 6px 0 0; color: var(--an-text-2); font-size: 12px; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-dialog__close { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; color: var(--an-text-2); background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
|
||||
.aksrt-ticket-dialog__close:hover { color: var(--an-text); background: var(--an-bg-soft); border-color: var(--an-border); }
|
||||
.aksrt-ticket-dialog__head h2 { margin: 0; color: var(--an-text); font-size: 18px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-dialog__head h2:focus { outline: 0; }
|
||||
.aksrt-ticket-dialog__head p { margin: 4px 0 0; color: var(--an-muted); font-size: 12px; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-dialog__close { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 32px; height: 32px; margin: -2px -6px 0 0; padding: 0; color: var(--an-muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
|
||||
.aksrt-ticket-dialog__close:hover { color: var(--an-text); background: var(--an-bg-soft); }
|
||||
.aksrt-ticket-dialog__body { min-height: 0; padding: 20px 24px; overflow-y: auto; overscroll-behavior: contain; }
|
||||
.aksrt-ticket-dialog--detail .aksrt-ticket-dialog__body { min-height: 120px; background: var(--an-bg-soft); }
|
||||
.aksrt-ticket-dialog__foot { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--an-border); }
|
||||
.aksrt-ticket-dialog--detail .aksrt-ticket-dialog__body { min-height: 160px; padding: 16px; background: var(--an-bg-soft); }
|
||||
.aksrt-ticket-dialog--detail .aksrt-ticket-dialog__body[aria-busy="true"]:empty { background: var(--an-bg-soft) linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent) -200px 0 / 200px 100% no-repeat; animation: aksrt-ticket-shimmer 1.2s linear infinite; }
|
||||
@keyframes aksrt-ticket-shimmer { to { background-position: calc(100% + 200px) 0; } }
|
||||
.aksrt-ticket-dialog__foot { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--an-card); border-top: 1px solid var(--an-border-soft); }
|
||||
.aksrt-ticket-dialog__foot > .aksrt-ticket-hint { margin-right: auto; }
|
||||
.aksrt-ticket-dialog [hidden] { display: none !important; }
|
||||
.aksrt-ticket-dialog textarea { box-sizing: border-box; width: 100%; min-height: 70px; resize: vertical; line-height: 1.65; }
|
||||
.aksrt-ticket-dialog textarea { box-sizing: border-box; width: 100%; min-height: 64px; resize: vertical; line-height: 1.65; }
|
||||
.aksrt-ticket-dialog :is(input, select, textarea, button, a):focus-visible,
|
||||
.aksrt-ticket-conversation__scroll:focus-visible { outline: 2px solid var(--an-primary); outline-offset: 2px; box-shadow: none; }
|
||||
.aksrt-ticket-dialog button:disabled { cursor: default; opacity: .6; }
|
||||
.aksrt-ticket-feedback { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; color: #176b3d; background: var(--an-primary-soft); border-bottom: 1px solid var(--an-border); }
|
||||
.aksrt-ticket-feedback { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; color: #176b3d; background: var(--an-primary-soft); border-bottom: 1px solid color-mix(in srgb, var(--an-primary) 18%, transparent); font-size: 13px; }
|
||||
.aksrt-ticket-feedback p { margin: 0; }
|
||||
.aksrt-ticket-feedback.is-error { color: #a61b36; background: #fdf0f2; }
|
||||
.aksrt-ticket-feedback.is-error { color: #a61b36; background: #fdf0f2; border-bottom-color: #f6d3da; }
|
||||
.aksrt-ticket-feedback .button { flex: none; }
|
||||
|
||||
/* 处理工作区:会话与用户回复在左,内部处理与备注在右。 */
|
||||
.aksrt-ticket-detail { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
|
||||
/* 处理工作区:会话与回复在左,处理信息与内部备注在右。 */
|
||||
.aksrt-ticket-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
|
||||
.aksrt-ticket-detail__main,
|
||||
.aksrt-ticket-detail__side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
|
||||
.aksrt-ticket-detail__side { position: sticky; top: 0; }
|
||||
.aksrt-ticket-conversation,
|
||||
.aksrt-ticket-detail__reply-form,
|
||||
.aksrt-ticket-detail__card { background: var(--an-card); border: 1px solid var(--an-border); border-radius: var(--an-radius-sm); }
|
||||
.aksrt-ticket-detail__reply-form,
|
||||
.aksrt-ticket-composer--reply,
|
||||
.aksrt-ticket-detail__card { background: var(--an-card); border: 1px solid var(--an-border); border-radius: var(--an-radius); }
|
||||
.aksrt-ticket-detail__card { padding: 16px; }
|
||||
.aksrt-ticket-detail__heading { display: block; margin: 0 0 10px; color: var(--an-text); font-size: 14px; font-weight: 600; }
|
||||
.aksrt-ticket-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
|
||||
.aksrt-ticket-section-head h3 { margin: 0; color: var(--an-text); font-size: 14px; }
|
||||
.aksrt-ticket-section-head .button-link { font-size: 12px; }
|
||||
.aksrt-ticket-conversation > .aksrt-ticket-section-head { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--an-border-soft); }
|
||||
.aksrt-ticket-conversation__scroll { max-height: 48vh; padding: 16px; overflow-y: auto; overscroll-behavior: contain; }
|
||||
.aksrt-ticket-detail__origin { padding: 0 0 18px; }
|
||||
.aksrt-ticket-detail__msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; font-size: 12px; }
|
||||
.aksrt-ticket-detail__msg-head img { flex: none; border-radius: 50%; }
|
||||
.aksrt-ticket-detail__msg-head strong { color: var(--an-text); overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__msg-head time { margin-left: auto; color: var(--an-text-2); }
|
||||
.aksrt-ticket-detail__body { max-width: 76ch; overflow-wrap: anywhere; line-height: 1.75; }
|
||||
.aksrt-ticket-detail__body > p:first-child { margin-top: 0; }
|
||||
.aksrt-ticket-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
|
||||
.aksrt-ticket-section-head h3 { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--an-text); font-size: 14px; font-weight: 600; }
|
||||
.aksrt-ticket-section-head .button-link { font-size: 12px; text-decoration: none; }
|
||||
.aksrt-ticket-conversation > .aksrt-ticket-section-head { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--an-border-soft); }
|
||||
|
||||
/* 会话时间线:用户在左、客服在右、系统事件居中。 */
|
||||
.aksrt-ticket-conversation__scroll { max-height: 52vh; padding: 20px 16px; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
|
||||
.aksrt-ticket-detail__thread { display: flex; flex-direction: column; gap: 18px; margin: 0; padding: 0; list-style: none; }
|
||||
.aksrt-ticket-detail__message { display: flex; align-items: flex-start; gap: 10px; max-width: 86%; margin: 0; }
|
||||
.aksrt-ticket-detail__message.is-admin { flex-direction: row-reverse; align-self: flex-end; }
|
||||
.aksrt-ticket-detail__message.is-origin { max-width: none; }
|
||||
.aksrt-ticket-detail__avatar { flex: none; width: 32px; height: 32px; background: var(--an-border); border-radius: 50%; object-fit: cover; }
|
||||
.aksrt-ticket-detail__bubble { min-width: 0; padding: 10px 14px 12px; background: var(--an-bg-soft); border: 1px solid var(--an-border-soft); border-radius: 4px 12px 12px 12px; }
|
||||
.aksrt-ticket-detail__message.is-admin .aksrt-ticket-detail__bubble { background: var(--an-primary-soft); border-color: color-mix(in srgb, var(--an-primary) 20%, transparent); border-radius: 12px 4px 12px 12px; }
|
||||
.aksrt-ticket-detail__message.is-origin .aksrt-ticket-detail__bubble { flex: 1; background: var(--an-card); border-color: var(--an-border); border-left: 3px solid var(--an-info); border-radius: 4px 12px 12px 12px; }
|
||||
.aksrt-ticket-detail__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 6px; font-size: 12px; }
|
||||
.aksrt-ticket-detail__message.is-admin .aksrt-ticket-detail__meta { flex-direction: row-reverse; }
|
||||
.aksrt-ticket-detail__meta strong { color: var(--an-text); font-weight: 600; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__role { padding: 0 6px; color: var(--an-text-2); background: rgba(15, 23, 42, .05); border-radius: 4px; line-height: 18px; }
|
||||
.aksrt-ticket-detail__meta time { color: var(--an-muted); font-variant-numeric: tabular-nums; }
|
||||
.aksrt-ticket-detail__body { color: var(--an-text); overflow-wrap: anywhere; line-height: 1.7; }
|
||||
.aksrt-ticket-detail__body > p { margin: 0 0 .6em; }
|
||||
.aksrt-ticket-detail__body > p:last-child { margin-bottom: 0; }
|
||||
.aksrt-ticket-detail__empty { margin: 10px 0 0; color: var(--an-text-2); }
|
||||
.aksrt-ticket-detail__replies { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
|
||||
.aksrt-ticket-detail__reply { margin: 0; padding: 14px; border: 1px solid var(--an-border); border-radius: var(--an-radius-sm); }
|
||||
.aksrt-ticket-detail__reply.is-admin { margin-left: 24px; background: var(--an-primary-soft); border-color: #c4e7d3; }
|
||||
.aksrt-ticket-detail__reply.is-user { margin-right: 24px; }
|
||||
.aksrt-ticket-detail__system { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; margin: 0; color: var(--an-text-2); font-size: 12px; }
|
||||
.aksrt-ticket-detail__quote { margin: 0 0 10px; padding: 8px 12px; color: var(--an-text-2); background: var(--an-bg-soft); border-left: 3px solid var(--an-border); white-space: pre-line; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
|
||||
.aksrt-ticket-detail__empty,
|
||||
.aksrt-ticket-detail__event { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin: 0; color: var(--an-muted); font-size: 12px; text-align: center; }
|
||||
.aksrt-ticket-detail__event::before,
|
||||
.aksrt-ticket-detail__event::after { content: ""; flex: 1 1 24px; max-width: 80px; height: 1px; background: var(--an-border); }
|
||||
.aksrt-ticket-detail__quote { margin: 0 0 8px; padding: 6px 10px; color: var(--an-text-2); background: rgba(15, 23, 42, .04); border-left: 3px solid var(--an-border); border-radius: 0 6px 6px 0; font-size: 12px; white-space: pre-line; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
|
||||
.aksrt-ticket-detail__attachments li { margin: 0; }
|
||||
.aksrt-ticket-detail__attachments img { display: block; width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--an-border); border-radius: 6px; }
|
||||
.aksrt-ticket-counter { display: block; margin-top: 5px; color: var(--an-text-2); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.aksrt-ticket-detail__attachments a { display: block; border-radius: 8px; transition: transform .15s; }
|
||||
.aksrt-ticket-detail__attachments a:hover { transform: translateY(-1px); }
|
||||
.aksrt-ticket-detail__attachments img { display: block; width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--an-border); border-radius: 8px; }
|
||||
|
||||
/* 输入器:文本框与工具栏合成一个可聚焦整体。 */
|
||||
.aksrt-ticket-composer { margin: 0; }
|
||||
.aksrt-ticket-composer--reply { padding: 14px 16px 16px; }
|
||||
.aksrt-ticket-composer__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
|
||||
.aksrt-ticket-composer__head label { color: var(--an-text); font-size: 14px; font-weight: 600; }
|
||||
.aksrt-ticket-composer--note .aksrt-ticket-composer__head label { font-size: 13px; font-weight: 500; }
|
||||
.aksrt-ticket-composer__box { background: var(--an-card); border: 1px solid var(--an-border); border-radius: var(--an-radius-sm); transition: border-color .15s, box-shadow .15s; }
|
||||
.aksrt-ticket-composer__box:focus-within { border-color: var(--an-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--an-primary) 18%, transparent); }
|
||||
.aksrt-native .aksrt-ticket-composer__box textarea { display: block; padding: 10px 12px; background: transparent; border: 0; border-radius: var(--an-radius-sm) var(--an-radius-sm) 0 0; box-shadow: none; }
|
||||
.aksrt-native .aksrt-ticket-composer__box textarea:focus,
|
||||
.aksrt-ticket-dialog .aksrt-ticket-composer__box textarea:focus-visible { outline: 0; box-shadow: none; }
|
||||
.aksrt-ticket-composer__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-top: 1px solid var(--an-border-soft); }
|
||||
.aksrt-ticket-composer__bar select { max-width: min(240px, 100%); min-height: 30px; font-size: 12px; }
|
||||
.aksrt-ticket-counter { margin-left: auto; color: var(--an-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
||||
.aksrt-ticket-counter.is-over { color: var(--an-danger); }
|
||||
.aksrt-ticket-detail__reply-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
|
||||
.aksrt-ticket-detail__reply-foot select { max-width: min(260px, 100%); }
|
||||
.aksrt-ticket-detail__reply-foot .button-primary { margin-left: auto; }
|
||||
.aksrt-ticket-detail__closed { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 16px; color: var(--an-text-2); background: var(--an-card); border: 1px dashed var(--an-border); border-radius: var(--an-radius-sm); }
|
||||
.aksrt-ticket-detail__closed .dashicons { flex: none; }
|
||||
.aksrt-ticket-detail__info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; margin: 0; font-size: 12px; }
|
||||
.aksrt-ticket-detail__info dt { color: var(--an-text-2); }
|
||||
.aksrt-ticket-detail__info dd { margin: 0; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__status-form { display: flex; flex-direction: column; gap: 12px; }
|
||||
.aksrt-ticket-detail__status-form .aksrt-ticket-detail__info dt { align-self: center; }
|
||||
.aksrt-native-field .aksrt-ticket-counter { align-self: flex-end; }
|
||||
.aksrt-ticket-detail__closed { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 16px; color: var(--an-text-2); background: var(--an-card); border: 1px dashed var(--an-border); border-radius: var(--an-radius); font-size: 13px; }
|
||||
.aksrt-ticket-detail__closed .dashicons { flex: none; color: var(--an-muted); }
|
||||
|
||||
/* 工单信息:标签列固定宽度,可编辑项直接内联。 */
|
||||
.aksrt-ticket-detail__info { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px 12px; align-items: center; margin: 0; font-size: 13px; }
|
||||
.aksrt-ticket-detail__info dt { color: var(--an-muted); font-size: 12px; }
|
||||
.aksrt-ticket-detail__info dd { margin: 0; min-width: 0; color: var(--an-text); overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__status-form { display: flex; flex-direction: column; gap: 14px; }
|
||||
.aksrt-ticket-detail__status-form select { width: 100%; max-width: none; }
|
||||
.aksrt-ticket-close-warning { padding: 10px; color: #9d2038; background: #fdf0f2; border-radius: 6px; font-size: 12px; }
|
||||
.aksrt-ticket-detail__status-form > .button { align-self: stretch; justify-content: center; }
|
||||
.aksrt-ticket-close-warning { padding: 10px 12px; color: #9d2038; background: #fdf0f2; border: 1px solid #f6d3da; border-radius: var(--an-radius-sm); font-size: 12px; }
|
||||
.aksrt-ticket-close-warning label { display: flex; align-items: flex-start; gap: 6px; line-height: 1.6; }
|
||||
.aksrt-ticket-close-warning input { flex: none; margin: 3px 0 0; }
|
||||
.aksrt-ticket-detail__private { border-top: 3px solid var(--an-warning); }
|
||||
.aksrt-ticket-detail__private > .aksrt-ticket-hint { margin: -3px 0 12px; }
|
||||
.aksrt-ticket-detail__notes { display: flex; flex-direction: column; gap: 12px; max-height: 240px; margin: 0 0 14px; padding: 0; overflow-y: auto; list-style: none; }
|
||||
.aksrt-ticket-detail__notes li { margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--an-border-soft); overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__note-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; margin-bottom: 6px; font-size: 12px; }
|
||||
.aksrt-ticket-detail__note-head time { color: var(--an-text-2); }
|
||||
.aksrt-ticket-detail__note-form .button { margin-top: 8px; }
|
||||
|
||||
/* 内部备注:暖色便签,与对用户可见的会话区分。 */
|
||||
.aksrt-ticket-detail__private { background: #fffbf0; border-color: #f3e2b6; }
|
||||
.aksrt-ticket-detail__private .aksrt-ticket-section-head { margin-bottom: 4px; }
|
||||
.aksrt-ticket-detail__private > .aksrt-ticket-hint { margin: 0 0 12px; color: #a26b07; }
|
||||
.aksrt-ticket-detail__notes { display: flex; flex-direction: column; gap: 8px; max-height: 240px; margin: 0 0 12px; padding: 0; overflow-y: auto; list-style: none; }
|
||||
.aksrt-ticket-detail__notes li { margin: 0; padding: 8px 10px; background: var(--an-card); border: 1px solid #f3e2b6; border-radius: var(--an-radius-sm); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
|
||||
.aksrt-ticket-detail__note-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; margin-bottom: 4px; font-size: 12px; }
|
||||
.aksrt-ticket-detail__note-head time { color: var(--an-muted); font-variant-numeric: tabular-nums; }
|
||||
.aksrt-ticket-detail__private .aksrt-ticket-composer__box { border-color: #f3e2b6; }
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.aksrt-ticket-detail { grid-template-columns: minmax(0, 1fr); }
|
||||
.aksrt-ticket-detail__side { position: static; }
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.aksrt-ticket-dialog,
|
||||
.aksrt-ticket-dialog--create { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 8px; }
|
||||
.aksrt-ticket-dialog__frame { max-height: calc(100dvh - 18px); }
|
||||
.aksrt-ticket-dialog--create { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 10px; }
|
||||
.aksrt-ticket-dialog__frame { max-height: calc(100dvh - 16px); }
|
||||
.aksrt-ticket-dialog__head,
|
||||
.aksrt-ticket-dialog__body,
|
||||
.aksrt-ticket-dialog__foot,
|
||||
.aksrt-ticket-feedback { padding: 14px; }
|
||||
.aksrt-ticket-dialog__head h2 { font-size: 17px; }
|
||||
.aksrt-ticket-feedback { padding: 12px 14px; }
|
||||
.aksrt-ticket-dialog--detail .aksrt-ticket-dialog__body { padding: 10px; }
|
||||
.aksrt-ticket-dialog__head h2 { font-size: 16px; }
|
||||
.aksrt-ticket-dialog__foot > .aksrt-ticket-hint { flex-basis: 100%; }
|
||||
.aksrt-ticket-detail__reply.is-admin,
|
||||
.aksrt-ticket-detail__reply.is-user { margin-left: 0; margin-right: 0; }
|
||||
.aksrt-ticket-detail__msg-head time { flex-basis: 100%; margin-left: 0; }
|
||||
.aksrt-ticket-conversation__scroll { max-height: 44vh; padding: 12px; }
|
||||
.aksrt-ticket-detail__reply-foot select { max-width: 100%; width: 100%; }
|
||||
.aksrt-ticket-conversation__scroll { max-height: 44vh; padding: 14px 12px; }
|
||||
.aksrt-ticket-detail__message { max-width: 100%; }
|
||||
.aksrt-ticket-detail__avatar { width: 28px; height: 28px; }
|
||||
.aksrt-ticket-composer__bar select { flex-basis: 100%; max-width: 100%; }
|
||||
.aksrt-ticket-feedback { align-items: flex-start; flex-direction: column; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.aksrt-tickets-admin *, .aksrt-tickets-admin *::before { scroll-behavior: auto !important; transition: none !important; }
|
||||
.aksrt-tickets-admin *, .aksrt-tickets-admin *::before, .aksrt-tickets-admin *::backdrop { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/** 工单处理弹窗:会话、回复、处理信息与内部备注。@package AKSRT */
|
||||
/** 工单处理弹窗:左侧会话与回复输入,右侧处理信息与内部备注。@package AKSRT */
|
||||
|
||||
namespace AKSRT\Admin\Native;
|
||||
|
||||
@@ -16,81 +16,77 @@ trait UsersMenusTicketsDetail {
|
||||
|
||||
private function render_ticket_detail_panel(array $ticket): string {
|
||||
$id = (int) $ticket['id'];
|
||||
$replies = TicketRepository::get_instance()->replies($id);
|
||||
$notes = TicketNoteService::for_ticket($id);
|
||||
$closed = !empty($ticket['is_closed']);
|
||||
$html = '<div class="aksrt-ticket-detail" data-aksrt-ticket-detail="' . $id . '"><div class="aksrt-ticket-detail__main">';
|
||||
$html .= '<section class="aksrt-ticket-conversation" aria-label="' . esc_attr__('问题与沟通记录', 'aksrt') . '">';
|
||||
$html .= '<div class="aksrt-ticket-section-head"><h3>' . esc_html__('沟通记录', 'aksrt') . ' <span class="aksrt-ticket-hint">' . esc_html(sprintf(__('%d 条记录', 'aksrt'), count($replies))) . '</span></h3>';
|
||||
if ($replies !== []) {
|
||||
$html .= '<button type="button" class="button-link" data-aksrt-ticket-latest>' . esc_html__('查看最新记录', 'aksrt') . '</button>';
|
||||
}
|
||||
$html .= '</div><div class="aksrt-ticket-conversation__scroll" tabindex="0" role="region" aria-label="' . esc_attr__('可滚动的沟通记录', 'aksrt') . '">';
|
||||
$html .= '<article class="aksrt-ticket-detail__origin">';
|
||||
$html .= $this->ticket_message_head((int) $ticket['user_id'], (string) $ticket['user_name'], !empty($ticket['post_admin_id']) ? __('代客提交', 'aksrt') : __('提交了工单', 'aksrt'), (string) $ticket['post_time']);
|
||||
$html .= '<div class="aksrt-ticket-detail__body">' . wpautop(esc_html((string) $ticket['content'])) . '</div>';
|
||||
$html .= $this->ticket_attachments_html((array) $ticket['attachment']) . '</article>';
|
||||
if ($replies === []) {
|
||||
$html .= '<p class="aksrt-ticket-detail__empty">' . esc_html__('暂无回复,请核对问题后联系用户。', 'aksrt') . '</p>';
|
||||
} else {
|
||||
$html .= '<ol class="aksrt-ticket-detail__replies">';
|
||||
foreach ($replies as $reply) {
|
||||
if ((string) $reply['author_type'] === 'system') {
|
||||
$html .= '<li class="aksrt-ticket-detail__system"><span>' . esc_html((string) $reply['content']) . '</span><time>' . esc_html((string) $reply['created_at']) . '</time></li>';
|
||||
continue;
|
||||
}
|
||||
$admin = (string) $reply['author_type'] === 'admin';
|
||||
$html .= '<li class="aksrt-ticket-detail__reply is-' . ($admin ? 'admin' : 'user') . '">';
|
||||
$html .= $this->ticket_message_head((int) $reply['author_id'], (string) $reply['author_name'], $admin ? __('客服', 'aksrt') : __('用户', 'aksrt'), (string) $reply['created_at']);
|
||||
if (is_array($reply['quote'] ?? null)) {
|
||||
$quote = $reply['quote'];
|
||||
$html .= '<blockquote class="aksrt-ticket-detail__quote">' . esc_html(!empty($quote['is_deleted']) ? __('原回复已删除', 'aksrt') : (string) $quote['content']) . '</blockquote>';
|
||||
}
|
||||
$html .= '<div class="aksrt-ticket-detail__body">' . wpautop(esc_html((string) $reply['content'])) . '</div>';
|
||||
$html .= $this->ticket_attachments_html((array) $reply['attachment']) . '</li>';
|
||||
}
|
||||
$html .= '</ol>';
|
||||
}
|
||||
$html .= '</div></section>';
|
||||
$html .= $closed
|
||||
$html .= $this->ticket_conversation($ticket, TicketRepository::get_instance()->replies($id));
|
||||
$html .= !empty($ticket['is_closed'])
|
||||
? '<p class="aksrt-ticket-detail__closed"><span class="dashicons dashicons-lock" aria-hidden="true"></span>' . esc_html__('工单已关闭,不能继续回复或变更处理信息;仍可添加内部备注。', 'aksrt') . '</p>'
|
||||
: $this->ticket_reply_form($id);
|
||||
$html .= '</div><aside class="aksrt-ticket-detail__side" aria-label="' . esc_attr__('工单信息与内部备注', 'aksrt') . '">';
|
||||
$html .= $this->ticket_info_card($ticket);
|
||||
$html .= '<section class="aksrt-ticket-detail__card aksrt-ticket-detail__private"><h3 class="aksrt-ticket-detail__heading">' . esc_html__('内部备注', 'aksrt') . '</h3><p class="aksrt-ticket-hint">' . esc_html__('仅管理员可见,不会发送给用户。', 'aksrt') . '</p>';
|
||||
if ($notes !== []) {
|
||||
$html .= '<ul class="aksrt-ticket-detail__notes">';
|
||||
foreach ($notes as $note) {
|
||||
$html .= '<li><div class="aksrt-ticket-detail__note-head"><strong>' . esc_html((string) $note['admin_name']) . '</strong><time>' . esc_html((string) $note['created_at']) . '</time></div><div>' . nl2br(esc_html((string) $note['content'])) . '</div></li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
return $html . $this->ticket_info_card($ticket) . $this->ticket_notes_card($id) . '</aside></div>';
|
||||
}
|
||||
|
||||
/** 原始问题与回复同属一条时间线:用户在左、客服在右、系统事件居中。 */
|
||||
private function ticket_conversation(array $ticket, array $replies): string {
|
||||
$html = '<section class="aksrt-ticket-conversation" aria-label="' . esc_attr__('问题与沟通记录', 'aksrt') . '">';
|
||||
$html .= '<div class="aksrt-ticket-section-head"><h3>' . esc_html__('沟通记录', 'aksrt') . ' <span class="aksrt-ticket-pill">' . esc_html(sprintf(__('%d 条记录', 'aksrt'), count($replies))) . '</span></h3>';
|
||||
if ($replies !== []) {
|
||||
$html .= '<button type="button" class="button-link" data-aksrt-ticket-latest>' . esc_html__('查看最新记录', 'aksrt') . '</button>';
|
||||
}
|
||||
$html .= $this->ticket_form_open('note', $id, 'aksrt-ticket-detail__note-form');
|
||||
$html .= $this->ticket_editor('aksrt-ticket-note-' . $id, __('备注内容', 'aksrt'), __('记录处理进展、排查结论…', 'aksrt'), 3);
|
||||
$html .= '<button type="submit" class="button">' . esc_html__('添加内部备注', 'aksrt') . '</button></form></section></aside></div>';
|
||||
return $html;
|
||||
$html .= '</div><div class="aksrt-ticket-conversation__scroll" tabindex="0" role="region" aria-label="' . esc_attr__('可滚动的沟通记录', 'aksrt') . '"><ol class="aksrt-ticket-detail__thread">';
|
||||
$html .= $this->ticket_message('origin', (int) $ticket['user_id'], (string) $ticket['user_name'], !empty($ticket['post_admin_id']) ? __('代客提交', 'aksrt') : __('提交了工单', 'aksrt'), (string) $ticket['post_time'], (string) $ticket['content'], (array) $ticket['attachment']);
|
||||
if ($replies === []) {
|
||||
$html .= '<li class="aksrt-ticket-detail__empty">' . esc_html__('暂无回复,请核对问题后联系用户。', 'aksrt') . '</li>';
|
||||
}
|
||||
foreach ($replies as $reply) {
|
||||
if ((string) $reply['author_type'] === 'system') {
|
||||
$html .= '<li class="aksrt-ticket-detail__event"><span>' . esc_html((string) $reply['content']) . '</span><time>' . esc_html((string) $reply['created_at']) . '</time></li>';
|
||||
continue;
|
||||
}
|
||||
$admin = (string) $reply['author_type'] === 'admin';
|
||||
$quote_html = '';
|
||||
if (is_array($reply['quote'] ?? null)) {
|
||||
$quote = $reply['quote'];
|
||||
$quote_html = '<blockquote class="aksrt-ticket-detail__quote">' . esc_html(!empty($quote['is_deleted']) ? __('原回复已删除', 'aksrt') : (string) $quote['content']) . '</blockquote>';
|
||||
}
|
||||
$html .= $this->ticket_message($admin ? 'admin' : 'user', (int) $reply['author_id'], (string) $reply['author_name'], $admin ? __('客服', 'aksrt') : __('用户', 'aksrt'), (string) $reply['created_at'], (string) $reply['content'], (array) $reply['attachment'], $quote_html);
|
||||
}
|
||||
return $html . '</ol></div></section>';
|
||||
}
|
||||
|
||||
private function ticket_message(string $variant, int $user_id, string $name, string $role, string $time, string $content, array $attachments, string $quote_html = ''): string {
|
||||
$avatar = function_exists('aksrt_get_avatar_url') ? aksrt_get_avatar_url($user_id, 64) : '';
|
||||
return '<li class="aksrt-ticket-detail__message is-' . esc_attr($variant) . '">'
|
||||
. ($avatar !== '' ? '<img class="aksrt-ticket-detail__avatar" src="' . esc_url($avatar) . '" alt="" width="32" height="32">' : '<span class="aksrt-ticket-detail__avatar" aria-hidden="true"></span>')
|
||||
. '<div class="aksrt-ticket-detail__bubble"><header class="aksrt-ticket-detail__meta"><strong>' . esc_html($name !== '' ? $name : '#' . $user_id) . '</strong>'
|
||||
. '<span class="aksrt-ticket-detail__role">' . esc_html($role) . '</span><time>' . esc_html($time) . '</time></header>'
|
||||
. $quote_html . '<div class="aksrt-ticket-detail__body">' . wpautop(esc_html($content)) . '</div>'
|
||||
. $this->ticket_attachments_html($attachments) . '</div></li>';
|
||||
}
|
||||
|
||||
private function ticket_reply_form(int $id): string {
|
||||
$field = 'aksrt-ticket-reply-' . $id;
|
||||
$html = $this->ticket_form_open('reply', $id, 'aksrt-ticket-detail__reply-form');
|
||||
$html .= $this->ticket_editor($field, __('回复用户', 'aksrt'), __('填写回复内容,发送后用户将收到通知', 'aksrt'), 5);
|
||||
$html .= '<div class="aksrt-ticket-detail__reply-foot">';
|
||||
$tools = '';
|
||||
$prereplies = TicketPrereplyService::all();
|
||||
if ($prereplies !== []) {
|
||||
$html .= '<label class="screen-reader-text" for="' . $field . '-pre">' . esc_html__('插入预设回复', 'aksrt') . '</label><select id="' . $field . '-pre" data-aksrt-ticket-prereply="' . $field . '"><option value="">' . esc_html__('插入预设回复…', 'aksrt') . '</option>';
|
||||
$tools = '<label class="screen-reader-text" for="' . $field . '-pre">' . esc_html__('插入预设回复', 'aksrt') . '</label><select id="' . $field . '-pre" data-aksrt-ticket-prereply="' . $field . '"><option value="">' . esc_html__('插入预设回复…', 'aksrt') . '</option>';
|
||||
foreach ($prereplies as $row) {
|
||||
$html .= '<option value="' . esc_attr((string) $row['content']) . '">' . esc_html(mb_strimwidth((string) $row['content'], 0, 40, '…')) . '</option>';
|
||||
$tools .= '<option value="' . esc_attr((string) $row['content']) . '">' . esc_html(mb_strimwidth((string) $row['content'], 0, 40, '…')) . '</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
$tools .= '</select>';
|
||||
}
|
||||
return $html . '<button type="submit" class="button button-primary">' . esc_html__('发送回复', 'aksrt') . '</button></div></form>';
|
||||
return $this->ticket_composer('reply', $id, $field, __('回复用户', 'aksrt'), __('发送后用户将收到通知', 'aksrt'), __('填写回复内容…', 'aksrt'), 4, $tools, __('发送回复', 'aksrt'), true);
|
||||
}
|
||||
|
||||
private function ticket_editor(string $id, string $label, string $placeholder, int $rows): string {
|
||||
return '<label class="aksrt-ticket-detail__heading" for="' . esc_attr($id) . '">' . esc_html($label) . '</label>'
|
||||
. '<textarea id="' . esc_attr($id) . '" name="content" rows="' . $rows . '" maxlength="' . TicketSettings::reply_max() . '" required data-aksrt-ticket-editor aria-describedby="' . esc_attr($id) . '-count" placeholder="' . esc_attr($placeholder) . '"></textarea>'
|
||||
. '<span id="' . esc_attr($id) . '-count" class="aksrt-ticket-counter" data-aksrt-ticket-counter="' . esc_attr($id) . '">0 / ' . TicketSettings::reply_max() . '</span>';
|
||||
/** 输入框与工具栏合为一个整体:预设回复、字数与提交按钮同排。 */
|
||||
private function ticket_composer(string $action, int $id, string $field, string $label, string $hint, string $placeholder, int $rows, string $tools, string $submit, bool $primary): string {
|
||||
$max = TicketSettings::reply_max();
|
||||
return $this->ticket_form_open($action, $id, 'aksrt-ticket-composer aksrt-ticket-composer--' . $action)
|
||||
. '<div class="aksrt-ticket-composer__head"><label for="' . esc_attr($field) . '">' . esc_html($label) . '</label>'
|
||||
. ($hint !== '' ? '<span class="aksrt-ticket-hint">' . esc_html($hint) . '</span>' : '') . '</div>'
|
||||
. '<div class="aksrt-ticket-composer__box"><textarea id="' . esc_attr($field) . '" name="content" rows="' . $rows . '" maxlength="' . $max . '" required data-aksrt-ticket-editor aria-describedby="' . esc_attr($field) . '-count" placeholder="' . esc_attr($placeholder) . '"></textarea>'
|
||||
. '<div class="aksrt-ticket-composer__bar">' . $tools
|
||||
. '<span id="' . esc_attr($field) . '-count" class="aksrt-ticket-counter" data-aksrt-ticket-counter="' . esc_attr($field) . '">0 / ' . $max . '</span>'
|
||||
. '<button type="submit" class="button' . ($primary ? ' button-primary' : '') . '">' . esc_html($submit) . '</button></div></div></form>';
|
||||
}
|
||||
|
||||
private function ticket_info_card(array $ticket): string {
|
||||
@@ -109,7 +105,7 @@ trait UsersMenusTicketsDetail {
|
||||
}
|
||||
$rows[] = [__('提交时间', 'aksrt'), esc_html((string) $ticket['post_time'])];
|
||||
if ((int) $ticket['urge_count'] > 0) {
|
||||
$rows[] = [__('催单', 'aksrt'), esc_html(sprintf(__('%1$d 次,最近 %2$s', 'aksrt'), (int) $ticket['urge_count'], (string) $ticket['last_urge_time']))];
|
||||
$rows[] = [__('催单', 'aksrt'), '<span class="aksrt-ticket-urge">' . esc_html(sprintf(__('%1$d 次,最近 %2$s', 'aksrt'), (int) $ticket['urge_count'], (string) $ticket['last_urge_time'])) . '</span>'];
|
||||
}
|
||||
$html = '<section class="aksrt-ticket-detail__card"><div class="aksrt-ticket-section-head"><h3>' . esc_html__('工单信息', 'aksrt') . '</h3>';
|
||||
if ($editable) {
|
||||
@@ -179,11 +175,21 @@ trait UsersMenusTicketsDetail {
|
||||
return $options;
|
||||
}
|
||||
|
||||
private function ticket_message_head(int $user_id, string $name, string $role, string $time): string {
|
||||
$avatar = function_exists('aksrt_get_avatar_url') ? aksrt_get_avatar_url($user_id, 64) : '';
|
||||
return '<header class="aksrt-ticket-detail__msg-head">'
|
||||
. ($avatar !== '' ? '<img src="' . esc_url($avatar) . '" alt="" width="32" height="32">' : '')
|
||||
. '<strong>' . esc_html($name !== '' ? $name : '#' . $user_id) . '</strong><span class="aksrt-ticket-hint">' . esc_html($role) . '</span><time>' . esc_html($time) . '</time></header>';
|
||||
private function ticket_notes_card(int $id): string {
|
||||
$notes = TicketNoteService::for_ticket($id);
|
||||
$html = '<section class="aksrt-ticket-detail__card aksrt-ticket-detail__private"><div class="aksrt-ticket-section-head"><h3>' . esc_html__('内部备注', 'aksrt');
|
||||
if ($notes !== []) {
|
||||
$html .= ' <span class="aksrt-ticket-pill">' . count($notes) . '</span>';
|
||||
}
|
||||
$html .= '</h3></div><p class="aksrt-ticket-hint">' . esc_html__('仅管理员可见,不会发送给用户。', 'aksrt') . '</p>';
|
||||
if ($notes !== []) {
|
||||
$html .= '<ol class="aksrt-ticket-detail__notes">';
|
||||
foreach ($notes as $note) {
|
||||
$html .= '<li><div class="aksrt-ticket-detail__note-head"><strong>' . esc_html((string) $note['admin_name']) . '</strong><time>' . esc_html((string) $note['created_at']) . '</time></div><div>' . nl2br(esc_html((string) $note['content'])) . '</div></li>';
|
||||
}
|
||||
$html .= '</ol>';
|
||||
}
|
||||
return $html . $this->ticket_composer('note', $id, 'aksrt-ticket-note-' . $id, __('添加备注', 'aksrt'), '', __('记录处理进展、排查结论…', 'aksrt'), 2, '', __('添加内部备注', 'aksrt'), false) . '</section>';
|
||||
}
|
||||
|
||||
private function ticket_attachments_html(array $urls): string {
|
||||
|
||||
@@ -59,7 +59,9 @@ test('conversation, private notes and final-state confirmation remain distinct',
|
||||
assert.match(detail, /TicketNoteService::for_ticket\(\$id\)/);
|
||||
assert.match(detail, /TicketRepository::get_instance\(\)->replies\(\$id\)/);
|
||||
assert.match(detail, /!empty\(\$quote\['is_deleted'\]\) \? __\('原回复已删除', 'aksrt'\)/);
|
||||
for (const action of ['reply', 'note', 'status']) assert.ok(detail.includes(`ticket_form_open('${action}'`));
|
||||
for (const action of ['reply', 'note']) assert.ok(detail.includes(`ticket_composer('${action}'`));
|
||||
assert.ok(detail.includes("ticket_form_open('status'"));
|
||||
assert.match(detail, /return \$this->ticket_form_open\(\$action, \$id,/);
|
||||
assert.match(detail, /aksrt-ticket-detail__closed/);
|
||||
assert.match(detail, /TicketStatusService::can_transition\(\$from, \$key\)/);
|
||||
assert.match(detail, /data-aksrt-ticket-close-confirm/);
|
||||
|
||||
Reference in new issue
Block a user