feat(aigc): add user agreement page and update consent dialog
Add new AIGC user agreement page with scrollable markdown rendering, loading and retry states. Register the new route in pages.json. Restructure AigcConsentDialog's content into styled sections, and update its rule click handler to navigate directly to the new agreement page.
This commit is contained in:
53
src/pages-aigc/agreement/agreement.vue
Normal file
53
src/pages-aigc/agreement/agreement.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<view class="aigc-agreement-page">
|
||||
<TopNavBar title="智念AI用户规则" background="#ffffff" title-color="#172033" back-icon-color="#172033"
|
||||
:align-with-menu-button="true" :z-index="3" />
|
||||
|
||||
<scroll-view class="aigc-agreement-scroll" scroll-y>
|
||||
<view v-if="agreement" class="aigc-agreement-document">
|
||||
<zero-markdown-view :markdown="agreement" />
|
||||
</view>
|
||||
|
||||
<view v-else class="aigc-agreement-state">
|
||||
<text>{{ loading ? "协议加载中..." : "协议内容加载失败" }}</text>
|
||||
<button v-if="!loading" class="aigc-agreement-retry" @tap="fetchAgreement">
|
||||
重新加载
|
||||
</button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import { getUserAgreement } from "@/request/api/AigcApi.js";
|
||||
|
||||
const agreement = ref("");
|
||||
const loading = ref(false);
|
||||
|
||||
const fetchAgreement = async () => {
|
||||
if (loading.value) return;
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getUserAgreement();
|
||||
agreement.value =
|
||||
res?.code === 0 && typeof res.data === "string" ? res.data.trim() : "";
|
||||
} catch (error) {
|
||||
agreement.value = "";
|
||||
console.error("获取智念AI用户规则失败", error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onLoad(() => {
|
||||
fetchAgreement();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "./styles/index.scss";
|
||||
</style>
|
||||
54
src/pages-aigc/agreement/styles/index.scss
Normal file
54
src/pages-aigc/agreement/styles/index.scss
Normal file
@@ -0,0 +1,54 @@
|
||||
.aigc-agreement-page {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.aigc-agreement-scroll {
|
||||
height: 0;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.aigc-agreement-document {
|
||||
min-height: 100%;
|
||||
padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.aigc-agreement-state {
|
||||
min-height: 240px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
color: #7b8798;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.aigc-agreement-retry {
|
||||
width: 120px;
|
||||
height: 42px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 16px 0 0;
|
||||
padding: 0;
|
||||
border-radius: 999px;
|
||||
background: #102942;
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.aigc-agreement-retry::after {
|
||||
border: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user