Explorar o código

refactor(hospital): 重构会话列表界面

- 修改会话列表项的布局和样式
- 增加患者信息和消息预览功能
- 优化数据处理逻辑,提高列表加载效率- 修复了一些与消息解析和时间格式化相关的小问题
徐勤民 hai 1 mes
pai
achega
0dcbae9adc
Modificáronse 2 ficheiros con 6 adicións e 2 borrados
  1. 3 0
      src/main/ets/utils/TimeHelper.ts
  2. 3 2
      src/main/ets/utils/ToolsHelper.ets

+ 3 - 0
src/main/ets/utils/TimeHelper.ts

@@ -45,6 +45,9 @@ export class TimeHelper {
     };
     return format.replace(/yyyy|MM|dd|HH|mm|ss/g, matched => replacements[matched]);
   }
+  static formatDateForTime(time: number, format: string) {
+    return this.formatDate(new Date(time), format);
+  }
 
   /**
    * 获取月份天数

+ 3 - 2
src/main/ets/utils/ToolsHelper.ets

@@ -1,6 +1,6 @@
 import promptAction from '@ohos.promptAction';
 import { BusinessError, deviceInfo } from '@kit.BasicServicesKit';
-import { buffer, HashMap } from '@kit.ArkTS';
+import { HashMap, util } from '@kit.ArkTS';
 import { DeviceInfo } from '../bean/DeviceInfo';
 import { common } from '@kit.AbilityKit';
 import { md5_hex } from '../util/md5';
@@ -390,7 +390,8 @@ export class ToolsHelper {
   }
 
   static toString(arrayBuffer: ArrayBuffer) {
-    return buffer.from(arrayBuffer).toString('base64')
+    let decoder = util.TextDecoder.create('utf-8');
+    return decoder.decodeToString(new Uint8Array(arrayBuffer))
   }
 
   private static setTimeOutMap: Map<string, ThrottleInterface> = new Map()