Compare commits

..

23 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
13 changed files with 167 additions and 44 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,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 组件库
@@ -84,6 +87,7 @@ npm install
* 方法类函数应该使用 `function` 进行定义。
* 避免出现超过4个以上的 `ref`超过4个则使用 `reactive`
* 页面的生命周期需要通过 `@dcloudio/uni-app` 依赖进行按需导入,如(`import { onLoad } from '@dcloudio/uni-app'`)。
页面的加载、挂载生命周期不要使用 `onMounted` 应该使用 `onLoad`
* 全局变量都集中放置于代码顶部。
* 变量名使用小驼峰命名法。
* 常量名使用全大写。
@@ -91,13 +95,14 @@ npm install
* 事件类方法命名参考 `handleClick``onSelect`
* 变量都应该写有注释说明、类型说明。
* 所有 `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

@@ -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

@@ -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: {