Explorar el Código

feat(product): basely add struct

gemercheung hace 3 años
padre
commit
7b6dd82a00

+ 0 - 21
build/vite/optimizer.ts

@@ -1,21 +0,0 @@
-// TODO
-import type { GetManualChunk } from 'rollup';
-
-//
-const vendorLibs: { match: string[]; output: string }[] = [
-  // {
-  //   match: ['xlsx'],
-  //   output: 'xlsx',
-  // },
-];
-
-// @ts-ignore
-export const configManualChunk: GetManualChunk = (id: string) => {
-  if (/[\\/]node_modules[\\/]/.test(id)) {
-    const matchItem = vendorLibs.find((item) => {
-      const reg = new RegExp(`[\\/]node_modules[\\/]_?(${item.match.join('|')})(.*)`, 'ig');
-      return reg.test(id);
-    });
-    return matchItem ? matchItem.output : null;
-  }
-};

+ 0 - 25
build/vite/plugin/hmr.ts

@@ -1,25 +0,0 @@
-import type { Plugin } from 'vite';
-
-/**
- * TODO
- * Temporarily solve the Vite circular dependency problem, and wait for a better solution to fix it later. I don't know what problems this writing will bring.
- * @returns
- */
-
-export function configHmrPlugin(): Plugin {
-  return {
-    name: 'singleHMR',
-    handleHotUpdate({ modules, file }) {
-      if (file.match(/xml$/)) return [];
-
-      modules.forEach((m) => {
-        if (!m.url.match(/\.(css|less)/)) {
-          m.importedModules = new Set();
-          m.importers = new Set();
-        }
-      });
-
-      return modules;
-    },
-  };
-}

+ 2 - 6
build/vite/plugin/index.ts

@@ -14,7 +14,6 @@ import { configVisualizerConfig } from './visualizer';
 import { configThemePlugin } from './theme';
 import { configImageminPlugin } from './imagemin';
 import { configSvgIconsPlugin } from './svgSprite';
-import { configHmrPlugin } from './hmr';
 
 export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
   const {
@@ -37,9 +36,6 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
   // vite-plugin-windicss
   vitePlugins.push(windiCSS());
 
-  // TODO
-  !isBuild && vitePlugins.push(configHmrPlugin());
-
   // @vitejs/plugin-legacy
   VITE_LEGACY && isBuild && vitePlugins.push(legacy());
 
@@ -61,12 +57,12 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
   // rollup-plugin-visualizer
   vitePlugins.push(configVisualizerConfig());
 
-  //vite-plugin-theme
+  // vite-plugin-theme
   vitePlugins.push(configThemePlugin(isBuild));
 
   // The following plugins only work in the production environment
   if (isBuild) {
-    //vite-plugin-imagemin
+    // vite-plugin-imagemin
     VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
 
     // rollup-plugin-gzip

+ 5 - 4
build/vite/plugin/styleImport.ts

@@ -4,10 +4,10 @@
  */
 import styleImport from 'vite-plugin-style-import';
 
-export function configStyleImportPlugin(isBuild: boolean) {
-  if (!isBuild) {
-    return [];
-  }
+export function configStyleImportPlugin(_isBuild: boolean) {
+  // if (!isBuild) {
+  //   return [];
+  // }
   const styleImportPlugin = styleImport({
     libs: [
       {
@@ -19,6 +19,7 @@ export function configStyleImportPlugin(isBuild: boolean) {
             'anchor-link',
             'sub-menu',
             'menu-item',
+            'menu-divider',
             'menu-item-group',
             'breadcrumb-item',
             'breadcrumb-separator',

+ 1 - 0
src/App.vue

@@ -12,6 +12,7 @@
   import { useTitle } from '/@/hooks/web/useTitle';
   import { useLocale } from '/@/locales/useLocale';
 
+  import 'dayjs/locale/zh-cn';
   // support Multi-language
   const { getAntdLocale } = useLocale();
 

+ 2 - 3
src/locales/lang/en.ts

@@ -1,6 +1,5 @@
 import { genMessage } from '../helper';
 import antdLocale from 'ant-design-vue/es/locale/en_US';
-// import momentLocale from 'moment/dist/locale/en-us';
 
 const modules = import.meta.globEager('./en/**/*.ts');
 export default {
@@ -8,6 +7,6 @@ export default {
     ...genMessage(modules, 'en'),
     antdLocale,
   },
-  momentLocale: null,
-  momentLocaleName: 'en',
+  dateLocale: null,
+  dateLocaleName: 'en',
 };

+ 0 - 1
src/locales/lang/en/layout.ts

@@ -3,7 +3,6 @@ export default {
   header: {
     // user dropdown
     dropdownItemDoc: 'Document',
-    personalSetting: 'personal setting',
     dropdownItemLoginOut: 'Login Out',
 
     tooltipErrorLog: 'Error log',

+ 1 - 0
src/locales/lang/en/routes/demo.ts

@@ -195,5 +195,6 @@ export default {
     editCellTable: 'Editable cell',
     editRowTable: 'Editable row',
     authColumn: 'Auth column',
+    resizeParentHeightTable: 'resizeParentHeightTable',
   },
 };

+ 0 - 1
src/locales/lang/zh-CN/layout.ts

@@ -3,7 +3,6 @@ export default {
   header: {
     // user dropdown
     dropdownItemDoc: '文档',
-    personalSetting: '个人设置',
     dropdownItemLoginOut: '退出系统',
 
     // tooltip

+ 1 - 0
src/locales/lang/zh-CN/routes/demo.ts

@@ -186,5 +186,6 @@ export default {
     editCellTable: '可编辑单元格',
     editRowTable: '可编辑行',
     authColumn: '权限列',
+    resizeParentHeightTable: '继承父元素高度',
   },
 };

+ 2 - 2
src/locales/lang/zh-CN/sys.ts

@@ -65,8 +65,8 @@ export default {
     signUpFormTitle: '注册',
     forgetFormTitle: '重置密码',
 
-    signInTitle: '10分钟搞定实景VR',
-    signInDesc: '自助720度实景VR发布管理,自助、简单、安全、高效',
+    signInTitle: '开箱即用的中后台管理系统',
+    signInDesc: '输入您的个人详细信息开始使用!',
     policy: '我同意xxx隐私政策',
     scanSign: `扫码后点击"确认",即可完成登录`,
 

+ 0 - 2
src/locales/lang/zh_CN.ts

@@ -7,6 +7,4 @@ export default {
     ...genMessage(modules, 'zh-CN'),
     antdLocale,
   },
-
-  momentLocaleName: 'zh-cn',
 };

+ 3 - 6
src/locales/useLocale.ts

@@ -3,8 +3,6 @@
  */
 import type { LocaleType } from '/#/config';
 
-import moment from 'moment';
-
 import { i18n } from './setupI18n';
 import { useLocaleStoreWithOut } from '/@/store/modules/locale';
 import { unref, computed } from 'vue';
@@ -12,8 +10,8 @@ import { loadLocalePool, setHtmlPageLang } from './helper';
 
 interface LangModule {
   message: Recordable;
-  momentLocale: Recordable;
-  momentLocaleName: string;
+  dateLocale: Recordable;
+  dateLocaleName: string;
 }
 
 function setI18nLanguage(locale: LocaleType) {
@@ -53,10 +51,9 @@ export function useLocale() {
     const langModule = ((await import(`./lang/${locale}.ts`)) as any).default as LangModule;
     if (!langModule) return;
 
-    const { message, momentLocale, momentLocaleName } = langModule;
+    const { message } = langModule;
 
     globalI18n.setLocaleMessage(locale, message);
-    moment.updateLocale(momentLocaleName, momentLocale);
     loadLocalePool.push(locale);
 
     setI18nLanguage(locale);

+ 1 - 8
src/main.ts

@@ -1,6 +1,6 @@
-import '/@/design/index.less';
 import 'virtual:windi-base.css';
 import 'virtual:windi-components.css';
+import '/@/design/index.less';
 import 'virtual:windi-utilities.css';
 // Register icon sprite
 import 'virtual:svg-icons-register';
@@ -15,13 +15,6 @@ import { setupGlobDirectives } from '/@/directives';
 import { setupI18n } from '/@/locales/setupI18n';
 import { registerGlobComp } from '/@/components/registerGlobComp';
 
-// Importing on demand in local development will increase the number of browser requests by around 20%.
-// This may slow down the browser refresh speed.
-// Therefore, only enable on-demand importing in production environments .
-if (import.meta.env.DEV) {
-  import('ant-design-vue/dist/antd.less');
-}
-
 async function bootstrap() {
   const app = createApp(App);
 

+ 2 - 1
src/views/dashboard/product/drawer.data.ts

@@ -28,12 +28,13 @@ export const formSchema: FormSchema[] = [
     label: '直播间名称',
     component: 'Input',
     helpMessage: '直播间不能修改',
+    required: true,
     colProps: {
       lg: 8,
       md: 8,
     },
     componentProps: {
-      disabled: true,
+      disabled: false,
     },
   },
   {

+ 9 - 1
src/views/dashboard/product/list.vue

@@ -1,7 +1,9 @@
 <template>
   <div>
     <BasicTable @register="registerTable">
-      <template #toolbar> </template>
+      <template #toolbar>
+        <a-button type="primary" @click="handleCreate"> 新增商品</a-button>
+      </template>
       <template #link="{ record }">
         <a :href="record.link" target="_blank">{{ record.link }}</a>
       </template>
@@ -88,6 +90,11 @@
           isUpdate: true,
         });
       }
+      function handleCreate() {
+        openDrawer(true, {
+          isUpdate: false,
+        });
+      }
 
       return {
         registerTable,
@@ -97,6 +104,7 @@
         renderProductTypeLabel,
         registerDrawer,
         handleEdit,
+        handleCreate,
         uploadApi: uploadApi as any,
       };
     },

+ 2 - 1
src/views/dashboard/product/productDrawer.vue

@@ -26,7 +26,7 @@
       const isUpdate = ref(true);
 
       const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
-        labelWidth: 100,
+        labelWidth: 120,
         schemas: formSchema,
         showActionButtonGroup: false,
         baseColProps: { lg: 18, md: 18, offset: 1 },
@@ -38,6 +38,7 @@
         isUpdate.value = !!data?.isUpdate;
 
         if (unref(isUpdate)) {
+          console.log(data.record);
           setFieldsValue({
             ...data.record,
             steamRoom: data.record?.steamRoom?.name,