Commit b4438fde authored by 沈翠玲's avatar 沈翠玲

修改bug

parent dd04d169
......@@ -13,7 +13,7 @@ const install = (Vue, vm) => {
// 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等
login: (params = {}) => vm.$u.postJson(config.adminPath + '/login', params),
// getInfo: (params = {}) => vm.$u.get('http://192.168.1.128:8088' + '/getInfo'),
getInfo: (params = {}) => vm.$u.get('http://192.168.222.60:8088' + '/getInfo'),
getInfo: (params = {}) => vm.$u.get('http://182.140.132.45:8088' + '/getInfo'),
changepassword: (params = {}) => vm.$u.postJson(config.adminPath + '/cmsmv/changepassword', params),
// 到货条码打印查询
getforprint: (params = {}) => vm.$u.postJson(config.adminPath + '/purcc/getforprint', params),
......
import i18n from '../lang/index'
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
......@@ -47,63 +48,18 @@ const install = (Vue, vm) => {
// 响应拦截,判断状态码是否通过
Vue.prototype.$u.http.interceptor.response = async (res, req) => {
console.log('res111', res)
let data = res.data;
if (!(data)) {
vm.$u.toast('未连接到服务器')
vm.$u.toast(i18n.t('未连接到服务器'))
return false;
}
// 根据返回的code值来做不同的处理
switch (res.statusCode) {
case 401:
uni.reLaunch({
url: '/pages/sys/login/login'
});
break;
case 403:
// 没有权限
if (data.errorMessage !== null) {
uni.showToast({
title: data.errorMessage,
duration: 3000
})
} else {
uni.showToast({
title: '失败',
duration: 3000
})
}
break;
case 500:
// 错误
if (data.errorMessage !== null) {
uni.showToast({
icon: 'none',
title: data.errorMessage || '未连接到服务器',
duration: 3000
})
} else {
uni.showToast({
icon: 'none',
title: '未知错误',
duration: 3000
})
}
break;
}
if(!data.success){
if (data.errorMessage !== null) {
uni.showToast({
icon: 'none',
title: data.errorMessage,
duration: 3000
})
vm.$u.toast(data.errorMessage)
} else {
uni.showToast({
title: '失败',
duration: 3000
})
vm.$u.toast(i18n.t('失败'))
}
}
......
......@@ -136,5 +136,9 @@
"工单已经完成领料": "ใบสั่งงานเสร็จสมบูรณ์แล้ว",
"委外进货单不存在": "ไม่มีใบนำส่งนอกประเทศ",
"委外进货单不存在待检明细": "ไม่มีรายละเอียดที่ต้องตรวจสอบในใบส่งของเข้านอกคณะกรรมการ",
"未找到到货单": "ไม่พบใบส่งสินค้า"
"未找到到货单": "ไม่พบใบส่งสินค้า",
"未连接到服务器": "ไม่ได้เชื่อมต่อกับเซิร์ฟเวอร์",
"失败": "ล้มเหลว",
"未知错误": "ข้อผิดพลาดที่ไม่รู้จัก",
"获取用户语言失败": "ล้มเหลวในการรับภาษาผู้ใช้"
}
......@@ -136,5 +136,9 @@
"工单已经完成领料": "工单已经完成领料",
"委外进货单不存在": "委外进货单不存在",
"委外进货单不存在待检明细": "委外进货单不存在待检明细",
"未找到到货单": "未找到到货单"
"未找到到货单": "未找到到货单",
"未连接到服务器": "未连接到服务器",
"失败": "失败",
"未知错误": "未知错误",
"获取用户语言失败": "获取用户语言失败"
}
\ No newline at end of file
......@@ -86,7 +86,10 @@ import {setLocal} from '@/lang'
this.loading = false;
this.$u.vuex('vuex_token', res.data.token)
this.$u.api.getInfo().then(res1 => {
if(!res1.user) this.$u.toast( i18n.t('获取用户语言失败'))
res1.user.locale ? setLocal(res1.user.locale.substring(0, 2)) : setLocal('zh')
}).catch(e => {
console.log('getInfo', e)
})
this.$u.vuex('vuex_user', res.data)
if (res.success) {
......
......@@ -31,9 +31,10 @@ class Request {
return new Promise((resolve, reject) => {
options.complete = (response) => {
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
clearTimeout(this.config.timer);
uni.hideLoading();
// 清除定时器,如果请求回来了,就无需loading
clearTimeout(this.config.timer);
this.config.timer = null;
// 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
if (this.config.originalData) {
......
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