From c9d18f6d8a0fc80f4c6ff4aa437f6cdfc7683479 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 3 Oct 2024 01:29:12 +0800 Subject: [PATCH] chore: 1 --- .../core/pipeline/src/utils/util.request.ts | 5 ++++ packages/ui/certd-client/src/api/service.ts | 6 ++++- packages/ui/certd-client/src/api/tools.ts | 3 +++ .../plugins/common/remote-select.vue | 27 ++++++++++++++----- .../src/components/plugins/lib/index.ts | 5 ++-- .../plugins/synology/device-id-getter.vue | 2 +- .../src/components/vip-button/index.vue | 26 ++++++++++++------ .../src/plugin/fast-crud/index.tsx | 2 +- .../ui/certd-client/src/store/modules/user.ts | 14 +++++++++- .../src/views/sys/authority/user/crud.tsx | 5 ++-- .../ui/certd-server/.env.development.yaml | 23 +++++++++------- packages/ui/certd-server/package.json | 1 + .../authority/controller/role-controller.ts | 3 +++ .../authority/controller/user-controller.ts | 5 +++- .../src/modules/authority/entity/user.ts | 2 ++ .../mine/controller/mine-controller.ts | 4 +++ .../src/modules/mine/entity/user-settings.ts | 1 + 17 files changed, 100 insertions(+), 34 deletions(-) diff --git a/packages/core/pipeline/src/utils/util.request.ts b/packages/core/pipeline/src/utils/util.request.ts index 205fe2edf..b5c341c04 100644 --- a/packages/core/pipeline/src/utils/util.request.ts +++ b/packages/core/pipeline/src/utils/util.request.ts @@ -16,6 +16,11 @@ export class HttpError extends Error { return; } super(error.message); + + if (error?.message?.indexOf("ssl3_get_record:wrong version number") > -1) { + this.message = "http协议错误,服务端要求http协议,请检查是否使用了https请求"; + } + this.name = error.name; this.code = error.code; this.cause = error.cause; diff --git a/packages/ui/certd-client/src/api/service.ts b/packages/ui/certd-client/src/api/service.ts index c69442c23..412b35cab 100644 --- a/packages/ui/certd-client/src/api/service.ts +++ b/packages/ui/certd-client/src/api/service.ts @@ -1,7 +1,7 @@ import axios from "axios"; import { get } from "lodash-es"; import Adapter from "axios-mock-adapter"; -import { errorLog, errorCreate } from "./tools"; +import { errorLog, errorCreate, response } from "./tools"; import { env } from "/src/utils/util.env"; import { useUserStore } from "../store/modules/user"; /** @@ -96,6 +96,10 @@ function createService() { const userStore = useUserStore(); userStore.logout(); } + + if (error?.config?.onError) { + error.config.onError(error); + } return Promise.reject(error); } ); diff --git a/packages/ui/certd-client/src/api/tools.ts b/packages/ui/certd-client/src/api/tools.ts index ccf032d44..85ed157e0 100644 --- a/packages/ui/certd-client/src/api/tools.ts +++ b/packages/ui/certd-client/src/api/tools.ts @@ -55,6 +55,9 @@ export function errorLog(error: any) { if (error.response?.data?.message) { message = error.response.data.message; } + if (message.indexOf("ssl3_get_record:wrong version number" > -1)) { + message = "http协议错误,服务端要求http协议,请检查是否使用了https请求"; + } // 显示提示 uiContext.get().notification.error({ message }); } diff --git a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue index 6634e09a8..93ce220b8 100644 --- a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue +++ b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue @@ -13,13 +13,21 @@ const emit = defineEmits<{ }>(); const optionsRef = ref([]); +const message = ref(""); const getOptions = async () => { - return await doRequest({ - type: props.type, - typeName: props.typeName, - action: props.action, - input: props.form - }); + return await doRequest( + { + type: props.type, + typeName: props.typeName, + action: props.action, + input: props.form + }, + { + onError(err) { + message.value = err.message; + } + } + ); }; const filterOption = (input: string, option: any) => { @@ -53,7 +61,8 @@ watch( diff --git a/packages/ui/certd-client/src/components/plugins/lib/index.ts b/packages/ui/certd-client/src/components/plugins/lib/index.ts index 5b6c47594..b338d562c 100644 --- a/packages/ui/certd-client/src/components/plugins/lib/index.ts +++ b/packages/ui/certd-client/src/components/plugins/lib/index.ts @@ -14,7 +14,7 @@ export type RequestHandleReq = { input: T; }; -export async function doRequest(req: RequestHandleReq) { +export async function doRequest(req: RequestHandleReq, opts?: any = {}) { const url = req.type === "access" ? "/pi/handle/access" : "/pi/handle/plugin"; const { typeName, action, data, input } = req; const res = await request({ @@ -25,7 +25,8 @@ export async function doRequest(req: RequestHandleReq) { action, data, input - } + }, + ...opts }); return res; } diff --git a/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue b/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue index ebbf8636f..94e2c1497 100644 --- a/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue +++ b/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue @@ -1,7 +1,7 @@