From e5a9153f745dae2f72c19705808b6db1256c4d59 Mon Sep 17 00:00:00 2001 From: jiahao <283739569@qq.com> Date: Thu, 26 Mar 2020 16:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E8=BD=AC?= =?UTF-8?q?=E5=8F=91=E9=94=99=E8=AF=AF/=E7=A6=81=E6=AD=A2=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=B6=88=E6=81=AF=E8=BD=AC=E5=8F=91/=E6=8F=90?= =?UTF-8?q?=E6=AC=BE=E8=A7=84=E5=88=99=E5=9F=9F=E5=90=8D=E4=BF=AE=E6=94=B9?= =?UTF-8?q?/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/chat/ChatPage.dart | 8 +++++++- lib/chat/ChatPageItem.dart | 25 ++++++++++++++++++++----- lib/chat/group_chat_item.dart | 20 ++++++++++++++------ lib/chat/group_chat_view.dart | 8 +++++++- lib/home/MoneyPage.dart | 3 ++- lib/home/service_view.dart | 2 +- lib/utils/HttpUtil.dart | 4 ++-- lib/utils/upload_util.dart | 5 +++++ 8 files changed, 58 insertions(+), 17 deletions(-) diff --git a/lib/chat/ChatPage.dart b/lib/chat/ChatPage.dart index 4b442c8..1a33fd9 100644 --- a/lib/chat/ChatPage.dart +++ b/lib/chat/ChatPage.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:io'; +import 'package:chat/utils/upload_util.dart'; import 'package:fixnum/fixnum.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:chat/chat/translate_state.dart'; @@ -215,7 +216,12 @@ class _ChatPageState extends State { MsgModel msg = MsgHandler.createSendMsg( ChatType.valueOf(originMsg.msgType), originMsg.msgContent); msg.extraInfo = originMsg.extraInfo; - msg.extraFile = originMsg.extraFile; + if(originMsg.extraFile.contains('http')){ + msg.extraFile = originMsg.extraFile; + }else{ + msg.extraFile = UploadUtil().getFullUrl(originMsg.extraFile, originMsg.sessionId, originMsg.channelType); + } + msg.localFile = originMsg.localFile; msg.friendId = widget.friendId; if (msg.localFile != null) { diff --git a/lib/chat/ChatPageItem.dart b/lib/chat/ChatPageItem.dart index 6e75478..b909cde 100644 --- a/lib/chat/ChatPageItem.dart +++ b/lib/chat/ChatPageItem.dart @@ -629,7 +629,7 @@ class _ChatPageItemState extends State List actions = [ I18n.of(context).delete, I18n.of(context).reply, - I18n.of(context).forward + ]; actionsFunc.add(() { @@ -639,10 +639,25 @@ class _ChatPageItemState extends State print('发送引用的消息'); MessageMgr().emit('Reply Select Message', widget.msg); }); - actionsFunc.add(() { - print('转发消息'); - AppNavigator.pushForwardPage(context, widget.msg); - }); + + + ///转发 + if (widget.msg.msgType == ChatType.TextChatType.value|| + widget.msg.msgType == ChatType.ImageChatType.value|| + widget.msg.msgType == ChatType.ShortVideoChatType.value|| + widget.msg.msgType == ChatType.PlaceChatType.value|| + widget.msg.msgType == ChatType.EmoticonType.value|| + widget.msg.msgType == ChatType.FileChatType.value + ){ + actions.add( I18n.of(context).forward); + actionsFunc.add(() { + print('转发消息'); + AppNavigator.pushForwardPage(context, widget.msg); + }); + } + + + if (widget.msg.msgType == ChatType.FileChatType.value &&widget.msg.localFile!=null) { diff --git a/lib/chat/group_chat_item.dart b/lib/chat/group_chat_item.dart index 01f630d..72980ee 100644 --- a/lib/chat/group_chat_item.dart +++ b/lib/chat/group_chat_item.dart @@ -574,7 +574,6 @@ class _GroupChatPageItemState extends State List actionsFunc = []; List actions = [ I18n.of(context).reply, - I18n.of(context).forward, I18n.of(context).delete, ]; @@ -582,16 +581,25 @@ class _GroupChatPageItemState extends State print('发送引用的消息'); MessageMgr().emit('Reply Select Message', widget.msg); }); - actionsFunc.add(() { - print('转发消息'); - AppNavigator.pushForwardPage(context, widget.msg); - }); actionsFunc.add(() { MessageMgr().emit('Delete Select Message', widget.msg); }); - + ///转发 + if (widget.msg.msgType == ChatType.TextChatType.value|| + widget.msg.msgType == ChatType.ImageChatType.value|| + widget.msg.msgType == ChatType.ShortVideoChatType.value|| + widget.msg.msgType == ChatType.PlaceChatType.value|| + widget.msg.msgType == ChatType.EmoticonType.value|| + widget.msg.msgType == ChatType.FileChatType.value + ){ + actions.add( I18n.of(context).forward); + actionsFunc.add(() { + print('转发消息'); + AppNavigator.pushForwardPage(context, widget.msg); + }); + } if (widget.msg.msgType == ChatType.FileChatType.value &&widget.msg.localFile!=null) { diff --git a/lib/chat/group_chat_view.dart b/lib/chat/group_chat_view.dart index bb42964..631d9c7 100644 --- a/lib/chat/group_chat_view.dart +++ b/lib/chat/group_chat_view.dart @@ -23,6 +23,7 @@ import 'package:chat/utils/screen.dart'; import 'package:chat/utils/sound_util.dart'; import 'package:chat/utils/sp_utils.dart'; import 'package:chat/utils/sql_util.dart'; +import 'package:chat/utils/upload_util.dart'; import 'package:extended_text/extended_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -111,7 +112,12 @@ class _GroupChatPageState extends State { ChatType.valueOf(originMsg.msgType), originMsg.msgContent, channelType: ChatChannelType.Group); msg.extraInfo = originMsg.extraInfo; - msg.extraFile = originMsg.extraFile; +// msg.extraFile = originMsg.extraFile; + if(originMsg.extraFile.contains('http')){ + msg.extraFile = originMsg.extraFile; + }else{ + msg.extraFile = UploadUtil().getFullUrl(originMsg.extraFile, originMsg.sessionId, originMsg.channelType); + } msg.localFile = originMsg.localFile; if (msg.localFile != null) { msg.state = MsgState.Uploaded; diff --git a/lib/home/MoneyPage.dart b/lib/home/MoneyPage.dart index 3d8500c..ab8f7e8 100644 --- a/lib/home/MoneyPage.dart +++ b/lib/home/MoneyPage.dart @@ -684,9 +684,10 @@ class MoneyPageState extends State ], ), InkWell( + onTap: () { launch( - "https://datasm.chengyouhd.com/zh-CN/Home/WithdrawalRole?language=${UserData().language}"); + "http://datechatagent.chengyouhd.com/zh-CN/Home/WithdrawalRole?language=${UserData().language}"); }, child: Container( margin: EdgeInsets.only(top: 25, bottom: 10, left: 13.5), diff --git a/lib/home/service_view.dart b/lib/home/service_view.dart index 71a54c7..6437f9a 100644 --- a/lib/home/service_view.dart +++ b/lib/home/service_view.dart @@ -31,7 +31,7 @@ class ServiceMsgModel { ServiceMsgModel({this.isMe, this.msg}); } -class ServiceCenterPage extends StatefulWidget { +class ServiceCenterPage extends StatefulWidget { final int questionIndex; ServiceCenterPage({this.questionIndex = -1}); diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 7661a77..86d44dd 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -44,9 +44,9 @@ class HttpUtil { //static const String BaseUrl = 'http://192.168.0.223:7001/'; //static const String BaseUrl = 'http://192.168.0.207:9080/'; -// static const String BaseUrl = 'http://120.79.107.63:9080/'; + static const String BaseUrl = 'http://120.79.107.63:9080/'; //static const String BaseUrl = 'http://192.168.0.177:9016/'; - static const String BaseUrl = 'https://datasm.chengyouhd.com/'; +// static const String BaseUrl = 'https://datasm.chengyouhd.com/'; static HttpUtil _getInstance() { if (_instance == null) { diff --git a/lib/utils/upload_util.dart b/lib/utils/upload_util.dart index 3580f9c..f6e2a7f 100644 --- a/lib/utils/upload_util.dart +++ b/lib/utils/upload_util.dart @@ -199,7 +199,12 @@ class UploadUtil { Future downloadFile(MsgModel msg, {CancelToken cancelToken}) async { Response response; + + var fullUrl = getFullUrl(msg.extraFile, msg.sessionId, msg.channelType); + if(msg.extraFile.contains('http://')){ + fullUrl = msg.extraFile; + } print('下载文件$fullUrl');