优化错误码弹窗
This commit is contained in:
parent
9d2f572c35
commit
902059e11b
27
ui/src/components/widget/errcodeDetail.vue
Normal file
27
ui/src/components/widget/errcodeDetail.vue
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
data: {}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log("打开errcodeDetail,data:", props.data)
|
||||||
|
|
||||||
|
let tipContent = "<span style='font-size: 20px;color: red'>错误详情:</span><span style='font-size: 20px'>"
|
||||||
|
tipContent += props.data.detail_msg
|
||||||
|
tipContent += "<br/>"
|
||||||
|
tipContent += "<span style='font-size: 20px;color: red'>出错代码:</span>"
|
||||||
|
tipContent += props.data.stack
|
||||||
|
tipContent += "</span>"
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-tooltip :content="tipContent" raw-content placement="bottom" effect="light" style="font-size: 20px">
|
||||||
|
<span style="font-size: 20px">原因:{{ data.msg }}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -5,6 +5,8 @@ import {useRouter} from "vue-router";
|
|||||||
import LocalCache from "@/stores/localCache.js";
|
import LocalCache from "@/stores/localCache.js";
|
||||||
// import ExpireCache from "@/stores/expireCache";
|
// import ExpireCache from "@/stores/expireCache";
|
||||||
|
|
||||||
|
import errcodeDetail from '@/components/widget/errcodeDetail.vue'
|
||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||||
@ -71,10 +73,21 @@ const resInterceptor = (res) => {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log("interceptor err code", res)
|
console.log("interceptor err code", res)
|
||||||
ElMessageBox.alert(res.data.msg, "服务器错误码[" + code + "]", {
|
ElMessageBox({
|
||||||
|
title: "服务器错误码[" + code + "]",
|
||||||
|
message: () =>
|
||||||
|
h(errcodeDetail, {
|
||||||
|
data: res.data,
|
||||||
|
}),
|
||||||
type: "warning",
|
type: "warning",
|
||||||
confirmButtonText: '知道了',
|
confirmButtonText: '知道了',
|
||||||
|
}).then((action) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
// ElMessageBox.alert(res.data.msg, "服务器错误码[" + code + "]", {
|
||||||
|
// type: "warning",
|
||||||
|
// confirmButtonText: '知道了',
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(res.data)
|
return Promise.reject(res.data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user