refactor: ♻️ 修复已知问题

This commit is contained in:
Ray.Hao
2025-10-09 20:45:01 +08:00
parent 55014529b3
commit 197c4014fc
4 changed files with 84 additions and 42 deletions

View File

@@ -12,20 +12,59 @@
## 项目启动
安装依赖
### 安装依赖
```
```bash
pnpm install
```
h5启动
### H5 启动
```
```bash
pnpm run dev:h5
```
访问 [http://localhost:4096](http://localhost:4096)
### 微信小程序启动
#### 1. 编译项目
```bash
pnpm run dev:mp-weixin
```
编译完成后,会在 `dist/dev/mp-weixin` 目录下生成微信小程序代码。
#### 2. 导入项目到微信开发者工具
- 打开**微信开发者工具**
- 点击 **"导入项目"**
- 选择项目根目录下的 `dist/dev/mp-weixin` 文件夹
- 填写 AppID没有可以选择测试号
#### 3. 配置微信开发者工具(⚠️ 重要)
在微信开发者工具中,点击右上角的 **"详情"** → **"本地设置"**,确保以下配置:
-**不校验合法域名、web-view业务域名、TLS 版本以及 HTTPS 证书** - 必须勾选(开发环境)
-**ES6 转 ES5** - 建议勾选
-**过滤无依赖文件** - **必须取消勾选**(否则会导致组件无法加载)
-**上传时过滤无依赖文件** - 建议取消勾选
#### 4. 首次运行或遇到组件加载问题
如果遇到组件无法加载或页面报错,请执行以下操作:
1. **清除缓存**:点击菜单 `工具``清除缓存``全部清除`
2. **重新编译**:点击工具栏的 **"编译"** 按钮
3. **重新载入项目配置**:点击菜单 `项目``重新载入项目配置`
如果问题依然存在,尝试:
- 关闭微信开发者工具
- 重新打开并导入项目
## 组件结构
项目组件分为以下几类:

View File

@@ -90,57 +90,57 @@
"@dcloudio/uni-mp-weixin": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-xhs": "3.0.0-4020420240722002",
"@dcloudio/uni-quickapp-webview": "3.0.0-4020420240722002",
"@stomp/stompjs": "^7.1.1",
"@stomp/stompjs": "^7.2.0",
"@uni-helper/uni-use": "^0.19.15",
"@vueuse/core": "9.13.0",
"pinia": "^2.2.2",
"vue": "^3.5.13",
"pinia": "^2.3.1",
"vue": "^3.5.22",
"wot-design-uni": "^1.13.0"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@dcloudio/types": "^3.4.8",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@dcloudio/types": "^3.4.24",
"@dcloudio/uni-automator": "3.0.0-4020420240722002",
"@dcloudio/uni-cli-shared": "3.0.0-4020420240722002",
"@dcloudio/uni-stacktracey": "3.0.0-4020420240722002",
"@dcloudio/vite-plugin-uni": "3.0.0-4020420240722002",
"@eslint/js": "^9.10.0",
"@eslint/js": "^9.37.0",
"@uni-helper/uni-types": "1.0.0-alpha.6",
"@uni-helper/vite-plugin-uni-components": "^0.2.0",
"@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
"@uni-helper/vite-plugin-uni-pages": "^0.2.28",
"@vue/runtime-core": "^3.4.21",
"commitizen": "^4.3.0",
"cz-git": "^1.9.4",
"eslint": "^9.10.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vue": "^9.28.0",
"globals": "^15.9.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"postcss": "^8.4.47",
"postcss-html": "^1.7.0",
"@uni-helper/vite-plugin-uni-components": "^0.2.3",
"@uni-helper/vite-plugin-uni-layouts": "^0.1.11",
"@uni-helper/vite-plugin-uni-pages": "^0.2.29",
"@vue/runtime-core": "^3.5.22",
"commitizen": "^4.3.1",
"cz-git": "^1.12.0",
"eslint": "^9.37.0",
"eslint-config-prettier": "^9.1.2",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-vue": "^9.33.0",
"globals": "^15.15.0",
"husky": "^9.1.7",
"lint-staged": "^15.5.2",
"postcss": "^8.5.6",
"postcss-html": "^1.8.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.3.3",
"prettier": "^3.6.2",
"sass": "1.78.0",
"sass-loader": "^16.0.2",
"stylelint": "^16.9.0",
"sass-loader": "^16.0.5",
"stylelint": "^16.25.0",
"stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^5.1.0",
"stylelint-config-recess-order": "^5.1.1",
"stylelint-config-recommended": "^14.0.1",
"stylelint-config-recommended-scss": "^14.1.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-prettier": "^5.0.2",
"typescript": "^4.9.4",
"typescript-eslint": "^8.6.0",
"stylelint-config-recommended-vue": "^1.6.1",
"stylelint-prettier": "^5.0.3",
"typescript": "^4.9.5",
"typescript-eslint": "^8.46.0",
"uni-mini-router": "^0.1.6",
"unocss": "^0.62.4",
"unocss-preset-weapp": "^0.62.2",
"unplugin-auto-import": "^0.18.3",
"unplugin-auto-import": "^0.18.6",
"vite": "6.3.2",
"vue-eslint-parser": "^9.4.3",
"vue-tsc": "^1.0.24"
"vue-tsc": "^1.8.27"
}
}

View File

@@ -129,4 +129,4 @@
]
},
"subPackages": []
}
}

View File

@@ -135,11 +135,12 @@ const searchWidth = ref("100%"); // 搜索框宽度
// 初始化导航栏信息
onMounted(() => {
const systemInfo = uni.getSystemInfoSync();
statusBarHeight.value = systemInfo.statusBarHeight || 0;
// #ifdef MP-WEIXIN
// 微信小程序:获取胶囊按钮信息
// 微信小程序:使用新的 API 获取窗口信息
const windowInfo = uni.getWindowInfo();
statusBarHeight.value = windowInfo.statusBarHeight || 0;
// 获取胶囊按钮信息
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
// 计算导航栏高度:(胶囊底部 - 状态栏高度) + (胶囊顶部 - 状态栏高度)
navBarHeight.value =
@@ -149,7 +150,9 @@ onMounted(() => {
// #endif
// #ifdef H5 || APP-PLUS
// H5 和 App 使用默认高度和 100% 宽度44px ≈ 88rpx
// H5 和 App使用 getSystemInfoSync非小程序环境仍然可用
const systemInfo = uni.getSystemInfoSync();
statusBarHeight.value = systemInfo.statusBarHeight || 0;
navBarHeight.value = 44;
searchWidth.value = "100%";
// #endif