feat(storegoods): 新增加工进仓模块并适配智盛ERP
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,9 +22,11 @@ const install = (Vue, vm) => {
|
||||
|
||||
// 请求拦截,配置Token等参数
|
||||
Vue.prototype.$u.http.interceptor.request = (req) => {
|
||||
const reqUrl = req && req.url ? String(req.url) : '';
|
||||
const isAbsolute = /^https?:\/\//i.test(reqUrl);
|
||||
console.log('request', req);
|
||||
console.log('baseUrl', vm.$store.state.apiurl);
|
||||
console.log('完整URL', vm.$store.state.apiurl + req.url);
|
||||
console.log('完整URL', isAbsolute ? reqUrl : (vm.$store.state.apiurl + reqUrl));
|
||||
if (!req.header){
|
||||
req.header = [];
|
||||
}
|
||||
@@ -68,11 +70,22 @@ const install = (Vue, vm) => {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
// 非业务 JSON(如 404 page not found)
|
||||
if (res.statusCode && res.statusCode !== 200) {
|
||||
const msg = (res.data && res.data.msg) || `请求失败(${res.statusCode})`;
|
||||
vm.$u.toast(msg);
|
||||
return Promise.reject(new Error(msg));
|
||||
}
|
||||
console.log('res',res)
|
||||
if (!(res.data)){
|
||||
vm.$u.toast('未连接到服务器')
|
||||
return Promise.reject(new Error('未连接到服务器'));
|
||||
}
|
||||
if (typeof res.data !== 'object') {
|
||||
const msg = '接口返回异常';
|
||||
vm.$u.toast(msg);
|
||||
return Promise.reject(new Error(msg));
|
||||
}
|
||||
|
||||
if(res.data.code !== 0) {
|
||||
vm.$u.toast(res.data.msg)
|
||||
|
||||
Reference in New Issue
Block a user