hookehuyr

feat(用户协议): 添加用户服务协议弹窗组件并集成到隐私协议中

- 创建独立的用户服务协议弹窗组件
- 在隐私协议中集成该组件并实现联动逻辑
- 为隐私协议添加底部确认按钮
...@@ -49,5 +49,6 @@ declare module 'vue' { ...@@ -49,5 +49,6 @@ declare module 'vue' {
49 RouterView: typeof import('vue-router')['RouterView'] 49 RouterView: typeof import('vue-router')['RouterView']
50 SearchPopup: typeof import('./src/components/SearchPopup.vue')['default'] 50 SearchPopup: typeof import('./src/components/SearchPopup.vue')['default']
51 TabBar: typeof import('./src/components/TabBar.vue')['default'] 51 TabBar: typeof import('./src/components/TabBar.vue')['default']
52 + UserServiceAgreementModal: typeof import('./src/components/UserServiceAgreementModal.vue')['default']
52 } 53 }
53 } 54 }
......
...@@ -78,13 +78,27 @@ ...@@ -78,13 +78,27 @@
78 <view class="content-text" v-html="contentText"></view> 78 <view class="content-text" v-html="contentText"></view>
79 </view> 79 </view>
80 </scroll-view> 80 </scroll-view>
81 +
82 + <!-- 底部按钮 -->
83 + <view class="modal-footer">
84 + <nut-button type="primary" block color="#fb923c" @click="onCloseContentModal">
85 + 我已阅读并同意
86 + </nut-button>
87 + </view>
81 </view> 88 </view>
82 </nut-popup> 89 </nut-popup>
90 +
91 + <!-- 用户服务协议弹窗 -->
92 + <UserServiceAgreementModal
93 + v-model:visible="showUserAgreementModal"
94 + @confirm="onUserAgreementConfirm"
95 + />
83 </template> 96 </template>
84 97
85 <script setup> 98 <script setup>
86 import { ref, computed, watch, defineEmits, defineProps } from 'vue' 99 import { ref, computed, watch, defineEmits, defineProps } from 'vue'
87 import Taro from '@tarojs/taro' 100 import Taro from '@tarojs/taro'
101 +import UserServiceAgreementModal from './UserServiceAgreementModal.vue'
88 102
89 // Props 103 // Props
90 const props = defineProps({ 104 const props = defineProps({
...@@ -99,6 +113,7 @@ const emit = defineEmits(['update:visible', 'confirm', 'cancel']) ...@@ -99,6 +113,7 @@ const emit = defineEmits(['update:visible', 'confirm', 'cancel'])
99 113
100 // 响应式数据 114 // 响应式数据
101 const agreed = ref(false) 115 const agreed = ref(false)
116 +const showUserAgreementModal = ref(false)
102 117
103 // 监听弹框显示状态,每次打开时重置agreed 118 // 监听弹框显示状态,每次打开时重置agreed
104 watch(() => props.visible, (newVisible) => { 119 watch(() => props.visible, (newVisible) => {
...@@ -229,9 +244,7 @@ const contentText = ref('') ...@@ -229,9 +244,7 @@ const contentText = ref('')
229 * 点击用户服务协议 244 * 点击用户服务协议
230 */ 245 */
231 const onUserAgreementClick = () => { 246 const onUserAgreementClick = () => {
232 - contentTitle.value = '用户服务协议' 247 + showUserAgreementModal.value = true
233 - contentText.value = userAgreementContent
234 - showContentModal.value = true
235 } 248 }
236 249
237 /** 250 /**
...@@ -262,6 +275,13 @@ const onCancel = () => { ...@@ -262,6 +275,13 @@ const onCancel = () => {
262 } 275 }
263 276
264 /** 277 /**
278 + * 用户服务协议确认
279 + */
280 +const onUserAgreementConfirm = () => {
281 + showUserAgreementModal.value = false
282 +}
283 +
284 +/**
265 * 确认操作 285 * 确认操作
266 */ 286 */
267 const onConfirm = () => { 287 const onConfirm = () => {
...@@ -508,4 +528,13 @@ const onConfirm = () => { ...@@ -508,4 +528,13 @@ const onConfirm = () => {
508 border-top: 2rpx solid #e5e5e5; 528 border-top: 2rpx solid #e5e5e5;
509 font-style: italic; 529 font-style: italic;
510 } 530 }
531 +
532 +.modal-footer {
533 + padding: 32rpx;
534 + border-top: 1rpx solid #eee;
535 + background: white;
536 + position: sticky;
537 + bottom: 0;
538 + z-index: 10;
539 +}
511 </style> 540 </style>
......
This diff is collapsed. Click to expand it.