|
@@ -1,13 +1,12 @@
|
|
|
/**
|
|
/**
|
|
|
* 在线更新日志弹窗组件
|
|
* 在线更新日志弹窗组件
|
|
|
- * 参考WebIndex.ets的成功实现,确保WebView正常工作
|
|
|
|
|
|
|
+ * 通过ConfigManager获取json配置并渲染页面,避免WebView加载loading
|
|
|
*/
|
|
*/
|
|
|
-import { webview } from '@kit.ArkWeb';
|
|
|
|
|
-import { UpdateConstants } from '../common/constants/UpdateConstants';
|
|
|
|
|
-import { UpdateLogManager } from '../common/util/UpdateLogManager';
|
|
|
|
|
|
|
+import { UpdateLogManager, UpdateLogItemType, UpdateLogConfigType } from '../common/util/UpdateLogManager';
|
|
|
import { ConfigurationConstant } from '@kit.AbilityKit';
|
|
import { ConfigurationConstant } from '@kit.AbilityKit';
|
|
|
import { AppUtil, PreferencesUtil } from '@pura/harmony-utils';
|
|
import { AppUtil, PreferencesUtil } from '@pura/harmony-utils';
|
|
|
import { CommonConstants } from '../common/constants/CommonConstants';
|
|
import { CommonConstants } from '../common/constants/CommonConstants';
|
|
|
|
|
+import { ConfigManager } from '../common/util/ConfigManager';
|
|
|
|
|
|
|
|
@Component
|
|
@Component
|
|
|
export default struct OnlineUpdateLog {
|
|
export default struct OnlineUpdateLog {
|
|
@@ -15,20 +14,14 @@ export default struct OnlineUpdateLog {
|
|
|
controller?: CustomDialogController;
|
|
controller?: CustomDialogController;
|
|
|
/** 关闭回调 */
|
|
/** 关闭回调 */
|
|
|
onClose?: () => void;
|
|
onClose?: () => void;
|
|
|
- /** 更新日志URL */
|
|
|
|
|
- @State updateLogUrl: string = '';
|
|
|
|
|
/** 当前应用版本 */
|
|
/** 当前应用版本 */
|
|
|
@State currentVersion: string = '';
|
|
@State currentVersion: string = '';
|
|
|
- /** WebView控制器 */
|
|
|
|
|
- private webViewController: webview.WebviewController = new webview.WebviewController();
|
|
|
|
|
|
|
+ /** 更新日志配置数据 */
|
|
|
|
|
+ @State updateLogConfig: UpdateLogConfigType | null = null;
|
|
|
/** 是否加载完成 */
|
|
/** 是否加载完成 */
|
|
|
@State isLoading: boolean = true;
|
|
@State isLoading: boolean = true;
|
|
|
/** 加载错误信息 */
|
|
/** 加载错误信息 */
|
|
|
@State errorMessage: string = '';
|
|
@State errorMessage: string = '';
|
|
|
- /** 加载进度 */
|
|
|
|
|
- @State progressValue: number = 0;
|
|
|
|
|
- /** 进度条是否可见 */
|
|
|
|
|
- @State progressVisible: boolean = true;
|
|
|
|
|
/** 深色模式 */
|
|
/** 深色模式 */
|
|
|
@State isDarkMode: boolean = false;
|
|
@State isDarkMode: boolean = false;
|
|
|
@StorageProp('currentColorMode') currentMode: number = ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
|
|
@StorageProp('currentColorMode') currentMode: number = ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
|
|
@@ -38,20 +31,16 @@ export default struct OnlineUpdateLog {
|
|
|
try {
|
|
try {
|
|
|
// 获取当前应用版本
|
|
// 获取当前应用版本
|
|
|
this.getCurrentVersion();
|
|
this.getCurrentVersion();
|
|
|
- // 设置更新日志URL - 直接使用在线URL
|
|
|
|
|
- this.updateLogUrl = UpdateConstants.UPDATE_LOG_URL;
|
|
|
|
|
// 检查深色模式
|
|
// 检查深色模式
|
|
|
this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK;
|
|
this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK;
|
|
|
let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
|
|
let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
|
|
|
AppStorage.setOrCreate('themeColor', themeColor);
|
|
AppStorage.setOrCreate('themeColor', themeColor);
|
|
|
this.themeColor = themeColor
|
|
this.themeColor = themeColor
|
|
|
- console.info('OnlineUpdateLogDialog URL:', this.updateLogUrl);
|
|
|
|
|
- console.info('OnlineUpdateLogDialog 开始加载在线更新日志');
|
|
|
|
|
|
|
|
|
|
- // 确保WebView控制器已初始化
|
|
|
|
|
- if (!this.webViewController) {
|
|
|
|
|
- this.webViewController = new webview.WebviewController();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 从ConfigManager获取更新日志配置
|
|
|
|
|
+ this.loadUpdateLogConfig();
|
|
|
|
|
+
|
|
|
|
|
+ console.info('OnlineUpdateLogDialog 开始加载更新日志配置');
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('OnlineUpdateLogDialog aboutToAppear error:', error);
|
|
console.error('OnlineUpdateLogDialog aboutToAppear error:', error);
|
|
|
this.errorMessage = '初始化失败';
|
|
this.errorMessage = '初始化失败';
|
|
@@ -64,12 +53,39 @@ export default struct OnlineUpdateLog {
|
|
|
*/
|
|
*/
|
|
|
private getCurrentVersion() {
|
|
private getCurrentVersion() {
|
|
|
try {
|
|
try {
|
|
|
- this.currentVersion = AppUtil.getVersionName()//UpdateConstants.APP_VERSION;
|
|
|
|
|
|
|
+ this.currentVersion = AppUtil.getVersionName();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
this.currentVersion = '1.0.0';
|
|
this.currentVersion = '1.0.0';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从ConfigManager加载更新日志配置
|
|
|
|
|
+ */
|
|
|
|
|
+ private loadUpdateLogConfig() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.isLoading = true;
|
|
|
|
|
+ this.errorMessage = '';
|
|
|
|
|
+
|
|
|
|
|
+ // 从ConfigManager获取更新日志配置
|
|
|
|
|
+ const configData = ConfigManager.getConfig('update_log_config', null);
|
|
|
|
|
+
|
|
|
|
|
+ if (configData) {
|
|
|
|
|
+ this.updateLogConfig = configData as UpdateLogConfigType;
|
|
|
|
|
+ this.isLoading = false;
|
|
|
|
|
+ console.info('OnlineUpdateLogDialog 成功加载更新日志配置', JSON.stringify(this.updateLogConfig));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.errorMessage = '未找到更新日志配置';
|
|
|
|
|
+ this.isLoading = false;
|
|
|
|
|
+ console.warn('OnlineUpdateLogDialog 未找到更新日志配置');
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('OnlineUpdateLogDialog 加载更新日志配置失败:', error);
|
|
|
|
|
+ this.errorMessage = '加载配置失败';
|
|
|
|
|
+ this.isLoading = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 记录已显示的版本,避免重复显示
|
|
* 记录已显示的版本,避免重复显示
|
|
|
*/
|
|
*/
|
|
@@ -88,10 +104,7 @@ export default struct OnlineUpdateLog {
|
|
|
aboutToDisappear() {
|
|
aboutToDisappear() {
|
|
|
try {
|
|
try {
|
|
|
console.info('OnlineUpdateLogDialog aboutToDisappear');
|
|
console.info('OnlineUpdateLogDialog aboutToDisappear');
|
|
|
- // 清理WebView控制器
|
|
|
|
|
- if (this.webViewController) {
|
|
|
|
|
- // 这里可以添加WebView的清理逻辑,如果需要的话
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 清理资源
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('OnlineUpdateLogDialog aboutToDisappear error:', error);
|
|
console.error('OnlineUpdateLogDialog aboutToDisappear error:', error);
|
|
|
}
|
|
}
|
|
@@ -99,40 +112,70 @@ export default struct OnlineUpdateLog {
|
|
|
|
|
|
|
|
build() {
|
|
build() {
|
|
|
Column() {
|
|
Column() {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // 版本信息和进度条
|
|
|
|
|
|
|
+ // 标题区域 - 优化设计
|
|
|
Column() {
|
|
Column() {
|
|
|
- // 进度条 - 使用主题色
|
|
|
|
|
- if (this.progressVisible && this.progressValue < 100) {
|
|
|
|
|
- Column() {
|
|
|
|
|
- Progress({ value: this.progressValue, total: 100, type: ProgressType.Linear })
|
|
|
|
|
- .width('100%')
|
|
|
|
|
- .height(4)
|
|
|
|
|
- .color(this.themeColor)
|
|
|
|
|
- .backgroundColor(this.isDarkMode ? '#4A4A4A' : '#E0E0E0')
|
|
|
|
|
- .borderRadius(2)
|
|
|
|
|
-
|
|
|
|
|
- Text(`加载中... ${this.progressValue}%`)
|
|
|
|
|
- .fontSize(10)
|
|
|
|
|
- .fontColor(this.isDarkMode ? '#E0E0E0' : Color.Gray)
|
|
|
|
|
- .margin({ top: 4 })
|
|
|
|
|
- .alignSelf(ItemAlign.End)
|
|
|
|
|
- }
|
|
|
|
|
- .width('100%')
|
|
|
|
|
|
|
+ // 图标装饰
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ Text('📋')
|
|
|
|
|
+ .fontSize(24)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width(48)
|
|
|
|
|
+ .height(48)
|
|
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
|
|
+ .borderRadius(24)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ .shadow({
|
|
|
|
|
+ radius: 8,
|
|
|
|
|
+ color: this.themeColor + '30',
|
|
|
|
|
+ offsetX: 0,
|
|
|
|
|
+ offsetY: 2
|
|
|
|
|
+ })
|
|
|
|
|
+ .margin({ bottom: 12 })
|
|
|
|
|
+
|
|
|
|
|
+ if (this.updateLogConfig?.title) {
|
|
|
|
|
+ Text(this.updateLogConfig.title)
|
|
|
|
|
+ .fontSize(20)
|
|
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? Color.White : '#1A1A1A')
|
|
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
|
|
+ .margin({ bottom: 8 })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 当前版本信息 - 带背景的标签样式
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Text('当前版本')
|
|
|
|
|
+ .fontSize(11)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#B0B0B0' : '#666666')
|
|
|
|
|
+ .margin({ right: 6 })
|
|
|
|
|
+
|
|
|
|
|
+ Text(this.currentVersion)
|
|
|
|
|
+ .fontSize(12)
|
|
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
|
|
+ .fontColor(Color.White)
|
|
|
|
|
+ .padding({ left: 8, right: 8, top: 2, bottom: 2 })
|
|
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
|
|
+ .borderRadius(10)
|
|
|
}
|
|
}
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
- .padding({ left: 20, right: 20, top: 12, bottom: 8 })
|
|
|
|
|
- .backgroundColor(this.isDarkMode ? '#3A3A3A' : '#F8F9FA')
|
|
|
|
|
|
|
+ .padding({ left: 24, right: 24, top: 20, bottom: 16 })
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#2A2A2A' : Color.White)
|
|
|
.borderRadius({
|
|
.borderRadius({
|
|
|
- topLeft: 0,
|
|
|
|
|
- topRight: 0,
|
|
|
|
|
- bottomLeft: 8,
|
|
|
|
|
- bottomRight: 8
|
|
|
|
|
|
|
+ topLeft: 12,
|
|
|
|
|
+ topRight: 12,
|
|
|
|
|
+ bottomLeft: 0,
|
|
|
|
|
+ bottomRight: 0
|
|
|
|
|
+ })
|
|
|
|
|
+ .shadow({
|
|
|
|
|
+ radius: 4,
|
|
|
|
|
+ color: this.isDarkMode ? 'rgba(0,0,0,0.3)' : 'rgba(0,0,0,0.08)',
|
|
|
|
|
+ offsetX: 0,
|
|
|
|
|
+ offsetY: 2
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // WebView内容区域 - 完全参考WebIndex.ets的实现
|
|
|
|
|
|
|
+ // 内容区域
|
|
|
if (this.errorMessage) {
|
|
if (this.errorMessage) {
|
|
|
// 错误状态
|
|
// 错误状态
|
|
|
Column() {
|
|
Column() {
|
|
@@ -151,20 +194,20 @@ export default struct OnlineUpdateLog {
|
|
|
width: 1,
|
|
width: 1,
|
|
|
color: this.isDarkMode ? '#666666' : '#FED7D7'
|
|
color: this.isDarkMode ? '#666666' : '#FED7D7'
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Text('加载失败')
|
|
Text('加载失败')
|
|
|
.fontSize(16)
|
|
.fontSize(16)
|
|
|
.fontColor(this.isDarkMode ? Color.White : Color.Black)
|
|
.fontColor(this.isDarkMode ? Color.White : Color.Black)
|
|
|
.fontWeight(FontWeight.Medium)
|
|
.fontWeight(FontWeight.Medium)
|
|
|
.margin({ top: 16 })
|
|
.margin({ top: 16 })
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Text(this.errorMessage)
|
|
Text(this.errorMessage)
|
|
|
.fontSize(12)
|
|
.fontSize(12)
|
|
|
.fontColor(this.isDarkMode ? '#E0E0E0' : Color.Gray)
|
|
.fontColor(this.isDarkMode ? '#E0E0E0' : Color.Gray)
|
|
|
.margin({ top: 8, left: 20, right: 20 })
|
|
.margin({ top: 8, left: 20, right: 20 })
|
|
|
.textAlign(TextAlign.Center)
|
|
.textAlign(TextAlign.Center)
|
|
|
.maxLines(3)
|
|
.maxLines(3)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Button('重试')
|
|
Button('重试')
|
|
|
.fontSize(14)
|
|
.fontSize(14)
|
|
|
.backgroundColor(this.themeColor)
|
|
.backgroundColor(this.themeColor)
|
|
@@ -175,14 +218,8 @@ export default struct OnlineUpdateLog {
|
|
|
.margin({ top: 20 })
|
|
.margin({ top: 20 })
|
|
|
.onClick(() => {
|
|
.onClick(() => {
|
|
|
try {
|
|
try {
|
|
|
- this.errorMessage = '';
|
|
|
|
|
- this.isLoading = true;
|
|
|
|
|
- this.progressValue = 0;
|
|
|
|
|
- this.progressVisible = true;
|
|
|
|
|
- // 重新加载
|
|
|
|
|
- if (this.webViewController) {
|
|
|
|
|
- this.webViewController.refresh();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 重新加载配置
|
|
|
|
|
+ this.loadUpdateLogConfig();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('OnlineUpdateLogDialog 重试失败:', error);
|
|
console.error('OnlineUpdateLogDialog 重试失败:', error);
|
|
|
this.errorMessage = '重试失败,请稍后再试';
|
|
this.errorMessage = '重试失败,请稍后再试';
|
|
@@ -195,70 +232,276 @@ export default struct OnlineUpdateLog {
|
|
|
.alignItems(HorizontalAlign.Center)
|
|
.alignItems(HorizontalAlign.Center)
|
|
|
.padding(20)
|
|
.padding(20)
|
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2C' : Color.White)
|
|
.backgroundColor(this.isDarkMode ? '#2C2C2C' : Color.White)
|
|
|
|
|
+ } else if (this.isLoading) {
|
|
|
|
|
+ // 加载状态 - 优化设计
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ // 加载动画
|
|
|
|
|
+ LoadingProgress()
|
|
|
|
|
+ .width(48)
|
|
|
|
|
+ .height(48)
|
|
|
|
|
+ .color(this.themeColor)
|
|
|
|
|
+ .margin({ bottom: 20 })
|
|
|
|
|
+
|
|
|
|
|
+ Text('正在加载更新日志...')
|
|
|
|
|
+ .fontSize(16)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#F0F0F0' : '#2A2A2A')
|
|
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
|
|
+ .margin({ bottom: 8 })
|
|
|
|
|
+
|
|
|
|
|
+ Text('请稍候')
|
|
|
|
|
+ .fontSize(13)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#B0B0B0' : '#888888')
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height(400)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#1E1E1E' : '#F5F7FA')
|
|
|
|
|
+ .borderRadius({
|
|
|
|
|
+ topLeft: 0,
|
|
|
|
|
+ topRight: 0,
|
|
|
|
|
+ bottomLeft: 12,
|
|
|
|
|
+ bottomRight: 12
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
- // WebView内容 - 完全按照WebIndex.ets的方式实现
|
|
|
|
|
- Web({
|
|
|
|
|
- src: this.updateLogUrl,
|
|
|
|
|
- controller: this.webViewController
|
|
|
|
|
|
|
+ // 更新日志内容
|
|
|
|
|
+ if (!this.updateLogConfig || !this.updateLogConfig.logs || this.updateLogConfig.logs.length === 0) {
|
|
|
|
|
+ // 无数据状态 - 优化设计
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ // 空状态图标
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ Text('📋')
|
|
|
|
|
+ .fontSize(36)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width(80)
|
|
|
|
|
+ .height(80)
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#3A3A3A' : '#F5F7FA')
|
|
|
|
|
+ .borderRadius(40)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ .margin({ bottom: 20 })
|
|
|
|
|
+ .shadow({
|
|
|
|
|
+ radius: 8,
|
|
|
|
|
+ color: this.isDarkMode ? 'rgba(0,0,0,0.3)' : 'rgba(0,0,0,0.06)',
|
|
|
|
|
+ offsetX: 0,
|
|
|
|
|
+ offsetY: 4
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ Text('暂无更新日志')
|
|
|
|
|
+ .fontSize(18)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#F0F0F0' : '#2A2A2A')
|
|
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
|
|
+ .margin({ bottom: 8 })
|
|
|
|
|
+
|
|
|
|
|
+ Text('当前版本已是最新内容')
|
|
|
|
|
+ .fontSize(13)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#B0B0B0' : '#888888')
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height(400)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#1E1E1E' : '#F5F7FA')
|
|
|
|
|
+ .borderRadius({
|
|
|
|
|
+ topLeft: 0,
|
|
|
|
|
+ topRight: 0,
|
|
|
|
|
+ bottomLeft: 12,
|
|
|
|
|
+ bottomRight: 12
|
|
|
})
|
|
})
|
|
|
- .width('100%')
|
|
|
|
|
- .height(350)
|
|
|
|
|
- .borderRadius(12)
|
|
|
|
|
- .layoutWeight(1)
|
|
|
|
|
- .backgroundColor(this.isDarkMode ? '#2C2C2C' : Color.White)
|
|
|
|
|
- // .border({
|
|
|
|
|
- // width: 1,
|
|
|
|
|
- // color: this.isDarkMode ? '#333333' : '#E0E0E0'
|
|
|
|
|
- // })
|
|
|
|
|
- .margin({ left: 12, right: 12, bottom: 8 })
|
|
|
|
|
- .darkMode(this.isDarkMode ? WebDarkMode.On : WebDarkMode.Off)
|
|
|
|
|
- .forceDarkAccess(this.isDarkMode)
|
|
|
|
|
- .onProgressChange((event) => {
|
|
|
|
|
- if (event) {
|
|
|
|
|
- console.info('OnlineUpdateLogDialog WebView进度:', event.newProgress);
|
|
|
|
|
- this.progressValue = event.newProgress;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 更新日志列表 - 优化设计
|
|
|
|
|
+ Scroll() {
|
|
|
|
|
+ Column({ space: 20 }) {
|
|
|
|
|
+ ForEach(this.updateLogConfig.logs, (logItem: UpdateLogItemType, index: number) => {
|
|
|
|
|
+ this.buildLogItemCard(logItem, index)
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- // 进度完成时隐藏进度条
|
|
|
|
|
- if (event.newProgress >= 100) {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.progressVisible = false;
|
|
|
|
|
- this.isLoading = false;
|
|
|
|
|
- }, 500);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 底部间距
|
|
|
|
|
+ Column()
|
|
|
|
|
+ .height(20)
|
|
|
}
|
|
}
|
|
|
|
|
+ .padding({ left: 20, right: 20, top: 16, bottom: 4 })
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height(400)
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#1E1E1E' : '#F5F7FA')
|
|
|
|
|
+ .borderRadius({
|
|
|
|
|
+ topLeft: 0,
|
|
|
|
|
+ topRight: 0,
|
|
|
|
|
+ bottomLeft: 12,
|
|
|
|
|
+ bottomRight: 12
|
|
|
})
|
|
})
|
|
|
- .onPageBegin(() => {
|
|
|
|
|
- console.info('OnlineUpdateLogDialog WebView开始加载:', this.updateLogUrl);
|
|
|
|
|
- this.isLoading = true;
|
|
|
|
|
- this.errorMessage = '';
|
|
|
|
|
- this.progressValue = 0;
|
|
|
|
|
- this.progressVisible = true;
|
|
|
|
|
- })
|
|
|
|
|
- .onPageEnd(() => {
|
|
|
|
|
- console.info('OnlineUpdateLogDialog WebView加载完成');
|
|
|
|
|
- this.isLoading = false;
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.progressVisible = false;
|
|
|
|
|
- }, 1000);
|
|
|
|
|
- })
|
|
|
|
|
- .onErrorReceive((event) => {
|
|
|
|
|
- const errorInfo = event?.error?.getErrorInfo() || '网络错误';
|
|
|
|
|
- console.error('OnlineUpdateLogDialog WebView加载错误:', errorInfo);
|
|
|
|
|
- this.isLoading = false;
|
|
|
|
|
- this.progressVisible = false;
|
|
|
|
|
- this.errorMessage = `加载失败:${errorInfo}`;
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ .scrollable(ScrollDirection.Vertical)
|
|
|
|
|
+ .scrollBar(BarState.Auto)
|
|
|
|
|
+ .edgeEffect(EdgeEffect.Spring)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .backgroundColor(this.isDarkMode ? '#2C2C2C' : Color.White)
|
|
|
|
|
- .borderRadius(12)
|
|
|
|
|
- .width('92%')
|
|
|
|
|
- .constraintSize({ maxHeight: '85%' })
|
|
|
|
|
|
|
+ .backgroundColor('transparent')
|
|
|
|
|
+ .borderRadius(16)
|
|
|
|
|
+ .width('95%')
|
|
|
|
|
+ .constraintSize({ maxHeight: '88%' })
|
|
|
|
|
+ .shadow({
|
|
|
|
|
+ radius: 24,
|
|
|
|
|
+ color: this.isDarkMode ? 'rgba(0,0,0,0.6)' : 'rgba(0,0,0,0.12)',
|
|
|
|
|
+ offsetX: 0,
|
|
|
|
|
+ offsetY: 8
|
|
|
|
|
+ })
|
|
|
|
|
+ .clip(true)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 构建单个更新日志卡片
|
|
|
|
|
+ */
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ buildLogItemCard(logItem: UpdateLogItemType, index: number) {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ // 版本号和日期头部 - 重新设计
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ // 版本号标签
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Text('v')
|
|
|
|
|
+ .fontSize(12)
|
|
|
|
|
+ .fontColor(Color.White)
|
|
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
|
|
+ Text(logItem.version)
|
|
|
|
|
+ .fontSize(16)
|
|
|
|
|
+ .fontColor(Color.White)
|
|
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
|
|
+ }
|
|
|
|
|
+ .padding({ left: 12, right: 12, top: 6, bottom: 6 })
|
|
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
|
|
+ .borderRadius(16)
|
|
|
|
|
+ .shadow({
|
|
|
|
|
+ radius: 4,
|
|
|
|
|
+ color: this.themeColor + '40',
|
|
|
|
|
+ offsetX: 0,
|
|
|
|
|
+ offsetY: 2
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ Blank()
|
|
|
|
|
+
|
|
|
|
|
+ // 日期标签
|
|
|
|
|
+ Text(logItem.date)
|
|
|
|
|
+ .fontSize(11)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#B0B0B0' : '#888888')
|
|
|
|
|
+ .padding({ left: 8, right: 8, top: 4, bottom: 4 })
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#3A3A3A' : '#F0F0F0')
|
|
|
|
|
+ .borderRadius(8)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .margin({ bottom: 16 })
|
|
|
|
|
+
|
|
|
|
|
+ // 更新标题
|
|
|
|
|
+ if (logItem.title) {
|
|
|
|
|
+ Text(logItem.title)
|
|
|
|
|
+ .fontSize(15)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#F0F0F0' : '#1A1A1A')
|
|
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .margin({ bottom: 16 })
|
|
|
|
|
+ .lineHeight(22)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 更新内容区域
|
|
|
|
|
+ Column({ space: 12 }) {
|
|
|
|
|
+ // 新功能
|
|
|
|
|
+ if (logItem.features && logItem.features.length > 0) {
|
|
|
|
|
+ this.buildUpdateSection('✨ 新功能', logItem.features, '#FF6B6B')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 优化改进
|
|
|
|
|
+ if (logItem.improvements && logItem.improvements.length > 0) {
|
|
|
|
|
+ this.buildUpdateSection('🔧 优化改进', logItem.improvements, '#4ECDC4')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 问题修复
|
|
|
|
|
+ if (logItem.fixes && logItem.fixes.length > 0) {
|
|
|
|
|
+ this.buildUpdateSection('🐛 问题修复', logItem.fixes, '#45B7D1')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .padding(20)
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? '#2A2A2A' : Color.White)
|
|
|
|
|
+ .borderRadius(16)
|
|
|
.shadow({
|
|
.shadow({
|
|
|
- radius: 16,
|
|
|
|
|
- color: this.isDarkMode ? 'rgba(0,0,0,0.8)' : 'rgba(0,0,0,0.15)',
|
|
|
|
|
|
|
+ radius: 12,
|
|
|
|
|
+ color: this.isDarkMode ? 'rgba(0,0,0,0.4)' : 'rgba(0,0,0,0.08)',
|
|
|
offsetX: 0,
|
|
offsetX: 0,
|
|
|
offsetY: 4
|
|
offsetY: 4
|
|
|
})
|
|
})
|
|
|
|
|
+ .border({
|
|
|
|
|
+ width: 1,
|
|
|
|
|
+ color: this.isDarkMode ? '#3A3A3A' : '#F0F0F0'
|
|
|
|
|
+ })
|
|
|
|
|
+ .transition(TransitionEffect.OPACITY.animation({ duration: 300, delay: index * 100 }))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 构建更新内容分区
|
|
|
|
|
+ */
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ buildUpdateSection(title: string, items: string[], accentColor: string = this.themeColor) {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ // 分区标题 - 重新设计
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ // 左侧装饰线
|
|
|
|
|
+ Column()
|
|
|
|
|
+ .width(3)
|
|
|
|
|
+ .height(20)
|
|
|
|
|
+ .backgroundColor(accentColor)
|
|
|
|
|
+ .borderRadius(2)
|
|
|
|
|
+ .margin({ right: 8 })
|
|
|
|
|
+
|
|
|
|
|
+ Text(title)
|
|
|
|
|
+ .fontSize(14)
|
|
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#F0F0F0' : '#2A2A2A')
|
|
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .margin({ bottom: 10 })
|
|
|
|
|
+
|
|
|
|
|
+ // 分区内容列表 - 优化设计
|
|
|
|
|
+ Column({ space: 8 }) {
|
|
|
|
|
+ ForEach(items, (item: string, index: number) => {
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ // 圆点装饰
|
|
|
|
|
+ Column()
|
|
|
|
|
+ .width(6)
|
|
|
|
|
+ .height(6)
|
|
|
|
|
+ .backgroundColor(accentColor)
|
|
|
|
|
+ .borderRadius(3)
|
|
|
|
|
+ .margin({ right: 12, top: 8 })
|
|
|
|
|
+
|
|
|
|
|
+ Text(item)
|
|
|
|
|
+ .fontSize(13)
|
|
|
|
|
+ .fontColor(this.isDarkMode ? '#E0E0E0' : '#4A4A4A')
|
|
|
|
|
+ .layoutWeight(1)
|
|
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
|
|
+ .lineHeight(20)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .alignItems(VerticalAlign.Top)
|
|
|
|
|
+ .padding({ left: 8, right: 4, top: 2, bottom: 2 })
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? 'rgba(255,255,255,0.02)' : 'rgba(0,0,0,0.02)')
|
|
|
|
|
+ .borderRadius(8)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .padding({ left: 8, right: 8, top: 8, bottom: 8 })
|
|
|
|
|
+ .backgroundColor(this.isDarkMode ? 'rgba(255,255,255,0.03)' : 'rgba(0,0,0,0.02)')
|
|
|
|
|
+ .borderRadius(12)
|
|
|
|
|
+ .border({
|
|
|
|
|
+ width: 1,
|
|
|
|
|
+ color: this.isDarkMode ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.06)'
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|