Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
紫光云
web-project
Commits
21ac10c5
Commit
21ac10c5
authored
Jun 14, 2024
by
jiaxu.yan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat; 修改打包模式,整改router 加载模式
parent
e34b8b37
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
155 additions
and
147 deletions
+155
-147
.env.production
.env.production
+2
-1
pageEnum.ts
src/enums/pageEnum.ts
+1
-1
MultipleHeader.vue
src/layouts/default/header/MultipleHeader.vue
+6
-2
index.vue
src/layouts/default/header/index.vue
+5
-2
index.vue
src/layouts/default/index.vue
+5
-4
index.ts
src/router/routes/index.ts
+11
-2
user.ts
src/store/modules/user.ts
+37
-43
biddingPlanEdit.vue
src/views/biddingPlan/biddingPlanEdit.vue
+2
-2
index.vue
src/views/project/index.vue
+86
-90
No files found.
.env.production
View file @
21ac10c5
...
...
@@ -15,7 +15,8 @@ VITE_GLOB_API_URL = https://dev.unitj.cn
# File upload address, optional
# It can be forwarded by nginx or write the actual address directly
VITE_GLOB_UPLOAD_URL = /upload
VITE_GLOB_UPLOAD_URL = '/api/system/file/add'
# Interface prefix
VITE_GLOB_API_URL_PREFIX =
src/enums/pageEnum.ts
View file @
21ac10c5
...
...
@@ -2,7 +2,7 @@ export enum PageEnum {
// basic login path
BASE_LOGIN
=
'/login'
,
// basic home path
BASE_HOME
=
'/dashboard'
,
BASE_HOME
=
'/dashboard
/index
'
,
// error page path
ERROR_PAGE
=
'/exception'
,
// error log page path
...
...
src/layouts/default/header/MultipleHeader.vue
View file @
21ac10c5
...
...
@@ -10,10 +10,14 @@
</div>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
unref
,
computed
,
CSSProperties
}
from
'vue'
;
import
{
unref
,
computed
,
CSSProperties
,
ref
}
from
'vue'
;
import
LayoutHeader
from
'./index.vue'
;
import
MultipleTabs
from
'../tabs/index.vue'
;
let
isDev
=
ref
<
boolean
>
(
true
);
isDev
.
value
=
import
.
meta
.
env
.
MODE
===
'development'
;
console
.
log
(
isDev
.
value
,
'development'
);
import
{
useHeaderSetting
}
from
'@/hooks/setting/useHeaderSetting'
;
import
{
useMenuSetting
}
from
'@/hooks/setting/useMenuSetting'
;
...
...
@@ -54,7 +58,7 @@
const
getWrapStyle
=
computed
(():
CSSProperties
=>
{
const
style
:
CSSProperties
=
{};
if
(
unref
(
getFixed
))
{
style
.
width
=
unref
(
getIsMobile
)
?
'100%'
:
unref
(
getCalcContentWidth
);
style
.
width
=
unref
(
getIsMobile
)
||
!
isDev
.
value
?
'100%'
:
unref
(
getCalcContentWidth
);
}
if
(
unref
(
getShowFullHeaderRef
))
{
style
.
top
=
`
${
HEADER_HEIGHT
}
px`
;
...
...
src/layouts/default/header/index.vue
View file @
21ac10c5
...
...
@@ -48,7 +48,7 @@
:class=
"`$
{prefixCls}-action__item`"
/> -->
<UserDropDown
:theme=
"getHeaderTheme"
/>
<UserDropDown
v-if=
"isDev"
:theme=
"getHeaderTheme"
/>
<!--
<SettingDrawer
v-if=
"getShowSetting"
:class=
"`$
{prefixCls}-action__item`" /> -->
</div>
...
...
@@ -56,7 +56,7 @@
</
template
>
<
script
lang=
"ts"
setup
>
import
{
Layout
}
from
'ant-design-vue'
;
import
{
computed
,
unref
}
from
'vue'
;
import
{
computed
,
unref
,
ref
}
from
'vue'
;
import
{
AppLocalePicker
,
AppLogo
,
AppSearch
}
from
'@/components/Application'
;
import
{
SettingButtonPositionEnum
}
from
'@/enums/appEnum'
;
...
...
@@ -73,7 +73,10 @@
import
LayoutMenu
from
'../menu/index.vue'
;
import
LayoutTrigger
from
'../trigger/index.vue'
;
import
{
ErrorAction
,
FullScreen
,
LayoutBreadcrumb
,
Notify
,
UserDropDown
}
from
'./components'
;
let
isDev
=
ref
<
boolean
>
(
true
);
isDev
.
value
=
import
.
meta
.
env
.
MODE
===
'development'
;
console
.
log
(
isDev
.
value
,
'development'
);
const
SettingDrawer
=
createAsyncComponent
(()
=>
import
(
'@/layouts/default/setting/index.vue'
),
{
loading
:
true
,
});
...
...
src/layouts/default/index.vue
View file @
21ac10c5
...
...
@@ -3,9 +3,9 @@
<LayoutFeatures
/>
<LayoutHeader
fixed
v-if=
"getShowFullHeaderRef"
/>
<Layout
:class=
"[layoutClass, `$
{prefixCls}-out`]">
<LayoutSideBar
v-if=
"
getShowSidebar || getIsMobile
"
/>
<LayoutSideBar
v-if=
"
(getShowSidebar || getIsMobile) && isDev
"
/>
<Layout
:class=
"`$
{prefixCls}-main`">
<LayoutMultipleHeader
/>
<LayoutMultipleHeader
v-if=
"isDev"
/>
<LayoutContent
/>
<LayoutFooter
/>
</Layout>
...
...
@@ -14,10 +14,11 @@
</
template
>
<
script
lang=
"ts"
setup
>
import
{
computed
,
unref
}
from
'vue'
;
import
{
computed
,
unref
,
ref
}
from
'vue'
;
import
{
Layout
}
from
'ant-design-vue'
;
import
{
createAsyncComponent
}
from
'@/utils/factory/createAsyncComponent'
;
let
isDev
=
ref
<
boolean
>
(
true
);
isDev
.
value
=
import
.
meta
.
env
.
MODE
===
'development'
;
import
LayoutHeader
from
'./header/index.vue'
;
import
LayoutContent
from
'./content/index.vue'
;
import
LayoutSideBar
from
'./sider/index.vue'
;
...
...
src/router/routes/index.ts
View file @
21ac10c5
import
type
{
AppRouteRecordRaw
,
AppRouteModule
}
from
'@/router/types'
;
import
type
{
MenuModule
,
AppRouteRecordRaw
,
AppRouteModule
}
from
'@/router/types'
;
import
{
PAGE_NOT_FOUND_ROUTE
,
REDIRECT_ROUTE
}
from
'@/router/routes/basic'
;
import
{
mainOutRoutes
}
from
'./mainOut'
;
import
{
PageEnum
}
from
'@/enums/pageEnum'
;
import
{
t
}
from
'@/hooks/web/useI18n'
;
...
...
@@ -38,9 +37,19 @@ export const LoginRoute: AppRouteRecordRaw = {
},
};
const
menuModules
:
MenuModule
[]
=
[];
Object
.
keys
(
modules
).
forEach
((
key
)
=>
{
const
modules
=
import
.
meta
.
glob
(
'../routes/modules/**/*.ts'
,
{
eager
:
true
});
const
mod
=
(
modules
as
Recordable
)[
key
].
default
||
{};
const
modList
=
Array
.
isArray
(
mod
)
?
[...
mod
]
:
[
mod
];
menuModules
.
push
(...
modList
);
});
// Basic routing without permission
// 未经许可的基本路由
export
const
basicRoutes
=
[
menuModules
,
LoginRoute
,
RootRoute
,
...
mainOutRoutes
,
...
...
src/store/modules/user.ts
View file @
21ac10c5
...
...
@@ -16,7 +16,7 @@ import { usePermissionStore } from '@/store/modules/permission';
import
{
RouteRecordRaw
}
from
'vue-router'
;
import
{
PAGE_NOT_FOUND_ROUTE
}
from
'@/router/routes/basic'
;
import
{
isArray
}
from
'@/utils/is'
;
import
{
h
}
from
'vue'
;
import
{
h
,
nextTick
}
from
'vue'
;
interface
UserState
{
userInfo
:
Nullable
<
UserInfo
>
;
...
...
@@ -42,6 +42,9 @@ export const useUserStore = defineStore({
}),
getters
:
{
getUserInfo
(
state
):
UserInfo
{
if
(
import
.
meta
.
env
.
MODE
===
'production'
)
{
setAuthCache
(
TOKEN_KEY
,
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
}
return
state
.
userInfo
||
getAuthCache
<
UserInfo
>
(
USER_INFO_KEY
)
||
{};
},
getToken
():
string
{
...
...
@@ -92,14 +95,11 @@ export const useUserStore = defineStore({
try
{
const
{
goHome
=
true
,
mode
,
...
loginParams
}
=
params
;
const
data
=
await
loginApi
(
loginParams
,
mode
);
console
.
log
(
data
);
console
.
log
(
333
);
// const { token } = data;
// save token
this
.
setToken
(
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
return
this
.
afterLoginAction
(
goHom
e
);
return
this
.
afterLoginAction
(
tru
e
);
}
catch
(
error
)
{
return
Promise
.
reject
(
error
);
}
...
...
@@ -114,17 +114,20 @@ export const useUserStore = defineStore({
}
else
{
const
permissionStore
=
usePermissionStore
();
// 动态路由加载(首次)
if
(
!
permissionStore
.
isDynamicAddedRoute
)
{
const
routes
=
await
permissionStore
.
buildRoutesAction
();
[...
routes
,
PAGE_NOT_FOUND_ROUTE
].
forEach
((
route
)
=>
{
router
.
addRoute
(
route
as
unknown
as
RouteRecordRaw
);
// // 动态路由加载(首次)
// if (!permissionStore.isDynamicAddedRoute) {
// const routes = await permissionStore.buildRoutesAction();
// [...routes, PAGE_NOT_FOUND_ROUTE].forEach((route) => {
// router.addRoute(route as unknown as RouteRecordRaw);
// });
// // 记录动态路由加载完成
// permissionStore.setDynamicAddedRoute(true);
// }
console
.
log
(
goHome
);
console
.
log
(
PageEnum
.
BASE_HOME
);
nextTick
(()
=>
{
goHome
&&
router
.
replace
(
PageEnum
.
BASE_HOME
);
});
// 记录动态路由加载完成
permissionStore
.
setDynamicAddedRoute
(
true
);
}
goHome
&&
(
await
router
.
replace
(
userInfo
?.
homePath
||
PageEnum
.
BASE_HOME
));
}
return
userInfo
;
},
...
...
@@ -138,21 +141,9 @@ export const useUserStore = defineStore({
// userInfo.roles = [];
// this.setRoleList([]);
// }
const
info
=
{
//用户id
userId
:
userInfo
.
userId
,
// 用户名
username
:
userInfo
.
userName
,
// 真实名字
realName
:
userInfo
.
userName
,
// 头像
avatar
:
''
,
// 介绍
desc
:
''
,
roles
:
userInfo
.
roles
,
};
this
.
setUserInfo
(
info
);
return
info
;
console
.
log
(
userInfo
);
this
.
setUserInfo
(
userInfo
);
return
userInfo
;
},
/**
* @description: logout
...
...
@@ -168,6 +159,8 @@ export const useUserStore = defineStore({
this
.
setToken
(
undefined
);
this
.
setSessionTimeout
(
false
);
this
.
setUserInfo
(
null
);
console
.
log
(
goLogin
);
nextTick
(()
=>
{
if
(
goLogin
)
{
// 直接回登陆页
router
.
replace
(
PageEnum
.
BASE_LOGIN
);
...
...
@@ -180,6 +173,7 @@ export const useUserStore = defineStore({
},
});
}
});
},
/**
...
...
src/views/biddingPlan/biddingPlanEdit.vue
View file @
21ac10c5
...
...
@@ -89,8 +89,8 @@
Object
.
assign
({
schemas
:
formSchema
,
disabled
},
baseFormConfig
)
as
FormProps
,
),
};
source
.
biddingPeriod
=
source
.
biddingPeriod
.
split
(
','
)
;
source
.
plannedPeriod
=
source
.
plannedPeriod
.
split
(
','
)
;
source
.
biddingPeriod
=
source
.
biddingPeriod
?
source
.
biddingPeriod
.
split
(
','
)
:
''
;
source
.
plannedPeriod
=
source
.
plannedPeriod
?
source
.
plannedPeriod
.
split
(
','
)
:
''
;
const
{
setFieldsValue
}
=
item
.
Form
[
1
];
tabsFormSchema
.
push
(
item
);
formData
.
value
.
tenderPlanPro
.
push
({
...
...
src/views/project/index.vue
View file @
21ac10c5
<
template
>
<PageWrapper
:class=
"prefixCls"
>
<PageCard
title=
"数据简报"
>
<div
:class=
"`$
{prefixCls}__top`">
<Row
:gutter=
"12"
>
<Col
:span=
"4"
:class=
"`$
{prefixCls}__top-col`">
...
...
@@ -50,7 +48,6 @@
</Col>
</Row>
</div>
</PageCard>
<BasicTable
@
register=
"registerTable"
>
<template
#
toolbar
>
<a-button
type=
"primary"
preIcon=
"mdi:plus"
@
click=
"handleCreate"
>
新增项目
</a-button>
...
...
@@ -91,7 +88,6 @@
</template>
</BasicTable>
<projectDrawer
@
register=
"registerDrawer"
@
success=
"handleSuccess"
/>
</PageWrapper>
</template>
<
script
lang=
"ts"
setup
>
import
{
Tag
}
from
'ant-design-vue'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment