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
a68bd9bf
Commit
a68bd9bf
authored
May 23, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
Develop See merge request
!114
parents
51fb0e85
c32f1a23
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 @
a68bd9bf
const
removeConsolePlugin
=
[];
const
removeConsolePlugin
=
[];
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
removeConsolePlugin
.
push
(
'transform-remove-console'
);
removeConsolePlugin
.
push
([
'transform-remove-console'
,
{
exclude
:
[
'error'
,
'warn'
],
},
]);
}
}
module
.
exports
=
{
module
.
exports
=
{
...
...
src/api/validate.js
View file @
a68bd9bf
...
@@ -17,8 +17,13 @@ export const validateCode = res => {
...
@@ -17,8 +17,13 @@ export const validateCode = res => {
type
:
'warning'
,
type
:
'warning'
,
}
}
).
then
(()
=>
{
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
)
.
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
})
.
catch
(
err
=>
{
console
.
error
(
'FedLogOutErr: '
,
err
);
});
});
});
});
return
Promise
.
reject
(
res
);
return
Promise
.
reject
(
res
);
...
...
src/lib/Api.js
View file @
a68bd9bf
import
axios
from
'axios'
;
import
axios
from
'axios'
;
import
{
Message
,
MessageBox
}
from
'element-ui'
;
import
{
Message
,
MessageBox
}
from
'element-ui'
;
import
store
from
'../store'
;
import
store
from
'../store'
;
import
{
SUCCESS_CODE
}
from
'@/config'
;
import
{
SUCCESS_CODE
,
LOGOUT_CODE
}
from
'@/config'
;
import
{
errorHandle
}
from
'@/api/validate'
;
import
{
errorHandle
}
from
'@/api/validate'
;
import
{
getYourIP
}
from
'@/utils/getIp.js'
;
import
{
getYourIP
}
from
'@/utils/getIp.js'
;
...
@@ -24,16 +24,16 @@ const createBaseFetch = config => {
...
@@ -24,16 +24,16 @@ const createBaseFetch = config => {
store
.
dispatch
(
'fetchStart'
,
notLoading
);
store
.
dispatch
(
'fetchStart'
,
notLoading
);
if
(
store
.
getters
.
token
)
{
if
(
store
.
getters
.
token
)
{
conf
.
headers
=
{
conf
.
headers
=
{
...
conf
.
headers
,
reqSource
:
'pc'
,
reqSource
:
'pc'
,
token
:
store
.
getters
.
token
,
token
:
store
.
getters
.
token
,
ip
:
ip
,
ip
:
ip
,
...
conf
.
headers
,
};
};
}
else
{
}
else
{
conf
.
headers
=
{
conf
.
headers
=
{
...
conf
.
headers
,
reqSource
:
'pc'
,
reqSource
:
'pc'
,
ip
:
ip
,
ip
:
ip
,
...
conf
.
headers
,
};
};
}
}
...
@@ -73,7 +73,7 @@ const createBaseFetch = config => {
...
@@ -73,7 +73,7 @@ const createBaseFetch = config => {
});
});
// -2:其他客户端登录了;Token 过期了;
// -2:其他客户端登录了;Token 过期了;
if
(
res
.
code
===
'-2'
)
{
if
(
res
.
code
===
LOGOUT_CODE
)
{
if
(
logout
)
return
;
if
(
logout
)
return
;
logout
=
true
;
logout
=
true
;
MessageBox
.
confirm
(
MessageBox
.
confirm
(
...
@@ -86,8 +86,13 @@ const createBaseFetch = config => {
...
@@ -86,8 +86,13 @@ const createBaseFetch = config => {
}
}
)
)
.
then
(()
=>
{
.
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
)
.
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
})
.
catch
(
err
=>
{
console
.
error
(
'FedLogOutErr: '
,
err
);
});
});
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
...
src/store/modules/user/index.js
View file @
a68bd9bf
...
@@ -66,6 +66,7 @@ const actions = {
...
@@ -66,6 +66,7 @@ const actions = {
// 前端 登出
// 前端 登出
FedLogOut
({
commit
})
{
FedLogOut
({
commit
})
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
console
.
debug
(
'in FedLogOut'
);
commit
(
SET_TOKEN
,
''
);
commit
(
SET_TOKEN
,
''
);
removeToken
();
removeToken
();
resolve
();
resolve
();
...
...
src/utils/index.js
View file @
a68bd9bf
...
@@ -354,6 +354,7 @@ export const allowLetterNumber = value => {
...
@@ -354,6 +354,7 @@ export const allowLetterNumber = value => {
export
const
formatterMoneyToDouble
=
val
=>
{
export
const
formatterMoneyToDouble
=
val
=>
{
return
val
?
Number
(
val
).
toFixed
(
2
)
:
Number
(
0
).
toFixed
(
2
);
return
val
?
Number
(
val
).
toFixed
(
2
)
:
Number
(
0
).
toFixed
(
2
);
};
};
export
const
formatPrice
=
price
=>
{
export
const
formatPrice
=
price
=>
{
var
result
=
[],
var
result
=
[],
counter
=
0
;
counter
=
0
;
...
@@ -361,6 +362,9 @@ export const formatPrice = price => {
...
@@ -361,6 +362,9 @@ export const formatPrice = price => {
result
.
push
(
price
.
slice
(
-
3
).
join
(
''
));
result
.
push
(
price
.
slice
(
-
3
).
join
(
''
));
for
(
var
i
=
price
.
length
-
4
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
price
.
length
-
4
;
i
>=
0
;
i
--
)
{
counter
++
;
counter
++
;
if
(
i
==
0
&&
isNaN
(
Number
(
price
[
i
]))
&&
result
[
0
]
===
','
)
{
result
.
shift
();
}
result
.
unshift
(
price
[
i
]);
result
.
unshift
(
price
[
i
]);
if
(
!
(
counter
%
3
)
&&
i
!=
0
)
{
if
(
!
(
counter
%
3
)
&&
i
!=
0
)
{
result
.
unshift
(
','
);
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