|
@@ -15,7 +15,7 @@ var reg = /(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}
|
|
|
var browserUrl = window.location.hostname
|
|
|
console.log("========url===",reg.test(browserUrl))
|
|
|
if (reg.test(browserUrl)){
|
|
|
- URL = window.location.protocol +"//"+ browserUrl + ":80/"
|
|
|
+ URL = window.location.protocol +"//"+ browserUrl + ":8082"
|
|
|
}
|
|
|
|
|
|
Cookies.set('url',URL)
|
|
@@ -33,7 +33,7 @@ service.interceptors.request.use(
|
|
|
// do something before request is sent
|
|
|
// config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' //此处是增加的代码,设置请求头的类型
|
|
|
if (process.env.VUE_APP_BASE_API !== '/dev-api') {
|
|
|
- config.headers['Content-Type'] = 'application/json'
|
|
|
+ config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
config.withCredentials = false
|
|
|
}
|
|
|
|
|
@@ -75,7 +75,7 @@ service.interceptors.response.use(
|
|
|
if (res.code !== 200) {
|
|
|
Message({
|
|
|
// message: res.msg + res.code,
|
|
|
- message: '请求超时',
|
|
|
+ message: this.$t('common.requestMsg'),
|
|
|
type: 'error',
|
|
|
duration: 5 * 1000
|
|
|
})
|
|
@@ -85,7 +85,7 @@ service.interceptors.response.use(
|
|
|
// to re-login
|
|
|
MessageBox.confirm('你已经注销登陆,你可以取消或重新登陆', '确认注销', {
|
|
|
confirmButtonText: '重新登陆',
|
|
|
- cancelButtonText: '取消',
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
store.dispatch('user/resetToken').then(() => {
|
|
@@ -118,12 +118,9 @@ service.interceptors.response.use(
|
|
|
console.log('config.__retryCount==>', config.__retryCount) // for debug
|
|
|
// 设置请求超时次数
|
|
|
config.__retryCount = config.__retryCount || 0
|
|
|
- // 君盛牧场不需要多次请求
|
|
|
- // if (config.__retryCount >= 0) {
|
|
|
- // 其他牧场失败后需要多次尝试
|
|
|
if (config.__retryCount >= 3) {
|
|
|
// Message({ message:error.message, type: 'error', duration: 5 * 1000 })
|
|
|
- Message({ message:'请求超时', type: 'error', duration: 5 * 1000 })
|
|
|
+ Message({ message:this.$t('common.requestMsg'), type: 'error', duration: 5 * 1000 })
|
|
|
// Message.error((error && error.data && error.data.msg) || '请求超时')
|
|
|
return Promise.reject(error)
|
|
|
}
|