From dca421adca3d72e1eac9939b1fc3a57560a395b3 Mon Sep 17 00:00:00 2001 From: sige Date: Wed, 24 Jul 2024 10:41:07 +0800 Subject: [PATCH] 1 --- package.json | 3 +- src/App.vue | 52 +++++++-- src/components/ServiceConfiguration.vue | 195 ++++++++++++++++++++++++++++++++ src/utils/ApiClient.js | 10 +- vue.config.js | 1 + 5 files changed, 247 insertions(+), 14 deletions(-) create mode 100644 src/components/ServiceConfiguration.vue diff --git a/package.json b/package.json index dc63501..6eb74d1 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "parser": "@babel/eslint-parser" }, "rules": { - "no-debugger": "off" + "no-debugger": "off", + "no-undef" : "off" } }, "browserslist": [ diff --git a/src/App.vue b/src/App.vue index fd1ce0f..10a6d11 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,27 +1,55 @@ \ No newline at end of file diff --git a/src/components/ServiceConfiguration.vue b/src/components/ServiceConfiguration.vue new file mode 100644 index 0000000..b9a0098 --- /dev/null +++ b/src/components/ServiceConfiguration.vue @@ -0,0 +1,195 @@ + + \ No newline at end of file diff --git a/src/utils/ApiClient.js b/src/utils/ApiClient.js index bb7151d..5f178ac 100644 --- a/src/utils/ApiClient.js +++ b/src/utils/ApiClient.js @@ -1,4 +1,7 @@ + import axios from 'axios'; +import { Modal } from 'ant-design-vue'; +import { h } from 'vue'; export default class ApiClient { // instancec of client static instance = null; @@ -19,7 +22,12 @@ export default class ApiClient { data: params }); if ( !response.data.success ) { - throw new Error(`API【${name}】调用失败 : ${response.data.message}`); + let content = h('div', {}, [ + h('pre', JSON.stringify(response.data.ecode, null, 2)), + h('pre', {class:'overflow-auto h-96 mt-5'}, response.data.traceInfo), + ]); + Modal.error({title: '请求错误',content:content,width:800}); + throw new Error(`API【${name}】调用失败 : ${response.data}`); } return response.data.data; } diff --git a/vue.config.js b/vue.config.js index 3faad05..211a29f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,7 @@ const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ transpileDependencies: true, + publicPath : './', configureWebpack : { devtool:"source-map" },