Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
xqz
/
dianDemo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
fcfd1c4f
authored
2019-06-04 11:08:29 +0800
by
406803045
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加filters
1 parent
09485e79
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
16 deletions
src/filters/filter.js
src/filters/index.js
src/main.js
src/utils/request.js
src/utils/validate.js
src/filters/filter.js
0 → 100644
View file @
fcfd1c4
/*
* 隐藏用户手机号中间四位
*/
exports
.
hidePhone
=
phone
=>
{
return
phone
.
replace
(
/
(\d{3})\d{4}(\d{4})
/
,
'$1****$2'
)
}
\ No newline at end of file
src/filters/index.js
0 → 100644
View file @
fcfd1c4
import
Vue
from
'vue'
import
filter
from
'./filter'
Object
.
keys
(
filter
).
forEach
(
k
=>
Vue
.
filter
(
k
,
filter
[
k
]))
Vue
.
prototype
.
$hidePhone
=
Vue
.
filter
(
'hidePhone'
)
\ No newline at end of file
src/main.js
View file @
fcfd1c4
...
...
@@ -7,6 +7,7 @@ import 'lib-flexible/flexible.js'
import
App
from
'./App'
import
store
from
'./store'
import
router
from
'./router'
import
filters
from
'./filter'
Vue
.
config
.
productionTip
=
false
new
Vue
({
...
...
src/utils/request.js
View file @
fcfd1c4
...
...
@@ -34,22 +34,17 @@ service.interceptors.request.use(
service
.
interceptors
.
response
.
use
(
response
=>
{
Toast
.
clear
()
// 如果是数据流
if
(
response
.
config
.
responseType
===
'arraybuffer'
)
{
return
response
.
data
}
else
{
const
res
=
response
.
data
if
(
res
.
status
!==
200
)
{
// 登录超时,重新登录
if
(
res
.
status
===
401
)
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
location
.
reload
()
})
}
return
Promise
.
reject
(
res
||
'error'
)
}
else
{
return
Promise
.
resolve
(
res
)
const
res
=
response
.
data
if
(
res
.
status
&&
res
.
status
!==
200
)
{
// 登录超时,重新登录
if
(
res
.
status
===
401
)
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
location
.
reload
()
})
}
return
Promise
.
reject
(
res
||
'error'
)
}
else
{
return
Promise
.
resolve
(
res
)
}
},
error
=>
{
...
...
src/utils/validate.js
View file @
fcfd1c4
/**
* Created by
PanJiaChen on 16/11/18
.
* Created by
Sunnie on 19/06/04
.
*/
/**
...
...
Write
Preview
Styling with
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