From 4b784953bf6c84a4d4da229b966e07447af53ae3 Mon Sep 17 00:00:00 2001 From: tanzhisong Date: Mon, 24 Feb 2025 18:10:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E4=BF=A1=E6=81=AF=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.test | 28 +++ package.json | 1 + .../miniapp/miniappInfo/AppMiniappInfo.api.ts | 64 +++++++ .../miniapp/miniappInfo/AppMiniappInfo.data.ts | 109 +++++++++++ .../miniapp/miniappInfo/AppMiniappInfoList.vue | 202 +++++++++++++++++++++ .../V20250224_1__menu_insert_AppMiniappInfo.sql | 26 +++ .../miniappInfo/components/AppMiniappInfoForm.vue | 70 +++++++ .../miniappInfo/components/AppMiniappInfoModal.vue | 76 ++++++++ src/views/miniapp/order/AppOrder.data.ts | 2 +- 9 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 .env.test create mode 100644 src/views/miniapp/miniappInfo/AppMiniappInfo.api.ts create mode 100644 src/views/miniapp/miniappInfo/AppMiniappInfo.data.ts create mode 100644 src/views/miniapp/miniappInfo/AppMiniappInfoList.vue create mode 100644 src/views/miniapp/miniappInfo/V20250224_1__menu_insert_AppMiniappInfo.sql create mode 100644 src/views/miniapp/miniappInfo/components/AppMiniappInfoForm.vue create mode 100644 src/views/miniapp/miniappInfo/components/AppMiniappInfoModal.vue diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..6b38ab7 --- /dev/null +++ b/.env.test @@ -0,0 +1,28 @@ +# 是否启用mock +VITE_USE_MOCK = false + +# 发布路径 +VITE_PUBLIC_PATH = / + +# 是否启用gzip或brotli压缩 +# 选项值: gzip | brotli | none +# 如果需要多个可以使用“,”分隔 +VITE_BUILD_COMPRESS = 'gzip' + +# 使用压缩时是否删除原始文件,默认为false +VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false + +#后台接口父地址(必填) +VITE_GLOB_API_URL=/contract + +#后台接口全路径地址(必填) +VITE_GLOB_DOMAIN_URL=https://shengchuangyunkong.com/contract + +# 接口父路径前缀 +VITE_GLOB_API_URL_PREFIX= + + +# 填写后将作为乾坤子应用启动,主应用注册时AppName需保持一致(放开 VITE_GLOB_QIANKUN_MICRO_APP_NAME 参数表示jeecg-vue3将以乾坤子应用模式启动) +#VITE_GLOB_QIANKUN_MICRO_APP_NAME=jeecg-vue3 +# 作为乾坤子应用启动时必填,需与qiankun主应用注册子应用时填写的 entry 保持一致 +#VITE_GLOB_QIANKUN_MICRO_APP_ENTRY=//qiankun.boot3.jeecg.com/jeecg-vue3 diff --git a/package.json b/package.json index e78910e..824cd7f 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "pinstall": "pnpm install", "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", "dev": "vite", + "build:test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 vite build && esno ./build/script/postBuild.ts", "build": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 vite build && esno ./build/script/postBuild.ts", "build:report": "pnpm clean:cache && cross-env REPORT=true npm run build", "preview": "npm run build && vite preview", diff --git a/src/views/miniapp/miniappInfo/AppMiniappInfo.api.ts b/src/views/miniapp/miniappInfo/AppMiniappInfo.api.ts new file mode 100644 index 0000000..677b924 --- /dev/null +++ b/src/views/miniapp/miniappInfo/AppMiniappInfo.api.ts @@ -0,0 +1,64 @@ +import {defHttp} from '/@/utils/http/axios'; +import { useMessage } from "/@/hooks/web/useMessage"; + +const { createConfirm } = useMessage(); + +enum Api { + list = '/miniappInfo/appMiniappInfo/list', + save='/miniappInfo/appMiniappInfo/add', + edit='/miniappInfo/appMiniappInfo/edit', + deleteOne = '/miniappInfo/appMiniappInfo/delete', + deleteBatch = '/miniappInfo/appMiniappInfo/deleteBatch', + importExcel = '/miniappInfo/appMiniappInfo/importExcel', + exportXls = '/miniappInfo/appMiniappInfo/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + createConfirm({ + iconType: 'warning', + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/src/views/miniapp/miniappInfo/AppMiniappInfo.data.ts b/src/views/miniapp/miniappInfo/AppMiniappInfo.data.ts new file mode 100644 index 0000000..5f65f6f --- /dev/null +++ b/src/views/miniapp/miniappInfo/AppMiniappInfo.data.ts @@ -0,0 +1,109 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +import { getWeekMonthQuarterYear } from '/@/utils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '小程序名称', + align:"center", + dataIndex: 'name' + }, + { + title: 'logo', + align:"center", + dataIndex: 'logo', + customRender:render.renderImage, + }, + { + title: '用户协议', + align:"center", + dataIndex: 'agreement', + }, + { + title: '隐私协议', + align:"center", + dataIndex: 'privacy', + }, + { + title: '关于我们', + align:"center", + dataIndex: 'aboutUs', + }, + { + title: '客服电话', + align:"center", + dataIndex: 'serviceNumer' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ + { + label: "小程序名称", + field: "name", + component: 'JInput', + }, +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '小程序名称', + field: 'name', + component: 'Input', + }, + { + label: 'logo', + field: 'logo', + component: 'JImageUpload', + componentProps:{ + fileMax: 0 + }, + }, + { + label: '用户协议', + field: 'agreement', + component: 'JEditor', + }, + { + label: '隐私协议', + field: 'privacy', + component: 'JEditor', + }, + { + label: '关于我们', + field: 'aboutUs', + component: 'JEditor', + }, + { + label: '客服电话', + field: 'serviceNumer', + component: 'Input', + }, + // TODO 主键隐藏字段,目前写死为ID + { + label: '', + field: 'id', + component: 'Input', + show: false + }, +]; + +// 高级查询数据 +export const superQuerySchema = { + name: {title: '小程序名称',order: 0,view: 'text', type: 'string',}, + logo: {title: 'logo',order: 1,view: 'image', type: 'string',}, + agreement: {title: '用户协议',order: 2,view: 'umeditor', type: 'string',}, + privacy: {title: '隐私协议',order: 3,view: 'umeditor', type: 'string',}, + aboutUs: {title: '关于我们',order: 4,view: 'umeditor', type: 'string',}, + serviceNumer: {title: '客服电话',order: 5,view: 'text', type: 'string',}, +}; + +/** +* 流程表单调用这个方法获取formSchema +* @param param +*/ +export function getBpmFormSchema(_formData): FormSchema[]{ + // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema + return formSchema; +} \ No newline at end of file diff --git a/src/views/miniapp/miniappInfo/AppMiniappInfoList.vue b/src/views/miniapp/miniappInfo/AppMiniappInfoList.vue new file mode 100644 index 0000000..f06b1ed --- /dev/null +++ b/src/views/miniapp/miniappInfo/AppMiniappInfoList.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/src/views/miniapp/miniappInfo/V20250224_1__menu_insert_AppMiniappInfo.sql b/src/views/miniapp/miniappInfo/V20250224_1__menu_insert_AppMiniappInfo.sql new file mode 100644 index 0000000..025a9b3 --- /dev/null +++ b/src/views/miniapp/miniappInfo/V20250224_1__menu_insert_AppMiniappInfo.sql @@ -0,0 +1,26 @@ +-- 注意:该页面对应的前台目录为views/miniappInfo文件夹下 +-- 如果你想更改到其他目录,请修改sql中component字段对应的值 + + +INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) +VALUES ('2025022403579150100', NULL, '小程序信息管理', '/miniappInfo/appMiniappInfoList', '/miniapp/miniappInfo/AppMiniappInfoList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0); + +-- 权限控制sql +-- 新增 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2025022403579150101', '2025022403579150100', '添加小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0); +-- 编辑 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2025022403579150102', '2025022403579150100', '编辑小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0); +-- 删除 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2025022403579150103', '2025022403579150100', '删除小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0); +-- 批量删除 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2025022403579150104', '2025022403579150100', '批量删除小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0); +-- 导出excel +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2025022403579150105', '2025022403579150100', '导出excel_小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0); +-- 导入excel +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2025022403579150106', '2025022403579150100', '导入excel_小程序信息管理', NULL, NULL, 0, NULL, NULL, 2, 'miniappInfo:app_miniapp_info:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-24 15:57:10', NULL, NULL, 0, 0, '1', 0); diff --git a/src/views/miniapp/miniappInfo/components/AppMiniappInfoForm.vue b/src/views/miniapp/miniappInfo/components/AppMiniappInfoForm.vue new file mode 100644 index 0000000..377a5e1 --- /dev/null +++ b/src/views/miniapp/miniappInfo/components/AppMiniappInfoForm.vue @@ -0,0 +1,70 @@ + + + \ No newline at end of file diff --git a/src/views/miniapp/miniappInfo/components/AppMiniappInfoModal.vue b/src/views/miniapp/miniappInfo/components/AppMiniappInfoModal.vue new file mode 100644 index 0000000..81332f2 --- /dev/null +++ b/src/views/miniapp/miniappInfo/components/AppMiniappInfoModal.vue @@ -0,0 +1,76 @@ + + + + + \ No newline at end of file diff --git a/src/views/miniapp/order/AppOrder.data.ts b/src/views/miniapp/order/AppOrder.data.ts index 052ecb9..f7e262d 100644 --- a/src/views/miniapp/order/AppOrder.data.ts +++ b/src/views/miniapp/order/AppOrder.data.ts @@ -364,7 +364,7 @@ export const formSchema: FormSchema[] = [ componentProps: { dictCode: 'order_status', type: 'radio', - stringToNumer: true, + stringToNumber: true, }, dynamicRules: ({ model, schema }) => { return [{ required: true, message: '请输入订单状态!' }];