Authored by 陈峰

Merge branch 'master' into release/1.0

... ... @@ -41,8 +41,6 @@
return;
}
return this.$Message.error(err_msg);
}, (error) => {
this.$Message.error(error.message);
});
},
methods: {
... ...
... ... @@ -12,7 +12,7 @@ export default {
},
production: {
historyMode: 'history',
shopsFeDomain: 'http://shops.yohops.com',
shopsFeDomain: 'http://shops.yohobuy.com',
axiosBaseUrl: '/Api',
axiosResponseType: 'json',
homePage: 'home.overview',
... ...
... ... @@ -4,7 +4,6 @@
import _ from 'lodash';
import axios from 'axios';
import userService from 'user-service';
import iView from 'iview';
import Rsa from 'rsa';
const plugin = {
... ... @@ -100,15 +99,11 @@ const plugin = {
Vue.$router.push('/login.html');
};
axios.defaults.validateStatus = (status) => {
if (status >= 200 && status < 300) {
return true;
}
if (status === 401) {
Vue.logout();
return false;
}
iView.Message.error('接口异常');
return false;
return true;
};
}
};
... ...
... ... @@ -93,6 +93,16 @@ const plugin = {
// 设置axios默认参数
axios.defaults.baseURL = Vue.$config.axiosBaseUrl;
axios.defaults.responseType = Vue.$config.axiosResponseType;
axios.interceptors.response.use(response => {
if (response.status >= 200 && response.status < 300) {
return response;
}
iView.Message.error('接口异常');
return Promise.reject({response});
}, error => {
return Promise.reject(error);
});
}
};
... ...
{
"name": "yoho-shop-manage",
"version": "1.0.3",
"version": "1.0.5",
"description": "",
"main": "app.js",
"scripts": {
... ...
... ... @@ -58,7 +58,13 @@ class Api extends Context {
return request(params, (error, response) => {
if (!error) {
logger.info(`api call ${response.statusCode} [${response.request.method}] ${response.request.href} ${response.request.body}`); // eslint-disable-line
if (response && /^20\d/.test(response.statusCode)) {
logger.info(`api call ${response.statusCode} [${response.request.method}] ${response.request.href} ${response.request.body}`); // eslint-disable-line
} else {
let res = response.toJSON();
logger.error(`api call ${res.statusCode} [${res.request.method}] ${res.request.uri.href} ${res.body || ''}`); // eslint-disable-line
}
}
});
}
... ...
... ... @@ -12,7 +12,7 @@ const apiDomain = require('./api-domain');
const config = {
app: 'shop-manage',
appVersion: '0.0.1', // 调用api的版本
platform: 2,
platform: 4,
port: 6007,
siteUrl: '//shop.yohobuy.com',
assetUrl: '//127.0.0.1:5001',
... ...
... ... @@ -4,6 +4,7 @@ const request = require('request');
const env = global.env;
let mainProxy = (req, res) => {
res.header('x-version', env.version);
request.get(`http://cdn.yoho.cn/yoho-shop-manage/${env.version}/index.html`).pipe(res);
};
... ...