diff --git a/.env b/.env index 586f6dc..677b4b9 100644 --- a/.env +++ b/.env @@ -1,11 +1,2 @@ -# 租户配置(必填) -VITE_TENANT_ID=10606 - -# 租户名称 -VITE_TENANT_NAME=企业商城 - -# WebSoftAdmin 授权码 (必填-请联系官方获取) -VITE_LICENSE_CODE=dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW== - -# 服务端 API 配置(可选) -VITE_SERVER_API_URL=https://server.websoft.top/api +VITE_APP_NAME=塔吊 +VITE_API_URL=/api diff --git a/.env.development b/.env.development index 6afaae4..d44294c 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,3 @@ -VITE_APP_NAME=后台管理(开发环境) -#VITE_API_URL=http://127.0.0.1:9200/api -#VITE_SERVER_API_URL=http://127.0.0.1:8000/api - -# -VITE_API_URL=https://guilixu-api.websoft.top/api -#VITE_SERVER_API_URL=http://47.107.249.41:8000/api +VITE_APP_NAME=后台管理系统 +VITE_API_URL=http://127.0.0.1:9200/api +#VITE_API_URL=https://guilixu-api.websoft.top/api diff --git a/.env.production b/.env.production index 1b438d0..7708095 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,2 @@ -# 服务端 API 配置(可选) -VITE_SERVER_API_URL=https://server.websoft.top/api -# API 配置(必填) +VITE_APP_NAME=后台管理系统 VITE_API_URL=https://guilixu-api.websoft.top/api -# WebSoftAdmin 授权码 (必填-请联系官方获取) -VITE_LICENSE_CODE=dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW== diff --git a/.idea/UniappTool.xml b/.idea/UniappTool.xml new file mode 100644 index 0000000..0980911 --- /dev/null +++ b/.idea/UniappTool.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9ae2fa3 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,125 @@ + + + + \ No newline at end of file diff --git a/package.json b/package.json index c58024b..ef3c058 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ } }, "scripts": { - "postinstall": "bash scripts/fix-ele-admin-pro.sh", + "postinstall": "node scripts/antd4-less-compat.js", "dev": "vite", "dev:test": "vite --mode test", "build": "vite build", diff --git a/scripts/antd4-less-compat.js b/scripts/antd4-less-compat.js index 2a7181e..2fd3454 100644 --- a/scripts/antd4-less-compat.js +++ b/scripts/antd4-less-compat.js @@ -7,50 +7,53 @@ const fs = require('fs'); const path = require('path'); const rootDir = path.resolve(__dirname, '..'); -// 尝试多个可能的位置(pnpm 的 .pnpm store 和直接链接) -const possiblePaths = [ - path.join(rootDir, 'node_modules/ele-admin-pro/es/style/common.less'), - path.join(rootDir, 'node_modules/.pnpm/node_modules/ele-admin-pro/es/style/common.less'), -]; - -// 也搜索 .pnpm 目录下的实际路径 -const pnpmDir = path.join(rootDir, 'node_modules/.pnpm'); -if (fs.existsSync(pnpmDir)) { - const entries = fs.readdirSync(pnpmDir).filter(e => e.startsWith('ele-admin-pro')); - for (const entry of entries) { - possiblePaths.push(path.join(pnpmDir, entry, 'node_modules/ele-admin-pro/es/style/common.less')); - } -} - -let filePath = null; -for (const p of possiblePaths) { - if (fs.existsSync(p)) { - filePath = p; - break; - } -} - -if (!fs.existsSync(filePath)) { - console.log('[antd4-compat] common.less not found, skipping'); - process.exit(0); -} - -let content = fs.readFileSync(filePath, 'utf8'); -const original = content; - const primaryColors = { 1: '#e6f4ff', 2: '#bae0ff', 3: '#91caff', 4: '#69b1ff', 5: '#4096ff', 6: '#1677ff', 7: '#0958d9', 8: '#003eb3', 9: '#002c8c', 10: '#001d66' }; const successColors = { 1: '#f6ffed', 2: '#d9f7be', 3: '#b7eb8f', 4: '#95de64', 5: '#73d13d', 6: '#52c41a', 7: '#389e0d', 8: '#237804', 9: '#135200', 10: '#092b00' }; const warningColors = { 1: '#fffbe6', 2: '#fff1b8', 3: '#ffe58f', 4: '#ffd666', 5: '#ffc53d', 6: '#faad14', 7: '#d48806', 8: '#ad6800', 9: '#874d00', 10: '#612500' }; const errorColors = { 1: '#fff2f0', 2: '#ffccc7', 3: '#ffa39e', 4: '#ff7875', 5: '#ff4d4f', 6: '#f5222d', 7: '#cf1322', 8: '#a8071a', 9: '#820014', 10: '#5c0011' }; -content = content.replace(/~`colorPalette\('@\{primary-color\}',\s*(\d+)\)\s*`/g, (m, idx) => primaryColors[idx] || '#1677ff'); -content = content.replace(/~`colorPalette\('@\{success-color\}',\s*(\d+)\)\s*`/g, (m, idx) => successColors[idx] || '#52c41a'); -content = content.replace(/~`colorPalette\('@\{warning-color\}',\s*(\d+)\)\s*`/g, (m, idx) => warningColors[idx] || '#faad14'); -content = content.replace(/~`colorPalette\('@\{error-color\}',\s*(\d+)\)\s*`/g, (m, idx) => errorColors[idx] || '#ff4d4f'); +function collectLessFiles(dir, results = []) { + if (!fs.existsSync(dir)) return results; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const fullPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + collectLessFiles(fullPath, results); + } else if (entry.isFile() && fullPath.endsWith('.less')) { + results.push(fullPath); + } + } + return results; +} -if (content !== original) { - fs.writeFileSync(filePath, content); - console.log('[antd4-compat] Replaced colorPalette calls in common.less'); +function replacePalette(content) { + let next = content; + next = next.replace(/~`colorPalette\('@\{primary-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => primaryColors[idx] || '#1677ff'); + next = next.replace(/~`colorPalette\('@\{success-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => successColors[idx] || '#52c41a'); + next = next.replace(/~`colorPalette\('@\{warning-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => warningColors[idx] || '#faad14'); + next = next.replace(/~`colorPalette\('@\{error-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => errorColors[idx] || '#ff4d4f'); + return next; +} + +const eleAdminDir = path.join(rootDir, 'node_modules/ele-admin-pro'); +const lessFiles = collectLessFiles(eleAdminDir); + +if (!lessFiles.length) { + console.log('[antd4-compat] ele-admin-pro less files not found, skipping'); + process.exit(0); +} + +let changedCount = 0; +for (const filePath of lessFiles) { + const original = fs.readFileSync(filePath, 'utf8'); + const content = replacePalette(original); + if (content !== original) { + fs.writeFileSync(filePath, content); + changedCount += 1; + } +} + +if (changedCount > 0) { + console.log(`[antd4-compat] Replaced colorPalette calls in ${changedCount} less file(s)`); } else { console.log('[antd4-compat] No colorPalette calls found, skipping'); } diff --git a/src/api/shop/shopGoods/index.ts b/src/api/shop/shopGoods/index.ts index 5479fc2..f2e503b 100644 --- a/src/api/shop/shopGoods/index.ts +++ b/src/api/shop/shopGoods/index.ts @@ -1,6 +1,6 @@ import request from '@/utils/request'; import type { ApiResult, PageResult } from '@/api'; -import type { ShopGoods, ShopGoodsCollectParam, ShopGoodsParam } from './model'; +import type { ShopGoods, ShopGoodsParam } from './model'; import { MODULES_API_URL } from '@/config/setting'; /** @@ -132,12 +132,14 @@ export async function importShopGoods(file: File) { } /** - * 通过商品链接采集入库 + * 导入商品图片 */ -export async function collectShopGoods(data: ShopGoodsCollectParam) { +export async function importShopGoodsImages(file: File) { + const formData = new FormData(); + formData.append('file', file); const res = await request.post>( - MODULES_API_URL + '/shop/shop-goods/collect', - data + MODULES_API_URL + '/shop/shop-goods/import/images', + formData ); if (res.data.code === 0) { return res.data.message; diff --git a/src/api/shop/shopGoodsCategory/model/index.ts b/src/api/shop/shopGoodsCategory/model/index.ts index 375ed63..c967654 100644 --- a/src/api/shop/shopGoodsCategory/model/index.ts +++ b/src/api/shop/shopGoodsCategory/model/index.ts @@ -14,6 +14,8 @@ export interface ShopGoodsCategory { type?: number; // 分类图片 image?: string; + // 广告图 + adImage?: string; // 上级分类ID parentId?: number; // 路由/链接地址 diff --git a/src/api/system/payment/model/index.ts b/src/api/system/payment/model/index.ts index 07c4ee4..32c8306 100644 --- a/src/api/system/payment/model/index.ts +++ b/src/api/system/payment/model/index.ts @@ -20,6 +20,10 @@ export interface Payment { appId?: string; // 商户号 mchId?: string; + // 子商户应用ID + subAppId?: string; + // 子商户号 + subMchId?: string; // 设置APIv3密钥 apiKey?: string; // 证书文件 (CERT) diff --git a/src/config/setting.ts b/src/config/setting.ts index 516e620..fd04210 100644 --- a/src/config/setting.ts +++ b/src/config/setting.ts @@ -8,7 +8,7 @@ export const APP_SECRET = import.meta.env.VITE_APP_SECRET || ''; export const domain = import.meta.env.VITE_DOMAIN || 'https://your-domain.com'; // 主节点 export const SERVER_API_URL = - import.meta.env.VITE_SERVER_API_URL || 'https://your-api.com/api'; + import.meta.env.VITE_SERVER_API_URL || 'https://server.websoft.top/api'; // 模块节点 export const MODULES_API_URL = localStorage.getItem('ApiUrl') || import.meta.env.VITE_API_URL; @@ -74,7 +74,7 @@ export const MAP_KEY = import.meta.env.VITE_MAP_KEY || ''; // 高德地图 安全密钥 export const MAP_CODE = import.meta.env.VITE_MAP_CODE || ''; // WebSoftAdmin 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码 -export const LICENSE_CODE = import.meta.env.VITE_LICENSE_CODE || ''; +export const LICENSE_CODE = 'dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW=='; // 缩略图前缀 export const FILE_THUMBNAIL = FILE_SERVER + '/thumbnail'; // 文件下载前缀 diff --git a/src/views/shop/shopGoods/components/search.vue b/src/views/shop/shopGoods/components/search.vue index 122451d..155f7d1 100644 --- a/src/views/shop/shopGoods/components/search.vue +++ b/src/views/shop/shopGoods/components/search.vue @@ -25,11 +25,11 @@ 导入 - + - 采集 + 导入图片 导出xls @@ -70,10 +70,10 @@