Ver código fonte

feat:修改入口,token验证,移除token为空的判断

yf_zhb 2 anos atrás
pai
commit
643a2d9783

+ 27 - 33
App.vue

@@ -1,39 +1,33 @@
 <script>
-	import cache from '@/utils/cache';
-	import {
-		userLogin
-	} from '@/api/common.js';
-	import {
-		LOGIN_TOKEN,
-	} from '@/config/cache'
-	export default {
-		// 全局获取token
-		async onLaunch(option) {
-			// c测试数据
-			 // cache.set(LOGIN_TOKEN,'XB5TDFmqD/EFLD7Bmsfp11vkfOjrNGqvcGEnWIAIGaE=');
-			// 登录token
-			if (!option.query.token) {
-				return;
-			}
-			this.$api.loading('登陆中...');
-			const  res = await userLogin({
-				pp_token:option.query.token
-			});
-			this.$api.hide();
-			let session_key= res?.session_key ?? ''
-			cache.set(LOGIN_TOKEN,session_key);
-			await this.$isResolve()//调用
-		},
-		onShow() {
+import cache from '@/utils/cache';
+import { userLogin } from '@/api/common.js';
+import { LOGIN_TOKEN } from '@/config/cache';
+export default {
+  // 全局获取token
+  async onLaunch(option) {
+    // c测试数据
+    // cache.set(LOGIN_TOKEN,'XB5TDFmqD/EFLD7Bmsfp11vkfOjrNGqvcGEnWIAIGaE=');
+    let token = option.query.token;
+    // 登录token
+    if (!token) {
+      token = 'test-token';
+    }
 
-		},
-		onHide() {
-
-		}
-	}
+    this.$api.loading('登陆中...');
+    const res = await userLogin({
+      pp_token: token,
+    });
+    this.$api.hide();
+    let session_key = res?.session_key ?? '';
+    cache.set(LOGIN_TOKEN, session_key);
+    await this.$isResolve(); //调用
+  },
+  onShow() {},
+  onHide() {},
+};
 </script>
 
 <style lang="scss">
-	/*每个页面公共css */
-	@import '@/styles/common.scss';
+/*每个页面公共css */
+@import '@/styles/common.scss';
 </style>

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/build/h5/index.html


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
unpackage/dist/build/h5/static/js/index.77a9c21c.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1
unpackage/dist/build/h5/static/js/index.e1e957e0.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1
unpackage/dist/build/h5/static/js/pages-weather-details~pages-weather-history~pages-worm-analyse~pages-worm-history.c158212f.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
unpackage/dist/build/h5/static/js/pages-weather-details~pages-weather-history~pages-worm-analyse~pages-worm-history.fd602ec0.js