Explorar el Código

修改用户反馈

master
jiahao hace 5 años
padre
commit
cab60f08e8
Se han modificado 6 ficheros con 126 adiciones y 56 borrados
  1. +27
    -0
      ios/Runner.xcodeproj/project.pbxproj
  2. +1
    -3
      lib/chat/ChatPageItem.dart
  3. +90
    -46
      lib/chat/company_server_view.dart
  4. +2
    -3
      lib/chat/group_chat_item.dart
  5. +1
    -1
      lib/home/last_chat_record_widget.dart
  6. +5
    -3
      lib/utils/HttpUtil.dart

+ 27
- 0
ios/Runner.xcodeproj/project.pbxproj Ver fichero

@@ -222,6 +222,7 @@
5C95C08A2406514F00CEBCE3 /* Sources */,
5C95C08B2406514F00CEBCE3 /* Frameworks */,
5C95C08C2406514F00CEBCE3 /* Resources */,
5CBED0B8243600130095B03C /* ShellScript */,
);
buildRules = (
);
@@ -381,6 +382,23 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
5CBED0B8243600130095B03C /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/\"\nif [[ -d \"Frameworks\" ]]; then \n rm -fr Frameworks\nfi\n";
};
74E44EF25DBCD813164B0D15 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -544,6 +562,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = QJ9M3998Q6;
EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = YES;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -570,6 +589,7 @@
5C95C09A2406514F00CEBCE3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
@@ -580,6 +600,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = QJ9M3998Q6;
EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = NO;
ENABLE_BITCODE = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share Extension/Info.plist";
@@ -602,6 +623,7 @@
5C95C09B2406514F00CEBCE3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
@@ -612,6 +634,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = QJ9M3998Q6;
EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = NO;
ENABLE_BITCODE = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share Extension/Info.plist";
@@ -632,6 +655,7 @@
5C95C09C2406514F00CEBCE3 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
@@ -642,6 +666,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = QJ9M3998Q6;
EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = NO;
ENABLE_BITCODE = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share Extension/Info.plist";
@@ -779,6 +804,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = YES;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -813,6 +839,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = QJ9M3998Q6;
EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = YES;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",


+ 1
- 3
lib/chat/ChatPageItem.dart Ver fichero

@@ -434,9 +434,7 @@ class _ChatPageItemState extends State<ChatPageItem>
quoteItem['showTimeStr'], quoteItem['quoteContent'], true));
}
var contentWidth = _getTextWidth(textList[curTextType]);
if (contentWidth > width && contentWidth <= maxWidth) {
width = contentWidth;
}
width = min(max(contentWidth, width),maxWidth);
showMsg.add(Container(
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22),


+ 90
- 46
lib/chat/company_server_view.dart Ver fichero

@@ -2,6 +2,7 @@ import 'dart:io';
import 'dart:typed_data';
import 'package:chat/chat/ChatPageItem.dart';
import 'package:chat/data/UserData.dart';
import 'package:chat/data/chat_data_mgr.dart';
import 'package:chat/data/constants.dart';
import 'package:chat/generated/i18n.dart';
@@ -11,11 +12,13 @@ import 'package:chat/proto/chat.pb.dart';
import 'package:chat/r.dart';
import 'package:chat/utils/CustomUI.dart';
import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/TokenMgr.dart';
import 'package:chat/utils/file_cache_mgr.dart';
import 'package:chat/utils/image_util.dart';
import 'package:chat/utils/keyboard_utils.dart';
import 'package:chat/utils/msgHandler.dart';
import 'package:chat/utils/screen.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -31,7 +34,7 @@ class CompanyServerPage extends StatefulWidget {
class _CompanyServerPageState extends State<CompanyServerPage> {
final TextEditingController _textCtrl = TextEditingController();
FocusNode editFocus = NoKeyboardEditableTextFocusNode();
bool _isComposingMessage = false;
// bool _isComposingMessage = false;
double keyboardHeight;
KeyboardBloc _bloc = KeyboardBloc();
@@ -42,6 +45,8 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
static int companyId = 10000;
final ValueNotifier<bool> updateProgress = ValueNotifier<bool>(false);
UserInfo companyInfo = UserInfo(
userId: companyId,
headimgurl: R.assetsImagesServerIcon,
@@ -123,7 +128,7 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
friendId: companyId, channelType: ChatChannelType.CSD);
setState(() {
_isComposingMessage = _textCtrl.text.length > 0;
updateProgress.value = _textCtrl.text.length > 0;
});
sendMsg(msg);
@@ -165,16 +170,46 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
),
);
// if (resultList != null && resultList.length > 0) {
// for (var i = 0; i < resultList.length; i++) {
// Asset photoEntity = resultList[i];
// ByteData byteData = await photoEntity.getByteData();
// File file = await FileCacheMgr().writeFile('temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', byteData.buffer.asInt8List(0));
// _sendPhotoFile(file);
// }
// }
if (resultList != null && resultList.length > 0) {
List<File> fileList = [];
for (var i = 0; i < resultList.length; i++) {
Asset photoEntity = resultList[i];
print('名字:${photoEntity.name}');
ByteData byteData = await photoEntity.getByteData();
File file = await FileCacheMgr().writeFile('temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', byteData.buffer.asInt8List(0));
_sendPhotoFile(file);
fileList.add(file);
}
print('文件列表${fileList.length}');
Map data = {"type": 3, "userId": UserData().basicInfo.userId};
data['sign'] = TokenMgr().getSign(data);
Response res = await HttpUtil().uploadFiles(
fileList, data, 'upload/post/postfiles', 'image',
isShowLoading: true);
var resData = res.data;
if (resData['code'] == 0 && resData['msg'] != null) {
List<String> imgUrlList = [];
imgUrlList.addAll(resData['msg'].split("|"));
for(int k=0;k<imgUrlList.length;k++){
_sendPhotoFile(fileList[k],imgUrlList[k]);
}
setState(() {});
}
}
} on Exception catch (e) {
print(e.toString());
}
@@ -196,33 +231,36 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
// }
}
void _sendPhotoFile(File imgFile) async {
var imgSize = await imgFile.length();
void _sendPhotoFile(File imgFile,String imageUrl) async {
// var imgSize = await imgFile.length();
//
// print('图片大小:${imgSize / 1024}KB');
// var sendImg;
//
// if (imgSize > 33 * 1024 * 1024) {
// showToast(I18n.of(context).video_more_big);
// return;
// }
// bool isNeedUpload = false;
// if (imgSize > ImgSizeLimit) {
// print('图片大于 $ImgSizeLimit,压缩');
// //发送压缩图
// sendImg = await WidgetUtil.getCompressImg(imgFile.absolute.path );
// isNeedUpload = true;
// } else {
// sendImg = imgFile.readAsBytesSync();
// }
print('图片大小:${imgSize / 1024}KB');
var sendImg;
if (imgSize > 33 * 1024 * 1024) {
showToast(I18n.of(context).video_more_big);
return;
}
bool isNeedUpload = false;
if (imgSize > ImgSizeLimit) {
print('图片大于 $ImgSizeLimit,压缩');
//发送压缩图
sendImg = await WidgetUtil.getCompressImg(imgFile.absolute.path );
isNeedUpload = true;
} else {
sendImg = imgFile.readAsBytesSync();
}
var sendImg = imgFile.readAsBytesSync();
var rect = await WidgetUtil.getImageWH(
image: Image.memory(Uint8List.fromList(sendImg)));
print('图片大小 Rect : $rect');
int aspectRatio = rect.width * 100 ~/ rect.height;
var msg = MsgHandler.createSendMsg(ChatType.ImageChatType, sendImg,
localFile: isNeedUpload ? imgFile.absolute.path : null,
var msg = MsgHandler.createSendMsg(ChatType.ImageChatType, imageUrl,
localFile: imgFile.absolute.path,
extra: aspectRatio,
friendId: companyId,
channelType: ChatChannelType.CSD);
@@ -235,9 +273,7 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
child: TextField(
keyboardAppearance: Brightness.light,
onChanged: (String messageText) {
setState(() {
_isComposingMessage = _textCtrl.text.length > 0;
});
updateProgress.value = _textCtrl.text.length > 0;
},
cursorColor: Constants.BlueTextColor,
style: TextStyle(
@@ -262,25 +298,28 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
),
);
return GestureDetector(
onTap: () {
print('放置触控隐藏键盘');
},
child: Container(
width: Screen.width,
color: Colors.white,
return ValueListenableBuilder(
builder: (BuildContext context, bool isComp,
Widget child) {
return GestureDetector(
onTap: () {
print('放置触控隐藏键盘');
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 7),
alignment: Alignment.topCenter,
decoration: BoxDecoration(
color: Colors.white,
border: Border(top: BorderSide(color: Color(0xFFDFDFDF)))),
child: Row(
children: <Widget>[
//输入框
Expanded(child: input), SizedBox(width: 10),
_isComposingMessage
? InkWell(
width: Screen.width,
color: Colors.white,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 7),
alignment: Alignment.topCenter,
decoration: BoxDecoration(
color: Colors.white,
border: Border(top: BorderSide(color: Color(0xFFDFDFDF)))),
child: Row(
children: <Widget>[
//输入框
Expanded(child: input), SizedBox(width: 10),
isComp
? InkWell(
child: Padding(
padding: EdgeInsets.fromLTRB(50, 2, 10, 2),
child: Icon(
@@ -289,7 +328,7 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
size: 28,
)),
onTap: _sendTextMessage)
: InkWell(
: InkWell(
child: Icon(
IconData(0xe60c,
fontFamily: Constants.IconFontFamily),
@@ -299,8 +338,13 @@ class _CompanyServerPageState extends State<CompanyServerPage> {
onTap: () {
_openPhotoView();
}),
],
))));
],
))))
;
},
valueListenable: updateProgress,
);
}
Widget _buildMessageList() {


+ 2
- 3
lib/chat/group_chat_item.dart Ver fichero

@@ -397,9 +397,8 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
quoteItem['showTimeStr'], quoteItem['quoteContent'], true));
}
var contentWidth = _getTextWidth(textList[curTextType]);
if (contentWidth > width && contentWidth <= maxWidth) {
width = contentWidth;
}
width = min(max(contentWidth, width),maxWidth);
showMsg.add(Container(
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22),


+ 1
- 1
lib/home/last_chat_record_widget.dart Ver fichero

@@ -110,7 +110,7 @@ class _LastChatPageState extends State<LastChatPage> {
: Container(),
NetStateWidget(),
widget.needRobot ? _translateRobot() : Container(),
//_CompanyServer(),
_CompanyServer(),
lastMsgList.length == 0
? _emptyContent()
: _chatRecordsList(lastMsgList)


+ 5
- 3
lib/utils/HttpUtil.dart Ver fichero

@@ -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) {
@@ -1380,9 +1380,11 @@ class HttpUtil {
ChatDataMgr().updateMsgState(msgModel.sessionId, msgModel.time,
msgModel.channelType, msgModel.state);
return true;
}else{
showToast(resData['msg']);
}
showToast(resData['msg']);
return false;
}


Cargando…
Cancelar
Guardar