Commit 9948fce0aa4ba2601d81bdd88f240cc579c1d568

Authored by xp.Huang
2 parents 830ff573 c2d0b3dc

Merge branch 'ww' into 'main'

perf: 新增命令行区分不同环境下运行项目

See merge request yunteng/thingskit-view!6
Showing 40 changed files with 299 additions and 281 deletions
1 # port 1 # port
2 -VITE_DEV_PORT = '8001' 2 +VITE_DEV_PORT = 5555
3 3
4 # development path 4 # development path
5 VITE_DEV_PATH = '/' 5 VITE_DEV_PATH = '/'
@@ -8,10 +8,8 @@ VITE_DEV_PATH = '/' @@ -8,10 +8,8 @@ VITE_DEV_PATH = '/'
8 VITE_PRO_PATH = '/' 8 VITE_PRO_PATH = '/'
9 9
10 # spa-title 10 # spa-title
11 -VITE_GLOB_APP_TITLE = GoView 11 +VITE_GLOB_APP_TITLE = 大屏设计器
12 12
13 # spa shortname 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
@@ -9,3 +9,6 @@ VITE_GLOB_API_URL_PREFIX = /yt @@ -9,3 +9,6 @@ VITE_GLOB_API_URL_PREFIX = /yt
9 9
10 # 内容安全协议 10 # 内容安全协议
11 VITE_GLOB_CONTENT_SECURITY_POLICY = false 11 VITE_GLOB_CONTENT_SECURITY_POLICY = false
  12 +
  13 +# 公共路径
  14 +VITE_GLOB_PUBLIC_PATH = /
  1 +# Proxy
  2 +VITE_GLOB_PROXY = [["/api", "http://222.180.200.114:48080/api"]]
  3 +
  4 +# Api prefix
  5 +VITE_GLOB_API_URL = /api
  6 +
  7 +#
  8 +VITE_GLOB_API_URL_PREFIX = /yt
  9 +
  10 +# 内容安全协议
  11 +VITE_GLOB_CONTENT_SECURITY_POLICY = false
  12 +
  13 +# 公共路径
  14 +VITE_GLOB_PUBLIC_PATH = /
@@ -8,7 +8,7 @@ VITE_GLOB_API_URL = /api @@ -8,7 +8,7 @@ VITE_GLOB_API_URL = /api
8 VITE_GLOB_API_URL_PREFIX = /yt 8 VITE_GLOB_API_URL_PREFIX = /yt
9 9
10 # 内容安全协议 10 # 内容安全协议
11 -VITE_GLOB_CONTENT_SECURITY_POLICY = false 11 +VITE_GLOB_CONTENT_SECURITY_POLICY = true
12 12
13 # 公共路径 13 # 公共路径
14 -VITE_GLOB_PUBLIC_PATH = / 14 +VITE_GLOB_PUBLIC_PATH = /large-designer/
@@ -7,7 +7,7 @@ VITE_GLOB_API_URL = /api @@ -7,7 +7,7 @@ VITE_GLOB_API_URL = /api
7 VITE_GLOB_API_URL_PREFIX = /yt 7 VITE_GLOB_API_URL_PREFIX = /yt
8 8
9 # 内容安全协议 9 # 内容安全协议
10 -VITE_GLOB_CONTENT_SECURITY_POLICY = true 10 +VITE_GLOB_CONTENT_SECURITY_POLICY = false
11 11
12 -#  
13 -VITE_GLOB_PUBLIC_PATH = / 12 +# 公共路径
  13 +VITE_GLOB_PUBLIC_PATH = /large-designer/
@@ -4,3 +4,4 @@ dist @@ -4,3 +4,4 @@ dist
4 dist-ssr 4 dist-ssr
5 *.local 5 *.local
6 .vscode 6 .vscode
  7 +src/packages/components/Decorates/Mores/external/Icon/SvgBorder.vue
  1 +export enum ProjectRuntimeEnvEnum {
  2 + DEV = 'development',
  3 + PROD = 'production',
  4 + DEV_ALONE = 'alone.dev',
  5 + PROD_ALONE = 'alone.prod'
  6 +}
1 import { resolve } from "path" 1 import { resolve } from "path"
2 import { ConfigEnv } from "vite" 2 import { ConfigEnv } from "vite"
3 3
  4 +
4 export function parseEnv(env: ImportMetaEnv) { 5 export function parseEnv(env: ImportMetaEnv) {
5 const res: Record<string, any> = {} 6 const res: Record<string, any> = {}
6 7
@@ -28,7 +29,7 @@ export function parseEnv(env: ImportMetaEnv) { @@ -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 export function getEnvConfig(match = 'VITE_GLOB_',) { 35 export function getEnvConfig(match = 'VITE_GLOB_',) {
@@ -40,6 +41,6 @@ export function getRootPath(...dir: string[]) { @@ -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,9 +3,9 @@ import { createHtmlPlugin } from 'vite-plugin-html'
3 const GLOB_CONFIG_FILE_NAME = '_app.config.js' 3 const GLOB_CONFIG_FILE_NAME = '_app.config.js'
4 4
5 export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) { 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 const getAppConfigSrc = () => { 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 return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${Date.now()}` 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,7 +14,6 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
14 inject: { 14 inject: {
15 data: { 15 data: {
16 title: VITE_GLOB_APP_TITLE, 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 tags: isBuild ? [ 18 tags: isBuild ? [
20 { 19 {
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="zh-cmn-Hans"> 2 <html lang="zh-cmn-Hans">
3 3
4 -<head>  
5 - <%- contentSecurityPolicy %> 4 +<head>
6 <meta charset="UTF-8" /> 5 <meta charset="UTF-8" />
7 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
8 <meta name="renderer" content="webkit" /> 7 <meta name="renderer" content="webkit" />
@@ -13,7 +12,7 @@ @@ -13,7 +12,7 @@
13 content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" /> 12 content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" />
14 <link rel="icon" href="./favicon.ico" /> 13 <link rel="icon" href="./favicon.ico" />
15 <title> 14 <title>
16 - <%= title %>> 15 + <%= title %>
17 </title> 16 </title>
18 <link rel="stylesheet" href="./index.css" /> 17 <link rel="stylesheet" href="./index.css" />
19 </head> 18 </head>
@@ -26,11 +25,7 @@ @@ -26,11 +25,7 @@
26 <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span> 25 <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
27 </div> 26 </div>
28 </div> 27 </div>
29 - </div>  
30 - <!-- THINGS_KIT -->  
31 - <script>  
32 - document.title="大屏设计器"  
33 - </script> 28 + </div>
34 <script type="module" src="/src/main.ts"></script> 29 <script type="module" src="/src/main.ts"></script>
35 </body> 30 </body>
36 31
@@ -6,9 +6,11 @@ @@ -6,9 +6,11 @@
6 }, 6 },
7 "scripts": { 7 "scripts": {
8 "dev": "vite --host", 8 "dev": "vite --host",
9 - "dev:proxy": "vite --host --mode independence", 9 + "dev:alone": "vite --host --mode alone.dev",
10 "build": "vue-tsc --noEmit && vite build", 10 "build": "vue-tsc --noEmit && vite build",
  11 + "build:alone": "vue-tsc --noEmit && vite build --mode alone.prod",
11 "preview": "vite preview", 12 "preview": "vite preview",
  13 + "preview:alone": "vite preview --mode alone.prod",
12 "new": "plop --plopfile ./plop/plopfile.js", 14 "new": "plop --plopfile ./plop/plopfile.js",
13 "postinstall": "husky install", 15 "postinstall": "husky install",
14 "lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src", 16 "lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src",
@@ -22,6 +22,7 @@ import { GoSystemInfo } from '@/components/GoSystemInfo/index' @@ -22,6 +22,7 @@ import { GoSystemInfo } from '@/components/GoSystemInfo/index'
22 import Person from './person.png' 22 import Person from './person.png'
23 23
24 import { icon } from '@/plugins' 24 import { icon } from '@/plugins'
  25 +import { useUserStore } from '@/store/external/module/user'
25 const { ChatboxEllipsesIcon, PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5 26 const { ChatboxEllipsesIcon, PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5
26 27
27 const t = window['$t'] 28 const t = window['$t']
@@ -65,7 +66,7 @@ const options = ref([ @@ -65,7 +66,7 @@ const options = ref([
65 key: 'sysSet', 66 key: 'sysSet',
66 icon: renderIcon(SettingsSharpIcon) 67 icon: renderIcon(SettingsSharpIcon)
67 }, 68 },
68 - // THINGS_KIT 69 + // THINGS_KIT 隐藏关于软件
69 // { 70 // {
70 // label: renderLang('global.contact'), 71 // label: renderLang('global.contact'),
71 // key: 'contact', 72 // key: 'contact',
@@ -97,6 +98,8 @@ const sysInfoHandle = () => { @@ -97,6 +98,8 @@ const sysInfoHandle = () => {
97 modelShowInfo.value = true 98 modelShowInfo.value = true
98 } 99 }
99 100
  101 +// THINGS_KIT 修改退出登录
  102 +const userStore = useUserStore()
100 const handleSelect = (key: string) => { 103 const handleSelect = (key: string) => {
101 switch (key) { 104 switch (key) {
102 case 'contact': 105 case 'contact':
@@ -106,7 +109,9 @@ const handleSelect = (key: string) => { @@ -106,7 +109,9 @@ const handleSelect = (key: string) => {
106 sysSetHandle() 109 sysSetHandle()
107 break 110 break
108 case 'logout': 111 case 'logout':
109 - logout() 112 + // THINGS_KIT 修改退出登录
  113 + userStore.logout(true)
  114 + // logout()
110 break 115 break
111 } 116 }
112 } 117 }
1 -export enum RuntimeEnvironment {  
2 - DEVELOPMENT = 'development',  
3 - PRODUCTION = 'production',  
4 - INDEPENDENCE = 'independence'  
5 -} 1 +import { ProjectRuntimeEnvEnum } from '../../../build/external/envEnum'
  2 +
  3 +export { ProjectRuntimeEnvEnum }
1 -export const PageEnum = {  
2 - SYSTEM_PASSWORD: '/system/changePassword', 1 +
  2 +
  3 +export enum PageEnum {
3 // basic login path 4 // basic login path
4 - BASE_LOGIN: '/login', 5 + BASE_LOGIN = '/login',
5 // basic home path 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,12 +29,6 @@ export enum PageEnum {
29 RELOAD = '/reload', 29 RELOAD = '/reload',
30 RELOAD_NAME = 'Reload', 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 BASE_HOME = '/project', 33 BASE_HOME = '/project',
40 BASE_HOME_NAME = 'Project', 34 BASE_HOME_NAME = 'Project',
  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,8 +13,12 @@ import '@/styles/pages/index.scss'
13 import 'animate.css/animate.min.css' 13 import 'animate.css/animate.min.css'
14 // 引入标尺 14 // 引入标尺
15 import 'vue3-sketch-ruler/lib/style.css' 15 import 'vue3-sketch-ruler/lib/style.css'
  16 +import { useWebSecurityPolicy } from './hooks/external/useWebSecurityPolicy'
16 17
17 async function appInit() { 18 async function appInit() {
  19 + // THINGS_KIT 内容安全协议hook
  20 + useWebSecurityPolicy()
  21 +
18 const goAppProvider = createApp(GoAppProvider) 22 const goAppProvider = createApp(GoAppProvider)
19 23
20 const app = createApp(App) 24 const app = createApp(App)
@@ -7,14 +7,14 @@ export const option = { @@ -7,14 +7,14 @@ export const option = {
7 dataset: '物联网平台数据统计', 7 dataset: '物联网平台数据统计',
8 bgSrc: 'src/assets/external/headbackground/bg_top.png', 8 bgSrc: 'src/assets/external/headbackground/bg_top.png',
9 fontSize: 36, 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 export default class Config extends PublicConfigClass implements CreateComponentType { 20 export default class Config extends PublicConfigClass implements CreateComponentType {
@@ -2,14 +2,8 @@ @@ -2,14 +2,8 @@
2 <collapse-item name="信息" :expanded="true"> 2 <collapse-item name="信息" :expanded="true">
3 <setting-item-box name="背景选择" :alone="true"> 3 <setting-item-box name="背景选择" :alone="true">
4 <setting-item> 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 </setting-item> 7 </setting-item>
14 </setting-item-box> 8 </setting-item-box>
15 <setting-item-box name="文字" :alone="true"> 9 <setting-item-box name="文字" :alone="true">
@@ -31,7 +25,7 @@ @@ -31,7 +25,7 @@
31 </setting-item-box> 25 </setting-item-box>
32 <setting-item-box name="位置x轴"> 26 <setting-item-box name="位置x轴">
33 <setting-item name="字体位置x轴"> 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 </setting-item> 29 </setting-item>
36 </setting-item-box> 30 </setting-item-box>
37 <setting-item-box name="位置y轴"> 31 <setting-item-box name="位置y轴">
@@ -43,16 +37,15 @@ @@ -43,16 +37,15 @@
43 <collapse-item name="右侧" :expanded="true"> 37 <collapse-item name="右侧" :expanded="true">
44 <setting-item-box name="是否显示"> 38 <setting-item-box name="是否显示">
45 <setting-item name=""> 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 </setting-item> 41 </setting-item>
48 </setting-item-box> 42 </setting-item-box>
49 <setting-item-box name="文字"> 43 <setting-item-box name="文字">
50 <setting-item name="字体大小"> 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 </setting-item> 46 </setting-item>
54 <setting-item name="字体位置x轴"> 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 </setting-item> 49 </setting-item>
57 <setting-item name="字体位置y轴"> 50 <setting-item name="字体位置y轴">
58 <n-input-number v-model:value="optionData.yT" size="small" placeholder="字体位置"></n-input-number> 51 <n-input-number v-model:value="optionData.yT" size="small" placeholder="字体位置"></n-input-number>
@@ -67,14 +60,14 @@ @@ -67,14 +60,14 @@
67 </template> 60 </template>
68 61
69 <script setup lang="ts"> 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 import { 65 import {
73 CollapseItem, 66 CollapseItem,
74 SettingItemBox, 67 SettingItemBox,
75 SettingItem 68 SettingItem
76 } from '@/components/Pages/ChartItemSetting' 69 } from '@/components/Pages/ChartItemSetting'
77 -import {SelectOption} from "naive-ui"; 70 +import { SelectOption } from "naive-ui";
78 71
79 const props = defineProps({ 72 const props = defineProps({
80 optionData: { 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 export const LeftCenterRightHeadConfig: ConfigType = { 6 export const LeftCenterRightHeadConfig: ConfigType = {
5 key: 'LeftCenterRightHead', 7 key: 'LeftCenterRightHead',
1 <template> 1 <template>
2 <div class="go-text-box"> 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 <n-grid-item> 5 <n-grid-item>
6 <!-- 占位--> 6 <!-- 占位-->
7 <div></div> 7 <div></div>
8 </n-grid-item> 8 </n-grid-item>
9 <n-grid-item> 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 option.configOption.dataset 12 option.configOption.dataset
14 }}</span> 13 }}</span>
15 </n-grid-item> 14 </n-grid-item>
16 <n-grid-item> 15 <n-grid-item>
17 <span style="position:relative" v-if="option.configOption.showRight" 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 newData 18 newData
20 }}</span> 19 }}</span>
21 </n-grid-item> 20 </n-grid-item>
@@ -23,11 +22,11 @@ @@ -23,11 +22,11 @@
23 </div> 22 </div>
24 </template> 23 </template>
25 <script setup lang="ts"> 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 const props = defineProps({ 31 const props = defineProps({
33 chartConfig: { 32 chartConfig: {
@@ -55,14 +54,14 @@ props.chartConfig.attr.x = 0 @@ -55,14 +54,14 @@ props.chartConfig.attr.x = 0
55 props.chartConfig.attr.y = 0 54 props.chartConfig.attr.y = 0
56 55
57 watch( 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 useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { 67 useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
@@ -72,18 +71,18 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { @@ -72,18 +71,18 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
72 71
73 //TODO待封装 这里和原作者时间通用获取当前时间代码一样 72 //TODO待封装 这里和原作者时间通用获取当前时间代码一样
74 onMounted(() => { 73 onMounted(() => {
75 -//格式化当前时间 74 + //格式化当前时间
76 timer = setInterval(() => { 75 timer = setInterval(() => {
77 const 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 const datetime = new Date() 86 const datetime = new Date()
88 const year = datetime.getFullYear() 87 const year = datetime.getFullYear()
89 const month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1 88 const month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1
@@ -115,6 +114,7 @@ onUnmounted(() => { @@ -115,6 +114,7 @@ onUnmounted(() => {
115 display: flex; 114 display: flex;
116 align-items: center; 115 align-items: center;
117 justify-content: center; 116 justify-content: center;
  117 +
118 .n-gradient-text { 118 .n-gradient-text {
119 white-space: initial; 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 import cloneDeep from 'lodash/cloneDeep' 4 import cloneDeep from 'lodash/cloneDeep'
5 5
6 export const option = { 6 export const option = {
1 <template> 1 <template>
2 <CollapseItem name="头部左侧样式" :expanded="true"> 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 <SettingItem name="颜色"> 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 </SettingItem> 6 </SettingItem>
15 <SettingItem> 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 </n-button> 10 </n-button>
22 </SettingItem> 11 </SettingItem>
23 </SettingItemBox> 12 </SettingItemBox>
24 </CollapseItem> 13 </CollapseItem>
25 <CollapseItem name="头部右侧样式" :expanded="true"> 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 <SettingItem name="颜色"> 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 </SettingItem> 18 </SettingItem>
38 <SettingItem> 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 </n-button> 22 </n-button>
45 </SettingItem> 23 </SettingItem>
@@ -48,8 +26,8 @@ @@ -48,8 +26,8 @@
48 </template> 26 </template>
49 27
50 <script setup lang="ts"> 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 import { 31 import {
54 CollapseItem, 32 CollapseItem,
55 SettingItemBox, 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 export const LeftCenterRightHeadCommonConfig: ConfigType = { 5 export const LeftCenterRightHeadCommonConfig: ConfigType = {
5 key: 'LeftCenterRightHeadCommon', 6 key: 'LeftCenterRightHeadCommon',
1 <template> 1 <template>
2 <div> 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 <n-grid-item> 4 <n-grid-item>
6 <svg :width="w" :height="h"> 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 </svg> 14 </svg>
30 </n-grid-item> 15 </n-grid-item>
31 <n-grid-item> 16 <n-grid-item>
32 -<!-- <div style="width:300px;height: 30px"></div>--> 17 + <!-- <div style="width:300px;height: 30px"></div>-->
33 </n-grid-item> 18 </n-grid-item>
34 <n-grid-item> 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 </n-grid-item> 44 </n-grid-item>
60 </n-grid> 45 </n-grid>
61 </div> 46 </div>
62 </template> 47 </template>
63 <script setup lang="ts"> 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 const props = defineProps({ 52 const props = defineProps({
68 chartConfig: { 53 chartConfig: {
@@ -76,8 +61,8 @@ const props = defineProps({ @@ -76,8 +61,8 @@ const props = defineProps({
76 // props.chartConfig.attr.h = 148 61 // props.chartConfig.attr.h = 148
77 // props.chartConfig.attr.x = 0 62 // props.chartConfig.attr.x = 0
78 // props.chartConfig.attr.y = 0 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 const xPos = (pos: number) => { 67 const xPos = (pos: number) => {
83 if (!reverse.value) return pos 68 if (!reverse.value) return pos
1 import { LeftCenterRightHeadConfig } from './LeftCenterRightHead/index' 1 import { LeftCenterRightHeadConfig } from './LeftCenterRightHead/index'
2 import { LeftCenterRightHeadCommonConfig } from './LeftCenterRightHeadCommon/index' 2 import { LeftCenterRightHeadCommonConfig } from './LeftCenterRightHeadCommon/index'
3 3
4 -export default [LeftCenterRightHeadConfig,LeftCenterRightHeadCommonConfig] 4 +export default [LeftCenterRightHeadConfig, LeftCenterRightHeadCommonConfig]
1 <template> 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 </template> 4 </template>
11 5
12 <script setup lang="ts"> 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,8 +150,6 @@ export enum PackagesCategoryEnum {
150 TABLES = 'Tables', 150 TABLES = 'Tables',
151 INFORMATIONS = 'Informations', 151 INFORMATIONS = 'Informations',
152 DECORATES = 'Decorates', 152 DECORATES = 'Decorates',
153 - // THINGS_KIT  
154 - COMPOSES = 'external/Composes',  
155 } 153 }
156 154
157 // 包分类名称 155 // 包分类名称
@@ -160,8 +158,6 @@ export enum PackagesCategoryName { @@ -160,8 +158,6 @@ export enum PackagesCategoryName {
160 TABLES = '列表', 158 TABLES = '列表',
161 INFORMATIONS = '信息', 159 INFORMATIONS = '信息',
162 DECORATES = '小组件', 160 DECORATES = '小组件',
163 - // THINGS_KIT  
164 - COMPOSES='组合',  
165 } 161 }
166 162
167 // 获取组件 163 // 获取组件
@@ -176,6 +172,4 @@ export type PackagesType = { @@ -176,6 +172,4 @@ export type PackagesType = {
176 [PackagesCategoryEnum.INFORMATIONS]: ConfigType[] 172 [PackagesCategoryEnum.INFORMATIONS]: ConfigType[]
177 [PackagesCategoryEnum.TABLES]: ConfigType[] 173 [PackagesCategoryEnum.TABLES]: ConfigType[]
178 [PackagesCategoryEnum.DECORATES]: ConfigType[] 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,22 +2,19 @@ import { ChartList } from '@/packages/components/Charts/index'
2 import { DecorateList } from '@/packages/components/Decorates/index' 2 import { DecorateList } from '@/packages/components/Decorates/index'
3 import { InformationList } from '@/packages/components/Informations/index' 3 import { InformationList } from '@/packages/components/Informations/index'
4 import { TableList } from '@/packages/components/Tables/index' 4 import { TableList } from '@/packages/components/Tables/index'
5 -// THINGS_KIT  
6 -import { ComposesList } from '@/packages/components/external/Composes/index'  
7 import { PackagesCategoryEnum, PackagesType, ConfigType, FetchComFlagType } from '@/packages/index.d' 5 import { PackagesCategoryEnum, PackagesType, ConfigType, FetchComFlagType } from '@/packages/index.d'
  6 +import { useInjectLib } from './components/external/utils/useInjectLib'
8 7
9 const configModules = import.meta.globEager('./components/**/config.vue') 8 const configModules = import.meta.globEager('./components/**/config.vue')
10 const indexModules = import.meta.globEager('./components/**/index.vue') 9 const indexModules = import.meta.globEager('./components/**/index.vue')
11 const imagesModules = import.meta.globEager('../assets/images/chart/**') 10 const imagesModules = import.meta.globEager('../assets/images/chart/**')
12 11
13 // * 所有图表 12 // * 所有图表
14 -export let packagesList: PackagesType = { 13 +export const packagesList: PackagesType = {
15 [PackagesCategoryEnum.CHARTS]: ChartList, 14 [PackagesCategoryEnum.CHARTS]: ChartList,
16 [PackagesCategoryEnum.INFORMATIONS]: InformationList, 15 [PackagesCategoryEnum.INFORMATIONS]: InformationList,
17 [PackagesCategoryEnum.TABLES]: TableList, 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,3 +80,5 @@ export const fetchImages = async (targetData?: ConfigType) => {
83 } 80 }
84 return '' 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 import { useUserStoreWithOut } from "@/store/external/module/user"; 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 const whitePathList: string[] = [PageEnum.BASE_LOGIN]; 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 export function createPermissionGuard(router: Router) { 25 export function createPermissionGuard(router: Router) {
17 - const userStore = useUserStoreWithOut() 26 + const userStore = useUserStoreWithOut()
18 27
19 router.beforeEach((to, from, next) => { 28 router.beforeEach((to, from, next) => {
20 if (from.path === '/' && 29 if (from.path === '/' &&
@@ -22,7 +31,6 @@ export function createPermissionGuard(router: Router) { @@ -22,7 +31,6 @@ export function createPermissionGuard(router: Router) {
22 userStore.getUserInfo.homePath && 31 userStore.getUserInfo.homePath &&
23 userStore.getUserInfo.homePath !== PageEnum.BASE_HOME 32 userStore.getUserInfo.homePath !== PageEnum.BASE_HOME
24 ) { 33 ) {
25 - console.log(userStore.getUserInfo.homePath)  
26 next(userStore.getUserInfo.homePath) 34 next(userStore.getUserInfo.homePath)
27 return 35 return
28 } 36 }
@@ -33,7 +41,7 @@ export function createPermissionGuard(router: Router) { @@ -33,7 +41,7 @@ export function createPermissionGuard(router: Router) {
33 if (to.path === PageEnum.BASE_LOGIN && token) { 41 if (to.path === PageEnum.BASE_LOGIN && token) {
34 const isSessionTimeout = userStore.getSessionTimeout 42 const isSessionTimeout = userStore.getSessionTimeout
35 try { 43 try {
36 - if (!isSessionTimeout) { 44 + if (isSessionTimeout) {
37 next('/') 45 next('/')
38 } 46 }
39 } catch (error) { 47 } catch (error) {
@@ -41,8 +49,9 @@ export function createPermissionGuard(router: Router) { @@ -41,8 +49,9 @@ export function createPermissionGuard(router: Router) {
41 } 49 }
42 } 50 }
43 else { 51 else {
44 - if (isIndependenceMode) {  
45 - toIotPlatformLogin() 52 + if (!isAloneMode) {
  53 + console.log({ to, from })
  54 + toIotPlatformLogin({ to, from, next })
46 return 55 return
47 } 56 }
48 next() 57 next()
@@ -55,8 +64,9 @@ export function createPermissionGuard(router: Router) { @@ -55,8 +64,9 @@ export function createPermissionGuard(router: Router) {
55 path: PageEnum.BASE_LOGIN, 64 path: PageEnum.BASE_LOGIN,
56 redirect: true 65 redirect: true
57 } as RouteLocationRaw 66 } as RouteLocationRaw
58 - if (isIndependenceMode) {  
59 - toIotPlatformLogin() 67 + if (!isAloneMode) {
  68 + console.log({ to, from })
  69 + toIotPlatformLogin({ to, from, next })
60 return 70 return
61 } 71 }
62 next(redirectData) 72 next(redirectData)
@@ -2,7 +2,7 @@ import type { UserInfo, UserUpdateInfo } from '/#/external/store'; @@ -2,7 +2,7 @@ import type { UserInfo, UserUpdateInfo } from '/#/external/store';
2 import type { ErrorMessageMode } from '/#/external/axios'; 2 import type { ErrorMessageMode } from '/#/external/axios';
3 import { defineStore } from 'pinia'; 3 import { defineStore } from 'pinia';
4 import { pinia as store } from '@/store'; 4 import { pinia as store } from '@/store';
5 -import { RoleEnum } from '@/enums/external/roleEnum'; 5 +import { RoleEnum } from '@/enums/external/roleEnum';
6 import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, USER_INFO_KEY } from '@/enums/external/cacheEnum'; 6 import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, USER_INFO_KEY } from '@/enums/external/cacheEnum';
7 import { getAuthCache, setAuthCache } from '@/utils/external/auth'; 7 import { getAuthCache, setAuthCache } from '@/utils/external/auth';
8 import { 8 import {
@@ -16,7 +16,7 @@ import router from '@/router'; @@ -16,7 +16,7 @@ import router from '@/router';
16 import { createLocalStorage } from '@/utils/external/cache'; 16 import { createLocalStorage } from '@/utils/external/cache';
17 import { useI18n } from 'vue-i18n'; 17 import { useI18n } from 'vue-i18n';
18 import { useDialog } from 'naive-ui'; 18 import { useDialog } from 'naive-ui';
19 -import { PageEnum } from '@/enums/pageEnum'; 19 +import { PageEnum } from '@/enums/external/pageEnum';
20 20
21 interface UserState { 21 interface UserState {
22 platInfo: any; 22 platInfo: any;
@@ -177,9 +177,9 @@ export const useUserStore = defineStore({ @@ -177,9 +177,9 @@ export const useUserStore = defineStore({
177 this.setSessionTimeout(false); 177 this.setSessionTimeout(false);
178 setAuthCache(REFRESH_TOKEN_KEY, undefined); 178 setAuthCache(REFRESH_TOKEN_KEY, undefined);
179 this.setUserInfo(null); 179 this.setUserInfo(null);
180 - goLogin && router.push(PageEnum.BASE_LOGIN);  
181 window.localStorage.clear(); 180 window.localStorage.clear();
182 window.localStorage.removeItem('updateUserInfo'); 181 window.localStorage.removeItem('updateUserInfo');
  182 + goLogin && router.push(PageEnum.BASE_LOGIN);
183 }, 183 },
184 184
185 async doRefresh() { 185 async doRefresh() {
@@ -2,12 +2,13 @@ import type { GlobEnvConfig } from '/#/external/config'; @@ -2,12 +2,13 @@ import type { GlobEnvConfig } from '/#/external/config';
2 2
3 // import pkg from '../../../../package.json'; 3 // import pkg from '../../../../package.json';
4 import { getGlobalConfigName } from '../../../../build/external/vite/plugins/globConfig/getGlobConfigName'; 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 export function getCommonStoragePrefix() { 8 export function getCommonStoragePrefix() {
8 // const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig(); 9 // const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig();
9 const VITE_GLOB_APP_SHORT_NAME = 'undefined' 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 return `${VITE_GLOB_APP_SHORT_NAME}__${ENV.toUpperCase()}`.toUpperCase(); 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 +6,7 @@ import { PackagesCategoryEnum, PackagesCategoryName, PackagesType } from '@/pack
6 // 图表 6 // 图表
7 import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore' 7 import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore'
8 import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d' 8 import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
  9 +import { useInjectAside } from './external/useInjectAside'
9 // 图标 10 // 图标
10 const { BarChartIcon } = icon.ionicons5 11 const { BarChartIcon } = icon.ionicons5
11 const { TableSplitIcon, RoadmapIcon, SpellCheckIcon, GraphicalDataFlowIcon } = icon.carbon 12 const { TableSplitIcon, RoadmapIcon, SpellCheckIcon, GraphicalDataFlowIcon } = icon.carbon
@@ -20,7 +21,7 @@ export type MenuOptionsType = { @@ -20,7 +21,7 @@ export type MenuOptionsType = {
20 21
21 const { getPackagesList } = usePackagesStore() 22 const { getPackagesList } = usePackagesStore()
22 const menuOptions: MenuOptionsType[] = [] 23 const menuOptions: MenuOptionsType[] = []
23 -// THINGS_KIT 24 +
24 const packagesListObj = { 25 const packagesListObj = {
25 [PackagesCategoryEnum.CHARTS]: { 26 [PackagesCategoryEnum.CHARTS]: {
26 icon: renderIcon(RoadmapIcon), 27 icon: renderIcon(RoadmapIcon),
@@ -37,13 +38,12 @@ const packagesListObj = { @@ -37,13 +38,12 @@ const packagesListObj = {
37 [PackagesCategoryEnum.DECORATES]: { 38 [PackagesCategoryEnum.DECORATES]: {
38 icon: renderIcon(GraphicalDataFlowIcon), 39 icon: renderIcon(GraphicalDataFlowIcon),
39 label: PackagesCategoryName.DECORATES 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 const handlePackagesList = () => { 48 const handlePackagesList = () => {
49 for (const val in getPackagesList) { 49 for (const val in getPackagesList) {
1 <template> 1 <template>
2 <div class="go-items-list"> 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 <n-grid-item v-for="(item, index) in list" :key="item.id"> 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 </n-grid-item> 7 </n-grid-item>
17 </n-grid> 8 </n-grid>
18 <div class="list-pagination"> 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 </div> 11 </div>
25 </div> 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 </template> 15 </template>
34 16
35 <script setup lang="ts"> 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 // THINGS_KIT 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 // THINGS_KIT 32 // THINGS_KIT
51 const list = ref<ChartList>([]) 33 const list = ref<ChartList>([])
52 onMounted(async () => { 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 </script> 43 </script>
58 44
59 <style lang="scss" scoped> 45 <style lang="scss" scoped>
60 $contentHeight: 250px; 46 $contentHeight: 250px;
  47 +
61 @include go('items-list') { 48 @include go('items-list') {
62 display: flex; 49 display: flex;
63 flex-direction: column; 50 flex-direction: column;
64 justify-content: space-between; 51 justify-content: space-between;
65 min-height: calc(100vh - #{$--header-height} * 2 - 2px); 52 min-height: calc(100vh - #{$--header-height} * 2 - 2px);
  53 +
66 .list-content { 54 .list-content {
67 position: relative; 55 position: relative;
68 height: $contentHeight; 56 height: $contentHeight;
69 } 57 }
  58 +
70 .list-pagination { 59 .list-pagination {
71 display: flex; 60 display: flex;
72 justify-content: flex-end; 61 justify-content: flex-end;
@@ -12,10 +12,10 @@ declare interface GlobEnvConfig { @@ -12,10 +12,10 @@ declare interface GlobEnvConfig {
12 12
13 VITE_GLOB_APP_SHORT_NAME: string 13 VITE_GLOB_APP_SHORT_NAME: string
14 } 14 }
15 - 15 +
16 16
17 declare type GlobConfig = { 17 declare type GlobConfig = {
18 - 18 +
19 } 19 }
20 20
21 declare interface ViteEnv extends GlobEnvConfig { 21 declare interface ViteEnv extends GlobEnvConfig {
@@ -25,8 +25,6 @@ declare interface ViteEnv extends GlobEnvConfig { @@ -25,8 +25,6 @@ declare interface ViteEnv extends GlobEnvConfig {
25 VITE_DEV_PATH: string 25 VITE_DEV_PATH: string
26 // 生产地址 26 // 生产地址
27 VITE_PRO_PATH: string 27 VITE_PRO_PATH: string
28 - // iot platform proxy prefix  
29 - VITE_IOT_PLATFORM_PROXY_PREFIX: string  
30 } 28 }
31 29
32 interface ImportMetaEnv extends ViteEnv { 30 interface ImportMetaEnv extends ViteEnv {
@@ -17,7 +17,7 @@ export default defineConfig(({ mode, command }) => { @@ -17,7 +17,7 @@ export default defineConfig(({ mode, command }) => {
17 17
18 const root = process.cwd() 18 const root = process.cwd()
19 19
20 - const env = loadEnv(mode, root) 20 + const env = loadEnv(mode, root)
21 21
22 const viteEnv = parseEnv(env) 22 const viteEnv = parseEnv(env)
23 23
@@ -89,8 +89,8 @@ export default defineConfig(({ mode, command }) => { @@ -89,8 +89,8 @@ export default defineConfig(({ mode, command }) => {
89 chunkSizeWarningLimit: chunkSizeWarningLimit 89 chunkSizeWarningLimit: chunkSizeWarningLimit
90 }, 90 },
91 server: { 91 server: {
92 - port: 5555, 92 + port: viteEnv.VITE_DEV_PORT,
93 proxy: createProxy(viteEnv), 93 proxy: createProxy(viteEnv),
94 - }, 94 + },
95 } 95 }
96 }) 96 })
  1 +import { defineConfig } from 'vite-plugin-windicss';
  2 +export default defineConfig({})