From c8c3279358e203fa307dda6f448c8fa50fdb032c Mon Sep 17 00:00:00 2001 From: EarlySummer <785383749@qq.com> Date: Wed, 4 Dec 2024 16:51:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=BC=80=E5=85=B3=20=E4=BF=AE=E5=A4=8D=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=BB=84=E4=BB=B6=E8=87=AA=E5=AE=9A=E4=B9=89=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E6=A0=B7=E5=BC=8F=20=E5=A2=9E=E5=8A=A0=E7=88=B6?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=AE=B9=E5=99=A8ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 + .../Pages/MonacoEditor/EditorWorker.vue | 4 + .../Informations/Texts/TextCard/index.vue | 2 +- src/packages/index.d.ts | 7 +- src/packages/public/publicConfig.ts | 3 + src/router/index.ts | 2 +- src/router/router-guards.ts | 23 +- src/utils/router.ts | 2 + .../ChartStyleEnhance/css-validator.d.ts | 4 + .../components/ChartStyleEnhance/index.ts | 3 + .../components/ChartStyleEnhance/index.vue | 233 ++++++++++++++++++ .../components/ChartEvent/index.vue | 2 + src/views/login/index.vue | 15 +- .../components/PreviewRenderList/index.vue | 1 + src/views/preview/utils/storage.ts | 5 - 15 files changed, 281 insertions(+), 28 deletions(-) create mode 100644 src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/css-validator.d.ts create mode 100644 src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.ts create mode 100644 src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.vue diff --git a/.env b/.env index 53551f77..424b38e0 100644 --- a/.env +++ b/.env @@ -13,3 +13,6 @@ VITE_APP_TENANT_ENABLE=true # 验证码的开关 VITE_APP_CAPTCHA_ENABLE=true + +#默认路由开关 +VITE_ROUTER_DEFAULT=true \ No newline at end of file diff --git a/src/components/Pages/MonacoEditor/EditorWorker.vue b/src/components/Pages/MonacoEditor/EditorWorker.vue index a1689e68..6286102b 100644 --- a/src/components/Pages/MonacoEditor/EditorWorker.vue +++ b/src/components/Pages/MonacoEditor/EditorWorker.vue @@ -6,6 +6,7 @@ import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker' import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker' import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker' import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker' +import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker' self.MonacoEnvironment = { getWorker(workerId, label) { @@ -18,6 +19,9 @@ self.MonacoEnvironment = { if (label === 'html') { return new htmlWorker() } + if (label === 'css') { + return new cssWorker() + } return new editorWorker() } } diff --git a/src/packages/components/Informations/Texts/TextCard/index.vue b/src/packages/components/Informations/Texts/TextCard/index.vue index 81eed183..7b33b9a1 100644 --- a/src/packages/components/Informations/Texts/TextCard/index.vue +++ b/src/packages/components/Informations/Texts/TextCard/index.vue @@ -131,7 +131,7 @@ console.log('22222222222222222222223') // 滚动处理 const startScrollAnimation = () => { - const totalHeight = itemHeight.value * dataList.value.length; + const totalHeight = itemHeight.value * props.chartConfig.option.dataset.lenght; timer = setInterval(() => { console.log('滚动测试...') scrollY.value -= itemHeight.value; diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts index 888149cb..b7a8adec 100644 --- a/src/packages/index.d.ts +++ b/src/packages/index.d.ts @@ -100,7 +100,9 @@ export enum FilterEnum { //动画时长 CIRCULATE_PLAY_TIME = 'circulatePlayTime', //动画延迟时长 - CIRCULATE_DELAY_TIME = 'circulateDelayTime' + CIRCULATE_DELAY_TIME = 'circulateDelayTime', + //样式增强 + STYLE_ENHANCE= 'styleEnhance', } @@ -163,6 +165,9 @@ export interface PublicConfigType { // 动画延迟时长/秒 [FilterEnum.CIRCULATE_DELAY_TIME]: number, + + // 样式自定义增强 + [FilterEnum.STYLE_ENHANCE]: string, } preview?: { // 预览超出隐藏 diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts index f2885cad..d7afec85 100644 --- a/src/packages/public/publicConfig.ts +++ b/src/packages/public/publicConfig.ts @@ -89,6 +89,9 @@ export class PublicConfigClass implements PublicConfigType { circulatePlayTime:1, // 动画延迟时长/秒 circulateDelayTime:0, + //自定义样式增强 + styleEnhance:"", + } // 预览 diff --git a/src/router/index.ts b/src/router/index.ts index b58a14e0..c8977dda 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -28,7 +28,7 @@ const RootRoute: Array = [ ] -export const constantRouter: any[] = [LoginRoute, ...RootRoute, RedirectRoute, ReloadRoute]; +export const constantRouter: any[] = [LoginRoute, ...RootRoute, ReloadRoute]; const router = createRouter({ history: createWebHashHistory(''), diff --git a/src/router/router-guards.ts b/src/router/router-guards.ts index 70153352..853a1940 100644 --- a/src/router/router-guards.ts +++ b/src/router/router-guards.ts @@ -1,7 +1,7 @@ import { Router } from 'vue-router'; import { PageEnum, PreviewEnum } from '@/enums/pageEnum' import {loginCheck, setSessionStorage} from '@/utils' - +const viteRouter = import.meta.env.VITE_ROUTER_DEFAULT // 路由白名单 const routerAllowList = [ // 登录 @@ -32,17 +32,20 @@ export function createRouterGuards(router: Router) { // @ts-ignore console.log(!routerAllowList.includes(to.name), !loginCheck()) // @ts-ignore - if (!routerAllowList.includes(to.name) && !loginCheck()) { - console.log(to.fullPath,'存储临时跳回路径与查询ID') - if(PreviewEnum.CHART_PREVIEW_NAME === to.name){ - setSessionStorage('setRedirectPath','/chart/preview') - setSessionStorage('setRedirectPathId',to.params.id[0]) - } - console.log('test...login....') - next({ name: PageEnum.BASE_LOGIN_NAME }) - return + console.log('路由开关:',viteRouter==='false') + console.log('路由开关2:',viteRouter,!viteRouter,!!viteRouter) + console.log(!routerAllowList.includes(to.name),!loginCheck()) + if (!routerAllowList.includes(to.name)&&!loginCheck()) { + if(PreviewEnum.CHART_PREVIEW_NAME === to.name&& viteRouter==='false'){ + console.log(to.fullPath,'存储临时跳回路径与查询ID') + setSessionStorage('setRedirectPath','/chart/preview') + setSessionStorage('setRedirectPathId',to.params.id[0]) + } + console.log('test...login....') + next({ name: PageEnum.BASE_LOGIN_NAME }) } console.log('test。。。next。。。') + console.log("现地址",to.path,"重定向前地址",to.redirectedFrom?.path) next() }) diff --git a/src/utils/router.ts b/src/utils/router.ts index e0f2fe44..2603b8d2 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -73,9 +73,11 @@ export const routerTurnByPath = ( if (query?.length) { fullPath = `${path}/${query.join('/')}` } + if (windowOpen) { return openNewWindow(fullPath) } + if (isReplace) { router.replace({ path: fullPath, diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/css-validator.d.ts b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/css-validator.d.ts new file mode 100644 index 00000000..dda114b1 --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/css-validator.d.ts @@ -0,0 +1,4 @@ +declare module 'css-validator' { + export function validateCSS(css: string, callback?: (isValid: boolean) => void): void; + export function validateCSSAsync(css: string): Promise; +} \ No newline at end of file diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.ts b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.ts new file mode 100644 index 00000000..d856fcb5 --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.ts @@ -0,0 +1,3 @@ +import ChartStyleEnhance from './index.vue' + +export { ChartStyleEnhance } diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.vue new file mode 100644 index 00000000..493e50d4 --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartStyleEnhance/index.vue @@ -0,0 +1,233 @@ + + + + diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue index 6e632cc5..4dc48290 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue @@ -8,6 +8,7 @@ + @@ -16,6 +17,7 @@ import { ref } from 'vue' import { ChartEventInteraction } from './components/ChartEventInteraction' import { ChartEventAdvancedHandle } from './components/ChartEventAdvancedHandle' import { ChartEventBaseHandle } from './components/ChartEventBaseHandle' +import { ChartStyleEnhance } from './components/ChartStyleEnhance' import { useTargetData } from '../hooks/useTargetData.hook' const { targetData } = useTargetData() diff --git a/src/views/login/index.vue b/src/views/login/index.vue index f661414e..11c53ef2 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -171,7 +171,7 @@ const autoLogin = ref(true) const show = ref(false) const showBg = ref(false) const systemStore = useSystemStore() - +const viteRouter = import.meta.env.VITE_ROUTER_DEFAULT const t = window['$t'] const formInline = reactive({ @@ -302,23 +302,18 @@ const handleSubmit = async (params: any) => { window['$message'].success(t('login.login_success')) - const redirectPath = getSessionStorage('setRedirectPath') + const redirectPath:string = getSessionStorage('setRedirectPath') as string const redirectPathId = getSessionStorage('setRedirectPathId') console.log(redirectPath) console.log(redirectPathId) - if(redirectPath){ + if(redirectPath && viteRouter==='false'){ + console.log("重定向缓存页面",redirectPath,viteRouter,!viteRouter,!!viteRouter) routerTurnByPath(redirectPath,[redirectPathId],true,false) }else{ - if(getSessionStorage('setRedirectPath')) { - console.log("重定向到登录页") - routerTurnByPath(getSessionStorage('setRedirectPath')); - }else{ console.log("重定向到首页》》》") routerTurnByName(PageEnum.BASE_HOME_NAME, true); - } - } - + // routerTurnByName(PageEnum.BASE_HOME_NAME, true) } loading.value = false } else { diff --git a/src/views/preview/components/PreviewRenderList/index.vue b/src/views/preview/components/PreviewRenderList/index.vue index b2f54e46..36bac9a9 100644 --- a/src/views/preview/components/PreviewRenderList/index.vue +++ b/src/views/preview/components/PreviewRenderList/index.vue @@ -1,6 +1,7 @@