refactor(hospital): 重构消息相关代码
- 修改 ApiConfig 文件,添加分号 - 重命名 ConversationBean 中的属性,首字母大写 - 移除 HosConversationVIew 中的 onLoadMore 方法 - 新增 MessageHelper工具类,用于解析和处理消息 - 优化 HttpHelper 中的 response 处理逻辑 - 在 ToolsHelper 中添加 toString 方法,用于处理 ArrayBuffer
这个提交包含在:
父节点
376d9a5fd0
当前提交
920d33e8a4
@ -272,7 +272,12 @@ export class HttpHelper {
|
||||
this.httpHandlerList.length)
|
||||
}
|
||||
if (data.responseCode === 200) {
|
||||
resolve((typeof data.result === 'string' ? JSON.parse(data.result) : data.result) as T)
|
||||
|
||||
if (typeof data.result === 'string') {
|
||||
resolve(JSON.parse(data.result) as T)
|
||||
}else{
|
||||
resolve(data.result as T)
|
||||
}
|
||||
} else {
|
||||
const err: Error = new Error()
|
||||
err.name = data.responseCode.toString()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import { BusinessError, deviceInfo } from '@kit.BasicServicesKit';
|
||||
import { HashMap } from '@kit.ArkTS';
|
||||
import { buffer, HashMap } from '@kit.ArkTS';
|
||||
import { DeviceInfo } from '../bean/DeviceInfo';
|
||||
import { common } from '@kit.AbilityKit';
|
||||
import { md5_hex } from '../util/md5';
|
||||
@ -389,6 +389,10 @@ export class ToolsHelper {
|
||||
|
||||
}
|
||||
|
||||
static toString(arrayBuffer: ArrayBuffer) {
|
||||
return buffer.from(arrayBuffer).toString('base64')
|
||||
}
|
||||
|
||||
private static setTimeOutMap: Map<string, ThrottleInterface> = new Map()
|
||||
private static uniqueIdMap = new WeakMap<Function, string>();
|
||||
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户