Browse Source

fix(locale): fix locale.show not work

vben 4 years ago
parent
commit
10cd4fcdff
5 changed files with 15 additions and 5 deletions
  1. 2 0
      CHANGELOG.zh_CN.md
  2. 1 1
      package.json
  3. 1 2
      src/hooks/web/useI18n.ts
  4. 4 2
      src/store/modules/permission.ts
  5. 7 0
      yarn.lock

+ 2 - 0
CHANGELOG.zh_CN.md

@@ -9,6 +9,8 @@
 
 - 修复混合模式下滚动条丢失问题
 - 修复环境变量配置失效以及 history 模式下 logo 地址问题
+- 修复图表库切换页面导致宽高计算错误
+- 修复多语言配置 `Locale.show`导致配置不生效
 
 ## 2.0.0-rc.14 (2020-12-15)
 

+ 1 - 1
package.json

@@ -25,7 +25,7 @@
     "@vueuse/core": "^4.0.0",
     "ant-design-vue": "^2.0.0-rc.5",
     "apexcharts": "^3.23.0",
-    "axios": "^0.21.0",
+    "axios": "^0.21.1",
     "crypto-es": "^1.2.6",
     "echarts": "^4.9.0",
     "lodash-es": "^4.17.20",

+ 1 - 2
src/hooks/web/useI18n.ts

@@ -1,5 +1,4 @@
 import { getI18n } from '/@/setup/i18n';
-import projectSetting from '/@/settings/projectSetting';
 
 export function useI18n(namespace?: string) {
   function getKey(key: string) {
@@ -17,7 +16,7 @@ export function useI18n(namespace?: string) {
     },
   };
 
-  if (!projectSetting.locale.show || !getI18n()) {
+  if (!getI18n()) {
     return normalFn;
   }
 

+ 4 - 2
src/store/modules/permission.ts

@@ -20,6 +20,7 @@ import { transformRouteToMenu } from '/@/router/helper/menuHelper';
 import { useMessage } from '/@/hooks/web/useMessage';
 // import { warn } from '/@/utils/log';
 import { useI18n } from '/@/hooks/web/useI18n';
+import { PAGE_NOT_FOUND_ROUTE } from '/@/router/constant';
 
 const { createMessage } = useMessage();
 const NAME = 'permission';
@@ -109,7 +110,8 @@ class Permission extends VuexModule {
       if (!paramId) {
         throw new Error('paramId is undefined!');
       }
-      let routeList: any[] = await getMenuListById({ id: paramId });
+      let routeList = (await getMenuListById({ id: paramId })) as AppRouteRecordRaw[];
+
       // 动态引入组件
       routeList = transformObjToRoute(routeList);
       //  后台路由转菜单结构
@@ -117,7 +119,7 @@ class Permission extends VuexModule {
 
       this.commitBackMenuListState(backMenuList);
 
-      routes = routeList;
+      routes = [PAGE_NOT_FOUND_ROUTE, ...routeList];
     }
     return routes;
   }

+ 7 - 0
yarn.lock

@@ -2098,6 +2098,13 @@ axios@^0.21.0:
   dependencies:
     follow-redirects "^1.10.0"
 
+axios@^0.21.1:
+  version "0.21.1"
+  resolved "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
+  integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
+  dependencies:
+    follow-redirects "^1.10.0"
+
 babel-extract-comments@^1.0.0:
   version "1.0.0"
   resolved "https://registry.npmjs.org/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21"