Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
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
周远喜
mes-ui
Commits
27eb9b6d
Commit
27eb9b6d
authored
Oct 27, 2020
by
骆瑛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生命周期
parent
e7c84fbe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
711 additions
and
141 deletions
+711
-141
life.vue
components/page/life.vue
+274
-0
state.vue
components/page/state.vue
+12
-2
api.js
pages/test/api.js
+37
-33
index.vue
pages/test/statueLine/index.vue
+280
-0
iview.js
plugins/iview.js
+108
-106
No files found.
components/page/life.vue
0 → 100644
View file @
27eb9b6d
<
template
>
<div
class=
"datalife"
>
<div
class=
"bigBing"
:style=
"
{width:220*bigNum+'px'}" v-if="mode">
<div
v-for=
"(item, index) in data"
:key=
"index"
class=
"linebox"
>
<div
class=
"box"
:class=
"curIndex == index ? 'boxBorder1':curIndex
<index
?
'
boxBorder2
'
:
'
boxBorder
'
"
>
<Tag
type=
"dot"
:color=
"item.color?item.color:tagColor"
>
{{
item
.
name
}}
</Tag>
</div>
<div
class=
"line"
:class=
"[curIndex == index ? 'borderBotCol1' : curIndex
<index
?
'
borderBotCol2
'
:
'
borderBotCol
']"
v-if=
"bigNum != index+1"
>
<span
class=
"item arrow-right"
:class=
"[curIndex==index? 'boxBorder1' :curIndex
<index
?
'
boxBorder2
'
:
'
boxBorder
']"
></span>
</div>
</div>
</div>
<div
class=
"bigBing"
:style=
"
{width:240*bigNum+'px'}" v-else>
<div
class=
"lifeBox"
v-for=
"(item, index) in data"
:key=
"index"
>
<div
class=
"arrow-left"
>
<b
class=
"right"
v-if=
"index != 0"
>
<i
class=
"right-arrow"
:class=
"curIndex==index ? 'rightCol1' :curIndex
<index
?
'
rightCol2
'
:
'
rightCol
'
"
></i><i
class=
"right-arrow2"
></i>
</b>
</div>
<div
class=
"lifeBoxfish"
:class=
"[curIndex==index? 'boxBorder1' : curIndex
<index
?
'
boxBorder2
'
:
'
boxBorder
',
bigNum
!=
index
+
1
?
'
borderR
'
:
'
borderR1
',
]"
>
<Tag
type=
"dot"
:color=
"item.color?item.color:tagColor"
>
{{
item
.
name
}}
</Tag>
</div>
<div
class=
"arrow-right"
>
<b
class=
"right"
v-if=
"bigNum != index + 1"
><i
class=
"right-arrow"
:class=
"curIndex==index ? 'rightCol1' : curIndex
<index
?
'
rightCol2
'
:
'
rightCol
'
"
></i><i
class=
"right-arrow2"
></i
></b>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
"life"
,
data
()
{
return
{
data
:[],
tagColor
:
'#000'
,
bigNum
:
0
,
curIndex
:
-
1
,
};
},
props
:{
code
:{
//字典编码
type
:
String
,
default
:
"Process.routing_detail.resource_type"
},
row
:{
//行数据
type
:
Object
},
value
:{
//当前值
type
:[
String
,
Number
]
},
mode
:{
//显示形式
type
:
String
,
default
:
""
}
},
created
()
{
this
.
data
=
this
.
$store
.
getters
.
dictionaryByKey
(
this
.
code
)
||
[];
this
.
bigNum
=
this
.
data
.
length
;
this
.
data
.
forEach
((
u
,
i
)
=>
{
if
(
u
.
code
==
this
.
value
){
this
.
curIndex
=
i
;
}
})
},
methods
:
{
},
};
</
script
>
<
style
lang=
"less"
>
.datalife {
overflow-x: auto;
.linebox {
display: inline-flex;
.box {
background: white;
border-radius: 4px;
width: 120px;
height: 50px;
line-height: 50px;
margin: 10px 0 20px 8px;
text-align: center;
border: 3px solid;
.ivu-tag-dot{
font-weight: bolder;
font-size: 14px;
height: 100%;
line-height: 43px;
border: 0px solid #e8eaec !important;
width: 100%;
background: transparent !important;
}
}
.boxBorder {
border-color: #0dd78d;
}
.boxBorder1 {
border-color: #5b9ff0;
}
.boxBorder2 {
border-color: #b8bcc4;
}
.borderBotCol {
border-bottom: 3px solid #0dd78d;
}
.borderBotCol1 {
border-bottom: 3px solid #5b9ff0;
}
.borderBotCol2 {
border-bottom: 3px solid #b8bcc4;
}
.line {
position: relative;
width: 100px;
height: 20px;
margin-top: 21px;
margin-left: -3px;
z-index: 3;
border-left: 4px solid white;
/* 向右的箭头 */
.item {
position: absolute;
right: -6px;
top: 10px;
float: left;
clear: both;
margin-bottom: 23px;
}
.arrow-right {
font-size: 0;
line-height: 0;
border-width: 10px;
border-right-width: 0;
border-style: dashed;
border-left-style: solid;
border-top-color: transparent;
border-bottom-color: transparent;
}
}
}
.lifeBox {
display: inline-flex;
position: relative;
width: 220px;
.lifeBoxfish {
line-height: 50px;
text-align: center;
width: 200px;
// padding: 0 20px;
height: 50px;
border: 3px solid;
margin: 10px 0 20px 8px;
background: white;
.ivu-tag-dot{
font-weight: bolder;
font-size: 14px;
height: 100%;
line-height: 43px;
border: 0px solid #e8eaec !important;
width: 100%;
background: transparent !important;
}
.borderR {
border-right-color: #0dd78d;
}
.borderR1 {
border-right-color: transparent;
}
}
.boxBorder {
border-color: #0dd78d;
}
.boxBorder1 {
border-color: #5b9ff0;
}
.boxBorder2 {
border-color: #b8bcc4;
}
.arrow-left {
position: relative;
/*右箭头*/
.right {
width: 30px;
height: 50px;
position: absolute;
left: 8px;
top: 10px;
}
.right-arrow,
.right-arrow2 {
width: 0;
height: 0;
display: block;
position: absolute;
left: 0;
top: 0;
border-top: 25px transparent dashed;
border-right: 2px transparent dashed;
border-bottom: 25px transparent dashed;
/* border-left: 10px white solid !important; */
overflow: hidden;
}
.right-arrow {
left: 1px;
/*重要*/
border-left: 17px solid;
}
.right-arrow2 {
border-left: 16px white solid;
}
.rightCol{
border-left-color: #0dd78d;
}
.rightCol1{
border-left-color: #5b9ff0;
}
.rightCol2{
border-left-color: #b8bcc4;
}
}
.arrow-right {
position: relative;
/*右箭头*/
.right {
width: 30px;
height: 50px;
position: absolute;
left: -2px;
top: 10px;
}
.right-arrow,
.right-arrow2 {
width: 0;
height: 0;
display: block;
position: absolute;
left: 0;
top: 0;
border-top: 25px transparent dashed;
border-right: 2px transparent dashed;
border-bottom: 25px transparent dashed;
/* border-left: 10px white solid !important; */
overflow: hidden;
}
.right-arrow {
left: 1px;
/*重要*/
border-left: 17px solid;
}
.right-arrow2 {
border-left: 16px white solid;
}
.rightCol{
border-left-color: #0dd78d;
}
.rightCol1{
border-left-color: #5b9ff0;
}
.rightCol2{
border-left-color: #b8bcc4;
}
}
}
}
</
style
>
\ No newline at end of file
components/page/state.vue
View file @
27eb9b6d
<
template
>
<div
class=
"ib"
>
<div
class=
"ib"
@
click=
"showLife"
>
<div
class=
"ib"
v-if=
"!isMore"
>
<span
v-if=
"type=='text'"
:style=
"style"
>
{{
name
}}
</span>
<Tag
v-if=
"type=='tag'"
:color=
"tagcolor"
>
{{
name
}}
</Tag>
...
...
@@ -11,6 +11,9 @@
<Tag
v-if=
"type=='tag'"
:color=
"li.tagcolor"
>
{{
li
.
name
}}
</Tag>
<Badge
v-if=
"type=='dot'"
:color=
"li.tagcolor"
:text=
"li.name"
/>
</div>
<Modal
v-model=
"modal"
title=
"生命周期"
width=
"800"
footer-hide
:mask-closable=
"false"
>
<component
:is=
"detail"
:code=
"code"
:value=
"value"
:mode=
"mode"
/>
</Modal>
</div>
</
template
>
<
script
>
...
...
@@ -18,11 +21,14 @@ export default {
name
:
"state"
,
data
()
{
return
{
mode
:
'0'
,
name
:
""
,
isMore
:
false
,
modal
:
false
,
item
:
{},
items
:
[],
data
:
[]
data
:
[],
detail
:
null
,
};
},
props
:
{
...
...
@@ -94,6 +100,10 @@ export default {
this
.
items
=
items
;
}
}
,
showLife
(){
this
.
modal
=
true
;
this
.
detail
=
()
=>
import
(
"./life"
);
}
},
computed
:
{
tagcolor
()
{
...
...
pages/test/api.js
View file @
27eb9b6d
export
const
exampleRouter
=
[
{
export
const
exampleRouter
=
[{
// path:'/test/example/components/:id',
route
:
'/test/example/components'
,
icon
:
'md-add'
,
name
:
'components'
,
title
:
'基础组件'
,
children
:
[{
route
:
'/test/example/tag'
,
title
:
'tag组件'
,
name
:
'components-tag'
,
icon
:
'ios-albums'
},
{
route
:
'/test/example/table'
,
title
:
'表格'
,
name
:
'components-table'
,
icon
:
'md-aperture'
},
{
route
:
'/test/example/tree'
,
title
:
'树'
,
name
:
'tree'
,
icon
:
'md-aperture'
},
{
route
:
'/test/example/select'
,
title
:
'select组件'
,
name
:
'components-select'
,
icon
:
'md-arrow-dropdown'
},
]
},
]
route
:
'/test/example/components'
,
icon
:
'md-add'
,
name
:
'components'
,
title
:
'基础组件'
,
children
:
[{
route
:
'/test/example/tag'
,
title
:
'tag组件'
,
name
:
'components-tag'
,
icon
:
'ios-albums'
},
{
route
:
'/test/example/table'
,
title
:
'表格'
,
name
:
'components-table'
,
icon
:
'md-aperture'
},
{
route
:
'/test/example/tree'
,
title
:
'树'
,
name
:
'tree'
,
icon
:
'md-aperture'
},
{
route
:
'/test/example/select'
,
title
:
'select组件'
,
name
:
'components-select'
,
icon
:
'md-arrow-dropdown'
},
{
route
:
'/test/statueLine'
,
title
:
'生命周期'
,
name
:
'components-statuLine'
,
icon
:
'md-arrow-dropdown'
},
]
},
]
export
default
exampleRouter
;
\ No newline at end of file
pages/test/statueLine/index.vue
0 → 100644
View file @
27eb9b6d
<
template
>
<div
class=
"datalife"
>
<div
class=
"bigBing"
v-if=
"mode"
>
<div
v-for=
"(item, index) in data"
:key=
"index"
class=
"linebox"
>
<div
class=
"box"
:class=
"curIndex == index ? 'boxBorder1':curIndex
<index
?
'
boxBorder
'
:
'
boxBorder2
'
"
>
<Tag
type=
"dot"
:color=
"item.color?item.color:tagColor"
>
{{
item
.
name
}}
</Tag>
</div>
<div
class=
"line"
:class=
"[curIndex == index ? 'borderBotCol1' : curIndex
<index
?
'
borderBotCol
'
:
'
borderBotCol2
']"
v-if=
"bigNum != index+1"
>
<span
class=
"item arrow-right"
:class=
"[curIndex==index? 'boxBorder1' :curIndex
<index
?
'
boxBorder
'
:
'
boxBorder2
']"
></span>
</div>
</div>
</div>
<div
class=
"bigBing"
v-else
>
<div
class=
"lifeBox"
v-for=
"(item, index) in data"
:key=
"index"
>
<div
class=
"arrow-left"
>
<b
class=
"right"
v-if=
"index != 0"
>
<i
class=
"right-arrow"
:class=
"curIndex==index ? 'rightCol1' :curIndex
<index
?
'
rightCol2
'
:
'
rightCol
'
"
></i><i
class=
"right-arrow2"
></i>
</b>
</div>
<div
class=
"lifeBoxfish"
:class=
"[curIndex==index? 'boxBorder1' : curIndex
<index
?
'
boxBorder2
'
:
'
boxBorder
',
bigNum
!=
index
+
1
?
'
borderR
'
:
'
borderR1
',
]"
>
<Tag
type=
"dot"
:color=
"item.color?item.color:tagColor"
>
{{
item
.
name
}}
</Tag>
</div>
<div
class=
"arrow-right"
>
<b
class=
"right"
v-if=
"bigNum != index + 1"
><i
class=
"right-arrow"
:class=
"curIndex==index ? 'rightCol1' : curIndex
<index
?
'
rightCol2
'
:
'
rightCol
'
"
></i><i
class=
"right-arrow2"
></i
></b>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
// name: "",
data
()
{
return
{
data
:[],
tagColor
:
'#000'
,
bigNum
:
0
,
curIndex
:
-
1
,
};
},
props
:{
code
:{
//字典编码
type
:
String
,
default
:
"Process.routing_detail.resource_type"
},
row
:{
//行数据
type
:
Object
},
value
:{
//当前值
type
:[
String
,
Number
]
},
mode
:{
//显示形式
type
:
String
,
default
:
""
}
},
watch
:
{},
created
()
{
this
.
data
=
this
.
$store
.
getters
.
dictionaryByKey
(
this
.
code
)
||
[];
this
.
bigNum
=
this
.
data
.
length
;
this
.
data
.
forEach
((
u
,
i
)
=>
{
if
(
u
.
code
==
this
.
value
){
this
.
curIndex
=
i
;
}
})
console
.
log
(
"data"
,
this
.
data
)
},
methods
:
{
},
};
</
script
>
<
style
lang=
"less"
>
.datalife {
.bigBing{
width: 100%;
}
.linebox {
display: inline-flex;
.box {
background: white;
border-radius: 4px;
width: 120px;
height: 50px;
line-height: 50px;
margin: 10px 0 20px 8px;
text-align: center;
border: 3px solid;
.ivu-tag-dot{
font-weight: bolder;
font-size: 14px;
height: 100%;
line-height: 43px;
border: 0px solid #e8eaec !important;
width: 100%;
background: transparent !important;
}
}
.boxBorder {
border-color: #0dd78d;
}
.boxBorder1 {
border-color: #5b9ff0;
}
.boxBorder2 {
border-color: #b8bcc4;
}
.borderBotCol {
border-bottom: 3px solid #0dd78d;
}
.borderBotCol1 {
border-bottom: 3px solid #5b9ff0;
}
.borderBotCol2 {
border-bottom: 3px solid #b8bcc4;
}
.line {
position: relative;
width: 100px;
height: 20px;
margin-top: 21px;
margin-left: -3px;
z-index: 3;
border-left: 4px solid white;
/* 向右的箭头 */
.item {
position: absolute;
right: -6px;
top: 10px;
float: left;
clear: both;
margin-bottom: 23px;
}
.arrow-right {
font-size: 0;
line-height: 0;
border-width: 10px;
border-right-width: 0;
border-style: dashed;
border-left-style: solid;
border-top-color: transparent;
border-bottom-color: transparent;
}
}
}
.lifeBox {
display: inline-flex;
position: relative;
width: 220px;
.lifeBoxfish {
line-height: 50px;
text-align: center;
width: 200px;
// padding: 0 20px;
height: 50px;
border: 3px solid;
margin: 10px 0 20px 8px;
background: white;
.ivu-tag-dot{
font-weight: bolder;
font-size: 14px;
height: 100%;
line-height: 43px;
border: 0px solid #e8eaec !important;
width: 100%;
background: transparent !important;
}
.borderR {
border-right-color: #0dd78d;
}
.borderR1 {
border-right-color: transparent;
}
}
.boxBorder {
border-color: #0dd78d;
}
.boxBorder1 {
border-color: #5b9ff0;
}
.boxBorder2 {
border-color: #b8bcc4;
}
.arrow-left {
position: relative;
/*右箭头*/
.right {
width: 30px;
height: 50px;
position: absolute;
left: 8px;
top: 10px;
}
.right-arrow,
.right-arrow2 {
width: 0;
height: 0;
display: block;
position: absolute;
left: 0;
top: 0;
border-top: 25px transparent dashed;
border-right: 2px transparent dashed;
border-bottom: 25px transparent dashed;
/* border-left: 10px white solid !important; */
overflow: hidden;
}
.right-arrow {
left: 1px;
/*重要*/
border-left: 17px solid;
}
.right-arrow2 {
border-left: 16px white solid;
}
.rightCol{
border-left-color: #0dd78d;
}
.rightCol1{
border-left-color: #5b9ff0;
}
.rightCol2{
border-left-color: #b8bcc4;
}
}
.arrow-right {
position: relative;
/*右箭头*/
.right {
width: 30px;
height: 50px;
position: absolute;
left: -2px;
top: 10px;
}
.right-arrow,
.right-arrow2 {
width: 0;
height: 0;
display: block;
position: absolute;
left: 0;
top: 0;
border-top: 25px transparent dashed;
border-right: 2px transparent dashed;
border-bottom: 25px transparent dashed;
/* border-left: 10px white solid !important; */
overflow: hidden;
}
.right-arrow {
left: 1px;
/*重要*/
border-left: 17px solid;
}
.right-arrow2 {
border-left: 16px white solid;
}
.rightCol{
border-left-color: #0dd78d;
}
.rightCol1{
border-left-color: #5b9ff0;
}
.rightCol2{
border-left-color: #b8bcc4;
}
}
}
}
</
style
>
\ No newline at end of file
plugins/iview.js
View file @
27eb9b6d
...
...
@@ -52,6 +52,7 @@ import imgUploadFile from '@/components/page/imgUploadFile.vue'
import
files
from
'@/components/page/files.vue'
import
FilesList
from
'@/components/page/filesList.vue'
import
FilesView
from
'@/components/page/filesView.vue'
import
Life
from
'@/components/page/life.vue'
import
DataGrid
from
'@/components/page/dataGrid.vue'
import
TreeGrid
from
'@/components/page/treeGrid/index.vue'
...
...
@@ -92,12 +93,12 @@ Vue.use(VueEditor)
Vue
.
use
(
Viewer
)
Viewer
.
setDefaults
({
zIndexInline
:
2017
})
// Vue.use(Element, {
// size: 'small',
// zIndex: 3000
// });
zIndexInline
:
2017
})
// Vue.use(Element, {
// size: 'small',
// zIndex: 3000
// });
// 内置组件
import
iLink
from
'@/components/link'
;
...
...
@@ -126,7 +127,7 @@ Vue.component("Materiel", Materiel)
Vue
.
component
(
"RoleSelect"
,
RoleSelect
)
Vue
.
component
(
"UserExamSelect"
,
UserExamSelect
)
Vue
.
component
(
"WorkShopSelect"
,
WorkShopSelect
)
Vue
.
component
(
"WorkShopName"
,
WorkShopName
)
Vue
.
component
(
"WorkShopName"
,
WorkShopName
)
Vue
.
component
(
"workShopDefault"
,
workShopDefault
)
Vue
.
component
(
"WorkShop"
,
WorkShop
)
Vue
.
component
(
"EquipSelect"
,
EquipSelect
)
...
...
@@ -146,115 +147,116 @@ Vue.component("OutputTime", OutputTime)
Vue
.
component
(
"ViewerImg"
,
ViewerImg
)
Vue
.
component
(
"StoreTree"
,
StoreTree
)
Vue
.
component
(
"StoreSelect"
,
StoreSelect
)
Vue
.
component
(
"ImportExcel"
,
ImportExcel
)
Vue
.
component
(
"CustomProperties"
,
CustomProperties
)
Vue
.
component
(
"InputCode"
,
InputCode
)
Vue
.
component
(
"Pictrue"
,
Pictrue
)
Vue
.
component
(
"WordTree"
,
WordTree
)
Vue
.
component
(
"Actions"
,
Actions
)
Vue
.
component
(
"TimeDifference"
,
TimeDifference
)
Vue
.
component
(
"ImportExcel"
,
ImportExcel
)
Vue
.
component
(
"CustomProperties"
,
CustomProperties
)
Vue
.
component
(
"InputCode"
,
InputCode
)
Vue
.
component
(
"Pictrue"
,
Pictrue
)
Vue
.
component
(
"WordTree"
,
WordTree
)
Vue
.
component
(
"Actions"
,
Actions
)
Vue
.
component
(
"TimeDifference"
,
TimeDifference
)
Vue
.
component
(
"Life"
,
Life
)
//注入mock
// require("../mock")
Vue
.
prototype
.
$api
=
request
;
Vue
.
prototype
.
$http
=
Api
;
Vue
.
prototype
.
$api
=
request
;
Vue
.
prototype
.
$http
=
Api
;
Vue
.
prototype
.
$u
=
Henq
;
export
default
({
app
,
store
app
,
store
})
=>
{
Vue
.
use
(
VueI18n
)
Vue
.
use
(
VueDND
)
app
.
i18n
=
new
VueI18n
({
locale
:
'zh-CN'
,
messages
:
Languages
});
app
.
i18n
.
locale
=
"zh-CN"
Vue
.
use
(
ViewUI
,
{
// locale:'zh-CN',
i18n
:
(
key
,
value
)
=>
app
.
i18n
.
t
(
key
,
value
)
})
Vue
.
use
(
iViewPro
);
Vue
.
use
(
BaiduMap
,
{
// ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
ak
:
'NMVkIGzyFBL6g3ekXIZqIYMCnvz74YOc'
})
Vue
.
prototype
.
$log
=
{
...
util
.
log
,
push
(
data
)
{
if
(
typeof
data
===
'string'
)
{
// 如果传递来的数据是字符串
// 赋值给 message 字段
// 为了方便使用
// eg: this.$log.push('foo text')
store
.
dispatch
(
'admin/log/push'
,
{
message
:
data
});
}
else
if
(
typeof
data
===
'object'
)
{
// 如果传递来的数据是对象
store
.
dispatch
(
'admin/log/push'
,
data
);
}
}
}
Vue
.
config
.
errorHandler
=
function
(
error
,
instance
,
info
)
{
Vue
.
nextTick
(()
=>
{
// store 追加 log
store
.
dispatch
(
'admin/log/push'
,
{
message
:
`
${
info
}
:
${
error
.
message
}
`
,
type
:
'error'
,
meta
:
{
error
// instance
}
});
// 只在开发模式下打印 log
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
util
.
log
.
capsule
(
'iView Admin'
,
'ErrorHandler'
,
'error'
);
util
.
log
.
error
(
'>>>>>> 错误信息 >>>>>>'
);
console
.
log
(
info
);
util
.
log
.
error
(
'>>>>>> Vue 实例 >>>>>>'
);
console
.
log
(
instance
);
util
.
log
.
error
(
'>>>>>> Error >>>>>>'
);
console
.
log
(
error
)
}
Vue
.
use
(
VueI18n
)
Vue
.
use
(
VueDND
)
app
.
i18n
=
new
VueI18n
({
locale
:
'zh-CN'
,
messages
:
Languages
});
app
.
i18n
.
locale
=
"zh-CN"
Vue
.
use
(
ViewUI
,
{
// locale:'zh-CN',
i18n
:
(
key
,
value
)
=>
app
.
i18n
.
t
(
key
,
value
)
})
Vue
.
use
(
iViewPro
);
Vue
.
use
(
BaiduMap
,
{
// ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
ak
:
'NMVkIGzyFBL6g3ekXIZqIYMCnvz74YOc'
})
}
Vue
.
prototype
.
$log
=
{
...
util
.
log
,
push
(
data
)
{
if
(
typeof
data
===
'string'
)
{
// 如果传递来的数据是字符串
// 赋值给 message 字段
// 为了方便使用
// eg: this.$log.push('foo text')
store
.
dispatch
(
'admin/log/push'
,
{
message
:
data
});
}
else
if
(
typeof
data
===
'object'
)
{
// 如果传递来的数据是对象
store
.
dispatch
(
'admin/log/push'
,
data
);
}
}
}
Vue
.
directive
(
'auth'
,{
inserted
(
el
,
binding
,
vnode
)
{
const
{
value
}
=
binding
;
const
access
=
store
.
state
.
admin
.
user
.
info
.
access
;
if
(
value
&&
value
instanceof
Array
&&
value
.
length
&&
access
&&
access
.
length
)
{
const
isPermission
=
includeArray
(
value
,
access
);
if
(
!
isPermission
)
{
el
.
parentNode
&&
el
.
parentNode
.
removeChild
(
el
);
}
}
}
}
)
Vue
.
directive
(
'paste'
,
{
bind
(
el
,
binding
,
vnode
)
{
el
.
addEventListener
(
'paste'
,
function
(
event
)
{
//这里直接监听元素的粘贴事件
binding
.
value
(
event
)
})
Vue
.
config
.
errorHandler
=
function
(
error
,
instance
,
info
)
{
Vue
.
nextTick
(()
=>
{
// store 追加 log
store
.
dispatch
(
'admin/log/push'
,
{
message
:
`
${
info
}
:
${
error
.
message
}
`
,
type
:
'error'
,
meta
:
{
error
// instance
}
});
// 只在开发模式下打印 log
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
util
.
log
.
capsule
(
'iView Admin'
,
'ErrorHandler'
,
'error'
);
util
.
log
.
error
(
'>>>>>> 错误信息 >>>>>>'
);
console
.
log
(
info
);
util
.
log
.
error
(
'>>>>>> Vue 实例 >>>>>>'
);
console
.
log
(
instance
);
util
.
log
.
error
(
'>>>>>> Error >>>>>>'
);
console
.
log
(
error
)
}
})
}
})
// 防重复点击(指令实现)
Vue
.
directive
(
'noClick'
,
{
inserted
(
el
,
binding
)
{
el
.
addEventListener
(
'click'
,
()
=>
{
if
(
!
el
.
disabled
)
{
el
.
disabled
=
true
setTimeout
(()
=>
{
el
.
disabled
=
false
},
binding
.
value
||
3000
)
Vue
.
directive
(
'auth'
,
{
inserted
(
el
,
binding
,
vnode
)
{
const
{
value
}
=
binding
;
const
access
=
store
.
state
.
admin
.
user
.
info
.
access
;
if
(
value
&&
value
instanceof
Array
&&
value
.
length
&&
access
&&
access
.
length
)
{
const
isPermission
=
includeArray
(
value
,
access
);
if
(
!
isPermission
)
{
el
.
parentNode
&&
el
.
parentNode
.
removeChild
(
el
);
}
}
}
})
}
})
// console.warn("this:",app.i18n.locale,app)
})
Vue
.
directive
(
'paste'
,
{
bind
(
el
,
binding
,
vnode
)
{
el
.
addEventListener
(
'paste'
,
function
(
event
)
{
//这里直接监听元素的粘贴事件
binding
.
value
(
event
)
})
}
})
// 防重复点击(指令实现)
Vue
.
directive
(
'noClick'
,
{
inserted
(
el
,
binding
)
{
el
.
addEventListener
(
'click'
,
()
=>
{
if
(
!
el
.
disabled
)
{
el
.
disabled
=
true
setTimeout
(()
=>
{
el
.
disabled
=
false
},
binding
.
value
||
3000
)
}
})
}
})
// console.warn("this:",app.i18n.locale,app)
}
\ No newline at end of file
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