Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
8fbef19a
提交
8fbef19a
编写于
11月 30, 2020
作者:
tony001
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev'
上级
d57a0885
61ceb2e8
变更
20
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
728 行增加
和
85 行删除
+728
-85
app-register.ts
src/app-register.ts
+6
-0
app-after-time.vue
src/components/app-after-time/app-after-time.vue
+5
-3
app-alert-group.vue
src/components/app-alert-group/app-alert-group.vue
+0
-1
app-color-picker.less
src/components/app-color-picker/app-color-picker.less
+24
-0
app-color-picker.vue
src/components/app-color-picker/app-color-picker.vue
+184
-0
app-color-span.vue
src/components/app-color-span/app-color-span.vue
+163
-0
app-input-ip.less
src/components/app-input-ip/app-input-ip.less
+8
-6
app-input-ip.vue
src/components/app-input-ip/app-input-ip.vue
+8
-4
app-map-position.vue
src/components/app-map-position/app-map-position.vue
+8
-5
app-picker.vue
src/components/app-picker/app-picker.vue
+15
-5
app-quick-group.vue
src/components/app-quick-group/app-quick-group.vue
+1
-1
app-sort-bar.less
src/components/app-sort-bar/app-sort-bar.less
+18
-2
app-sort-bar.vue
src/components/app-sort-bar/app-sort-bar.vue
+5
-3
login.vue
src/components/login/login.vue
+4
-38
loadding.ts
src/directive/loadding/loadding.ts
+149
-0
default.less
src/styles/default.less
+1
-1
http.ts
src/utils/http/http.ts
+46
-14
interceptor.ts
src/utils/interceptor/interceptor.ts
+32
-0
util.d.ts
src/utils/types/util.d.ts
+16
-2
util.ts
src/utils/util/util.ts
+35
-0
未找到文件。
src/app-register.ts
浏览文件 @
8fbef19a
...
...
@@ -104,6 +104,9 @@ import AppMapPosition from './components/app-map-position/app-map-position.vue';
import
AppSortBar
from
'./components/app-sort-bar/app-sort-bar.vue'
;
import
AppAfterTime
from
'./components/app-after-time/app-after-time.vue'
;
import
AppInputIp
from
'./components/app-input-ip/app-input-ip.vue'
;
import
Loadding
from
'./directive/loadding/loadding'
;
import
AppColorSpan
from
'./components/app-color-span/app-color-span.vue'
;
import
AppColorPicker
from
'./components/app-color-picker/app-color-picker.vue'
;
// 全局挂载UI实体服务注册中心
window
[
'uiServiceRegister'
]
=
uiServiceRegister
;
...
...
@@ -223,5 +226,8 @@ export const AppComponents = {
v
.
component
(
'app-sort-bar'
,
AppSortBar
);
v
.
component
(
'app-after-time'
,
AppAfterTime
);
v
.
component
(
'app-input-ip'
,
AppInputIp
);
v
.
directive
(
'loading'
,
Loadding
);
v
.
component
(
'app-color-span'
,
AppColorSpan
);
v
.
component
(
'app-color-picker'
,
AppColorPicker
);
},
};
\ No newline at end of file
src/components/app-after-time/app-after-time.vue
浏览文件 @
8fbef19a
...
...
@@ -12,6 +12,7 @@
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Prop
,
Emit
,
Watch
,
Model
}
from
'vue-property-decorator'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
moment
from
'moment'
;
@
Component
({})
export
default
class
AppAfterTime
extends
Vue
{
...
...
@@ -105,8 +106,9 @@ export default class AppAfterTime extends Vue {
*/
public
transTime
(){
if
(
this
.
value
){
let
oldTime
=
new
Date
(
this
.
value
).
getTime
();
let
nowTime
=
new
Date
().
getTime
();
let
dateString
:
any
=
'YYYY年MM月DD日'
||
'YYYY年MM月DD日 HH时mm分ss秒'
||
'YYYY-MM-DD HH:mm:ss'
||
'YYYY-MM-DD'
||
'YYYY/MM/DD HH:mm:ss'
||
'YYYY/MM/DD'
;
let
oldTime
=
moment
(
this
.
value
,
dateString
).
valueOf
();
let
nowTime
=
moment
().
valueOf
();
let
diffTime
=
nowTime
-
oldTime
;
if
(
diffTime
<
3600000
){
this
.
curvalue
=
Math
.
ceil
(
diffTime
/
60000
)
+
''
;
...
...
@@ -119,7 +121,7 @@ export default class AppAfterTime extends Vue {
this
.
diffTime
=
'days'
;
}
else
if
(
diffTime
<
31104000000
){
this
.
curvalue
=
Math
.
floor
(
diffTime
/
2592000000
)
+
''
;
this
.
diffTime
=
'mou
n
th'
;
this
.
diffTime
=
'mouth'
;
}
else
{
this
.
curvalue
=
Math
.
floor
(
diffTime
/
31104000000
)
+
''
;
this
.
diffTime
=
'years'
;
...
...
src/components/app-alert-group/app-alert-group.vue
浏览文件 @
8fbef19a
...
...
@@ -114,7 +114,6 @@ export default class AppAlertGroup extends Vue {
<
style
lang=
"less"
>
.view-body-messages {
margin-top: -10px;
margin-bottom: 6px;
}
</
style
>
\ No newline at end of file
src/components/app-color-picker/app-color-picker.less
0 → 100644
浏览文件 @
8fbef19a
.app-color-picker {
.el-color-picker__trigger {
border: none;
left: 6px;
.el-color-picker__color {
border: 0.5px solid #dcdee2;
cursor: pointer;
top: 20px;
width: 77%;
height: 5px;
left: 3px;
.el-icon-close {
display: none;
}
}
}
.ivu-icon {
font-size: 22px;
position: absolute;
top: 2px;
right: -1px;
cursor: pointer;
}
}
\ No newline at end of file
src/components/app-color-picker/app-color-picker.vue
0 → 100644
浏览文件 @
8fbef19a
<
template
>
<div
class=
"app-color-picker"
>
<el-input
v-model=
"curVal"
size=
"small"
ref=
"colorPicker"
:disabled=
"disabled"
:placeholder=
"placeholder"
>
<template
slot=
"suffix"
>
<el-color-picker
ref=
"picker"
v-model=
"colorValue"
@
change=
"colorChange"
size=
"small"
>
</el-color-picker>
<Icon
type=
"md-color-palette"
@
click=
"iconClick"
/>
</
template
>
</el-input>
</div>
</template>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
,
Prop
,
Model
}
from
'vue-property-decorator'
;
import
CodeListService
from
'@codelist/codelist-service'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
@
Component
({})
export
default
class
AppColorPicker
extends
Vue
{
/**
* 双向绑定表单项数据
*
* @type {*}
* @memberof AppColorPicker
*/
@
Model
(
'change'
)
public
value
:
any
;
/**
* 表单数据
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
()
public
data
:
any
;
/**
* 表单通讯对象
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
()
public
formState
?:
Subject
<
any
>
;
/**
* 禁用状态
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
({
default
:
false
})
public
disabled
?:
boolean
;
/**
* 占位提示
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
()
public
placeholder
?:
string
;
/**
* 上下文
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
()
public
context
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
()
public
viewparam
:
any
;
/**
* 颜色对应字段值
*
* @type {*}
* @memberof AppColorPicker
*/
@
Prop
()
public
color
:
any
;
/**
* 双向绑定颜色
*
* @type {*}
* @memberof AppColorPicker
*/
public
colorValue
:
any
=
null
;
/**
* 获取输入框值
*
* @type {*}
* @memberof AppColorPicker
*/
get
curVal
()
{
return
this
.
value
;
}
/**
* 设置值
*
* @type {*}
* @memberof AppColorPicker
*/
set
curVal
(
val
:
any
)
{
this
.
$emit
(
'change'
,
val
);
}
/**
* Vue生命周期
*
* @memberof AppColorPicker
*/
public
created
()
{
this
.
handleData
();
}
/**
* 数据处理
*
* @memberof AppColorPicker
*/
@
Watch
(
'value'
)
public
handleData
()
{
if
(
!
this
.
value
&&
!
this
.
color
)
{
return
;
}
this
.
colorValue
=
this
.
data
[
this
.
color
];
this
.
curVal
=
this
.
value
;
this
.
handleInputColor
(
this
.
colorValue
);
}
/**
* 数据处理
*
* @memberof AppColorPicker
*/
public
colorChange
(
color
:
any
)
{
this
.
handleInputColor
(
color
);
this
.
$emit
(
'colorChange'
,
{
name
:
this
.
color
,
value
:
color
});
}
/**
* 设置输入框字体颜色
*
* @memberof AppColorPicker
*/
public
handleInputColor
(
color
:
any
)
{
let
picker
:
any
=
this
.
$refs
.
colorPicker
;
if
(
picker
)
{
let
child
:
any
=
picker
.
$el
.
children
[
0
];
child
.
style
.
color
=
color
;
}
}
/**
* 模拟点击事件
*
* @memberof AppColorPicker
*/
public
iconClick
()
{
let
picker
:
any
=
this
.
$refs
.
picker
;
let
e
:
any
=
document
.
createEvent
(
'MouseEvent'
);
e
.
initEvent
(
'click'
,
true
,
true
);
if
(
picker
)
{
picker
.
$el
.
children
[
0
].
dispatchEvent
(
e
);
}
}
}
</
script
>
<
style
lang=
"less"
>
@import './app-color-picker.less';
</
style
>
src/components/app-color-span/app-color-span.vue
0 → 100644
浏览文件 @
8fbef19a
<
template
>
<div
class=
"app-color-span"
>
<span
v-if=
"color"
:style=
"
{ color:textColor }">
{{
text
?
text
:
'---'
}}
</span>
<template
v-else
>
<template
v-if=
"dataValue && dataValue.length > 0"
>
<span
v-for=
"(textItem,index) of dataValue"
:key=
"index"
class=
"text-color"
:style=
"
{ backgroundColor:textItem.color }">
{{
textItem
.
srfmajortext
?
textItem
.
srfmajortext
:
'---'
}}
</span>
</
template
>
<span
v-else
>
---
</span>
</template>
</div>
</template>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
,
Prop
,
Model
}
from
'vue-property-decorator'
;
import
CodeListService
from
'@codelist/codelist-service'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
@
Component
({
})
export
default
class
AppColorSpan
extends
Vue
{
/**
* 当前值
*
* @type {*}
* @memberof AppColorSpan
*/
@
Prop
()
public
value
:
any
;
/**
* 当前表单项名称
*
* @type {*}
* @memberof AppColorSpan
*/
@
Prop
()
public
name
?:
any
;
/**
* 代码表类型
*
* @type {string}
* @memberof AppColorSpan
*/
@
Prop
()
public
codelistType
?:
string
;
/**
* 传入表单数据
*
* @type {*}
* @memberof AppColorSpan
*/
@
Prop
()
public
data
?:
any
;
/**
* 局部上下文导航参数
*
* @type {any}
* @memberof AppColorSpan
*/
@
Prop
()
public
localContext
!
:
any
;
/**
* 局部导航参数
*
* @type {any}
* @memberof AppColorSpan
*/
@
Prop
()
public
localParam
!
:
any
;
/**
* 视图上下文
*
* @type {*}
* @memberof AppColorSpan
*/
@
Prop
()
public
context
!
:
any
;
/**
* 视图参数
*
* @type {*}
* @memberof AppColorSpan
*/
@
Prop
()
public
viewparams
!
:
any
;
/**
* 颜色标识
*
* @type {*}
* @memberof AppColorSpan
*/
@
Prop
()
color
:
any
;
/**
* 颜色
*
* @type {*}
* @memberof AppColorSpan
*/
public
textColor
:
any
;
/**
* 显示值
* @type {*}
* @memberof AppColorSpan
*/
public
text
:
any
=
''
;
/**
* 数据数组
*
* @type {*}
* @memberof AppColorSpan
*/
public
dataValue
:
Array
<
any
>
=
[];
/**
* 监听value
*
* @memberof AppColorSpan
*/
@
Watch
(
'value'
)
public
valueChange
(
newVal
:
any
,
oldVal
:
any
){
if
(
newVal
!==
oldVal
){
this
.
load
();
}
}
/**
* 加载数据
*
* @memberof AppColorSpan
*/
public
load
(){
if
(
this
.
color
){
this
.
text
=
this
.
value
;
this
.
textColor
=
this
.
data
[
this
.
color
];
}
else
{
this
.
dataValue
=
JSON
.
parse
(
this
.
value
);
}
}
/**
* vue 生命周期
*
* @memberof AppColorSpan
*/
public
created
()
{
this
.
load
();
}
}
</
script
>
<
style
lang=
"less"
>
.text-color{
padding: 2px;
margin: 6px;
border-radius: 4px;
}
</
style
>
\ No newline at end of file
src/components/app-input-ip/app-input-ip.less
浏览文件 @
8fbef19a
input{
border-radius: 4px;
border:1px solid #888;
padding: 2px 10px;
width: 20%;
}
.app-inpu-ip{
display: flex;
flex-wrap: nowrap;
.el-input{
margin-right: 3px;
margin-left: 3px;
}
}
\ No newline at end of file
src/components/app-input-ip/app-input-ip.vue
浏览文件 @
8fbef19a
<
template
>
<div
class=
"app-inpu-ip"
>
<input
<
el-
input
type=
"text"
size=
"small"
v-model=
"firstIp"
maxlength=
"3"
/>
.
<input
<
el-
input
type=
"text"
size=
"small"
v-model=
"secIp"
maxlength=
"3"
/>
.
<input
<
el-
input
type=
"text"
size=
"small"
maxlength=
"3"
v-model=
"thirdIp"
/>
.
<input
<
el-
input
type=
"text"
size=
"small"
maxlength=
"3"
v-model=
"forIp"
/>
</div>
...
...
src/components/app-map-position/app-map-position.vue
浏览文件 @
8fbef19a
...
...
@@ -115,7 +115,7 @@ export default class AppMapPosition extends Vue {
* @type {*}
* @memberof AppMapPosition
*/
@
Prop
()
public
formState
!
:
Subject
<
any
>
;
;
@
Prop
()
public
formState
!
:
Subject
<
any
>
;
/**
* 搜索框显示值
...
...
@@ -234,7 +234,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition
*/
public
initMap
()
{
if
(
!
this
.
mode
||
!
this
.
value
)
{
if
(
!
this
.
mode
)
{
return
;
}
if
(
Object
.
is
(
this
.
mode
,
'address'
))
{
...
...
@@ -252,7 +252,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition
*/
public
initByAddress
()
{
if
(
this
.
longitude
&&
this
.
latitude
&&
this
.
data
)
{
if
(
this
.
longitude
&&
this
.
latitude
&&
this
.
data
&&
this
.
value
)
{
const
position
=
[
this
.
data
[
this
.
longitude
],
this
.
data
[
this
.
latitude
]];
Object
.
assign
(
this
.
marker
,
{
position
:
position
,
...
...
@@ -278,7 +278,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition
*/
public
initByLng
()
{
if
(
this
.
latitude
&&
this
.
data
)
{
if
(
this
.
latitude
&&
this
.
data
&&
this
.
value
)
{
this
.
handleMarker
(
this
.
value
,
this
.
data
[
this
.
latitude
],
this
);
}
else
{
Object
.
assign
(
this
.
marker
,
{
...
...
@@ -296,7 +296,7 @@ export default class AppMapPosition extends Vue {
* @memberof AppMapPosition
*/
public
initByLat
()
{
if
(
this
.
longitude
&&
this
.
data
)
{
if
(
this
.
longitude
&&
this
.
data
&&
this
.
value
)
{
this
.
handleMarker
(
this
.
data
[
this
.
longitude
],
this
.
value
,
this
);
}
else
{
Object
.
assign
(
this
.
marker
,
{
...
...
@@ -333,6 +333,9 @@ export default class AppMapPosition extends Vue {
public
handleMapShow
()
{
this
.
resultShow
=
false
;
this
.
dialogShow
=
true
;
if
(
!
this
.
markerResult
||
JSON
.
stringify
(
this
.
markerResult
)
==
"{}"
)
{
return
;
}
this
.
searchAddress
=
this
.
markerResult
.
address
;
Object
.
assign
(
this
.
marker
,
this
.
markerResult
);
this
.
center
=
this
.
markerResult
.
position
;
...
...
src/components/app-picker/app-picker.vue
浏览文件 @
8fbef19a
...
...
@@ -6,7 +6,8 @@
<div
class=
'app-picker'
>
<el-autocomplete
class=
'text-value'
:value-key=
"deMajorField"
:disabled=
"disabled"
v-model=
"curvalue"
size=
'small'
:trigger-on-focus=
"true"
:fetch-suggestions=
"(query, callback) =>
{ this.onSearch(query, callback, true) }" @select="onACSelect"
@input="onInput" @blur="onBlur" style='width:100%;'>
@input="onInput" @blur="onBlur" style='width:100%;'
:placeholder="placeholder">
<template
v-slot:default=
"
{item}">
<!--
<template
v-if=
"item.isNew"
>
<div
v-if=
"linkview"
@
click=
"newAndEdit"
>
{{
$t
(
'components.appPicker.newAndEdit'
)
}}
</div>
...
...
@@ -26,7 +27,7 @@
</div>
<div
v-else-if=
"Object.is(editortype, 'pickup-no-ac')"
class=
'app-picker'
>
<div
class=
'app-picker'
>
<el-input
class=
'text-value'
:value=
"curvalue"
readonly
size=
'small'
:disabled=
"disabled"
>
<el-input
class=
'text-value'
:
placeholder=
"placeholder"
:
value=
"curvalue"
readonly
size=
'small'
:disabled=
"disabled"
>
<
template
slot=
'suffix'
>
<i
v-if=
"curvalue && !disabled"
class=
'el-icon-circle-close'
@
click=
"onClear"
></i>
<i
class=
'el-icon-search'
@
click=
"openView"
></i>
...
...
@@ -38,7 +39,8 @@
<div
v-else-if=
"Object.is(editortype, 'dropdown')"
class=
'app-picker'
>
<el-select
ref=
"appPicker"
remote
:remote-method=
"(query) => this.onSearch(query, null, true)"
:value=
"refvalue"
size=
'small'
filterable
@
change=
"onSelect"
:disabled=
"disabled"
style=
'width:100%;'
clearable
popper-class=
"app-picker-dropdown"
@
clear=
"onClear"
@
visible-change=
"onSelectOpen"
>
@
clear=
"onClear"
@
visible-change=
"onSelectOpen"
:placeholder=
"placeholder"
>
<
template
v-if=
"items"
>
<template
v-for=
"_item in items"
>
<el-option
v-if=
"!_item.tag"
:key=
"_item[deKeyField]"
:value=
"_item[deKeyField]"
:label=
"_item[deMajorField]"
:disabled=
"_item.disabled"
></el-option>
...
...
@@ -222,6 +224,14 @@ export default class AppPicker extends Vue {
*/
@
Model
(
'change'
)
public
value
?:
any
;
/**
* 占位提示
*
* @type {*}
* @memberof AppPicker
*/
@
Prop
()
public
placeholder
?:
string
;
/**
* 当前值
*
...
...
@@ -258,7 +268,7 @@ export default class AppPicker extends Vue {
* @type {string}
* @memberof AppPicker
*/
public
selectValue
=
this
.
value
;
public
selectValue
=
null
;
/**
* 下拉列表节点元素
...
...
@@ -291,6 +301,7 @@ export default class AppPicker extends Vue {
@
Watch
(
'value'
,{
immediate
:
true
})
public
onValueChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
curvalue
=
newVal
;
this
.
selectValue
=
newVal
;
if
(
Object
.
is
(
this
.
editortype
,
'dropdown'
)
&&
this
.
valueitem
)
{
const
value
=
this
.
data
[
this
.
valueitem
];
const
index
=
this
.
items
.
findIndex
((
item
:
any
)
=>
Object
.
is
(
item
.
value
,
value
));
...
...
@@ -421,7 +432,6 @@ export default class AppPicker extends Vue {
* @param item
*/
public
onACSelect
(
item
:
any
):
void
{
this
.
selectValue
=
item
[
this
.
deMajorField
];
if
(
this
.
valueitem
)
{
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
this
.
valueitem
,
value
:
item
[
this
.
deKeyField
]
});
}
...
...
src/components/app-quick-group/app-quick-group.vue
浏览文件 @
8fbef19a
...
...
@@ -144,7 +144,7 @@ export default class AppQuickGroup extends Vue {
* @memberof AppQuickGroup
*/
public
handleClick
(
$event
:
any
,
isswitch
:
boolean
=
true
){
if
(
this
.
selectedUiItem
&&
(
this
.
selectedUiItem
.
id
===
$event
.
id
))
{
if
(
(
this
.
selectedUiItem
&&
(
this
.
selectedUiItem
.
id
===
$event
.
id
))
||
$event
.
children
)
{
return
;
}
this
.
$emit
(
'valuechange'
,
$event
);
...
...
src/components/app-sort-bar/app-sort-bar.less
浏览文件 @
8fbef19a
...
...
@@ -63,6 +63,22 @@
}
}
}
.slide-in(@x-begin,@x-end,@c-begin,@c-end,@name){
@keyframes @name{
from {
transform: translateX(@x-begin);
background-color: @c-begin;
}
to {
transform: translateX(@x-end);
background-color: @c-end;
}
}
}
.slide-in(1670px,0px,#fff,#EEF2F5,fadein);
.animation(@animation-name,@animation-duration,@animation-timing-function,@animation-delay,@play-state){
animation: @arguments;
};
.open-bar {
background-color: #EEF2F5;
}
\ No newline at end of file
.animation(fadein,0.7s,linear,0s,forwards);
};
\ No newline at end of file
src/components/app-sort-bar/app-sort-bar.vue
浏览文件 @
8fbef19a
<
template
>
<div
:class=
"['app-sort-bar', isSort ? 'open-bar' : '']"
>
<div
:class=
"['app-sort-bar', isSort ? 'open-bar' : ''
,
]"
>
<row
v-if=
"sortModel && sortModel.length>0"
class=
"page-sort-bar"
:gutter=
"10"
type=
"flex"
justify=
"start"
style=
"margin:0px;"
>
<template
v-for=
"(item, index) in sortModel"
>
<i-col
v-show=
"isSort"
:key=
"index"
:class=
"getSortClass(item)"
>
<div
@
click=
"sortItemClick(item)"
>
<div
>
<div
@
click=
"sortItemClick(item)"
>
<span
class=
"sort-field-text"
>
{{
$t
(
'entities.'
+
entityName
+
'.fields.'
+
item
)
}}
</span>
<span
class=
"caret-wrapper"
>
<Icon
type=
"md-arrow-dropup"
/>
<Icon
type=
"md-arrow-dropdown"
/>
</span>
</div>
</div>
</i-col>
</
template
>
<div
class=
"issort"
@
click=
"handleSort"
>
...
...
@@ -48,7 +51,6 @@ export default class AppSortBar extends Vue {
}
public
sortItemClick
(
name
:
string
)
{
console
.
log
(
name
);
this
.
$emit
(
'clickSort'
,
name
);
}
...
...
src/components/login/login.vue
浏览文件 @
8fbef19a
...
...
@@ -74,7 +74,7 @@
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
}
from
'vue-property-decorator'
;
import
{
Environment
}
from
'@/environments/environment'
;
//import Divider from "ibiz-vue-lib/lib/ibiz-vue-lib.common"
;
import
{
Util
}
from
'@/utils'
;
@
Component
({
components
:
{}
...
...
@@ -141,7 +141,7 @@ export default class Login extends Vue {
}
public
mounted
()
{
this
.
getCookie
(
"loginname"
);
Util
.
getCookie
(
"loginname"
);
}
/**
...
...
@@ -181,13 +181,13 @@ export default class Login extends Vue {
const
data
=
response
.
data
;
if
(
data
&&
data
.
token
)
{
localStorage
.
setItem
(
'token'
,
data
.
token
);
this
.
setCookie
(
'ibzuaa-token'
,
data
.
token
,
0
);
Util
.
setCookie
(
'ibzuaa-token'
,
data
.
token
,
0
);
}
if
(
data
&&
data
.
user
){
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
// 设置cookie,保存账号密码7天
this
.
setCookie
(
"loginname"
,
loginname
,
7
);
Util
.
setCookie
(
"loginname"
,
loginname
,
7
);
// 跳转首页
const
url
:
any
=
this
.
$route
.
query
.
redirect
?
this
.
$route
.
query
.
redirect
:
'*'
;
this
.
$router
.
push
({
path
:
url
});
...
...
@@ -223,40 +223,6 @@ export default class Login extends Vue {
_this
.
form
=
{
loginname
:
'ibzadmin'
,
password
:
'123456'
}
}
/**
* 设置cookie
*
* @memberof Login
*/
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
let
curDate
=
new
Date
();
let
curTamp
=
curDate
.
getTime
();
let
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
let
passedTamp
=
curTamp
-
curWeeHours
;
let
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
let
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTamp
+
curTamp
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
}
else
{
document
.
cookie
=
name
+
"="
+
escape
(
value
);
}
}
/**
* 获取cookie
*
* @memberof Login
*/
public
getCookie
(
name
:
any
):
any
{
let
arr
;
let
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
unescape
(
arr
[
2
]);
else
return
null
;
}
/**
* qq授权登录
* @param thirdpart
...
...
src/directive/loadding/loadding.ts
0 → 100644
浏览文件 @
8fbef19a
import
{
Http
}
from
'@/utils'
;
import
{
Subscription
}
from
'rxjs'
;
/**
* 按钮loadding状态服务
*
* @export
* @class LoaddingService
*/
export
class
LoaddingService
{
/**
* 单例变量声明
*
* @private
* @static
* @type {LoaddingService}
* @memberof LoaddingService
*/
private
static
loaddingService
:
LoaddingService
;
/**
* loadding状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof LoaddingService
*/
public
loaddingStateEvent
:
Subscription
|
undefined
;
/**
* 获取 LoaddingService 单例对象
*
* @static
* @returns {LoaddingService}
* @memberof LoaddingService
*/
public
static
getInstance
():
LoaddingService
{
if
(
!
LoaddingService
.
loaddingService
)
{
LoaddingService
.
loaddingService
=
new
LoaddingService
();
}
return
this
.
loaddingService
;
}
/**
* 初始化指令所绑定的元素状态
*
* @param {any} el 指令所绑定的元素
* @param {any} binding 指令附加参数
* @memberof LoaddingService
*/
public
initElement
(
el
:
any
,
binding
:
any
){
if
(
binding
&&
binding
.
arg
){
// 工具栏按钮
if
(
Object
.
is
(
binding
.
arg
,
'i-button'
)){
if
(
el
.
getElementsByTagName
(
'i'
)
&&
el
.
getElementsByTagName
(
'i'
).
length
>
0
){
let
iconElement
:
any
=
el
.
getElementsByTagName
(
'i'
)[
0
];
iconElement
.
setAttribute
(
'ownclassname'
,
iconElement
.
className
);
}
}
}
}
/**
* 设置loadding状态
*
* @param {any} el 指令所绑定的元素
* @param {any} binding 指令附加参数
* @memberof LoaddingService
*/
public
setLoadState
(
el
:
any
,
binding
:
any
){
this
.
loaddingStateEvent
=
Http
.
getInstance
().
getNotifyObject
().
subscribe
((
result
:
any
)
=>
{
if
(
result
&&
result
.
action
&&
Object
.
is
(
result
.
action
,
'setloadstate'
)){
if
(
result
&&
result
.
state
){
this
.
addLoadState
(
el
,
binding
);
}
else
{
this
.
removeLoadState
(
el
,
binding
);
}
}
})
}
/**
* 添加loadding状态
*
* @param {any} el 指令所绑定的元素
* @param {any} binding 指令附加参数
* @memberof LoaddingService
*/
public
addLoadState
(
el
:
any
,
binding
:
any
){
if
(
binding
&&
binding
.
arg
){
el
.
style
.
pointerEvents
=
'none'
;
// 工具栏按钮
if
(
Object
.
is
(
binding
.
arg
,
'i-button'
)){
if
(
el
.
getElementsByTagName
(
'i'
)
&&
el
.
getElementsByTagName
(
'i'
).
length
>
0
){
let
iconElement
:
any
=
el
.
getElementsByTagName
(
'i'
)[
0
];
iconElement
.
className
=
"el-icon-loading"
;
}
}
}
}
/**
* 移除loadding状态
*
* @param {any} el 指令所绑定的元素
* @param {any} binding 指令附加参数
* @memberof LoaddingService
*/
public
removeLoadState
(
el
:
any
,
binding
:
any
){
if
(
binding
&&
binding
.
arg
){
el
.
style
.
pointerEvents
=
''
;
// 工具栏按钮
if
(
Object
.
is
(
binding
.
arg
,
'i-button'
)){
if
(
el
.
getElementsByTagName
(
'i'
)
&&
el
.
getElementsByTagName
(
'i'
).
length
>
0
){
let
iconElement
:
any
=
el
.
getElementsByTagName
(
'i'
)[
0
];
iconElement
.
className
=
iconElement
.
getAttribute
(
'ownclassname'
);
}
}
}
}
/**
* 清除资源(取消订阅)
*
* @param {any} el 指令所绑定的元素
* @param {any} binding 指令附加参数
* @memberof LoaddingService
*/
public
clearResource
(
el
:
any
,
binding
:
any
){
if
(
this
.
loaddingStateEvent
){
this
.
loaddingStateEvent
.
unsubscribe
();
}
}
}
export
default
{
bind
(
el
:
any
,
binding
:
any
)
{
LoaddingService
.
getInstance
().
initElement
(
el
,
binding
);
},
inserted
(
el
:
any
,
binding
:
any
)
{
LoaddingService
.
getInstance
().
setLoadState
(
el
,
binding
);
},
unbind
(
el
:
any
,
binding
:
any
)
{
LoaddingService
.
getInstance
().
clearResource
(
el
,
binding
);
}
}
\ No newline at end of file
src/styles/default.less
浏览文件 @
8fbef19a
...
...
@@ -246,7 +246,7 @@
}
}
.view-container.degridview, .view-container.degridview9, .view-container.dewfgridview, .view-container.delistview, .view-container.delistview9, .view-container.dedataview, .view-container.dedataview9,.view-container.dechartview,.view-container.dechartview9{
.view-container.degridview, .view-container.degridview9, .view-container.dewfgridview, .view-container.delistview, .view-container.delistview9, .view-container.dedataview, .view-container.dedataview9,.view-container.dechartview,.view-container.dechartview9
,.view-container.decalendarview,.view-container.decalendarview9
{
>.view-card.view-no-caption{
>.ivu-card-body{
height: 100%;
...
...
src/utils/http/http.ts
浏览文件 @
8fbef19a
...
...
@@ -2,6 +2,8 @@ import axios from 'axios';
import
{
Loading
}
from
'element-ui'
;
import
{
ElLoadingComponent
}
from
'element-ui/types/loading'
;
import
qs
from
'qs'
;
import
{
Subject
}
from
'rxjs'
;
/**
* Http net 对象
* 调用 getInstance() 获取实例
...
...
@@ -10,20 +12,6 @@ import qs from 'qs';
*/
export
class
Http
{
/**
* 获取 Http 单例对象
*
* @static
* @returns {Http}
* @memberof Http
*/
public
static
getInstance
():
Http
{
if
(
!
Http
.
Http
)
{
Http
.
Http
=
new
Http
();
}
return
this
.
Http
;
}
/**
* 单例变量声明
*
...
...
@@ -42,6 +30,28 @@ export class Http {
*/
private
loadingCount
:
number
=
0
;
/**
* 数据传递对象
*
* @type {Subject}
* @memberof Http
*/
private
subject
:
Subject
<
any
>
=
new
Subject
<
any
>
();
/**
* 获取 Http 单例对象
*
* @static
* @returns {Http}
* @memberof Http
*/
public
static
getInstance
():
Http
{
if
(
!
Http
.
Http
)
{
Http
.
Http
=
new
Http
();
}
return
this
.
Http
;
}
/**
* load状态管理器
*
...
...
@@ -227,6 +237,7 @@ export class Http {
body
:
true
,
fullscreen
:
true
,
});
this
.
notifyLoadState
(
true
);
}
this
.
loadingCount
++
;
}
...
...
@@ -244,6 +255,7 @@ export class Http {
setTimeout
(()
=>
{
if
(
this
.
loadingCount
===
0
)
{
this
.
elLoadingComponent
.
close
();
this
.
notifyLoadState
(
false
);
}
},
500
);
}
...
...
@@ -265,4 +277,24 @@ export class Http {
return
data
;
}
/**
* 获取通知对象
*
* @public
* @memberof Http
*/
public
getNotifyObject
(){
return
this
.
subject
;
}
/**
* 通知loadding状态
*
* @private
* @memberof Http
*/
private
notifyLoadState
(
loadingState
:
boolean
){
this
.
subject
.
next
({
action
:
'setloadstate'
,
state
:
loadingState
});
}
}
\ No newline at end of file
src/utils/interceptor/interceptor.ts
浏览文件 @
8fbef19a
...
...
@@ -3,6 +3,9 @@ import axios from 'axios';
import
Router
from
'vue-router'
;
import
i18n
from
'@/locale'
;
import
{
Environment
}
from
'@/environments/environment'
;
import
{
Http
}
from
'../http/http'
;
import
{
Util
}
from
'../util/util'
;
/**
* 拦截器
*
...
...
@@ -104,6 +107,9 @@ export class Interceptors {
});
axios
.
interceptors
.
response
.
use
((
response
:
any
)
=>
{
if
(
response
.
headers
&&
response
.
headers
[
'refreshtoken'
]
&&
localStorage
.
getItem
(
'token'
)){
this
.
refreshToken
(
response
);
}
return
response
;
},
(
error
:
any
)
=>
{
error
=
error
?
error
:
{
response
:
{}
};
...
...
@@ -174,4 +180,30 @@ export class Interceptors {
}
}
/**
* 刷新token
*
* @private
* @param {*} [data={}]
* @memberof Interceptors
*/
private
refreshToken
(
data
:
any
=
{}):
void
{
if
(
data
&&
data
.
config
&&
(
data
.
config
.
url
==
"/uaa/refreshToken"
)){
return
;
}
Http
.
getInstance
().
post
(
'/uaa/refreshToken'
,
localStorage
.
getItem
(
'token'
),
false
).
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
const
data
=
response
.
data
;
if
(
data
)
{
localStorage
.
setItem
(
'token'
,
data
);
Util
.
setCookie
(
'ibzuaa-token'
,
data
,
0
);
}
}
else
{
console
.
log
(
"刷新token出错"
);
}
}).
catch
((
error
:
any
)
=>
{
console
.
log
(
"刷新token出错"
);
});
}
}
\ No newline at end of file
src/utils/types/util.d.ts
浏览文件 @
8fbef19a
...
...
@@ -153,7 +153,7 @@ export declare interface Util {
* @returns {string}
* @memberof Util
*/
dateFormat
(
date
:
any
,
fmt
?:
string
):
string
dateFormat
(
date
:
any
,
fmt
?:
string
):
string
;
/**
* 表单项校验
...
...
@@ -164,7 +164,21 @@ export declare interface Util {
* @returns {Promise}
* @memberof Util
*/
validateItem
(
property
:
string
,
data
:
any
,
rules
:
any
):
Promise
<
any
>
validateItem
(
property
:
string
,
data
:
any
,
rules
:
any
):
Promise
<
any
>
;
/**
* 设置cookie
*
* @memberof Util
*/
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
):
void
;
/**
* 获取cookie
*
* @memberof Util
*/
getCookie
(
name
:
any
):
any
;
}
declare
module
"vue/types/vue"
{
...
...
src/utils/util/util.ts
浏览文件 @
8fbef19a
...
...
@@ -427,4 +427,39 @@ export class Util {
// 校验返回Promise
return
schema
.
validate
({
[
property
]:
value
})
}
/**
* 设置cookie
*
* @memberof Util
*/
public
static
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
let
curDate
=
new
Date
();
let
curTamp
=
curDate
.
getTime
();
let
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
let
passedTamp
=
curTamp
-
curWeeHours
;
let
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
let
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTamp
+
curTamp
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
}
else
{
document
.
cookie
=
name
+
"="
+
escape
(
value
);
}
}
/**
* 获取cookie
*
* @memberof Util
*/
public
static
getCookie
(
name
:
any
):
any
{
let
arr
;
let
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
unescape
(
arr
[
2
]);
else
return
null
;
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录