@yyp92-cli/template-vue-pc 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +15 -0
- package/template/.env.development +2 -0
- package/template/.env.production +2 -0
- package/template/.env.test +2 -0
- package/template/README.md +30 -0
- package/template/auto-imports.d.ts +11 -0
- package/template/components.d.ts +67 -0
- package/template/index.html +16 -0
- package/template/package.json +43 -0
- package/template/pnpm-lock.yaml +2830 -0
- package/template/public/vite.svg +1 -0
- package/template/src/App.vue +26 -0
- package/template/src/assets/img/login-bg.jpg +0 -0
- package/template/src/assets/img/logo.svg +15 -0
- package/template/src/components/layout/header-crumb/index.vue +38 -0
- package/template/src/components/layout/header-info/index.vue +181 -0
- package/template/src/components/layout/index.vue +83 -0
- package/template/src/components/layout/main-header/index.vue +85 -0
- package/template/src/components/layout/main-menu/index.vue +166 -0
- package/template/src/components/layout-horizontal/header-crumb/index.vue +38 -0
- package/template/src/components/layout-horizontal/header-info/index.vue +185 -0
- package/template/src/components/layout-horizontal/index.vue +55 -0
- package/template/src/components/layout-horizontal/main-header/index.vue +86 -0
- package/template/src/components/layout-horizontal/main-menu/index.vue +135 -0
- package/template/src/global/constants.ts +4 -0
- package/template/src/global/register-icons.ts +10 -0
- package/template/src/main.ts +16 -0
- package/template/src/mock/index.ts +8 -0
- package/template/src/mock/login.ts +5 -0
- package/template/src/mock/userDepartmentList.ts +85 -0
- package/template/src/mock/userInfoMock.ts +24 -0
- package/template/src/mock/userList.ts +115 -0
- package/template/src/mock/userListDelete.ts +1 -0
- package/template/src/mock/userMenuList.ts +466 -0
- package/template/src/mock/userMenus.ts +374 -0
- package/template/src/mock/userRoleList.ts +1846 -0
- package/template/src/router/index.ts +41 -0
- package/template/src/router/routes.ts +189 -0
- package/template/src/service/api/index.ts +90 -0
- package/template/src/service/request/index.ts +268 -0
- package/template/src/service/request/type.ts +5 -0
- package/template/src/store/counter.ts +19 -0
- package/template/src/store/index.ts +14 -0
- package/template/src/store/login/index.ts +142 -0
- package/template/src/store/main/index.ts +54 -0
- package/template/src/store/main/system/index.ts +88 -0
- package/template/src/store/main/system/type.ts +19 -0
- package/template/src/styles/global.scss +33 -0
- package/template/src/styles/index.scss +4 -0
- package/template/src/styles/reset.scss +17 -0
- package/template/src/theme/darkTheme.scss +51 -0
- package/template/src/theme/lightTheme.scss +53 -0
- package/template/src/types/index.ts +1 -0
- package/template/src/types/login.ts +4 -0
- package/template/src/utils/cache.ts +44 -0
- package/template/src/utils/download.ts +27 -0
- package/template/src/utils/format.ts +10 -0
- package/template/src/utils/index.ts +14 -0
- package/template/src/utils/map-menus.ts +174 -0
- package/template/src/views/403/index.vue +22 -0
- package/template/src/views/login/component/login-panel.vue +138 -0
- package/template/src/views/login/component/panel-account.vue +138 -0
- package/template/src/views/login/component/panel-phone.vue +56 -0
- package/template/src/views/login/index.vue +28 -0
- package/template/src/views/main/analysis/dashboard/index.vue +19 -0
- package/template/src/views/main/analysis/overview/index.vue +25 -0
- package/template/src/views/main/detail/index.vue +19 -0
- package/template/src/views/main/fullScreen/images/bg.png +0 -0
- package/template/src/views/main/fullScreen/images/contrast-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-alarm.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-btn-bg-l.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-btn-bg-r.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-center-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-left-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-right-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-warn-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-cb.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-lb.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-lc.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-lt.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-rb.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-rc.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-rt.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-title.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-warn-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/line-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/man-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/man.png +0 -0
- package/template/src/views/main/fullScreen/images/map-title-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/rankingChart-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/total.png +0 -0
- package/template/src/views/main/fullScreen/images/woman-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/woman.png +0 -0
- package/template/src/views/main/fullScreen/index.vue +33 -0
- package/template/src/views/main/index.vue +24 -0
- package/template/src/views/main/product/category/index.vue +19 -0
- package/template/src/views/main/product/goods/index.vue +19 -0
- package/template/src/views/main/story/chat/index.vue +70 -0
- package/template/src/views/main/story/list/index.vue +19 -0
- package/template/src/views/main/system/department/index.vue +20 -0
- package/template/src/views/main/system/menu/index.vue +19 -0
- package/template/src/views/main/system/role/index.vue +20 -0
- package/template/src/views/main/system/user/index.vue +141 -0
- package/template/src/views/main/system/user/user-comp/UserContent.vue +211 -0
- package/template/src/views/main/system/user/user-comp/UserModal.vue +225 -0
- package/template/src/views/main/system/user/user-comp/UserSearch.vue +147 -0
- package/template/src/views/not-found/index.vue +22 -0
- package/template/src/vite-env.d.ts +9 -0
- package/template/tsconfig.app.json +26 -0
- package/template/tsconfig.json +7 -0
- package/template/tsconfig.node.json +25 -0
- package/template/vite.config.ts +66 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {defineStore} from 'pinia'
|
|
2
|
+
import { accountLoginRequest, getUserInfoById, getUserMenusByRoleId } from '@/service/api'
|
|
3
|
+
import type {IAccount} from '@/types'
|
|
4
|
+
import { localCache } from '@/utils/cache'
|
|
5
|
+
import { LOGIN_TOKEN, PERMISSION, USER_INFO, USER_MENUS } from '@/global/constants'
|
|
6
|
+
import { mapMenusToRoutes, mapMenusToPermissions } from '@/utils/map-menus'
|
|
7
|
+
import router from '@/router'
|
|
8
|
+
import useMainStore from '../main'
|
|
9
|
+
|
|
10
|
+
interface LoginState {
|
|
11
|
+
token: string,
|
|
12
|
+
userInfo: any,
|
|
13
|
+
userMenus: any,
|
|
14
|
+
permissions: string[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const useLoginStore = defineStore(
|
|
18
|
+
'login',
|
|
19
|
+
{
|
|
20
|
+
state: (): LoginState => ({
|
|
21
|
+
token: '',
|
|
22
|
+
userInfo: {},
|
|
23
|
+
userMenus: [],
|
|
24
|
+
permissions: []
|
|
25
|
+
}),
|
|
26
|
+
|
|
27
|
+
actions: {
|
|
28
|
+
async loginAccountAction(account: IAccount) {
|
|
29
|
+
let id = -1
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
// 1. 账号登录,获取 token 信息
|
|
33
|
+
const loginResult = await accountLoginRequest(account)
|
|
34
|
+
const {
|
|
35
|
+
data: {
|
|
36
|
+
id: newId,
|
|
37
|
+
token
|
|
38
|
+
}
|
|
39
|
+
} = loginResult ?? {data: {}}
|
|
40
|
+
|
|
41
|
+
this.token = token
|
|
42
|
+
id = newId
|
|
43
|
+
|
|
44
|
+
// 2. 进行本地缓存
|
|
45
|
+
localCache.setCache(LOGIN_TOKEN, token)
|
|
46
|
+
}
|
|
47
|
+
catch(error) {
|
|
48
|
+
return error
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 3. 获取登录用户的详细信息(role信息)
|
|
52
|
+
try {
|
|
53
|
+
const userInfoResult = await getUserInfoById(id)
|
|
54
|
+
const userInfo = userInfoResult.data
|
|
55
|
+
this.userInfo = userInfo
|
|
56
|
+
localCache.setCache(USER_INFO, userInfo)
|
|
57
|
+
|
|
58
|
+
// 获取登录用户的所有按钮的权限
|
|
59
|
+
this.permissions = [
|
|
60
|
+
'/analysis',
|
|
61
|
+
// '/overview',
|
|
62
|
+
'/dashboard',
|
|
63
|
+
'/system',
|
|
64
|
+
'/user',
|
|
65
|
+
'/department',
|
|
66
|
+
'/menu',
|
|
67
|
+
'/role',
|
|
68
|
+
'/product',
|
|
69
|
+
'/category',
|
|
70
|
+
'/goods',
|
|
71
|
+
'/story',
|
|
72
|
+
'/chat',
|
|
73
|
+
'/list',
|
|
74
|
+
'/fullScreen',
|
|
75
|
+
'/detail',
|
|
76
|
+
]
|
|
77
|
+
localCache.setCache(PERMISSION, [
|
|
78
|
+
'/analysis',
|
|
79
|
+
// '/overview',
|
|
80
|
+
'/dashboard',
|
|
81
|
+
'/system',
|
|
82
|
+
'/user',
|
|
83
|
+
'/department',
|
|
84
|
+
'/menu',
|
|
85
|
+
'/role',
|
|
86
|
+
'/product',
|
|
87
|
+
'/category',
|
|
88
|
+
'/goods',
|
|
89
|
+
'/story',
|
|
90
|
+
'/chat',
|
|
91
|
+
'/list',
|
|
92
|
+
'/fullScreen',
|
|
93
|
+
'/detail',
|
|
94
|
+
])
|
|
95
|
+
}
|
|
96
|
+
catch(error) {
|
|
97
|
+
return error
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 4. 根据角色请求用户的权限(菜单menus)
|
|
101
|
+
try {
|
|
102
|
+
const userMenusResult = await getUserMenusByRoleId(this.userInfo?.role?.id)
|
|
103
|
+
const userMenus = userMenusResult.data
|
|
104
|
+
this.userMenus = mapMenusToRoutes()
|
|
105
|
+
localCache.setCache(USER_MENUS, mapMenusToRoutes())
|
|
106
|
+
|
|
107
|
+
// 请求所有的 roles/departments 数据
|
|
108
|
+
const mainStore = useMainStore()
|
|
109
|
+
mainStore.fetchEntireDataAction()
|
|
110
|
+
}
|
|
111
|
+
catch(error) {
|
|
112
|
+
return error
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return 'ok'
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// 用户进行刷新默认加载数据
|
|
119
|
+
loadLocalCacheAction() {
|
|
120
|
+
const token = localCache.getCache(LOGIN_TOKEN)
|
|
121
|
+
const userInfo = localCache.getCache(USER_INFO)
|
|
122
|
+
const userMenus = localCache.getCache(USER_MENUS)
|
|
123
|
+
const permission = localCache.getCache(PERMISSION)
|
|
124
|
+
|
|
125
|
+
if (token && userInfo && userMenus) {
|
|
126
|
+
this.token = token
|
|
127
|
+
this.userInfo = userInfo
|
|
128
|
+
this.userMenus = userMenus
|
|
129
|
+
|
|
130
|
+
// 请求所有的 roles/departments 数据
|
|
131
|
+
const mainStore = useMainStore()
|
|
132
|
+
mainStore.fetchEntireDataAction()
|
|
133
|
+
|
|
134
|
+
// 获取登录用户的所有按钮的权限
|
|
135
|
+
this.permissions = permission
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
export default useLoginStore
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getEntireDepartments, getEntireMenu, getEntireRoles } from '@/service/api'
|
|
2
|
+
import {defineStore} from 'pinia'
|
|
3
|
+
|
|
4
|
+
interface IMainState {
|
|
5
|
+
entireRoles: any[]
|
|
6
|
+
entireDepartments: any[],
|
|
7
|
+
entireMenu: any[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const useMainStore = defineStore(
|
|
11
|
+
'main',
|
|
12
|
+
{
|
|
13
|
+
state: (): IMainState => ({
|
|
14
|
+
entireRoles: [],
|
|
15
|
+
entireDepartments: [],
|
|
16
|
+
entireMenu: []
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
actions: {
|
|
20
|
+
fetchEntireDataAction() {
|
|
21
|
+
Promise.allSettled([
|
|
22
|
+
getEntireRoles(),
|
|
23
|
+
getEntireDepartments(),
|
|
24
|
+
getEntireMenu()
|
|
25
|
+
]).then((res: any[]) => {
|
|
26
|
+
res.forEach((item: any, index: number) => {
|
|
27
|
+
const {
|
|
28
|
+
status,
|
|
29
|
+
value
|
|
30
|
+
} = item ?? {}
|
|
31
|
+
|
|
32
|
+
if (status === 'fulfilled') {
|
|
33
|
+
const list = value.data.list
|
|
34
|
+
|
|
35
|
+
switch(index) {
|
|
36
|
+
case 0:
|
|
37
|
+
this.entireRoles = list
|
|
38
|
+
break
|
|
39
|
+
case 1:
|
|
40
|
+
this.entireDepartments = list
|
|
41
|
+
break
|
|
42
|
+
case 2:
|
|
43
|
+
this.entireMenu = list
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
export default useMainStore
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {defineStore} from 'pinia'
|
|
2
|
+
import {
|
|
3
|
+
postUserList,
|
|
4
|
+
deleteUserById,
|
|
5
|
+
newUserData,
|
|
6
|
+
editUserData
|
|
7
|
+
} from '@/service/api'
|
|
8
|
+
import type { SystemState } from './type'
|
|
9
|
+
|
|
10
|
+
const useSystemStore = defineStore('system', {
|
|
11
|
+
state: (): SystemState => ({
|
|
12
|
+
usersList: [],
|
|
13
|
+
usersTotalCount: 0,
|
|
14
|
+
pageList: [],
|
|
15
|
+
pageTotalCount: 0
|
|
16
|
+
}),
|
|
17
|
+
|
|
18
|
+
actions: {
|
|
19
|
+
async postUsersListAction(queryInfo: any) {
|
|
20
|
+
try {
|
|
21
|
+
const usersListResult = await postUserList(queryInfo)
|
|
22
|
+
const {totalCount, list} = usersListResult.data
|
|
23
|
+
|
|
24
|
+
this.usersTotalCount = totalCount
|
|
25
|
+
this.usersList = list.map((item: any, index: number) => {
|
|
26
|
+
return {
|
|
27
|
+
...item,
|
|
28
|
+
order: Math.floor((queryInfo.offset / queryInfo.size)) * queryInfo.size + (index + 1)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
catch(error) {}
|
|
33
|
+
finally {
|
|
34
|
+
return 'finally'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
async deleteUserByIdAction(id: number) {
|
|
39
|
+
try {
|
|
40
|
+
await deleteUserById(id)
|
|
41
|
+
|
|
42
|
+
ElMessage({
|
|
43
|
+
message: '删除成功',
|
|
44
|
+
type: 'success',
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return 'ok'
|
|
48
|
+
}
|
|
49
|
+
catch(error) {
|
|
50
|
+
return 'error'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async addUserDataActions(userInfo: any) {
|
|
55
|
+
try {
|
|
56
|
+
await newUserData(userInfo)
|
|
57
|
+
|
|
58
|
+
ElMessage({
|
|
59
|
+
message: '创建成功',
|
|
60
|
+
type: 'success',
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
return 'ok'
|
|
64
|
+
}
|
|
65
|
+
catch(error) {
|
|
66
|
+
return 'error'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
async editUserDataActions(id: number, userInfo: any) {
|
|
71
|
+
try {
|
|
72
|
+
await editUserData(id, userInfo)
|
|
73
|
+
|
|
74
|
+
ElMessage({
|
|
75
|
+
message: '编辑成功',
|
|
76
|
+
type: 'success',
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return 'ok'
|
|
80
|
+
}
|
|
81
|
+
catch(error) {
|
|
82
|
+
return 'error'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
export default useSystemStore
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UserProps {
|
|
2
|
+
id: number
|
|
3
|
+
name: string
|
|
4
|
+
realname: string
|
|
5
|
+
cellphone: number
|
|
6
|
+
enable: number
|
|
7
|
+
departmentId: number
|
|
8
|
+
roleId: number
|
|
9
|
+
createAt: string
|
|
10
|
+
updateAt: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SystemState {
|
|
14
|
+
usersList: UserProps[],
|
|
15
|
+
usersTotalCount: number,
|
|
16
|
+
|
|
17
|
+
pageList: any[],
|
|
18
|
+
pageTotalCount: number
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
html,
|
|
2
|
+
body {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#app {
|
|
9
|
+
width: 100%;
|
|
10
|
+
min-width: 1000px;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background: var(--bg-white-color);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
*:focus-visible {
|
|
16
|
+
outline: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// element-plus 组件库的样式重写
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// 滚动条
|
|
24
|
+
// ::-webkit-scrollbar {
|
|
25
|
+
// width: 8px;
|
|
26
|
+
// height: 8px;
|
|
27
|
+
// }
|
|
28
|
+
// ::-webkit-scrollbar-thumb {
|
|
29
|
+
// border-radius: 6px;
|
|
30
|
+
// background-color: #dde6f0;
|
|
31
|
+
// border: 2px dashed transparent;
|
|
32
|
+
// background-clip: padding-box;
|
|
33
|
+
// }
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
:root[data-theme="dark"] {
|
|
2
|
+
--primary-text-color: #FFFFFF;
|
|
3
|
+
--primary-white-color: #2A2A2D;
|
|
4
|
+
|
|
5
|
+
// 全局主色
|
|
6
|
+
--primary-color: #3591F4;
|
|
7
|
+
--primary-color1: rgba(53, 145, 244, 0.1);
|
|
8
|
+
// 链接色
|
|
9
|
+
--link-color: #3591F4;
|
|
10
|
+
// 成功色
|
|
11
|
+
--success-color: #0CAA43;
|
|
12
|
+
--success-color1: rgba(12, 170, 67, 0.1);
|
|
13
|
+
// 警告色
|
|
14
|
+
--warning-color: #FFA00A;
|
|
15
|
+
--warning-color1: rgba(255, 160, 10, 0.1);
|
|
16
|
+
// 错误色
|
|
17
|
+
--error-color: #F43835;
|
|
18
|
+
--error-color1: rgba(244, 56, 53, 0.1);
|
|
19
|
+
|
|
20
|
+
// 主文本色
|
|
21
|
+
--text-color: #FFFFFF;
|
|
22
|
+
// 次文本色
|
|
23
|
+
--text-color-secondary: #898D97;
|
|
24
|
+
|
|
25
|
+
// 白的背景
|
|
26
|
+
--bg-white-color: #1C1C1C;
|
|
27
|
+
--bg-grey-color: #161616;
|
|
28
|
+
--bg-grey-color1: transparent;
|
|
29
|
+
--bg-black2-color: #222222;
|
|
30
|
+
--bg-hover-color: rgba(53, 145, 244, 0.1);
|
|
31
|
+
--bg-white-color1: rgba(0, 0, 0, 0.5);
|
|
32
|
+
|
|
33
|
+
// 边框、输入框、分割线
|
|
34
|
+
--border-color-base: #2A2A2D;
|
|
35
|
+
// icon
|
|
36
|
+
--icon-color: #898D97;
|
|
37
|
+
|
|
38
|
+
// 主字号
|
|
39
|
+
--font-size-base: 14px;
|
|
40
|
+
|
|
41
|
+
// 组件/浮层圆角
|
|
42
|
+
--border-radius-base: 4px;
|
|
43
|
+
--modal-border-radius-base: 5px;
|
|
44
|
+
|
|
45
|
+
// 阴影
|
|
46
|
+
--box-shadow-color: #000000;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// 大屏主题
|
|
50
|
+
--screen-text-color: #29fcff;
|
|
51
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
:root[data-theme="light"] {
|
|
2
|
+
--primary-text-color: #FFFFFF;
|
|
3
|
+
--primary-white-color: #FFFFFF;
|
|
4
|
+
|
|
5
|
+
// 全局主色
|
|
6
|
+
--primary-color: #3591F4;
|
|
7
|
+
--primary-color1: rgba(53, 145, 244, 0.1);
|
|
8
|
+
// 链接色
|
|
9
|
+
--link-color: var(--primary-color);
|
|
10
|
+
// 成功色
|
|
11
|
+
--success-color: #0CAA43;
|
|
12
|
+
--success-color1: rgba(12, 170, 67, 0.1);
|
|
13
|
+
// 警告色
|
|
14
|
+
--warning-color: #FFA00A;
|
|
15
|
+
--warning-color1: rgba(255, 160, 10, 0.1);
|
|
16
|
+
// 错误色
|
|
17
|
+
--error-color: #F43835;
|
|
18
|
+
--error-color1: rgba(244, 56, 53, 0.1);
|
|
19
|
+
|
|
20
|
+
// 主文本色
|
|
21
|
+
--text-color: #363A45;
|
|
22
|
+
// 次文本色
|
|
23
|
+
--text-color-secondary: #898D97;
|
|
24
|
+
|
|
25
|
+
// 白的背景
|
|
26
|
+
--bg-white-color: var(--primary-white-color);
|
|
27
|
+
--bg-grey-color: #F2F4F9;
|
|
28
|
+
--bg-grey-color1: var(--bg-grey-color);
|
|
29
|
+
--bg-black2-color: var(--primary-white-color);
|
|
30
|
+
--bg-hover-color: rgba(53, 145, 244, 0.1);
|
|
31
|
+
--bg-white-color1: rgba(255, 255, 255, 0.5);
|
|
32
|
+
|
|
33
|
+
// 边框、输入框、分割线
|
|
34
|
+
--border-color-base: #DDE6F0;
|
|
35
|
+
// icon
|
|
36
|
+
--icon-color: #CCD6DD;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// 主字号
|
|
41
|
+
--font-size-base: 14px;
|
|
42
|
+
|
|
43
|
+
// 组件/浮层圆角
|
|
44
|
+
--border-radius-base: 4px;
|
|
45
|
+
--modal-border-radius-base: 5px;
|
|
46
|
+
|
|
47
|
+
// 阴影
|
|
48
|
+
--box-shadow-color: #000000;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// 大屏主题
|
|
52
|
+
--screen-text-color: #29fcff;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './login'
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
enum CacheType {
|
|
2
|
+
Local,
|
|
3
|
+
Session
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
class Cache {
|
|
7
|
+
storage: Storage
|
|
8
|
+
|
|
9
|
+
constructor(type: CacheType) {
|
|
10
|
+
this.storage = type === CacheType.Local
|
|
11
|
+
? localStorage
|
|
12
|
+
: sessionStorage
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setCache(key: string, value: any) {
|
|
16
|
+
if (value) {
|
|
17
|
+
this.storage.setItem(key, JSON.stringify(value))
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getCache(key: string) {
|
|
22
|
+
const value = this.storage.getItem(key)
|
|
23
|
+
|
|
24
|
+
if (value) {
|
|
25
|
+
return JSON.parse(value)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
removeCache(key: string) {
|
|
30
|
+
this.storage.removeItem(key)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
clear() {
|
|
34
|
+
this.storage.clear()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const localCache = new Cache(CacheType.Local)
|
|
39
|
+
const sessionCache = new Cache(CacheType.Session)
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
localCache,
|
|
43
|
+
sessionCache
|
|
44
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {isFunction} from 'lodash-es'
|
|
2
|
+
|
|
3
|
+
// 下载文件
|
|
4
|
+
export const downloadFile = (
|
|
5
|
+
output: any,
|
|
6
|
+
downloadFileName: string = '未命名文件',
|
|
7
|
+
handleCancel: () => void = () => {}
|
|
8
|
+
) => {
|
|
9
|
+
if (!output && isFunction(handleCancel)) {
|
|
10
|
+
handleCancel()
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fetch(output, {responseType: 'blob'} as any)
|
|
15
|
+
.then((res: any) => res?.blob?.())
|
|
16
|
+
.then((res: any) => {
|
|
17
|
+
const link = document.createElement('a')
|
|
18
|
+
link.href = window.URL.createObjectURL(res)
|
|
19
|
+
link.download = downloadFileName
|
|
20
|
+
link.style.display = 'none'
|
|
21
|
+
document.body.appendChild(link)
|
|
22
|
+
link.click()
|
|
23
|
+
})
|
|
24
|
+
.finally(() => {
|
|
25
|
+
isFunction(handleCancel) && handleCancel()
|
|
26
|
+
})
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// 主题切换
|
|
2
|
+
export const changeTheme = (isDark: boolean) => {
|
|
3
|
+
// 获取根元素
|
|
4
|
+
const root = document.documentElement;
|
|
5
|
+
|
|
6
|
+
if (!isDark) {
|
|
7
|
+
// 修改 data-theme 属性的值为 "light"
|
|
8
|
+
root.setAttribute('data-theme', 'light');
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 修改 data-theme 属性的值为 "dark"
|
|
13
|
+
root.setAttribute('data-theme', 'dark');
|
|
14
|
+
}
|