From 969b9c3458cead11e4feb77b52f4e0236b8bdf2c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 16 Nov 2022 21:52:33 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20swagger=20404=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/handler/GlobalExceptionHandler.java | 6 ----- .../server/controller/DefaultController.java | 24 +++++++++++++++++++ .../src/main/resources/application.yaml | 4 ++-- 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 05e4f0b11..28fd9b9d6 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -168,12 +168,6 @@ public class GlobalExceptionHandler { */ @ExceptionHandler(NoHandlerFoundException.class) public CommonResult noHandlerFoundExceptionHandler(HttpServletRequest req, NoHandlerFoundException ex) { - // 情况一:部分功能未开启 - if (req.getRequestURI().contains("/bpm/")) { - return CommonResult.error(NOT_IMPLEMENTED.getCode(), "[工作流模块 yudao-module-bpm - 已禁用][参考 https://doc.iocoder.cn/bpm/ 开启]"); - } - - // 情况二:正常情况下的 404 log.warn("[noHandlerFoundExceptionHandler]", ex); return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())); } diff --git a/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java b/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java new file mode 100644 index 000000000..14946218a --- /dev/null +++ b/yudao-server/src/main/java/cn/iocoder/yudao/server/controller/DefaultController.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.server.controller; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED; + +/** + * 默认 Controller,解决部分 module 未开启时的 404 提示。 + * 例如说,/bpm/** 路径,工作流 + * + * @author 芋道源码 + */ +@RestController +public class DefaultController { + + @RequestMapping("/admin-api/bpm/**") + public CommonResult bpm404() { + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[工作流模块 yudao-module-bpm - 已禁用][参考 https://doc.iocoder.cn/bpm/ 开启]"); + } + +} diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 87f781091..7918d443c 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -17,8 +17,8 @@ spring: mvc: pathmatch: matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类 - throw-exception-if-no-handler-found: true # 404 错误时抛出异常,方便统一处理 - static-path-pattern: /static/** # 静态资源路径; 注意:如果不配置,则 throw-exception-if-no-handler-found 不生效!!! +# throw-exception-if-no-handler-found: true # 404 错误时抛出异常,方便统一处理 +# static-path-pattern: /static/** # 静态资源路径; 注意:如果不配置,则 throw-exception-if-no-handler-found 不生效!!! TODO 芋艿:不能配置,会导致 swagger 不生效 # Jackson 配置项 jackson: From 4d7ac3ebc8425b7b443fa5205d78ba83a6eebcac Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 17 Nov 2022 09:21:35 +0800 Subject: [PATCH 02/30] fix: dict --- .../resources/codegen/vue3/views/data.ts.vm | 127 +++++++++--------- 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm index 37c436246..1e6755ea5 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm @@ -21,71 +21,76 @@ const crudSchemas = reactive({ action: true, actionWidth: '200', // 3个按钮默认200,如有删减对应增减即可 columns: [ -#foreach($column in $columns) - #if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation) - #set ($dictType = $column.dictType) - #if(!$column.primaryKey) - { - title: '${column.columnComment}', - field: '${column.javaField}', - #if ("" != $dictType)## 有数据字典 - dictType: DICT_TYPE.$dictType.toUpperCase(), - #end - #if (!$column.createOperation && !$column.updateOperation) - isForm: false - #elseif(!("" != $column.dictType)) - #if ($column.htmlType == "datetime")## 时间框 - form: { - show: true, - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'YYYY-MM-DD HH:mm:ss' - } - } - #elseif($column.htmlType == "editor")## 文本编辑器 - form: { - show: true, - component: 'Editor', - colProps: { - span: 24 + #foreach($column in $columns) + #if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation) + #set ($dictType = $column.dictType) + #if(!$column.primaryKey) + { + title: '${column.columnComment}', + field: '${column.javaField}', + #if ("" != $dictType)## 有数据字典 + dictType: DICT_TYPE.$dictType.toUpperCase(), + #if (${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") + dictData: 'number', + #else + dictData: 'string', + #end + #end + #if (!$column.createOperation && !$column.updateOperation) + isForm: false, + #elseif(!("" != $column.dictType)) + #if ($column.htmlType == "datetime")## 时间框 + form: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'YYYY-MM-DD HH:mm:ss' + } }, - componentProps: { - valueHtml: '' - } - } - #elseif($column.htmlType == "textarea")## 文本框 - form: { - show: true, - component: 'Input', - componentProps: { - type: 'textarea', - rows: 4 + #elseif($column.htmlType == "editor")## 文本编辑器 + form: { + show: true, + component: 'Editor', + colProps: { + span: 24 + }, + componentProps: { + valueHtml: '' + } }, - colProps: { - span: 24 - } - } + #elseif($column.htmlType == "textarea")## 文本框 + form: { + show: true, + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 + } + }, + #end + #end + #if ($column.listOperationResult) + #if($column.htmlType == "input") + isSearch: true, + #elseif("" != $dictType) + isSearch: true, + #elseif($column.htmlType == "datetime") + search: { + show: true, + itemRender: { + name: 'XDataTimePicker' + } + }, + #end + #end + #end + }, #end - #end - #if ($column.listOperationResult) - #if($column.htmlType == "input") - isSearch: true - #elseif("" != $dictType) - isSearch: true - #elseif($column.htmlType == "datetime") - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - #end - #end - #end - }, #end -#end ] }) export const { allSchemas } = useVxeCrudSchemas(crudSchemas) \ No newline at end of file From d2d4794490ad206a789f510c8aa6fcfb2352e30d Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 17 Nov 2022 10:12:50 +0800 Subject: [PATCH 03/30] refactor: verify --- yudao-ui-admin-vue3/src/api/login/index.ts | 9 +++++++ .../src/components/Verifition/src/Verify.vue | 15 +++++++---- .../Verifition/src/Verify/VerifyPoints.vue | 6 ++--- .../Verifition/src/Verify/VerifySlide.vue | 6 ++--- .../components/Verifition/src/api/index.ts | 26 ------------------- .../components/Verifition/src/utils/axios.ts | 26 ------------------- yudao-ui-admin-vue3/src/config/axios/index.ts | 4 +++ yudao-ui-admin-vue3/vite.config.ts | 2 ++ 8 files changed, 31 insertions(+), 63 deletions(-) delete mode 100644 yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts delete mode 100644 yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts diff --git a/yudao-ui-admin-vue3/src/api/login/index.ts b/yudao-ui-admin-vue3/src/api/login/index.ts index 3f9c9a93f..36b7d01c4 100644 --- a/yudao-ui-admin-vue3/src/api/login/index.ts +++ b/yudao-ui-admin-vue3/src/api/login/index.ts @@ -62,3 +62,12 @@ export const socialAuthRedirectApi = (type: string, redirectUri: string) => { url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri }) } +// 获取验证图片 以及token +export const getCodeApi = (data) => { + return request.postOriginal({ url: 'system/captcha/get', data }) +} + +// 滑动或者点选验证 +export const reqCheckApi = (data) => { + return request.postOriginal({ url: 'system/captcha/check', data }) +} diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue index 70bfce7ef..a24280b4c 100644 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue +++ b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue @@ -2,7 +2,7 @@
{{ t('captcha.verification') }} @@ -10,7 +10,7 @@
-
+
{ + reqCheckApi(data).then((res) => { if (res.repCode == '0000') { barAreaColor.value = '#4cae4c' barAreaBorderColor.value = '#5cb85c' @@ -230,7 +230,7 @@ export default { let data = { captchaType: captchaType.value } - reqGet(data).then((res) => { + getCodeApi(data).then((res) => { if (res.repCode == '0000') { pointBackImgBase.value = res.repData.originalImageBase64 backToken.value = res.repData.token diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue index 2d59023bd..4b18299b8 100644 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue +++ b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue @@ -78,7 +78,7 @@ * */ import { aesEncrypt } from './../utils/ase' import { resetSize } from './../utils/util' -import { reqGet, reqCheck } from './../api/index' +import { getCodeApi, reqCheckApi } from '@/api/login' import { useI18n } from '@/hooks/web/useI18n' import { computed, @@ -302,7 +302,7 @@ export default { : JSON.stringify({ x: moveLeftDistance, y: 5.0 }), token: backToken.value } - reqCheck(data).then((res) => { + reqCheckApi(data).then((res) => { if (res.repCode == '0000') { moveBlockBackgroundColor.value = '#5cb85c' leftBarBorderColor.value = '#5cb85c' @@ -379,7 +379,7 @@ export default { let data = { captchaType: captchaType.value } - reqGet(data).then((res) => { + getCodeApi(data).then((res) => { if (res.repCode == '0000') { backImgBase.value = res.repData.originalImageBase64 blockBackImgBase.value = res.repData.jigsawImageBase64 diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts b/yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts deleted file mode 100644 index 78c7c335c..000000000 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 此处可直接引用自己项目封装好的 axios 配合后端联调 - */ - -import request from './../utils/axios' //组件内部封装的axios -// import request from "@/api/axios.js" //调用项目封装的axios - -//获取验证图片 以及token -export function reqGet(data) { - return request({ - // url: '/captcha/get', - url: '/admin-api/system/captcha/get', // 使用项目自定义的 /admin-api/ 前缀 - method: 'post', - data - }) -} - -//滑动或者点选验证 -export function reqCheck(data) { - return request({ - // url: '/captcha/check', - url: '/admin-api/system/captcha/check', // 使用项目自定义的 /admin-api/ 前缀 - method: 'post', - data - }) -} diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts b/yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts deleted file mode 100644 index ca68097e7..000000000 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts +++ /dev/null @@ -1,26 +0,0 @@ -import axios from 'axios' - -axios.defaults.baseURL = import.meta.env.VITE_BASE_URL - -const service = axios.create({ - timeout: 40000, - headers: { - 'X-Requested-With': 'XMLHttpRequest', - 'Content-Type': 'application/json; charset=UTF-8' - } -}) -service.interceptors.request.use( - (config) => { - return config - }, - (error) => { - Promise.reject(error) - } -) - -// response interceptor -service.interceptors.response.use((response) => { - const res = response.data - return res -}) -export default service diff --git a/yudao-ui-admin-vue3/src/config/axios/index.ts b/yudao-ui-admin-vue3/src/config/axios/index.ts index 28a546d83..c2a3344bf 100644 --- a/yudao-ui-admin-vue3/src/config/axios/index.ts +++ b/yudao-ui-admin-vue3/src/config/axios/index.ts @@ -26,6 +26,10 @@ export default { const res = await request({ method: 'POST', ...option }) return res.data as unknown as T }, + postOriginal: async (option: any) => { + const res = await request({ method: 'POST', ...option }) + return res + }, delete: async (option: any) => { const res = await request({ method: 'DELETE', ...option }) return res.data as unknown as T diff --git a/yudao-ui-admin-vue3/vite.config.ts b/yudao-ui-admin-vue3/vite.config.ts index 12d958c83..17c1804db 100644 --- a/yudao-ui-admin-vue3/vite.config.ts +++ b/yudao-ui-admin-vue3/vite.config.ts @@ -144,6 +144,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { 'vue-router', 'vue-types', 'vue-i18n', + 'vxe-table', + 'xe-utils', 'element-plus/es', 'element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/en', From b28baf0ef52c20edb49d811d1933cab02e4fb9f5 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 17 Nov 2022 10:30:02 +0800 Subject: [PATCH 04/30] style: refactor --- .../src/components/Verifition/src/Verify/VerifySlide.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue index 4b18299b8..0a0beaea3 100644 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue +++ b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue @@ -137,7 +137,7 @@ export default { default() { return { width: '310px', - height: '40px' + height: '30px' } } } From 7083d991fe2a99ebdd995992ceb4c21a5f1f9a9a Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 17 Nov 2022 10:37:23 +0800 Subject: [PATCH 05/30] refactor: verify --- yudao-ui-admin/src/api/login.js | 18 ++++++++++++ .../src/components/RightToolbar/index.vue | 4 +-- .../Verifition/Verify/VerifyPoints.vue | 2 +- .../Verifition/Verify/VerifySlide.vue | 2 +- .../src/components/Verifition/api/index.js | 27 ----------------- .../src/components/Verifition/utils/axios.js | 29 ------------------- .../src/views/mall/trade/order/detail.vue | 2 +- .../src/views/mall/trade/order/index.vue | 2 +- 8 files changed, 24 insertions(+), 62 deletions(-) delete mode 100644 yudao-ui-admin/src/components/Verifition/api/index.js delete mode 100644 yudao-ui-admin/src/components/Verifition/utils/axios.js diff --git a/yudao-ui-admin/src/api/login.js b/yudao-ui-admin/src/api/login.js index b34d98d29..614a11fcb 100644 --- a/yudao-ui-admin/src/api/login.js +++ b/yudao-ui-admin/src/api/login.js @@ -126,5 +126,23 @@ export function authorize(responseType, clientId, redirectUri, state, }) } +// 获取验证图片 以及token +export function reqGet(data) { + return request({ + url: 'system/captcha/get', + method: 'post', + data + }) +} + +// 滑动或者点选验证 +export function reqCheck(data) { + return request({ + url: '/system/captcha/check', + method: 'post', + data + }) +} + export class socialBindLogin { } diff --git a/yudao-ui-admin/src/components/RightToolbar/index.vue b/yudao-ui-admin/src/components/RightToolbar/index.vue index e3a95f05c..12562917b 100644 --- a/yudao-ui-admin/src/components/RightToolbar/index.vue +++ b/yudao-ui-admin/src/components/RightToolbar/index.vue @@ -92,13 +92,13 @@ export default { }; diff --git a/yudao-ui-admin/src/components/Verifition/Verify/VerifyPoints.vue b/yudao-ui-admin/src/components/Verifition/Verify/VerifyPoints.vue index 72a71d9aa..4927ccacd 100644 --- a/yudao-ui-admin/src/components/Verifition/Verify/VerifyPoints.vue +++ b/yudao-ui-admin/src/components/Verifition/Verify/VerifyPoints.vue @@ -60,7 +60,7 @@ * */ import { resetSize } from './../utils/util' import { aesEncrypt } from '@/utils/ase' -import { reqGet, reqCheck } from './../api/index' +import { reqGet, reqCheck } from '@/api/login' export default { name: 'VerifyPoints', diff --git a/yudao-ui-admin/src/components/Verifition/Verify/VerifySlide.vue b/yudao-ui-admin/src/components/Verifition/Verify/VerifySlide.vue index 90d538e3f..a1cac7d7d 100644 --- a/yudao-ui-admin/src/components/Verifition/Verify/VerifySlide.vue +++ b/yudao-ui-admin/src/components/Verifition/Verify/VerifySlide.vue @@ -64,7 +64,7 @@ * */ import { aesEncrypt } from '@/utils/ase' import { resetSize } from './../utils/util' -import { reqGet, reqCheck } from './../api/index' +import { reqGet, reqCheck } from '@/api/login' // "captchaType":"blockPuzzle", export default { diff --git a/yudao-ui-admin/src/components/Verifition/api/index.js b/yudao-ui-admin/src/components/Verifition/api/index.js deleted file mode 100644 index 7c5a94094..000000000 --- a/yudao-ui-admin/src/components/Verifition/api/index.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 此处可直接引用自己项目封装好的 axios 配合后端联调 - */ - -import request from './../utils/axios' // 组件内部封装的axios -// import request from "@/api/axios.js" //调用项目封装的axios - -// 获取验证图片 以及token -export function reqGet(data) { - return request({ - // url: '/captcha/get', - url: '/admin-api/system/captcha/get', // 使用项目自定义的 /admin-api/ 前缀 - method: 'post', - data - }) -} - -// 滑动或者点选验证 -export function reqCheck(data) { - return request({ - // url: '/captcha/check', - url: '/admin-api/system/captcha/check', // 使用项目自定义的 /admin-api/ 前缀 - method: 'post', - data - }) -} - diff --git a/yudao-ui-admin/src/components/Verifition/utils/axios.js b/yudao-ui-admin/src/components/Verifition/utils/axios.js deleted file mode 100644 index 2f960bb54..000000000 --- a/yudao-ui-admin/src/components/Verifition/utils/axios.js +++ /dev/null @@ -1,29 +0,0 @@ -import axios from 'axios' - -axios.defaults.baseURL = process.env.VUE_APP_BASE_API - -const service = axios.create({ - timeout: 40000, - headers: { - 'X-Requested-With': 'XMLHttpRequest', - 'Content-Type': 'application/json; charset=UTF-8' - }, -}) -service.interceptors.request.use( - config => { - return config - }, - error => { - Promise.reject(error) - } -) - -// response interceptor -service.interceptors.response.use( - response => { - return response.data - }, - error => { - } -) -export default service diff --git a/yudao-ui-admin/src/views/mall/trade/order/detail.vue b/yudao-ui-admin/src/views/mall/trade/order/detail.vue index 4e50d8f41..7581f4148 100644 --- a/yudao-ui-admin/src/views/mall/trade/order/detail.vue +++ b/yudao-ui-admin/src/views/mall/trade/order/detail.vue @@ -244,7 +244,7 @@ export default { diff --git a/yudao-ui-admin-vue3/vite.config.ts b/yudao-ui-admin-vue3/vite.config.ts index 17c1804db..c33a46208 100644 --- a/yudao-ui-admin-vue3/vite.config.ts +++ b/yudao-ui-admin-vue3/vite.config.ts @@ -13,7 +13,7 @@ import { createHtmlPlugin } from 'vite-plugin-html' import viteCompression from 'vite-plugin-compression' import VueMarcos from 'unplugin-vue-macros/vite' -// 当前执行node命令时文件夹的地址(工作目录) +// 当前执行node命令时文件夹的地址(工作目录) const root = process.cwd() // 路径查找