Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
supply-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 62ccbc52
authored
Sep 12, 2020
by
wangql
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/glsx-business/supply-web
2 parents
792a9147
bd55c611
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
33 deletions
src/layout/header-aside/layout.vue
src/libs/util.db.js
src/main.js
src/router/index.js
src/layout/header-aside/layout.vue
View file @
62ccbc5
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<div
class=
"d2-header-right"
flex-box=
"0"
>
<div
class=
"d2-header-right"
flex-box=
"0"
>
<d2-header-datetime
/>
<d2-header-datetime
/>
<!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" -->
<!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" -->
<
d2-header-search
@
click=
"handleSearchClick"
/
>
<
!--
<d2-header-search
@
click=
"handleSearchClick"
/>
--
>
<!--
<d2-header-log
v-if=
"$env === 'development'"
/>
-->
<!--
<d2-header-log
v-if=
"$env === 'development'"
/>
-->
<!--
<d2-header-size/>
-->
<!--
<d2-header-size/>
-->
<d2-header-fullscreen/>
<d2-header-fullscreen/>
...
...
src/libs/util.db.js
View file @
62ccbc5
...
@@ -2,20 +2,20 @@ import low from 'lowdb'
...
@@ -2,20 +2,20 @@ import low from 'lowdb'
import
LocalStorage
from
'lowdb/adapters/LocalStorage'
import
LocalStorage
from
'lowdb/adapters/LocalStorage'
import
util
from
'@/libs/util'
import
util
from
'@/libs/util'
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
const
adapter
=
new
LocalStorage
(
`
${
process
.
env
.
VUE_APP_STORAGE_PREFIX
}
-
${
process
.
env
.
VUE_APP_VERSION
}
`
,
{
//
const adapter = new LocalStorage(`${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}`, {
serialize
:
(
data
)
=>
isDev
?
JSON
.
stringify
(
data
)
:
escape
(
JSON
.
stringify
(
data
)),
//
serialize: (data) => isDev ? JSON.stringify(data) : escape(JSON.stringify(data)),
deserialize
:
(
data
)
=>
isDev
?
JSON
.
parse
(
data
)
:
JSON
.
parse
(
unescape
(
data
))
//
deserialize: (data) => isDev ? JSON.parse(data) : JSON.parse(unescape(data))
})
//
})
const
db
=
low
(
adapter
)
//
const db = low(adapter)
db
//
db
.
defaults
({
//
.defaults({
sys
:
{},
//
sys: {},
database
:
{}
//
database: {}
})
//
})
.
write
()
//
.write()
export
default
db
//
export default db
/**
/**
* @description 检查路径是否存在 不存在的话初始化
* @description 检查路径是否存在 不存在的话初始化
...
@@ -31,16 +31,16 @@ export function pathInit({
...
@@ -31,16 +31,16 @@ export function pathInit({
path
=
''
,
path
=
''
,
user
=
true
,
user
=
true
,
validator
=
()
=>
true
,
validator
=
()
=>
true
,
defaultValue
=
''
defaultValue
=
'
.
'
})
{
})
{
const
uuid
=
util
.
cookies
.
get
(
'uuid'
)
||
'ghost-uuid'
const
uuid
=
util
.
cookies
.
get
(
'uuid'
)
||
'ghost-uuid'
const
currentPath
=
`
${
dbName
}
.
${
user
?
`user.
${
uuid
}
`
:
'public'
}${
path
?
`.
${
path
}
`
:
''
}
`
const
currentPath
=
`
${
dbName
}
.
${
user
?
`user.
${
uuid
}
`
:
'public'
}${
path
?
`.
${
path
}
`
:
''
}
`
const
value
=
db
.
get
(
currentPath
).
value
()
//
const value = db.get(currentPath).value()
if
(
!
(
value
!==
undefined
&&
validator
(
value
)))
{
//
if (!(value !== undefined && validator(value))) {
db
//
db
.
set
(
currentPath
,
defaultValue
)
//
.set(currentPath, defaultValue)
.
write
()
//
.write()
}
//
}
return
currentPath
return
currentPath
}
}
...
@@ -58,11 +58,16 @@ export function dbSet({
...
@@ -58,11 +58,16 @@ export function dbSet({
value
=
''
,
value
=
''
,
user
=
false
user
=
false
})
{
})
{
db
.
set
(
pathInit
({
// db.set(pathInit({
dbName
,
// dbName,
path
,
// path,
user
// user
}),
value
).
write
()
// }), value).write()
localStorage
.
setItem
(
pathInit
({
dbName
,
path
,
user
}),
JSON
.
stringify
(
value
))
}
}
/**
/**
...
@@ -84,12 +89,17 @@ export function dbGet({
...
@@ -84,12 +89,17 @@ export function dbGet({
user
,
user
,
defaultValue
)
defaultValue
)
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
resolve
(
_
.
cloneDeep
(
db
.
get
(
pathInit
({
// resolve(_.cloneDeep(db.get(pathInit({
// dbName,
// path,
// user,
// defaultValue
// })).value()))
resolve
(
JSON
.
parse
(
localStorage
.
getItem
(
pathInit
({
dbName
,
dbName
,
path
,
path
,
user
,
user
defaultValue
}))))
})).
value
()))
})
})
}
}
...
...
src/main.js
View file @
62ccbc5
...
@@ -37,7 +37,7 @@ new Vue({
...
@@ -37,7 +37,7 @@ new Vue({
store
,
store
,
// i18n,
// i18n,
render
:
h
=>
h
(
App
),
render
:
h
=>
h
(
App
),
//
created () {
created
()
{
// 处理路由 得到每一级的路由设置
// 处理路由 得到每一级的路由设置
// this.$store.commit('d2admin/page/init', frameInRoutes)
// this.$store.commit('d2admin/page/init', frameInRoutes)
// 设置顶栏菜单 (暂时不需要)
// 设置顶栏菜单 (暂时不需要)
...
@@ -46,7 +46,7 @@ new Vue({
...
@@ -46,7 +46,7 @@ new Vue({
// this.$store.commit('d2admin/menu/asideSet', menuAside)
// this.$store.commit('d2admin/menu/asideSet', menuAside)
// 初始化菜单搜索功能
// 初始化菜单搜索功能
// this.$store.commit('d2admin/search/init', menuHeader)
// this.$store.commit('d2admin/search/init', menuHeader)
//
},
},
mounted
()
{
mounted
()
{
Vue
.
config
.
devtools
=
true
Vue
.
config
.
devtools
=
true
// 展示系统信息
// 展示系统信息
...
...
src/router/index.js
View file @
62ccbc5
...
@@ -22,7 +22,6 @@ Vue.use(VueRouter)
...
@@ -22,7 +22,6 @@ Vue.use(VueRouter)
const
router
=
new
VueRouter
({
const
router
=
new
VueRouter
({
routes
routes
})
})
const
setCurrent
=
path
=>
{
const
setCurrent
=
path
=>
{
return
new
Promise
(
async
resolve
=>
{
return
new
Promise
(
async
resolve
=>
{
path
!==
'/login'
&&
await
store
.
dispatch
(
'd2admin/page/currentSet'
,
path
)
path
!==
'/login'
&&
await
store
.
dispatch
(
'd2admin/page/currentSet'
,
path
)
...
@@ -44,6 +43,7 @@ router.beforeEach(async(to, from, next) => {
...
@@ -44,6 +43,7 @@ router.beforeEach(async(to, from, next) => {
await
setCurrent
(
to
.
fullPath
)
await
setCurrent
(
to
.
fullPath
)
// 进度条
// 进度条
NProgress
.
start
()
NProgress
.
start
()
store
.
dispatch
(
'd2admin/account/login'
,{
loginName
:
'155454'
,
password
:
'5541514'
,
method
:
'fims.user.loginTem'
});
// 关闭搜索面板
// 关闭搜索面板
store
.
commit
(
'd2admin/search/set'
,
false
)
store
.
commit
(
'd2admin/search/set'
,
false
)
if
(
from
.
name
===
null
&&
to
.
path
!==
'/login'
&&
!
source
)
{
// 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
if
(
from
.
name
===
null
&&
to
.
path
!==
'/login'
&&
!
source
)
{
// 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
...
@@ -63,7 +63,6 @@ router.beforeEach(async(to, from, next) => {
...
@@ -63,7 +63,6 @@ router.beforeEach(async(to, from, next) => {
}
}
}
}
})
})
router
.
afterEach
(
to
=>
{
router
.
afterEach
(
to
=>
{
// 进度条
// 进度条
NProgress
.
done
()
NProgress
.
done
()
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment