feat: integrate customer service chat

This commit is contained in:
richjohnrambo
2026-10-14 16:37:12 +08:00
parent f3f59fe7c3
commit 48b3564ac9
22 changed files with 1788 additions and 64 deletions
+319 -20
View File
@@ -1386,18 +1386,24 @@ body {
background: #c86d45;
}
.m-chat {
min-height: 100dvh;
height: 100dvh;
background: #f4f5f6;
padding-bottom: 80px;
display: flex;
flex-direction: column;
overflow: hidden;
}
.m-chat .m-page-header {
flex: 0 0 auto;
padding-inline: 20px;
background: #fff;
border-bottom: 1px solid #f0f0f0;
}
.m-chat-time {
flex: 0 0 auto;
text-align: center;
color: #92969b;
padding: 8px;
padding: 9px 16px;
font-size: 13px;
}
.m-chat-empty {
min-height: 530px;
@@ -1422,34 +1428,327 @@ body {
width: min(280px, 100%);
margin-top: 16px;
}
.m-chat-input {
position: fixed;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: min(100%, 750px);
height: 72px;
.m-chat-composer {
flex: 0 0 auto;
width: 100%;
background: #f1f1f1;
padding: 10px 15px calc(10px + env(safe-area-inset-bottom));
border-top: 1px solid #e8e8e8;
padding-bottom: env(safe-area-inset-bottom);
}
.m-chat-input {
min-height: 68px;
padding: 10px 14px;
display: grid;
grid-template-columns: 44px 1fr 44px;
gap: 8px;
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
}
.m-chat-input button {
.m-chat-input .m-chat-send {
min-width: 66px;
height: 44px;
padding: 0 14px;
border: 0;
background: transparent;
font-size: 27px;
border-radius: 7px;
background: linear-gradient(135deg, #e2a25f, #d18437);
color: #fff;
font-size: 16px;
font-weight: 600;
box-shadow: 0 3px 9px rgb(177 105 37 / 20%);
}
.m-chat-input button img {
width: 24px;
height: 24px;
.m-chat-input .m-chat-send:disabled {
opacity: 0.55;
}
.m-chat-tool {
width: 42px;
height: 42px;
padding: 6px;
border: 0;
border-radius: 50%;
background: transparent;
display: grid;
place-items: center;
}
.m-chat-tool img {
width: 30px;
height: 30px;
object-fit: contain;
}
.m-chat-input input {
min-width: 0;
height: 46px;
border: 0;
border-radius: 8px;
background: #fff;
padding: 0 12px;
padding: 0 14px;
outline: none;
color: var(--m-ink);
box-shadow: inset 0 0 0 1px transparent;
}
.m-chat-input input:focus {
box-shadow: inset 0 0 0 1px #d99a55;
}
.m-chat-tools {
min-height: 142px;
padding: 10px 30px 18px;
display: grid;
grid-template-columns: repeat(3, 82px);
gap: 24px;
align-items: start;
}
.m-chat-tools button {
border: 0;
background: transparent;
color: #7a7d80;
display: grid;
justify-items: center;
gap: 8px;
}
.m-chat-tools button:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.m-chat-file-input {
display: none;
}
.m-chat-tools .n-icon {
width: 62px;
height: 62px;
border-radius: 12px;
background: #fff;
display: grid;
place-items: center;
color: #555;
font-size: 31px;
}
.m-chat-emoji-panel {
min-height: 248px;
padding: 12px 18px 20px;
background: #fff;
border-radius: 18px 18px 0 0;
}
.m-chat-emoji-tabs {
min-height: 38px;
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
}
.m-chat-emoji-tabs button {
min-width: 54px;
height: 34px;
padding: 0 14px;
border: 0;
border-radius: 10px;
background: transparent;
color: #8b929d;
font-size: 15px;
}
.m-chat-emoji-tabs button.is-active {
background: #e3efff;
color: #1683ff;
font-weight: 600;
}
.m-chat-emojis {
display: grid;
grid-template-columns: repeat(12, minmax(0, 1fr));
gap: 12px 8px;
align-items: center;
}
.m-chat-emojis button {
width: 100%;
height: 32px;
padding: 0;
border: 0;
border-radius: 6px;
background: transparent;
font-size: 24px;
line-height: 1;
}
.m-chat-emojis button:active {
background: #eef4fb;
transform: scale(0.94);
}
.m-chat-emoji-empty {
min-height: 142px;
display: grid;
place-items: center;
color: #a1a7b0;
font-size: 14px;
}
.m-chat-uploading {
height: 34px;
padding: 0 18px 8px;
display: flex;
align-items: center;
gap: 10px;
color: #8a633d;
font-size: 12px;
}
.m-chat-uploading progress {
width: 100%;
height: 6px;
border: 0;
border-radius: 4px;
overflow: hidden;
accent-color: #d58d2b;
}
.m-chat-uploading b {
flex: 0 0 auto;
font-weight: 500;
}
.m-chat-messages {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
padding: 12px 20px 24px;
}
.m-chat-welcome {
width: max-content;
max-width: 90%;
margin: 12px auto 20px;
padding: 7px 12px;
border-radius: 14px;
background: #e5e7e9;
color: #74797e;
font-size: 13px;
}
.m-chat-history-divider {
height: 28px;
display: flex;
align-items: center;
gap: 12px;
color: #9a9ea4;
font-size: 12px;
}
.m-chat-history-divider::before,
.m-chat-history-divider::after {
content: '';
height: 1px;
flex: 1;
background: #e4e6e9;
}
.m-chat-session-tip {
width: max-content;
max-width: 90%;
margin: 12px auto 20px;
padding: 7px 13px;
border-radius: 7px;
background: #fff;
color: #647188;
font-size: 13px;
box-shadow: 0 2px 7px rgb(0 0 0 / 4%);
}
.m-chat-system-row {
display: flex;
align-items: flex-start;
gap: 10px;
margin: 0 0 18px;
}
.m-chat-avatar--agent span,
.m-chat-avatar > span {
font-size: 23px;
line-height: 1;
}
.m-chat-system-message {
max-width: calc(100% - 52px);
}
.m-chat-system-message small {
display: block;
margin: 0 0 6px 2px;
color: #68768d;
font-size: 12px;
}
.m-chat-system-message p {
margin: 0;
padding: 13px 15px;
border-radius: 4px 14px 14px;
background: #fff;
color: #e75b9f;
font-size: 14px;
font-weight: 600;
line-height: 1.65;
box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
}
.m-chat-row {
display: flex;
align-items: flex-start;
gap: 10px;
margin: 14px 0;
}
.m-chat-row.is-mine {
flex-direction: row-reverse;
justify-content: flex-start;
}
.m-chat-avatar {
flex: 0 0 auto;
width: 42px;
height: 42px;
border-radius: 50%;
overflow: hidden;
background: #f3c883;
display: grid;
place-items: center;
color: #fff;
}
.m-chat-row.is-mine .m-chat-avatar {
background: #62a7e8;
}
.m-chat-avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.m-chat-avatar .n-icon {
font-size: 26px;
}
.m-chat-message {
max-width: calc(78% - 52px);
}
.m-chat-row.is-mine .m-chat-message {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.m-chat-bubble {
position: relative;
padding: 11px 14px;
border-radius: 4px 14px 14px;
background: #fff;
box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
}
.m-chat-row.is-mine .m-chat-bubble {
border-radius: 14px 4px 14px 14px;
background: #dfa05f;
}
.m-chat-bubble p {
margin: 0;
color: var(--m-ink);
line-height: 1.55;
overflow-wrap: anywhere;
white-space: pre-wrap;
}
.m-chat-row.is-mine .m-chat-bubble p {
color: #fff;
}
.m-chat-bubble.is-media {
padding: 4px;
overflow: hidden;
background: #fff;
}
.m-chat-media {
display: block;
width: auto;
max-width: min(280px, 100%);
max-height: 320px;
border-radius: 10px;
object-fit: contain;
background: #111;
}
.m-chat-message > small {
display: block;
margin-top: 5px;
color: #92969b;
font-size: 11px;
}
.m-subpage {