Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenSun1
vue-vben-admin
提交
ecfb702b
V
vue-vben-admin
项目概览
ChenSun1
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ecfb702b
编写于
11月 12, 2020
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: type error
上级
21e0548e
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
83 addition
and
73 deletion
+83
-73
build/script/preserve.ts
build/script/preserve.ts
+1
-1
build/vite/plugin/dynamicImport/index.ts
build/vite/plugin/dynamicImport/index.ts
+1
-2
src/App.vue
src/App.vue
+1
-1
src/components/ContextMenu/index.ts
src/components/ContextMenu/index.ts
+5
-5
src/components/Dropdown/Dropdown.tsx
src/components/Dropdown/Dropdown.tsx
+1
-0
src/components/Excel/src/ImportExcel.vue
src/components/Excel/src/ImportExcel.vue
+1
-1
src/components/Form/src/FormItem.tsx
src/components/Form/src/FormItem.tsx
+2
-2
src/components/Form/src/props.ts
src/components/Form/src/props.ts
+1
-1
src/components/Menu/src/BasicMenu.tsx
src/components/Menu/src/BasicMenu.tsx
+2
-2
src/components/Scrollbar/src/util.ts
src/components/Scrollbar/src/util.ts
+1
-0
src/components/Table/src/components/TableAction.tsx
src/components/Table/src/components/TableAction.tsx
+9
-2
src/components/Table/src/const.ts
src/components/Table/src/const.ts
+1
-1
src/components/Table/src/props.ts
src/components/Table/src/props.ts
+1
-1
src/components/Table/src/types/table.ts
src/components/Table/src/types/table.ts
+2
-2
src/hooks/event/useEvent.ts
src/hooks/event/useEvent.ts
+1
-1
src/hooks/event/useWindowSize.ts
src/hooks/event/useWindowSize.ts
+0
-2
src/hooks/web/useLocalStorage.ts
src/hooks/web/useLocalStorage.ts
+1
-1
src/hooks/web/useMessage.tsx
src/hooks/web/useMessage.tsx
+1
-1
src/hooks/web/usePermission.ts
src/hooks/web/usePermission.ts
+1
-1
src/hooks/web/useSessionStorage.ts
src/hooks/web/useSessionStorage.ts
+1
-1
src/layouts/default/header/LayoutHeader.tsx
src/layouts/default/header/LayoutHeader.tsx
+1
-1
src/layouts/default/header/LockActionItem.tsx
src/layouts/default/header/LockActionItem.tsx
+1
-1
src/main.ts
src/main.ts
+2
-2
src/router/menus/index.ts
src/router/menus/index.ts
+1
-3
src/router/types.d.ts
src/router/types.d.ts
+5
-3
src/setup/directives/permission.ts
src/setup/directives/permission.ts
+1
-1
src/store/modules/permission.ts
src/store/modules/permission.ts
+1
-1
src/useApp.ts
src/useApp.ts
+5
-4
src/utils/color.ts
src/utils/color.ts
+3
-3
src/utils/env.ts
src/utils/env.ts
+0
-4
src/utils/helper/menuHelper.ts
src/utils/helper/menuHelper.ts
+2
-2
src/utils/helper/persistent.ts
src/utils/helper/persistent.ts
+1
-1
src/utils/helper/routeHelper.ts
src/utils/helper/routeHelper.ts
+22
-16
src/utils/helper/tsxHelper.tsx
src/utils/helper/tsxHelper.tsx
+1
-0
src/utils/http/axios/Axios.ts
src/utils/http/axios/Axios.ts
+1
-1
src/utils/storage/Storage.ts
src/utils/storage/Storage.ts
+1
-1
src/utils/uuid.ts
src/utils/uuid.ts
+1
-1
未找到文件。
build/script/preserve.ts
浏览文件 @
ecfb702b
...
...
@@ -25,7 +25,7 @@ export async function runPreserve() {
process
.
exit
(
1
);
}
fs
.
mkdirp
(
resolve
(
'
build/.cache
'
));
await
fs
.
mkdirp
(
resolve
(
'
build/.cache
'
));
function
checkPkgUpdate
()
{
const
pkg
=
require
(
'
../../package.json
'
);
const
{
dependencies
,
devDependencies
}
=
pkg
;
...
...
build/vite/plugin/dynamicImport/index.ts
浏览文件 @
ecfb702b
...
...
@@ -33,7 +33,7 @@ const dynamicImportTransform = function (env: any = {}): Transform {
try
{
const
files
=
glob
.
sync
(
'
src/views/**/**.{vue,tsx}
'
,
{
cwd
:
process
.
cwd
()
});
const
_code
=
`
return
`
export default function (id) {
switch (id) {
${
files
...
...
@@ -47,7 +47,6 @@ const dynamicImportTransform = function (env: any = {}): Transform {
}
}\n\n
`
;
return
_code
;
}
catch
(
error
)
{
console
.
error
(
error
);
return
code
;
...
...
src/App.vue
浏览文件 @
ecfb702b
<
template
>
<ConfigProvider
:locale=
"zhCN"
:transform
CellT
ext=
"transformCellText"
v-bind=
"lockOn"
>
<ConfigProvider
:locale=
"zhCN"
:transform
-cell-t
ext=
"transformCellText"
v-bind=
"lockOn"
>
<router-view
/>
</ConfigProvider>
</
template
>
...
...
src/components/ContextMenu/index.ts
浏览文件 @
ecfb702b
...
...
@@ -3,10 +3,10 @@ import { isClient } from '/@/utils/is';
import
{
Options
,
Props
}
from
'
./src/types
'
;
import
{
createVNode
,
render
}
from
'
vue
'
;
const
menuManager
:
{
dom
s
:
Element
[];
dom
List
:
Element
[];
resolve
:
Fn
;
}
=
{
dom
s
:
[],
dom
List
:
[],
resolve
:
()
=>
{},
};
export
const
createContextMenu
=
function
(
options
:
Options
)
{
...
...
@@ -32,9 +32,9 @@ export const createContextMenu = function (options: Options) {
const
bodyClick
=
function
()
{
menuManager
.
resolve
(
''
);
};
menuManager
.
dom
s
.
push
(
container
);
menuManager
.
dom
List
.
push
(
container
);
const
remove
=
function
()
{
menuManager
.
dom
s
.
forEach
((
dom
:
Element
)
=>
{
menuManager
.
dom
List
.
forEach
((
dom
:
Element
)
=>
{
try
{
document
.
body
.
removeChild
(
dom
);
}
catch
(
error
)
{}
...
...
@@ -55,7 +55,7 @@ export const createContextMenu = function (options: Options) {
export
const
unMountedContextMenu
=
function
()
{
if
(
menuManager
)
{
menuManager
.
resolve
(
''
);
menuManager
.
dom
s
=
[];
menuManager
.
dom
List
=
[];
}
};
...
...
src/components/Dropdown/Dropdown.tsx
浏览文件 @
ecfb702b
...
...
@@ -34,6 +34,7 @@ export default defineComponent({
</>
)
}
</
Menu
.
Item
>,
// @ts-ignore
divider
&&
<
Menu
.
Divider
key
=
{
`d-
${
index
}
`
}
/>,
];
})
}
...
...
src/components/Excel/src/ImportExcel.vue
浏览文件 @
ecfb702b
...
...
@@ -96,7 +96,7 @@
// fix can't select the same excel
inputRefDom
.
value
=
''
;
}
readerData
(
rawFile
);
await
readerData
(
rawFile
);
}
/**
...
...
src/components/Form/src/FormItem.tsx
浏览文件 @
ecfb702b
...
...
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
import
type
{
FormProps
}
from
'
./types/form
'
;
import
type
{
FormSchema
}
from
'
./types/form
'
;
import
type
{
ValidationRule
}
from
'
ant-design-vue/lib/form/Form
'
;
import
type
{
TableActionType
}
from
'
../../Table/src/types/t
able
'
;
import
type
{
TableActionType
}
from
'
/@/components/T
able
'
;
import
{
defineComponent
,
computed
,
unref
,
toRef
}
from
'
vue
'
;
import
{
Form
,
Col
}
from
'
ant-design-vue
'
;
...
...
@@ -16,7 +16,7 @@ import { upperFirst, cloneDeep } from 'lodash-es';
import
{
useItemLabelWidth
}
from
'
./hooks/useLabelWidth
'
;
import
{
ComponentType
}
from
'
./types
'
;
import
{
isNumber
}
from
'
../../..
/utils/is
'
;
import
{
isNumber
}
from
'
/@
/utils/is
'
;
export
default
defineComponent
({
name
:
'
BasicFormItem
'
,
...
...
src/components/Form/src/props.ts
浏览文件 @
ecfb702b
import
type
{
FieldMapToTime
,
FormSchema
}
from
'
./types/form
'
;
import
type
{
PropType
}
from
'
vue
'
;
import
type
{
ColEx
}
from
'
./types
'
;
import
{
TableActionType
}
from
'
../../Table/src/types/t
able
'
;
import
{
TableActionType
}
from
'
/@/components/T
able
'
;
export
const
basicProps
=
{
model
:
{
...
...
src/components/Menu/src/BasicMenu.tsx
浏览文件 @
ecfb702b
...
...
@@ -6,7 +6,7 @@ import { Menu } from 'ant-design-vue';
import
SearchInput
from
'
./SearchInput.vue
'
;
import
MenuContent
from
'
./MenuContent
'
;
import
{
MenuModeEnum
,
MenuTypeEnum
}
from
'
/@/enums/menuEnum
'
;
import
{
MenuModeEnum
,
MenuT
hemeEnum
,
MenuT
ypeEnum
}
from
'
/@/enums/menuEnum
'
;
import
{
menuStore
}
from
'
/@/store/modules/menu
'
;
import
{
appStore
}
from
'
/@/store/modules/app
'
;
...
...
@@ -255,7 +255,7 @@ export default defineComponent({
{
getSlot
(
slots
,
'
header
'
)
}
<
SearchInput
class
=
{
!
props
.
search
?
'
hidden
'
:
''
}
theme
=
{
props
.
theme
}
theme
=
{
props
.
theme
as
MenuThemeEnum
}
onChange
=
{
handleInputChange
}
onClick
=
{
handleInputClick
}
collapsed
=
{
getCollapsedState
}
...
...
src/components/Scrollbar/src/util.ts
浏览文件 @
ecfb702b
...
...
@@ -22,6 +22,7 @@ export const BAR_MAP: BarMap = {
},
};
// @ts-ignore
export
function
renderThumbStyle
({
move
,
size
,
bar
})
{
const
style
=
{}
as
any
;
const
translate
=
`translate
${
bar
.
axis
}
(
${
move
}
%)`
;
...
...
src/components/Table/src/components/TableAction.tsx
浏览文件 @
ecfb702b
...
...
@@ -2,7 +2,7 @@ import { defineComponent, PropType } from 'vue';
import
{
Dropdown
,
Menu
,
Popconfirm
}
from
'
ant-design-vue
'
;
import
Icon
from
'
/@/components/Icon/index
'
;
import
{
DownOutlined
}
from
'
@ant-design/icons-vue
'
;
import
{
ActionItem
}
from
'
../types/tableAction
'
;
import
{
ActionItem
}
from
'
/@/components/Table
'
;
import
Button
from
'
/@/components/Button/index.vue
'
;
const
prefixCls
=
'
basic-table-action
'
;
export
default
defineComponent
({
...
...
@@ -26,7 +26,14 @@ export default defineComponent({
function
renderButton
(
action
:
ActionItem
,
index
:
number
)
{
const
{
disabled
=
false
,
label
,
icon
,
color
=
''
,
type
=
'
link
'
}
=
action
;
const
button
=
(
<
Button
type
=
{
type
}
size
=
"small"
disabled
=
{
disabled
}
color
=
{
color
}
{
...
action
}
key
=
{
index
}
>
<
Button
type
=
{
type
as
any
}
size
=
"small"
disabled
=
{
disabled
}
color
=
{
color
}
{
...
action
}
key
=
{
index
}
>
{
()
=>
(
<>
{
label
}
...
...
src/components/Table/src/const.ts
浏览文件 @
ecfb702b
...
...
@@ -22,7 +22,7 @@ export const FETCH_SETTING = {
};
// 配置通用排序函数
export
function
DEFAULT_SORT_FN
(
sortInfo
:
SorterResult
<
any
>
)
{
export
function
DEFAULT_SORT_FN
(
sortInfo
:
SorterResult
)
{
const
{
field
,
order
}
=
sortInfo
;
return
{
// 传给后台的排序字段你
...
...
src/components/Table/src/props.ts
浏览文件 @
ecfb702b
...
...
@@ -8,7 +8,7 @@ import type {
TableCustomRecord
,
TableRowSelection
,
}
from
'
./types/table
'
;
import
type
{
FormProps
}
from
'
/@/components/Form
/index
'
;
import
type
{
FormProps
}
from
'
/@/components/Form
'
;
import
{
DEFAULT_SORT_FN
,
FETCH_SETTING
}
from
'
./const
'
;
// 注释看 types/table
...
...
src/components/Table/src/types/table.ts
浏览文件 @
ecfb702b
import
type
{
VNodeChild
}
from
'
vue
'
;
import
type
{
PaginationProps
}
from
'
./pagination
'
;
import
type
{
FormProps
}
from
'
/@/components/Form
/index
'
;
import
type
{
FormProps
}
from
'
/@/components/Form
'
;
import
type
{
ColumnProps
,
TableRowSelection
as
ITableRowSelection
,
...
...
@@ -125,7 +125,7 @@ export interface TableSetting {
export
interface
BasicTableProps
<
T
=
any
>
{
// 自定义排序方法
sortFn
?:
(
sortInfo
:
SorterResult
<
any
>
)
=>
any
;
sortFn
?:
(
sortInfo
:
SorterResult
)
=>
any
;
// 显示表格设置
showTableSetting
?:
boolean
;
tableSetting
?:
TableSetting
;
...
...
src/hooks/event/useEvent.ts
浏览文件 @
ecfb702b
...
...
@@ -41,7 +41,7 @@ export function useEvent({
const
removeWatch
=
watch
(
element
,
(
v
,
ov
,
cleanUp
)
=>
{
(
v
,
_
ov
,
cleanUp
)
=>
{
if
(
v
)
{
!
unref
(
isAddRef
)
&&
addEventListener
(
v
);
cleanUp
(()
=>
{
...
...
src/hooks/event/useWindowSize.ts
浏览文件 @
ecfb702b
import
type
{
Fn
}
from
'
./types
'
;
import
{
tryOnMounted
,
tryOnUnmounted
}
from
'
/@/utils/helper/vueHelper
'
;
import
{
ref
}
from
'
vue
'
;
...
...
src/hooks/web/useLocalStorage.ts
浏览文件 @
ecfb702b
import
{
createStorage
}
from
'
/@/utils/storage
/index
'
;
import
{
createStorage
}
from
'
/@/utils/storage
'
;
export
function
useLocalStorage
()
{
return
createStorage
(
localStorage
);
...
...
src/hooks/web/useMessage.tsx
浏览文件 @
ecfb702b
import
type
{
ModalFunc
,
ModalFuncProps
}
from
'
ant-design-vue/lib/modal/Modal
'
;
import
type
{
MessageApi
}
from
'
ant-design-vue/lib/message
/index
'
;
import
type
{
MessageApi
}
from
'
ant-design-vue/lib/message
'
;
import
type
{
VNodeTypes
,
CSSProperties
}
from
'
vue
'
;
import
{
Modal
,
message
as
Message
,
notification
}
from
'
ant-design-vue
'
;
...
...
src/hooks/web/usePermission.ts
浏览文件 @
ecfb702b
import
{
appStore
}
from
'
./../..
/store/modules/app
'
;
import
{
appStore
}
from
'
/@
/store/modules/app
'
;
import
{
permissionStore
}
from
'
/@/store/modules/permission
'
;
import
{
useTabs
}
from
'
./useTabs
'
;
import
{
RoleEnum
}
from
'
/@/enums/roleEnum
'
;
...
...
src/hooks/web/useSessionStorage.ts
浏览文件 @
ecfb702b
import
{
createStorage
}
from
'
/@/utils/storage
/index
'
;
import
{
createStorage
}
from
'
/@/utils/storage
'
;
export
function
useSessionStorage
()
{
return
createStorage
(
sessionStorage
);
...
...
src/layouts/default/header/LayoutHeader.tsx
浏览文件 @
ecfb702b
...
...
@@ -21,7 +21,7 @@ import { useFullscreen } from '/@/hooks/web/useFullScreen';
import
{
useTabs
}
from
'
/@/hooks/web/useTabs
'
;
import
{
useWindowSizeFn
}
from
'
/@/hooks/event/useWindowSize
'
;
import
{
useRouter
}
from
'
vue-router
'
;
import
{
useModal
}
from
'
/@/components/Modal
/index
'
;
import
{
useModal
}
from
'
/@/components/Modal
'
;
import
{
appStore
}
from
'
/@/store/modules/app
'
;
import
{
errorStore
}
from
'
/@/store/modules/error
'
;
...
...
src/layouts/default/header/LockActionItem.tsx
浏览文件 @
ecfb702b
...
...
@@ -54,7 +54,7 @@ export default defineComponent({
isLock
:
true
,
pwd
:
password
,
});
resetFields
();
await
resetFields
();
}
catch
(
error
)
{}
}
// 账号密码登录
...
...
src/main.ts
浏览文件 @
ecfb702b
...
...
@@ -3,8 +3,8 @@ import { createApp } from 'vue';
import
router
,
{
setupRouter
}
from
'
/@/router
'
;
import
{
setupStore
}
from
'
/@/store
'
;
import
{
setupAntd
}
from
'
/@/setup/ant-design-vue
'
;
import
{
setupErrorHandle
}
from
'
/@/setup/error-handle
/index
'
;
import
{
setupDirectives
}
from
'
/@/setup/directives
/index
'
;
import
{
setupErrorHandle
}
from
'
/@/setup/error-handle
'
;
import
{
setupDirectives
}
from
'
/@/setup/directives
'
;
import
{
isDevMode
,
isProdMode
,
isUseMock
}
from
'
/@/utils/env
'
;
import
{
setupProdMockServer
}
from
'
../mock/_createProductionServer
'
;
...
...
src/router/menus/index.ts
浏览文件 @
ecfb702b
...
...
@@ -91,9 +91,7 @@ function basicFilter(routes: RouteRecordNormalized[]) {
if
(
route
.
meta
.
carryParam
)
{
return
pathToRegexp
(
route
.
path
).
test
(
menu
.
path
);
}
if
(
route
.
meta
.
ignoreAuth
)
{
return
false
;
}
if
(
route
.
meta
.
ignoreAuth
)
return
false
;
}
return
route
.
path
===
menu
.
path
;
});
...
...
src/router/types.d.ts
浏览文件 @
ecfb702b
...
...
@@ -73,9 +73,11 @@ export interface MenuModule {
menu
:
Menu
;
}
export
interface
App
RouteModule
{
layout
?
:
AppRouteRecordRaw
;
routes
?
:
AppRouteRecordRaw
[];
interface
RouteModule
{
layout
:
AppRouteRecordRaw
;
routes
:
AppRouteRecordRaw
[];
children
?:
AppRouteRecordRaw
[];
component
?:
any
;
}
export
type
AppRouteModule
=
RouteModule
|
AppRouteRecordRaw
;
src/setup/directives/permission.ts
浏览文件 @
ecfb702b
import
{
appStore
}
from
'
./../..
/store/modules/app
'
;
import
{
appStore
}
from
'
/@
/store/modules/app
'
;
import
type
{
App
}
from
'
vue
'
;
import
{
usePermission
}
from
'
/@/hooks/web/usePermission
'
;
import
{
PermissionModeEnum
}
from
'
/@/enums/appEnum
'
;
...
...
src/store/modules/permission.ts
浏览文件 @
ecfb702b
...
...
@@ -10,7 +10,7 @@ import { PermissionModeEnum } from '/@/enums/appEnum';
import
{
appStore
}
from
'
/@/store/modules/app
'
;
import
{
userStore
}
from
'
/@/store/modules/user
'
;
import
{
asyncRoutes
}
from
'
/@/router/routes
/index
'
;
import
{
asyncRoutes
}
from
'
/@/router/routes
'
;
import
{
filter
}
from
'
/@/utils/helper/treeHelper
'
;
import
{
toRaw
}
from
'
vue
'
;
import
{
getMenuListById
}
from
'
/@/api/sys/menu
'
;
...
...
src/useApp.ts
浏览文件 @
ecfb702b
...
...
@@ -93,10 +93,11 @@ export function useListenerNetWork() {
// Check network status
useNetWork
({
onLineFn
:
()
=>
{
replace
(
PageEnum
.
BASE_HOME
);
useTimeout
(()
=>
{
appStore
.
commitPageLoadingState
(
false
);
},
300
);
replace
(
PageEnum
.
BASE_HOME
).
then
(()
=>
{
useTimeout
(()
=>
{
appStore
.
commitPageLoadingState
(
false
);
},
200
);
});
},
offLineFn
:
()
=>
{
replace
({
...
...
src/utils/color.ts
浏览文件 @
ecfb702b
...
...
@@ -14,10 +14,10 @@ export const isHexColor = function (color: string) {
* RGB 颜色值转换为 十六进制颜色值.
* r, g, 和 b 需要在 [0, 255] 范围内
*
* @param Number r 红色色值
* @param Number g 绿色色值
* @param Number b 蓝色色值
* @return String 类似#ff00ff
* @param r
* @param g
* @param b
*/
export
const
rgbToHex
=
function
(
r
:
number
,
g
:
number
,
b
:
number
)
{
// tslint:disable-next-line:no-bitwise
...
...
src/utils/env.ts
浏览文件 @
ecfb702b
...
...
@@ -17,7 +17,6 @@ export const prodMode = 'production';
/**
* @description: 获取环境变量
* @param {type}
* @returns:
* @example:
*/
...
...
@@ -25,7 +24,6 @@ export const getEnv = (): string => import.meta.env.MODE;
/**
* @description: 是否是开发模式
* @param {type}
* @returns:
* @example:
*/
...
...
@@ -33,7 +31,6 @@ export const isDevMode = (): boolean => import.meta.env.DEV;
/**
* @description: 是否是生产模式模式
* @param {type}
* @returns:
* @example:
*/
...
...
@@ -41,7 +38,6 @@ export const isProdMode = (): boolean => import.meta.env.PROD;
/**
* @description: 是否开启mock
* @param {type}
* @returns:
* @example:
*/
...
...
src/utils/helper/menuHelper.ts
浏览文件 @
ecfb702b
import
{
AppRouteModule
}
from
'
/@/router/types.d
'
;
import
{
AppRouteModule
,
RouteModule
}
from
'
/@/router/types.d
'
;
import
type
{
MenuModule
,
Menu
,
AppRouteRecordRaw
}
from
'
/@/router/types
'
;
import
{
findPath
,
forEach
,
treeMap
,
treeToList
}
from
'
./treeHelper
'
;
...
...
@@ -48,7 +48,7 @@ export function transformRouteToMenu(routeModList: AppRouteModule[]) {
const cloneRouteModList = cloneDeep(routeModList);
const routeList: AppRouteRecordRaw[] = [];
cloneRouteModList.forEach((item) => {
const { layout, routes, children } = item;
const { layout, routes, children } = item
as RouteModule
;
if (layout) {
layout.children = routes || children;
routeList.push(layout);
...
...
src/utils/helper/persistent.ts
浏览文件 @
ecfb702b
import
{
createStorage
}
from
'
/@/utils/storage
/index
'
;
import
{
createStorage
}
from
'
/@/utils/storage
'
;
import
{
isIeFn
}
from
'
/@/utils/browser
'
;
import
{
BASE_LOCAL_CACHE_KEY
,
BASE_SESSION_CACHE_KEY
}
from
'
/@/enums/cacheEnum
'
;
...
...
src/utils/helper/routeHelper.ts
浏览文件 @
ecfb702b
import
type
{
AppRouteModule
,
AppRouteRecordRaw
}
from
'
/@/router/types
'
;
import
type
{
AppRouteModule
,
AppRouteRecordRaw
,
RouteModule
}
from
'
/@/router/types
'
;
import
type
{
RouteLocationNormalized
,
RouteRecordRaw
}
from
'
vue-router
'
;
import
{
createRouter
,
createWebHashHistory
}
from
'
vue-router
'
;
import
{
appStore
}
from
'
/@/store/modules/app
'
;
import
{
tabStore
}
from
'
/@/store/modules/tab
'
;
import
{
createRouter
,
createWebHashHistory
}
from
'
vue-router
'
;
import
{
toRaw
}
from
'
vue
'
;
import
{
PAGE_LAYOUT_COMPONENT
}
from
'
/@/router/constant
'
;
// import { isDevMode } from '/@/utils/env';
...
...
@@ -21,17 +21,17 @@ export function setCurrentTo(to: RouteLocationNormalized) {
}
// 转化路由模块
// 将多级转成2层。keepAlive问题
export
function
genRouteModule
(
moduleList
:
AppRouteModule
[])
{
export
function
genRouteModule
(
moduleList
:
AppRouteModule
[]
|
AppRouteRecordRaw
[]
)
{
const
ret
:
AppRouteRecordRaw
[]
=
[];
for
(
const
routeMod
of
moduleList
)
{
let
routes
=
[];
let
routes
:
RouteRecordRaw
[]
=
[];
let
layout
:
AppRouteRecordRaw
|
undefined
;
if
(
Reflect
.
has
(
routeMod
,
'
routes
'
))
{
routes
=
routeMod
.
routes
as
any
;
layout
=
routeMod
.
layout
;
routes
=
(
routeMod
as
RouteModule
)
.
routes
as
any
;
layout
=
(
routeMod
as
RouteModule
)
.
layout
;
}
else
if
(
Reflect
.
has
(
routeMod
,
'
path
'
))
{
layout
=
omit
(
routeMod
,
'
children
'
)
as
any
;
routes
=
routeMod
.
children
||
[]
;
routes
=
(
routeMod
.
children
as
RouteRecordRaw
[])
||
([]
as
RouteRecordRaw
[])
;
}
const
router
=
createRouter
({
routes
,
history
:
createWebHashHistory
()
});
...
...
@@ -66,20 +66,26 @@ function asyncImportRoute(routes: AppRouteRecordRaw[] | undefined) {
});
}
function
getLayoutComp
(
comp
:
string
)
{
return
comp
===
'
PAGE_LAYOUT
'
?
PAGE_LAYOUT_COMPONENT
:
''
;
}
// 将后台对象转成路由对象
export
function
transformObjToRoute
(
routeList
:
AppRouteModule
[])
{
export
function
transformObjToRoute
<
T
=
any
>
(
routeList
:
AppRouteModule
[]):
T
[]
{
routeList
.
forEach
((
route
)
=>
{
asyncImportRoute
(
Reflect
.
has
(
route
,
'
routes
'
)
?
route
.
routes
:
route
.
children
||
[]);
if
(
route
.
layout
)
{
route
.
layout
.
component
=
route
.
layout
.
component
===
'
PAGE_LAYOUT
'
?
PAGE_LAYOUT_COMPONENT
:
''
;
asyncImportRoute
(
Reflect
.
has
(
route
,
'
routes
'
)
?
(
route
as
RouteModule
).
routes
:
route
.
children
||
[]
);
if
((
route
as
RouteModule
).
layout
)
{
(
route
as
RouteModule
).
layout
.
component
=
getLayoutComp
(
(
route
as
RouteModule
).
layout
.
component
);
}
else
{
route
.
component
=
route
.
component
===
'
PAGE_LAYOUT
'
?
PAGE_LAYOUT_COMPONENT
:
''
;
const
_layout
=
omit
(
route
,
'
children
'
)
as
any
;
route
.
layout
=
_layout
;
route
.
component
=
getLayoutComp
(
route
.
component
);
(
route
as
RouteModule
).
layout
=
omit
(
route
,
'
children
'
)
as
any
;
}
});
return
routeList
;
return
(
routeList
as
unknown
)
as
T
[]
;
}
//
...
...
src/utils/helper/tsxHelper.tsx
浏览文件 @
ecfb702b
...
...
@@ -20,6 +20,7 @@ export function getSlot(slots: Slots, slot = 'default', data?: any) {
/**
* extends slots
* @param slots
* @param excludeKeys
*/
export
function
extendSlots
(
slots
:
Slots
,
excludeKeys
:
string
[]
=
[])
{
const
slotKeys
=
Object
.
keys
(
slots
);
...
...
src/utils/http/axios/Axios.ts
浏览文件 @
ecfb702b
...
...
@@ -17,7 +17,7 @@ export * from './axiosTransform';
*/
export
class
VAxios
{
private
axiosInstance
:
AxiosInstance
;
private
options
:
CreateAxiosOptions
;
private
readonly
options
:
CreateAxiosOptions
;
constructor
(
options
:
CreateAxiosOptions
)
{
this
.
options
=
options
;
...
...
src/utils/storage/Storage.ts
浏览文件 @
ecfb702b
...
...
@@ -92,7 +92,7 @@ export const createStorage = ({ prefixKey = '', storage = sessionStorage } = {})
* 添加cookie
* @param name cookie名字
* @param value cookie内容
* @param
day 过期时间
* @param
expire
* 如果过期时间未设置,默认管理浏览器自动删除
* 例子:
* cookieData.set('name','value',)
...
...
src/utils/uuid.ts
浏览文件 @
ecfb702b
...
...
@@ -10,7 +10,7 @@ export function buildUUID(): string {
}
else
if
(
i
===
15
)
{
uuid
+=
4
;
}
else
if
(
i
===
20
)
{
uuid
+=
hexList
[(
Math
.
random
()
*
4
)
|
(
0
+
8
)
];
uuid
+=
hexList
[(
Math
.
random
()
*
4
)
|
8
];
}
else
{
uuid
+=
hexList
[(
Math
.
random
()
*
16
)
|
0
];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录