diff --git a/.gitignore b/.gitignore index 59c9154..75c8526 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,18 @@ package-lock.json yarn.lock + +# 微信小程序CI上传密钥(敏感文件,禁止提交) +private.key + +# 可选:如果有测试环境的密钥文件,也一起忽略 +private-test.key + +# 其他小程序开发常见忽略项(建议一并添加,避免冗余文件提交) +node_modules/ +dist/ +unpackage/ +.DS_Store +*.log +.vscode/ +.project diff --git a/api/product.js b/api/product.js index 457922b..ebcacd7 100644 --- a/api/product.js +++ b/api/product.js @@ -287,11 +287,12 @@ export function getBrandList(params) { } // 获取品牌树状结构 -export function getBrandTree(storeId) { +export function getBrandTree(storeId, brandName) { return request8081({ - baseUrl: 'http://193.112.94.36:8081', + baseUrl: 'http://192.168.0.7:8081', url: `/mall/brand/getTree/${storeId}`, - method: 'get' + method: 'get', + params: { brandName } }) } @@ -325,11 +326,12 @@ export function addClassification(data) { } // 获取分类树状结构 -export function getClassificationTree(storeId) { +export function getClassificationTree(storeId, classificationName) { return request8081({ - baseUrl: 'http://193.112.94.36:8081', + baseUrl: 'http://192.168.0.7:8081', url: `/mall/classification/getTree/${storeId}`, - method: 'get' + method: 'get', + params: { classificationName } }) } diff --git a/ci-script.js b/ci-script.js new file mode 100644 index 0000000..d3fbb92 --- /dev/null +++ b/ci-script.js @@ -0,0 +1,61 @@ +const ci = require('miniprogram-ci'); +const path = require('path'); +const fs = require('fs'); + +// 配置项(必须改!) +const config = { + appid: 'wx9393bde462d9805a', // 替换成你的正式小程序AppID + // 替换成你的密钥文件路径(比如 private.wx9393bde462d9805a.key) + privateKeyPath: path.resolve(__dirname, './private.wx9393bde462d9805a.key'), + projectPath: path.resolve(__dirname, './unpackage/dist/dev/mp-weixin'), + version: '1.0.0', + desc: '自动化上传测试', + // ci-script.js 中的 setting 配置 +setting: { + es6: true, + es7: true, + minify: true, // 基础压缩 + minifyJS: true, // 压缩JS(移除注释、空格、变量名混淆) + minifyWXSS: true, // 压缩样式(合并重复样式、移除空格) + minifyXML: true, // 压缩配置文件(app.json/page.json) + autoPrefixWXSS: true, + codeProtect: false, // 关闭代码保护(保护会增加体积) + ignoreUnusedFiles: true, // 自动忽略未引用的文件 + disableUseStrict: true, // 禁用"use strict"减少JS体积 + disableShowSourceMap: true // 关闭sourcemap(调试文件占体积) +}, + previewQrOutputPath: path.resolve(__dirname, './preview-qr.png'), + onProgressUpdate: (res) => { + console.log(`进度:${res.progress}%,状态:${res.status}`); + } +}; + +// 上传代码方法 +async function uploadCode() { + try { + if (!fs.existsSync(config.privateKeyPath)) { + throw new Error(`密钥文件不存在:${config.privateKeyPath}`); + } + const project = new ci.Project({ + appid: config.appid, + type: 'miniProgram', + projectPath: config.projectPath, + privateKeyPath: config.privateKeyPath, + ignores: ['node_modules/**/*'], + }); + const uploadResult = await ci.upload({ + project, + version: config.version, + desc: config.desc, + setting: config.setting, + onProgressUpdate: config.onProgressUpdate, + }); + console.log('✅ 代码上传成功:', uploadResult); + } catch (error) { + console.error('❌ 上传失败:', error.message); + process.exit(1); + } +} + +// 执行上传 +uploadCode(); \ No newline at end of file diff --git a/config.js b/config.js index ff72a7b..fba8b0c 100644 --- a/config.js +++ b/config.js @@ -13,7 +13,7 @@ module.exports = { // 应用版本 version: "1.2.0", // 应用logo - logo: "/static/logo.png", + logo: "http://193.112.94.36:8099/static/images/logo.png", // 官方网站 site_url: "http://ruoyi.vip", // 政策协议 diff --git a/manifest.json b/manifest.json index b011686..197d863 100644 --- a/manifest.json +++ b/manifest.json @@ -59,16 +59,16 @@ "subPackages" : true }, "usingComponents" : true, - "networkTimeout": { - "request": 10000, - "connectSocket": 10000, - "uploadFile": 10000, - "downloadFile": 10000 + "networkTimeout" : { + "request" : 10000, + "connectSocket" : 10000, + "uploadFile" : 10000, + "downloadFile" : 10000 } }, "vueVersion" : "2", "h5" : { - "template" : "static/index.html", + "template" : "http://193.112.94.36:8099/static/images/index.html", "devServer" : { "port" : 9090, "https" : false diff --git a/package.json b/package.json new file mode 100644 index 0000000..26ef0cc --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "miniprogram-ci": "^2.1.26" + } +} diff --git a/pages.json b/pages.json index 637147c..78bd434 100644 --- a/pages.json +++ b/pages.json @@ -198,4 +198,4 @@ "navigationBarTitleText": "RuoYi", "navigationBarBackgroundColor": "#FFFFFF" } -} +} \ No newline at end of file diff --git a/pages/BrandSelector/BrandSelector.vue b/pages/BrandSelector/BrandSelector.vue index d81b98c..ad8ce2e 100644 --- a/pages/BrandSelector/BrandSelector.vue +++ b/pages/BrandSelector/BrandSelector.vue @@ -12,16 +12,21 @@ - - - + + + + + + - + - + 品牌管理 @@ -47,18 +52,9 @@ export default { name: 'BrandSelector', props: { - visible: { - type: Boolean, - default: false - }, - defaultValue: { - type: String, - default: '默认品牌' - }, - brandList: { - type: Array, - default: () => [{ name: '默认品牌' }] - } + visible: { type: Boolean, default: false }, + defaultValue: { type: String, default: '默认品牌' }, + brandList: { type: Array, default: () => [{ name: '默认品牌' }] } }, data() { return { @@ -75,7 +71,7 @@ export default { filteredBrandList() { if (!this.searchKeyword) return this.brandList return this.brandList.filter(item => - item.name.includes(this.searchKeyword) + item.name.toLowerCase().includes(this.searchKeyword.toLowerCase()) ) } }, @@ -92,12 +88,16 @@ export default { }, handleToBrandManagement() { this.$emit('toBrandManagement') + }, + handleSearchInput(e) { + this.searchKeyword = e.detail.value } } } \ No newline at end of file diff --git a/pages/addBrand/addBrand.vue b/pages/addBrand/addBrand.vue index 8a6627a..3fd9330 100644 --- a/pages/addBrand/addBrand.vue +++ b/pages/addBrand/addBrand.vue @@ -10,7 +10,13 @@ - + @@ -181,12 +187,14 @@ export default { renameBrandIndex: null, // 编辑二级品牌相关 editSubBrandId: null, + // 搜索关键字 + searchKeyword: '' } }, onLoad() { // 获取storeId this.storeId = getStoreId() - // 加载品牌列表 + // 加载品牌列表,初始时不传入搜索关键字 this.loadBrandList() }, methods: { @@ -194,13 +202,12 @@ export default { uni.navigateBack() }, // 加载品牌列表 - async loadBrandList() { + async loadBrandList(brandName = '') { try { - // 使用新的getBrandTree接口,传入storeId作为URL参数 - const res = await getBrandTree(this.storeId) + // 使用新的getBrandTree接口,传入storeId作为URL参数和brandName作为查询参数 + const res = await getBrandTree(this.storeId, brandName) if (res.code === 200 && res.data) { - // 新接口直接返回树状结构,可能不需要额外处理 - // 但需要根据实际返回格式调整 + // 格式化并设置品牌列表 this.brandList = this.formatBrandData(res.data) } } catch (error) { @@ -222,6 +229,13 @@ export default { })) : [] })) }, + // 搜索输入处理 + onSearchInput() { + const keyword = this.searchKeyword.trim() + + // 调用API进行搜索,传入搜索关键字 + this.loadBrandList(keyword) + }, // 展开/折叠一级品牌 toggleExpand(index) { this.brandList[index].expanded = !this.brandList[index].expanded @@ -615,6 +629,8 @@ export default { font-size: 28rpx; width: 100%; box-sizing: border-box; + color: #333; + height: 72rpx; } /* 品牌树 */ diff --git a/pages/category/category.vue b/pages/category/category.vue index 51766a2..53347c9 100644 --- a/pages/category/category.vue +++ b/pages/category/category.vue @@ -12,9 +12,17 @@ - 🔍 - - + + + + @@ -307,7 +315,7 @@ export default { const storeInfo = getStoreInfo(); const storeId = storeInfo ? storeInfo.storeId : 1; - getClassificationTree(storeId) + getClassificationTree(storeId, this.searchText) .then(res => { if (res.code === 200) { this.categories = res.data || []; @@ -594,6 +602,18 @@ export default { console.error('重命名分类失败:', error); uni.showToast({ title: '网络请求失败', icon: 'none' }); }); + }, + + // 搜索输入处理 + handleSearchInput() { + // 触发分类搜索 + this.loadClassificationTree(); + }, + + // 搜索确认处理 + handleSearchConfirm() { + // 触发分类搜索 + this.loadClassificationTree(); } } }; diff --git a/pages/edit/edit.vue b/pages/edit/edit.vue index 62a7bf9..d5054ab 100644 --- a/pages/edit/edit.vue +++ b/pages/edit/edit.vue @@ -262,13 +262,39 @@ - + + + 搜索 + @@ -334,13 +360,39 @@ - + + + 搜索 + @@ -402,7 +454,7 @@