ソースを参照

更新依赖,和租户处理

ZaiZai 2 年 前
コミット
5c2d47a3fb
4 ファイル変更32 行追加5 行削除
  1. 1 1
      package.json
  2. 9 0
      src/api/modules/other.js
  3. 17 4
      src/layout/modules/MenuBar.vue
  4. 5 0
      yarn.lock

+ 1 - 1
package.json

@@ -11,7 +11,7 @@
     "dependencies": {
         "axios": "^1.4.0",
         "crypto-js": "^4.1.1",
-        "dayjs": "^1.11.8",
+        "dayjs": "^1.11.9",
         "echarts": "^5.4.2",
         "element-plus": "2.3.7",
         "hc-vue3-ui": "^1.5.9",

+ 9 - 0
src/api/modules/other.js

@@ -119,3 +119,12 @@ export const getContractUserList = (form, msg = true) => httpApi({
     method: 'get',
     params: form
 }, msg);
+
+//获取租户详情
+export const getTenantDetail = (id) => httpApi({
+    url: '/api/blade-system/tenant/detail',
+    method: 'get',
+    params: {
+        tenantId: id
+    }
+}, true);

+ 17 - 4
src/layout/modules/MenuBar.vue

@@ -16,6 +16,9 @@
 import {ref, watch} from "vue";
 import MenuItem from "./MenuItem.vue"
 import {getToken} from "~src/api/util/auth";
+import {getStoreValue} from "~uti/storage";
+import {getTenantDetail} from "~api/other";
+import {getObjValue} from "js-fast-way";
 
 const props = defineProps({
     datas: {
@@ -52,11 +55,21 @@ watch(() => [
 
 //事件
 const emit = defineEmits(['change'])
-const MenuClick = (item) => {
+const MenuClick = async (item) => {
     if (item?.code === 'to-archives-url') {
-        const token = getToken()
-        //refreshToken, accessToken
-        window.open(item?.path + '/#/auth?token=' + token, '_blank')
+        let token = getToken(), domain = item?.path
+        const tenantId = getStoreValue('tenantId')
+        if (tenantId === '000000' || !tenantId) {
+            domain = item?.path
+        } else {
+            const {error, code, data} = await getTenantDetail(tenantId)
+            if (!error && code === 200) {
+                const url = getObjValue(data).domainUrl
+                domain = url ? url : item?.path
+            }
+        }
+        console.log(domain)
+        //window.open(domain + '/#/auth?token=' + token, '_blank')
     } else {
         curKey.value = item?.code || '';
         emit('change', item)

+ 5 - 0
yarn.lock

@@ -742,6 +742,11 @@ dayjs@^1.11.8:
   resolved "http://47.110.251.215:9000/dayjs/-/dayjs-1.11.8.tgz#4282f139c8c19dd6d0c7bd571e30c2d0ba7698ea"
   integrity sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==
 
+dayjs@^1.11.9:
+  version "1.11.9"
+  resolved "http://47.110.251.215:9000/dayjs/-/dayjs-1.11.9.tgz#9ca491933fadd0a60a2c19f6c237c03517d71d1a"
+  integrity sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==
+
 delayed-stream@~1.0.0:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"