feat(user agreement): show on not read when trigger login/register

This commit is contained in:
Timi
2026-11-13 12:16:33 +08:00
parent 5fbcc02c98
commit 04ad331e8d
5 changed files with 112 additions and 37 deletions
+54 -17
View File
@@ -38,7 +38,7 @@
:label="item.title"
lazy
>
<div class="agreement-item">
<div class="panel">
<t-loading v-if="item.loading" class="loading" text="正在加载协议" />
<article-view
v-else-if="item.article"
@@ -84,6 +84,8 @@ const props = withDefaults(defineProps<{
const emit = defineEmits<{
"update:modelValue": [value: boolean];
agree: [];
reject: [];
}>();
const dialogVisible = ref(false);
@@ -133,6 +135,10 @@ async function handleCheckboxChange(checked: boolean): Promise<void> {
return;
}
await open();
}
async function open(): Promise<void> {
emit("update:modelValue", false);
dialogVisible.value = true;
activeAgreementId.value = "";
@@ -188,12 +194,16 @@ function resolveAttachmentUrl(attachmentId: string): string {
return AttachmentAPI.getReadURL(attachmentId);
}
defineExpose({ open });
function rejectAgreement(): void {
emit("update:modelValue", false);
emit("reject");
}
function agreeAgreement(): void {
emit("update:modelValue", true);
emit("agree");
}
</script>
@@ -219,22 +229,15 @@ function agreeAgreement(): void {
:global(.user-agreement-dialog.t-dialog .t-dialog__body) {
flex: 1 1 auto;
min-height: 0;
display: flex;
overflow: hidden;
min-height: 0;
text-align: unset;
}
:global(.user-agreement-dialog.t-dialog .t-dialog__body-text) {
width: 100%;
flex: 1 1 auto;
min-height: 0;
display: flex;
}
:global(.user-agreement-dialog.t-dialog .t-dialog__footer) {
--td-spacer-1: 0;
--td-button-border-radius: 1rem;
padding: 10px;
min-width: 0;
}
.dialog-content {
@@ -242,6 +245,7 @@ function agreeAgreement(): void {
gap: .5rem;
width: 100%;
min-width: 0;
height: 100%;
flex: 1 1 auto;
display: flex;
@@ -251,12 +255,17 @@ function agreeAgreement(): void {
.tabs {
--td-tab-item-height: 2rem;
width: 100%;
flex: 1 1 auto;
min-height: 0;
width: 100%;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
min-height: 0;
flex-direction: column;
:deep(.t-tabs__nav) {
border-bottom: 1px solid var(--td-component-border);
}
:deep(.t-tabs__content) {
flex: 1 1 auto;
@@ -269,10 +278,13 @@ function agreeAgreement(): void {
padding: 0 .5rem;
font-size: .75rem;
}
:deep(.t-tabs__item--active) {
font-weight: unset;
}
}
.agreement-item {
padding-top: 1rem;
.panel {
.loading {
padding: 1.5rem 0;
@@ -301,6 +313,31 @@ function agreeAgreement(): void {
}
}
@media (orientation: landscape) and (min-width: 48rem) {
:global(.user-agreement-dialog.t-dialog) {
--td-dialog-width: min(80vw, 48rem);
}
.user-agreement-dialog {
:global(.user-agreement-dialog.t-dialog .t-dialog__content) {
height: min(76vh, 36rem);
max-height: min(76vh, 36rem);
}
.dialog-content {
.tips {
br {
display: none;
}
span + span::before {
content: ",";
}
}
}
}
}
:global(html.theme-dark) {
.user-agreement {
.checkbox {
@@ -310,7 +347,7 @@ function agreeAgreement(): void {
.user-agreement-dialog {
.dialog-content {
.hint {
.tips {
color: #94a3b8;
}