Parcourir la source

隐藏部分协议内容

沐梦. il y a 3 jours
Parent
commit
bc055aeb3b

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "好萌友",
     "appid" : "__UNI__F19BBAD",
     "description" : "宠物服务商家端",
-    "versionName" : "1.1.6",
-    "versionCode" : 43,
+    "versionName" : "1.1.8",
+    "versionCode" : 45,
     "transformPx" : false,
     "app-plus" : {
         "privacy" : {

+ 1 - 1
pages/index/index.vue

@@ -64,7 +64,7 @@
 				<image src="/static/images/index-hand.png" class="hand-img" mode="widthFix"></image>
 				<view class="hand-text-content">
 					<text class="hand-title">好萌友提醒您~</text>
-					<text class="hand-subtitle">功能优化中,敬请期待~</text>
+					<text class="hand-subtitle">懂你的爱,更懂你的小可爱~</text>
 				</view>
 			</view>
 		</view>

+ 2 - 2
pages/login/index.vue

@@ -58,7 +58,7 @@
 						<text class="agree-text">我已阅读并同意</text>
 						<text class="text-link" @click.stop="showAgreement(2)">《隐私政策》</text>
 						<text class="agree-text">和</text>
-						<text class="text-link" @click.stop="showAgreement(4)">《托运协议》</text>
+						<text class="text-link" @click.stop="showAgreement(1)">《用户服务协议》</text>
 					</label>
 				</checkbox-group>
 			</view>
@@ -78,7 +78,7 @@
 			<text>安全加密 · 保护您的账号信息</text>
 		</view>
 
-		<!-- 隐私政策/托运协议弹窗 -->
+		<!-- 隐私政策/用户服务协议弹窗 -->
 		<policy-dialog v-model:visible="dialogVisible" :title="dialogTitle" :content="dialogContent"></policy-dialog>
 	</view>
 </template>

+ 2 - 2
pages/login/register.vue

@@ -94,7 +94,7 @@
 						<text class="agree-text">我已阅读并同意</text>
 						<text class="text-link" @click.stop="showAgreement(2)">《隐私政策》</text>
 						<text class="agree-text">和</text>
-						<text class="text-link" @click.stop="showAgreement(4)">《托运协议》</text>
+						<text class="text-link" @click.stop="showAgreement(1)">《用户服务协议》</text>
 					</label>
 				</checkbox-group>
 			</view>
@@ -109,7 +109,7 @@
 			</view>
 		</view>
 
-		<!-- 隐私政策/托运协议弹窗 -->
+		<!-- 隐私政策/用户服务协议弹窗 -->
 		<policy-dialog v-model:visible="dialogVisible" :title="dialogTitle" :content="dialogContent"></policy-dialog>
 	</view>
 </template>

+ 64 - 4
pages/my/agreement/detail/index.vue

@@ -38,10 +38,70 @@ const fetchAgreement = async (id) => {
 			agreementData.value = res
 			// 解码 Base64 内容 (Admin端采用 btoa(unescape(encodeURIComponent(content))) 编码)
 			if (res.content) {
-				try {
-					contentHtml.value = decodeURIComponent(escape(atob(res.content)))
-				} catch (e) {
-					// 如果解码失败,回显原始内容
+				const cleanStr = String(res.content).trim().replace(/\s+/g, '')
+				// 检查是否是 base64 格式(仅包含 A-Z, a-z, 0-9, +, /, =)
+				const isBase64 = /^[A-Za-z0-9+/=]+$/.test(cleanStr)
+				
+				if (isBase64) {
+					try {
+						// 1. Base64 解码为二进制字符串
+						const atobPolyfill = (str) => {
+							if (typeof atob === 'function') return atob(str)
+							const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
+							let output = ''
+							const clean = str.replace(/=+$/, '')
+							for (let bc = 0, bs, buffer, idx = 0; idx < clean.length; ) {
+								const char = clean.charAt(idx++)
+								const buffer = chars.indexOf(char)
+								if (buffer === -1) throw new Error('Invalid base64 character')
+								bs = bc % 4 ? bs * 64 + buffer : buffer
+								if (bc++ % 4) {
+									output += String.fromCharCode(255 & bs >> (-2 * bc & 6))
+								}
+							}
+							return output
+						}
+						
+						const decodedBinary = atobPolyfill(cleanStr)
+						
+						// 2. 将二进制字符串解码为 UTF-8 字符串
+						const decodeUtf8 = (str) => {
+							let result = ''
+							let i = 0
+							while (i < str.length) {
+								const c1 = str.charCodeAt(i++)
+								if (c1 < 128) {
+									result += String.fromCharCode(c1)
+								} else if (c1 > 191 && c1 < 224) {
+									const c2 = str.charCodeAt(i++)
+									result += String.fromCharCode(((c1 & 31) << 6) | (c2 & 63))
+								} else if (c1 > 223 && c1 < 240) {
+									const c2 = str.charCodeAt(i++)
+									const c3 = str.charCodeAt(i++)
+									result += String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63))
+								} else {
+									const c2 = str.charCodeAt(i++)
+									const c3 = str.charCodeAt(i++)
+									const c4 = str.charCodeAt(i++)
+									const codepoint = ((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)
+									if (codepoint > 0xffff) {
+										const offset = codepoint - 0x10000
+										result += String.fromCharCode((offset >> 10) + 0xd800, (offset & 0x3ff) + 0xdc00)
+									} else {
+										result += String.fromCharCode(codepoint)
+									}
+								}
+							}
+							return result
+						}
+						
+						contentHtml.value = decodeUtf8(decodedBinary)
+					} catch (e) {
+						// 解码失败,回显原始内容
+						contentHtml.value = res.content
+					}
+				} else {
+					// 非 base64 格式,直接回显原始 HTML 页面
 					contentHtml.value = res.content
 				}
 			} else {

+ 1 - 3
pages/my/agreement/list/index.vue

@@ -20,9 +20,7 @@ import navBar from '@/components/nav-bar/index.vue'
 // 协议列表,ID 参考 admin web 配置及后端 SysAgreementController
 const agreements = ref([
 	{ id: 2, title: '隐私政策' },
-	{ id: 1, title: '用户服务协议' },
-	{ id: 4, title: '商家托运协议' },
-	{ id: 5, title: '宠物洗护服务规范' } // 根据需求预留 ID:5
+	{ id: 1, title: '用户服务协议' }
 ])
 
 const goToDetail = (item) => {