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