Commit 9948fce0aa4ba2601d81bdd88f240cc579c1d568
Merge branch 'ww' into 'main'
perf: 新增命令行区分不同环境下运行项目 See merge request yunteng/thingskit-view!6
Showing
40 changed files
with
299 additions
and
281 deletions
1 | 1 | # port |
2 | -VITE_DEV_PORT = '8001' | |
2 | +VITE_DEV_PORT = 5555 | |
3 | 3 | |
4 | 4 | # development path |
5 | 5 | VITE_DEV_PATH = '/' |
... | ... | @@ -8,10 +8,8 @@ VITE_DEV_PATH = '/' |
8 | 8 | VITE_PRO_PATH = '/' |
9 | 9 | |
10 | 10 | # spa-title |
11 | -VITE_GLOB_APP_TITLE = GoView | |
11 | +VITE_GLOB_APP_TITLE = 大屏设计器 | |
12 | 12 | |
13 | 13 | # spa shortname |
14 | -VITE_GLOB_APP_SHORT_NAME = GoView | |
15 | - | |
16 | -# iot platform proxy prefix | |
17 | -VITE_IOT_PLATFORM_PROXY_PREFIX = /large-designer/ | |
14 | +# VITE_GLOB_APP_SHORT_NAME = | |
15 | + | ... | ... |
.env.alone.dev
renamed from
.env.independence
.env.alone.prod
0 → 100644
build/external/envEnum.ts
0 → 100644
1 | 1 | import { resolve } from "path" |
2 | 2 | import { ConfigEnv } from "vite" |
3 | 3 | |
4 | + | |
4 | 5 | export function parseEnv(env: ImportMetaEnv) { |
5 | 6 | const res: Record<string, any> = {} |
6 | 7 | |
... | ... | @@ -28,7 +29,7 @@ export function parseEnv(env: ImportMetaEnv) { |
28 | 29 | |
29 | 30 | } |
30 | 31 | |
31 | - return res | |
32 | + return res as ViteEnv | |
32 | 33 | } |
33 | 34 | |
34 | 35 | export function getEnvConfig(match = 'VITE_GLOB_',) { |
... | ... | @@ -40,6 +41,6 @@ export function getRootPath(...dir: string[]) { |
40 | 41 | } |
41 | 42 | |
42 | 43 | |
43 | -export function getPublicPath({ command, mode }: ConfigEnv, viteEnv: ViteEnv) { | |
44 | - return command === 'build' ? '/' : mode === 'independence' ? viteEnv.VITE_IOT_PLATFORM_PROXY_PREFIX: '/' | |
44 | +export function getPublicPath({ command, mode }: ConfigEnv, viteEnv: ViteEnv) { | |
45 | + return viteEnv.VITE_GLOB_PUBLIC_PATH | |
45 | 46 | } | ... | ... |
... | ... | @@ -3,9 +3,9 @@ import { createHtmlPlugin } from 'vite-plugin-html' |
3 | 3 | const GLOB_CONFIG_FILE_NAME = '_app.config.js' |
4 | 4 | |
5 | 5 | export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) { |
6 | - const { VITE_GLOB_APP_TITLE, VITE_GLOB_CONTENT_SECURITY_POLICY, VITE_GLOB_PUBLIC_PATH } = env | |
6 | + const { VITE_GLOB_APP_TITLE, VITE_GLOB_PUBLIC_PATH } = env | |
7 | 7 | const getAppConfigSrc = () => { |
8 | - const path = VITE_GLOB_PUBLIC_PATH?.endsWith('/') ? VITE_GLOB_PUBLIC_PATH : `${VITE_GLOB_PUBLIC_PATH}` | |
8 | + const path = VITE_GLOB_PUBLIC_PATH | |
9 | 9 | return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${Date.now()}` |
10 | 10 | } |
11 | 11 | |
... | ... | @@ -14,7 +14,6 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) { |
14 | 14 | inject: { |
15 | 15 | data: { |
16 | 16 | title: VITE_GLOB_APP_TITLE, |
17 | - contentSecurityPolicy: VITE_GLOB_CONTENT_SECURITY_POLICY ? `<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />` : '' | |
18 | 17 | }, |
19 | 18 | tags: isBuild ? [ |
20 | 19 | { | ... | ... |
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html lang="zh-cmn-Hans"> |
3 | 3 | |
4 | -<head> | |
5 | - <%- contentSecurityPolicy %> | |
4 | +<head> | |
6 | 5 | <meta charset="UTF-8" /> |
7 | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
8 | 7 | <meta name="renderer" content="webkit" /> |
... | ... | @@ -13,7 +12,7 @@ |
13 | 12 | content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" /> |
14 | 13 | <link rel="icon" href="./favicon.ico" /> |
15 | 14 | <title> |
16 | - <%= title %>> | |
15 | + <%= title %> | |
17 | 16 | </title> |
18 | 17 | <link rel="stylesheet" href="./index.css" /> |
19 | 18 | </head> |
... | ... | @@ -26,11 +25,7 @@ |
26 | 25 | <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span> |
27 | 26 | </div> |
28 | 27 | </div> |
29 | - </div> | |
30 | - <!-- THINGS_KIT --> | |
31 | - <script> | |
32 | - document.title="大屏设计器" | |
33 | - </script> | |
28 | + </div> | |
34 | 29 | <script type="module" src="/src/main.ts"></script> |
35 | 30 | </body> |
36 | 31 | ... | ... |
... | ... | @@ -6,9 +6,11 @@ |
6 | 6 | }, |
7 | 7 | "scripts": { |
8 | 8 | "dev": "vite --host", |
9 | - "dev:proxy": "vite --host --mode independence", | |
9 | + "dev:alone": "vite --host --mode alone.dev", | |
10 | 10 | "build": "vue-tsc --noEmit && vite build", |
11 | + "build:alone": "vue-tsc --noEmit && vite build --mode alone.prod", | |
11 | 12 | "preview": "vite preview", |
13 | + "preview:alone": "vite preview --mode alone.prod", | |
12 | 14 | "new": "plop --plopfile ./plop/plopfile.js", |
13 | 15 | "postinstall": "husky install", |
14 | 16 | "lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src", | ... | ... |
... | ... | @@ -22,6 +22,7 @@ import { GoSystemInfo } from '@/components/GoSystemInfo/index' |
22 | 22 | import Person from './person.png' |
23 | 23 | |
24 | 24 | import { icon } from '@/plugins' |
25 | +import { useUserStore } from '@/store/external/module/user' | |
25 | 26 | const { ChatboxEllipsesIcon, PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5 |
26 | 27 | |
27 | 28 | const t = window['$t'] |
... | ... | @@ -65,7 +66,7 @@ const options = ref([ |
65 | 66 | key: 'sysSet', |
66 | 67 | icon: renderIcon(SettingsSharpIcon) |
67 | 68 | }, |
68 | - // THINGS_KIT | |
69 | + // THINGS_KIT 隐藏关于软件 | |
69 | 70 | // { |
70 | 71 | // label: renderLang('global.contact'), |
71 | 72 | // key: 'contact', |
... | ... | @@ -97,6 +98,8 @@ const sysInfoHandle = () => { |
97 | 98 | modelShowInfo.value = true |
98 | 99 | } |
99 | 100 | |
101 | +// THINGS_KIT 修改退出登录 | |
102 | +const userStore = useUserStore() | |
100 | 103 | const handleSelect = (key: string) => { |
101 | 104 | switch (key) { |
102 | 105 | case 'contact': |
... | ... | @@ -106,7 +109,9 @@ const handleSelect = (key: string) => { |
106 | 109 | sysSetHandle() |
107 | 110 | break |
108 | 111 | case 'logout': |
109 | - logout() | |
112 | + // THINGS_KIT 修改退出登录 | |
113 | + userStore.logout(true) | |
114 | + // logout() | |
110 | 115 | break |
111 | 116 | } |
112 | 117 | } | ... | ... |
1 | -export const PageEnum = { | |
2 | - SYSTEM_PASSWORD: '/system/changePassword', | |
1 | + | |
2 | + | |
3 | +export enum PageEnum { | |
3 | 4 | // basic login path |
4 | - BASE_LOGIN: '/login', | |
5 | + BASE_LOGIN = '/login', | |
5 | 6 | // basic home path |
6 | - BASE_HOME: '/dashboard/workbench', | |
7 | - // error page path | |
8 | - ERROR_PAGE: '/exception', | |
9 | - // error log page path | |
10 | - ERROR_LOG_PAGE: '/error-log/list', | |
11 | - //消息配置 | |
12 | - MESSAGE_CONFIG: '/message/config', | |
13 | - //设备配置 | |
14 | - DEVICE_PROFILE: '/product/profiles', | |
15 | - DEVICE_LIST: '/device/list', | |
16 | -}; | |
7 | + BASE_HOME = '/project/items', | |
8 | + | |
9 | + // 未发布 | |
10 | + REDIRECT_UN_PUBLISH = '/redirect/unPublish', | |
11 | + REDIRECT_UN_PUBLISH_NAME = 'redirect-un-publish', | |
12 | +} | ... | ... |
... | ... | @@ -29,12 +29,6 @@ export enum PageEnum { |
29 | 29 | RELOAD = '/reload', |
30 | 30 | RELOAD_NAME = 'Reload', |
31 | 31 | |
32 | - // THINGS_KIT | |
33 | - // 未发布 | |
34 | - REDIRECT_UN_PUBLISH = '/redirect/unPublish', | |
35 | - REDIRECT_UN_PUBLISH_NAME = 'redirect-un-publish', | |
36 | - | |
37 | - | |
38 | 32 | // 首页 |
39 | 33 | BASE_HOME = '/project', |
40 | 34 | BASE_HOME_NAME = 'Project', | ... | ... |
src/hooks/external/useWebSecurityPolicy.ts
0 → 100644
1 | +import { isBoolean } from "@/utils"; | |
2 | +import { useGlobSetting } from "./setting"; | |
3 | + | |
4 | + | |
5 | +let initialFlag = false; | |
6 | +export function useWebSecurityPolicy() { | |
7 | + if (window && window.document && window.document.documentElement) { | |
8 | + const { securityPolicy } = useGlobSetting(); | |
9 | + const flag = isBoolean(securityPolicy) ? securityPolicy : securityPolicy === 'true' | |
10 | + if (flag && !initialFlag) { | |
11 | + const meta = document.createElement('meta'); | |
12 | + meta.setAttribute('http-equiv', 'Content-Security-Policy'); | |
13 | + meta.setAttribute('content', 'upgrade-insecure-requests'); | |
14 | + const container = document.querySelector('head'); | |
15 | + container?.prepend(meta); | |
16 | + initialFlag = true; | |
17 | + } | |
18 | + } | |
19 | +} | ... | ... |
... | ... | @@ -13,8 +13,12 @@ import '@/styles/pages/index.scss' |
13 | 13 | import 'animate.css/animate.min.css' |
14 | 14 | // 引入标尺 |
15 | 15 | import 'vue3-sketch-ruler/lib/style.css' |
16 | +import { useWebSecurityPolicy } from './hooks/external/useWebSecurityPolicy' | |
16 | 17 | |
17 | 18 | async function appInit() { |
19 | + // THINGS_KIT 内容安全协议hook | |
20 | + useWebSecurityPolicy() | |
21 | + | |
18 | 22 | const goAppProvider = createApp(GoAppProvider) |
19 | 23 | |
20 | 24 | const app = createApp(App) | ... | ... |
... | ... | @@ -7,14 +7,14 @@ export const option = { |
7 | 7 | dataset: '物联网平台数据统计', |
8 | 8 | bgSrc: 'src/assets/external/headbackground/bg_top.png', |
9 | 9 | fontSize: 36, |
10 | - showRight:true, | |
11 | - textColor:'#00f6ff', | |
12 | - textRightSizeColor:'#ffffff', | |
13 | - textRightFontSize:14, | |
14 | - x:0, | |
15 | - y:0, | |
16 | - xT:0, | |
17 | - yT:0, | |
10 | + showRight: true, | |
11 | + textColor: '#00f6ff', | |
12 | + textRightSizeColor: '#ffffff', | |
13 | + textRightFontSize: 14, | |
14 | + x: 0, | |
15 | + y: 0, | |
16 | + xT: 0, | |
17 | + yT: 0, | |
18 | 18 | } |
19 | 19 | |
20 | 20 | export default class Config extends PublicConfigClass implements CreateComponentType { | ... | ... |
... | ... | @@ -2,14 +2,8 @@ |
2 | 2 | <collapse-item name="信息" :expanded="true"> |
3 | 3 | <setting-item-box name="背景选择" :alone="true"> |
4 | 4 | <setting-item> |
5 | - <n-select | |
6 | - size="small" | |
7 | - placeholder="请选择您要使用的背景" | |
8 | - style="width: 250px" | |
9 | - v-model:value="selectValue" | |
10 | - :options="selectBgOptions" | |
11 | - @update:value="selectBgValueHandle" | |
12 | - /> | |
5 | + <n-select size="small" placeholder="请选择您要使用的背景" style="width: 250px" v-model:value="selectValue" | |
6 | + :options="selectBgOptions" @update:value="selectBgValueHandle" /> | |
13 | 7 | </setting-item> |
14 | 8 | </setting-item-box> |
15 | 9 | <setting-item-box name="文字" :alone="true"> |
... | ... | @@ -31,7 +25,7 @@ |
31 | 25 | </setting-item-box> |
32 | 26 | <setting-item-box name="位置x轴"> |
33 | 27 | <setting-item name="字体位置x轴"> |
34 | - <n-input-number v-model:value="optionData.x" size="small" placeholder="字体位置"></n-input-number> | |
28 | + <n-input-number v-model:value="optionData.x" size="small" placeholder="字体位置"></n-input-number> | |
35 | 29 | </setting-item> |
36 | 30 | </setting-item-box> |
37 | 31 | <setting-item-box name="位置y轴"> |
... | ... | @@ -43,16 +37,15 @@ |
43 | 37 | <collapse-item name="右侧" :expanded="true"> |
44 | 38 | <setting-item-box name="是否显示"> |
45 | 39 | <setting-item name=""> |
46 | - <n-switch @change="handleChange" v-model:value="optionData.showRight"/> | |
40 | + <n-switch @change="handleChange" v-model:value="optionData.showRight" /> | |
47 | 41 | </setting-item> |
48 | 42 | </setting-item-box> |
49 | 43 | <setting-item-box name="文字"> |
50 | 44 | <setting-item name="字体大小"> |
51 | - <n-input-number v-model:value="optionData.textRightFontSize" size="small" | |
52 | - placeholder="字体大小"></n-input-number> | |
45 | + <n-input-number v-model:value="optionData.textRightFontSize" size="small" placeholder="字体大小"></n-input-number> | |
53 | 46 | </setting-item> |
54 | 47 | <setting-item name="字体位置x轴"> |
55 | - <n-input-number v-model:value="optionData.xT" size="small" placeholder="字体位置"></n-input-number> | |
48 | + <n-input-number v-model:value="optionData.xT" size="small" placeholder="字体位置"></n-input-number> | |
56 | 49 | </setting-item> |
57 | 50 | <setting-item name="字体位置y轴"> |
58 | 51 | <n-input-number v-model:value="optionData.yT" size="small" placeholder="字体位置"></n-input-number> |
... | ... | @@ -67,14 +60,14 @@ |
67 | 60 | </template> |
68 | 61 | |
69 | 62 | <script setup lang="ts"> |
70 | -import {PropType, ref} from 'vue' | |
71 | -import {option} from './config' | |
63 | +import { PropType, ref } from 'vue' | |
64 | +import { option } from './config' | |
72 | 65 | import { |
73 | 66 | CollapseItem, |
74 | 67 | SettingItemBox, |
75 | 68 | SettingItem |
76 | 69 | } from '@/components/Pages/ChartItemSetting' |
77 | -import {SelectOption} from "naive-ui"; | |
70 | +import { SelectOption } from "naive-ui"; | |
78 | 71 | |
79 | 72 | const props = defineProps({ |
80 | 73 | optionData: { | ... | ... |
1 | -import {ConfigType, PackagesCategoryEnum, ChartFrameEnum} from '@/packages/index.d' | |
2 | -import {ChatCategoryEnum, ChatCategoryEnumName} from '../../index.d' | |
1 | +import { ChartFrameEnum } from '@/packages/index.d' | |
2 | +import { ConfigType } from '@/packages/index.d' | |
3 | +import { PackagesCategoryEnum } from '@/packages/components/external/types' | |
4 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | |
3 | 5 | |
4 | 6 | export const LeftCenterRightHeadConfig: ConfigType = { |
5 | 7 | key: 'LeftCenterRightHead', | ... | ... |
1 | 1 | <template> |
2 | 2 | <div class="go-text-box"> |
3 | - <n-grid :style="{'background-image': 'url('+option.configOption.bgSrc+')'}" class="go-n-grid" :x-gap="12" :y-gap="3" | |
4 | - :cols="3" layout-shift-disabled> | |
3 | + <n-grid :style="{ 'background-image': 'url(' + option.configOption.bgSrc + ')' }" class="go-n-grid" :x-gap="12" :y-gap="3" | |
4 | + :cols="3" layout-shift-disabled> | |
5 | 5 | <n-grid-item> |
6 | 6 | <!-- 占位--> |
7 | 7 | <div></div> |
8 | 8 | </n-grid-item> |
9 | 9 | <n-grid-item> |
10 | - <span | |
11 | - style="position:relative" | |
12 | - :style="{ top:option.configOption.y+'px',marginLeft:option.configOption.x+'px',color: option.configOption.textColor, fontSize: option.configOption.fontSize + 'px' }">{{ | |
10 | + <span style="position:relative" | |
11 | + :style="{ top: option.configOption.y + 'px', marginLeft: option.configOption.x + 'px', color: option.configOption.textColor, fontSize: option.configOption.fontSize + 'px' }">{{ | |
13 | 12 | option.configOption.dataset |
14 | 13 | }}</span> |
15 | 14 | </n-grid-item> |
16 | 15 | <n-grid-item> |
17 | 16 | <span style="position:relative" v-if="option.configOption.showRight" |
18 | - :style="{ top:option.configOption.yT+'px',marginLeft:option.configOption.xT+'px',color: option.configOption.textRightSizeColor, fontSize: option.configOption.textRightFontSize + 'px' }">{{ | |
17 | + :style="{ top: option.configOption.yT + 'px', marginLeft: option.configOption.xT + 'px', color: option.configOption.textRightSizeColor, fontSize: option.configOption.textRightFontSize + 'px' }">{{ | |
19 | 18 | newData |
20 | 19 | }}</span> |
21 | 20 | </n-grid-item> |
... | ... | @@ -23,11 +22,11 @@ |
23 | 22 | </div> |
24 | 23 | </template> |
25 | 24 | <script setup lang="ts"> |
26 | -import {PropType, toRefs, shallowReactive, watch, onMounted, onUnmounted, ref} from 'vue' | |
27 | -import {CreateComponentType} from '@/packages/index.d' | |
28 | -import {useChartDataFetch} from '@/hooks' | |
29 | -import {useChartEditStore} from '@/store/modules/chartEditStore/chartEditStore' | |
30 | -import {option as configOption} from './config' | |
25 | +import { PropType, toRefs, shallowReactive, watch, onMounted, onUnmounted, ref } from 'vue' | |
26 | +import { CreateComponentType } from '@/packages/index.d' | |
27 | +import { useChartDataFetch } from '@/hooks' | |
28 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
29 | +import { option as configOption } from './config' | |
31 | 30 | |
32 | 31 | const props = defineProps({ |
33 | 32 | chartConfig: { |
... | ... | @@ -55,14 +54,14 @@ props.chartConfig.attr.x = 0 |
55 | 54 | props.chartConfig.attr.y = 0 |
56 | 55 | |
57 | 56 | watch( |
58 | - () => props.chartConfig.option, | |
59 | - (newData: any) => { | |
60 | - option.configOption = newData | |
61 | - }, | |
62 | - { | |
63 | - immediate: true, | |
64 | - deep: false | |
65 | - } | |
57 | + () => props.chartConfig.option, | |
58 | + (newData: any) => { | |
59 | + option.configOption = newData | |
60 | + }, | |
61 | + { | |
62 | + immediate: true, | |
63 | + deep: false | |
64 | + } | |
66 | 65 | ) |
67 | 66 | |
68 | 67 | useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { |
... | ... | @@ -72,18 +71,18 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { |
72 | 71 | |
73 | 72 | //TODO待封装 这里和原作者时间通用获取当前时间代码一样 |
74 | 73 | onMounted(() => { |
75 | -//格式化当前时间 | |
74 | + //格式化当前时间 | |
76 | 75 | timer = setInterval(() => { |
77 | 76 | const |
78 | - weeks = { | |
79 | - "0": '星期日', | |
80 | - "1": '星期一', | |
81 | - "2": '星期二', | |
82 | - "3": '星期三', | |
83 | - "4": '星期四', | |
84 | - "5": '星期五', | |
85 | - "6": '星期六', | |
86 | - } as any | |
77 | + weeks = { | |
78 | + "0": '星期日', | |
79 | + "1": '星期一', | |
80 | + "2": '星期二', | |
81 | + "3": '星期三', | |
82 | + "4": '星期四', | |
83 | + "5": '星期五', | |
84 | + "6": '星期六', | |
85 | + } as any | |
87 | 86 | const datetime = new Date() |
88 | 87 | const year = datetime.getFullYear() |
89 | 88 | const month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1 |
... | ... | @@ -115,6 +114,7 @@ onUnmounted(() => { |
115 | 114 | display: flex; |
116 | 115 | align-items: center; |
117 | 116 | justify-content: center; |
117 | + | |
118 | 118 | .n-gradient-text { |
119 | 119 | white-space: initial; |
120 | 120 | } | ... | ... |
1 | -import {PublicConfigClass} from '@/packages/public' | |
2 | -import {CreateComponentType} from '@/packages/index.d' | |
3 | -import {LeftCenterRightHeadCommonConfig} from './index' | |
1 | +import { PublicConfigClass } from '@/packages/public' | |
2 | +import { CreateComponentType } from '@/packages/index.d' | |
3 | +import { LeftCenterRightHeadCommonConfig } from './index' | |
4 | 4 | import cloneDeep from 'lodash/cloneDeep' |
5 | 5 | |
6 | 6 | export const option = { | ... | ... |
1 | 1 | <template> |
2 | 2 | <CollapseItem name="头部左侧样式" :expanded="true"> |
3 | - <SettingItemBox | |
4 | - :name="`颜色-${index + 1}`" | |
5 | - v-for="(item, index) in optionData.colorLefts" | |
6 | - :key="index" | |
7 | - > | |
3 | + <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorLefts" :key="index"> | |
8 | 4 | <SettingItem name="颜色"> |
9 | - <n-color-picker | |
10 | - size="small" | |
11 | - :modes="['hex']" | |
12 | - v-model:value="optionData.colorLefts[index]" | |
13 | - ></n-color-picker> | |
5 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorLefts[index]"></n-color-picker> | |
14 | 6 | </SettingItem> |
15 | 7 | <SettingItem> |
16 | - <n-button | |
17 | - size="small" | |
18 | - @click="optionData.colorLefts[index] = option.colorLefts[index]" | |
19 | - > | |
8 | + <n-button size="small" @click="optionData.colorLefts[index] = option.colorLefts[index]"> | |
20 | 9 | 恢复默认 |
21 | 10 | </n-button> |
22 | 11 | </SettingItem> |
23 | 12 | </SettingItemBox> |
24 | 13 | </CollapseItem> |
25 | 14 | <CollapseItem name="头部右侧样式" :expanded="true"> |
26 | - <SettingItemBox | |
27 | - :name="`颜色-${index + 1}`" | |
28 | - v-for="(item, index) in optionData.colorRights" | |
29 | - :key="index" | |
30 | - > | |
15 | + <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorRights" :key="index"> | |
31 | 16 | <SettingItem name="颜色"> |
32 | - <n-color-picker | |
33 | - size="small" | |
34 | - :modes="['hex']" | |
35 | - v-model:value="optionData.colorRights[index]" | |
36 | - ></n-color-picker> | |
17 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorRights[index]"></n-color-picker> | |
37 | 18 | </SettingItem> |
38 | 19 | <SettingItem> |
39 | - <n-button | |
40 | - size="small" | |
41 | - @click="optionData.colorRights[index] = option.colorRights[index]" | |
42 | - > | |
20 | + <n-button size="small" @click="optionData.colorRights[index] = option.colorRights[index]"> | |
43 | 21 | 恢复默认 |
44 | 22 | </n-button> |
45 | 23 | </SettingItem> |
... | ... | @@ -48,8 +26,8 @@ |
48 | 26 | </template> |
49 | 27 | |
50 | 28 | <script setup lang="ts"> |
51 | -import {PropType} from 'vue' | |
52 | -import {option} from './config' | |
29 | +import { PropType } from 'vue' | |
30 | +import { option } from './config' | |
53 | 31 | import { |
54 | 32 | CollapseItem, |
55 | 33 | SettingItemBox, | ... | ... |
1 | -import {ConfigType, PackagesCategoryEnum, ChartFrameEnum} from '@/packages/index.d' | |
2 | -import {ChatCategoryEnum, ChatCategoryEnumName} from '../../index.d' | |
1 | +import { ChartFrameEnum, ConfigType } from '@/packages/index.d' | |
2 | +import { PackagesCategoryEnum } from '@/packages/components/external/types' | |
3 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | |
3 | 4 | |
4 | 5 | export const LeftCenterRightHeadCommonConfig: ConfigType = { |
5 | 6 | key: 'LeftCenterRightHeadCommon', | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <n-grid :x-gap="12" | |
4 | - :cols="3" layout-shift-disabled> | |
3 | + <n-grid :x-gap="12" :cols="3" layout-shift-disabled> | |
5 | 4 | <n-grid-item> |
6 | 5 | <svg :width="w" :height="h"> |
7 | - <polyline | |
8 | - :stroke="colorLefts[0]" | |
9 | - stroke-width="2" | |
10 | - fill="transparent" | |
11 | - :points="`${xFalsePos(0)}, 0 ${xFalsePos(30)}, ${h / 2}`" | |
12 | - /> | |
6 | + <polyline :stroke="colorLefts[0]" stroke-width="2" fill="transparent" | |
7 | + :points="`${xFalsePos(0)}, 0 ${xFalsePos(30)}, ${h / 2}`" /> | |
13 | 8 | |
14 | - <polyline | |
15 | - :stroke="colorLefts[0]" | |
16 | - stroke-width="2" | |
17 | - fill="transparent" | |
18 | - :points="`${xFalsePos(20)}, 0 ${xFalsePos(50)}, ${h / 2} ${xFalsePos(w)}, ${ | |
19 | - h / 2 | |
20 | - }`" | |
21 | - /> | |
9 | + <polyline :stroke="colorLefts[0]" stroke-width="2" fill="transparent" :points="`${xFalsePos(20)}, 0 ${xFalsePos(50)}, ${h / 2} ${xFalsePos(w)}, ${h / 2 | |
10 | + }`" /> | |
22 | 11 | |
23 | - <polyline | |
24 | - :stroke="colorLefts[1]" | |
25 | - fill="transparent" | |
26 | - stroke-width="3" | |
27 | - :points="`${xFalsePos(0)}, ${h - 3}, ${xFalsePos(200)}, ${h - 3}`" | |
28 | - /> | |
12 | + <polyline :stroke="colorLefts[1]" fill="transparent" stroke-width="3" | |
13 | + :points="`${xFalsePos(0)}, ${h - 3}, ${xFalsePos(200)}, ${h - 3}`" /> | |
29 | 14 | </svg> |
30 | 15 | </n-grid-item> |
31 | 16 | <n-grid-item> |
32 | -<!-- <div style="width:300px;height: 30px"></div>--> | |
17 | + <!-- <div style="width:300px;height: 30px"></div>--> | |
33 | 18 | </n-grid-item> |
34 | 19 | <n-grid-item> |
35 | -<!-- <svg :width="w" :height="h">--> | |
36 | -<!-- <polyline--> | |
37 | -<!-- :stroke="colorRights[0]"--> | |
38 | -<!-- stroke-width="2"--> | |
39 | -<!-- fill="transparent"--> | |
40 | -<!-- :points="`${xPos(0)}, 0 ${xPos(30)}, ${h / 2}`"--> | |
41 | -<!-- />--> | |
20 | + <!-- <svg :width="w" :height="h">--> | |
21 | + <!-- <polyline--> | |
22 | + <!-- :stroke="colorRights[0]"--> | |
23 | + <!-- stroke-width="2"--> | |
24 | + <!-- fill="transparent"--> | |
25 | + <!-- :points="`${xPos(0)}, 0 ${xPos(30)}, ${h / 2}`"--> | |
26 | + <!-- />--> | |
42 | 27 | |
43 | -<!-- <polyline--> | |
44 | -<!-- :stroke="colorRights[0]"--> | |
45 | -<!-- stroke-width="2"--> | |
46 | -<!-- fill="transparent"--> | |
47 | -<!-- :points="`${xPos(20)}, 0 ${xPos(50)}, ${h / 2} ${xPos(w)}, ${--> | |
48 | -<!-- h / 2--> | |
49 | -<!-- }`"--> | |
50 | -<!-- />--> | |
28 | + <!-- <polyline--> | |
29 | + <!-- :stroke="colorRights[0]"--> | |
30 | + <!-- stroke-width="2"--> | |
31 | + <!-- fill="transparent"--> | |
32 | + <!-- :points="`${xPos(20)}, 0 ${xPos(50)}, ${h / 2} ${xPos(w)}, ${--> | |
33 | + <!-- h / 2--> | |
34 | + <!-- }`"--> | |
35 | + <!-- />--> | |
51 | 36 | |
52 | -<!-- <polyline--> | |
53 | -<!-- :stroke="colorRights[1]"--> | |
54 | -<!-- fill="transparent"--> | |
55 | -<!-- stroke-width="3"--> | |
56 | -<!-- :points="`${xPos(0)}, ${h - 3}, ${xPos(200)}, ${h - 3}`"--> | |
57 | -<!-- />--> | |
58 | -<!-- </svg>--> | |
37 | + <!-- <polyline--> | |
38 | + <!-- :stroke="colorRights[1]"--> | |
39 | + <!-- fill="transparent"--> | |
40 | + <!-- stroke-width="3"--> | |
41 | + <!-- :points="`${xPos(0)}, ${h - 3}, ${xPos(200)}, ${h - 3}`"--> | |
42 | + <!-- />--> | |
43 | + <!-- </svg>--> | |
59 | 44 | </n-grid-item> |
60 | 45 | </n-grid> |
61 | 46 | </div> |
62 | 47 | </template> |
63 | 48 | <script setup lang="ts"> |
64 | -import {PropType, toRefs} from 'vue' | |
65 | -import {CreateComponentType} from '@/packages/index.d' | |
49 | +import { PropType, toRefs } from 'vue' | |
50 | +import { CreateComponentType } from '@/packages/index.d' | |
66 | 51 | |
67 | 52 | const props = defineProps({ |
68 | 53 | chartConfig: { |
... | ... | @@ -76,8 +61,8 @@ const props = defineProps({ |
76 | 61 | // props.chartConfig.attr.h = 148 |
77 | 62 | // props.chartConfig.attr.x = 0 |
78 | 63 | // props.chartConfig.attr.y = 0 |
79 | -const {w, h} = toRefs(props.chartConfig.attr) | |
80 | -const {colorLefts,colorRights,reverse,defaultReverse} = toRefs(props.chartConfig.option) | |
64 | +const { w, h } = toRefs(props.chartConfig.attr) | |
65 | +const { colorLefts, colorRights, reverse, defaultReverse } = toRefs(props.chartConfig.option) | |
81 | 66 | |
82 | 67 | const xPos = (pos: number) => { |
83 | 68 | if (!reverse.value) return pos | ... | ... |
1 | 1 | import { LeftCenterRightHeadConfig } from './LeftCenterRightHead/index' |
2 | 2 | import { LeftCenterRightHeadCommonConfig } from './LeftCenterRightHeadCommon/index' |
3 | 3 | |
4 | -export default [LeftCenterRightHeadConfig,LeftCenterRightHeadCommonConfig] | |
4 | +export default [LeftCenterRightHeadConfig, LeftCenterRightHeadCommonConfig] | ... | ... |
1 | 1 | <template> |
2 | - <v-chart | |
3 | - ref="vChartRef" | |
4 | - :theme="themeColor" | |
5 | - :option="option" | |
6 | - :manual-update="isPreview()" | |
7 | - :update-options="{ replaceMerge: replaceMergeArr }" | |
8 | - autoresize | |
9 | - ></v-chart> | |
2 | + <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" | |
3 | + :update-options="{ replaceMerge: replaceMergeArr }" autoresize></v-chart> | |
10 | 4 | </template> |
11 | 5 | |
12 | 6 | <script setup lang="ts"> | ... | ... |
1 | +import { ConfigType } from "@/packages/index.d" | |
2 | + | |
3 | +// 包分类枚举 | |
4 | +export enum PackagesCategoryEnum { | |
5 | + COMPOSES = 'external/Composes', | |
6 | +} | |
7 | + | |
8 | +// 图表包类型 | |
9 | +export type PackagesType = { | |
10 | + [PackagesCategoryEnum.COMPOSES]: ConfigType[] | |
11 | +} | |
12 | + | |
13 | +// 包分类名称 | |
14 | +export enum PackagesCategoryName { | |
15 | + COMPOSES = '组合', | |
16 | +} | ... | ... |
1 | +import { PackagesCategoryEnum, PackagesType } from '@/packages/components/external/types' | |
2 | +import { ComposesList } from '@/packages/components/external/Composes' | |
3 | + | |
4 | +export function useInjectLib(packagesList: any) { | |
5 | + | |
6 | + // console.log(ComposesList) | |
7 | + packagesList[PackagesCategoryEnum.COMPOSES] = ComposesList | |
8 | +} | ... | ... |
... | ... | @@ -150,8 +150,6 @@ export enum PackagesCategoryEnum { |
150 | 150 | TABLES = 'Tables', |
151 | 151 | INFORMATIONS = 'Informations', |
152 | 152 | DECORATES = 'Decorates', |
153 | - // THINGS_KIT | |
154 | - COMPOSES = 'external/Composes', | |
155 | 153 | } |
156 | 154 | |
157 | 155 | // 包分类名称 |
... | ... | @@ -160,8 +158,6 @@ export enum PackagesCategoryName { |
160 | 158 | TABLES = '列表', |
161 | 159 | INFORMATIONS = '信息', |
162 | 160 | DECORATES = '小组件', |
163 | - // THINGS_KIT | |
164 | - COMPOSES='组合', | |
165 | 161 | } |
166 | 162 | |
167 | 163 | // 获取组件 |
... | ... | @@ -176,6 +172,4 @@ export type PackagesType = { |
176 | 172 | [PackagesCategoryEnum.INFORMATIONS]: ConfigType[] |
177 | 173 | [PackagesCategoryEnum.TABLES]: ConfigType[] |
178 | 174 | [PackagesCategoryEnum.DECORATES]: ConfigType[] |
179 | - // THINGS_KIT | |
180 | - [PackagesCategoryEnum.COMPOSES]: ConfigType[] | |
181 | 175 | } | ... | ... |
... | ... | @@ -2,22 +2,19 @@ import { ChartList } from '@/packages/components/Charts/index' |
2 | 2 | import { DecorateList } from '@/packages/components/Decorates/index' |
3 | 3 | import { InformationList } from '@/packages/components/Informations/index' |
4 | 4 | import { TableList } from '@/packages/components/Tables/index' |
5 | -// THINGS_KIT | |
6 | -import { ComposesList } from '@/packages/components/external/Composes/index' | |
7 | 5 | import { PackagesCategoryEnum, PackagesType, ConfigType, FetchComFlagType } from '@/packages/index.d' |
6 | +import { useInjectLib } from './components/external/utils/useInjectLib' | |
8 | 7 | |
9 | 8 | const configModules = import.meta.globEager('./components/**/config.vue') |
10 | 9 | const indexModules = import.meta.globEager('./components/**/index.vue') |
11 | 10 | const imagesModules = import.meta.globEager('../assets/images/chart/**') |
12 | 11 | |
13 | 12 | // * 所有图表 |
14 | -export let packagesList: PackagesType = { | |
13 | +export const packagesList: PackagesType = { | |
15 | 14 | [PackagesCategoryEnum.CHARTS]: ChartList, |
16 | 15 | [PackagesCategoryEnum.INFORMATIONS]: InformationList, |
17 | 16 | [PackagesCategoryEnum.TABLES]: TableList, |
18 | - [PackagesCategoryEnum.DECORATES]: DecorateList, | |
19 | - // THINGS_KIT | |
20 | - [PackagesCategoryEnum.COMPOSES]: ComposesList | |
17 | + [PackagesCategoryEnum.DECORATES]: DecorateList, | |
21 | 18 | } |
22 | 19 | |
23 | 20 | /** |
... | ... | @@ -83,3 +80,5 @@ export const fetchImages = async (targetData?: ConfigType) => { |
83 | 80 | } |
84 | 81 | return '' |
85 | 82 | } |
83 | + | |
84 | +useInjectLib(packagesList as any) | ... | ... |
1 | -import { RuntimeEnvironment } from "@/enums/external/envEnum"; | |
2 | -import { PageEnum } from "@/enums/pageEnum"; | |
1 | +import { ProjectRuntimeEnvEnum } from "@/enums/external/envEnum"; | |
2 | +import { PageEnum } from "@/enums/external/pageEnum"; | |
3 | 3 | import { useUserStoreWithOut } from "@/store/external/module/user"; |
4 | -import { RouteLocationRaw, Router } from "vue-router"; | |
4 | +import { NavigationGuardNext, NavigationGuardWithThis, RouteLocationNormalized, RouteLocationRaw, Router } from "vue-router"; | |
5 | 5 | |
6 | 6 | |
7 | 7 | const whitePathList: string[] = [PageEnum.BASE_LOGIN]; |
8 | 8 | |
9 | -const isIndependenceMode = import.meta.env.MODE === RuntimeEnvironment.INDEPENDENCE | |
9 | +const isAloneMode = [ProjectRuntimeEnvEnum.DEV_ALONE, ProjectRuntimeEnvEnum.PROD_ALONE].includes(import.meta.env.MODE as ProjectRuntimeEnvEnum) | |
10 | 10 | |
11 | -const toIotPlatformLogin = () => { | |
12 | - const { origin } = window.location | |
13 | - window.location.replace(`${origin}/login?redirect=${import.meta.env.VITE_IOT_PLATFORM_PROXY_PREFIX}`) | |
11 | +const toIotPlatformLogin = ({ to, from, next }: { to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext }) => { | |
12 | + const { origin, port } = window.location | |
13 | + if (Number(port) === Number(import.meta.env.VITE_DEV_PORT)) { | |
14 | + if (whitePathList.includes(to.path)) { | |
15 | + next() | |
16 | + return | |
17 | + } else { | |
18 | + next(PageEnum.BASE_LOGIN) | |
19 | + } | |
20 | + return | |
21 | + } | |
22 | + window.location.replace(`${origin}/login?redirect=${import.meta.env.VITE_GLOB_PUBLIC_PATH}`) | |
14 | 23 | } |
15 | 24 | |
16 | 25 | export function createPermissionGuard(router: Router) { |
17 | - const userStore = useUserStoreWithOut() | |
26 | + const userStore = useUserStoreWithOut() | |
18 | 27 | |
19 | 28 | router.beforeEach((to, from, next) => { |
20 | 29 | if (from.path === '/' && |
... | ... | @@ -22,7 +31,6 @@ export function createPermissionGuard(router: Router) { |
22 | 31 | userStore.getUserInfo.homePath && |
23 | 32 | userStore.getUserInfo.homePath !== PageEnum.BASE_HOME |
24 | 33 | ) { |
25 | - console.log(userStore.getUserInfo.homePath) | |
26 | 34 | next(userStore.getUserInfo.homePath) |
27 | 35 | return |
28 | 36 | } |
... | ... | @@ -33,7 +41,7 @@ export function createPermissionGuard(router: Router) { |
33 | 41 | if (to.path === PageEnum.BASE_LOGIN && token) { |
34 | 42 | const isSessionTimeout = userStore.getSessionTimeout |
35 | 43 | try { |
36 | - if (!isSessionTimeout) { | |
44 | + if (isSessionTimeout) { | |
37 | 45 | next('/') |
38 | 46 | } |
39 | 47 | } catch (error) { |
... | ... | @@ -41,8 +49,9 @@ export function createPermissionGuard(router: Router) { |
41 | 49 | } |
42 | 50 | } |
43 | 51 | else { |
44 | - if (isIndependenceMode) { | |
45 | - toIotPlatformLogin() | |
52 | + if (!isAloneMode) { | |
53 | + console.log({ to, from }) | |
54 | + toIotPlatformLogin({ to, from, next }) | |
46 | 55 | return |
47 | 56 | } |
48 | 57 | next() |
... | ... | @@ -55,8 +64,9 @@ export function createPermissionGuard(router: Router) { |
55 | 64 | path: PageEnum.BASE_LOGIN, |
56 | 65 | redirect: true |
57 | 66 | } as RouteLocationRaw |
58 | - if (isIndependenceMode) { | |
59 | - toIotPlatformLogin() | |
67 | + if (!isAloneMode) { | |
68 | + console.log({ to, from }) | |
69 | + toIotPlatformLogin({ to, from, next }) | |
60 | 70 | return |
61 | 71 | } |
62 | 72 | next(redirectData) | ... | ... |
... | ... | @@ -2,7 +2,7 @@ import type { UserInfo, UserUpdateInfo } from '/#/external/store'; |
2 | 2 | import type { ErrorMessageMode } from '/#/external/axios'; |
3 | 3 | import { defineStore } from 'pinia'; |
4 | 4 | import { pinia as store } from '@/store'; |
5 | -import { RoleEnum } from '@/enums/external/roleEnum'; | |
5 | +import { RoleEnum } from '@/enums/external/roleEnum'; | |
6 | 6 | import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, USER_INFO_KEY } from '@/enums/external/cacheEnum'; |
7 | 7 | import { getAuthCache, setAuthCache } from '@/utils/external/auth'; |
8 | 8 | import { |
... | ... | @@ -16,7 +16,7 @@ import router from '@/router'; |
16 | 16 | import { createLocalStorage } from '@/utils/external/cache'; |
17 | 17 | import { useI18n } from 'vue-i18n'; |
18 | 18 | import { useDialog } from 'naive-ui'; |
19 | -import { PageEnum } from '@/enums/pageEnum'; | |
19 | +import { PageEnum } from '@/enums/external/pageEnum'; | |
20 | 20 | |
21 | 21 | interface UserState { |
22 | 22 | platInfo: any; |
... | ... | @@ -177,9 +177,9 @@ export const useUserStore = defineStore({ |
177 | 177 | this.setSessionTimeout(false); |
178 | 178 | setAuthCache(REFRESH_TOKEN_KEY, undefined); |
179 | 179 | this.setUserInfo(null); |
180 | - goLogin && router.push(PageEnum.BASE_LOGIN); | |
181 | 180 | window.localStorage.clear(); |
182 | 181 | window.localStorage.removeItem('updateUserInfo'); |
182 | + goLogin && router.push(PageEnum.BASE_LOGIN); | |
183 | 183 | }, |
184 | 184 | |
185 | 185 | async doRefresh() { | ... | ... |
... | ... | @@ -2,12 +2,13 @@ import type { GlobEnvConfig } from '/#/external/config'; |
2 | 2 | |
3 | 3 | // import pkg from '../../../../package.json'; |
4 | 4 | import { getGlobalConfigName } from '../../../../build/external/vite/plugins/globConfig/getGlobConfigName'; |
5 | -import { RuntimeEnvironment } from '@/enums/external/envEnum'; | |
5 | +import { ProjectRuntimeEnvEnum } from '@/enums/external/envEnum'; | |
6 | + | |
6 | 7 | |
7 | 8 | export function getCommonStoragePrefix() { |
8 | 9 | // const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig(); |
9 | 10 | const VITE_GLOB_APP_SHORT_NAME = 'undefined' |
10 | - const ENV = [RuntimeEnvironment.DEVELOPMENT, RuntimeEnvironment.INDEPENDENCE].includes(import.meta.env.MODE as RuntimeEnvironment) ? RuntimeEnvironment.DEVELOPMENT : RuntimeEnvironment.PRODUCTION | |
11 | + const ENV = [ProjectRuntimeEnvEnum.DEV, ProjectRuntimeEnvEnum.DEV_ALONE].includes(import.meta.env.MODE as ProjectRuntimeEnvEnum) ? ProjectRuntimeEnvEnum.DEV : ProjectRuntimeEnvEnum.PROD | |
11 | 12 | return `${VITE_GLOB_APP_SHORT_NAME}__${ENV.toUpperCase()}`.toUpperCase(); |
12 | 13 | } |
13 | 14 | ... | ... |
1 | +import { PackagesCategoryEnum, PackagesCategoryName } from "@/packages/components/external/types" | |
2 | +import { icon } from '@/plugins' | |
3 | +import { renderIcon } from "@/utils" | |
4 | + | |
5 | +const { GraphicalDataFlowIcon } = icon.carbon | |
6 | + | |
7 | +export function useInjectAside(packagesListObj: Recordable) { | |
8 | + | |
9 | + packagesListObj[PackagesCategoryEnum.COMPOSES] = { | |
10 | + icon: renderIcon(GraphicalDataFlowIcon), | |
11 | + label: PackagesCategoryName.COMPOSES | |
12 | + } | |
13 | +} | ... | ... |
... | ... | @@ -6,6 +6,7 @@ import { PackagesCategoryEnum, PackagesCategoryName, PackagesType } from '@/pack |
6 | 6 | // 图表 |
7 | 7 | import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore' |
8 | 8 | import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d' |
9 | +import { useInjectAside } from './external/useInjectAside' | |
9 | 10 | // 图标 |
10 | 11 | const { BarChartIcon } = icon.ionicons5 |
11 | 12 | const { TableSplitIcon, RoadmapIcon, SpellCheckIcon, GraphicalDataFlowIcon } = icon.carbon |
... | ... | @@ -20,7 +21,7 @@ export type MenuOptionsType = { |
20 | 21 | |
21 | 22 | const { getPackagesList } = usePackagesStore() |
22 | 23 | const menuOptions: MenuOptionsType[] = [] |
23 | -// THINGS_KIT | |
24 | + | |
24 | 25 | const packagesListObj = { |
25 | 26 | [PackagesCategoryEnum.CHARTS]: { |
26 | 27 | icon: renderIcon(RoadmapIcon), |
... | ... | @@ -37,13 +38,12 @@ const packagesListObj = { |
37 | 38 | [PackagesCategoryEnum.DECORATES]: { |
38 | 39 | icon: renderIcon(GraphicalDataFlowIcon), |
39 | 40 | label: PackagesCategoryName.DECORATES |
40 | - }, | |
41 | - [PackagesCategoryEnum.COMPOSES]: { | |
42 | - icon: renderIcon(GraphicalDataFlowIcon), | |
43 | - label: PackagesCategoryName.COMPOSES | |
44 | 41 | } |
45 | 42 | } |
46 | 43 | |
44 | +// THINGS_KIT | |
45 | +useInjectAside(packagesListObj as any) | |
46 | + | |
47 | 47 | // 处理列表 |
48 | 48 | const handlePackagesList = () => { |
49 | 49 | for (const val in getPackagesList) { | ... | ... |
1 | 1 | <template> |
2 | 2 | <div class="go-items-list"> |
3 | - <n-grid | |
4 | - :x-gap="20" | |
5 | - :y-gap="20" | |
6 | - cols="2 s:2 m:3 l:4 xl:4 xxl:4" | |
7 | - responsive="screen" | |
8 | - > | |
3 | + <n-grid :x-gap="20" :y-gap="20" cols="2 s:2 m:3 l:4 xl:4 xxl:4" responsive="screen"> | |
9 | 4 | <n-grid-item v-for="(item, index) in list" :key="item.id"> |
10 | - <project-items-card | |
11 | - :cardData="item" | |
12 | - @resize="resizeHandle" | |
13 | - @delete="deleteHandle($event, index)" | |
14 | - @edit="editHandle" | |
15 | - ></project-items-card> | |
5 | + <project-items-card :cardData="item" @resize="resizeHandle" @delete="deleteHandle($event, index)" | |
6 | + @edit="editHandle"></project-items-card> | |
16 | 7 | </n-grid-item> |
17 | 8 | </n-grid> |
18 | 9 | <div class="list-pagination"> |
19 | - <n-pagination | |
20 | - :item-count="10" | |
21 | - :page-sizes="[10, 20, 30, 40]" | |
22 | - show-size-picker | |
23 | - /> | |
10 | + <n-pagination :item-count="10" :page-sizes="[10, 20, 30, 40]" show-size-picker /> | |
24 | 11 | </div> |
25 | 12 | </div> |
26 | - <project-items-modal-card | |
27 | - v-if="modalData" | |
28 | - :modalShow="modalShow" | |
29 | - :cardData="modalData" | |
30 | - @close="closeModal" | |
31 | - @edit="editHandle" | |
32 | - ></project-items-modal-card> | |
13 | + <project-items-modal-card v-if="modalData" :modalShow="modalShow" :cardData="modalData" @close="closeModal" | |
14 | + @edit="editHandle"></project-items-modal-card> | |
33 | 15 | </template> |
34 | 16 | |
35 | 17 | <script setup lang="ts"> |
36 | -import {ProjectItemsCard} from '../ProjectItemsCard/index' | |
37 | -import {ProjectItemsModalCard} from '../ProjectItemsModalCard/index' | |
38 | -import {icon} from '@/plugins' | |
39 | -import {useModalDataInit} from './hooks/useModal.hook' | |
40 | -import {useDataListInit} from './hooks/useData.hook' | |
41 | -import {getDataViewList} from "@/api/external/contentSave/content"; | |
42 | -import {onMounted, ref} from "vue"; | |
18 | +import { ProjectItemsCard } from '../ProjectItemsCard/index' | |
19 | +import { ProjectItemsModalCard } from '../ProjectItemsModalCard/index' | |
20 | +import { icon } from '@/plugins' | |
21 | +import { useModalDataInit } from './hooks/useModal.hook' | |
22 | +import { useDataListInit } from './hooks/useData.hook' | |
23 | +import { getDataViewList } from "@/api/external/contentSave/content"; | |
24 | +import { onMounted, ref } from "vue"; | |
43 | 25 | // THINGS_KIT |
44 | -import {ChartList} from '../../index.d' | |
26 | +import { ChartList } from '../../index.d' | |
45 | 27 | |
46 | -const {CopyIcon, EllipsisHorizontalCircleSharpIcon} = icon.ionicons5 | |
47 | -const {deleteHandle} = useDataListInit() | |
48 | -const {modalData, modalShow, closeModal, resizeHandle, editHandle} = useModalDataInit() | |
28 | +const { CopyIcon, EllipsisHorizontalCircleSharpIcon } = icon.ionicons5 | |
29 | +const { deleteHandle } = useDataListInit() | |
30 | +const { modalData, modalShow, closeModal, resizeHandle, editHandle } = useModalDataInit() | |
49 | 31 | |
50 | 32 | // THINGS_KIT |
51 | 33 | const list = ref<ChartList>([]) |
52 | 34 | onMounted(async () => { |
53 | - const {items} = await getDataViewList({page: 1, pageSize: 10}) | |
54 | - list.value = items | |
35 | + try { | |
36 | + const { items } = await getDataViewList({ page: 1, pageSize: 10 }) | |
37 | + list.value = items | |
38 | + } catch (error) { | |
39 | + console.log(error) | |
40 | + } | |
55 | 41 | }) |
56 | 42 | |
57 | 43 | </script> |
58 | 44 | |
59 | 45 | <style lang="scss" scoped> |
60 | 46 | $contentHeight: 250px; |
47 | + | |
61 | 48 | @include go('items-list') { |
62 | 49 | display: flex; |
63 | 50 | flex-direction: column; |
64 | 51 | justify-content: space-between; |
65 | 52 | min-height: calc(100vh - #{$--header-height} * 2 - 2px); |
53 | + | |
66 | 54 | .list-content { |
67 | 55 | position: relative; |
68 | 56 | height: $contentHeight; |
69 | 57 | } |
58 | + | |
70 | 59 | .list-pagination { |
71 | 60 | display: flex; |
72 | 61 | justify-content: flex-end; | ... | ... |
... | ... | @@ -12,10 +12,10 @@ declare interface GlobEnvConfig { |
12 | 12 | |
13 | 13 | VITE_GLOB_APP_SHORT_NAME: string |
14 | 14 | } |
15 | - | |
15 | + | |
16 | 16 | |
17 | 17 | declare type GlobConfig = { |
18 | - | |
18 | + | |
19 | 19 | } |
20 | 20 | |
21 | 21 | declare interface ViteEnv extends GlobEnvConfig { |
... | ... | @@ -25,8 +25,6 @@ declare interface ViteEnv extends GlobEnvConfig { |
25 | 25 | VITE_DEV_PATH: string |
26 | 26 | // 生产地址 |
27 | 27 | VITE_PRO_PATH: string |
28 | - // iot platform proxy prefix | |
29 | - VITE_IOT_PLATFORM_PROXY_PREFIX: string | |
30 | 28 | } |
31 | 29 | |
32 | 30 | interface ImportMetaEnv extends ViteEnv { | ... | ... |
... | ... | @@ -17,7 +17,7 @@ export default defineConfig(({ mode, command }) => { |
17 | 17 | |
18 | 18 | const root = process.cwd() |
19 | 19 | |
20 | - const env = loadEnv(mode, root) | |
20 | + const env = loadEnv(mode, root) | |
21 | 21 | |
22 | 22 | const viteEnv = parseEnv(env) |
23 | 23 | |
... | ... | @@ -89,8 +89,8 @@ export default defineConfig(({ mode, command }) => { |
89 | 89 | chunkSizeWarningLimit: chunkSizeWarningLimit |
90 | 90 | }, |
91 | 91 | server: { |
92 | - port: 5555, | |
92 | + port: viteEnv.VITE_DEV_PORT, | |
93 | 93 | proxy: createProxy(viteEnv), |
94 | - }, | |
94 | + }, | |
95 | 95 | } |
96 | 96 | }) | ... | ... |
windi.config.ts
0 → 100644