Commit a68bd9bf by 姜雷

Merge branch 'develop' into 'test'

Develop See merge request !114
parents 51fb0e85 c32f1a23
const removeConsolePlugin = [];
if (process.env.NODE_ENV === 'production') {
removeConsolePlugin.push('transform-remove-console');
removeConsolePlugin.push([
'transform-remove-console',
{
exclude: ['error', 'warn'],
},
]);
}
module.exports = {
......
......@@ -17,9 +17,14 @@ export const validateCode = res => {
type: 'warning',
}
).then(() => {
store.dispatch('FedLogOut').then(() => {
location.reload(); // 为了重新实例化vue-router对象 避免bug
});
store
.dispatch('FedLogOut')
.then(() => {
location.reload(); // 为了重新实例化vue-router对象 避免bug
})
.catch(err => {
console.error('FedLogOutErr: ', err);
});
});
return Promise.reject(res);
default:
......
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,9 +86,14 @@ const createBaseFetch = config => {
}
)
.then(() => {
store.dispatch('FedLogOut').then(() => {
location.reload(); // 为了重新实例化vue-router对象 避免bug
});
store
.dispatch('FedLogOut')
.then(() => {
location.reload(); // 为了重新实例化vue-router对象 避免bug
})
.catch(err => {
console.error('FedLogOutErr: ', err);
});
})
.catch(err => {
console.error(err);
......
......@@ -66,6 +66,7 @@ const actions = {
// 前端 登出
FedLogOut({ commit }) {
return new Promise(resolve => {
console.debug('in FedLogOut');
commit(SET_TOKEN, '');
removeToken();
resolve();
......
......@@ -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(',');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment