Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
Overview
Details
Activity
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
姜雷
dcxy-manage-shell
Commits
e1d900bc
Commit
e1d900bc
authored
May 23, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'master'
Test See merge request
!115
parents
1daefbe1
a68bd9bf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
7 deletions
+27
-7
babel.config.js
babel.config.js
+6
-1
validate.js
src/api/validate.js
+6
-1
Api.js
src/lib/Api.js
+10
-5
index.js
src/store/modules/user/index.js
+1
-0
index.js
src/utils/index.js
+4
-0
No files found.
babel.config.js
View file @
e1d900bc
const
removeConsolePlugin
=
[];
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
removeConsolePlugin
.
push
(
'transform-remove-console'
);
removeConsolePlugin
.
push
([
'transform-remove-console'
,
{
exclude
:
[
'error'
,
'warn'
],
},
]);
}
module
.
exports
=
{
...
...
src/api/validate.js
View file @
e1d900bc
...
...
@@ -17,8 +17,13 @@ export const validateCode = res => {
type
:
'warning'
,
}
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
)
.
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
})
.
catch
(
err
=>
{
console
.
error
(
'FedLogOutErr: '
,
err
);
});
});
return
Promise
.
reject
(
res
);
...
...
src/lib/Api.js
View file @
e1d900bc
import
axios
from
'axios'
;
import
{
Message
,
MessageBox
}
from
'element-ui'
;
import
store
from
'../store'
;
import
{
SUCCESS_CODE
}
from
'@/config'
;
import
{
SUCCESS_CODE
,
LOGOUT_CODE
}
from
'@/config'
;
import
{
errorHandle
}
from
'@/api/validate'
;
import
{
getYourIP
}
from
'@/utils/getIp.js'
;
...
...
@@ -24,16 +24,16 @@ const createBaseFetch = config => {
store
.
dispatch
(
'fetchStart'
,
notLoading
);
if
(
store
.
getters
.
token
)
{
conf
.
headers
=
{
...
conf
.
headers
,
reqSource
:
'pc'
,
token
:
store
.
getters
.
token
,
ip
:
ip
,
...
conf
.
headers
,
};
}
else
{
conf
.
headers
=
{
...
conf
.
headers
,
reqSource
:
'pc'
,
ip
:
ip
,
...
conf
.
headers
,
};
}
...
...
@@ -73,7 +73,7 @@ const createBaseFetch = config => {
});
// -2:其他客户端登录了;Token 过期了;
if
(
res
.
code
===
'-2'
)
{
if
(
res
.
code
===
LOGOUT_CODE
)
{
if
(
logout
)
return
;
logout
=
true
;
MessageBox
.
confirm
(
...
...
@@ -86,8 +86,13 @@ const createBaseFetch = config => {
}
)
.
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
)
.
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
})
.
catch
(
err
=>
{
console
.
error
(
'FedLogOutErr: '
,
err
);
});
})
.
catch
(
err
=>
{
...
...
src/store/modules/user/index.js
View file @
e1d900bc
...
...
@@ -66,6 +66,7 @@ const actions = {
// 前端 登出
FedLogOut
({
commit
})
{
return
new
Promise
(
resolve
=>
{
console
.
debug
(
'in FedLogOut'
);
commit
(
SET_TOKEN
,
''
);
removeToken
();
resolve
();
...
...
src/utils/index.js
View file @
e1d900bc
...
...
@@ -354,6 +354,7 @@ export const allowLetterNumber = value => {
export
const
formatterMoneyToDouble
=
val
=>
{
return
val
?
Number
(
val
).
toFixed
(
2
)
:
Number
(
0
).
toFixed
(
2
);
};
export
const
formatPrice
=
price
=>
{
var
result
=
[],
counter
=
0
;
...
...
@@ -361,6 +362,9 @@ export const formatPrice = price => {
result
.
push
(
price
.
slice
(
-
3
).
join
(
''
));
for
(
var
i
=
price
.
length
-
4
;
i
>=
0
;
i
--
)
{
counter
++
;
if
(
i
==
0
&&
isNaN
(
Number
(
price
[
i
]))
&&
result
[
0
]
===
','
)
{
result
.
shift
();
}
result
.
unshift
(
price
[
i
]);
if
(
!
(
counter
%
3
)
&&
i
!=
0
)
{
result
.
unshift
(
','
);
...
...
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