Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
super-hive-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
front-end
super-hive-web
Commits
94b4cef2
Commit
94b4cef2
authored
Jul 30, 2020
by
wends
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove errorlog
parent
7fede577
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
165 deletions
+6
-165
README.md
README.md
+4
-24
index.vue
src/components/ErrorLog/index.vue
+0
-78
settings.js
src/settings.js
+0
-7
getters.js
src/store/getters.js
+1
-7
app.js
src/store/modules/app.js
+1
-21
errorLog.js
src/store/modules/errorLog.js
+0
-28
No files found.
README.md
View file @
94b4cef2
...
...
@@ -216,28 +216,6 @@ Object.keys(filters).forEach(key => {
})
```
### moment
moment 时间格式化工具
```
javascript
export
function
momentFilter
(
value
,
formatString
)
{
formatString
=
formatString
||
'
YYYY-MM-DD HH:mm:ss
'
if
(
value
===
undefined
)
{
return
null
}
return
moment
(
value
).
format
(
formatString
)
}
```
用在展示数据时把时间戳转换为带有固定格式的日期
```
javascript
{{
1587712722637
|
momentFilter
}}
```
除了 moment 之外还有 pluralize、timeAgo这些可以全局使用的过滤器
## 全局方法
在 main.js 中 Mixin 全局方法,全局混入的方法名加 $前缀,以便与实例内方法区分开
...
...
@@ -250,8 +228,10 @@ export function momentFilter(value, formatString) {
Vue
.
mixin
({
methods
:
{
$moment
(
row
,
column
,
cellValue
)
{
const
m
=
moment
(
cellValue
,
'
x
'
)
return
m
.
isValid
()
?
moment
(
cellValue
).
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
:
null
const
val
=
cellValue
||
row
const
m
=
moment
(
val
,
'
x
'
)
const
formatText
=
cellValue
?
(
format
||
'
YYYY-MM-DD HH:mm:ss
'
)
:
column
return
m
.
isValid
()
?
moment
(
cellValue
).
format
(
formatText
)
:
null
}
}
})
...
...
src/components/ErrorLog/index.vue
deleted
100644 → 0
View file @
7fede577
<
template
>
<div
v-if=
"errorLogs.length>0"
>
<el-badge
:is-dot=
"true"
style=
"line-height: 25px;margin-top: -5px;"
@
click.native=
"dialogTableVisible=true"
>
<el-button
style=
"padding: 8px 10px;"
size=
"small"
type=
"danger"
>
<svg-icon
icon-class=
"bug"
/>
</el-button>
</el-badge>
<el-dialog
:visible.sync=
"dialogTableVisible"
width=
"80%"
append-to-body
>
<div
slot=
"title"
>
<span
style=
"padding-right: 10px;"
>
Error Log
</span>
<el-button
size=
"mini"
type=
"primary"
icon=
"el-icon-delete"
@
click=
"clearAll"
>
Clear All
</el-button>
</div>
<el-table
:data=
"errorLogs"
border
>
<el-table-column
label=
"Message"
>
<template
slot-scope=
"
{row}">
<div>
<span
class=
"message-title"
>
Msg:
</span>
<el-tag
type=
"danger"
>
{{
row
.
err
.
message
}}
</el-tag>
</div>
<br>
<div>
<span
class=
"message-title"
style=
"padding-right: 10px;"
>
Info:
</span>
<el-tag
type=
"warning"
>
{{
row
.
vm
.
$vnode
.
tag
}}
error in
{{
row
.
info
}}
</el-tag>
</div>
<br>
<div>
<span
class=
"message-title"
style=
"padding-right: 16px;"
>
Url:
</span>
<el-tag
type=
"success"
>
{{
row
.
url
}}
</el-tag>
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"Stack"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
err
.
stack
}}
</
template
>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<
script
>
export
default
{
name
:
'
ErrorLog
'
,
data
()
{
return
{
dialogTableVisible
:
false
}
},
computed
:
{
errorLogs
()
{
return
this
.
$store
.
getters
.
errorLogs
}
},
methods
:
{
clearAll
()
{
this
.
dialogTableVisible
=
false
this
.
$store
.
dispatch
(
'
errorLog/clearErrorLog
'
)
}
}
}
</
script
>
<
style
scoped
>
.message-title
{
font-size
:
16px
;
color
:
#333
;
font-weight
:
bold
;
padding-right
:
8px
;
}
</
style
>
src/settings.js
View file @
94b4cef2
...
...
@@ -25,12 +25,5 @@ module.exports = {
*/
sidebarLogo
:
true
,
/**
* @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
'
,
overview
:
true
}
src/store/getters.js
View file @
94b4cef2
...
...
@@ -9,15 +9,9 @@ const getters = {
roles
:
state
=>
state
.
user
.
roles
,
permission_routes
:
state
=>
state
.
permission
.
routes
,
add_routes
:
state
=>
state
.
permission
.
addRoutes
,
errorLogs
:
state
=>
state
.
errorLog
.
logs
,
permissions
:
state
=>
state
.
permission
.
permissions
,
tokenValid
:
state
=>
state
.
user
.
tokenValid
,
userInfo
:
state
=>
state
.
user
.
userInfo
,
currentMenuId
:
state
=>
state
.
permission
.
currentMenuId
,
dictionary
:
state
=>
state
.
app
.
dictionary
,
regions
:
state
=>
state
.
app
.
regions
,
originalRegions
:
state
=>
state
.
app
.
originalRegions
,
goodsType
:
state
=>
state
.
app
.
goodsType
,
vehicleType
:
state
=>
state
.
app
.
vehicleType
currentMenuId
:
state
=>
state
.
permission
.
currentMenuId
}
export
default
getters
src/store/modules/app.js
View file @
94b4cef2
...
...
@@ -6,12 +6,7 @@ const state = {
withoutAnimation
:
false
},
device
:
'
desktop
'
,
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
,
dictionary
:
{},
regions
:
[],
originalRegions
:
[],
goodsType
:
[],
vehicleType
:
[]
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
}
const
mutations
=
{
...
...
@@ -35,21 +30,6 @@ const mutations = {
SET_SIZE
:
(
state
,
size
)
=>
{
state
.
size
=
size
Cookies
.
set
(
'
size
'
,
size
)
},
SET_DIST
:
(
state
,
dictionary
)
=>
{
state
.
dictionary
=
dictionary
},
SET_REGIONS
:
(
state
,
regions
)
=>
{
state
.
regions
=
regions
},
SET_ORIGINAL_REGIONS
:
(
state
,
originalRegions
)
=>
{
state
.
originalRegions
=
originalRegions
},
SET_GOODSTYPE
:
(
state
,
goodsType
)
=>
{
state
.
goodsType
=
goodsType
},
SET_VEHICLETYPE
:
(
state
,
vehicleType
)
=>
{
state
.
vehicleType
=
vehicleType
}
}
...
...
src/store/modules/errorLog.js
deleted
100644 → 0
View file @
7fede577
const
state
=
{
logs
:
[]
}
const
mutations
=
{
ADD_ERROR_LOG
:
(
state
,
log
)
=>
{
state
.
logs
.
push
(
log
)
},
CLEAR_ERROR_LOG
:
(
state
)
=>
{
state
.
logs
.
splice
(
0
)
}
}
const
actions
=
{
addErrorLog
({
commit
},
log
)
{
commit
(
'
ADD_ERROR_LOG
'
,
log
)
},
clearErrorLog
({
commit
})
{
commit
(
'
CLEAR_ERROR_LOG
'
)
}
}
export
default
{
namespaced
:
true
,
state
,
mutations
,
actions
}
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