chore(realse): 完善发布流程
This commit is contained in:
53
.gitignore
vendored
Normal file
53
.gitignore
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# 依赖目录
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# 编译输出目录
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# 编辑器配置
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# 依赖锁文件
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
# 日志文件
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# 微信开发者工具生成文件
|
||||||
|
*.jks
|
||||||
|
*.p12
|
||||||
|
*.keystore
|
||||||
|
*.mobileprovision
|
||||||
|
*.p8
|
||||||
|
*.p10
|
||||||
|
*.pem
|
||||||
|
project.private.config.json
|
||||||
|
miniprogram_npm/
|
||||||
|
.miniprogram/
|
||||||
|
we7temp/
|
||||||
|
|
||||||
|
|
||||||
|
# 环境变量文件
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
# 其他临时文件
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
192
README.md
Normal file
192
README.md
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
# 数码喷墨墨水微信小程序项目
|
||||||
|
|
||||||
|
## 项目介绍
|
||||||
|
|
||||||
|
本项目是为数码喷墨墨水客户定制开发的微信小程序,用于展示和销售数码喷墨墨水产品,提供在线购物、订单管理、用户中心等功能。
|
||||||
|
|
||||||
|
- **客户名称**:数码喷墨墨水
|
||||||
|
- **uniacid**:2285
|
||||||
|
- **后台网站地址**:https://xcx.aigc-quickapp.com
|
||||||
|
|
||||||
|
## 项目结构
|
||||||
|
|
||||||
|
```
|
||||||
|
├── app.js # 小程序入口文件
|
||||||
|
├── app.json # 小程序全局配置
|
||||||
|
├── app.wxss # 小程序全局样式
|
||||||
|
├── common/ # 公共文件目录
|
||||||
|
│ ├── main.js # 主入口文件
|
||||||
|
│ ├── main.wxss # 主样式文件
|
||||||
|
│ ├── runtime.js # 运行时文件
|
||||||
|
│ └── vendor.js # 第三方依赖文件
|
||||||
|
├── components/ # 自定义组件目录
|
||||||
|
│ ├── common-payment/ # 公共支付组件
|
||||||
|
│ ├── diy-components/ # DIY组件
|
||||||
|
│ ├── hover-nav/ # 悬浮导航组件
|
||||||
|
│ ├── loading-cover/ # 加载遮罩组件
|
||||||
|
│ ├── mescroll/ # 滚动加载组件
|
||||||
|
│ ├── ns-adv/ # 广告组件
|
||||||
|
│ ├── ns-contact/ # 联系组件
|
||||||
|
│ ├── ns-copyright/ # 版权组件
|
||||||
|
│ ├── ns-empty/ # 空状态组件
|
||||||
|
│ ├── ns-form/ # 表单组件
|
||||||
|
│ ├── ns-goods-action/# 商品操作组件
|
||||||
|
│ ├── ns-goods-sku/ # 商品SKU组件
|
||||||
|
│ ├── ns-loading/ # 加载组件
|
||||||
|
│ ├── ns-login/ # 登录组件
|
||||||
|
│ ├── ns-navbar/ # 导航栏组件
|
||||||
|
│ ├── ns-new-gift/ # 新手礼品组件
|
||||||
|
│ ├── ns-newform/ # 新表单组件
|
||||||
|
│ ├── ns-payment/ # 支付组件
|
||||||
|
│ ├── ns-select-time/ # 时间选择组件
|
||||||
|
│ ├── ns-switch/ # 开关组件
|
||||||
|
│ ├── payment/ # 支付相关组件
|
||||||
|
│ ├── pick-regions/ # 地区选择组件
|
||||||
|
│ ├── register-reward/# 注册奖励组件
|
||||||
|
│ └── toTop/ # 返回顶部组件
|
||||||
|
├── pages/ # 页面目录
|
||||||
|
│ ├── contact/ # 联系我们页面
|
||||||
|
│ ├── goods/ # 商品相关页面
|
||||||
|
│ ├── index/ # 首页
|
||||||
|
│ ├── member/ # 会员中心
|
||||||
|
│ └── order/ # 订单相关页面
|
||||||
|
├── pages_promotion/ # 促销活动页面
|
||||||
|
├── pages_tool/ # 工具页面
|
||||||
|
├── project.config.json # 微信开发者工具配置
|
||||||
|
├── site.js # 站点配置文件
|
||||||
|
├── static/ # 静态资源目录
|
||||||
|
│ └── img/ # 图片资源
|
||||||
|
└── uni_modules/ # uni_modules模块
|
||||||
|
```
|
||||||
|
|
||||||
|
## 技术栈
|
||||||
|
|
||||||
|
- **开发框架**:微信小程序原生开发
|
||||||
|
- **组件库**:自定义组件 + uni_modules
|
||||||
|
- **数据请求**:微信小程序原生API
|
||||||
|
- **状态管理**:小程序全局状态
|
||||||
|
|
||||||
|
## 安装和运行
|
||||||
|
|
||||||
|
### 环境要求
|
||||||
|
|
||||||
|
- 微信开发者工具
|
||||||
|
- Node.js (可选,用于依赖管理)
|
||||||
|
|
||||||
|
### 安装步骤
|
||||||
|
|
||||||
|
1. 克隆或下载项目到本地
|
||||||
|
2. 打开微信开发者工具
|
||||||
|
3. 导入项目目录
|
||||||
|
4. 配置appid(如果需要)
|
||||||
|
5. 点击编译运行
|
||||||
|
|
||||||
|
## 项目配置
|
||||||
|
|
||||||
|
### 站点配置
|
||||||
|
|
||||||
|
在`site.js`文件中配置站点信息:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
module.exports={
|
||||||
|
baseUrl: "https://xcx.aigc-quickapp.com", // 后台接口地址
|
||||||
|
uniacid: 2285 // 站点ID
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 全局配置
|
||||||
|
|
||||||
|
在`app.json`文件中配置小程序的全局设置,包括页面路径、窗口样式、tabBar等。
|
||||||
|
|
||||||
|
## 主要功能模块
|
||||||
|
|
||||||
|
### 首页
|
||||||
|
- 轮播图展示
|
||||||
|
- 商品分类导航
|
||||||
|
- 热门商品推荐
|
||||||
|
- 促销活动展示
|
||||||
|
|
||||||
|
### 商品模块
|
||||||
|
- 商品列表展示
|
||||||
|
- 商品详情查看
|
||||||
|
- 商品SKU选择
|
||||||
|
- 商品搜索功能
|
||||||
|
|
||||||
|
### 购物车
|
||||||
|
- 商品添加/删除
|
||||||
|
- 商品数量调整
|
||||||
|
- 购物车结算
|
||||||
|
|
||||||
|
### 订单模块
|
||||||
|
- 订单生成
|
||||||
|
- 订单列表
|
||||||
|
- 订单详情
|
||||||
|
- 订单支付
|
||||||
|
- 订单售后
|
||||||
|
|
||||||
|
### 会员中心
|
||||||
|
- 用户信息管理
|
||||||
|
- 收货地址管理
|
||||||
|
- 优惠券管理
|
||||||
|
- 积分管理
|
||||||
|
- 充值功能
|
||||||
|
|
||||||
|
### 联系我们
|
||||||
|
- 联系方式展示
|
||||||
|
- 在线客服
|
||||||
|
|
||||||
|
## 开发注意事项
|
||||||
|
|
||||||
|
1. 所有接口请求需通过`baseUrl`配置的后台地址
|
||||||
|
2. 组件使用需遵循微信小程序组件规范
|
||||||
|
3. 页面跳转需使用微信小程序导航API
|
||||||
|
4. 数据缓存需使用微信小程序存储API
|
||||||
|
5. 开发过程中需注意小程序的尺寸限制和性能优化
|
||||||
|
|
||||||
|
## 部署说明
|
||||||
|
|
||||||
|
1. 在微信开发者工具中点击"上传"
|
||||||
|
2. 填写版本号和更新日志
|
||||||
|
3. 登录微信公众平台
|
||||||
|
4. 进入版本管理
|
||||||
|
5. 提交审核
|
||||||
|
6. 审核通过后发布上线
|
||||||
|
|
||||||
|
## 项目发布
|
||||||
|
|
||||||
|
### 使用 release.js 脚本发布
|
||||||
|
|
||||||
|
1. 确保已安装 Node.js 环境
|
||||||
|
2. 在项目根目录执行以下命令:
|
||||||
|
```bash
|
||||||
|
node release.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### 生成文件说明
|
||||||
|
|
||||||
|
- **输出目录**:项目根目录下的 `dist/` 文件夹
|
||||||
|
- **主要文件**:
|
||||||
|
- 压缩后的小程序源代码文件
|
||||||
|
- 按日期命名的 ZIP 压缩包(格式:`数码喷墨墨水-定制化-YYYY-MM-DD-mp-weixin.zip`)
|
||||||
|
|
||||||
|
### 交付给发布人员的文件格式
|
||||||
|
|
||||||
|
- 交付文件:`dist/` 目录下生成的 ZIP 压缩包
|
||||||
|
- 文件命名:`数码喷墨墨水-定制化-YYYY-MM-DD-mp-weixin.zip`(YYYY-MM-DD 为当前日期)
|
||||||
|
- 交付内容:包含完整的小程序源代码,已进行 WXML 压缩优化
|
||||||
|
|
||||||
|
发布人员可直接使用此 ZIP 压缩包进行小程序上线发布操作。
|
||||||
|
|
||||||
|
## 维护和更新
|
||||||
|
|
||||||
|
- 定期检查后台接口变化
|
||||||
|
- 及时更新小程序版本
|
||||||
|
- 修复用户反馈的问题
|
||||||
|
- 优化用户体验
|
||||||
|
|
||||||
|
## 联系方式
|
||||||
|
|
||||||
|
如有问题或建议,请联系技术支持:
|
||||||
|
- 后台管理地址:https://xcx.aigc-quickapp.com
|
||||||
|
- 客户名称:数码喷墨墨水
|
||||||
|
- uniacid:2285
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
// 定义要压缩的目录
|
|
||||||
const rootDir = __dirname;
|
|
||||||
|
|
||||||
// 定义wxml压缩函数
|
|
||||||
function compressWxml(content) {
|
|
||||||
// 移除HTML注释
|
|
||||||
content = content.replace(/<!--[\s\S]*?-->/g, '');
|
|
||||||
|
|
||||||
// 移除多余的空白字符(空格、换行、制表符)
|
|
||||||
// 保留标签内的必要空格
|
|
||||||
content = content.replace(/\s+/g, ' ');
|
|
||||||
|
|
||||||
// 移除标签前后的空格
|
|
||||||
content = content.replace(/\s*</g, '<');
|
|
||||||
content = content.replace(/>\s*/g, '>');
|
|
||||||
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 递归遍历目录并压缩wxml文件
|
|
||||||
function traverseDir(dir) {
|
|
||||||
const files = fs.readdirSync(dir);
|
|
||||||
|
|
||||||
files.forEach(file => {
|
|
||||||
const filePath = path.join(dir, file);
|
|
||||||
const stats = fs.statSync(filePath);
|
|
||||||
|
|
||||||
if (stats.isDirectory()) {
|
|
||||||
// 跳过node_modules和其他不需要处理的目录
|
|
||||||
if (file !== 'node_modules' && file !== '.git' && file !== 'dist') {
|
|
||||||
traverseDir(filePath);
|
|
||||||
}
|
|
||||||
} else if (path.extname(file) === '.wxml') {
|
|
||||||
// 读取并压缩wxml文件
|
|
||||||
const content = fs.readFileSync(filePath, 'utf8');
|
|
||||||
const compressedContent = compressWxml(content);
|
|
||||||
|
|
||||||
// 写回压缩后的内容
|
|
||||||
fs.writeFileSync(filePath, compressedContent, 'utf8');
|
|
||||||
|
|
||||||
console.log(`Compressed: ${filePath}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开始压缩
|
|
||||||
console.log('Start compressing wxml files...');
|
|
||||||
traverseDir(rootDir);
|
|
||||||
console.log('All wxml files compressed successfully!');
|
|
||||||
BIN
dist/数码喷墨墨水-定制化-2025-12-20-mp-weixin.zip
vendored
BIN
dist/数码喷墨墨水-定制化-2025-12-20-mp-weixin.zip
vendored
Binary file not shown.
132
release.js
Normal file
132
release.js
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
|
||||||
|
// 定义项目根目录
|
||||||
|
const rootDir = __dirname;
|
||||||
|
// 定义输出目录
|
||||||
|
const distDir = path.join(rootDir, 'dist');
|
||||||
|
// 定义要排除的目录和文件
|
||||||
|
const excludeDirs = ['node_modules', '.git', 'dist', '.vscode'];
|
||||||
|
const excludeFiles = ['.gitignore', 'package-lock.json', 'yarn.lock', 'release.js'];
|
||||||
|
|
||||||
|
// 获取当前日期,用于生成zip文件名(格式:YYYY-MM-DD)
|
||||||
|
function getCurrentDate() {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义wxml压缩函数
|
||||||
|
function compressWxml(content) {
|
||||||
|
// 移除HTML注释
|
||||||
|
content = content.replace(/<!--[\s\S]*?-->/g, '');
|
||||||
|
|
||||||
|
// 移除多余的空白字符(空格、换行、制表符)
|
||||||
|
// 保留标签内的必要空格
|
||||||
|
content = content.replace(/\s+/g, ' ');
|
||||||
|
|
||||||
|
// 移除标签前后的空格
|
||||||
|
content = content.replace(/\s*</g, '<');
|
||||||
|
content = content.replace(/>\s*/g, '>');
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归复制目录并压缩wxml文件
|
||||||
|
function copyAndCompressDir(sourceDir, targetDir) {
|
||||||
|
// 创建目标目录
|
||||||
|
if (!fs.existsSync(targetDir)) {
|
||||||
|
fs.mkdirSync(targetDir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
const files = fs.readdirSync(sourceDir);
|
||||||
|
|
||||||
|
files.forEach(file => {
|
||||||
|
const sourcePath = path.join(sourceDir, file);
|
||||||
|
const targetPath = path.join(targetDir, file);
|
||||||
|
const stats = fs.statSync(sourcePath);
|
||||||
|
|
||||||
|
// 跳过排除的目录和文件
|
||||||
|
if (excludeDirs.includes(file) || excludeFiles.includes(file)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
// 递归处理子目录
|
||||||
|
copyAndCompressDir(sourcePath, targetPath);
|
||||||
|
} else {
|
||||||
|
if (path.extname(file) === '.wxml') {
|
||||||
|
// 压缩wxml文件
|
||||||
|
const content = fs.readFileSync(sourcePath, 'utf8');
|
||||||
|
const compressedContent = compressWxml(content);
|
||||||
|
fs.writeFileSync(targetPath, compressedContent, 'utf8');
|
||||||
|
console.log(`Compressed and copied: ${sourcePath}`);
|
||||||
|
} else {
|
||||||
|
// 直接复制其他文件
|
||||||
|
fs.copyFileSync(sourcePath, targetPath);
|
||||||
|
console.log(`Copied: ${sourcePath}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用系统命令创建zip压缩包
|
||||||
|
function createZipArchive(sourceDir, outputPath) {
|
||||||
|
try {
|
||||||
|
// 根据操作系统选择命令
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
// Windows系统使用PowerShell命令
|
||||||
|
const command = `Compress-Archive -Path "${sourceDir}\*" -DestinationPath "${outputPath}" -Force`;
|
||||||
|
execSync(command, { shell: 'powershell.exe' });
|
||||||
|
} else {
|
||||||
|
// Linux/Mac系统使用zip命令
|
||||||
|
const command = `zip -r "${outputPath}" * -d "${sourceDir}"`;
|
||||||
|
execSync(command, { cwd: sourceDir });
|
||||||
|
}
|
||||||
|
console.log(`Zip archive created: ${outputPath}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error creating zip archive:', error.message);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 主函数
|
||||||
|
function main() {
|
||||||
|
try {
|
||||||
|
// 清理dist目录(如果存在)
|
||||||
|
if (fs.existsSync(distDir)) {
|
||||||
|
fs.rmSync(distDir, { recursive: true, force: true });
|
||||||
|
console.log('Cleaned dist directory');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建dist目录
|
||||||
|
fs.mkdirSync(distDir, { recursive: true });
|
||||||
|
|
||||||
|
// 复制并压缩文件到dist目录
|
||||||
|
console.log('Start copying and compressing files...');
|
||||||
|
copyAndCompressDir(rootDir, distDir);
|
||||||
|
console.log('Files copied and compressed successfully!');
|
||||||
|
|
||||||
|
// 生成zip文件名(格式:数码喷墨墨水-定制化-YYYY-MM-DD-mp-weixin.zip)
|
||||||
|
const currentDate = getCurrentDate();
|
||||||
|
const zipFileName = `数码喷墨墨水-定制化-${currentDate}-mp-weixin.zip`;
|
||||||
|
const zipPath = path.join(distDir, zipFileName);
|
||||||
|
|
||||||
|
// 创建zip压缩包
|
||||||
|
console.log('Creating zip archive...');
|
||||||
|
createZipArchive(distDir, zipPath);
|
||||||
|
|
||||||
|
console.log('\nAll tasks completed successfully!');
|
||||||
|
console.log(`Dist directory: ${distDir}`);
|
||||||
|
console.log(`Zip file: ${zipPath}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error occurred:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行主函数
|
||||||
|
main();
|
||||||
Reference in New Issue
Block a user