初始化
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
---
|
||||
description: 用户要求 git commit、提交代码、写 commit message 或创建提交时,必须先加载 commit-convention skill 并严格遵守
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Git 提交规范自动激活
|
||||
|
||||
当用户要求**提交代码**、**git commit**、**写提交说明**或执行提交流程时:
|
||||
|
||||
1. 必须先加载 `.cursor/skills/commit-convention/SKILL.md`。
|
||||
2. Agent 代提交时 subject **必须**以 `[Ai]` 开头,并写清业务变更或 Bug 修复,禁止敷衍 subject。
|
||||
3. 未获用户明确授权不得 commit;不得提交 `.env` 等含密钥文件;默认不 push。
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
description: 项目通用规范,涵盖技术栈、目录结构、编码约定
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# 项目约定
|
||||
|
||||
## 技术栈
|
||||
|
||||
- **框架**: Vue 2 + Vue CLI 4
|
||||
- **路由**: Vue Router 3 (history 模式)
|
||||
- **状态管理**: Vuex 3
|
||||
- **语言**: JavaScript (无 TypeScript)
|
||||
- **UI 库**: Element UI + Vant 2
|
||||
- **样式**: SCSS + scoped + PostCSS px2rem (rootValue: 37.5)
|
||||
- **移动端适配**: lib-flexible + postcss-plugin-px2rem
|
||||
- **HTTP**: Axios
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── api/ # API 请求模块
|
||||
├── assets/ # 静态资源 (图片、样式)
|
||||
├── plugins/ # 插件 (Element UI、flexible 等)
|
||||
├── router/ # 路由配置
|
||||
├── store/ # Vuex store
|
||||
├── utils/ # 工具函数
|
||||
├── views/ # 页面视图
|
||||
│ └── land/ # 落地页
|
||||
│ ├── index.vue # 主入口,根据设备/模板切换组件
|
||||
│ └── components/ # 落地页子组件 (mobile1, pc2 等)
|
||||
```
|
||||
|
||||
## 编码规范
|
||||
|
||||
- 使用 ES6+ 语法,Options API 风格
|
||||
- 组件通过 props 接收 `os`、`configs`、`switchData` 等父级数据
|
||||
- 事件通过 `$emit` 向上传递 (`recordClick`、`getApkInfo`)
|
||||
- 图片资源使用相对路径引用,放在 `assets/images/` 对应子目录下
|
||||
- px 值会被 PostCSS 自动转为 rem,带 `pcm` 选择器前缀的除外
|
||||
- 始终用中文回复
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
description: SCSS 样式编写规范,包含移动端适配和 px2rem 规则
|
||||
globs: "**/*.vue,**/*.scss"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# SCSS 样式规范
|
||||
|
||||
## px2rem 适配
|
||||
|
||||
- 项目使用 `postcss-plugin-px2rem`,rootValue 为 **37.5**
|
||||
- 设计稿以 **375px** 宽度为基准,直接写 px 值即可自动转换
|
||||
- 带 `pcm` 选择器前缀的样式**不会**被转换 (PC 端样式)
|
||||
|
||||
## 样式写法
|
||||
|
||||
- 使用 `<style lang="scss" scoped>` 保证组件样式隔离
|
||||
- 深层覆盖 Vant 组件样式使用 `::v-deep`:
|
||||
|
||||
```scss
|
||||
::v-deep .van-tabs__wrap {
|
||||
.van-tab--active {
|
||||
background: #f68804;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 常用模式
|
||||
|
||||
### 全屏背景图
|
||||
|
||||
```scss
|
||||
.contentBlock {
|
||||
height: 940px;
|
||||
width: 343px;
|
||||
background: url("./../../../assets/images/{template}/content.webp") no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
```
|
||||
|
||||
### 固定定位浮层
|
||||
|
||||
```scss
|
||||
.floatingBox {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 187px;
|
||||
z-index: 998;
|
||||
}
|
||||
```
|
||||
|
||||
### 下载按钮
|
||||
|
||||
```scss
|
||||
.downBtn {
|
||||
border-radius: 24px;
|
||||
background: #ff6f2e;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
```
|
||||
|
||||
## 颜色常量 (项目常用)
|
||||
|
||||
| 用途 | 色值 |
|
||||
|------|------|
|
||||
| 页面背景 | `#141414` |
|
||||
| 主按钮 | `#ff6f2e` / `#f68804` |
|
||||
| Tab 背景 | `#2d2c2f` |
|
||||
| 弹窗按钮 | `#5b92ee` |
|
||||
| 文字白色 | `#ffffff` |
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
description: Vue 组件开发规范,适用于落地页组件
|
||||
globs: "**/*.vue"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Vue 组件规范
|
||||
|
||||
## 组件结构
|
||||
|
||||
遵循 `<template>` → `<script>` → `<style>` 顺序:
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div class="pageName">
|
||||
<!-- 内容 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ["os", "configs", "switchData"],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
watch: {},
|
||||
mounted() {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.pageName {
|
||||
/* 样式 */
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
## 命名约定
|
||||
|
||||
- 文件名: 小写或 camelCase (`mobile1.vue`, `selectLinePopup.vue`)
|
||||
- 新落地页模板: `mobile{N}.vue` (移动端) / `pc{N}.vue` (PC 端)
|
||||
- CSS 类名: camelCase (`headerBox`, `floatingBox`, `bottomBox`)
|
||||
- 事件名: camelCase (`getApkInfo`, `recordClick`)
|
||||
|
||||
## Props 通信
|
||||
|
||||
落地页组件接收三个核心 props:
|
||||
|
||||
| Prop | 说明 |
|
||||
|------|------|
|
||||
| `os` | 设备信息 (isPhone, userAgent 等) |
|
||||
| `configs` | 配置列表 (tg_group, potato_group 等) |
|
||||
| `switchData` | 开关数据 (下载链接、功能开关) |
|
||||
|
||||
## 事件追踪
|
||||
|
||||
使用 `landingPageClick` 上报用户点击行为,传入 tab 和坐标:
|
||||
|
||||
```js
|
||||
import { landingPageClick } from "@/utils/eventTracker";
|
||||
landingPageClick(this, { tab_key, tab_name, click_coordinates_x, click_coordinates_y });
|
||||
```
|
||||
|
||||
## 图片资源引用
|
||||
|
||||
图片放在 `src/assets/images/{templateName}/` 下,在 SCSS 中通过相对路径引用:
|
||||
|
||||
```scss
|
||||
background: url("./../../../assets/images/mobile1/logo.png") no-repeat;
|
||||
background-size: 100% 100%;
|
||||
```
|
||||
Reference in New Issue
Block a user