Просмотр исходного кода

feat(pages): 新增通用页面用于展示外部链接内容

- 添加 common.vue 页面,使用 web-view 组件加载外部网页
- 在 login.vue 中增加对特定域名链接的跳转逻辑
- 注释掉原有扫码登录相关判断逻辑
- 配置 pages.json 支持新页面路由
mws 1 месяц назад
Родитель
Сommit
34430b87d6
3 измененных файлов с 56 добавлено и 5 удалено
  1. 7 0
      pages.json
  2. 31 0
      pages/common.vue
  3. 18 5
      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>

+ 18 - 5
pages/login.vue

@@ -31,12 +31,25 @@
  			uni.removeStorageSync("Authorization-status");
  			// 获取并解码 q 参数
  			let qlink = decodeURIComponent(options.q || '');
+       console.log(qlink);
  			if (qlink) {
- 				const decodedUrl = decodeURIComponent(qlink); // 先解码
+ 				let decodedUrl = decodeURIComponent(qlink); // 先解码
  				// 1. 去掉域名部分,提取路径
  				const scanCode = decodedUrl.replace('https://e.dnzc.vip/', ''); // 得到 "a7e4a3f2947004f6"
  				this.scanCode = scanCode;
+
+        uni.redirectTo({
+          url: '/pages/skip?url='+skipUrl
+        })
+
  			}
+      let decodedUrl = "https://d.dnzc.vip/a00f8b7dc36984c1";
+      if (decodedUrl.indexOf('https://d.dnzc.vip') !== -1){
+        uni.navigateTo({
+          url: '/pages/common?url=' + encodeURIComponent(decodedUrl)
+        })
+        return;
+      }
  			this.login(); // 调用登录方法
 
  		},
@@ -56,10 +69,10 @@
  									if (res.data.isWxAuth == 1) {
  										uni.setStorageSync('Authorization-status', true);
  									}
-                  if ((that.scanCode === '' || that.scanCode === undefined) && res.data.roles.length > 1){
-                     that.getIsNoLogin(res.data.uid);
-                     return;
-                  }
+                  // if ((that.scanCode === '' || that.scanCode === undefined) && res.data.roles.length > 1){
+                  //    that.getIsNoLogin(res.data.uid);
+                  //    return;
+                  // }
 
  									that.scanCode = res.data.qrCode;
  									setToken(res.data.sessionId);