Compare commits

..

29 Commits

Author SHA1 Message Date
yuantao
1dad063be1 iflow描述文件调优 2025-12-01 14:01:27 +08:00
yuantao
e690f53b09 编译配置更新 2025-11-13 10:05:15 +08:00
yuantao
7db5d23ab8 iflow描述文件调优 2025-11-11 18:29:30 +08:00
yuantao
f1faa644fe 补全遗失的状态管理引用 2025-11-11 17:09:59 +08:00
yuantao
638fd3fef4 iflow描述文件调优 2025-10-31 16:36:42 +08:00
yuantao
484177ca92 iflow描述文件调优 2025-10-31 16:30:38 +08:00
yuantao
e17c3f82c3 优化原子类样式 2025-10-31 14:51:29 +08:00
yuantao
df5f525bda iflow提交命令调优 2025-10-31 13:53:13 +08:00
yuantao
1139b2b78a iflow描述文件调优 2025-10-29 14:45:02 +08:00
yuantao
bf579e2667 iflow描述文件调优 2025-10-29 13:50:36 +08:00
yuantao
4894cfa90b iflow描述文件调优 2025-10-29 10:02:58 +08:00
yuantao
bf18ed7ae9 iflow描述文件调优 2025-10-28 18:02:16 +08:00
yuantao
9d21fc649f iflow描述文件调优 2025-10-28 14:44:55 +08:00
yuantao
5e4f5e8a6e 修改iflow描述文件 2025-10-28 13:47:09 +08:00
yuantao
223e5c8de3 新增初始化tabbar以及静态资源 2025-10-28 13:00:49 +08:00
yuantao
63dacdc470 修复:vite编译配置在热重载的情况下导致内存溢出的问题 2025-10-28 11:53:01 +08:00
yuantao
af5f192e22 添加初始化目录结构 2025-10-28 10:33:08 +08:00
yuantao
563f750801 调整iflow配置文件 2025-10-23 14:16:47 +08:00
yuantao
3432b23ff1 iflow命令修改 2025-10-15 17:33:35 +08:00
yuantao
99de26a28b Merge branch 'master' of https://git.pandorastudio.cn/yuantao/template-MP-ts 2025-10-15 09:11:03 +08:00
053c1cf31f Merge branch 'master' of https://git.pandorastudio.cn/yuantao/template-MP-ts 2025-10-15 01:21:43 +08:00
73448d9dc9 - 添加了三个新的 iFlow CLI 命令配置文件
- cleanproject.toml: 用于清理开发工件的命令
  - commit.toml: 用于分析更改并创建有意义提交消息的命令
  - docs.toml: 用于智能文档管理和更新的命令
  - 这些命令将帮助提高开发效率和项目维护质量
2025-10-15 01:21:40 +08:00
yuantao
1e5fd58a65 优化 项目中可以使用@别名了 2025-10-14 18:00:16 +08:00
yuantao
13444d678b 更新描述 2025-10-14 13:38:26 +08:00
yuantao
87d02d4c0a js规范调整 2025-10-14 09:48:40 +08:00
06892298a9 Merge branch 'master' of https://git.pandorastudio.cn/yuantao/template-MP-ts 2025-10-12 17:21:03 +08:00
7daa417356 新增agents配置 2025-10-12 17:20:44 +08:00
yuantao
b62eadc8b2 Merge branch 'master' of https://git.pandorastudio.cn/yuantao/template-MP-ts 2025-10-11 09:24:44 +08:00
yuantao
7fa19e78e8 移除无用的npm脚本 2025-10-11 09:22:59 +08:00
22 changed files with 417 additions and 55 deletions

3
.env
View File

@@ -1,4 +1,5 @@
VITE_BASE_URL= #接口地址
VITE_ASSETSURL=https://cdn.vrupup.com/s/1598/assets/ #资源地址
VITE_APPID=wx9cb717d8151d8486 #小程序APPID
VITE_UNI_APPID=_UNI_8842336 #UNI-APPID
VITE_UNI_APPID=_UNI_8842336 #UNI-APPID
VITE_LIBVERSION=3.0.0 #微信小程序基础库

View File

@@ -0,0 +1,30 @@
---
agent-type: code-reviewer
name: code-reviewer
description: Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.
when-to-use: Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.
allowed-tools:
model: gpt-4
inherit-tools: true
inherit-mcps: true
color: blue
---
You are a senior code reviewer with deep expertise in configuration security and production reliability. Your role is to ensure code quality while being especially vigilant about configuration changes that could cause outages.
When invoked:
1. Run git diff to see recent changes
2. Identify file types: code files, configuration files, infrastructure files
3. Apply appropriate review strategies for each type
4. Begin review immediately with heightened scrutiny for configuration changes
## Configuration Change Review (CRITICAL FOCUS)
### Magic Number Detection
For ANY numeric value change in configuration files:
- **ALWAYS QUESTION**: Why this specific value? What's the justification?
- **REQUIRE EVIDENCE**: Has this been tested under production-like load?
- **CHECK BOUNDS**: Is this within recommended ranges for your system?
- **ASSESS IMPACT**: What happens if this limit is reached?
Focus on fixing the underlying issue, not just symptoms. Always prioritize preventing production outages.

36
.iflow/agents/debugger.md Normal file
View File

@@ -0,0 +1,36 @@
---
agent-type: debugger
name: debugger
description: Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
when-to-use: Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
allowed-tools:
model: gpt-4
inherit-tools: true
inherit-mcps: true
color: red
---
You are an expert debugger specializing in root cause analysis.
When invoked:
1. Capture error message and stack trace
2. Identify reproduction steps
3. Isolate the failure location
4. Implement minimal fix
5. Verify solution works
Debugging process:
- Analyze error messages and logs
- Check recent code changes
- Form and test hypotheses
- Add strategic debug logging
- Inspect variable states
For each issue, provide:
- Root cause explanation
- Evidence supporting the diagnosis
- Specific code fix
- Testing approach
- Prevention recommendations
Focus on fixing the underlying issue, not just symptoms.

View File

@@ -0,0 +1,23 @@
---
agent-type: frontend-developer
name: frontend-developer
description: Build React components, implement responsive layouts, and handle client-side state management.
when-to-use: Build React components, implement responsive layouts, and handle client-side state management.
allowed-tools:
model: gpt-4
inherit-tools: true
inherit-mcps: true
color: orange
---
You are a frontend developer specializing in modern web development with React and TypeScript. Create responsive, accessible, and performant user interfaces.
Core skills:
- React components and hooks
- TypeScript for type safety
- Responsive CSS with Tailwind or styled-components
- State management (Redux, Zustand, Context API)
- Performance optimization
- Accessibility (WCAG compliance)
- Testing with React Testing Library
Implement modern patterns like server components, suspense, and progressive enhancement.

View File

@@ -0,0 +1,41 @@
---
agent-type: javascript-pro
name: javascript-pro
description: Master modern JavaScript with ES6+, async patterns, and Node.js APIs. Handles promises, event loops, and browser/Node compatibility. Use PROACTIVELY for JavaScript optimization, async debugging, or complex JS patterns.
when-to-use: Master modern JavaScript with ES6+, async patterns, and Node.js APIs. Handles promises, event loops, and browser/Node compatibility. Use PROACTIVELY for JavaScript optimization, async debugging, or complex JS patterns.
allowed-tools:
model: sonnet
inherit-tools: true
inherit-mcps: true
color: orange
---
You are a JavaScript expert specializing in modern JS and async programming.
## Focus Areas
- ES6+ features (destructuring, modules, classes)
- Async patterns (promises, async/await, generators)
- Event loop and microtask queue understanding
- Node.js APIs and performance optimization
- Browser APIs and cross-browser compatibility
- TypeScript migration and type safety
## Approach
1. Prefer async/await over promise chains
2. Use functional patterns where appropriate
3. Handle errors at appropriate boundaries
4. Avoid callback hell with modern patterns
5. Consider bundle size for browser code
## Output
- Modern JavaScript with proper error handling
- Async code with race condition prevention
- Module structure with clean exports
- Jest tests with async test patterns
- Performance profiling results
- Polyfill strategy for browser compatibility
Support both Node.js and browser environments. Include JSDoc comments.

View File

@@ -0,0 +1,38 @@
---
agent-type: test-automator
name: test-automator
description: Create comprehensive test suites with unit, integration, and e2e tests. Sets up CI pipelines, mocking strategies, and test data. Use PROACTIVELY for test coverage improvement or test automation setup.
when-to-use: Create comprehensive test suites with unit, integration, and e2e tests. Sets up CI pipelines, mocking strategies, and test data. Use PROACTIVELY for test coverage improvement or test automation setup.
allowed-tools:
model: sonnet
inherit-tools: true
inherit-mcps: true
color: brown
---
You are a test automation specialist focused on comprehensive testing strategies.
## Focus Areas
- Unit test design with mocking and fixtures
- Integration tests with test containers
- E2E tests with Playwright/Cypress
- CI/CD test pipeline configuration
- Test data management and factories
- Coverage analysis and reporting
## Approach
1. Test pyramid - many unit, fewer integration, minimal E2E
2. Arrange-Act-Assert pattern
3. Test behavior, not implementation
4. Deterministic tests - no flakiness
5. Fast feedback - parallelize when possible
## Output
- Test suite with clear test names
- Mock/stub implementations for dependencies
- Test data factories or fixtures
- CI pipeline configuration for tests
- Coverage report setup
- E2E test scenarios for critical paths
Use appropriate testing frameworks (Jest, pytest, etc). Include both happy and edge cases.

View File

@@ -0,0 +1,39 @@
---
agent-type: typescript-pro
name: typescript-pro
description: Master TypeScript with advanced types, generics, and strict type safety. Handles complex type systems, decorators, and enterprise-grade patterns. Use PROACTIVELY for TypeScript architecture, type inference optimization, or advanced typing patterns.
when-to-use: Master TypeScript with advanced types, generics, and strict type safety. Handles complex type systems, decorators, and enterprise-grade patterns. Use PROACTIVELY for TypeScript architecture, type inference optimization, or advanced typing patterns.
allowed-tools:
model: sonnet
inherit-tools: true
inherit-mcps: true
color: yellow
---
You are a TypeScript expert specializing in advanced typing and enterprise-grade development.
## Focus Areas
- Advanced type systems (generics, conditional types, mapped types)
- Strict TypeScript configuration and compiler options
- Type inference optimization and utility types
- Decorators and metadata programming
- Module systems and namespace organization
- Integration with modern frameworks (React, Node.js, Express)
## Approach
1. Leverage strict type checking with appropriate compiler flags
2. Use generics and utility types for maximum type safety
3. Prefer type inference over explicit annotations when clear
4. Design robust interfaces and abstract classes
5. Implement proper error boundaries with typed exceptions
6. Optimize build times with incremental compilation
## Output
- Strongly-typed TypeScript with comprehensive interfaces
- Generic functions and classes with proper constraints
- Custom utility types and advanced type manipulations
- Jest/Vitest tests with proper type assertions
- TSConfig optimization for project requirements
- Type declaration files (.d.ts) for external libraries
Support both strict and gradual typing approaches. Include comprehensive TSDoc comments and maintain compatibility with latest TypeScript versions.

View File

@@ -0,0 +1,41 @@
---
agent-type: ui-ux-designer
name: ui-ux-designer
description: Create interface designs, wireframes, and design systems. Masters user research, prototyping, and accessibility standards. Use PROACTIVELY for design systems, user flows, or interface optimization.
when-to-use: Create interface designs, wireframes, and design systems. Masters user research, prototyping, and accessibility standards. Use PROACTIVELY for design systems, user flows, or interface optimization.
allowed-tools:
model: sonnet
inherit-tools: true
inherit-mcps: true
color: purple
---
You are a UI/UX designer specializing in user-centered design and interface systems.
## Focus Areas
- User research and persona development
- Wireframing and prototyping workflows
- Design system creation and maintenance
- Accessibility and inclusive design principles
- Information architecture and user flows
- Usability testing and iteration strategies
## Approach
1. User needs first - design with empathy and data
2. Progressive disclosure for complex interfaces
3. Consistent design patterns and components
4. Mobile-first responsive design thinking
5. Accessibility built-in from the start
## Output
- User journey maps and flow diagrams
- Low and high-fidelity wireframes
- Design system components and guidelines
- Prototype specifications for development
- Accessibility annotations and requirements
- Usability testing plans and metrics
Focus on solving user problems. Include design rationale and implementation notes.

View File

@@ -0,0 +1,11 @@
# Command: cleanproject
# Description: Clean up development artifacts while preserving your working code
# Category: utility
# Version: 1
# Author: 10169
description = "Clean up development artifacts while preserving your working code"
prompt = """
I'll help clean up development artifacts while preserving your working code. I'll identify cleanup targets using native tools: Glob tool to find temporary and debug files, Grep tool to detect debug statements in code, Read tool to verify file contents before removal. Critical directories are automatically protected: .claude directory (commands and configurations), .git directory (version control), node_modules, vendor (dependency directories), Essential configuration files. When I find multiple items to clean, I'll create a todo list to process them systematically.
"""

View File

@@ -0,0 +1,11 @@
# Command: commit
# Description: Analyze your changes and create a meaningful commit message
# Category: utility
# Version: 1
# Author: 10169
description = "分析您的更改并创建有意义的提交消息"
prompt = """
我会分析您的更改并创建一条有意义的提交消息并使用简单的git命令进行提交更改。我会分析更改以确定修改了哪些文件、更改的性质功能、修复、重构等以及受影响的范围/组件。基于分析结果、以及遵循项目的IFLOW上下文中的提交规范我会创建一条常规的中文提交消息其中包含类型新增|修复|文档|优化|其他)、主题(用现在时清晰描述)。
"""

11
.iflow/commands/docs.toml Normal file
View File

@@ -0,0 +1,11 @@
# Command: docs
# Description: Smart documentation management and updates
# Category: documentation
# Version: 1
# Author: 10169
description = "智能文档管理和更新"
prompt = """
我将根据代码变更更新、整理和维护文档,帮助您智能地管理文档。我将同步文档与实现变更,识别过时的章节,提出改进建议,并确保文档之间的一致性。功能包括自动文档更新、交叉引用链接、版本跟踪和质量评估。
"""

View File

@@ -1,16 +1,18 @@
{
"language": "zh-CN",
"mcpServers": {
"Framelink Figma MCP": {
"description": "为AI编程工具提供Figma设计文件访问能力支持获取设计数据和下载图像资源帮助实现设计到代码的一键转换。",
"bing-cn-mcp": {
"description": "MCP 服务器,提供中文必应搜索结果抓取和网页内容抓取功能,支持中文搜索",
"command": "npx",
"args": ["-y", "@iflow-mcp/figma-developer-mcp@0.5.0", "--stdio"],
"args": ["-y", "@iflow-mcp/bing-cn-mcp"],
"env": {
"FIGMA_API_KEY": ""
"USER_AGENT": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}
},
"playwright": {
"chrome-devtools": {
"description": "Chrome浏览器自动化工具支持页面操作、性能分析、网络监控等功能",
"command": "npx",
"args": ["@playwright/mcp@latest"]
"args": ["-y", "@iflow-mcp/chrome-devtools-mcp"]
},
"context7": {
"description": "为开发者提供最新技术文档和代码示例的智能检索服务,支持库搜索和文档获取功能",
@@ -22,15 +24,6 @@
"command": "npx",
"args": ["-y", "@iflow-mcp/fetch@1.0.2"]
},
"server-puppeteer": {
"description": "基于Puppeteer的浏览器自动化工具支持页面导航、截图、元素操作和JavaScript执行等功能",
"command": "npx",
"args": ["-y", "@iflow-mcp/server-puppeteer@0.6.2"],
"env": {
"PUPPETEER_LAUNCH_OPTIONS": "{\"executablePath\":\"C:\\Program Files\\Google\\Chrome\\Application\"}",
"ALLOW_DANGEROUS": "{\"executablePath\":\"C:\\Program Files\\Google\\Chrome\\Application\"}"
}
},
"math-tools": {
"description": "提供34个数学运算工具包含算术运算、统计计算、数据科学和表达式求值功能支持高精度计算。",
"command": "npx",
@@ -54,10 +47,13 @@
"command": "npx",
"args": ["-y", "@iflow-mcp/server-filesystem@0.6.2", "E:\\"]
},
"mcp-server-code-runner": {
"description": "多语言代码执行器支持35种编程语言的代码片段执行包括JavaScript、Python、Go、Java等主流语言",
"Framelink Figma MCP": {
"description": "为AI编程工具提供Figma设计文件访问能力支持获取设计数据和下载图像资源帮助实现设计到代码的一键转换。",
"command": "npx",
"args": ["-y", "@iflow-mcp/mcp-server-code-runner"]
"args": ["-y", "@iflow-mcp/figma-developer-mcp@0.5.0", "--stdio"],
"env": {
"FIGMA_API_KEY": ""
}
},
"gitlab": {
"description": "提供GitLab项目管理、文件操作、Issue管理、合并请求等功能的MCP服务器工具集",

View File

@@ -1,4 +1,4 @@
# 项目概述
# 项目概述 - IFLOW 上下文
这是一个基于 UniApp + Vue3 + TypeScript 的微信小程序项目模板。它提供了一个基础的项目结构和一些常用的工具函数,方便快速开发微信小程序。
@@ -9,7 +9,8 @@
* **TypeScript**: JavaScript 的超集,提供类型检查和更好的开发体验。
* **uView-Plus**: 基于 UniApp 的 UI 组件库。
* **z-paging**: 一个用于处理分页加载的组件库。
* **Vuex**: 状态管理库。
* **Vuex**: 状态管理库,用于统一管理应用状态(登录状态、用户信息等)
* **luch-request**: 基于 Promise 的网络请求库。
## 目录结构
@@ -25,14 +26,16 @@
│ └── utils/ # 工具函数
│ └── tool.ts # 常用工具函数
├── components/ # 公共组件
├── wxcomponents/ # 微信原生组件
├── lib/ # 第三方库
│ └── luch-request/ # luch-request 网络请求库
├── pages/ # 主包页面
│ └── index/ # 首页
│ └── index.vue # 首页页面
├── subPages/ # 分包页面
├── static/ # 静态资源文件
│ └── assets/ # 静态图片资源
├── store/ # 状态管理
│ └── index.ts # Vuex store
├── uni_modules/ # uni-app 组件
│ └── z-paging/ # 分页组件库
├── uview-plus/ # uView-Plus 组件库
@@ -83,21 +86,23 @@ npm install
* 遵循函数式编程范式。
* 方法类函数应该使用 `function` 进行定义。
* 避免出现超过4个以上的 `ref`超过4个则使用 `reactive`
* 页面的生命周期按需进行导入,如(`import { onLoad } from '@dcloudio/uni-app'`)。
* 页面的生命周期需要通过 `@dcloudio/uni-app` 依赖进行按需导入,如(`import { onLoad } from '@dcloudio/uni-app'`)。
页面的加载、挂载生命周期不要使用 `onMounted` 应该使用 `onLoad`
* 全局变量都集中放置于代码顶部。
* 变量名使用小驼峰命名法。
* 常量名使用全大写。
* 状态类变量命名参考 `isLogin``isOpen`
* 事件类方法命名参考 `handleClick``onSelect`
* 变量都应该写有注释说明、类型说明。
* `Promise` 方法使用 `async` `await` 写法,并进行容错处理。
* 所有 `Promise` 方法使用 `async` `await` 写法,避免出现 `.then` 嵌套,并进行容错、错误抛出处理。
* 在需要页面跳转、提示、加载、本地存储、或其他功能的时候,优先使用工具函数 `common/utils/tool.ts` 中存在的函数。
* 字符串拼接使用ES6的模板语法。
* TypeScript规范应遵循项目中已有的风格。
## 静态资源
* 静态资源变量 `ASSETSURL` 已进行全局暴露,可以在 `<template></template>` 中直接使用。
* 所有静态资源URL应该使用 `ASSETSURL` 进行拼接,`${ASSETSURL}simple.png`
* 所有静态资源URL应该使用 `ASSETSURL` 进行拼接,使用方式为`${ASSETSURL}simple.png``background-image: url($ASSETSURL + 'b23bbf0c4c8e59f88f8fd883cb5d6b27.png')`
## 工具函数 (tool.ts)
@@ -115,18 +120,48 @@ npm install
* 包含请求和响应拦截器,用于处理通用逻辑(如错误提示、鉴权等)。
* 各业务板块的接口都应存放在 `api/modules` 下,并将单个接口进行导出以便页面按需导入。
## 状态管理 (Vuex)
* 项目集成了Vuex进行全局状态管理。
* 状态管理文件位于 `store/index.ts`
* 使用 `useStore` 钩子在组件中访问状态。
## 组件
* 项目集成了 `uView-Plus``z-paging` 两个组件库。
* 所有 `uni_modules` 目录中的组件无需导入直接可以进行使用。
* `uView-Plus` 组件已通过 `easycom` 自动导入,可以直接使用,如:`<u-button>``<u-icon>`
* 全局组件放在 `components/` 目录下。
* 页面独立组件放在页面根目录下的 `components/`
* 每个组件应该附带 `README.MD` 文档
* 微信的原生组件放在页面根目录下的 `wxcomponents/`,并在使用了组件的对应页面路由配置中添加组件的引用属性 `"usingComponents": { "components": "/wxcomponents/components/components" }`
* 组件编写应遵循项目中已有的风格。
## 分页功能
* 项目使用 `z-paging` 组件实现分页功能。
* 分页组件通过 `v-model` 绑定数据,并使用 `@query` 事件处理数据查询。
* 在页面中直接使用 `v-for` 循环渲染数据项,如:`<view class="item" v-for="item in dataList" :key="item.id">`
* 通过 `paging.value?.reload()` 触发分页组件重新加载数据。
* 通过 `paging.value?.complete()` 通知分页组件数据加载完成。
## 页面
* 页面配置在 `pages.json` 中管理。
* 主包页面放在 `pages/` 目录下,分包页面放在 `subPages/` 目录下。
* 主包页面放在 `pages/` 目录下,分包页面放在 `subPages/` 目录下,如果页面不属于一级页面且没有包含在 `pages.json` 中的 `tabbar`,则应该放置在分包目录下
* 页面使用 Composition API (setup语法糖) 编写。
* 注释、结构规范应遵循项目中已有的风格。
* 注释、结构规范应遵循项目中已有的风格。
## 代码提交规范
* 提交信息应清晰描述变更内容,如 `修复 搜索功能空值检查``新增 删除按钮功能`
* 对于功能性的新增或修改,使用 `新增` 前缀。
* 对于错误修复,使用 `修复` 前缀。
* 对于性能优化、代码重构(既不修复错误也不添加功能),使用 `优化` 前缀。
* 对于文档更新,使用 `文档` 前缀。
* 提交信息应使用中文。
## 其他
* 页面中的分享功能应该使用原生的微信分享功能,通过 `button``<u-button>` 组件的 `open-type="share"` 属性实现。
* 项目使用环境变量管理不同环境的配置,通过 `.env` 文件配置。
* Vite配置文件 `vite.config.js` 包含了自定义插件用于在编译时替换 `manifest.json` 中的 appid。

View File

@@ -1,5 +1,5 @@
// 定义内外边距历遍1-40
@for $i from 0 through 40 {
// 定义内外边距历遍1-100
@for $i from 0 through 100 {
// 只要双数和能被5除尽的数
@if $i % 2==0 or $i % 5==0 {
// 得出u-margin-30或者u-m-30

View File

@@ -1,6 +1,7 @@
import { createApp } from 'vue'
// @ts-ignore
import App from './App.vue'
import store from './store'
// 创建应用实例
const app = createApp(App)
@@ -14,6 +15,7 @@ app.provide('ASSETSURL', ASSETSURL)
// @ts-ignore
import uView from './uview-plus/index'
app.use(uView)
app.use(store)
// 挂载应用
app.mount('#app')

View File

@@ -2,12 +2,6 @@
"name": "template-mp-ts",
"version": "1.0.0",
"description": "A TypeScript template for UniApp Mini Program",
"scripts": {
"dev:mp-weixin": "npm run build:mp-weixin -- --watch",
"build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
"dev:mp-alipay": "npm run build:mp-alipay -- --watch",
"build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build"
},
"dependencies": {
"@dcloudio/uni-app": "^3.0.0-3000020210720001",
"@dcloudio/uni-app-plus": "^3.0.0-3000020210720001",

View File

@@ -1,22 +1,43 @@
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页"
}
"path": "pages/index/index"
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"subPackages": [
{
"root": "subPages",
"pages": [
{
"path": "welcome/index"
}
]
}
],
"tabBar": {
"color": "#c3c3c3",
"selectedColor": "#454c5c",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/assets/icon_home.png",
"selectedIconPath": "static/assets/icon_home_selected.png"
}
]
},
"easycom": {
"autoscan": true,
"custom": {
"^u-(.*)": "@/uview-plus/components/u-$1/u-$1.vue"
"^u-([^-].*)": "@/uview-plus/components/u-$1/u-$1.vue"
}
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "miniprogram",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
}

BIN
static/assets/icon_home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,7 @@
<template>
<div> </div>
</template>
<script setup lang="ts"></script>
<style scoped></style>

View File

@@ -3,9 +3,6 @@
"version": "3.2.5",
"description": "types for uview-plus",
"main": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ijry/uview-plus.git"

View File

@@ -1,36 +1,50 @@
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { resolve } from 'path'
import { readFileSync, writeFileSync } from 'fs'
import { readFileSync, writeFileSync, existsSync, unlinkSync } from 'fs'
import dotenv from 'dotenv'
// 自定义插件:替换 manifest.json 中的 appid
// 仅在通过HBuilder首次编译时执行避免热重载时重复执行导致内存占用高
function replaceManifestAppid() {
return {
name: 'replace-manifest-appid',
buildStart() {
// 检查是否通过HBuilder编译
// 检查是否已经执行过插件
const manifestUpdatedFlag = resolve(__dirname, '.manifest-updated')
const isFirstCompile = !existsSync(manifestUpdatedFlag)
// 仅首次编译时执行
if (!isFirstCompile) {
console.log('跳过 manifest appid 更新(已执行过首次编译)')
return
}
// 获取环境变量,明确指定路径为项目根目录
dotenv.config({ path: resolve(__dirname, '.env') })
const appid = process.env.VITE_APPID
const uni_appId = process.env.VITE_UNI_APPID
const libVersion = process.env.VITE_LIBVERSION || '3.0.0'
if (appid && uni_appId) {
// 读取 manifest.json 文件
const manifestPath = resolve(__dirname, 'manifest.json')
let manifestContent = readFileSync(manifestPath, 'utf-8')
// 解析 JSON
const manifest = JSON.parse(manifestContent)
// 替换
manifest.appid = uni_appId
if (manifest['mp-weixin']) {
manifest['mp-weixin'].appid = appid
manifest['mp-weixin'].libVersion = libVersion
}
// 写回文件
writeFileSync(manifestPath, JSON.stringify(manifest, null, 4))
// 创建标记文件,表示已执行过插件
writeFileSync(manifestUpdatedFlag, 'Manifest updated by HBuilder first compile')
console.log(`Manifest appid 已更新为: ${uni_appId}`)
console.log(`Manifest mp-weixin appid 已更新为: ${appid}`)
} else {
@@ -40,8 +54,22 @@ function replaceManifestAppid() {
}
}
// 检查是否通过HBuilder编译决定是否启用插件
const manifestUpdatedFlag = resolve(__dirname, '.manifest-updated')
if (existsSync(manifestUpdatedFlag)) {
unlinkSync(manifestUpdatedFlag)
console.log('已清理 manifest 更新标记文件')
}
const plugins = manifestUpdatedFlag ? [replaceManifestAppid(), uni()] : [uni()]
export default defineConfig({
plugins: [replaceManifestAppid(), uni()],
plugins,
resolve: {
alias: {
'@': '/src',
},
},
build: {
minify: 'terser',
terserOptions: {