Browse Source

fix: 修改已知问题

xyh 2 years ago
parent
commit
d0d81b0299

+ 2 - 3
src/components/filter/select/index.tsx

@@ -41,7 +41,7 @@ export default defineComponent({
       function(value: string) {
         filterValue.value = value;
       },
-      0,
+      500,
       {
         trailing: true,
         leading: false,
@@ -51,8 +51,7 @@ export default defineComponent({
     // 如果没有搜索结果将搜索值清空
     // 防止没搜索到之后失去焦点再返回会显示空选项
     function onBlur() {
-      filterOptions.value.length === 0
-      && filterValue.value.length > 0
+      filterValue.value.length > 0
       && (filterValue.value = '');
     }
 

+ 8 - 3
src/pages/home/menu/hooks.tsx

@@ -1,4 +1,4 @@
-import {onMounted, reactive, watch} from 'vue';
+import {computed, onMounted, reactive, watch} from 'vue';
 import {useTabStore, storeToRefs} from '@stores';
 import {find} from 'lodash-es';
 import {useRoute, useRouter} from 'vue-router';
@@ -6,6 +6,7 @@ import {formatMenu} from '@utils';
 import {useQueryClient} from '@tanstack/vue-query';
 import {MenuListData} from '@models';
 import {getMenuByUserId} from '@apis';
+import {useI18n} from 'vue-i18n';
 
 export function useMenu() {
   const queryClient = useQueryClient();
@@ -26,7 +27,11 @@ export function useMenu() {
     ...(data ?? []),
   ];
 
-  const menuOptions = formatMenu(basicMenu);
+  const {locale} = useI18n();
+
+  const menuOptions = computed(function() {
+    return formatMenu(basicMenu, locale.value);
+  });
 
   const tabStore = useTabStore();
   const {activeKey, tabList} = storeToRefs(tabStore);
@@ -40,7 +45,7 @@ export function useMenu() {
 
   function onUpdate(
     key: string,
-    item: typeof menuOptions[0],
+    item: typeof menuOptions.value[0],
   ) {
     const {label, pId, url, koLabel} = item;
 

+ 1 - 1
src/pages/menu-child/table/modal/index.vue

@@ -35,7 +35,7 @@ const {t} = useI18n();
 
 <template>
   <LDNormalModal
-    :isAdd="id.length > 0"
+    :isAdd="id.length === 0"
     v-model="visibleValue"
     :title="t(`menu.modal.title[${id.length > 0 ? 1 : 0}]`)"
     @submit="onSubmit"

+ 1 - 1
src/pages/menu/table/modal/index.vue

@@ -35,7 +35,7 @@ const {t} = useI18n();
 
 <template>
   <LDNormalModal
-    :isAdd="id.length > 0"
+    :isAdd="id.length === 0"
     v-model="visibleValue"
     :title="t(`menu.modal.title[${id.length > 0 ? 1 : 0}]`)"
     @submit="onSubmit"

+ 1 - 1
src/pages/role/table/modal/index.vue

@@ -35,7 +35,7 @@ const {t} = useI18n();
 
 <template>
   <LDNormalModal
-    :isAdd="id.length > 0"
+    :isAdd="id.length === 0"
     v-model="visibleValue"
     :title="t(`role.modal.title[${id.length > 0 ? 1 : 0}]`)"
     @submit="onSubmit"

+ 0 - 1
src/pages/user/filter/hooks.ts

@@ -26,7 +26,6 @@ export function useExtendsTools() {
   ];
 
   const extendsTools: LDFilterTool<OriginalListParams<GetUserListParams>>[] = [
-
     {type: 'field', label: computed(() => t('user.filter[3]')), name: 'email', id: '2'},
     {type: 'field', label: computed(() => t('user.filter[4]')), name: 'phone', id: '3'},
     {

+ 1 - 1
src/pages/user/table/modal/index.vue

@@ -35,7 +35,7 @@ const {t} = useI18n();
 
 <template>
   <LDNormalModal
-    :isAdd="id.length > 0"
+    :isAdd="id.length === 0"
     v-model="visibleValue"
     :title="t(`user.modal.title[${id.length > 0 ? 1 : 0}]`)"
     @submit="onSubmit"

+ 1 - 1
src/utils/constants.ts

@@ -3,7 +3,7 @@ import {QueryClient} from '@tanstack/vue-query';
 /** 请求域名 */
 export const NETWORK_URL
   = process.env.NODE_ENV === 'development'
-    ? 'http://10.2.207.60:9700'
+    ? 'http://192.168.0.142:9700'
     : '';
 
 /** 用户存储Key */

+ 3 - 3
src/utils/format-menu/index.tsx

@@ -1,6 +1,6 @@
 import {MenuListData} from '@models';
 import {renderMenuIcon} from '@utils';
-import {VNodeChild} from 'vue';
+import {Ref, VNodeChild} from 'vue';
 
 export type MenuList = {
   label: string,
@@ -12,13 +12,13 @@ export type MenuList = {
   children?: MenuList[],
 };
 
-export function formatMenu(menus: MenuListData[]) {
+export function formatMenu(menus: MenuListData[], locale: string) {
   const result: MenuList[] = [];
   const tempArea = new Map<string, MenuList[]>();
 
   menus.forEach(function({name, id, img, pId, url, koreanName}) {
     const temp: MenuList = {
-      label: name,
+      label: locale === 'zh' ? name : koreanName,
       koLabel: koreanName,
       key: id,
       pId,