build: 处理解决冲突产生的错误代码

This commit is contained in:
奔跑的面条 2024-03-15 09:19:22 +08:00
parent 85aa2d8283
commit 796c844df7

View File

@ -95,114 +95,4 @@ const comBtnList = computed(() => {
cloneList.shift()
return cloneList
})
</script>
<style lang="scss" scoped>
.align-center {
margin-top: -4px;
}
</style>
<template>
<n-space class="go-mt-0">
<n-button v-for="item in comBtnList" :key="item.title" :type="item.type" ghost @click="item.event">
<template #icon>
<component :is="item.icon"></component>
</template>
<span>{{ item.title }}</span>
</n-button>
</n-space>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { renderIcon, goDialog, fetchPathByName, routerTurnByPath, setSessionStorage, getLocalStorage } from '@/utils'
import { PreviewEnum } from '@/enums/pageEnum'
import { StorageEnum } from '@/enums/storageEnum'
import { useRoute } from 'vue-router'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { syncData } from '../../ContentEdit/components/EditTools/hooks/useSyncUpdate.hook'
import { icon } from '@/plugins'
import { cloneDeep } from 'lodash'
const { BrowsersOutlineIcon, SendIcon, AnalyticsIcon } = icon.ionicons5
const chartEditStore = useChartEditStore()
const routerParamsInfo = useRoute()
//
const previewHandle = () => {
const path = fetchPathByName(PreviewEnum.CHART_PREVIEW_NAME, 'href')
if (!path) return
const { id } = routerParamsInfo.params
// id
const previewId = typeof id === 'string' ? id : id[0]
const storageInfo = chartEditStore.getStorageInfo()
const sessionStorageInfo = getLocalStorage(StorageEnum.GO_CHART_STORAGE_LIST) || []
if (sessionStorageInfo?.length) {
const repeateIndex = sessionStorageInfo.findIndex((e: { id: string }) => e.id === previewId)
//
if (repeateIndex !== -1) {
sessionStorageInfo.splice(repeateIndex, 1, { id: previewId, ...storageInfo })
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, sessionStorageInfo)
} else {
sessionStorageInfo.push({
id: previewId,
...storageInfo
})
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, sessionStorageInfo)
}
} else {
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ id: previewId, ...storageInfo }])
}
//
routerTurnByPath(path, [previewId], undefined, true)
}
//
const sendHandle = () => {
goDialog({
message: '想体验发布功能,请前往查看: https://demo.mtruning.club/#/login。源码需切换到master-fetch 分支。',
positiveText: '了然',
closeNegativeText: true,
onPositiveCallback: () => {}
})
}
const btnList = [
{
select: true,
title: '同步内容',
type: 'primary',
icon: renderIcon(AnalyticsIcon),
event: syncData
},
{
select: true,
title: '预览',
icon: renderIcon(BrowsersOutlineIcon),
event: previewHandle
},
{
select: true,
title: '发布',
icon: renderIcon(SendIcon),
event: sendHandle
}
]
const comBtnList = computed(() => {
if (chartEditStore.getEditCanvas.isCodeEdit) {
return btnList
}
const cloneList = cloneDeep(btnList)
cloneList.shift()
return cloneList
})
</script>
<style lang="scss" scoped>
.align-center {
margin-top: -4px;
}
</style>
</script>