Răsfoiți Sursa

协议内容显示

沐梦. 3 zile în urmă
părinte
comite
3d66159f2d
2 a modificat fișierele cu 10 adăugiri și 66 ștergeri
  1. 5 34
      pages/login/index.vue
  2. 5 32
      pages/login/register.vue

+ 5 - 34
pages/login/index.vue

@@ -78,27 +78,20 @@
 			<text>安全加密 · 保护您的账号信息</text>
 		</view>
 
-		<!-- 隐私政策/用户服务协议弹窗 -->
-		<policy-dialog v-model:visible="dialogVisible" :title="dialogTitle" :content="dialogContent"></policy-dialog>
 	</view>
 </template>
 
 <script setup>
 import { ref } from 'vue'
 import navBar from '@/components/nav-bar/index.vue'
-import policyDialog from '@/components/policy-dialog/index.vue'
 import { login } from '@/api/auth'
 import { getInfo } from '@/api/system/user'
-import { getAgreement } from '@/api/system/agreement'
 import { AgreementType } from '@/enums/agreementType'
 import { DEFAULT_HEADERS } from '@/utils/config'
 
 const username = ref('')
 const password = ref('')
 const checked = ref(false)
-const dialogVisible = ref(false)
-const dialogTitle = ref('')
-const dialogContent = ref('')
 
 const onClickLeft = () => uni.reLaunch({ url: '/pages/index/index' })
 
@@ -166,33 +159,11 @@ const onSubmit = async () => {
 	}
 }
 
-const showAgreement = async (agreementId) => {
-	try {
-		uni.showLoading({ title: '加载中...' })
-		const res = await getAgreement(agreementId)
-
-		if (res && res.title) {
-			dialogTitle.value = res.title || '协议详情'
-			let decodedContent = res.content || '暂无内容'
-			if (res.content) {
-				try {
-					decodedContent = decodeURIComponent(escape(atob(res.content)))
-				} catch (e) {
-					decodedContent = res.content
-				}
-			}
-			dialogContent.value = decodedContent
-			dialogVisible.value = true
-		} else {
-			console.warn('接口返回数据格式异常:', res)
-			uni.showToast({ title: '数据格式异常', icon: 'none' })
-		}
-	} catch (error) {
-		console.error('获取协议失败:', error)
-		uni.showToast({ title: typeof error === 'string' ? error : '加载失败,请稍后重试', icon: 'none' })
-	} finally {
-		uni.hideLoading()
-	}
+const showAgreement = (agreementId) => {
+	const title = agreementId === 1 ? '用户服务协议' : '隐私政策'
+	uni.navigateTo({
+		url: `/pages/my/agreement/detail/index?id=${agreementId}&title=${encodeURIComponent(title)}`
+	})
 }
 </script>
 

+ 5 - 32
pages/login/register.vue

@@ -107,16 +107,12 @@
 			</view>
 		</view>
 
-		<!-- 隐私政策/用户服务协议弹窗 -->
-		<policy-dialog v-model:visible="dialogVisible" :title="dialogTitle" :content="dialogContent"></policy-dialog>
 	</view>
 </template>
 
 <script setup>
 import { ref } from 'vue'
 import navBar from '@/components/nav-bar/index.vue'
-import policyDialog from '@/components/policy-dialog/index.vue'
-import { getAgreement } from '@/api/system/agreement'
 import { register } from '@/api/auth'
 
 const avatar = ref('')
@@ -127,9 +123,6 @@ const email = ref('')
 const password = ref('')
 const confirmPassword = ref('')
 const checked = ref(false)
-const dialogVisible = ref(false)
-const dialogTitle = ref('')
-const dialogContent = ref('')
 
 
 const onChooseAvatar = () => {
@@ -159,31 +152,11 @@ const onClickLeft = () => {
 	})
 }
 
-const showAgreement = async (agreementId) => {
-	try {
-		uni.showLoading({ title: '加载中...' })
-		const res = await getAgreement(agreementId)
-
-		if (res && res.title) {
-			dialogTitle.value = res.title || '协议详情'
-			let decodedContent = res.content || '暂无内容'
-			if (res.content) {
-				try {
-					decodedContent = decodeURIComponent(escape(window.atob(res.content)))
-				} catch (e) {
-					decodedContent = res.content
-				}
-			}
-			dialogContent.value = decodedContent
-			dialogVisible.value = true
-		} else {
-			uni.showToast({ title: '数据格式异常', icon: 'none' })
-		}
-	} catch (error) {
-		uni.showToast({ title: '加载失败,请稍后重试', icon: 'none' })
-	} finally {
-		uni.hideLoading()
-	}
+const showAgreement = (agreementId) => {
+	const title = agreementId === 1 ? '用户服务协议' : '隐私政策'
+	uni.navigateTo({
+		url: `/pages/my/agreement/detail/index?id=${agreementId}&title=${encodeURIComponent(title)}`
+	})
 }
 
 const onSubmit = async () => {