From 5f757796c804fc2b4ca14e7a324010dea3d988ab Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Fri, 10 Jan 2025 11:23:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=95=86=E6=88=B7=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 8 +-- .prettierrc | 8 +++ src/api/wallet/mch-manage.ts | 52 +++++++++---------- src/components/Select/SelectMch.vue | 63 +++++++++++++---------- vite.config.ts | 78 ++++++++++++++--------------- 5 files changed, 113 insertions(+), 96 deletions(-) create mode 100644 .prettierrc diff --git a/.env.development b/.env.development index 639afc5..84d07a4 100644 --- a/.env.development +++ b/.env.development @@ -8,15 +8,15 @@ VITE_OPEN = true ENV = 'development' # ADMIN 服务地址 -VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ +# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/ -# VITE_ADMIN_PROXY_PATH = http://localhost:9999/ +VITE_ADMIN_PROXY_PATH = http://localhost:9999/ # VITE_ADMIN_PROXY_PATH = http://192.168.101.29:9999/ # 邓-本地 # 图片访问基础地址 -VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api +# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc -# VITE_IMAGE_BASE_PATH = http://localhost:9999 +VITE_IMAGE_BASE_PATH = http://localhost:9999 # VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地 # 代码生成服务地址 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5e07d0e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "tabWidth": 2, + "useTabs": true, + "trailingComma": "all", + "semi": false, + "singleQuote": false, + "printWidth": 120 +} \ No newline at end of file diff --git a/src/api/wallet/mch-manage.ts b/src/api/wallet/mch-manage.ts index 864d6cd..fd9bf27 100644 --- a/src/api/wallet/mch-manage.ts +++ b/src/api/wallet/mch-manage.ts @@ -1,58 +1,58 @@ -import request from '/@/utils/request'; +import request from "/@/utils/request" -export function pageJoinSelect(query?: Object) { +export function select(query?: Object) { return request({ - url: '/wallet/mch-manage/page-join-select', - method: 'get', + url: "/wallet/mch-manage/select", + method: "get", params: query, - }); + }) } export function pageJoin(query?: Object) { return request({ - url: '/wallet/mch-manage/page-join', - method: 'get', + url: "/wallet/mch-manage/page-join", + method: "get", params: query, - }); + }) } export function fetchList(query?: Object) { return request({ - url: '/wallet/mch-manage/page', - method: 'get', + url: "/wallet/mch-manage/page", + method: "get", params: query, - }); + }) } export function addObj(obj?: Object) { return request({ - url: '/wallet/mch-manage', - method: 'post', + url: "/wallet/mch-manage", + method: "post", data: obj, - }); + }) } export function getObj(id?: string) { return request({ - url: '/wallet/mch-manage/' + id, - method: 'get', - }); + url: "/wallet/mch-manage/" + id, + method: "get", + }) } export function delObjs(ids?: Object) { return request({ - url: '/wallet/mch-manage', - method: 'delete', + url: "/wallet/mch-manage", + method: "delete", data: ids, - }); + }) } export function putObj(obj?: Object) { return request({ - url: '/wallet/mch-manage', - method: 'put', + url: "/wallet/mch-manage", + method: "put", data: obj, - }); + }) } /** @@ -61,10 +61,10 @@ export function putObj(obj?: Object) { */ export function selectMerchantList(type?: string) { return request({ - url: '/wallet/mch-manage/selectMerchantList', - method: 'get', + url: "/wallet/mch-manage/selectMerchantList", + method: "get", params: { type: type, }, - }); + }) } diff --git a/src/components/Select/SelectMch.vue b/src/components/Select/SelectMch.vue index 307856d..509095e 100644 --- a/src/components/Select/SelectMch.vue +++ b/src/components/Select/SelectMch.vue @@ -1,7 +1,16 @@ diff --git a/vite.config.ts b/vite.config.ts index 8fbe8e0..c7048f0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,44 +1,44 @@ -import vue from '@vitejs/plugin-vue'; -import { resolve } from 'path'; -import { defineConfig, loadEnv, ConfigEnv } from 'vite'; -import vueSetupExtend from 'vite-plugin-vue-setup-extend'; -import AutoImport from 'unplugin-auto-import/vite'; -import topLevelAwait from 'vite-plugin-top-level-await'; -import { createStyleImportPlugin, VxeTableResolve } from 'vite-plugin-style-import'; -import viteCompression from 'vite-plugin-compression'; +import vue from "@vitejs/plugin-vue" +import { resolve } from "path" +import { defineConfig, loadEnv, ConfigEnv } from "vite" +import vueSetupExtend from "vite-plugin-vue-setup-extend" +import AutoImport from "unplugin-auto-import/vite" +import topLevelAwait from "vite-plugin-top-level-await" +import { createStyleImportPlugin, VxeTableResolve } from "vite-plugin-style-import" +import viteCompression from "vite-plugin-compression" // @ts-ignore -import { svgBuilder } from '/@/components/IconSelector/index'; +import { svgBuilder } from "/@/components/IconSelector/index" -import dns from 'node:dns'; -dns.setDefaultResultOrder('verbatim'); +import dns from "node:dns" +dns.setDefaultResultOrder("verbatim") const pathResolve = (dir: string) => { - return resolve(__dirname, '.', dir); -}; + return resolve(__dirname, ".", dir) +} const alias: Record = { - '/@': pathResolve('./src/'), - 'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js', -}; + "/@": pathResolve("./src/"), + "vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js", +} const viteConfig = defineConfig((mode: ConfigEnv) => { - const env = loadEnv(mode.mode, process.cwd()); + const env = loadEnv(mode.mode, process.cwd()) // 判断是否开发环境 - const isDev = env.ENV === 'development'; + const isDev = env.ENV === "development" return { plugins: [ vue(), // Vue 插件 - svgBuilder('./src/assets/icons/'), // 将 SVG 文件转换成 Vue 组件 + svgBuilder("./src/assets/icons/"), // 将 SVG 文件转换成 Vue 组件 vueSetupExtend(), // setup语法糖增强插件 AutoImport({ - imports: ['vue', 'vue-router', 'pinia'], // 自动导入的依赖库数组 - dts: './auto-imports.d.ts', // 自动导入类型定义文件路径 + imports: ["vue", "vue-router", "pinia"], // 自动导入的依赖库数组 + dts: "./auto-imports.d.ts", // 自动导入类型定义文件路径 }), createStyleImportPlugin({ resolves: [VxeTableResolve()], // 配置vxetable 按需加载 }), topLevelAwait({ - promiseExportName: '__tla', // TLA Promise 变量名 + promiseExportName: "__tla", // TLA Promise 变量名 promiseImportName: (i) => `__tla_${i}`, // TLA Promise 导入名 }), viteCompression({ @@ -47,29 +47,29 @@ const viteConfig = defineConfig((mode: ConfigEnv) => { ], root: process.cwd(), // 项目根目录 resolve: { alias }, // 路径别名配置 - base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH, + base: mode.command === "serve" ? "./" : env.VITE_PUBLIC_PATH, optimizeDeps: { - include: ['element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/en'], + include: ["element-plus/es/locale/lang/zh-cn", "element-plus/es/locale/lang/en"], }, server: { - host: '0.0.0.0', // 服务器地址 + host: "0.0.0.0", // 服务器地址 port: env.VITE_PORT as unknown as number, // 服务器端口号 - open: env.VITE_OPEN === 'true', // 是否自动打开浏览器 + open: env.VITE_OPEN === "true", // 是否自动打开浏览器 hmr: true, // 启用热更新 proxy: { - '/api/gen': { + "/api/gen": { //单体架构下特殊处理代码生成模块代理 - target: env.VITE_IS_MICRO === 'true' ? env.VITE_ADMIN_PROXY_PATH : env.VITE_GEN_PROXY_PATH, + target: env.VITE_IS_MICRO === "true" ? env.VITE_ADMIN_PROXY_PATH : env.VITE_GEN_PROXY_PATH, changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ''), + rewrite: (path) => path.replace(/^\/api/, ""), }, - '/api': { + "/api": { target: env.VITE_ADMIN_PROXY_PATH, // 目标服务器地址 ws: true, // 是否启用 WebSocket changeOrigin: true, // 是否修改请求头中的 Origin 字段 - rewrite: (path) => path.replace(/^\/api/, ''), + rewrite: (path) => path.replace(/^\/api/, ""), }, - '^/ws/info/.*': { + "^/ws/info/.*": { target: env.VITE_ADMIN_PROXY_PATH, // 目标服务器地址 ws: true, // 是否启用 WebSocket changeOrigin: true, @@ -77,10 +77,10 @@ const viteConfig = defineConfig((mode: ConfigEnv) => { }, }, build: { - outDir: 'dist', // 打包输出目录// + outDir: "dist", // 打包输出目录// chunkSizeWarningLimit: 1500, // 代码分包阈值 // 开发使用 esbuild 更快,生产环境打包使用 terser 可以删除更多注释 - minify: isDev ? 'esbuild' : 'terser', + minify: isDev ? "esbuild" : "terser", terserOptions: { compress: { drop_console: true, // 删除 console @@ -97,8 +97,8 @@ const viteConfig = defineConfig((mode: ConfigEnv) => { assetFileNames: `assets/[name].[hash].[ext]`, compact: true, manualChunks: { - vue: ['vue', 'vue-router', 'pinia'], - echarts: ['echarts'], + vue: ["vue", "vue-router", "pinia"], + echarts: ["echarts"], }, }, }, @@ -111,7 +111,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => { __VERSION__: JSON.stringify(process.env.npm_package_version), __NEXT_NAME__: JSON.stringify(process.env.npm_package_name), }, - }; -}); + } +}) -export default viteConfig; +export default viteConfig