Browse Source

接收小程序token并获取用户信息实现

ming 5 months ago
parent
commit
6ea004f1b5
1 changed files with 17 additions and 5 deletions
  1. 17 5
      src/pages/login.vue

+ 17 - 5
src/pages/login.vue

@@ -182,7 +182,7 @@ function init() {
   useStore.GetWxOpenId(1); //调用获取微信公众号openId
 
   if (window.location.host) {
-    linkUrl.value = window.location.host;
+    linkUrl.value = 'manager.usky.cn';
     // linkUrl.value = "172.16.120.165:13200";
     // linkUrl.value = "localhost:81";
     useStore.GetMobileTenantConfig({ url: linkUrl.value });
@@ -301,10 +301,22 @@ onShow(() => {
 });
 
 onLoad((options) => {
-  if(options.xcx){
-    state.xcxData=decrypt(decodeURIComponent(options.xcx))
-    login(state.xcxData)
-  }
+  // console.log(linkUrl.value)
+  console.log('options')
+  console.log(options)
+
+  if(options.dataToken){
+      localStorage.setItem("App-Token", options.dataToken)
+      useStore.GetInfo()
+      proxy.$tab.reLaunch("/pages/index");
+
+      // window.location.href = `${linkUrl.value}pages/index`;
+    }
+
+  // if(options.xcx){
+  //   state.xcxData=decrypt(decodeURIComponent(options.xcx))
+  //   login(state.xcxData)
+  // }
 });
 </script>