Przeglądaj źródła

人工翻译接口/群聊时间显示

master
jiahao 5 lat temu
rodzic
commit
687b3fdee6
4 zmienionych plików z 10 dodań i 7 usunięć
  1. +1
    -1
      lib/chat/group_chat_view.dart
  2. +6
    -3
      lib/data/chat_data_mgr.dart
  3. +2
    -2
      lib/models/ChatMsg.dart
  4. +1
    -1
      lib/utils/HttpUtil.dart

+ 1
- 1
lib/chat/group_chat_view.dart Wyświetl plik

@@ -521,7 +521,7 @@ class _GroupChatPageState extends State<GroupChatPage> {
var lastMsgTime; var lastMsgTime;
if (index < msgList.length - 1) { if (index < msgList.length - 1) {
lastMsgTime = msgList[index].time;
lastMsgTime = msgList[index+1].time;
} }
MsgModel msg = msgList[index]; MsgModel msg = msgList[index];


+ 6
- 3
lib/data/chat_data_mgr.dart Wyświetl plik

@@ -127,19 +127,22 @@ class ChatDataMgr {
int curIndex = 0; int curIndex = 0;
if (record != null && record.length > 0) { if (record != null && record.length > 0) {
print('#### 有历史聊天记录 条数 ${record.length}');
for (var i = 0; i < record.length; i++) { for (var i = 0; i < record.length; i++) {
if (record[i].time == msgModel.time) { if (record[i].time == msgModel.time) {
curIndex = i; curIndex = i;
break; break;
} }
} }
}else{
print('#### 没有聊天记录');
} }
int maxLen = min(curIndex + 1, record.length);
int maxLen = min(curIndex + 4, record.length);
print('curIndex:$curIndex maxLen:$maxLen}');
for (var i = curIndex + 1; i < maxLen; i++) { for (var i = curIndex + 1; i < maxLen; i++) {
var shortDesc = record[i].shortRecordForTranslator(); var shortDesc = record[i].shortRecordForTranslator();
print(shortDesc);
// print('shortDesc'+shortDesc['Content']);
res.add(shortDesc); res.add(shortDesc);
} }


+ 2
- 2
lib/models/ChatMsg.dart Wyświetl plik

@@ -283,8 +283,8 @@ class MsgModel {
return { return {
'SendTime': DateUtils() 'SendTime': DateUtils()
.getFormartData(timeSamp: time, format: 'yyyy:MM:dd hh:mm:ss'),
'Content': desc,
.getFormartData(timeSamp: time, format: 'yyyy-MM-dd hh:mm:ss'),
'Content': base64Encode(utf8.encode(desc)),
'UserId': from 'UserId': from
}; };
} }


+ 1
- 1
lib/utils/HttpUtil.dart Wyświetl plik

@@ -171,7 +171,7 @@ class HttpUtil {
if (CancelToken.isCancel(e)) { if (CancelToken.isCancel(e)) {
print('post请求取消! ' + e.message); print('post请求取消! ' + e.message);
} }
print('post请求发生错误$e');
print('post请求发生错误 url:$url 参数:$data 错误:$e');
if (isShowLoading) LoadingManage().closeLoading(); if (isShowLoading) LoadingManage().closeLoading();
showToast(I18n.of(Constants.getCurrentContext()).server_error_tips); showToast(I18n.of(Constants.getCurrentContext()).server_error_tips);
if (failback != null) failback(); if (failback != null) failback();


Ładowanie…
Anuluj
Zapisz