新增 错误上报功能增加项目名称和版本号信息

This commit is contained in:
yuantao
2025-12-01 16:03:05 +08:00
parent 31566408d3
commit ba839a1e47

View File

@@ -33,9 +33,9 @@ class Tool {
// 项目信息
this.projectInfo = {
name: 'template',
version: '1.0.0'
version: '1.0.0',
}
// 尝试从 manifest.json 加载项目信息
this._loadProjectInfo()
}
@@ -826,13 +826,10 @@ class Tool {
*/
_loadProjectInfo() {
try {
// 尝试加载 manifest.json 信息
const manifest = require('../../manifest.json')
if (manifest.name) {
this.projectInfo.name = manifest.name
}
if (manifest.versionName) {
this.projectInfo.version = manifest.versionName
if (uni.getSystemInfoSync()) {
const AppInfo = uni.getSystemInfoSync()
this.projectInfo.name = AppInfo.appName
this.projectInfo.version = AppInfo.appVersion
}
} catch (error) {
// 如果加载失败,使用默认信息