feat: 新增tab名称跟随项目名称
This commit is contained in:
parent
13467e569f
commit
eae6de24c6
@ -48,6 +48,7 @@ export type EditCanvasType = {
|
|||||||
|
|
||||||
// 滤镜/背景色/宽高主题等
|
// 滤镜/背景色/宽高主题等
|
||||||
export enum EditCanvasConfigEnum {
|
export enum EditCanvasConfigEnum {
|
||||||
|
PROJECT_NAME = 'projectName',
|
||||||
WIDTH = 'width',
|
WIDTH = 'width',
|
||||||
HEIGHT = 'height',
|
HEIGHT = 'height',
|
||||||
CHART_THEME_COLOR = 'chartThemeColor',
|
CHART_THEME_COLOR = 'chartThemeColor',
|
||||||
@ -78,6 +79,8 @@ export interface EditCanvasConfigType {
|
|||||||
[FilterEnum.SKEW_X]: number
|
[FilterEnum.SKEW_X]: number
|
||||||
[FilterEnum.SKEW_Y]: number
|
[FilterEnum.SKEW_Y]: number
|
||||||
[FilterEnum.BLEND_MODE]: string
|
[FilterEnum.BLEND_MODE]: string
|
||||||
|
// 大屏名称
|
||||||
|
[EditCanvasConfigEnum.PROJECT_NAME]?: string
|
||||||
// 大屏宽度
|
// 大屏宽度
|
||||||
[EditCanvasConfigEnum.WIDTH]: number
|
[EditCanvasConfigEnum.WIDTH]: number
|
||||||
// 大屏高度
|
// 大屏高度
|
||||||
|
@ -75,6 +75,8 @@ export const useChartEditStore = defineStore({
|
|||||||
// -----------------------
|
// -----------------------
|
||||||
// 画布属性(需存储给后端)
|
// 画布属性(需存储给后端)
|
||||||
editCanvasConfig: {
|
editCanvasConfig: {
|
||||||
|
// 项目名称
|
||||||
|
projectName: undefined,
|
||||||
// 默认宽度
|
// 默认宽度
|
||||||
width: 1920,
|
width: 1920,
|
||||||
// 默认高度
|
// 默认高度
|
||||||
|
@ -325,3 +325,11 @@ export const JSONParse = (data: string) => {
|
|||||||
return v
|
return v
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 修改顶部标题
|
||||||
|
* @param title
|
||||||
|
*/
|
||||||
|
export const setTitle = (title?: string) => {
|
||||||
|
title && (document.title = title)
|
||||||
|
}
|
@ -30,9 +30,13 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, nextTick, computed } from 'vue'
|
import { ref, nextTick, computed } from 'vue'
|
||||||
import { fetchRouteParamsLocation } from '@/utils'
|
import { fetchRouteParamsLocation, setTitle } from '@/utils'
|
||||||
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
|
||||||
const { FishIcon } = icon.ionicons5
|
const { FishIcon } = icon.ionicons5
|
||||||
|
const chartEditStore = useChartEditStore()
|
||||||
|
|
||||||
const focus = ref<boolean>(false)
|
const focus = ref<boolean>(false)
|
||||||
const inputInstRef = ref(null)
|
const inputInstRef = ref(null)
|
||||||
@ -51,7 +55,10 @@ const title = ref<string>(fetchProhectInfoById() || '')
|
|||||||
const comTitle = computed(() => {
|
const comTitle = computed(() => {
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
title.value = title.value.replace(/\s/g, '')
|
title.value = title.value.replace(/\s/g, '')
|
||||||
return title.value.length ? title.value : '新项目'
|
const newTitle = title.value.length ? title.value : '新项目'
|
||||||
|
setTitle(`工作空间-${newTitle}`)
|
||||||
|
chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.PROJECT_NAME, newTitle)
|
||||||
|
return newTitle
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleFocus = () => {
|
const handleFocus = () => {
|
||||||
|
@ -38,7 +38,7 @@ import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
|||||||
import { SavePageEnum } from '@/enums/editPageEnum'
|
import { SavePageEnum } from '@/enums/editPageEnum'
|
||||||
import { getSessionStorageInfo } from '../preview/utils'
|
import { getSessionStorageInfo } from '../preview/utils'
|
||||||
import type { ChartEditStorageType } from '../preview/index.d'
|
import type { ChartEditStorageType } from '../preview/index.d'
|
||||||
import { setSessionStorage, JSONStringify, JSONParse } from '@/utils'
|
import { setSessionStorage, JSONStringify, JSONParse, setTitle } from '@/utils'
|
||||||
import { StorageEnum } from '@/enums/storageEnum'
|
import { StorageEnum } from '@/enums/storageEnum'
|
||||||
import { icon } from '@/plugins'
|
import { icon } from '@/plugins'
|
||||||
|
|
||||||
@ -48,6 +48,7 @@ const content = ref('')
|
|||||||
// 从sessionStorage 获取数据
|
// 从sessionStorage 获取数据
|
||||||
async function getDataBySession() {
|
async function getDataBySession() {
|
||||||
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
|
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
|
||||||
|
setTitle(`编辑-${localStorageInfo.editCanvasConfig.projectName}`)
|
||||||
content.value = JSONStringify(localStorageInfo)
|
content.value = JSONStringify(localStorageInfo)
|
||||||
}
|
}
|
||||||
setTimeout(getDataBySession)
|
setTimeout(getDataBySession)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { PreviewRenderList } from './components/PreviewRenderList'
|
import { PreviewRenderList } from './components/PreviewRenderList'
|
||||||
import { getFilterStyle } from '@/utils'
|
import { getFilterStyle, setTitle } from '@/utils'
|
||||||
import { getEditCanvasConfigStyle, getSessionStorageInfo } from './utils'
|
import { getEditCanvasConfigStyle, getSessionStorageInfo } from './utils'
|
||||||
import { useComInstall } from './hooks/useComInstall.hook'
|
import { useComInstall } from './hooks/useComInstall.hook'
|
||||||
import { useScale } from './hooks/useScale.hook'
|
import { useScale } from './hooks/useScale.hook'
|
||||||
@ -38,6 +38,7 @@ import { PreviewScaleEnum } from '@/enums/styleEnum'
|
|||||||
import type { ChartEditStorageType } from './index.d'
|
import type { ChartEditStorageType } from './index.d'
|
||||||
|
|
||||||
const localStorageInfo: ChartEditStorageType = getSessionStorageInfo() as ChartEditStorageType
|
const localStorageInfo: ChartEditStorageType = getSessionStorageInfo() as ChartEditStorageType
|
||||||
|
setTitle(`预览-${localStorageInfo.editCanvasConfig.projectName}`)
|
||||||
|
|
||||||
const previewRefStyle = computed(() => {
|
const previewRefStyle = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user