Переглянути джерело

feat(login): 添加通用页面用于显示外部网页

- 新增 common.vue 页面组件,使用 web-view 展示外部网页
- 在 login.vue 中添加跳转逻辑,当扫描链接包含特定域名时跳转到通用页面
- 配置 pages.json 添加 common 页面路由配置
- 实现 URL 参数传递和解码功能
- 设置页面全屏高度样式布局
mws 12 годин тому
батько
коміт
08a35a0c88
3 змінених файлів з 46 додано та 0 видалено
  1. 7 0
      pages.json
  2. 31 0
      pages/common.vue
  3. 8 0
      pages/login.vue

+ 7 - 0
pages.json

@@ -16,6 +16,13 @@
 				"navigationBarTitleText": "登录中",
 				"navigationStyle": "custom"
 			}
+		},
+		{
+			"path": "pages/common",
+			"style": {
+				"navigationBarTitleText": "",
+				"navigationStyle": "custom"
+			}
 		}
 	],
 

+ 31 - 0
pages/common.vue

@@ -0,0 +1,31 @@
+
+<template>
+  <view class="container">
+    <!-- 使用uni-app的web-view组件展示网页 -->
+    <web-view :src="url"></web-view>
+  </view>
+</template>
+
+
+<script >
+export default {
+  data() {
+    return {
+      url:""
+    }
+  },
+  onLoad(opt) {
+    console.log(opt.url)
+    this.url = decodeURIComponent(opt.url)
+  },
+  methods: {}
+}
+</script>
+
+
+<style scoped lang="scss">
+.container {
+  width: 100%;
+  height: 100vh;
+}
+</style>

+ 8 - 0
pages/login.vue

@@ -36,6 +36,14 @@
  				// 1. 去掉域名部分,提取路径
  				const scanCode = decodedUrl.replace('https://e.dnzc.vip/', ''); // 得到 "a7e4a3f2947004f6"
  				this.scanCode = scanCode;
+
+        if (decodedUrl.indexOf('https://d.dnzc.vip') !== -1){
+          uni.navigateTo({
+            url: '/pages/common?url=' + encodeURIComponent(decodedUrl)
+          })
+          return;
+        }
+
  			}
  			this.login(); // 调用登录方法