Commit 03e34fd8 by Jaxon

Merge branch 'dev' into 'master'

Dev

See merge request !16
2 parents db258ece 83989ed2
Pipeline #52 for 03e34fd8 failed in 0 seconds
Showing 906 changed files with 3558 additions and 69 deletions
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"privatePackages": { "version": true, "tag": true }, "privatePackages": { "version": true, "tag": true },
"linked": [], "linked": [],
"access": "public", "access": "public",
"baseBranch": "main", "baseBranch": "master",
"updateInternalDependencies": "patch", "updateInternalDependencies": "patch",
"ignore": [] "ignore": []
} }
---
"@venus/docs": major
---
编写变更说明:修改说明文档中相关技术说明
---
"uniapp-x-shop": minor
---
feat: 新增uniappx demo
name: 📚 Documentation name: 📚 Documentation
description: Report an issue with Vben Admin Website to help us make it better. description: Report an issue with Vben Admin Website to help us make it better.
title: 'Docs: ' title: "Docs: "
labels: [documentation] labels: [documentation]
body: body:
- type: markdown - type: markdown
......
name: ✨ New Feature Proposal name: ✨ New Feature Proposal
description: Propose a new feature to be added to Vben Admin description: Propose a new feature to be added to Vben Admin
title: 'FEATURE: ' title: "FEATURE: "
labels: ['enhancement: pending triage'] labels: ["enhancement: pending triage"]
body: body:
- type: markdown - type: markdown
attributes: attributes:
......
...@@ -67,10 +67,12 @@ jobs: ...@@ -67,10 +67,12 @@ jobs:
**作用**:安装 pnpm 包管理器 **作用**:安装 pnpm 包管理器
**版本来源**: **版本来源**:
- 优先使用 `package.json` 中 `packageManager` 字段指定的版本 - 优先使用 `package.json` 中 `packageManager` 字段指定的版本
- 示例:`"packageManager": "pnpm@9.0.0"` - 示例:`"packageManager": "pnpm@9.0.0"`
**优点**: **优点**:
- 确保使用正确的 pnpm 版本 - 确保使用正确的 pnpm 版本
- 避免版本不一致导致的问题 - 避免版本不一致导致的问题
...@@ -89,17 +91,20 @@ jobs: ...@@ -89,17 +91,20 @@ jobs:
**配置说明**: **配置说明**:
| 配置项 | 值 | 说明 | | 配置项 | 值 | 说明 |
|-------|---|------| | ------------------- | --------------- | ----------------------- |
| `node-version-file` | `.node-version` | 从文件读取 Node.js 版本 | | `node-version-file` | `.node-version` | 从文件读取 Node.js 版本 |
| `cache` | `pnpm` | 启用 pnpm 包缓存 | | `cache` | `pnpm` | 启用 pnpm 包缓存 |
**`.node-version` 文件**: **`.node-version` 文件**:
``` ```
20.11.0 20.11.0
``` ```
只需在文件中写入版本号,无需 `v` 前缀。 只需在文件中写入版本号,无需 `v` 前缀。
**缓存作用**: **缓存作用**:
- 第一次运行:下载并缓存 pnpm 包 - 第一次运行:下载并缓存 pnpm 包
- 后续运行:从缓存读取,大幅加速 - 后续运行:从缓存读取,大幅加速
...@@ -115,11 +120,13 @@ jobs: ...@@ -115,11 +120,13 @@ jobs:
``` ```
**作用**: **作用**:
- 获取 pnpm 包缓存存储目录 - 获取 pnpm 包缓存存储目录
- 存储到 `STORE_PATH` 环境变量 - 存储到 `STORE_PATH` 环境变量
- 供后续的缓存步骤使用 - 供后续的缓存步骤使用
**输出示例**: **输出示例**:
``` ```
STORE_PATH=/home/runner/.pnpm-store STORE_PATH=/home/runner/.pnpm-store
``` ```
...@@ -144,6 +151,7 @@ STORE_PATH=/home/runner/.pnpm-store ...@@ -144,6 +151,7 @@ STORE_PATH=/home/runner/.pnpm-store
**触发条件**:`github.ref_name == 'main'` **触发条件**:`github.ref_name == 'main'`
**缓存策略**: **缓存策略**:
- **缓存路径**:pnpm 包存储目录 - **缓存路径**:pnpm 包存储目录
- **缓存键**:`ubuntu-latest-pnpm-store-abc123def456` - **缓存键**:`ubuntu-latest-pnpm-store-abc123def456`
- 包含:操作系统 + 锁定文件的哈希值 - 包含:操作系统 + 锁定文件的哈希值
...@@ -152,6 +160,7 @@ STORE_PATH=/home/runner/.pnpm-store ...@@ -152,6 +160,7 @@ STORE_PATH=/home/runner/.pnpm-store
- 如果精确匹配失败,使用此模糊匹配 - 如果精确匹配失败,使用此模糊匹配
**优点**: **优点**:
- 保存缓存供后续使用 - 保存缓存供后续使用
- 新的依赖版本会触发缓存更新 - 新的依赖版本会触发缓存更新
- 避免使用过时的包 - 避免使用过时的包
...@@ -170,6 +179,7 @@ STORE_PATH=/home/runner/.pnpm-store ...@@ -170,6 +179,7 @@ STORE_PATH=/home/runner/.pnpm-store
**触发条件**:`github.ref_name != 'main'` **触发条件**:`github.ref_name != 'main'`
**行为**: **行为**:
- 只读取缓存,不写入 - 只读取缓存,不写入
- 使用模糊匹配查找最近的缓存 - 使用模糊匹配查找最近的缓存
- 加快特性分支的 CI 速度 - 加快特性分支的 CI 速度
...@@ -177,6 +187,7 @@ STORE_PATH=/home/runner/.pnpm-store ...@@ -177,6 +187,7 @@ STORE_PATH=/home/runner/.pnpm-store
**为什么这样设计**? **为什么这样设计**?
避免 main 分支上的多个 PR 并发运行时发生**缓存竞争**: 避免 main 分支上的多个 PR 并发运行时发生**缓存竞争**:
- 如果都写入缓存,可能导致缓存损坏 - 如果都写入缓存,可能导致缓存损坏
- 只有 main 分支写入,其他分支读取,保证缓存一致性 - 只有 main 分支写入,其他分支读取,保证缓存一致性
...@@ -193,10 +204,11 @@ STORE_PATH=/home/runner/.pnpm-store ...@@ -193,10 +204,11 @@ STORE_PATH=/home/runner/.pnpm-store
**参数说明**: **参数说明**:
| 参数 | 说明 | | 参数 | 说明 |
|-----|------| | ------------------- | ------------------------------------- |
| `--frozen-lockfile` | 不修改 `pnpm-lock.yaml`,确保版本一致 | | `--frozen-lockfile` | 不修改 `pnpm-lock.yaml`,确保版本一致 |
**作用**: **作用**:
- 根据 `pnpm-lock.yaml` 安装精确版本的依赖 - 根据 `pnpm-lock.yaml` 安装精确版本的依赖
- 适合 CI 环境,确保可重现的构建 - 适合 CI 环境,确保可重现的构建
- 如果缓存命中,此步骤极快 - 如果缓存命中,此步骤极快
...@@ -224,7 +236,7 @@ STORE_PATH=/home/runner/.pnpm-store ...@@ -224,7 +236,7 @@ STORE_PATH=/home/runner/.pnpm-store
### 缓存键示例 ### 缓存键示例
| pnpm-lock.yaml 变化 | 缓存键 | 缓存是否命中 | | pnpm-lock.yaml 变化 | 缓存键 | 缓存是否命中 |
|------------------|-------|-----------| | ------------------- | --------------------------------- | ------------------- |
| `dependencies` 改变 | `ubuntu-latest-pnpm-store-new123` | ❌ 新键,不命中 | | `dependencies` 改变 | `ubuntu-latest-pnpm-store-new123` | ❌ 新键,不命中 |
| 未改变 | `ubuntu-latest-pnpm-store-abc123` | ✅ 命中 | | 未改变 | `ubuntu-latest-pnpm-store-abc123` | ✅ 命中 |
| PR 中修改 | 使用模糊键 | ✅ 使用 main 的缓存 | | PR 中修改 | 使用模糊键 | ✅ 使用 main 的缓存 |
...@@ -329,7 +341,7 @@ jobs: ...@@ -329,7 +341,7 @@ jobs:
该 Action 被以下工作流使用: 该 Action 被以下工作流使用:
| 工作流文件 | 用途 | 位置 | | 工作流文件 | 用途 | 位置 |
|-----------|------|------| | ----------------------- | -------------- | ----------------------------------------- |
| `ci.yml` | 运行测试和构建 | `.github/workflows/ci.yml` | | `ci.yml` | 运行测试和构建 | `.github/workflows/ci.yml` |
| `build.yml` | 验证构建可行性 | `.github/workflows/build.yml` | | `build.yml` | 验证构建可行性 | `.github/workflows/build.yml` |
| `deploy.yml` | 部署前环境配置 | `.github/workflows/deploy.yml` | | `deploy.yml` | 部署前环境配置 | `.github/workflows/deploy.yml` |
...@@ -359,6 +371,7 @@ jobs: ...@@ -359,6 +371,7 @@ jobs:
### 修改 Node.js 版本 ### 修改 Node.js 版本
1. 编辑 `.node-version` 文件: 1. 编辑 `.node-version` 文件:
```bash ```bash
# 当前版本 # 当前版本
cat .node-version cat .node-version
...@@ -378,6 +391,7 @@ jobs: ...@@ -378,6 +391,7 @@ jobs:
### 修改 pnpm 版本 ### 修改 pnpm 版本
1. 更新 `package.json` 中的 `packageManager` 字段: 1. 更新 `package.json` 中的 `packageManager` 字段:
```json ```json
{ {
"packageManager": "pnpm@9.1.0" "packageManager": "pnpm@9.1.0"
...@@ -385,6 +399,7 @@ jobs: ...@@ -385,6 +399,7 @@ jobs:
``` ```
2. 更新到新版本: 2. 更新到新版本:
```bash ```bash
pnpm install -g pnpm@9.1.0 pnpm install -g pnpm@9.1.0
pnpm install --frozen-lockfile pnpm install --frozen-lockfile
...@@ -417,11 +432,13 @@ jobs: ...@@ -417,11 +432,13 @@ jobs:
**症状**:安装依赖速度很慢,每次都重新下载 **症状**:安装依赖速度很慢,每次都重新下载
**原因**: **原因**:
- `pnpm-lock.yaml` 频繁变化 - `pnpm-lock.yaml` 频繁变化
- 缓存过期(GitHub 默认 7 天) - 缓存过期(GitHub 默认 7 天)
- 操作系统不同(Linux、Windows 缓存分离) - 操作系统不同(Linux、Windows 缓存分离)
**解决方案**: **解决方案**:
```bash ```bash
# 检查 pnpm-lock.yaml 是否正确提交 # 检查 pnpm-lock.yaml 是否正确提交
git status pnpm-lock.yaml git status pnpm-lock.yaml
...@@ -438,10 +455,12 @@ git commit -m "fix: regenerate pnpm-lock" ...@@ -438,10 +455,12 @@ git commit -m "fix: regenerate pnpm-lock"
**症状**:工作流中 `node --version` 输出意外的版本 **症状**:工作流中 `node --version` 输出意外的版本
**原因**: **原因**:
- `.node-version` 文件不存在或格式错误 - `.node-version` 文件不存在或格式错误
- 缓存中有旧版本 - 缓存中有旧版本
**解决方案**: **解决方案**:
```bash ```bash
# 检查 .node-version 文件 # 检查 .node-version 文件
cat .node-version cat .node-version
...@@ -455,10 +474,12 @@ cat .node-version ...@@ -455,10 +474,12 @@ cat .node-version
**症状**:`Run pnpm install` 失败,提示权限不足 **症状**:`Run pnpm install` 失败,提示权限不足
**原因**: **原因**:
- 缓存目录权限问题 - 缓存目录权限问题
- 跨操作系统的缓存冲突 - 跨操作系统的缓存冲突
**解决方案**: **解决方案**:
```yaml ```yaml
# 在 action.yml 中添加权限修复 # 在 action.yml 中添加权限修复
- name: Fix cache permissions - name: Fix cache permissions
...@@ -473,7 +494,7 @@ cat .node-version ...@@ -473,7 +494,7 @@ cat .node-version
该 Action 的性能优化措施: 该 Action 的性能优化措施:
| 优化 | 效果 | 说明 | | 优化 | 效果 | 说明 |
|-----|------|------| | --------------- | ------------------------ | -------------------- |
| 缓存 pnpm store | 节省 50-80% 时间 | 依赖下载只发生一次 | | 缓存 pnpm store | 节省 50-80% 时间 | 依赖下载只发生一次 |
| 冻结锁定文件 | 100% 可重现构建 | 避免版本不一致 | | 冻结锁定文件 | 100% 可重现构建 | 避免版本不一致 |
| 主分支缓存写入 | 避免缓存竞争 | 多 PR 并发安全 | | 主分支缓存写入 | 避免缓存竞争 | 多 PR 并发安全 |
...@@ -482,7 +503,7 @@ cat .node-version ...@@ -482,7 +503,7 @@ cat .node-version
**典型执行时间**: **典型执行时间**:
| 场景 | 时间 | 说明 | | 场景 | 时间 | 说明 |
|-----|------|------| | -------- | -------- | ---------------- |
| 首次运行 | 2-3 分钟 | 下载并缓存所有包 | | 首次运行 | 2-3 分钟 | 下载并缓存所有包 |
| 依赖未变 | 20-30 秒 | 从缓存恢复 | | 依赖未变 | 20-30 秒 | 从缓存恢复 |
| 新增小包 | 40-50 秒 | 只下载新增包 | | 新增小包 | 40-50 秒 | 只下载新增包 |
...@@ -506,7 +527,7 @@ cat .node-version ...@@ -506,7 +527,7 @@ cat .node-version
本 Action 依赖的官方 Action: 本 Action 依赖的官方 Action:
| Action | 当前版本 | 检查更新 | | Action | 当前版本 | 检查更新 |
|--------|---------|---------| | -------------------- | -------- | ---------------------------------------------------------- |
| `pnpm/action-setup` | v4 | [releases](https://github.com/pnpm/action-setup/releases) | | `pnpm/action-setup` | v4 | [releases](https://github.com/pnpm/action-setup/releases) |
| `actions/setup-node` | v4 | [releases](https://github.com/actions/setup-node/releases) | | `actions/setup-node` | v4 | [releases](https://github.com/actions/setup-node/releases) |
| `actions/cache` | v4 | [releases](https://github.com/actions/cache/releases) | | `actions/cache` | v4 | [releases](https://github.com/actions/cache/releases) |
...@@ -514,17 +535,20 @@ cat .node-version ...@@ -514,17 +535,20 @@ cat .node-version
### 更新步骤 ### 更新步骤
1. **检查新版本**: 1. **检查新版本**:
```bash ```bash
# 访问上述链接检查是否有更新 # 访问上述链接检查是否有更新
``` ```
2. **测试新版本**: 2. **测试新版本**:
```yaml ```yaml
# 在测试分支中更新版本 # 在测试分支中更新版本
uses: pnpm/action-setup@v5 # 新版本 uses: pnpm/action-setup@v5 # 新版本
``` ```
3. **验证功能**: 3. **验证功能**:
```bash ```bash
# 确保工作流仍然正常运行 # 确保工作流仍然正常运行
``` ```
...@@ -541,12 +565,14 @@ cat .node-version ...@@ -541,12 +565,14 @@ cat .node-version
### ✅ 推荐做法 ### ✅ 推荐做法
1. **始终使用此 Action** 1. **始终使用此 Action**
```yaml ```yaml
# ✅ 好的做法 # ✅ 好的做法
- uses: ./.github/actions/setup-node - uses: ./.github/actions/setup-node
``` ```
2. **在所有需要 Node.js 的工作流中使用** 2. **在所有需要 Node.js 的工作流中使用**
```yaml ```yaml
# 测试工作流 # 测试工作流
- uses: ./.github/actions/setup-node - uses: ./.github/actions/setup-node
...@@ -567,6 +593,7 @@ cat .node-version ...@@ -567,6 +593,7 @@ cat .node-version
### ❌ 避免做法 ### ❌ 避免做法
1. **不要手动安装 Node.js** 1. **不要手动安装 Node.js**
```yaml ```yaml
# ❌ 避免 # ❌ 避免
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
...@@ -575,6 +602,7 @@ cat .node-version ...@@ -575,6 +602,7 @@ cat .node-version
``` ```
2. **不要跳过缓存** 2. **不要跳过缓存**
```yaml ```yaml
# ❌ 避免 # ❌ 避免
- run: pnpm install # 没有缓存优化 - run: pnpm install # 没有缓存优化
......
version: 2 version: 2
updates: updates:
- package-ecosystem: npm - package-ecosystem: npm
directory: '/' directory: "/"
schedule: schedule:
interval: daily interval: daily
groups: groups:
...@@ -9,7 +9,7 @@ updates: ...@@ -9,7 +9,7 @@ updates:
update-types: [minor, patch] update-types: [minor, patch]
- package-ecosystem: github-actions - package-ecosystem: github-actions
directory: '/' directory: "/"
schedule: schedule:
interval: weekly interval: weekly
groups: groups:
......
name-template: 'v$RESOLVED_VERSION' name-template: "v$RESOLVED_VERSION"
tag-template: 'v$RESOLVED_VERSION' tag-template: "v$RESOLVED_VERSION"
version-template: $MAJOR.$MINOR.$PATCH version-template: $MAJOR.$MINOR.$PATCH
change-template: '* $TITLE (#$NUMBER) @$AUTHOR' change-template: "* $TITLE (#$NUMBER) @$AUTHOR"
template: | template: |
# What's Changed # What's Changed
...@@ -10,52 +10,52 @@ template: | ...@@ -10,52 +10,52 @@ template: |
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories: categories:
- title: '🚀 Features' - title: "🚀 Features"
labels: labels:
- 'feature' - "feature"
- title: '🐞 Bug Fixes' - title: "🐞 Bug Fixes"
labels: labels:
- 'bug' - "bug"
- title: '📈 Performance & Enhancement' - title: "📈 Performance & Enhancement"
labels: labels:
- 'perf' - "perf"
- 'enhancement' - "enhancement"
- title: 📝 Documentation - title: 📝 Documentation
labels: labels:
- 'documentation' - "documentation"
- title: 👻 Maintenance - title: 👻 Maintenance
labels: labels:
- 'chore' - "chore"
- 'dependencies' - "dependencies"
# collapse-after: 12 # collapse-after: 12
- title: 🚦 Tests - title: 🚦 Tests
labels: labels:
- 'tests' - "tests"
- title: 'Breaking' - title: "Breaking"
label: 'breaking' label: "breaking"
version-resolver: version-resolver:
major: major:
labels: labels:
- 'major' - "major"
- 'breaking' - "breaking"
minor: minor:
labels: labels:
- 'minor' - "minor"
patch: patch:
labels: labels:
- 'feature' - "feature"
- 'patch' - "patch"
- 'bug' - "bug"
- 'maintenance' - "maintenance"
- 'docs' - "docs"
- 'dependencies' - "dependencies"
- 'security' - "security"
exclude-labels: exclude-labels:
- 'skip-changelog' - "skip-changelog"
- 'no-changelog' - "no-changelog"
- 'changelog' - "changelog"
- 'bump versions' - "bump versions"
- 'reverted' - "reverted"
- 'invalid' - "invalid"
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
``` ```
**工作流分类:** **工作流分类:**
- 🔨 **构建和测试**:验证代码质量 - 🔨 **构建和测试**:验证代码质量
- 📦 **版本和发布**:管理版本发布流程 - 📦 **版本和发布**:管理版本发布流程
- 🚀 **部署**:自动部署网站 - 🚀 **部署**:自动部署网站
...@@ -41,11 +42,13 @@ ...@@ -41,11 +42,13 @@
**描述**:持续集成工作流,在每次 PR 和推送到 main 分支时运行测试和构建。 **描述**:持续集成工作流,在每次 PR 和推送到 main 分支时运行测试和构建。
**触发条件**: **触发条件**:
- Pull Request 事件 - Pull Request 事件
- 推送到 `main` 分支 - 推送到 `main` 分支
- 推送到 `releases/*` 分支 - 推送到 `releases/*` 分支
**执行环境**: **执行环境**:
- Ubuntu Latest - Ubuntu Latest
- Windows Latest - Windows Latest
- ~~macOS Latest~~ (已注释) - ~~macOS Latest~~ (已注释)
...@@ -53,6 +56,7 @@ ...@@ -53,6 +56,7 @@
**超时**:20 分钟 **超时**:20 分钟
**主要步骤**: **主要步骤**:
```yaml ```yaml
1. 检查代码 (checkout@v4) 1. 检查代码 (checkout@v4)
2. 安装 pnpm 2. 安装 pnpm
...@@ -63,6 +67,7 @@ ...@@ -63,6 +67,7 @@
``` ```
**环境变量**: **环境变量**:
- `CI=true` - 标记为 CI 环境 - `CI=true` - 标记为 CI 环境
- `TZ=Asia/Shanghai` - 时区设置 - `TZ=Asia/Shanghai` - 时区设置
...@@ -75,14 +80,17 @@ ...@@ -75,14 +80,17 @@
**描述**:在多个操作系统上验证 PR 的构建可行性,确保代码在不同平台上都能正确构建。 **描述**:在多个操作系统上验证 PR 的构建可行性,确保代码在不同平台上都能正确构建。
**触发条件**: **触发条件**:
- PR 打开、同步或重新打开时 - PR 打开、同步或重新打开时
- 仅针对 `main` 分支 - 仅针对 `main` 分支
**执行环境**: **执行环境**:
- Ubuntu Latest - Ubuntu Latest
- Windows Latest - Windows Latest
**主要步骤**: **主要步骤**:
```yaml ```yaml
1. 检查代码 1. 检查代码
2. 检查出 PR 分支 2. 检查出 PR 分支
...@@ -91,10 +99,12 @@ ...@@ -91,10 +99,12 @@
``` ```
**特殊配置**: **特殊配置**:
- **并发控制**:同一 PR 的多个运行会互相取消,节省资源 - **并发控制**:同一 PR 的多个运行会互相取消,节省资源
- **权限**:读取内容、写入 PR - **权限**:读取内容、写入 PR
**用途**: **用途**:
- 验证 PR 能否成功构建 - 验证 PR 能否成功构建
- 在合并前捕获构建错误 - 在合并前捕获构建错误
- 检测跨平台兼容性问题 - 检测跨平台兼容性问题
...@@ -106,23 +116,28 @@ ...@@ -106,23 +116,28 @@
**描述**:使用 GitHub CodeQL 对代码进行静态安全分析,检测潜在的代码漏洞和安全问题。 **描述**:使用 GitHub CodeQL 对代码进行静态安全分析,检测潜在的代码漏洞和安全问题。
**触发条件**: **触发条件**:
- 推送到 `main` 分支 - 推送到 `main` 分支
- PR 到 `main` 分支 - PR 到 `main` 分支
- 每周日午夜定时运行(`0 35 * * 0`) - 每周日午夜定时运行(`0 35 * * 0`)
**执行环境**: **执行环境**:
- Swift: macOS Latest - Swift: macOS Latest
- 其他语言: Ubuntu Latest - 其他语言: Ubuntu Latest
**超时**: **超时**:
- Swift: 120 分钟 - Swift: 120 分钟
- 其他: 360 分钟 - 其他: 360 分钟
**权限**: **权限**:
- `security-events: write` - 创建安全事件 - `security-events: write` - 创建安全事件
- `packages: read` - 读取包 - `packages: read` - 读取包
**用途**: **用途**:
- 发现代码漏洞 - 发现代码漏洞
- 检测安全问题 - 检测安全问题
- 生成安全报告 - 生成安全报告
...@@ -136,12 +151,14 @@ ...@@ -136,12 +151,14 @@
**描述**:自动管理 monorepo 的版本更新,使用 changesets 工具管理语义化版本。 **描述**:自动管理 monorepo 的版本更新,使用 changesets 工具管理语义化版本。
**触发条件**: **触发条件**:
- PR 合并到 `main` 分支时 - PR 合并到 `main` 分支时
- 手动触发 (`workflow_dispatch`) - 手动触发 (`workflow_dispatch`)
**超时**:15 分钟 **超时**:15 分钟
**主要步骤**: **主要步骤**:
```yaml ```yaml
1. 检查代码 1. 检查代码
2. 设置 Node 环境 2. 设置 Node 环境
...@@ -151,6 +168,7 @@ ...@@ -151,6 +168,7 @@
``` ```
**条件**: **条件**:
- PR 必须已合并 - PR 必须已合并
- 非 dependabot 用户 - 非 dependabot 用户
- 不包含 `[skip ci]` 标记 - 不包含 `[skip ci]` 标记
...@@ -158,6 +176,7 @@ ...@@ -158,6 +176,7 @@
**工具**:[changesets/action](https://github.com/changesets/action) **工具**:[changesets/action](https://github.com/changesets/action)
**用途**: **用途**:
- 自动化版本号更新 - 自动化版本号更新
- 生成 CHANGELOG - 生成 CHANGELOG
- 为发布做准备 - 为发布做准备
...@@ -169,12 +188,14 @@ ...@@ -169,12 +188,14 @@
**描述**:检测版本标签推送事件,触发发布流程。 **描述**:检测版本标签推送事件,触发发布流程。
**触发条件**: **触发条件**:
- 推送版本标签,格式:`v*.*.*` - 推送版本标签,格式:`v*.*.*`
- 示例:`v1.0.0`、`v20.15.10` - 示例:`v1.0.0`、`v20.15.10`
**执行环境**:Ubuntu Latest (Node 20) **执行环境**:Ubuntu Latest (Node 20)
**主要步骤**: **主要步骤**:
```yaml ```yaml
1. 检查代码 1. 检查代码
2. 执行构建 2. 执行构建
...@@ -191,15 +212,18 @@ ...@@ -191,15 +212,18 @@
**描述**:自动生成发布说明(Release Notes),基于 PR 标签和信息。 **描述**:自动生成发布说明(Release Notes),基于 PR 标签和信息。
**触发条件**: **触发条件**:
- 推送到 `main` 分支时 - 推送到 `main` 分支时
**工具**:[release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) **工具**:[release-drafter/release-drafter](https://github.com/release-drafter/release-drafter)
**权限**: **权限**:
- `contents: write` - 创建发布 - `contents: write` - 创建发布
- `pull-requests: write` - 处理 PR 信息 - `pull-requests: write` - 处理 PR 信息
**用途**: **用途**:
- 自动化生成发布说明 - 自动化生成发布说明
- 基于 PR 自动分类更改 - 基于 PR 自动分类更改
- 简化发布流程 - 简化发布流程
...@@ -213,12 +237,14 @@ ...@@ -213,12 +237,14 @@
**描述**:自动部署演示站点、文档和 Web 应用到服务器。 **描述**:自动部署演示站点、文档和 Web 应用到服务器。
**触发条件**: **触发条件**:
- 推送到 `main` 分支时 - 推送到 `main` 分支时
- 排除:Dependabot 推送和包含 `[skip ci]` 的提交 - 排除:Dependabot 推送和包含 `[skip ci]` 的提交
**部署目标**: **部署目标**:
**1) Playground FTP 部署** **1) Playground FTP 部署**
- **目标**:演示站点(Playground) - **目标**:演示站点(Playground)
- **步骤**: - **步骤**:
```yaml ```yaml
...@@ -234,10 +260,12 @@ ...@@ -234,10 +260,12 @@
- `WEB_PLAYGROUND_FTP_PWSSWORD` - FTP 密码 - `WEB_PLAYGROUND_FTP_PWSSWORD` - FTP 密码
**2) Docs FTP 部署** **2) Docs FTP 部署**
- **目标**:项目文档 - **目标**:项目文档
- **步骤**:类似 Playground,构建并上传文档 - **步骤**:类似 Playground,构建并上传文档
**3) Web FTP 部署** **3) Web FTP 部署**
- **目标**:主网站 - **目标**:主网站
- **步骤**:构建 Web 应用并上传 - **步骤**:构建 Web 应用并上传
...@@ -254,9 +282,11 @@ ...@@ -254,9 +282,11 @@
**描述**:验证 PR 标题是否符合语义化提交规范,确保提交信息的一致性。 **描述**:验证 PR 标题是否符合语义化提交规范,确保提交信息的一致性。
**触发条件**: **触发条件**:
- PR 打开、编辑或同步时 - PR 打开、编辑或同步时
**验证规则**: **验证规则**:
- **首字母**:主体首字母不能大写 - **首字母**:主体首字母不能大写
- **允许的类型**: - **允许的类型**:
``` ```
...@@ -265,6 +295,7 @@ ...@@ -265,6 +295,7 @@
``` ```
**示例**: **示例**:
- ✅ 正确:`fix: button click issue` - ✅ 正确:`fix: button click issue`
- ❌ 错误:`Fix: button click issue` - ❌ 错误:`Fix: button click issue`
- ✅ 正确:`feat: add new feature` - ✅ 正确:`feat: add new feature`
...@@ -273,6 +304,7 @@ ...@@ -273,6 +304,7 @@
**工具**:[amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) **工具**:[amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request)
**用途**: **用途**:
- 保证提交信息格式一致 - 保证提交信息格式一致
- 便于自动生成 CHANGELOG - 便于自动生成 CHANGELOG
- 提高代码库可读性 - 提高代码库可读性
...@@ -284,20 +316,24 @@ ...@@ -284,20 +316,24 @@
**描述**:自动关闭标记为 "needs reproduction" 的长期未活动 Issue,保持 Issue 列表整洁。 **描述**:自动关闭标记为 "needs reproduction" 的长期未活动 Issue,保持 Issue 列表整洁。
**触发条件**: **触发条件**:
- 每天零点运行 - 每天零点运行
- 手动触发 (`workflow_dispatch`) - 手动触发 (`workflow_dispatch`)
**关闭规则**: **关闭规则**:
- 标签:`needs-reproduction` - 标签:`needs-reproduction`
- 无活动天数:3 天 - 无活动天数:3 天
- 关闭标签:`closed-by-action` - 关闭标签:`closed-by-action`
**关闭消息**: **关闭消息**:
``` ```
This issue was closed because it was open for 3 days without a valid reproduction. This issue was closed because it was open for 3 days without a valid reproduction.
``` ```
**用途**: **用途**:
- 要求用户提供复现步骤 - 要求用户提供复现步骤
- 自动清理无效 Issue - 自动清理无效 Issue
- 减少维护负担 - 减少维护负担
...@@ -309,17 +345,19 @@ This issue was closed because it was open for 3 days without a valid reproductio ...@@ -309,17 +345,19 @@ This issue was closed because it was open for 3 days without a valid reproductio
**描述**:根据添加的 Issue 标签自动做出响应,如发送评论或移除其他标签。 **描述**:根据添加的 Issue 标签自动做出响应,如发送评论或移除其他标签。
**触发条件**: **触发条件**:
- Issue 被添加标签时 - Issue 被添加标签时
**响应规则**: **响应规则**:
| 添加的标签 | 响应动作 | 说明 | | 添加的标签 | 响应动作 | 说明 |
|-----------|--------|------| | -------------------- | ------------------------------------- | -------------------- |
| `enhancement` | 移除 `enhancement: pending triage` | 确认为新功能需求 | | `enhancement` | 移除 `enhancement: pending triage` | 确认为新功能需求 |
| `bug` | 移除 `bug: pending triage` | 确认为 Bug | | `bug` | 移除 `bug: pending triage` | 确认为 Bug |
| `needs reproduction` | 发送评论 + 移除 `bug: pending triage` | 要求用户提供复现步骤 | | `needs reproduction` | 发送评论 + 移除 `bug: pending triage` | 要求用户提供复现步骤 |
**needs reproduction 评论内容**: **needs reproduction 评论内容**:
``` ```
Hello @${{ github.event.issue.user.login }}. Hello @${{ github.event.issue.user.login }}.
Please provide the complete reproduction steps and code. Please provide the complete reproduction steps and code.
...@@ -337,16 +375,18 @@ Issues labeled by `needs reproduction` will be closed if no activities in 3 days ...@@ -337,16 +375,18 @@ Issues labeled by `needs reproduction` will be closed if no activities in 3 days
**描述**:自动关闭长时间无活动的 Issue 和 PR,保持项目的活跃度。 **描述**:自动关闭长时间无活动的 Issue 和 PR,保持项目的活跃度。
**触发条件**: **触发条件**:
- 每天凌晨 1 点运行 - 每天凌晨 1 点运行
**关闭规则**: **关闭规则**:
| 内容类型 | 无活动天数 | 标记为 Stale | 再等天数 | 关闭 | 豁免标签 | | 内容类型 | 无活动天数 | 标记为 Stale | 再等天数 | 关闭 | 豁免标签 |
|--------|---------|------------|--------|------|---------| | -------- | ---------- | ------------ | -------- | ---- | ---------------- |
| Issue | 60 天 | 是 | 7 天 | 是 | bug, enhancement | | Issue | 60 天 | 是 | 7 天 | 是 | bug, enhancement |
| PR | 60 天 | 是 | 7 天 | 是 | 无 | | PR | 60 天 | 是 | 7 天 | 是 | 无 |
**提醒消息**: **提醒消息**:
``` ```
This issue/PR is stale because it has been open 60 days with no activity. This issue/PR is stale because it has been open 60 days with no activity.
Remove stale label or comment or this will be closed in 7 days. Remove stale label or comment or this will be closed in 7 days.
...@@ -357,6 +397,7 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -357,6 +397,7 @@ Remove stale label or comment or this will be closed in 7 days.
**工具**:[actions/stale](https://github.com/actions/stale) **工具**:[actions/stale](https://github.com/actions/stale)
**用途**: **用途**:
- 自动清理废弃的 Issue/PR - 自动清理废弃的 Issue/PR
- 鼓励用户跟进问题 - 鼓励用户跟进问题
- 保持项目整洁 - 保持项目整洁
...@@ -368,13 +409,14 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -368,13 +409,14 @@ Remove stale label or comment or this will be closed in 7 days.
**描述**:自动锁定长时间无活动的讨论,防止垃圾评论。 **描述**:自动锁定长时间无活动的讨论,防止垃圾评论。
**触发条件**: **触发条件**:
- 每天零点运行 - 每天零点运行
- 手动触发 - 手动触发
**锁定规则**: **锁定规则**:
| 内容类型 | 无活动天数 | 是否锁定 | 锁定原因 | | 内容类型 | 无活动天数 | 是否锁定 | 锁定原因 |
|--------|---------|--------|--------| | -------- | ---------- | -------- | -------------------------- |
| Issue | 14 天 | 是 | 空(默认:已解决或已弃用) | | Issue | 14 天 | 是 | 空(默认:已解决或已弃用) |
| PR | 30 天 | 是 | 空(默认:已合并或已弃用) | | PR | 30 天 | 是 | 空(默认:已合并或已弃用) |
...@@ -383,6 +425,7 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -383,6 +425,7 @@ Remove stale label or comment or this will be closed in 7 days.
**工具**:[dessant/lock-threads](https://github.com/dessant/lock-threads) **工具**:[dessant/lock-threads](https://github.com/dessant/lock-threads)
**用途**: **用途**:
- 防止已解决问题的垃圾评论 - 防止已解决问题的垃圾评论
- 保护历史讨论 - 保护历史讨论
- 减少通知干扰 - 减少通知干扰
...@@ -396,18 +439,22 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -396,18 +439,22 @@ Remove stale label or comment or this will be closed in 7 days.
**描述**:手动重新运行失败的 GitHub Actions 工作流,无需提交新的代码。 **描述**:手动重新运行失败的 GitHub Actions 工作流,无需提交新的代码。
**触发条件**: **触发条件**:
- 手动触发 (`workflow_dispatch`) - 手动触发 (`workflow_dispatch`)
**输入参数**: **输入参数**:
- `run_id` - 需要重新运行的工作流 ID(必需) - `run_id` - 需要重新运行的工作流 ID(必需)
**执行步骤**: **执行步骤**:
```yaml ```yaml
1. 等待原始工作流完成 1. 等待原始工作流完成
2. 重新运行失败的任务 2. 重新运行失败的任务
``` ```
**用途**: **用途**:
- 处理临时网络错误 - 处理临时网络错误
- 重新运行因外部因素失败的工作流 - 重新运行因外部因素失败的工作流
- 无需推送新代码 - 无需推送新代码
...@@ -419,7 +466,7 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -419,7 +466,7 @@ Remove stale label or comment or this will be closed in 7 days.
### 工作流触发时间表 ### 工作流触发时间表
| 时间 | 工作流 | 说明 | | 时间 | 工作流 | 说明 |
|-----|------|------| | ------------------ | ------------------------------------ | ------------------------ |
| **PR 打开/编辑时** | build.yml, semantic-pull-request.yml | 验证代码构建和 PR 规范 | | **PR 打开/编辑时** | build.yml, semantic-pull-request.yml | 验证代码构建和 PR 规范 |
| **PR 合并到 main** | changeset-version.yml | 更新版本号 | | **PR 合并到 main** | changeset-version.yml | 更新版本号 |
| **推送到 main** | ci.yml, deploy.yml, draft.yml | 测试、部署、生成发布说明 | | **推送到 main** | ci.yml, deploy.yml, draft.yml | 测试、部署、生成发布说明 |
...@@ -433,7 +480,7 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -433,7 +480,7 @@ Remove stale label or comment or this will be closed in 7 days.
### 权限总览 ### 权限总览
| 权限 | 用途 | 工作流 | | 权限 | 用途 | 工作流 |
|-----|------|-------| | ------------------------ | ------------ | ----------------------------- |
| `contents: read` | 读取仓库内容 | ci.yml, build.yml 等 | | `contents: read` | 读取仓库内容 | ci.yml, build.yml 等 |
| `contents: write` | 写入仓库内容 | release-tag.yml, draft.yml 等 | | `contents: write` | 写入仓库内容 | release-tag.yml, draft.yml 等 |
| `pull-requests: write` | 写入 PR | build.yml, draft.yml 等 | | `pull-requests: write` | 写入 PR | build.yml, draft.yml 等 |
...@@ -443,7 +490,7 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -443,7 +490,7 @@ Remove stale label or comment or this will be closed in 7 days.
### 环境变量 ### 环境变量
| 变量 | 值 | 用途 | 工作流 | | 变量 | 值 | 用途 | 工作流 |
|-----|---|------|-------| | ------- | --------------- | ------------- | -------------------------------- |
| `HUSKY` | `0` | 禁用 Git Hook | build.yml, changeset-version.yml | | `HUSKY` | `0` | 禁用 Git Hook | build.yml, changeset-version.yml |
| `CI` | `true` | 标记 CI 环境 | ci.yml, changeset-version.yml | | `CI` | `true` | 标记 CI 环境 | ci.yml, changeset-version.yml |
| `TZ` | `Asia/Shanghai` | 时区设置 | ci.yml | | `TZ` | `Asia/Shanghai` | 时区设置 | ci.yml |
...@@ -455,13 +502,14 @@ Remove stale label or comment or this will be closed in 7 days. ...@@ -455,13 +502,14 @@ Remove stale label or comment or this will be closed in 7 days.
### 部署所需的 GitHub Secrets ### 部署所需的 GitHub Secrets
| 秘密名称 | 用途 | 工作流 | | 秘密名称 | 用途 | 工作流 |
|--------|------|-------| | ----------------------------- | --------------- | ---------- |
| `GITHUB_TOKEN` | GitHub API 认证 | 所有工作流 | | `GITHUB_TOKEN` | GitHub API 认证 | 所有工作流 |
| `PRO_FTP_HOST` | FTP 主机地址 | deploy.yml | | `PRO_FTP_HOST` | FTP 主机地址 | deploy.yml |
| `WEB_PLAYGROUND_FTP_ACCOUNT` | FTP 账号 | deploy.yml | | `WEB_PLAYGROUND_FTP_ACCOUNT` | FTP 账号 | deploy.yml |
| `WEB_PLAYGROUND_FTP_PWSSWORD` | FTP 密码 | deploy.yml | | `WEB_PLAYGROUND_FTP_PWSSWORD` | FTP 密码 | deploy.yml |
**配置方式**: **配置方式**:
1. 进入 GitHub 仓库 Settings 1. 进入 GitHub 仓库 Settings
2. 找到 Secrets and variables → Actions 2. 找到 Secrets and variables → Actions
3. 点击 New repository secret 3. 点击 New repository secret
...@@ -485,11 +533,13 @@ git push ...@@ -485,11 +533,13 @@ git push
编辑 PR 标题使其符合规范: 编辑 PR 标题使其符合规范:
**错误格式**: **错误格式**:
``` ```
Fix: button click issue Fix: button click issue
``` ```
**正确格式**: **正确格式**:
``` ```
fix: button click issue fix: button click issue
``` ```
...@@ -538,6 +588,7 @@ fix: button click issue ...@@ -538,6 +588,7 @@ fix: button click issue
修改工作流时,请遵循以下步骤: 修改工作流时,请遵循以下步骤:
1. **创建分支**: 1. **创建分支**:
```bash ```bash
git checkout -b feature/workflow-update git checkout -b feature/workflow-update
``` ```
...@@ -551,6 +602,7 @@ fix: button click issue ...@@ -551,6 +602,7 @@ fix: button click issue
- 测试工作流逻辑 - 测试工作流逻辑
4. **提交 PR**: 4. **提交 PR**:
```bash ```bash
git add .github/workflows/ git add .github/workflows/
git commit -m "chore: update workflow configuration" git commit -m "chore: update workflow configuration"
......
...@@ -24,10 +24,34 @@ package-lock.json ...@@ -24,10 +24,34 @@ package-lock.json
**/backend-mock/data **/backend-mock/data
# 忽略所有子文件夹中的 .git # 忽略所有子文件夹中的 .git
**/.git **/.git
# 保留根仓库 .git # 保留根仓库 .git
!/.git !/.git
# uniappx
*.swiftmodule
*.swiftsourceinfo
*.swiftdoc
*.framework/Modules/
# uniapp 构建产物
unpackage/cache/
# Kotlin/Android 编译产物
*.kotlin_module
*.class
*.dex
*.apk
*.aar
# iOS 构建产物
*.framework
*.swiftmodule
*.swiftdoc
*.swiftsourceinfo
# Node / npm / pnpm
node_modules/
dist/
# local env files # local env files
.env.local .env.local
.env.*.local .env.*.local
...@@ -35,6 +59,7 @@ package-lock.json ...@@ -35,6 +59,7 @@ package-lock.json
logs logs
*.log *.log
*.tmp
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
......
image: node:24
# stages:
# - lint
# - test
# - build
# 缓存配置:缓存 node_modules 和 pnpm store 以加速构建
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .pnpm-store/
# 设置 pnpm 环境
before_script:
- corepack enable
- corepack prepare pnpm@latest --activate
- pnpm config set store-dir .pnpm-store
- pnpm install --frozen-lockfile
# 代码风格检查
# lint:
# stage: lint
# script:
# - pnpm run lint
# rules:
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# # 类型检查
# typecheck:
# stage: test
# script:
# - pnpm check:type
# rules:
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# # 单元测试
# unit-test:
# stage: test
# script:
# - pnpm run test:unit
# rules:
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# # 构建项目
# build:
# stage: build
# script:
# - pnpm run build
# rules:
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# - if: $CI_COMMIT_TAG
# default owner
* @shijie
* @qianduan01
* @cencw
* @limin
* @linlei
* @chenwq
<!--
name: 🐞 Bug 报告
about: 报告 Vben Admin 的问题以帮助我们改进。
title: "Bug: "
labels: "bug: pending triage"
-->
## 版本
<!-- 您正在运行什么版本的软件? -->
- [ ] Vben Admin V5
- [ ] Vben Admin V2
## Bug 描述
<!-- 清楚简洁地描述 Bug 是什么。如果您打算为此问题提交 PR,请在描述中告诉我们。谢谢! -->
## 复现步骤
<!-- 请提供一个可以复现您遇到问题的 StackBlitz 链接或 GitHub 仓库。除非您绝对确定问题很明显且提供的信息足以理解问题,否则必须提供最小复现。 -->
## 系统信息
<!-- 运行 `npx envinfo --system --npmPackages '{vue}' --binaries --browsers` 的输出 -->
## 相关日志输出
<!-- 请复制并粘贴任何相关的日志输出。这将自动格式化为代码,因此不需要反引号。 -->
## 验证
<!-- 提交 Issue 之前,请确保您已执行以下操作 -->
- [ ] 阅读 [文档](https://doc.vben.pro/)
- [ ] 确保代码是最新的。(一些问题已在最新版本中修复)
- [ ] 我已经搜索了 [现有的 Issue](https://github.com/vbenjs/vue-vben-admin/issues),并检查了我的 Issue 没有重复。
- [ ] 检查这是否是一个具体的 Bug。对于问答,请开启 [GitHub Discussion](https://github.com/vbenjs/vue-vben-admin/discussions) 或加入我们的 [Discord 聊天服务器](https://discord.gg/8GuAdwDhj6)。
- [ ] 提供的复现是 Bug 的 [最小可复现示例](https://stackoverflow.com/help/minimal-reproducible-example)。
<!--
name: ✨ 新功能建议
about: 建议为 Vben Admin 添加新功能
title: "FEATURE: "
labels: "enhancement: pending triage"
-->
## 版本
<!-- 您正在运行什么版本的软件? -->
- [ ] Vben Admin V5
- [ ] Vben Admin V2
## 描述
<!-- 功能请求的详细描述。请描述您希望看到的功能,以及为什么它会有用。 -->
## 建议的解决方案
<!-- 清楚简洁地描述您希望发生什么。描述您希望看到的解决方案 -->
## 考虑过的替代方案
<!-- 清楚简洁地描述您考虑过的任何替代解决方案或功能。 -->
## 其他上下文
<!-- 在此处添加关于功能请求的任何其他上下文或截图。 -->
## 验证
<!-- 提交 Issue 之前,请确保您已执行以下操作 -->
- [ ] 阅读 [文档](https://doc.vben.pro/)
- [ ] 确保代码是最新的。(一些问题已在最新版本中修复)
- [ ] 我已经搜索了 [现有的 Issue](https://github.com/vbenjs/vue-vben-admin/issues),并检查了我的 Issue 没有重复。
## 描述
<!-- 请根据需要描述变更。如果这是一个功能或增强,请尽可能详细。如果这是一个 Bug 修复,请链接它修复的问题或详细描述该 Bug。
-->
<!-- 你也可以在这里添加其他背景信息 -->
## 变更类型
请删除不相关的选项。
- [ ] Bug 修复(不破坏现有功能的修复)
- [ ] 新功能(不破坏现有功能的新增功能)
- [ ] 破坏性变更(会导致现有功能无法按预期工作的修复或功能)
- [ ] 此变更需要更新文档
- [ ] 请不要修改 `pnpm-lock.yaml`,除非你引入了新的测试示例。
## 检查清单
> ℹ️ 检查所有复选框 - 这表明你已按照 [贡献指南](contributing.md) 中的规则完成了所有操作。
- [ ] 如果引入新功能,请记录文档。你可以使用 `pnpm run docs:dev` 命令运行文档。
- [ ] 使用 `pnpm test` 运行测试。
- [ ] 变更日志由 PR 名称生成。请确保它以可理解的方式解释你的更改。请在变更集消息前加上 `feat:`、`fix:`、`perf:`、`docs:` 或 `chore:` 前缀。
- [ ] 我的代码遵循本项目的样式指南
- [ ] 我已对自己的代码进行了自我审查
- [ ] 我已对我的代码进行了评论,特别是在难以理解的区域
- [ ] 我已对文档进行了相应的更改
- [ ] 我的更改未生成新的警告
- [ ] 我已添加测试来证明我的修复有效或我的功能正常工作
- [ ] 新的和现有的单元测试在本地通过我的更改
- [ ] 任何依赖的更改都已在下游模块中合并和发布
export default { export default {
"*.{js,jsx,ts,tsx,vue,md}": "pnpm eslint --cache --fix", "*.{js,jsx,ts,tsx,vue,uvue,uts,md}": "pnpm eslint --cache --fix",
"package.json": "pnpm eslint --cache --fix", "package.json": "pnpm eslint --cache --fix",
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": "pnpm eslint --cache --fix", "{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": "pnpm eslint --cache --fix",
"*.{scss,less,styl,html,vue,css,wxss}":"pnpm stylelint --fix --allow-empty-input", "*.{scss,less,styl,html,vue,uvue,css,wxss}":"pnpm stylelint --fix --allow-empty-input",
}; };
dist dist
dev-dist dev-dist
.local .local
...@@ -7,7 +8,8 @@ coverage ...@@ -7,7 +8,8 @@ coverage
CODEOWNERS CODEOWNERS
.nitro .nitro
.output .output
**/*.uvue
**/*.uts
**/*.vue **/*.vue
**/*.js **/*.js
**/*.ts **/*.ts
...@@ -26,7 +28,7 @@ node_modules ...@@ -26,7 +28,7 @@ node_modules
miniprogram_npm miniprogram_npm
uni_modules uni_modules
wxcomponents wxcomponents
unpackage
# 只格式化 wxml # 只格式化 wxml
!*.wxml !*.wxml
!*.json !*.json
......
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
// CSS 变量提示 // CSS 变量提示
"vunguyentuan.vscode-css-variables", "vunguyentuan.vscode-css-variables",
// 在 package.json 中显示 PNPM catalog 的版本 // 在 package.json 中显示 PNPM catalog 的版本
"antfu.pnpm-catalog-lens" "antfu.pnpm-catalog-lens",
// uniapp X 的 语言服务
"dcloud-ide.hbuilderx-language-services"
], ],
"unwantedRecommendations": [ "unwantedRecommendations": [
// 和 volar 冲突 // 和 volar 冲突
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
"ESLint": { "ESLint": {
"type": "stdio", "type": "stdio",
"command": "npx", "command": "npx",
"args": [ "args": ["@eslint/mcp@latest"]
"@eslint/mcp@latest"
]
} }
}, },
"inputs": [] "inputs": []
......
...@@ -43,9 +43,8 @@ ...@@ -43,9 +43,8 @@
"editor.autoClosingQuotes": "beforeWhitespace", "editor.autoClosingQuotes": "beforeWhitespace",
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?", "editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit", "source.fixAll.eslint": "always",
"source.fixAll.stylelint": "explicit", "source.fixAll.stylelint": "always",
"source.organizeImports": "never"
}, },
"editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[html]": { "[html]": {
...@@ -87,6 +86,12 @@ ...@@ -87,6 +86,12 @@
"[yaml]": { "[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[uts]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[uvue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// extensions // extensions
"extensions.ignoreRecommendations": true, "extensions.ignoreRecommendations": true,
...@@ -96,12 +101,17 @@ ...@@ -96,12 +101,17 @@
"terminal.integrated.tabs.enabled": true, "terminal.integrated.tabs.enabled": true,
"terminal.integrated.scrollback": 10000, "terminal.integrated.scrollback": 10000,
"terminal.integrated.stickyScroll.enabled": true, "terminal.integrated.stickyScroll.enabled": true,
"vls.ext.default.style": "scss",
"emmet.includeLanguages": {
"vue": "html",
"uvue": "html"
},
// files // files
"files.eol": "\n", "files.eol": "\n",
"files.insertFinalNewline": true, "files.insertFinalNewline": true,
"files.simpleDialog.enable": true, "files.simpleDialog.enable": true,
"files.associations": { "files.associations": {
"*.uts": "typescript",
"*.ejs": "html", "*.ejs": "html",
"*.art": "html", "*.art": "html",
"**/tsconfig.json": "jsonc", "**/tsconfig.json": "jsonc",
...@@ -114,7 +124,7 @@ ...@@ -114,7 +124,7 @@
"**/bower_components": true, "**/bower_components": true,
"**/.turbo": true, "**/.turbo": true,
"**/.idea": true, "**/.idea": true,
"**/.vitepress": true, "**/.vitepress": false,
"**/tmp": true, "**/tmp": true,
"**/.git": true, "**/.git": true,
"**/.svn": true, "**/.svn": true,
...@@ -122,7 +132,7 @@ ...@@ -122,7 +132,7 @@
"**/CVS": true, "**/CVS": true,
"**/.stylelintcache": true, "**/.stylelintcache": true,
"**/.DS_Store": true, "**/.DS_Store": true,
"**/vite.config.mts.*": true, "**/vite.config.mts.*": false,
"**/tea.yaml": true "**/tea.yaml": true
}, },
"files.watcherExclude": { "files.watcherExclude": {
...@@ -204,6 +214,8 @@ ...@@ -204,6 +214,8 @@
"typescript", "typescript",
"javascriptreact", "javascriptreact",
"typescriptreact", "typescriptreact",
"uts",
"uvue",
"vue", "vue",
"html", "html",
"markdown", "markdown",
...@@ -258,5 +270,5 @@ ...@@ -258,5 +270,5 @@
"vue.server.hybridMode": true, "vue.server.hybridMode": true,
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"oxc.enable": false, "oxc.enable": false,
"cSpell.words": ["archiver", "axios", "dotenv", "isequal", "jspm", "napi", "nolebase", "rollup", "vitest"], "cSpell.words": ["archiver", "axios", "dotenv", "isequal", "jspm", "napi", "nolebase", "rollup", "vitest"]
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
## 开发相关 ## 开发相关
### `dev` ### `dev`
启动开发服务器,运行所有包/应用的开发模式。 启动开发服务器,运行所有包/应用的开发模式。
```bash ```bash
...@@ -12,6 +13,7 @@ pnpm dev ...@@ -12,6 +13,7 @@ pnpm dev
``` ```
### `dev:docs` ### `dev:docs`
启动文档开发服务器。 启动文档开发服务器。
```bash ```bash
...@@ -19,6 +21,7 @@ pnpm dev:docs ...@@ -19,6 +21,7 @@ pnpm dev:docs
``` ```
### `preview` ### `preview`
预览构建后的应用。 预览构建后的应用。
```bash ```bash
...@@ -28,6 +31,7 @@ pnpm preview ...@@ -28,6 +31,7 @@ pnpm preview
## 构建相关 ## 构建相关
### `build` ### `build`
构建项目(使用 turbo-run,设置内存限制为 8GB)。 构建项目(使用 turbo-run,设置内存限制为 8GB)。
```bash ```bash
...@@ -35,6 +39,7 @@ pnpm build ...@@ -35,6 +39,7 @@ pnpm build
``` ```
### `build:all` ### `build:all`
构建所有项目(使用 turbo,设置内存限制为 8GB)。 构建所有项目(使用 turbo,设置内存限制为 8GB)。
```bash ```bash
...@@ -42,6 +47,7 @@ pnpm build:all ...@@ -42,6 +47,7 @@ pnpm build:all
``` ```
### `build:filter` ### `build:filter`
按过滤条件构建并复制到根目录。 按过滤条件构建并复制到根目录。
```bash ```bash
...@@ -49,6 +55,7 @@ pnpm build:filter ...@@ -49,6 +55,7 @@ pnpm build:filter
``` ```
### `build:docs` ### `build:docs`
构建文档项目。 构建文档项目。
```bash ```bash
...@@ -58,6 +65,7 @@ pnpm build:docs ...@@ -58,6 +65,7 @@ pnpm build:docs
## 代码质量检查 ## 代码质量检查
### `check` ### `check`
运行所有检查:循环依赖、依赖、类型检查、拼写检查。 运行所有检查:循环依赖、依赖、类型检查、拼写检查。
```bash ```bash
...@@ -65,6 +73,7 @@ pnpm check ...@@ -65,6 +73,7 @@ pnpm check
``` ```
### `check:circular` ### `check:circular`
检查代码中的循环依赖。 检查代码中的循环依赖。
```bash ```bash
...@@ -72,6 +81,7 @@ pnpm check:circular ...@@ -72,6 +81,7 @@ pnpm check:circular
``` ```
### `check:dep` ### `check:dep`
检查依赖关系。 检查依赖关系。
```bash ```bash
...@@ -79,6 +89,7 @@ pnpm check:dep ...@@ -79,6 +89,7 @@ pnpm check:dep
``` ```
### `check:type` ### `check:type`
运行 TypeScript 类型检查。 运行 TypeScript 类型检查。
```bash ```bash
...@@ -86,6 +97,7 @@ pnpm check:type ...@@ -86,6 +97,7 @@ pnpm check:type
``` ```
### `check:cspell` ### `check:cspell`
对代码和文档进行拼写检查。 对代码和文档进行拼写检查。
```bash ```bash
...@@ -93,6 +105,7 @@ pnpm check:cspell ...@@ -93,6 +105,7 @@ pnpm check:cspell
``` ```
### `lint` ### `lint`
运行 ESLint 代码检查。 运行 ESLint 代码检查。
```bash ```bash
...@@ -100,6 +113,7 @@ pnpm lint ...@@ -100,6 +113,7 @@ pnpm lint
``` ```
### `format` ### `format`
格式化代码(自动修复格式问题)。 格式化代码(自动修复格式问题)。
```bash ```bash
...@@ -107,6 +121,7 @@ pnpm format ...@@ -107,6 +121,7 @@ pnpm format
``` ```
### `publint` ### `publint`
发布前对包进行 lint 检查。 发布前对包进行 lint 检查。
```bash ```bash
...@@ -116,6 +131,7 @@ pnpm publint ...@@ -116,6 +131,7 @@ pnpm publint
## 测试相关 ## 测试相关
### `test:unit` ### `test:unit`
运行单元测试(使用 Vitest,DOM 环境)。 运行单元测试(使用 Vitest,DOM 环境)。
```bash ```bash
...@@ -123,6 +139,7 @@ pnpm test:unit ...@@ -123,6 +139,7 @@ pnpm test:unit
``` ```
### `test:e2e` ### `test:e2e`
运行端到端测试(使用 Playwright)。 运行端到端测试(使用 Playwright)。
```bash ```bash
...@@ -130,6 +147,7 @@ pnpm test:e2e ...@@ -130,6 +147,7 @@ pnpm test:e2e
``` ```
### `command:test` ### `command:test`
测试构建命令。 测试构建命令。
```bash ```bash
...@@ -139,6 +157,7 @@ pnpm command:test ...@@ -139,6 +157,7 @@ pnpm command:test
## 依赖管理 ## 依赖管理
### `update:deps` ### `update:deps`
交互式更新所有依赖到最新版本。 交互式更新所有依赖到最新版本。
```bash ```bash
...@@ -146,6 +165,7 @@ pnpm update:deps ...@@ -146,6 +165,7 @@ pnpm update:deps
``` ```
### `reinstall` ### `reinstall`
清理并重新安装依赖(删除锁文件后重新安装)。 清理并重新安装依赖(删除锁文件后重新安装)。
```bash ```bash
...@@ -153,6 +173,7 @@ pnpm reinstall ...@@ -153,6 +173,7 @@ pnpm reinstall
``` ```
### `clean` ### `clean`
清理构建产物和临时文件。 清理构建产物和临时文件。
```bash ```bash
...@@ -162,6 +183,7 @@ pnpm clean ...@@ -162,6 +183,7 @@ pnpm clean
## 版本管理 ## 版本管理
### `changeset` ### `changeset`
创建变更集(用于版本管理和生成 CHANGELOG)。 创建变更集(用于版本管理和生成 CHANGELOG)。
```bash ```bash
...@@ -169,6 +191,7 @@ pnpm changeset ...@@ -169,6 +191,7 @@ pnpm changeset
``` ```
### `version` ### `version`
更新版本号并更新锁文件(通常在发布前使用)。 更新版本号并更新锁文件(通常在发布前使用)。
```bash ```bash
...@@ -176,6 +199,7 @@ pnpm version ...@@ -176,6 +199,7 @@ pnpm version
``` ```
### `catalog` ### `catalog`
运行 pnpm catalog codemod(管理依赖目录)。 运行 pnpm catalog codemod(管理依赖目录)。
```bash ```bash
...@@ -185,6 +209,7 @@ pnpm catalog ...@@ -185,6 +209,7 @@ pnpm catalog
## Venus CLI 相关 ## Venus CLI 相关
### `venus` ### `venus`
运行 Venus CLI 工具。 运行 Venus CLI 工具。
```bash ```bash
...@@ -192,6 +217,7 @@ pnpm venus ...@@ -192,6 +217,7 @@ pnpm venus
``` ```
### `venus:build` ### `venus:build`
构建 Venus CLI 工具。 构建 Venus CLI 工具。
```bash ```bash
...@@ -199,6 +225,7 @@ pnpm venus:build ...@@ -199,6 +225,7 @@ pnpm venus:build
``` ```
### `venus:create` ### `venus:create`
创建新的 Venus 项目。 创建新的 Venus 项目。
```bash ```bash
...@@ -206,6 +233,7 @@ pnpm venus:create ...@@ -206,6 +233,7 @@ pnpm venus:create
``` ```
### `venus:create:interactive` ### `venus:create:interactive`
交互式创建新的 Venus 项目。 交互式创建新的 Venus 项目。
```bash ```bash
...@@ -213,6 +241,7 @@ pnpm venus:create:interactive ...@@ -213,6 +241,7 @@ pnpm venus:create:interactive
``` ```
### `venus:ls` ### `venus:ls`
列出可用的 Venus 模板。 列出可用的 Venus 模板。
```bash ```bash
...@@ -222,6 +251,7 @@ pnpm venus:ls ...@@ -222,6 +251,7 @@ pnpm venus:ls
## Git 相关 ## Git 相关
### `commit` ### `commit`
使用 PowerShell 脚本进行 Git 提交(配置了 commitlint)。 使用 PowerShell 脚本进行 Git 提交(配置了 commitlint)。
```bash ```bash
...@@ -231,11 +261,13 @@ pnpm commit ...@@ -231,11 +261,13 @@ pnpm commit
## 生命周期钩子 ## 生命周期钩子
### `preinstall` ### `preinstall`
安装前钩子:强制使用 pnpm 作为包管理器。 安装前钩子:强制使用 pnpm 作为包管理器。
### `postinstall` ### `postinstall`
安装后钩子:在所有包中运行 stub 脚本(如果存在)。 安装后钩子:在所有包中运行 stub 脚本(如果存在)。
### `prepare` ### `prepare`
初始化 Husky Git hooks。
初始化 Husky Git hooks。
File mode changed
File mode changed
VITE_BASE_URL=https://baidu.com
\ No newline at end of file \ No newline at end of file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
unpackage
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.tsbuildinfo
.eslintcache
# Cypress
/cypress/videos/
/cypress/screenshots/
# Vitest
__screenshots__/
{
"version" : "1.0",
"configurations" : [
{
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
}
<script lang="uts">
// #ifdef APP-ANDROID || APP-HARMONY
let firstBackTime = 0;
// #endif
export default {
onLaunch () {
console.log("App Launch");
},
onShow () {
console.log("App Show");
},
onHide () {
console.log("App Hide");
},
// #ifdef APP-ANDROID || APP-HARMONY
onLastPageBackPress () {
console.log("App LastPageBackPress");
if (firstBackTime == 0) {
uni.showToast({
title: "再按一次退出应用",
position: "bottom",
});
firstBackTime = Date.now();
setTimeout(() => {
firstBackTime = 0;
}, 2000);
} else if (Date.now() - firstBackTime < 2000) {
firstBackTime = Date.now();
uni.exit();
}
},
// #endif
onExit () {
console.log("App Exit");
},
};
</script>
<style lang="scss">
@import url("./uni_modules/cool-unix/tailwindcss.scss");
@import url("./uni_modules/cool-unix/index.scss");
</style>
#### 项目介绍
萤火商城V2.0,是2021年全新推出的一款轻量级、高性能、前后端分离的电商系统,支持微信小程序 + H5+ 公众号 + APP,前后端源码完全开源,看见及所得,完美支持二次开发,可学习可商用,让您快速搭建个性化独立商城。
如果对您有帮助,您可以点右上角 “Star” 收藏一下 ,获取第一时间更新,谢谢!
#### 如何使用uni-app端
##### 一、导入uniapp项目
1. 首先下载HBuilderX并安装,地址:https://www.dcloud.io/hbuilderx.html
2. 打开HBuilderX -> 顶部菜单栏 -> 文件 -> 导入 -> 从本地目录导入 -> 选择uniapp端项目目录
3. 找到config.js文件,找到里面的apiUrl项,填入已搭建的后端url地址
4. 打开manifest.json文件,选择微信小程序配置,填写小程序的appid
##### 二、本地调试
1. 打开HBuilderX -> 顶部菜单栏 -> 运行 -> 运行到浏览器 -> Chrome
2. 如果请求后端api时 提示跨域错误,可安装Chrome插件:【Allow CORS: Access-Control-Allow-Origin】,地址:https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf
##### 三、打包发行(H5)
1. 打开HBuilderX -> 顶部菜单栏 -> 发行 -> 网站H5-手机版
2. 打包后的文件路径:/unpackage/dist/build/h5
3. 将打包完成的所有文件 复制到商城后端/pulic目录下,全部替换
##### 四、打包发行(微信小程序)
1. 下载微信开发者工具并安装,地址:https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
2. 打开HBuilderX -> 顶部菜单栏 -> 发行 -> 小程序-微信
3. 打包后的文件路径:/unpackage/dist/build/mp-weixin
5. 打开微信开发者工具 导入 打包完成的项目
6. 检查没有运行错误,在右上方上传小程序
#### UNIAPP-页面展示
![前端展示](https://images.gitee.com/uploads/images/2021/0316/215102_7bcb0802_2166072.png "前端展示.png")
#### 系统演示
![前端演示二维码](https://images.gitee.com/uploads/images/2021/0316/104516_3778337e_2166072.png "111.png")
#### 版权须知
1. 允许个人学习研究使用,支持二次开发,允许商业用途(仅限自运营)。
2. 允许商业用途,但仅限自运营,如果商用必须保留版权信息,望自觉遵守。
3. 不允许对程序代码以任何形式任何目的的再发行或出售,否则将追究侵权者法律责任。
\ No newline at end of file \ No newline at end of file
<template>
<view class="w-full p-5 pt-[60px] items-center justify-center">
<image :src="imgSrc" mode="widthFix" class="w-2/3"></image>
<view class="w-full justify-center items-center">
<text class="text-[#999] text-md" v-if="isTips">{{ tips }}</text>
<!-- 内容插槽 -->
<slot></slot>
</view>
</view>
</template>
<script setup lang="uts">
import data from '@/static/images/status/data.png'
import cart from '@/static/images/status/cart.png'
import order from '@/static/images/status/order.png'
import wallet from '@/static/images/status/wallet.png'
import coupon from '@/static/images/status/coupon.png'
import history from '@/static/images/status/history.png'
import message from '@/static/images/status/message.png'
import address from '@/static/images/status/address.png'
import payError from '@/static/images/status/pay-error.png'
import paySuccess from '@/static/images/status/pay-success.png'
type IconType = | 'data' | 'cart' | 'order' | 'wallet' | 'coupon' | 'history' | 'message' | 'address' | 'pay-success' | 'pay-error'
const props = defineProps({
type: {
type: String as PropType<IconType>,
default: 'data'
},
isTips: {
type: Boolean,
default: true
},
tips: {
type: String,
default: '这里空空如也~'
}
})
const imgSrc = computed(() => {
let src = ''
switch (props.type) {
case 'pay-success':
src = paySuccess
break;
case 'pay-error':
src = payError
break;
case 'data':
src = data
break;
case 'cart':
src = cart
break;
case 'order':
src = order
break;
case 'wallet':
src = wallet
break;
case 'coupon':
src = coupon
break;
case 'history':
src = history
break;
case 'message':
src = message
break;
case 'address':
src = address
break;
default:
src = data
break;
}
return src
})
</script>
<style lang="scss">
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="footer-float-bar">
<view :class="{pb: placeholder}">
<slot></slot>
</view>
</view>
</template>
<script setup lang="uts">
type Props = {
placeholder?: boolean
}
// 建议开启默认值,确保模板逻辑健壮
withDefaults(defineProps<Props>(), {
placeholder: true
});
</script>
<style lang="scss">
.footer-float-bar {
position: fixed;
bottom: 0;
left: 0;
z-index: 1;
width: 100%;
padding-bottom: var(--uni-safe-area-inset-bottom);
background-color: #fff;
.pb {
padding: 0 0 50px;
}
}
</style>
<template>
<view class="w-full rounded-md overflow-hidden"
:class="{ 'flex-row': direction == 'horizontal', 'mb-3': mb }"
@tap="goDetail">
<view class="relative"
:class="[direction == 'horizontal' ? 'horizontal-img' : 'vertical-img', customImgWidth ? 'custom-img-w' : '']">
<image class="w-full h-full absolute top-0 left-0"
mode="aspectFill"
src="https://uni-docs.cool-js.com/demo/pages/demo/static/bg1.png">
</image>
</view>
<view class="flex-1 px-2 bg-white" :class="{'py-2': direction == 'horizontal'}">
<cl-text ellipsis :pt="{className: 'text-[#333] font-bold'}">
商品名称
</cl-text>
<cl-text color="info"
ellipsis
:lines="direction == 'horizontal' ? 1 : 2"
size="12px">
云想衣裳花想容,春风拂槛露华浓。若非群玉山头见,会向瑶台月下逢。天阶夜色凉如水,卧看牵牛织女星。人生若只如初见,何事秋风悲画扇。山有木兮木有枝,心悦君兮君不知。
</cl-text>
<view class="flex-row items-center justify-between py-[2px]">
<cl-text color="error"
:pt="{className: 'font-bold'}"
size="15px"
type="amount"
:value="12">
</cl-text>
<cl-text color="info"
:pt="{className: 'ml-1'}"
size="10px">
销量:12
</cl-text>
</view>
<view class="flex-row items-end mt-auto" :class="{'pb-[10px]': direction === 'vertical'}">
<cl-button :pt="{
className: '!rounded-full !p-0 !w-[20px] !h-[20px] !border-none !ml-auto',
label: {
className: '!leading-4'
}
}"
size="small"
type="error"
@tap.stop>
<cl-icon color="#fff" name="add-line"></cl-icon>
</cl-button>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { router } from "@/utils/router.uts";
type Direction = "horizontal" | "vertical";
const props = defineProps({
/**
* @name 方向
* @enum "vertical , horizontal"
*/
direction: {
type: String as PropType<Direction>,
default: "vertical",
},
/**
* @name 底部边距
*/
mb: {
type: Boolean,
default: true
},
/**
* @name 控制横向商品图片的大小
*/
customImgWidth: {
type: Boolean,
default: false
}
});
const goDetail = () => {
router.navigateTo("/pages/subHome/goods-detail", "");
};
</script>
<style lang="scss">
.horizontal-img {
position: relative;
width: 30%;
padding-bottom: 30%;
}
.custom-img-w {
width: 40% !important;
padding-bottom: 40% !important;
}
.vertical-img {
position: relative;
width: 100%;
padding-bottom: 100%;
}
</style>
<template>
<view class="swiper-box">
<swiper class="swiper"
:current="current"
@change="swiperChange">
<swiper-item v-if="video"
class="swiper-item"
item-id="video">
<video class="swiper-item-video"
controls
:poster="poster"
:src="video">
</video>
</swiper-item>
<swiper-item v-for="item in list" :key="item" class="swiper-item">
<image class="swiper-item-img" :src="item"></image>
</swiper-item>
</swiper>
<view class="bot-type-tag absolute right-3 bottom-3 p-1 z-50">
<!-- 图片和视频下标 -->
<view v-if="video" class="flex-row">
<view class="p-1 rounded-md"
@tap="current = 0">
<text class="text-sm text-white">视频</text>
</view>
<view class="flex-row p-1 rounded-md"
:class="{'bg-black': current != 0}"
@tap="current = 1">
<text class="text-sm text-white">图集</text>
<text v-show="current != 0" class="text-sm text-white">{{ current }}/{{ list.length }}</text>
</view>
</view>
<!-- 仅图片下标 -->
<view v-else class="p-1 rounded-md">
<text class="text-sm text-white">{{ current + 1 }}/{{ list.length }}</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
defineProps({
list: {
type: Array<String>,
default: () => []
},
video: {
type: String,
default: ""
},
poster: {
type: String,
default: ""
}
});
// 当前轮播图下标
const current = ref<number>(0);
const swiperChange = (e : SwiperChangeEvent) => {
current.value = e.detail.current;
};
</script>
<style lang="scss">
.swiper-box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.swiper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.swiper-item,
.swiper-item-img,
.swiper-item-video {
width: 100%;
height: 100%;
}
}
.bot-type-tag {
background: rgb(0 0 0 / 70%);
border-radius: 6px;
}
}
</style>
<template>
<cl-topbar back-icon="arrow-left-s-line"
:background-color="bgc"
:color="color"
:fixed="fixed"
:height="height"
:pt="{
className: 'opacity-90 !z-50'
}"
safe-area-top
:show-back="isShowBack"
:title="title">
<template #prepend>
<view class="!pl-2">
<slot name="before"></slot>
</view>
</template>
<template #append>
<view class="pr-2">
<slot name="after"></slot>
</view>
</template>
</cl-topbar>
</template>
<script setup lang="uts">
const props = defineProps({
title: {
type: String,
default: "标题"
},
isShowBack: {
type: Boolean,
default: true
},
fixed: {
type: Boolean,
default: true
},
bgc: {
type: String,
default: "#ffffff"
},
color: {
type: String,
default: "#333333"
},
height: {
type: String,
default: "44px"
}
});
</script>
<style lang="scss">
</style>
<template>
<cl-popup v-model="visible" :show-close="false" title="订单支付">
<scroll-view class="p-4 h-[400px]">
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
</scroll-view>
<view class="p-3">
<cl-button type="error" @tap="emit('pay')">立即支付</cl-button>
</view>
</cl-popup>
</template>
<script lang="uts" setup>
const emit = defineEmits(['pay'])
const visible = ref(false);
const open = () => {
visible.value = true;
}
const close = () => {
visible.value = false
}
defineExpose({
open,
close
})
</script>
\ No newline at end of file \ No newline at end of file
<template>
<cl-button @tap="sendCode">
{{ isSendRes ? `${number }s 后重试` : text }}
</cl-button>
</template>
<script setup lang="uts">
import { useUi } from "@/uni_modules/cool-unix/hooks";
const props = defineProps({
email: {
type: String,
default: ""
}
});
const ui = useUi();
const number = ref(60);
const text = ref("发送验证码");
// 是否发送成功
const isSendRes = ref(false);
const reg = /^[A-Z0-9\u4E00-\u9FA5]+@[\w-]+(\.[\w-]+)+$/i;
// 操作倒计时数字
const timer = ref<null|number>(null);
const handleNumber = () => {
timer.value = setInterval(() => {
number.value = number.value - 1;
if (number.value == 0) {
if (timer.value != null) {
clearInterval(timer.value as number);
}
isSendRes.value = false;
}
}, 1000) as number;
};
const sendCode = () => {
if (isSendRes.value) return ui.showToast({
message: "验证码已发送,请稍后重试"
});
if (props.email == "") {
ui.showToast({
message: "请输入邮箱地址"
});
} else if (reg.test(props.email)) {
isSendRes.value = true;
handleNumber();
} else {
ui.showToast(({
message: "请输入正确的邮箱地址"
}));
}
};
</script>
<style>
</style>
<template>
<view class="tab-bar">
<view class="flex-row tab-bar-content">
<view class="flex-1 items-center justify-center" v-for="tab in tabBarList" :key="tab.url"
@tap="switchTab(tab.url)">
<image :src="tab.id == current ? tab.image_a : tab.image" class="w-[24px] h-[24px]"></image>
<cl-text size="10px" :pt="{
className: '!leading-[10px]'
}" :color="tab.id == current ? 'primary' : 'info'">{{tab.label}}</cl-text>
</view>
</view>
</view>
<!-- 底部导航占位符 -->
<view class="tab-bar-placeholder">
<view class="placeholder-content">
</view>
</view>
</template>
<script setup lang="uts">
import { router } from '@/utils/router.uts'
import { tabBarList } from '@/utils/pageStaticList'
const props = defineProps({
current: {
default: 'index',
type: String
}
})
const switchTab = (url : string) => {
console.log(url);
router.switchTab(url, '')
}
onLoad(() => {
uni.hideTabBar()
})
</script>
<style lang="scss">
.tab-bar {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
z-index: 99;
background-color: #fff;
border-top: 1px solid #eee;
padding-bottom: var(--uni-safe-area-inset-bottom);
/* #ifdef MP-WEIXIN */
padding-bottom: constant(safe-area-inset-bottom);
/* #endif */
padding-bottom: env(safe-area-inset-bottom);
.tab-bar-content {
height: 50px;
}
}
.tab-bar-placeholder {
padding-bottom: var(--uni-safe-area-inset-bottom);
/* #ifdef MP-WEIXIN */
padding-bottom: constant(safe-area-inset-bottom);
/* #endif */
padding-bottom: env(safe-area-inset-bottom);
.placeholder-content {
height: 50px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
{
"android": {},
"ios": {}
}
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="static/logo.png" type="image/x-icon" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app" class="app-main"><!--app-html--></div>
<script type="module" src="/main"></script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
import { createSSRApp } from "vue";
import App from "./App.uvue";
import { cool } from "./uni_modules/cool-unix";
export function createApp() {
const app = createSSRApp(App);
app.use(cool);
return {
app
};
}
{
"name": "NOURA",
"appid": "__UNI__F09ACC0",
"description": "NOURA STUDIO.",
"versionName": "1.0.1",
"versionCode": "101",
"uni-app-x": {},
/* 快应用特有相关 */
"quickapp": {},
/* 小程序特有相关 */
"mp-weixin": {
"appid": "wx4b1e8871f5305c63",
"setting": {
"urlCheck": false,
"minified": true
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": "获取位置"
}
}
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3",
"app": {
"distribute": {
"icons": {
"android": {
"hdpi": "",
"xhdpi": "",
"xxhdpi": "",
"xxxhdpi": ""
}
}
}
},
"app-android": {
"distribute": {
"modules": {
"uni-location": {
"system": {}
}
},
"icons": {
"hdpi": "D:/workspace/uniapp_demo/lightning/static/logo.png",
"xhdpi": "D:/workspace/uniapp_demo/lightning/static/logo.png",
"xxhdpi": "D:/workspace/uniapp_demo/lightning/static/logo.png",
"xxxhdpi": "D:/workspace/uniapp_demo/lightning/static/logo.png"
},
"splashScreens": {
"default": {}
}
}
},
"app-ios": {
"distribute": {
"modules": {},
"icons": {
"appstore": "D:/workspace/uniapp_demo/lightning/static/logo.png"
},
"splashScreens": {}
}
},
"web": {
"router": {
"mode": ""
},
"title": "NOURA STUDIO."
},
"app-harmony": {
"distribute": {
"modules": {}
}
}
}
{
"name": "uniapp-x-shop",
"version": "1.0.0",
"license": "MIT",
"scripts": {},
"dependencies": {
"vue": "^3.5.13"
},
"devDependencies": {
"@cool-vue/vite-plugin": "8.2.18",
"@dcloudio/types": "^3.4.16",
"@types/node": "^24.0.15",
"@vue/tsconfig": "^0.7.0",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.3",
"prettier": "^3.5.3",
"tailwindcss": "3.4.17",
"vite": "^6.3.5"
}
}
{
"pages": [{
"path": "pages/index/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/cate",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/moments",
"style": {
"navigationStyle": "custom",
"backgroundColor": "#f8f8f8"
}
},
{
"path": "pages/index/cart",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/mine",
"style": {
"navigationStyle": "custom"
}
}
],
"subPackages": [{
"root": "pages/subHome",
"pages": [{
"path": "search",
"style": {
"navigationBarTitleText": "搜索",
"navigationStyle": "custom"
}
},
{
"path": "goods-detail",
"style": {
"navigationBarTitleText": "商品详情页",
"navigationStyle": "custom"
}
},
{
"path": "coupon",
"style": {
"navigationBarTitleText": "优惠券领取中心",
"navigationStyle": "custom"
}
}
]
},
{
"root": "pages/login",
"pages": [{
"path": "login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},
{
"path": "register",
"style": {
"navigationBarTitleText": "注册",
"navigationStyle": "custom"
}
},
{
"path": "agreement",
"style": {
"navigationBarTitleText": "隐私政策/用户协议",
"navigationStyle": "custom"
}
}
]
},
{
"root": "pages/subMoments",
"pages": [{
"path": "release-moment",
"style": {
"navigationBarTitleText": "发布动态",
"navigationStyle": "custom"
}
},
{
"path": "moment-detail",
"style": {
"navigationBarTitleText": "动态详情",
"navigationStyle": "custom"
}
},
{
"path": "my-moments",
"style": {
"navigationBarTitleText": "我的动态",
"navigationStyle": "custom"
}
}
]
},
{
"root": "pages/subMine",
"pages": [{
"path": "settings",
"style": {
"navigationBarTitleText": "设置",
"navigationStyle": "custom"
}
},
{
"path": "contact",
"style": {
"navigationBarTitleText": "联系我们",
"navigationStyle": "custom"
}
},
{
"path": "about",
"style": {
"navigationBarTitleText": "关于我们",
"navigationStyle": "custom"
}
},
{
"path": "user-center",
"style": {
"navigationBarTitleText": "个人中心",
"navigationStyle": "custom"
}
},
{
"path": "account-security",
"style": {
"navigationBarTitleText": "账号安全",
"navigationStyle": "custom"
}
}
]
},
{
"root": "pages/order",
"pages": [{
"path": "submit-order-page",
"style": {
"navigationBarTitleText": "提交订单",
"navigationStyle": "custom"
}
},
{
"path": "payment-status",
"style": {
"navigationBarTitleText": "支付状态",
"navigationStyle": "custom",
"backgroundColorContent": "#ffffff"
}
},
{
"path": "order-detail",
"style": {
"navigationBarTitleText": "订单详情",
"navigationStyle": "custom"
}
},
{
"path": "order-list",
"style": {
"navigationBarTitleText": "订单列表",
"navigationStyle": "custom"
}
}
]
}
],
// "preloadRule": {
// "pages/index/index": {
// "network": "all",
// "packages": [
// "pages/login", "pages/subHome"
// ]
// },
// "pages/index/moments": {
// "network": "all",
// "packages": [
// "pages/subMoments"
// ]
// },
// "pages/index/mine": {
// "network": "all",
// "packages": [
// "pages/subMine"
// ]
// }
// },
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "NOURA STUDIO.",
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#00b96b",
"backgroundColorContent": "#f8f8f8"
},
"tabBar": {
"color": "#333",
"selectedColor": "#00b96b",
"backgroundColor": "#fff",
"borderStyle": "white",
"list": [{
"text": "首页",
"pagePath": "pages/index/index",
"iconPath": "/static/images/tabbar/home.png",
"selectedIconPath": "/static/images/tabbar/home_a.png"
},
{
"text": "商品",
"pagePath": "pages/index/cate",
"iconPath": "/static/images/tabbar/cate.png",
"selectedIconPath": "/static/images/tabbar/cate_a.png"
},
{
"text": "发现",
"pagePath": "pages/index/moments",
"iconPath": "/static/images/tabbar/moments.png",
"selectedIconPath": "/static/images/tabbar/moments_a.png"
},
{
"text": "购物车",
"pagePath": "pages/index/cart",
"iconPath": "/static/images/tabbar/cart.png",
"selectedIconPath": "/static/images/tabbar/cart_a.png"
},
{
"text": "我的",
"pagePath": "pages/index/mine",
"iconPath": "/static/images/tabbar/mine.png",
"selectedIconPath": "/static/images/tabbar/mine_a.png"
}
]
},
"uniIdRouter": {}
}
\ No newline at end of file \ No newline at end of file
<template>
<cl-page :back-top="false">
<NavBar title="" :is-show-back="false">
<template #before>
<view class="flex-row">
<cl-text :pt="{className: 'text-black'}" @tap="showToast">购物车</cl-text>
<cl-text size="10px" color="info">(40)</cl-text>
</view>
</template>
<template #after>
<cl-text @tap="isAction = !isAction" :style="{marginRight: wxMenuWidth + 'px'}">{{ isAction ? '完成' : '管理' }}</cl-text>
</template>
</NavBar>
<view class="w-full p-3 pb-[60px]">
<view class="w-full p-3 pb-0 rounded-lg bg-white">
<view class="pb-3" v-for="item in 8" :key="item">
<GoodsItem direction="horizontal" :mb="false"></GoodsItem>
</view>
</view>
<!-- 加载更多 -->
<view class="pt-3">
<cl-loadmore loading></cl-loadmore>
</view>
<!-- 底部操作栏 -->
<FooterFloatBar>
<view class="bg-white py-2 px-3 flex-row items-center justify-between">
<view class="flex-row items-center" @tap="isCheckAll = !isCheckAll">
<view class="radio" :class="{ 'a-radio': isCheckAll }">
<view class="radio-block" v-show="isCheckAll"> </view>
</view>
<cl-text :color="isCheckAll ? 'error': 'info'" value="全选"></cl-text>
</view>
<view class="flex-row items-center">
<cl-text type="amount" currency="¥" :value="12" :precision="2" color="error" :pt="{ className: '!mr-2' }"
v-if="!isAction"></cl-text>
<cl-button type="error" @tap="actions">{{ isAction ? '删除' : '去结算(1)' }}</cl-button>
</view>
</view>
</FooterFloatBar>
</view>
<TabBar current="cart"></TabBar>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
import TabBar from '@/components/TabBar.uvue'
import GoodsItem from '@/components/GoodsItem.uvue'
import FooterFloatBar from '@/components/FooterFloatBar.uvue'
import { useUi } from '@/uni_modules/cool-unix/hooks'
import type { ClConfirmAction } from '@/uni_modules/cool-unix/types'
const ui = useUi()
const token = ref<string | null>(null)
// 是否全选
const isCheckAll = ref(false)
// 是否操作
const isAction = ref(false)
const wxMenuWidth = computed(() => {
let mw = 0
// #ifdef MP-WEIXIN
const { width } = uni.getMenuButtonBoundingClientRect()
mw = width + 12
// #endif
return mw
})
const showToast = () => {
ui.showToast({
message: '编辑功能,开发中...'
})
}
const actions = () => {
// 执行删除操作
if (isAction.value) {
ui.showConfirm({
title: '提示',
message: '是否确认删除所选中的商品?',
callback: (ac : ClConfirmAction) => {
console.log(ac);
if (ac == 'confirm') {
isAction.value = false
}
}
})
return
}
// 携带参数,去结算
}
// 页面显示生命周期函数
onPageShow(() => {
const t = uni.getStorageSync('token') as string
token.value = t
console.log(token.value, 'token');
})
</script>
<style lang="scss">
.radio {
width: 16px;
height: 16px;
border-radius: 10px;
border: 2px solid #71717a;
margin-right: 4px;
position: relative;
&.a-radio {
border-color: #ef4444 !important;
}
.radio-block {
position: absolute;
top: 2px;
left: 2px;
width: 8px;
height: 8px;
border-radius: 4px;
background-color: #ef4444;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar :fixed="true"
:is-show-back="false"
title="分类">
<template #before>
<cl-icon name="sousuo_2" @tap="search"></cl-icon>
</template>
</NavBar>
<view class="cate-content flex-row" :style="{height: `${contentH }px`}">
<scroll-view class="cate-box" scroll-y="true">
<view v-for="(item, index) in cateList"
:key="item"
class="cate"
@tap="checkCate(index, item)">
<cl-text :color="index == checkCateInfo.index ? 'primary' : ''" size="14px">
猫和老鼠
</cl-text>
</view>
</scroll-view>
<scroll-view class="goods-box"
scroll-y="true"
@scrolltolower="scrollend">
<view class="p-2">
<GoodsItem v-for="goods in 18"
:key="goods"
:custom-img-width="true"
direction="horizontal">
</GoodsItem>
<cl-loadmore :finish="!loading"
finish-text="点击查看更多"
:loading="loading"
@tap="goPrev">
</cl-loadmore>
</view>
</scroll-view>
</view>
<TabBar current="cate"></TabBar>
</cl-page>
</template>
<script setup lang="uts">
import GoodsItem from "@/components/GoodsItem.uvue";
import NavBar from "@/components/NavBar.uvue";
import TabBar from "@/components/TabBar.uvue";
import { router } from "@/utils/router.uts";
// 内容可用高度
const contentH = computed(() => {
const { statusBarHeight, screenHeight } = uni.getSystemInfoSync();
return screenHeight - statusBarHeight - 94;
});
// 分类列表
const cateList = ref<string[]>([
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
]);
// 商品列表
const goodsList = ref<string[]>([
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg1.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg2.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg3.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg4.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg1.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg2.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg3.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg4.png",
]);
const loading = ref(true);
type CheckCate = {
id : string
index : number
}
const checkCateInfo = ref<CheckCate>({
index: 0,
id: ""
});
// 切换分类
const checkCate = (index : number, id : string) => {
checkCateInfo.value = {
index,
id
} as CheckCate;
};
// 滚动到底部
const scrollend = (e : UniScrollToLowerEvent) => {
setTimeout(() => {
loading.value = false;
}, 2000);
};
// 点击查看下一个分类
const goPrev = () => {
const { index } = checkCateInfo.value;
if (index + 1 >= cateList.value.length) return;
checkCateInfo.value = {
index: index + 1,
id: cateList.value[index + 1]
} as CheckCate;
};
// 搜索
const search = () => {
router.navigateTo("/pages/subHome/search", "");
};
</script>
<style lang="scss">
.cate-content {
padding-bottom: var(--uni-safe-area-inset-bottom);
.cate-box {
width: 80px;
background-color: #fff;
border-right: 1px solid #eee;
.cate {
padding: 5px 10px;
}
}
.goods-box {
flex: 1;
.goods-item {
margin-bottom: 12px;
background-color: #fff;
border-radius: 8px;
}
}
}
</style>
<template>
<view class="home-top-components">
<cl-sticky :offset-top="0">
<view class="search-box" :style="{paddingTop: pt + 'px'}">
<view class="search h-[30px] flex-row rounded-[30px]" :style="{marginRight: wxMenuWidth + 'px'}"
@tap="nav('/pages/subHome/search')">
<cl-icon name="sousuo_2" color="#fff"></cl-icon>
<text class="text-md text-[#fff] ml-2">点击搜索更多商品~</text>
</view>
<cl-tabs v-model="val" :height="60" :list="cateList" color="#f40" unColor="#fff"></cl-tabs>
</view>
</cl-sticky>
<view class="b-bg"></view>
<view class="feature-grid-box flex-row items-start">
<view class="feature-banner-box mr-3">
<swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="10000" :circular="true"
indicator-active-color="#ffdde1">
<swiper-item class="swiper-item" v-for="item in list" :key="item">
<image :src="item" class="swiper-item-img"></image>
</swiper-item>
</swiper>
</view>
<view class="points-new mb-2">
<view class="points" @tap="nav('/pages/subHome/coupon')">
<image src="/static/images/lq-coupon.png" class="points-img" mode="aspectFill"></image>
</view>
<view class="new-goods mt-2">
<image src="/static/images/new-goods.png" class="new-img" mode="aspectFill"></image>
</view>
</view>
</view>
<view class="p-3">
<view class="h-[40px] flex-row">
<view class="w-[40px] h-[40px] bg-green-500">今</view>
<view class="w-[40px] h-[40px] bg-green-500">日</view>
<view class="w-[40px] h-[40px] bg-green-500">上</view>
<view class="w-[40px] h-[40px] bg-green-500">新</view>
<view class="w-[40px] h-[40px] bg-green-500">啦</view>
<view class="w-[40px] h-[40px] bg-green-500">!</view>
<view class="w-[40px] h-[40px] bg-green-500">!</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { router } from '@/utils/router.uts'
import type { ClTabsItem } from "@/uni_modules/cool-unix";
const pt = computed(() => {
const { statusBarHeight } = uni.getSystemInfoSync()
return statusBarHeight + 8
})
const wxMenuWidth = computed(() => {
let mw = 0
// #ifdef MP-WEIXIN
const { width } = uni.getMenuButtonBoundingClientRect()
mw = width
// #endif
return mw
})
const val = ref("1");
const cateList = ref<ClTabsItem[]>([
{
label: "推荐",
value: "1",
},
{
label: "新品上市",
value: "2",
},
{
label: "今日特价",
value: "3",
},
{
label: "人气榜",
value: "4",
},
{
label: "限时团购",
value: "5",
}
]);
const list = ref<string[]>([
"https://img.alicdn.com/imgextra/i1/O1CN01bPtedB1gyEW70NAko_!!6000000004210-2-tps-750-1000.png",
"https://img.alicdn.com/imgextra/i1/O1CN01fkcCak258M3329VoP_!!6000000007481-2-tps-750-1000.png",
" https://img.alicdn.com/imgextra/i3/O1CN01oj7fpb1yOCRLbaqUj_!!6000000006568-2-tps-750-1000.png",
]);
const nav = (url : string) => {
router.navigateTo(url, '')
}
</script>
<style lang="scss">
.home-top-components {
.search-box {
background: #00b96b;
padding: 10px 12px;
.search {
border: 1px solid #f8f9fa;
padding: 0 12px;
margin: 0 0 10px 0;
align-items: center;
}
}
.b-bg {
width: 100%;
padding: 0 0 100px 0;
border-radius: 0 0 15px 15px;
background-image: linear-gradient(to bottom, #00b96b, #fff);
}
.feature-grid-box {
padding: 0 12px 0px;
transform: translateY(-100px);
margin: 0 0 -100px 0;
.feature-banner-box {
width: 50%;
position: relative;
padding: 0 0 70% 0;
border-radius: 10px;
overflow: hidden;
.swiper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.swiper-item,
.swiper-item-img {
width: 100%;
height: 100%;
}
}
}
.points-new {
flex: 1;
height: 100%;
.points,
.new-goods {
flex: 1;
position: relative;
border-radius: 10px;
.points-img,
.new-img {
width: 100%;
height: 100%;
position: absolute;
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="mine-user-info">
<!-- 顶部悬浮用户头像 -->
<view class="top-avatar" v-show="isShowTopAvatar">
<view class="top-avatar-content" :style="{paddingTop: statusBar}">
<cl-avatar :src="avatar" size="30px" rounded></cl-avatar>
</view>
</view>
<!-- 用户信息 -->
<view class="user-info">
<cl-avatar :src="avatar" size="80px" rounded></cl-avatar>
<view class="user-desc" v-if="token">
<cl-text size="20px" :pt="{
className: '!mb-1 !font-bold'
}">豆包</cl-text>
<cl-text value="17538875228" type="phone" color="info" mask></cl-text>
</view>
<view class="no-login" @tap="emit('nav', '/pages/login/login')" v-else>
<text class="no-text">暂未登录</text>
</view>
</view>
</view>
<!-- 订单模块 -->
<view class="order-box p-3 rounded-xl mb-3">
<view class="flex-row justify-between items-center pb-[10px]">
<!-- <cl-text size="14px">我的订单</cl-text> -->
<view class="flex-row items-center pb-[10px]">
<image src="/static/images/mine/order.png" mode="widthFix" class="w-[18px] mr-1"></image>
<cl-text size="14px">我的订单</cl-text>
</view>
<view class="flex-row items-center" @tap="emit('nav', '/pages/order/order-list')">
<cl-text color="info" size="10px">全部订单</cl-text>
<cl-icon name="arrow-right-s-line" color="info"></cl-icon>
</view>
</view>
<view class="flex-row border-t">
<view class="flex-1 items-center justify-center" v-for="order in minePageOrderList" :key="order.id">
<image :src="order.image" class="size-8"></image>
<cl-text color="info" size="10px">{{ order.label }}</cl-text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { minePageOrderList } from '@/utils/pageStaticList'
const props = defineProps({
isShowTopAvatar: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['nav'])
const token = ref<string | null>(null)
const statusBar = computed(() => uni.getSystemInfoSync().statusBarHeight + 10 + 'px')
const avatar = 'https://ts4.tc.mm.bing.net/th/id/OADD2.8246453610765_186UKUV60SS80KKXFI?w=32&h=32&o=6&cb=ucfimg1&pid=21.2&ucfimg=1'
// 页面显示生命周期
onPageShow(() => {
const t = uni.getStorageSync('token') as string
token.value = t
})
</script>
<style lang="scss">
.mine-user-info {
padding: var(--status-bar-height) 0 70px 0;
background-color: #fff;
border-radius: 0 0 20px 20px;
background-image: linear-gradient(to right, #ffcad3, #febf99);
background-image: url('https://mp-2d57ae4b-9de7-44cc-8ebd-8d537a259d9b.cdn.bspapp.com/static/eastShop/home/background.png');
background-repeat: no-repeat;
background-size: cover;
.top-avatar {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-image: url('https://mp-2d57ae4b-9de7-44cc-8ebd-8d537a259d9b.cdn.bspapp.com/static/eastShop/home/background.png');
z-index: 99;
.top-avatar-content {
justify-content: center;
padding: 10px 12px;
}
}
.user-info {
padding: 50px 12px 10px;
flex-direction: row;
align-items: center;
.user-desc,
.no-login {
margin-left: 12px;
}
.no-login {
padding: 5px 15px;
border: 1px solid #f40;
border-radius: 20px;
.no-text {
color: #f40;
}
}
}
}
.order-box {
background-color: rgba(255, 255, 255, .8);
transform: translateY(-60px);
margin: 0 12px -60px;
.border-t {
border-top: solid 1px #e5e5e5;
padding-top: 12px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page :back-top="false">
<HomeTop></HomeTop>
<view class="py-[10px]">
<cl-waterfall v-if="123"
ref="waterfallRef"
:column="2"
:gutter="16">
<template #item>
<GoodsItem direction="vertical"></GoodsItem>
</template>
</cl-waterfall>
<cl-loadmore loading></cl-loadmore>
</view>
<TabBar current="index"></TabBar>
</cl-page>
</template>
<script setup lang="uts">
import GoodsItem from "@/components/GoodsItem.uvue";
// import { ClWaterfallComponentPublicInstance } from '@/uni_modules/cool-unix/cool/types'
import TabBar from "@/components/TabBar.uvue";
import HomeTop from "./components/HomeTop.uvue";
const waterfallRef = ref<ClWaterfallComponentPublicInstance | null>(null);
let id = 0;
function generateMockData() {
return [
{
id: id++,
},
{ id: id++,
},
{
id: id++,
},
{
id: id++,
},
{
id: id++,
},
{
id: id++,
},
{
id: id++,
},
{
id: id++,
},
{
id: id++,
},
{
id: id++,
},
] as UTSJSONObject[];
}
onLoad(() => {});
onMounted(() => {
const items = generateMockData();
waterfallRef.value?.append(items);
});
</script>
<style lang="scss">
</style>
<template>
<cl-page :back-top="false">
<view class="mine-page">
<!-- 用户身份信息/订单 -->
<UserOrOrder :is-show-top-avatar="showTopAvatar" @nav="nav"></UserOrOrder>
<view class="mine-content">
<!-- 我的钱包 -->
<view class="bg-white p-3 rounded-xl mb-3">
<view class="flex-row items-center pb-[10px]">
<image src="/static/images/mine/wallet.png" mode="widthFix" class="w-[18px] mr-1"></image>
<cl-text size="14px">我的钱包</cl-text>
</view>
<view class="flex-row border-t">
<view class="flex-1 items-center justify-center">
<cl-text size="16px">0</cl-text>
<cl-text color="info" size="10px">余额</cl-text>
</view>
<view class="flex-1 items-center justify-center">
<cl-text size="16px">30</cl-text>
<cl-text color="info" size="10px">积分</cl-text>
</view>
<view class="flex-1 items-center justify-center">
<cl-text size="16px">0</cl-text>
<cl-text color="info" size="10px">推荐</cl-text>
</view>
</view>
</view>
<!-- 常用功能 -->
<view class="px-3 py-2 rounded-xl bg-white">
<view class="flex-row items-center pb-[10px] b-b">
<image src="/static/images/mine/utils.png" mode="widthFix" class="w-[18px] mr-1"></image>
<cl-text size="14px">常用工具</cl-text>
</view>
<cl-list>
<cl-list-item :image="item.image" :label="item.label" arrow justify="start" hoverable
v-for="item in minePageUtilsList" :key="item.url" @tap="nav(item.url)">
<view class="flex-1 flex-row justify-end items-start">
<cl-text color="info" size="10px" v-if="item.label == '邀请好友'">3679</cl-text>
</view>
</cl-list-item>
</cl-list>
</view>
<view class="p-4 bg-white mt-5 rounded-xl items-center" @tap="logout()" v-if="token">
<text>退出登录</text>
</view>
</view>
</view>
<TabBar current="mine"></TabBar>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
import TabBar from '@/components/TabBar.uvue'
import UserOrOrder from './components/MineTopUserOrOrder.uvue'
import { router } from '@/utils/router.uts'
import { useUi } from '@/uni_modules/cool-unix/hooks'
import type { ClConfirmAction } from '@/uni_modules/cool-unix/types'
import { minePageUtilsList } from '@/utils/pageStaticList'
const ui = useUi()
const showTopAvatar = ref(false)
const token = ref<string | null>(null)
const nav = (url : string) => {
if (url == '') return ui.showToast({ message: '开发中,敬请期待...' })
router.navigateTo(url, '')
}
// 退出登录
const logout = () => {
ui.showConfirm({
title: '提示',
message: '确定要退出当前账号吗?',
callback: (val : ClConfirmAction) => {
if (val == 'confirm') {
uni.removeStorageSync('token')
token.value = ''
}
}
})
}
// 页面显示生命周期
onPageShow(() => {
const t = uni.getStorageSync('token') as string
token.value = t
console.log(token.value);
})
// 页面滚动生命周期
onPageScroll((e : OnPageScrollOptions) => {
const top = e.scrollTop
if (top > 50) {
showTopAvatar.value = true
} else {
showTopAvatar.value = false
}
})
</script>
<style lang="scss">
.mine-page {
.mine-content {
padding: 10px 12px;
}
.border-t {
border-top: solid 1px #eee;
padding-top: 12px;
}
.b-b {
border-bottom: solid 1px #eee;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page :back-top="false">
<NavBar :is-show-back="false" title="动态">
<template #before>
<cl-icon name="bubble-chart-line" @tap="nav('/pages/subMoments/my-moments')"></cl-icon>
</template>
</NavBar>
<view class="moments-content">
<cl-list-item v-for="item in 3" :key="item" :pt="{
className: 'mb-3 !rounded-xl overflow-hidden'
}" @tap="nav('/pages/subMoments/moment-detail')">
<view class="w-full">
<view class="user-info">
<image src="https://unix.cool-js.com/images/demo/avatar.jpg" mode="aspectFill"
class="w-10 h-10 rounded-full"></image>
<text class="user-name">这是一个昵称</text>
</view>
<!-- 文字描述 -->
<view class="text-content" v-if="item != 1">
<cl-text class="t-text" :lines="5" ellipsis>
简单模型展示:优先用 vue-3d-model(零学习成本)。
中小型交互场景:选 troisjs(Vue3 原生,组件化友好)。
复杂 3D 场景(如动画、物理、VR):用 Three.js + vue-use-three 或 Babylon.js(灵活性高)。
简单模型展示:优先用 vue-3d-model(零学习成本)。
中小型交互场景:选 troisjs(Vue3 原生,组件化友好)。
复杂 3D 场景(如动画、物理、VR):用 Three.js + vue-use-three 或 Babylon.js(灵活性高)。
</cl-text>
</view>
<!-- 单视频 -->
<view class="single-video" v-if="item == 1">
<video
src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400.mp4"
poster="https://unix.cool-js.com/images/demo/avatar.jpg" class="img-video"></video>
</view>
<!-- 单图 -->
<view class="single-img" v-if="item == 2">
<image src="https://unix.cool-js.com/images/demo/avatar.jpg" mode="aspectFill" class="img-video"></image>
</view>
<!-- 多图 -->
<cl-row :gutter="0" :pt="{className: 'w-full'}" v-if="item == 3">
<cl-col :span="8" v-for="img in 7" :key="img">
<view class="img-box">
<image src="https://unix.cool-js.com/images/demo/avatar.jpg" mode="aspectFill" class="img-video"></image>
</view>
</cl-col>
</cl-row>
<view class="action">
<cl-text size="12px" color="#999">2025-11-07 15:15:15</cl-text>
<cl-icon :name="item == 2 ? 'heart-fill' : 'dianzan'" :color="item == 2 ? '#f40' : ''"></cl-icon>
</view>
</view>
</cl-list-item>
</view>
<TabBar current="moments"></TabBar>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
import TabBar from '@/components/TabBar.uvue'
import { useUi } from '@/uni_modules/cool-unix/hooks'
import { router } from '@/utils/router.uts'
const ui = useUi()
const tips = () => {
ui.showToast({
message: '新增动态功能,待发布!'
})
}
const nav = (url: string) =>{
router.navigateTo(url, '')
}
</script>
<style lang="scss">
.moments-content {
padding: 10px 12px;
.user-info {
flex-direction: row;
margin-bottom: 10px;
.user-name {
font-size: 14px;
padding-top: 20px;
margin-left: 12px;
}
}
.text-content {
margin-bottom: 6px;
.t-text {
font-size: 13px;
}
}
.single-video {
width: 100%;
padding-bottom: 57%;
position: relative;
}
.single-img {
width: 60%;
padding-bottom: 100%;
position: relative;
}
.img-box {
width: 100%;
padding-bottom: 100%;
position: relative;
}
.img-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.action {
margin-top: 10px;
flex-direction: row;
justify-content: space-between;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar :title="title"></NavBar>
</cl-page>
<web-view class="wv" src="https://dcloud.io/license/DCloud.html" :bounces="false"></web-view>
</template>
<script setup>
import NavBar from '@/components/NavBar.uvue'
const title = ref('')
type OnLoadOptionsType = {
type?: string
}
onLoad((e : OnLoadOptionsType) => {
const { type } = e
if (type === 'policy') {
title.value = '隐私政策'
} else {
title.value = '用户协议'
}
})
</script>
<style lang="scss">
.wv {
width: 100%;
height: 100%;
padding-bottom: var(--uni-safe-area-inset-bottom);
/* #ifdef MP-WEIXIN */
padding-bottom: constant(safe-area-inset-bottom);
/* #endif */
padding-bottom: env(safe-area-inset-bottom);
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page :back-top="false">
<view class="login-page">
<image src="/static/login-bg.png" mode="aspectFill" class="login-bg"></image>
<view class="login-content" :style="{paddingTop: statusBarHeight + 'px'}">
<view class="back" @tap="nav('back')">
<cl-icon name="back" size="25px"></cl-icon>
</view>
<view class="logo-box">
<image src="/static/logo.png" class="logo"></image>
<text class="logo-text">LOGO_NAME</text>
</view>
<cl-form ref="formRef" v-model="formData" :rules="rules" :show-asterisk="false">
<cl-form-item label="邮箱" prop="email" required>
<cl-input v-model="formData.email" placeholder="请输入邮箱" clearable :border="false" :pt="{
className: '!h-12'
}"></cl-input>
</cl-form-item>
<cl-form-item label="密码" prop="password" required>
<cl-input v-model="formData.password" placeholder="请输入密码" clearable :border="false" :pt="{
className: '!h-12'
}"></cl-input>
</cl-form-item>
</cl-form>
<view class="action">
<cl-text>记住账号</cl-text>
<cl-text color="info" :pt="{
className: '!ml-auto'
}">忘记密码?</cl-text>
</view>
<cl-button type="primary" :pt="{
className: '!h-11'
}" @tap="submit">登录</cl-button>
<view class="register">
<cl-text color="info">还没有账号?</cl-text>
<cl-text color="primary" @tap="nav('/pages/login/register')">去注册</cl-text>
</view>
</view>
<view class="agreement">
<view class="agreement-content">
<cl-text color="info">我已阅读并同意</cl-text>
<cl-text color="#165DFF" @tap="nav('/pages/login/agreement')">《用户协议》</cl-text>
<cl-text color="info">及</cl-text>
<cl-text color="#165DFF" @tap="nav('/pages/login/agreement')">《隐私政策》</cl-text>
</view>
</view>
</view>
</cl-page>
</template>
<script setup lang="uts">
import { ref, type Ref } from 'vue'
import NavBar from '../../components/NavBar.uvue'
import { useUi, useForm } from '@/uni_modules/cool-unix/hooks'
import type { ClFormRule, ClFormValidateError } from '@/uni_modules/cool-unix/types'
import { router } from '@/utils/router'
const ui = useUi()
const { statusBarHeight } = uni.getSystemInfoSync()
type FormData = {
email : string;
password : string;
};
const { formRef, validate, clearValidate, validateField } = useForm()
const formData = ref<FormData>({
email: '',
password: ''
}) as Ref<FormData>
const rules = new Map<string, ClFormRule[]>([
[
"email",
[
{ required: true, message: "邮箱不能为空" },
{ min: 3, max: 20, message: "邮箱长度在3-20个字符之间" },
],
],
[
"password",
[
{ required: true, message: "密码不能为空" },
{ min: 3, max: 20, message: "密码长度在3-20个字符之间" },
],
]
]);
const nav = (url : string) => {
if (url == 'back') {
router.navigateBack()
} else {
router.navigateTo(url, '')
}
}
// 登录
const submit = () => {
validate((valid : Boolean, error : ClFormValidateError[]) => {
if (valid) {
console.log(valid);
ui.showToast({
message: '登陆成功'
})
// 设置 token
uni.setStorageSync('token', 'qwerasdfzxcv1234')
nav('back')
} else {
console.log(error);
}
})
}
</script>
<style lang="scss">
.login-page {
.login-bg,
.login-content {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.login-content {
z-index: 99;
padding: 10px 32px;
padding-bottom: env(safe-area-inset-bottom);
.back {
width: 50px;
height: 50px;
background-color: #fff;
border-radius: 25px;
align-items: center;
justify-content: center;
margin: 20px 0 40px -20px;
}
.logo-box {
align-items: center;
justify-content: center;
.logo {
width: 70px;
height: 70px;
}
.logo-text {
font-size: 20px;
font-weight: bold;
margin: 10px 0 40px 0;
}
}
.cl-form-item__content {
border-bottom: 1px solid #eee !important;
}
.action,
.register {
flex-direction: row;
padding-bottom: 20px;
}
.register {
margin-top: 12px;
}
}
.agreement {
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
width: 100%;
background-color: #fff;
padding: 6px 12px;
padding-bottom: env(safe-area-inset-bottom);
.agreement-content {
flex-direction: row;
padding-bottom: 6px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page :back-top="false">
<view class="login-page">
<image src="/static/login-bg.png" mode="aspectFill" class="login-bg"></image>
<view class="login-content" :style="{paddingTop: statusBarHeight + 'px'}">
<view class="back" @tap="nav('back')">
<cl-icon name="back" size="25px"></cl-icon>
</view>
<view class="logo-box">
<image src="/static/logo.png" class="logo"></image>
<text class="logo-text">LOGO_NAME</text>
</view>
<cl-form ref="formRef" v-model="formData" :rules="rules">
<cl-form-item label="邮箱" prop="email">
<cl-input v-model="formData.email" placeholder="请输入邮箱" clearable :border="false" :pt="{
className: '!h-12'
}"></cl-input>
</cl-form-item>
<cl-form-item label="密码" prop="password">
<cl-input v-model="formData.password" placeholder="请输入密码" clearable :border="false" :pt="{
className: '!h-12'
}">
<template #append>
<SendCode :email="formData.email"></SendCode>
</template>
</cl-input>
</cl-form-item>
</cl-form>
<cl-button type="primary" :pt="{
className: '!h-11'
}" @tap="submit">注册</cl-button>
<view class="register">
<cl-text color="info">已有账号?</cl-text>
<cl-text color="primary" @tap="nav('back')">去登录</cl-text>
</view>
</view>
<view class="agreement">
<view class="agreement-content">
<cl-text color="info">我已阅读并同意</cl-text>
<cl-text color="#165DFF">《用户协议》</cl-text>
<cl-text color="info">及</cl-text>
<cl-text color="#165DFF">《隐私政策》</cl-text>
</view>
</view>
</view>
</cl-page>
</template>
<script setup lang="uts">
import { ref, type Ref } from 'vue'
import NavBar from '@/components/NavBar.uvue'
import SendCode from '@/components/SendCode.uvue'
import { useUi } from '@/uni_modules/cool-unix/hooks'
import { type ClFormRule, useForm, type ClFormValidateError } from '@/uni_modules/cool-unix'
import { router } from '@/utils/router'
const ui = useUi()
const { statusBarHeight } = uni.getSystemInfoSync()
const { formRef, validate, clearValidate } = useForm()
type FormData = {
email : string;
password : string;
};
const formData = ref<FormData>({
email: '',
password: ''
}) as Ref<FormData>
const rules = new Map<string, ClFormRule[]>([
[
"email",
[
{ required: true, message: "邮箱不能为空" },
{ min: 3, max: 20, message: "邮箱长度在3-20个字符之间" },
],
],
[
"password",
[
{ required: true, message: "密码不能为空" },
{ min: 3, max: 20, message: "密码长度在3-20个字符之间" },
],
]
]);
const tips = () => {
ui.showToast({
message: 'tips'
})
}
const submit = () => {
console.log(formRef, 'formRef');
validate((valid : Boolean, error : ClFormValidateError[]) => {
if (valid) {
console.log(valid);
} else {
console.log(error);
}
})
}
const nav = (url : string) => {
if (url == 'back') {
router.navigateBack()
} else {
router.navigateTo(url, '')
}
}
</script>
<style lang="scss">
.login-page {
.login-bg,
.login-content {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.login-content {
z-index: 99;
padding: 10px 32px;
padding-bottom: env(safe-area-inset-bottom);
.back {
width: 50px;
height: 50px;
background-color: #fff;
border-radius: 25px;
align-items: center;
justify-content: center;
margin: 20px 0 40px -20px;
}
.logo-box {
align-items: center;
justify-content: center;
.logo {
width: 70px;
height: 70px;
}
.logo-text {
font-size: 20px;
font-weight: bold;
margin: 10px 0 40px 0;
}
}
.cl-form-item__content {
border-bottom: 1px solid #eee !important;
}
.register {
flex-direction: row;
margin-top: 20px;
}
}
.agreement {
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
width: 100%;
background-color: #fff;
padding: 6px 12px;
padding-bottom: env(safe-area-inset-bottom);
.agreement-content {
flex-direction: row;
padding-bottom: 6px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar title="订单详情"></NavBar>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
</script>
<style>
</style>
<template>
<cl-page>
<NavBar title="订单列表"></NavBar>
<view class="">
<Empty type="order" :is-tips="false">
<view class="w-full items-center">
<cl-button type="primary" @tap="nav('/pages/index/index')">去逛逛</cl-button>
</view>
</Empty>
</view>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
import Empty from '@/components/EmptyOrStatus.uvue'
import { router } from '@/utils/router.uts'
const nav = (url : string) => {
router.switchTab(url, '')
}
</script>
<style>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar title="支付成功"></NavBar>
<view class="">
<StatusComp type="pay-success" tips="您已支付成功~">
<view class="w-full flex-row justify-center items-center pt-3">
<cl-button type="light" @tap="back">返回</cl-button>
<cl-button type="error" @tap="nav('/pages/order/order-detail')">查看订单</cl-button>
</view>
</StatusComp>
</view>
</cl-page>
</template>
<script setup lang="uts">
import { router } from '@/utils/router.uts'
import NavBar from '@/components/NavBar.uvue'
import StatusComp from '@/components/EmptyOrStatus.uvue'
const back = () => {
router.navigateBack(2)
}
const nav = (url : string) => {
router.navigateTo(url, '')
}
</script>
<style>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar title="订单确认"></NavBar>
<view class="pb-[60px]">
</view>
<FooterBar :placeholder="false">
<view class="h-[50px] bg-white px-3 flex-row items-center justify-between">
<view class="flex-row items-center">
<text class="text-sm text-[#999]">合计:</text>
<cl-text :value="12" type="amount" color="#f40" size="16px" :pt="{className: '!font-bold'}"></cl-text>
</view>
<cl-button type="error" @tap="submit">立即支付</cl-button>
</view>
</FooterBar>
<PaymentPopup :ref="refs.set('paymentRef')" @pay="paySuccess"></PaymentPopup>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
import FooterBar from '@/components/FooterFloatBar.uvue'
import PaymentPopup from '@/components/PaymentPopup.uvue'
import { router } from '@/utils/router.uts'
import { useRefs } from '@/uni_modules/cool-unix/cool'
const refs = useRefs()
const submit = () => {
refs.callMethod('paymentRef', 'open')
}
const paySuccess = () => {
router.redirectTo('/pages/order/payment-status', '')
}
</script>
<style lang="scss">
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-popup v-model="visible" :title="title">
<scroll-view class="p-4 h-[400px]">
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
<cl-text>
春江花月夜,花草复青青。
江水流不尽,月光照无情。
夜来风雨急,愁思满心头。
何时再相见,共赏月明楼。
</cl-text>
</scroll-view>
</cl-popup>
</template>
<script lang="uts" setup>
const props = defineProps([ "title" ]);
const visible = ref(false);
const open = () => {
visible.value = true;
};
const close = () => {
visible.value = false;
};
defineExpose({
open,
close
});
</script>
<template>
<cl-page :back-top="false">
<NavBar title="领券中心"></NavBar>
<view class="coupon-list">
<view class="coupon w-full flex-row p-[10px] bg-white rounded-lg">
<view class="coupon-left">
<view class="price-box items-center justify-center">
<view class="flex-row items-end">
<cl-text currency=""
:precision="2"
:pt="{className: '!font-bold !text-[16px] !leading-[16px] !text-[#f40]'}"
type="amount"
:value="120">
</cl-text>
<cl-text :pt="{className: '!font-bold !text-[#f40] !leading-[8px] !text-[8px]'}">
元
</cl-text>
</view>
<cl-text :pt="{className: '!text-[#999] !text-[10px]'}">
满1000元可用
</cl-text>
</view>
</view>
<view class="coupon-right">
<view class="coupon-info flex-row items-center p-2">
<view class="flex-1 h-full mr-3 justify-between">
<cl-text ellipsis :pt="{className: '!font-bold !text-[16px]'}">
云想衣裳花想容
</cl-text>
<cl-text ellipsis
:lines="2"
:pt="{className: '!text-[#999] !text-[10px] !leading-[12px]'}">
云想衣裳花想容,春风拂槛露华浓。若非群玉山头见,会向瑶台月下逢。天阶夜色凉如水,卧看牵牛织女星。人生若只如初见,何事秋风悲画扇。山有木兮木有枝,心悦君兮君不知。
</cl-text>
<view class="flex-row items-center justify-between">
<cl-text :pt="{className: '!text-[#f40] !text-[10px]'}">
过期时间:2025-12-31
</cl-text>
<view class="flex-row items-center">
<cl-text :pt="{className: '!text-[#999] !text-[10px] !leading-[10px]'}" @tap="previewRules">
规则
</cl-text>
<cl-icon color="#999"
name="arrow-right-s-line"
size="10px">
</cl-icon>
</view>
</view>
</view>
<view class="get-coupon items-center justify-center">
<text class="text-white font-bold text-[16px]">领取</text>
</view>
</view>
</view>
</view>
</view>
<CouponRules :ref="refs.set('couponRullesRef')" title="云想衣裳花想容"></CouponRules>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from "@/components/NavBar.uvue";
import { useRefs } from "@/uni_modules/cool-unix/cool";
import CouponRules from "./components/CouponRules.uvue";
const refs = useRefs();
const previewRules = () => {
refs.callMethod("couponRullesRef", "open");
};
</script>
<style lang="scss">
.coupon-list {
padding: 10px 12px;
.coupon-left,
.coupon-right {
width: 25%;
position: relative;
border-radius: 8px;
padding-bottom: 25%;
background-color: #fcefee;
.price-box,
.coupon-info {
position: absolute;
width: 100%;
height: 100%;
.get-coupon {
width: 50px;
height: 50px;
border-radius: 25px;
background-color: #f40;
}
}
}
.coupon-right {
flex: 1;
border-left: 1px dashed #fff;
}
}
</style>
<template>
<cl-page :back-top="false">
<!-- 顶部按钮 + 搜索框 -->
<view class="btn-search fixed top-0 left-0 w-full z-[999]"
:class="{'bg-white': scrollTop > 200, 'border-b': scrollTop > 200}"
:style="{paddingTop: pt}">
<view class="w-full flex-row items-center search-box">
<view class="w-[30px] h-[30px] items-center justify-center back-btn rounded-full mr-3" @tap="back">
<cl-icon color="#999"
name="arrow-left-s-line"
size="25px">
</cl-icon>
</view>
<view v-show="scrollTop > 200"
class="search flex-1 h-[30px] flex-row rounded-[30px]"
:style="{marginRight: `${wxMenuWidth }px`}"
@tap="nav('/pages/subHome/search')">
<cl-icon color="#999" name="sousuo_2"></cl-icon>
<text class="text-md text-[#999] ml-2">点击搜索更多商品~</text>
</view>
</view>
</view>
<!-- 轮播图 -->
<view class="banner-box">
<ImageVideoSwiper :list="list"
:poster="poster"
:video="video">
</ImageVideoSwiper>
</view>
<!-- 商品详情 ↓ -->
<view class="goods-detail">
<view class="bg-white p-3 mb-3">
<!-- 价格-收藏 -->
<view class="flex-row justify-between items-center">
<!-- 价格 -->
<view class="flex-row items-end">
<text class="text-[14px] leading-[14px] text-[#f40]">¥</text>
<cl-text color="#f40"
currency=""
:precision="2"
:pt="{className: '!font-bold !text-[20px] !leading-[20px]'}"
type="amount"
:value="2">
</cl-text>
</view>
<!-- 收藏 -->
<view class="flex-row items-center">
<cl-icon color="#999"
name="heart-fill"
size="20px">
</cl-icon>
<text class="ml-1 text-md text-[#333]">收藏</text>
</view>
</view>
<!-- 商品名称 -->
<view class="py-2">
<cl-text ellipsis
:lines="2"
:pt="{className: '!font-bold !leading-loose'}"
size="20px"
value="一杯很好喝的咖啡">
</cl-text>
<!-- <cl-text :lines="4" ellipsis size="13px" color="#999" :pt="{className: '!leading-loose'}" value="星巴克咖啡公司成立于1971年,是全球较大的咖啡连锁店,其总部坐落美国华盛顿州西雅图市。星巴克旗下零售产品包括30多款咖啡豆、手工制作的浓缩咖啡和多款咖啡冷热饮料、新鲜美味的各式糕点食品以及丰富多样的咖啡机咖啡杯等商品。星巴克在全球范围内已经有近21300间分店遍布北美、南美洲、欧洲、中东及太平洋区v"></cl-text> -->
</view>
<!-- 销量-库存 -->
<view class="flex-row">
<view class="flex-1 flex-row">
<cl-text color="#999">
销量:
</cl-text>
<cl-text>99+</cl-text>
</view>
<view class="flex-1 flex-row">
<cl-text color="#999">
库存:
</cl-text>
<cl-text>3679</cl-text>
</view>
</view>
</view>
<cl-sticky :offset-top="tabsStickyTop">
<cl-tabs v-model="tabSelected"
fill
:list="tabList"
:pt="{className: '!bg-white'}"
@change="tabChange">
</cl-tabs>
</cl-sticky>
<!-- 评价 -->
<view id="review" class="review w-full h-[500px] bg-green-500">
review
</view>
<!-- 详情 -->
<view id="details" class="details w-full h-[600px] bg-red-500">
details
</view>
<!-- 推荐 -->
<view id="recommended" class="recommended w-full h-[500px] bg-yellow-500">
recommended
</view>
<!-- 加载更多 -->
<view class="loadmore-box justify-center">
<view class="pb-[60px]">
<cl-loadmore loading></cl-loadmore>
</view>
</view>
</view>
<!-- 底部操作栏 -->
<FooterBar :placeholder="false">
<view class="bg-white h-[50px] px-3 flex-row justify-between items-center">
<view class="flex-row mr-5">
<view class="items-center">
<image class="w-[20px] h-[20px]" src="/static/images/tabbar/mine.png"></image>
<text class="text-[12px] text-[#333]">客服</text>
</view>
<view class="items-center ml-3">
<image class="w-[20px] h-[20px]" src="/static/images/tabbar/cart.png"></image>
<text class="text-[12px] text-[#333]">购物车</text>
</view>
</view>
<view class="flex-row flex-1">
<cl-button :pt="{className: '!flex-1'}"
size="large"
type="warn"
@tap="addCart">
加入购物车
</cl-button>
<cl-button :pt="{className: '!flex-1'}"
size="large"
type="error"
@tap="nav('/pages/order/submit-order-page')">
立即购买
</cl-button>
</view>
</view>
</FooterBar>
</cl-page>
</template>
<script setup>
import type { ClTabsItem } from "@/uni_modules/cool-unix/types";
import FooterBar from "@/components/FooterFloatBar.uvue";
import ImageVideoSwiper from "@/components/ImageVideoSwiper.uvue";
import { elOffsetTopDistance, isLogin } from "@/utils/index.uts";
import { router } from "@/utils/router.uts";
const video = "http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400.mp4";
const poster = "https://unix.cool-js.com/images/demo/avatar.jpg";
const list = ref<string[]>([
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg1.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg2.png",
"https://uni-docs.cool-js.com/demo/pages/demo/static/bg3.png",
]);
const pt = computed(() => `${uni.getSystemInfoSync().statusBarHeight }px`);
const tabsStickyTop = computed(() => {
const { statusBarHeight } = uni.getSystemInfoSync();
// 为了兼容微信小程序搜索框和胶囊处以同一高度
// #ifndef MP-WEIXIN
return statusBarHeight + 48;
// #endif
// #ifdef MP-WEIXIN
return statusBarHeight + 40;
// #endif
});
const wxMenuWidth = computed(() => {
let mw = 0;
// #ifdef MP-WEIXIN
const { width } = uni.getMenuButtonBoundingClientRect();
mw = width;
// #endif
return mw;
});
const tabSelected = ref(0);
// 距离顶部的位置 arr
const distance = ref<number[]>([]);
const tabList = ref<ClTabsItem[]>([
{
label: "评价",
value: 0
},
{
label: "详情",
value: 1
},
{
label: "推荐",
value: 2
}
]);
const scrollTop = ref<number>(0);
// 评价-详情-推荐 => 切换事件
const tabChange = (e : number) => {
uni.pageScrollTo({
duration: 200,
scrollTop: distance.value[e] + 1 // +1 是为了防止滚动到详情位置时tab还选中于评价项
});
};
const back = () => {
router.navigateBack();
};
const nav = (url : string) => {
router.navigateTo(url, "");
};
// 加入购物车
const addCart = () => {
isLogin().then(() => {
console.log("加入购物车");
});
};
// 页面滚动事件
onPageScroll((e : OnPageScrollOptions) => {
scrollTop.value = e.scrollTop;
if (distance.value[1] <= scrollTop.value && scrollTop.value < distance.value[2]) {
tabSelected.value = 1;
} else if (scrollTop.value >= distance.value[2]) {
tabSelected.value = 2;
} else {
tabSelected.value = 0;
}
});
const getGoodsDetail = () => {
setTimeout(() => {
Promise.all([ elOffsetTopDistance("review"), elOffsetTopDistance("details"), elOffsetTopDistance("recommended") ]).then((res : number[]) => {
distance.value = res;
});
}, 500);
};
onMounted(() => {
getGoodsDetail();
});
</script>
<style lang="scss">
.btn-search {
padding: 10px 12px;
.search-box {
/* #ifndef MP-WEIXIN */
padding-top: 8px;
/* #endif */
}
.back-btn {
background-color: rgba(255, 255, 255, .5);
}
.search {
border: 1px solid #f8f9fa;
padding: 0 12px;
align-items: center;
// justify-content: center;
}
}
.border-b {
border-bottom: 1px solid #f8f8f8;
}
.banner-box {
width: 100%;
padding-bottom: 110%;
}
.loadmore-box {
padding: 12px 0 var(--uni-safe-area-inset-bottom) 0;
}
</style>
<template>
<cl-page>
<cl-topbar fixed safe-area-top background-color="#FFF" back-icon="arrow-left-s-line">
<view class="w-full pl-[42px]" :style="{paddingRight: pr}">
<cl-input :pt="{className: '!w-full !rounded-[20px]'}" placeholder="发现更多~">
<template #append>
<cl-button type="primary" size="small" icon="search-line"></cl-button>
</template>
</cl-input>
</view>
</cl-topbar>
</cl-page>
</template>
<script setup lang="uts">
const pr = computed(() => {
let w = 0
// #ifdef MP-WEIXIN
const { width } = uni.getMenuButtonBoundingClientRect()
w = width + 5
// #endif
return (w + 12) + 'px'
})
</script>
<style lang="scss">
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar title="关于我们"></NavBar>
<view class="p-3">
<view class="logo-version">
<image class="logo" src="/static/logo.png"></image>
<view class="flex-row mt-2">
<cl-text value="当前版本"></cl-text>
<cl-text :value="appVersion"></cl-text>
</view>
</view>
<view class="about-desc">
<cl-text value="关于我们的详细介绍"></cl-text>
</view>
</view>
</cl-page>
</template>
<script lang="uts" setup>
import NavBar from "@/components/NavBar.uvue";
const { appVersion } = uni.getSystemInfoSync();
</script>
<style lang="scss">
.logo-version {
padding: 30px 12px;
align-items: center;
justify-content: center;
border-radius: 8px;
background-color: rgba(255, 255, 255, .5);
.logo {
width: 80px;
height: 80px;
border-radius: 8px;
box-shadow: 1px gray;
}
}
.about-desc {
margin-top: 12px;
padding: 10px 12px;
border-radius: 8px;
background-color: rgba(255, 255, 255, .5);
}
</style>
<template>
<cl-page :back-top="false">
<NavBar title="账号与安全"></NavBar>
</cl-page>
</template>
<script setup>
import NavBar from '@/components/NavBar.uvue'
</script>
<style lang="scss">
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar title="联系我们"></NavBar>
<view class="contact-content p-3">
<view class="logo-version">
<image class="logo" src="/static/logo.png"></image>
<view class="flex-row mt-2">
<cl-text value="当前版本"></cl-text>
<cl-text :value="appVersion"></cl-text>
</view>
</view>
</view>
</cl-page>
</template>
<script lang="uts" setup>
import NavBar from "@/components/NavBar.uvue";
const { appVersion } = uni.getSystemInfoSync();
</script>
<style lang="scss">
.logo-version {
align-items: center;
justify-content: center;
padding: 30px 12px;
background-color: rgb(255 255 255 / 50%);
border-radius: 8px;
.logo {
width: 80px;
height: 80px;
border-radius: 8px;
box-shadow: 1px gray;
}
}
</style>
<template>
<cl-page>
<NavBar title="设置"></NavBar>
<view class="setting">
<view class="px-3 py-2 rounded-xl bg-white">
<cl-list>
<cl-list-item v-for="item in settingsPageUtilsList"
:key="item.url"
:arrow="item.type === 'link'"
hoverable
justify="start"
:label="item.label"
@tap="nav(item)">
<view class="flex-1 flex-row justify-end">
<cl-text v-if="item.type === 'num'"
color="info"
size="12px">
v{{ version }}
</cl-text>
</view>
</cl-list-item>
</cl-list>
</view>
<view class="p-4 bg-white mt-5 rounded-xl items-center" @tap="logout">
<text class="text-md text-[#3f3f46]">注销账号</text>
</view>
</view>
</cl-page>
</template>
<script setup>
import type { ClConfirmAction } from "@/uni_modules/cool-unix/types";
import NavBar from "@/components/NavBar.uvue";
import { useUi } from "@/uni_modules/cool-unix/hooks";
import { settingsPageUtilsList } from "@/utils/pageStaticList";
import { router } from "@/utils/router.uts";
const ui = useUi();
// 当前版本
const version = computed(() => uni.getSystemInfoSync().appVersion);
const nav = (item : { type : string, url : string }) => {
if (item.type != "link") return;
if (item.url == "") return ui.showToast({ message: "开发中,敬请期待..." });
router.navigateTo(item.url, "");
};
const logout = () => {
ui.showConfirm({
title: "确认注销账号?",
message: "注销后,个人资料、历史记录、权益等相关信息将永久删除,无法恢复!此操作不可逆,请谨慎操作~",
confirmText: "确认(不可逆)",
callback: (val : ClConfirmAction) => {
if (val == "confirm") {
uni.removeStorageSync("token");
}
}
});
};
</script>
<style lang="scss">
.setting {
padding: 10px 12px;
}
</style>
<template>
<cl-page :back-top="false">
<NavBar title="个人中心"></NavBar>
</cl-page>
</template>
<script setup>
import NavBar from "@/components/NavBar.uvue";
</script>
<style lang="scss">
</style>
<template>
<cl-page :back-top="false">
<NavBar title="动态详情"></NavBar>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
</script>
<style>
</style>
<template>
<cl-page :back-top="false">
<NavBar title="我的动态">
<template #after>
<cl-text color="#666" size="12px" @tap="relaseMoments">去发布</cl-text>
</template>
</NavBar>
<view class="w-full">
<view class="banner-box">
<image src="https://uni-docs.cool-js.com/demo/pages/demo/static/bg2.png" mode="aspectFill"
class="w-full h-full absolute top-0 left-0"></image>
</view>
</view>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
import { router } from '@/utils/router.uts'
const relaseMoments = () => {
router.navigateTo('/pages/subMoments/release-moment', '')
}
</script>
<style lang="scss">
.banner-box {
width: 100%;
padding: 0 0 65% 0;
position: relative;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<cl-page>
<NavBar title="发布动态"></NavBar>
</cl-page>
</template>
<script setup lang="uts">
import NavBar from '@/components/NavBar.uvue'
</script>
<style>
</style>
\ No newline at end of file \ No newline at end of file
// 参考链接 https://doc.dcloud.net.cn/uni-app-x/tutorial/ls-plugin.html#setting
{
"targets": [
"APP-ANDROID"
]
}
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
dj-car-life-system @ e37adb1c
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!