修改bug
parent
02504166a3
commit
502de574bd
|
@ -1,27 +1,21 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
|
|
||||||
interface requestType {
|
interface requestType {
|
||||||
url: string
|
url: string
|
||||||
params?: any
|
params?: any
|
||||||
}
|
}
|
||||||
const handleCode = async (code: number, msg: string) => {
|
const handleCode = async (code: number, message: string) => {
|
||||||
console.log(code);
|
if (code != 200) {
|
||||||
const router = useRouter();
|
console.log(message);
|
||||||
switch (code) {
|
ElMessage.error(message || `后端接口${code}异常`)
|
||||||
case 401:
|
|
||||||
debugger
|
}
|
||||||
ElMessage.error(msg || '登录失效')
|
if (code == 401) {
|
||||||
|
ElMessage.error(message || '登录失效')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log('登录失效')
|
location.href = "/login"
|
||||||
// router.replace("/login")
|
}, 1500);
|
||||||
}, 1500)
|
|
||||||
// 跳转登录
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
ElMessage.error(msg || `后端接口${code}异常`)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +37,6 @@ service.interceptors.request.use(
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
// 对请求错误做些什么
|
|
||||||
console.log(error, 'error')
|
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -53,29 +45,21 @@ service.interceptors.response.use(
|
||||||
(response) => {
|
(response) => {
|
||||||
//response参数是响应对象
|
//response参数是响应对象
|
||||||
// 对响应数据做点什么
|
// 对响应数据做点什么
|
||||||
|
|
||||||
const { data, config } = response
|
const { data, config } = response
|
||||||
if (data.code == 401) {
|
|
||||||
|
|
||||||
ElMessage.error(data.message)
|
|
||||||
}
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
const { response } = error
|
const { response } = error
|
||||||
|
|
||||||
if (error.response && error.response.data) {
|
if (error.response && error.response.data) {
|
||||||
const { status, data } = response
|
const { status, data } = response
|
||||||
handleCode(status, data.msg)
|
handleCode(status, data.message)
|
||||||
|
|
||||||
// 对响应错误做点什么
|
// 对响应错误做点什么
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
} else {
|
} else {
|
||||||
let { message } = error
|
let { message } = error
|
||||||
if (message === 'Network Error') {
|
if (message === 'Network Error') {
|
||||||
message = '后端接口连接异常'
|
message = '后端接口连接异常'
|
||||||
location.href = "/login"
|
|
||||||
}
|
}
|
||||||
if (message.includes('timeout')) {
|
if (message.includes('timeout')) {
|
||||||
message = '后端接口请求超时'
|
message = '后端接口请求超时'
|
||||||
|
|
|
@ -107,12 +107,12 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="技能类型" prop="skill_type">
|
<el-form-item label="技能类型" prop="skill_type">
|
||||||
<el-select
|
<el-select
|
||||||
:disabled="createFormData.id!=''"
|
:disabled="createFormData.id != ''"
|
||||||
v-model="createFormData.skill_type"
|
v-model="createFormData.skill_type"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-option label="所有" value="all" />
|
<el-option label="所有" value="All" />
|
||||||
<el-option label="身份证识别" value="IdCardOcr" />
|
<el-option label="身份证识别" value="IdCardOcr" />
|
||||||
<el-option label="手写识别" value="HandwritingOcr" />
|
<el-option label="手写识别" value="HandwritingOcr" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -165,7 +165,7 @@ const skillType = computed(() => {
|
||||||
let text = "";
|
let text = "";
|
||||||
return (val) => {
|
return (val) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "all":
|
case "All":
|
||||||
text = "所有";
|
text = "所有";
|
||||||
break;
|
break;
|
||||||
case "IdCardOcr":
|
case "IdCardOcr":
|
||||||
|
|
Loading…
Reference in New Issue