Commit 3ecac4f9b17c24db878f07c3c730d9f8e98f8efc

Authored by xp.Huang
2 parents 5f994dd3 764f1fb4

Merge branch 'ww' into 'main'

perf: add user config in dropConsoleInVue3VideoPlay vite plugin

See merge request huang/yun-teng-iot-front!379
  1 +import { Plugin } from 'vite';
  2 +
  3 +export function dropConsoleInVue3VideoPlayPlugin(params?: { enabled: boolean }) {
  4 + const { enabled = true } = params || {};
  5 + return {
  6 + name: 'drop-console-in-vue3-video-play-plugin',
  7 + transform(src, id) {
  8 + if (enabled) {
  9 + if (id.includes('vue3-video-play')) {
  10 + return {
  11 + code: src.replaceAll('console.log', ''),
  12 + };
  13 + }
  14 + }
  15 + },
  16 + } as Plugin;
  17 +}
... ...
... ... @@ -16,6 +16,7 @@ import { configThemePlugin } from './theme';
16 16 import { configImageminPlugin } from './imagemin';
17 17 import { configSvgIconsPlugin } from './svgSprite';
18 18 import { configHmrPlugin } from './hmr';
  19 +import { dropConsoleInVue3VideoPlayPlugin } from './dropConsoleInVue3VideoPlay';
19 20
20 21 export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
21 22 const {
... ... @@ -63,6 +64,8 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
63 64 //vite-plugin-theme
64 65 vitePlugins.push(configThemePlugin(isBuild));
65 66
  67 + vitePlugins.push(dropConsoleInVue3VideoPlayPlugin());
  68 +
66 69 // The following plugins only work in the production environment
67 70 if (isBuild) {
68 71 //vite-plugin-imagemin
... ...
... ... @@ -2,68 +2,67 @@
2 2 * Introduces component library styles on demand.
3 3 * https://github.com/anncwb/vite-plugin-style-import
4 4 */
5   - import styleImport from 'vite-plugin-style-import';
  5 +import styleImport from 'vite-plugin-style-import';
6 6
7   - export function configStyleImportPlugin(isBuild: boolean) {
8   - if (!isBuild) {
9   - return [];
10   - }
11   - const styleImportPlugin = styleImport({
12   - libs: [
13   - {
14   - libraryName: 'ant-design-vue',
15   - esModule: true,
16   - resolveStyle: (name) => {
17   - // 这里是“子组件”列表,无需额外引入样式文件
18   - const ignoreList = [
19   - 'typography-text',
20   - 'typography-title',
21   - 'typography-paragraph',
22   - 'typography-link',
23   - 'anchor-link',
24   - 'sub-menu',
25   - 'menu-item',
26   - 'menu-item-group',
27   - 'dropdown-button',
28   - 'breadcrumb-item',
29   - 'breadcrumb-separator',
30   - 'input-password',
31   - 'input-search',
32   - 'input-group',
33   - 'form-item',
34   - 'radio-group',
35   - 'checkbox-group',
36   - 'layout-sider',
37   - 'layout-content',
38   - 'layout-footer',
39   - 'layout-header',
40   - 'step',
41   - 'select-option',
42   - 'select-opt-group',
43   - 'card-grid',
44   - 'card-meta',
45   - 'collapse-panel',
46   - 'descriptions-item',
47   - 'list-item',
48   - 'list-item-meta',
49   - 'table-column',
50   - 'table-column-group',
51   - 'tab-pane',
52   - 'tab-content',
53   - 'timeline-item',
54   - 'tree-node',
55   - 'skeleton-input',
56   - 'skeleton-avatar',
57   - 'skeleton-title',
58   - 'skeleton-paragraph',
59   - 'skeleton-image',
60   - 'skeleton-button',
61   - ];
62   - return ignoreList.includes(name) ? '' : `ant-design-vue/es/${name}/style/index`;
63   - },
64   - },
65   - ],
66   - });
67   - return styleImportPlugin;
68   - }
69   -
\ No newline at end of file
  7 +export function configStyleImportPlugin(isBuild: boolean) {
  8 + if (!isBuild) {
  9 + return [];
  10 + }
  11 + const styleImportPlugin = styleImport({
  12 + libs: [
  13 + {
  14 + libraryName: 'ant-design-vue',
  15 + esModule: true,
  16 + resolveStyle: (name) => {
  17 + // 这里是“子组件”列表,无需额外引入样式文件
  18 + const ignoreList = [
  19 + 'typography-text',
  20 + 'typography-title',
  21 + 'typography-paragraph',
  22 + 'typography-link',
  23 + 'anchor-link',
  24 + 'sub-menu',
  25 + 'menu-item',
  26 + 'menu-item-group',
  27 + 'dropdown-button',
  28 + 'breadcrumb-item',
  29 + 'breadcrumb-separator',
  30 + 'input-password',
  31 + 'input-search',
  32 + 'input-group',
  33 + 'form-item',
  34 + 'radio-group',
  35 + 'checkbox-group',
  36 + 'layout-sider',
  37 + 'layout-content',
  38 + 'layout-footer',
  39 + 'layout-header',
  40 + 'step',
  41 + 'select-option',
  42 + 'select-opt-group',
  43 + 'card-grid',
  44 + 'card-meta',
  45 + 'collapse-panel',
  46 + 'descriptions-item',
  47 + 'list-item',
  48 + 'list-item-meta',
  49 + 'table-column',
  50 + 'table-column-group',
  51 + 'tab-pane',
  52 + 'tab-content',
  53 + 'timeline-item',
  54 + 'tree-node',
  55 + 'skeleton-input',
  56 + 'skeleton-avatar',
  57 + 'skeleton-title',
  58 + 'skeleton-paragraph',
  59 + 'skeleton-image',
  60 + 'skeleton-button',
  61 + ];
  62 + return ignoreList.includes(name) ? '' : `ant-design-vue/es/${name}/style/index`;
  63 + },
  64 + },
  65 + ],
  66 + });
  67 + return styleImportPlugin;
  68 +}
... ...
... ... @@ -47,8 +47,8 @@ export default defineComponent({
47 47 const {
48 48 getContentMode,
49 49 getShowFooter,
50   - // getShowBreadCrumb,
51   - // getShowBreadCrumbIcon,
  50 + getShowBreadCrumb,
  51 + getShowBreadCrumbIcon,
52 52 getShowLogo,
53 53 getFullContent,
54 54 getColorWeak,
... ... @@ -281,7 +281,7 @@ export default defineComponent({
281 281 function renderContent() {
282 282 return (
283 283 <>
284   - {/* <SwitchItem
  284 + <SwitchItem
285 285 title={t('layout.setting.breadcrumb')}
286 286 event={HandlerEnum.SHOW_BREADCRUMB}
287 287 def={unref(getShowBreadCrumb)}
... ... @@ -299,7 +299,7 @@ export default defineComponent({
299 299 title={t('layout.setting.tabs')}
300 300 event={HandlerEnum.TABS_SHOW}
301 301 def={unref(getShowMultipleTab)}
302   - /> */}
  302 + />
303 303
304 304 <SwitchItem
305 305 title={t('layout.setting.tabsRedoBtn')}
... ...
... ... @@ -120,7 +120,7 @@ const setting: ProjectConfig = {
120 120 multiTabsSetting: {
121 121 cache: false,
122 122 // Turn on
123   - show: true,
  123 + show: false,
124 124 // Is it possible to drag and drop sorting tabs
125 125 canDrag: true,
126 126 // Turn on quick actions
... ... @@ -155,7 +155,7 @@ const setting: ProjectConfig = {
155 155 lockTime: 0,
156 156
157 157 // Whether to show breadcrumbs
158   - showBreadCrumb: true,
  158 + showBreadCrumb: false,
159 159
160 160 // Whether to show the breadcrumb icon
161 161 showBreadCrumbIcon: false,
... ...
... ... @@ -90,7 +90,6 @@
90 90 placeholder: true,
91 91 }));
92 92 items = [...items, ...fillArr];
93   - console.log(fillArr);
94 93 }
95 94 cameraList.value = items;
96 95 } catch (error) {
... ...
... ... @@ -96,7 +96,7 @@ export const step1Schemas: FormSchema[] = [
96 96 },
97 97 {
98 98 field: 'name',
99   - label: '配置名称',
  99 + label: '产品名称',
100 100 required: true,
101 101 component: 'Input',
102 102 colProps: { span: 14 },
... ... @@ -104,7 +104,7 @@ export const step1Schemas: FormSchema[] = [
104 104 return {
105 105 disabled: false,
106 106 ength: 255,
107   - placeholder: '请输入配置名称',
  107 + placeholder: '请输入产品名称',
108 108 };
109 109 },
110 110 },
... ... @@ -242,12 +242,12 @@ export const defaultObj = {
242 242 export const searchFormSchema: FormSchema[] = [
243 243 {
244 244 field: 'name',
245   - label: '配置名称',
  245 + label: '产品名称',
246 246 component: 'Input',
247 247 colProps: { span: 6 },
248 248 componentProps: {
249 249 maxLength: 255,
250   - placeholder: '请输入配置名称',
  250 + placeholder: '请输入产品名称',
251 251 },
252 252 },
253 253 ];
... ... @@ -262,12 +262,12 @@ export const isEmail = (type: string) => {
262 262 export const formSchema: FormSchema[] = [
263 263 {
264 264 field: 'configName',
265   - label: '配置名称',
  265 + label: '产品名称',
266 266 required: true,
267 267 component: 'Input',
268 268 componentProps: {
269 269 maxLength: 255,
270   - placeholder: '请输入配置名称',
  270 + placeholder: '请输入产品名称',
271 271 },
272 272 },
273 273 {
... ...