Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web
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
Commits
186b12fc
Commit
186b12fc
authored
Dec 18, 2023
by
刘怀志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(全局): preitter格式化src
parent
ceb65d2b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
175 deletions
+189
-175
App.vue
src/App.vue
+32
-28
main.js
src/main.js
+103
-96
permission.js
src/permission.js
+10
-7
settings.js
src/settings.js
+44
-44
No files found.
src/App.vue
View file @
186b12fc
<
template
>
<div
id=
"app"
>
<router-view
/>
<theme-picker
/>
</div>
</
template
>
<
script
>
import
ThemePicker
from
"@/components/ThemePicker"
;
export
default
{
name
:
"App"
,
components
:
{
ThemePicker
},
metaInfo
()
{
return
{
title
:
this
.
$store
.
state
.
settings
.
dynamicTitle
&&
this
.
$store
.
state
.
settings
.
title
,
titleTemplate
:
title
=>
{
return
title
?
`
${
title
}
-
${
process
.
env
.
VUE_APP_TITLE
}
`
:
process
.
env
.
VUE_APP_TITLE
}
}
}
};
</
script
>
<
style
scoped
>
#app
.theme-picker
{
display
:
none
;
}
</
style
>
<
template
>
<div
id=
"app"
>
<router-view
/>
<theme-picker
/>
</div>
</
template
>
<
script
>
import
ThemePicker
from
'@/components/ThemePicker'
export
default
{
name
:
'App'
,
components
:
{
ThemePicker
},
metaInfo
()
{
return
{
title
:
this
.
$store
.
state
.
settings
.
dynamicTitle
&&
this
.
$store
.
state
.
settings
.
title
,
titleTemplate
:
title
=>
{
return
title
?
`
${
title
}
-
${
process
.
env
.
VUE_APP_TITLE
}
`
:
process
.
env
.
VUE_APP_TITLE
}
}
}
}
</
script
>
<
style
scoped
>
#app
.theme-picker
{
display
:
none
;
}
</
style
>
src/main.js
View file @
186b12fc
import
Vue
from
'vue'
import
Cookies
from
'js-cookie'
import
Element
from
'element-ui'
import
'./assets/styles/element-variables.scss'
import
'@/assets/styles/index.scss'
// global css
import
'@/assets/styles/ruoyi.scss'
// ruoyi css
import
App
from
'./App'
import
store
from
'./store'
import
router
from
'./router'
import
directive
from
'./directive'
// directive
import
plugins
from
'./plugins'
// plugins
import
{
download
}
from
'@/utils/request'
import
'./assets/icons'
// icon
import
'./permission'
// permission control
import
{
getDicts
}
from
"@/api/system/dict/data"
;
import
{
getConfigKey
}
from
"@/api/system/config"
;
import
{
parseTime
,
resetForm
,
addDateRange
,
selectDictLabel
,
selectDictLabels
,
handleTree
}
from
"@/utils/ruoyi"
;
// 分页组件
import
Pagination
from
"@/components/Pagination"
;
// 自定义表格工具组件
import
RightToolbar
from
"@/components/RightToolbar"
// 富文本组件
import
Editor
from
"@/components/Editor"
// 文件上传组件
import
FileUpload
from
"@/components/FileUpload"
// 图片上传组件
import
ImageUpload
from
"@/components/ImageUpload"
// 图片预览组件
import
ImagePreview
from
"@/components/ImagePreview"
// 页面模板
import
PageStandard
from
"@/components/Page/standard"
// 字典标签组件
import
DictTag
from
'@/components/DictTag'
// 头部标签组件
import
VueMeta
from
'vue-meta'
// 字典数据组件
import
DictData
from
'@/components/DictData'
import
TalkItem
from
"@/components/TalkItem"
;
// if (process.env.NODE_ENV === 'production') {
// const { mockXHR } = require('../mock')
// mockXHR()
// }
// 全局方法挂载
Vue
.
prototype
.
getDicts
=
getDicts
Vue
.
prototype
.
getConfigKey
=
getConfigKey
Vue
.
prototype
.
parseTime
=
parseTime
Vue
.
prototype
.
resetForm
=
resetForm
Vue
.
prototype
.
addDateRange
=
addDateRange
Vue
.
prototype
.
selectDictLabel
=
selectDictLabel
Vue
.
prototype
.
selectDictLabels
=
selectDictLabels
Vue
.
prototype
.
download
=
download
Vue
.
prototype
.
handleTree
=
handleTree
// 全局组件挂载
Vue
.
component
(
'DictTag'
,
DictTag
)
Vue
.
component
(
'Pagination'
,
Pagination
)
Vue
.
component
(
'RightToolbar'
,
RightToolbar
)
Vue
.
component
(
'Editor'
,
Editor
)
Vue
.
component
(
'FileUpload'
,
FileUpload
)
Vue
.
component
(
'ImageUpload'
,
ImageUpload
)
Vue
.
component
(
'ImagePreview'
,
ImagePreview
)
Vue
.
component
(
'PageStandard'
,
PageStandard
)
Vue
.
component
(
'TalkItem'
,
TalkItem
)
Vue
.
use
(
directive
)
Vue
.
use
(
plugins
)
Vue
.
use
(
VueMeta
)
DictData
.
install
()
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/
Vue
.
use
(
Element
,
{
size
:
Cookies
.
get
(
'size'
)
||
'medium'
// set element-ui default size
})
Vue
.
config
.
productionTip
=
false
new
Vue
({
el
:
'#app'
,
router
,
store
,
render
:
h
=>
h
(
App
)
})
import
Vue
from
'vue'
import
Cookies
from
'js-cookie'
import
Element
from
'element-ui'
import
'./assets/styles/element-variables.scss'
import
'@/assets/styles/index.scss'
// global css
import
'@/assets/styles/ruoyi.scss'
// ruoyi css
import
App
from
'./App'
import
store
from
'./store'
import
router
from
'./router'
import
directive
from
'./directive'
// directive
import
plugins
from
'./plugins'
// plugins
import
{
download
}
from
'@/utils/request'
import
'./assets/icons'
// icon
import
'./permission'
// permission control
import
{
getDicts
}
from
'@/api/system/dict/data'
import
{
getConfigKey
}
from
'@/api/system/config'
import
{
parseTime
,
resetForm
,
addDateRange
,
selectDictLabel
,
selectDictLabels
,
handleTree
}
from
'@/utils/ruoyi'
// 分页组件
import
Pagination
from
'@/components/Pagination'
// 自定义表格工具组件
import
RightToolbar
from
'@/components/RightToolbar'
// 富文本组件
import
Editor
from
'@/components/Editor'
// 文件上传组件
import
FileUpload
from
'@/components/FileUpload'
// 图片上传组件
import
ImageUpload
from
'@/components/ImageUpload'
// 图片预览组件
import
ImagePreview
from
'@/components/ImagePreview'
// 页面模板
import
PageStandard
from
'@/components/Page/standard'
// 字典标签组件
import
DictTag
from
'@/components/DictTag'
// 头部标签组件
import
VueMeta
from
'vue-meta'
// 字典数据组件
import
DictData
from
'@/components/DictData'
import
TalkItem
from
'@/components/TalkItem'
// if (process.env.NODE_ENV === 'production') {
// const { mockXHR } = require('../mock')
// mockXHR()
// }
// 全局方法挂载
Vue
.
prototype
.
getDicts
=
getDicts
Vue
.
prototype
.
getConfigKey
=
getConfigKey
Vue
.
prototype
.
parseTime
=
parseTime
Vue
.
prototype
.
resetForm
=
resetForm
Vue
.
prototype
.
addDateRange
=
addDateRange
Vue
.
prototype
.
selectDictLabel
=
selectDictLabel
Vue
.
prototype
.
selectDictLabels
=
selectDictLabels
Vue
.
prototype
.
download
=
download
Vue
.
prototype
.
handleTree
=
handleTree
// 全局组件挂载
Vue
.
component
(
'DictTag'
,
DictTag
)
Vue
.
component
(
'Pagination'
,
Pagination
)
Vue
.
component
(
'RightToolbar'
,
RightToolbar
)
Vue
.
component
(
'Editor'
,
Editor
)
Vue
.
component
(
'FileUpload'
,
FileUpload
)
Vue
.
component
(
'ImageUpload'
,
ImageUpload
)
Vue
.
component
(
'ImagePreview'
,
ImagePreview
)
Vue
.
component
(
'PageStandard'
,
PageStandard
)
Vue
.
component
(
'TalkItem'
,
TalkItem
)
Vue
.
use
(
directive
)
Vue
.
use
(
plugins
)
Vue
.
use
(
VueMeta
)
DictData
.
install
()
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/
Vue
.
use
(
Element
,
{
size
:
Cookies
.
get
(
'size'
)
||
'medium'
// set element-ui default size
})
Vue
.
config
.
productionTip
=
false
new
Vue
({
el
:
'#app'
,
router
,
store
,
render
:
h
=>
h
(
App
)
})
src/permission.js
View file @
186b12fc
...
...
@@ -24,14 +24,17 @@ router.beforeEach((to, from, next) => {
if
(
store
.
getters
.
roles
.
length
===
0
)
{
isRelogin
.
show
=
true
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(()
=>
{
isRelogin
.
show
=
false
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
store
.
dispatch
(
'GetInfo'
)
.
then
(()
=>
{
isRelogin
.
show
=
false
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
Message
.
error
(
err
)
next
({
path
:
'/'
})
...
...
src/settings.js
View file @
186b12fc
module
.
exports
=
{
/**
* 侧边栏主题 深色主题theme-dark,浅色主题theme-light
*/
sideTheme
:
'theme-dark'
,
/**
* 是否系统布局配置
*/
showSettings
:
false
,
/**
* 是否显示顶部导航
*/
topNav
:
false
,
/**
* 是否显示 tagsView
*/
tagsView
:
true
,
/**
* 是否固定头部
*/
fixedHeader
:
false
,
/**
* 是否显示logo
*/
sidebarLogo
:
true
,
/**
* 是否显示动态标题
*/
dynamicTitle
:
false
,
/**
* @type {string | array} 'production' | ['production', 'development']
* @description Need show err logs component.
* The default is only used in the production env
* If you want to also use it in dev, you can pass ['production', 'development']
*/
errorLog
:
'production'
}
module
.
exports
=
{
/**
* 侧边栏主题 深色主题theme-dark,浅色主题theme-light
*/
sideTheme
:
'theme-dark'
,
/**
* 是否系统布局配置
*/
showSettings
:
false
,
/**
* 是否显示顶部导航
*/
topNav
:
false
,
/**
* 是否显示 tagsView
*/
tagsView
:
true
,
/**
* 是否固定头部
*/
fixedHeader
:
false
,
/**
* 是否显示logo
*/
sidebarLogo
:
true
,
/**
* 是否显示动态标题
*/
dynamicTitle
:
false
,
/**
* @type {string | array} 'production' | ['production', 'development']
* @description Need show err logs component.
* The default is only used in the production env
* If you want to also use it in dev, you can pass ['production', 'development']
*/
errorLog
:
'production'
}
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