mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 22:12:11 +08:00
style: 初始化 禁用一些页面 跳转改为让宿主执行
This commit is contained in:
parent
81e2e4784d
commit
b9268d89ec
6
.env
6
.env
@ -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'
|
||||||
|
84
README.md
84
README.md
@ -37,61 +37,61 @@ import axiosInstance from './axios'
|
|||||||
import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum'
|
import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum'
|
||||||
|
|
||||||
export const get = (url: string, params?: object) => {
|
export const get = (url: string, params?: object) => {
|
||||||
return axiosInstance({
|
return axiosInstance({
|
||||||
url: url,
|
url: url,
|
||||||
method: RequestHttpEnum.GET,
|
method: RequestHttpEnum.GET,
|
||||||
params: params,
|
params: params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const post = (url: string, data?: object, headersType?: string) => {
|
export const post = (url: string, data?: object, headersType?: string) => {
|
||||||
return axiosInstance({
|
return axiosInstance({
|
||||||
url: url,
|
url: url,
|
||||||
method: RequestHttpEnum.POST,
|
method: RequestHttpEnum.POST,
|
||||||
data: data,
|
data: data,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const put = (url: string, data?: object, headersType?: string) => {
|
export const put = (url: string, data?: object, headersType?: string) => {
|
||||||
return axiosInstance({
|
return axiosInstance({
|
||||||
url: url,
|
url: url,
|
||||||
method: RequestHttpEnum.PUT,
|
method: RequestHttpEnum.PUT,
|
||||||
data: data,
|
data: data,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': headersType || ContentTypeEnum.JSON
|
'Content-Type': headersType || ContentTypeEnum.JSON
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const del = (url: string, params?: object) => {
|
export const del = (url: string, params?: object) => {
|
||||||
return axiosInstance({
|
return axiosInstance({
|
||||||
url: url,
|
url: url,
|
||||||
method: RequestHttpEnum.DELETE,
|
method: RequestHttpEnum.DELETE,
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取请求函数,默认get
|
// 获取请求函数,默认get
|
||||||
export const http = (type?: RequestHttpEnum) => {
|
export const http = (type?: RequestHttpEnum) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RequestHttpEnum.GET:
|
case RequestHttpEnum.GET:
|
||||||
return get
|
return get
|
||||||
|
|
||||||
case RequestHttpEnum.POST:
|
case RequestHttpEnum.POST:
|
||||||
return post
|
return post
|
||||||
|
|
||||||
case RequestHttpEnum.PUT:
|
case RequestHttpEnum.PUT:
|
||||||
return put
|
return put
|
||||||
|
|
||||||
case RequestHttpEnum.DELETE:
|
case RequestHttpEnum.DELETE:
|
||||||
return del
|
return del
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return get
|
return get
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -109,11 +109,3 @@ export const http = (type?: RequestHttpEnum) => {
|
|||||||
* build: 影响项目构建或依赖修改
|
* build: 影响项目构建或依赖修改
|
||||||
* style: 不影响程序逻辑的代码修改
|
* style: 不影响程序逻辑的代码修改
|
||||||
* chore: 不属于以上类型的其他类型(日常事务)
|
* chore: 不属于以上类型的其他类型(日常事务)
|
||||||
|
|
||||||
## 交流
|
|
||||||
|
|
||||||
QQ 群:1030129384
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
@ -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>
|
||||||
|
@ -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(''),
|
||||||
|
@ -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()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -44,4 +44,4 @@ export function createRouterGuards(router: Router) {
|
|||||||
router.onError((error) => {
|
router.onError((error) => {
|
||||||
console.log(error, '路由错误');
|
console.log(error, '路由错误');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -59,15 +59,30 @@ export const fetchPathByName = (pageName: string, p?: string) => {
|
|||||||
* @param windowOpen
|
* @param windowOpen
|
||||||
*/
|
*/
|
||||||
export const routerTurnByPath = (
|
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)
|
||||||
}
|
}
|
||||||
@ -204,11 +219,11 @@ 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()}`
|
||||||
return previewPath
|
return previewPath
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模态弹窗
|
// 模态弹窗
|
||||||
|
@ -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)
|
||||||
|
@ -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>
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 预览处理
|
// 预览处理
|
||||||
|
@ -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>
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user