style: 初始化 禁用一些页面 跳转改为让宿主执行

This commit is contained in:
huanghao1412 2023-12-20 11:03:32 +08:00
parent 81e2e4784d
commit b9268d89ec
13 changed files with 87 additions and 77 deletions

6
.env
View File

@ -2,7 +2,9 @@
VITE_DEV_PORT = '8080' VITE_DEV_PORT = '8080'
# development path # development path
VITE_DEV_PATH = 'https://demo.mtruning.club' # VITE_DEV_PATH = 'https://demo.mtruning.club'
VITE_DEV_PATH = 'http://192.168.0.120:3001'
# production path # production path
VITE_PRO_PATH = 'https://demo.mtruning.club' # VITE_PRO_PATH = 'https://demo.mtruning.club'
VITE_PRO_PATH = 'http://192.168.0.120:3001'

View File

@ -109,11 +109,3 @@ export const http = (type?: RequestHttpEnum) => {
* build: 影响项目构建或依赖修改 * build: 影响项目构建或依赖修改
* style: 不影响程序逻辑的代码修改 * style: 不影响程序逻辑的代码修改
* chore: 不属于以上类型的其他类型(日常事务) * chore: 不属于以上类型的其他类型(日常事务)
## 交流
QQ 群1030129384
![QQ群](readme/go-view-qq.png)
![渲染海报](readme/logo-poster.png)

View File

@ -10,7 +10,7 @@
<slot name="ri-left"></slot> <slot name="ri-left"></slot>
</template> </template>
<template #ri-right> <template #ri-right>
<go-user-info></go-user-info> <!-- <go-user-info></go-user-info> -->
<slot name="ri-right"></slot> <slot name="ri-right"></slot>
</template> </template>
</layout-header> </layout-header>

View File

@ -28,7 +28,7 @@ const RootRoute: Array<RouteRecordRaw> = [
] ]
export const constantRouter: any[] = [LoginRoute, ...RootRoute, ReloadRoute]; export const constantRouter: any[] = [...RootRoute, ReloadRoute];
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(''), history: createWebHashHistory(''),

View File

@ -28,9 +28,9 @@ export function createRouterGuards(router: Router) {
} }
// @ts-ignore // @ts-ignore
if (!routerAllowList.includes(to.name) && !loginCheck()) { // if (!routerAllowList.includes(to.name) && !loginCheck()) {
next({ name: PageEnum.BASE_LOGIN_NAME }) // next({ name: PageEnum.BASE_LOGIN_NAME })
} // }
next() next()
}) })

View File

@ -62,12 +62,27 @@ export const routerTurnByPath = (
path: string, path: string,
query?: Array<string | number>, query?: Array<string | number>,
isReplace?: boolean, isReplace?: boolean,
windowOpen?: boolean windowOpen?: boolean,
isCallByParent?: boolean
) => { ) => {
let fullPath = '' let fullPath = ''
if (query?.length) { if (query?.length) {
fullPath = `${path}/${query.join('/')}` fullPath = `${path}/${query.join('/')}`
} }
if (isCallByParent) {
// 获取父页面的 window 对象
var parentWindow = window.parent;
const message = {
// 属于哪个页面
page: 'customLargeScreen',
// 属于什么类型
type: 'changeRouter',
url: fullPath,
openNew: windowOpen ? 1 : 0
}
parentWindow.postMessage(JSON.stringify(message), '*');
return
}
if (windowOpen) { if (windowOpen) {
return openNewWindow(fullPath) return openNewWindow(fullPath)
} }
@ -206,7 +221,7 @@ export const loginCheck = () => {
* * * *
* @returns * @returns
*/ */
export const previewPath = (id?: string | number) => { export const previewPath = (id?: string | number) => {
const { origin, pathname } = document.location const { origin, pathname } = document.location
const path = fetchPathByName(PreviewEnum.CHART_PREVIEW_NAME, 'href') const path = fetchPathByName(PreviewEnum.CHART_PREVIEW_NAME, 'href')
const previewPath = `${origin}${pathname}${path}/${id || fetchRouteParamsLocation()}` const previewPath = `${origin}${pathname}${path}/${id || fetchRouteParamsLocation()}`

View File

@ -152,7 +152,7 @@ const editHandle = () => {
if (!path) return if (!path) return
const id = fetchRouteParamsLocation() const id = fetchRouteParamsLocation()
updateToSession(id) updateToSession(id)
routerTurnByPath(path, [id], undefined, true) routerTurnByPath(path, [id], undefined, true, true)
}, 2000) }, 2000)
} }

View File

@ -117,7 +117,7 @@ const previewHandle = () => {
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ id: previewId, ...storageInfo }]) setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ id: previewId, ...storageInfo }])
} }
// //
routerTurnByPath(path, [previewId], undefined, true) routerTurnByPath(path, [previewId], undefined, true, true)
} }
// //

View File

@ -102,7 +102,7 @@ function importJSON() {
} }
// //
window.opener.addEventListener(SavePageEnum.CHART, (e: any) => { window?.opener?.addEventListener(SavePageEnum.CHART, (e: any) => {
window['$message'].success('正在进行更新...') window['$message'].success('正在进行更新...')
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [e.detail]) setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [e.detail])
content.value = JSONStringify(e.detail) content.value = JSONStringify(e.detail)

View File

@ -27,16 +27,16 @@
import { ProjectLayoutSider } from './layout/components/ProjectLayoutSider' import { ProjectLayoutSider } from './layout/components/ProjectLayoutSider'
import { LayoutHeaderPro } from '@/layout/components/LayoutHeaderPro' import { LayoutHeaderPro } from '@/layout/components/LayoutHeaderPro'
import { LayoutTransitionMain } from '@/layout/components/LayoutTransitionMain/index' import { LayoutTransitionMain } from '@/layout/components/LayoutTransitionMain/index'
import { goDialog } from '@/utils' // import { goDialog } from '@/utils'
// // //
goDialog({ // goDialog({
message: '不要在官方后端上发布任何私密数据,任何人都看得到并进行删除!!!!', // message: '',
isMaskClosable: true, // isMaskClosable: true,
closeNegativeText: true, // closeNegativeText: true,
transformOrigin: 'center', // transformOrigin: 'center',
onPositiveCallback: () => {} // onPositiveCallback: () => {}
}) // })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -23,7 +23,7 @@ export const useModalDataInit = () => {
const editHandle = (cardData: Chartype) => { const editHandle = (cardData: Chartype) => {
if (!cardData) return if (!cardData) return
const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href') const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href')
routerTurnByPath(path, [cardData.id], undefined, true) routerTurnByPath(path, [cardData.id], undefined, true, true)
} }
// 预览处理 // 预览处理

View File

@ -26,7 +26,8 @@
<n-text>{{ $t('global.doc') }}</n-text> <n-text>{{ $t('global.doc') }}</n-text>
</n-button> </n-button>
<n-tooltip v-if="collapsed" placement="right" trigger="hover"> <!-- 官方地址 -->
<!-- <n-tooltip v-if="collapsed" placement="right" trigger="hover">
<template #trigger> <template #trigger>
<n-button secondary @click="handleDoc"> <n-button secondary @click="handleDoc">
<template #icon> <template #icon>
@ -48,7 +49,7 @@
</n-icon> </n-icon>
</template> </template>
<n-text v-show="!collapsed">{{ $t('global.code_addr') }}</n-text> <n-text v-show="!collapsed">{{ $t('global.code_addr') }}</n-text>
</n-button> </n-button> -->
</n-space> </n-space>
</div> </div>
</template> </template>

View File

@ -100,7 +100,7 @@ const btnHandle = async (key: string) => {
const { id } = res.data const { id } = res.data
const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href') const path = fetchPathByName(ChartEnum.CHART_HOME_NAME, 'href')
routerTurnByPath(path, [id], undefined, true) routerTurnByPath(path, [id], undefined, true, true)
closeHandle() closeHandle()
} }
} catch (error) { } catch (error) {