增加远程测试数据库,优化登录页面,优化用户信息设置

This commit is contained in:
cc 2025-04-01 19:21:46 +08:00
parent 5affae8a17
commit cf2c97a775
11 changed files with 27153 additions and 31025 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,11 +3,13 @@
"MODULES": [ "MODULES": [
{ {
"MODULE_NAME": "1043bfc77febe75fafec0c4309faccf1", "MODULE_NAME": "1043bfc77febe75fafec0c4309faccf1",
"API_TYPE": "stageMode" "API_TYPE": "stageMode",
"INCREMENTAL_TASKS": {
"COMPILE_ARKTS": true
}
} }
], ],
"BUILD_MODE": "debug", "BUILD_MODE": "debug"
"USE_NORMALIZED_OHMURL": true
}, },
"HVIGOR": { "HVIGOR": {
"IS_INCREMENTAL": true, "IS_INCREMENTAL": true,
@ -16,19 +18,21 @@
"IS_HVIGORFILE_TYPE_CHECK": false, "IS_HVIGORFILE_TYPE_CHECK": false,
"TASK_TIME": { "TASK_TIME": {
"1043bfc77febe75fafec0c4309faccf1": { "1043bfc77febe75fafec0c4309faccf1": {
"ConfigureCmake": 289167, "ConfigureCmake": 303500,
"PreCheckSyscap": 444958, "PreCheckSyscap": 534625,
"ProcessIntegratedHsp": 1675875, "ProcessIntegratedHsp": 2304750,
"BuildNativeWithCmake": 269250, "BuildNativeWithCmake": 812250,
"SyscapTransform": 591917, "SyscapTransform": 2126459,
"BuildNativeWithNinja": 708666, "BuildNativeWithNinja": 1346958,
"BuildJS": 1348583, "BuildJS": 2715708,
"SignHap": 572375, "CompileArkTS": 2690421000,
"CollectDebugSymbol": 1221042, "PackageHap": 569532292,
"assembleHap": 62917 "SignHap": 836333,
"CollectDebugSymbol": 2402750,
"assembleHap": 185542
} }
}, },
"TOTAL_TIME": 439641458, "TOTAL_TIME": 3678888500,
"BUILD_ID": "202504011357556550" "BUILD_ID": "202504011919153050"
} }
} }

View File

@ -1 +1 @@
{"CACHE_SYNC_FILE_HASH":{"/Users/tian/Documents/DevEco/ClassMG/hvigorfile.ts":"9fcfc9a3e7dcbc1ff9995f87c81451a17a752746978695a53ea315b4b0923f08","/Users/tian/Documents/DevEco/ClassMG/oh-package.json5":"d15b2e6574c835be846438740580fdf0d07913cca0f9f2b81c0cd23fc0e8542f","/Users/tian/Documents/DevEco/ClassMG/.hvigor/outputs/sync/output.json":"2fa5616dec2fad0d8c059dab3fd66b8b0b4c31ea05bcba95226d38634517a0dc","/Users/tian/Documents/DevEco/ClassMG/entry/hvigorfile.ts":"9fcfc9a3e7dcbc1ff9995f87c81451a17a752746978695a53ea315b4b0923f08","/Users/tian/Documents/DevEco/ClassMG/entry/build-profile.json5":"e753bd3a2f1e3b9cd295cdaebd2aa42f48d3df182a195636e9c3f2cb784c2ceb","/Users/tian/Documents/DevEco/ClassMG/hvigor/hvigor-config.json5":"e381cc4e155e767588bdbd4bce1682e23850099dc7b861b35f2a98ac70699378","/Users/tian/Documents/DevEco/ClassMG/entry/oh-package.json5":"e5c96a2b6c40008639c515043adc6905ce28355164f58b419139eeaccaed5d86","/Users/tian/Documents/DevEco/ClassMG/build-profile.json5":"67a095cfb37136aba9f50f1ae51e82f2818dafb19b0011a78d4e0df536a67f42","SDK_LOCATION":"/Applications/DevEco-Studio.app/Contents/sdk"},"OHPM_INSTALL_FILE_HASH":{"/Users/tian/Documents/DevEco/ClassMG/oh-package.json5":"d15b2e6574c835be846438740580fdf0d07913cca0f9f2b81c0cd23fc0e8542f","/Users/tian/Documents/DevEco/ClassMG/oh_modules":true,"/Users/tian/Documents/DevEco/ClassMG/entry/oh_modules":false,"/Users/tian/Documents/DevEco/ClassMG/entry/oh-package.json5":"e5c96a2b6c40008639c515043adc6905ce28355164f58b419139eeaccaed5d86","/Users/tian/Documents/DevEco/ClassMG/oh_modules/.ohpm/lock.json5":"744ae73f8f3a6db0e250f8e9050ebe1d27617adcfeb9d6abded765a2fc13a86c"}} {"CACHE_SYNC_FILE_HASH":{"/Users/tian/Documents/DevEco/ClassMG/hvigorfile.ts":"9fcfc9a3e7dcbc1ff9995f87c81451a17a752746978695a53ea315b4b0923f08","/Users/tian/Documents/DevEco/ClassMG/oh-package.json5":"d15b2e6574c835be846438740580fdf0d07913cca0f9f2b81c0cd23fc0e8542f","/Users/tian/Documents/DevEco/ClassMG/.hvigor/outputs/sync/output.json":"356b666ffa752775d1c20e689fc6fc69e7db1eac58a99b059ca326e65edf38c8","/Users/tian/Documents/DevEco/ClassMG/entry/hvigorfile.ts":"9fcfc9a3e7dcbc1ff9995f87c81451a17a752746978695a53ea315b4b0923f08","/Users/tian/Documents/DevEco/ClassMG/entry/build-profile.json5":"e753bd3a2f1e3b9cd295cdaebd2aa42f48d3df182a195636e9c3f2cb784c2ceb","/Users/tian/Documents/DevEco/ClassMG/hvigor/hvigor-config.json5":"e381cc4e155e767588bdbd4bce1682e23850099dc7b861b35f2a98ac70699378","/Users/tian/Documents/DevEco/ClassMG/entry/oh-package.json5":"e5c96a2b6c40008639c515043adc6905ce28355164f58b419139eeaccaed5d86","/Users/tian/Documents/DevEco/ClassMG/build-profile.json5":"67a095cfb37136aba9f50f1ae51e82f2818dafb19b0011a78d4e0df536a67f42","SDK_LOCATION":"/Applications/DevEco-Studio.app/Contents/sdk"},"OHPM_INSTALL_FILE_HASH":{"/Users/tian/Documents/DevEco/ClassMG/oh-package.json5":"d15b2e6574c835be846438740580fdf0d07913cca0f9f2b81c0cd23fc0e8542f","/Users/tian/Documents/DevEco/ClassMG/oh_modules":true,"/Users/tian/Documents/DevEco/ClassMG/entry/oh_modules":false,"/Users/tian/Documents/DevEco/ClassMG/entry/oh-package.json5":"e5c96a2b6c40008639c515043adc6905ce28355164f58b419139eeaccaed5d86","/Users/tian/Documents/DevEco/ClassMG/oh_modules/.ohpm/lock.json5":"2d9515d008afdec55f0d658cc0d2a91a5c10ad7010c10462b39d3626b5f9ff99"}}

View File

@ -128,7 +128,7 @@ chineseTexts.notificationSettings = '通知设置';
chineseTexts.about = '关于'; chineseTexts.about = '关于';
chineseTexts.versionInfo = '版本信息'; chineseTexts.versionInfo = '版本信息';
// 版本日志相关 // 版本日志相关
chineseTexts.versionLog = '版本日志'; chineseTexts.versionLog = '更新日志';
chineseTexts.versionHistory = '版本历史'; chineseTexts.versionHistory = '版本历史';
chineseTexts.latestVersion = '最新版本'; chineseTexts.latestVersion = '最新版本';
chineseTexts.noVersionInfo = '没有版本信息'; chineseTexts.noVersionInfo = '没有版本信息';
@ -168,7 +168,7 @@ englishTexts.notificationSettings = 'Notification Settings';
englishTexts.about = 'About'; englishTexts.about = 'About';
englishTexts.versionInfo = 'Version Information'; englishTexts.versionInfo = 'Version Information';
// 版本日志相关 // 版本日志相关
englishTexts.versionLog = 'Version Log'; englishTexts.versionLog = 'Update Log';
englishTexts.versionHistory = 'Version History'; englishTexts.versionHistory = 'Version History';
englishTexts.latestVersion = 'Latest Version'; englishTexts.latestVersion = 'Latest Version';
englishTexts.noVersionInfo = 'No Version Information'; englishTexts.noVersionInfo = 'No Version Information';

View File

@ -154,7 +154,8 @@ export class LogManager {
this.versionLogs = [ this.versionLogs = [
new VersionLogItem("1.0.0", "2025-2-10", ["初始版本发布", "实现基本功能界面", "添加用户信息管理", "支持主题色切换", "支持中英文切换"]), new VersionLogItem("1.0.0", "2025-2-10", ["初始版本发布", "实现基本功能界面", "添加用户信息管理", "支持主题色切换", "支持中英文切换"]),
new VersionLogItem("1.1.0", "2025-3-31", ["添加用户信息编辑功能", "增加版本日志功能", "改进主题颜色切换效果","添加公告栏","修复已知问题"]), new VersionLogItem("1.1.0", "2025-3-31", ["添加用户信息编辑功能", "增加版本日志功能", "改进主题颜色切换效果","添加公告栏","修复已知问题"]),
new VersionLogItem("1.1.5","2025-4-1",["增加远程测试数据库","优化登录页面","优化用户信息设置"]) new VersionLogItem("1.1.5","2025-4-1",["增加远程测试数据库","优化登录页面","优化用户信息设置","增加退出按钮"]),
new VersionLogItem("1.1.7","2025-4-1",["添加测试按钮","修复已知问题"])
]; ];
} }
@ -170,7 +171,19 @@ export class LogManager {
*/ */
public getLatestVersion(): string { public getLatestVersion(): string {
if (this.versionLogs && this.versionLogs.length > 0) { if (this.versionLogs && this.versionLogs.length > 0) {
return this.versionLogs[0].version; // 先复制一份数组进行排序,确保不影响原数组
const sortedLogs = [...this.versionLogs].sort((a, b) => {
const vA = a.version.split('.').map(Number);
const vB = b.version.split('.').map(Number);
for (let i = 0; i < Math.max(vA.length, vB.length); i++) {
const numA = i < vA.length ? vA[i] : 0;
const numB = i < vB.length ? vB[i] : 0;
if (numB - numA !== 0) return numB - numA;
}
return 0;
});
// 返回排序后的第一个元素(最高版本)
return sortedLogs[0].version;
} }
return "1.0.0"; // 默认版本号 return "1.0.0"; // 默认版本号
} }

View File

@ -1,7 +1,7 @@
import { router } from '@kit.ArkUI'; import { router } from '@kit.ArkUI';
import { hilog } from '@kit.PerformanceAnalysisKit'; import { hilog } from '@kit.PerformanceAnalysisKit';
import settingsService, { ThemeColor, Language, SettingsModel, TextResources, UserInfoModel } from '../common/SettingsService'; import settingsService, { ThemeColor, Language, SettingsModel, TextResources, UserInfoModel } from '../common/SettingsService';
import { VersionLogItem } from '../common/logtext'; import logManager, { LogCategory, LogEventType, VersionLogItem } from '../common/logtext';
import { promptAction } from '@kit.ArkUI'; import { promptAction } from '@kit.ArkUI';
@Entry @Entry
@ -463,6 +463,38 @@ struct SystemSettings {
this.refreshTrigger++; this.refreshTrigger++;
} }
// 退出登录
private handleLogout() {
const currentLanguage = settingsService.getSettings().language;
AlertDialog.show({
title: currentLanguage === Language.CHINESE ? '确认退出' : 'Confirm Logout',
message: currentLanguage === Language.CHINESE ? '确定要退出登录吗?' : 'Are you sure you want to log out?',
buttons: [
{
value: currentLanguage === Language.CHINESE ? '确定' : 'Confirm',
action: () => {
// 清空当前用户信息
settingsService.setCurrentAccount('');
// 记录退出登录日志
logManager.info(LogCategory.USER, LogEventType.LOGOUT, 'User logged out');
// 跳转到登录页面
router.replaceUrl({
url: 'pages/login'
});
}
},
{
value: currentLanguage === Language.CHINESE ? '取消' : 'Cancel',
action: () => {
// 取消操作,不做任何事
}
}
]
});
}
// 获取主题颜色显示名称 // 获取主题颜色显示名称
private getThemeColorDisplayName(): string { private getThemeColorDisplayName(): string {
const settings = settingsService.getSettings(); const settings = settingsService.getSettings();
@ -568,17 +600,20 @@ struct SystemSettings {
// 添加日志记录设置项 // 添加日志记录设置项
SettingItem({ SettingItem({
title: "日志记录", title: this.texts.versionLog || '更新日志',
value: "查看更新记录", value: '点一点',
refreshTrigger: this.refreshTrigger, refreshTrigger: this.refreshTrigger,
themeColor: this.currentThemeColor, themeColor: this.themeColor,
icon: $r('app.media.info'), icon: $r('app.media.update'),
onItemClick: () => this.showVersionLogDialog() onItemClick: () => {
this.showVersionLog();
}
}) })
// 添加关于选项
SettingItem({ SettingItem({
title: this.currentTexts.about, title: this.currentTexts.about || '关于',
value: this.currentTexts.versionInfo, value: `v${settingsService.getCurrentVersion()}`,
refreshTrigger: this.refreshTrigger, refreshTrigger: this.refreshTrigger,
themeColor: this.currentThemeColor, themeColor: this.currentThemeColor,
icon: $r('app.media.info'), icon: $r('app.media.info'),
@ -586,6 +621,36 @@ struct SystemSettings {
}) })
} }
.width('100%') .width('100%')
// 与系统设置分开的退出登录按钮
Column() {
// 添加间距
Divider()
.width('100%')
.color('#EEEEEE')
.margin({ top: 30, bottom: 30 })
Button({
type: ButtonType.Normal
}) {
Row() {
Text(this.currentLanguage === Language.CHINESE ? '退出登录' : 'Logout')
.fontSize(16)
.fontColor('#FFFFFF')
}
.width('100%')
.justifyContent(FlexAlign.Center)
}
.width('100%')
.height(50)
.backgroundColor('#F56C6C')
.borderRadius(10)
.onClick(() => {
this.handleLogout();
})
}
.width('100%')
.margin({ bottom: 20 })
} }
.width('100%') .width('100%')
.backgroundColor(Color.White) .backgroundColor(Color.White)
@ -738,19 +803,31 @@ struct SystemSettings {
} }
// 显示版本日志对话框 // 显示版本日志对话框
private showVersionLogDialog(): void { private showVersionLog(): void {
const versionLogs = settingsService.getVersionLogs(); const versionLogs = settingsService.getVersionLogs();
if (versionLogs.length === 0) { if (versionLogs.length === 0) {
promptAction.showToast({ promptAction.showToast({
message: '暂无版本日志', message: '暂无更新日志',
duration: 2000 duration: 2000
}); });
return; return;
} }
// 确保版本日志按版本号降序排列
const sortedLogs = [...versionLogs].sort((a, b) => {
const vA = a.version.split('.').map(Number);
const vB = b.version.split('.').map(Number);
for (let i = 0; i < Math.max(vA.length, vB.length); i++) {
const numA = i < vA.length ? vA[i] : 0;
const numB = i < vB.length ? vB[i] : 0;
if (numB - numA !== 0) return numB - numA;
}
return 0;
});
// 构建版本日志内容 // 构建版本日志内容
let message = ''; let message = '';
for (const log of versionLogs) { for (const log of sortedLogs) {
message += `版本 ${log.version}${log.date}\n`; message += `版本 ${log.version}${log.date}\n`;
for (const change of log.changes) { for (const change of log.changes) {
message += `• ${change}\n`; message += `• ${change}\n`;
@ -865,6 +942,7 @@ struct SettingItem {
} }
} }
}) })
} }
} }

View File

@ -158,6 +158,29 @@ struct Login {
.onClick(() => { .onClick(() => {
this.handleLogin(); this.handleLogin();
}) })
// 测试按钮 - 直接跳转到首页
Button("测试直接进入")
.width('100%')
.height(40)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.backgroundColor('#4CAF50')
.borderRadius(8)
.fontColor(Color.White)
.margin({ top: 10 })
.onClick(() => {
// 设置账户为测试用户
settingsService.setCurrentAccount('test');
// 记录测试登录
logManager.info(LogCategory.USER, LogEventType.USER_LOGIN, 'Test user logged in');
// 直接跳转到首页
router.replaceUrl({
url: 'pages/HomePage'
});
})
} }
.width('90%') .width('90%')
.padding(20) .padding(20)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB