Răsfoiți Sursa

根据登录用户的twin角色标识自动跳转不同的首页

liling 3 luni în urmă
părinte
comite
f75baf4152
3 a modificat fișierele cu 11 adăugiri și 0 ștergeri
  1. 1 0
      index.html
  2. 4 0
      public/global.js
  3. 6 0
      src/store/modules/user.js

+ 1 - 0
index.html

@@ -7,6 +7,7 @@
   <meta name="renderer" content="webkit">
   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
   <link rel="icon" href="/favicon.ico">
+  <script src="public/global.js?t=20250228110000"></script>
   <title>数据消费平台</title>
   <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
   <style>

+ 4 - 0
public/global.js

@@ -0,0 +1,4 @@
+//全局配置
+//此处配置内容不需要编译,可在运行时直接修改
+//如果修改后强烈建议浏览器清空一下本地缓存
+window.TWINURL='http://192.168.1.66/man';

+ 6 - 0
src/store/modules/user.js

@@ -46,6 +46,12 @@ const useUserStore = defineStore(
             } else {
               this.roles = ['ROLE_DEFAULT']
             }
+            for(let i=0;i<this.roles.length;i++){
+              if(this.roles[i]=='twin'){
+                window.location.href=window.TWINURL;
+                return;
+              }
+            }
             this.id = user.userId
             this.name = user.userName
             this.avatar = avatar