Browse Source

优化授权登录

ZaiZai 1 năm trước cách đây
mục cha
commit
ba8e9f570a
1 tập tin đã thay đổi với 11 bổ sung5 xóa
  1. 11 5
      src/views/home/auth.vue

+ 11 - 5
src/views/home/auth.vue

@@ -28,19 +28,25 @@ const router = useRouter()
 const useRoutes = useRoute()
 const store = useAppStore()
 
+//先清理下缓存
+store.clearStoreData()
+
 //变量
 const loading = ref(true)
 const isErrorShow = ref(false)
 
 //渲染完成
 onMounted(() => {
-    //先清理下缓存
-    store.clearStoreData()
-    // http://档案的域名/#/auth-token?token=xxxxxxx
-    const { token, tenantid } = getObjValue(useRoutes.query)
+    // http://档案的域名/#/auth-token?token=xxx&tid=xxx&pid=xxx&cid=xxx
+    const { token, tid, pid, cid } = getObjValue(useRoutes.query)
     if (!isNullES(token)) {
         isErrorShow.value = false
-        setLoginByTokenData(token, tenantid)
+        //缓存数据
+        store.setTokenVal(token)
+        store.setProjectId(pid)
+        store.setContractId(cid)
+        //处理授权登录
+        setLoginByTokenData(token, tid)
     } else {
         loading.value = false
         isErrorShow.value = true