mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 修改绘制界面样式,新增返回首页按钮
This commit is contained in:
+31
-5
@@ -1,7 +1,9 @@
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
import { ErrorPageNameMap, PageEnum } from '@/enums/pageEnum'
|
||||
import router from '@/router'
|
||||
import { docPath, giteeSourceCodePath } from '@/settings/pathConst'
|
||||
import { goDialog } from '@/utils/plugin'
|
||||
|
||||
/**
|
||||
* * 根据名字跳转路由
|
||||
@@ -21,12 +23,12 @@ export const routerTurnByName = (
|
||||
}
|
||||
if (isReplace) {
|
||||
router.replace({
|
||||
name: pageName
|
||||
name: pageName,
|
||||
})
|
||||
return
|
||||
}
|
||||
router.push({
|
||||
name: pageName
|
||||
name: pageName,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,7 +39,7 @@ export const routerTurnByName = (
|
||||
*/
|
||||
export const fetchPathByName = (pageName: string, p?: string) => {
|
||||
const pathData = router.resolve({
|
||||
name: pageName
|
||||
name: pageName,
|
||||
})
|
||||
return p ? (pathData as any)[p] : pathData
|
||||
}
|
||||
@@ -65,12 +67,12 @@ export const routerTurnByPath = (
|
||||
}
|
||||
if (isReplace) {
|
||||
router.replace({
|
||||
path: fullPath
|
||||
path: fullPath,
|
||||
})
|
||||
return
|
||||
}
|
||||
router.push({
|
||||
path: fullPath
|
||||
path: fullPath,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -123,3 +125,27 @@ export const openDoc = () => {
|
||||
export const openGiteeSourceCode = () => {
|
||||
openNewWindow(giteeSourceCodePath)
|
||||
}
|
||||
|
||||
/**
|
||||
* * 获取当前路由下的参数
|
||||
* @returns object
|
||||
*/
|
||||
export const fetchRouteParams = () => {
|
||||
const route = useRoute()
|
||||
return route.params
|
||||
}
|
||||
|
||||
/**
|
||||
* * 是否需要确认
|
||||
* @param confirm
|
||||
*/
|
||||
export const goHome = (confirm?: boolean, message?: string) => {
|
||||
if (confirm) {
|
||||
goDialog({
|
||||
message,
|
||||
onPositiveCallback: () => {
|
||||
routerTurnByName(PageEnum.BASE_HOME_NAME)
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -7,16 +7,16 @@ import { renderIcon } from '@/utils'
|
||||
|
||||
/**
|
||||
* * render 对话框
|
||||
* @param { Function } dialogFn dialog函数,暂时必须从页面传过来
|
||||
* @param { Object} params 配置参数
|
||||
* @param { Function } dialogFn 函数
|
||||
*/
|
||||
export const goDialog = (
|
||||
params: {
|
||||
// 基本
|
||||
type: DialogEnum
|
||||
type?: DialogEnum
|
||||
message?: string
|
||||
// 回调
|
||||
onPositiveCallback?: Function
|
||||
onPositiveCallback: Function
|
||||
onNegativeCallback?: Function
|
||||
// 异步
|
||||
promise?: boolean
|
||||
@@ -56,12 +56,13 @@ export const goDialog = (
|
||||
}
|
||||
}
|
||||
|
||||
const d: DialogReactive = (typeObj as any)[type]['fn']({
|
||||
const d: DialogReactive = (typeObj as any)[type || DialogEnum.warning]['fn']({
|
||||
title: '提示',
|
||||
icon: renderIcon(InformationCircleIcon, { size: dialogIconSize }),
|
||||
content: (typeObj as any)[type]['message'],
|
||||
content: (typeObj as any)[type || DialogEnum.warning]['message'],
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
// 是否通过遮罩关闭
|
||||
maskClosable: maskClosable,
|
||||
onPositiveClick: async () => {
|
||||
// 执行异步
|
||||
|
||||
+8
-3
@@ -55,6 +55,12 @@ export const requireFallbackImg = (path?: string, name?: string) => {
|
||||
).href
|
||||
}
|
||||
|
||||
/**
|
||||
* 全屏操作函数
|
||||
* @param isFullscreen
|
||||
* @param isEnabled
|
||||
* @returns
|
||||
*/
|
||||
export const screenfullFn = (isFullscreen?: boolean, isEnabled?: boolean) => {
|
||||
// 是否是全屏
|
||||
if (isFullscreen) return screenfull.isFullscreen
|
||||
@@ -72,12 +78,11 @@ export const screenfullFn = (isFullscreen?: boolean, isEnabled?: boolean) => {
|
||||
|
||||
/**
|
||||
* * 挂载监听
|
||||
* @returns url
|
||||
*/
|
||||
export const goAddEventListener = <K extends keyof WindowEventMap>(
|
||||
target: EventTarget,
|
||||
type: K,
|
||||
listener: EventListenerOrEventListenerObject,
|
||||
listener: any,
|
||||
options?: boolean | AddEventListenerOptions | undefined
|
||||
) => {
|
||||
if (!target) return
|
||||
@@ -90,9 +95,9 @@ export const goAddEventListener = <K extends keyof WindowEventMap>(
|
||||
options
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* * 卸载监听
|
||||
* @returns url
|
||||
*/
|
||||
export const goRemoveEventListener = <K extends keyof WindowEventMap>(
|
||||
target: EventTarget,
|
||||
|
||||
Reference in New Issue
Block a user