登录页面条款弹窗的优化

This commit is contained in:
minimaxagent1 2025-08-06 16:00:05 +08:00
parent 391ee81b53
commit 6d80f02d07
2 changed files with 101 additions and 13 deletions

View File

@ -1,13 +1,69 @@
<template>
<view class="">
</view>
<view class="page">
<custom-navbar title="未来规划" />
<tile-grid/>
<view class="header" :style="{ backgroundColor: CommonEnum.BASE_COLOR }">
<!-- 状态展示 -->
<status-display
v-if="loading"
type="loading"
loading-text="加载中..."
/>
<!-- 页面内容将在这里添加 -->
</view>
</view>
</template>
<script setup>
<script>
import CommonEnum from "../../enum/common";
import StatusDisplay from "../../components/status-display/status-display.vue";
export default {
components: {
StatusDisplay
},
data() {
return {
CommonEnum,
loading: false
}
},
onLoad() {
//
this.loadPageData()
},
methods: {
//
async loadPageData() {
this.loading = true
try {
// TODO: API
// const response = await getPageData()
//
setTimeout(() => {
this.loading = false
}, 1000)
} catch (error) {
console.error('获取页面数据失败:', error)
this.loading = false
}
}
}
}
</script>
<style lang="scss" scoped>
</style>
.page {
background: #F5F0E7;
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: flex-start;
flex-direction: column;
padding: 0 15rpx;
padding-bottom: 40rpx;
}
</style>

View File

@ -27,8 +27,10 @@
<text class="popup-title">服务条款</text>
<text class="popup-close" @click="closeServiceTermsPopup">×</text>
</view>
<scroll-view class="popup-body" scroll-y>
<rich-text :nodes="serviceTermsContent"></rich-text>
<scroll-view class="popup-body" scroll-y="true" :scroll-top="scrollTop">
<view class="terms-content">
<rich-text :nodes="serviceTermsContent"></rich-text>
</view>
</scroll-view>
<view class="popup-footer">
<text class="popup-tip">请仔细阅读服务条款阅读完毕后点击同意</text>
@ -44,8 +46,10 @@
<text class="popup-title">法律条款及隐私政策</text>
<text class="popup-close" @click="closePrivacyPolicyPopup">×</text>
</view>
<scroll-view class="popup-body" scroll-y>
<rich-text :nodes="privacyPolicyContent"></rich-text>
<scroll-view class="popup-body" scroll-y="true" :scroll-top="scrollTop">
<view class="terms-content">
<rich-text :nodes="privacyPolicyContent"></rich-text>
</view>
</scroll-view>
<view class="popup-footer">
<text class="popup-tip">请仔细阅读隐私政策阅读完毕后点击同意</text>
@ -79,6 +83,7 @@ export default {
showPrivacyPolicyPopup: false, //
serviceTermsContent: '', //
privacyPolicyContent: '', //
scrollTop: 0, //
}
},
onLoad() {
@ -118,8 +123,16 @@ export default {
try {
const res = await getServiceTerms();
if (res.code === 200 && res.data) {
this.serviceTermsContent = res.data.content || '暂无服务条款内容';
//
let content = res.data.content || '暂无服务条款内容';
// HTML
content = content.replace(/\n/g, '<br/>');
//
content = `<div style="word-wrap: break-word; word-break: break-all; line-height: 1.6; font-size: 28rpx; color: #333;">${content}</div>`;
this.serviceTermsContent = content;
this.showServiceTermsPopup = true;
//
this.scrollTop = 0;
} else {
uni.showToast({
title: '获取服务条款失败',
@ -139,8 +152,16 @@ export default {
try {
const res = await getPrivacyPolicy();
if (res.code === 200 && res.data) {
this.privacyPolicyContent = res.data.content || '暂无隐私政策内容';
//
let content = res.data.content || '暂无隐私政策内容';
// HTML
content = content.replace(/\n/g, '<br/>');
//
content = `<div style="word-wrap: break-word; word-break: break-all; line-height: 1.6; font-size: 28rpx; color: #333;">${content}</div>`;
this.privacyPolicyContent = content;
this.showPrivacyPolicyPopup = true;
//
this.scrollTop = 0;
} else {
uni.showToast({
title: '获取隐私政策失败',
@ -420,6 +441,17 @@ page{
line-height: 1.6;
font-size: 28rpx;
color: #333;
height: 0; /* 确保scroll-view有固定高度 */
}
.terms-content {
word-wrap: break-word;
word-break: break-all;
line-height: 1.6;
font-size: 28rpx;
color: #333;
padding-bottom: 20rpx; /* 底部留白 */
padding-right: 30rpx; /* 右边距 */
}
.popup-footer {