代码提交

This commit is contained in:
CYH 2025-04-24 17:29:27 +08:00
parent 158a936bcb
commit 9c1e8de478
7 changed files with 394 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,10 @@
import 'package:get/get.dart';
import 'logic.dart';
class Help_BackBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => Help_BackLogic());
}
}

View File

@ -0,0 +1,85 @@
import 'package:circle_app/utils/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
import '../../commons/config.dart';
import '../../net/api.dart';
import '../../net/dio_manager.dart';
import '../../utils/qiniu.dart';
class Help_BackLogic extends GetxController {
TextEditingController textEditingController = TextEditingController();
final ImagePicker _picker = ImagePicker();
TextEditingController photoController = TextEditingController();
var quToken = '';
String maxMsg = "0/200";
List<String> imaglist = [];
@override
void onInit() async{
super.onInit();
getToken();
}
getToken() async {
// var data = await DioManager.instance.get(url: Api.tokenNoLogin, params: {});
// var bean = BaseResponse<QnTokenData>.fromJson(
// data, (data) => QnTokenData.fromJson(data));
// if(data['code'] == 200){
// quToken = data['data']['token'];
// }
}
Future getImageFile() async {
try {
final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.gallery,
);
if(null==pickedFile){
return;
}
SmartDialog.showLoading(msg: '上传中');
uploadImage(quToken,pickedFile,ImgPath.CALL_OUT_IMAGE,(result){
SmartDialog.dismiss(force: true);
if (result.toString().isNotEmpty) {
imaglist.add(result);
update();
} else {
getToken();
}
});
} catch (_) {
SmartDialog.dismiss(force: true);
}
}
void getFeedBack() async {
if (photoController.text.isEmpty) {
showOKToast('请输入手机号');
} else if (textEditingController.text.isEmpty) {
showOKToast('请输入您的问题');
} else {
// var result = await DioManager.instance.postBody(url: Api.registerFeedback, params: {
// "content": textEditingController.text,
// "images": imaglist,
// "mobile": photoController.text
// });
// if (result['code'] == 200) {
// showOKToast('提交成功');
// Get.back();
// } else {
// showOKToast(result['msg']);
// }
}
}
}

View File

@ -0,0 +1,260 @@
import 'package:circle_app/commons/colors/app_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../commons/Widgets/my_app_bar.dart';
import '../../router/routers.dart';
import '../../utils/util.dart';
import 'logic.dart';
class Help_BackPage extends StatelessWidget {
Help_BackPage({Key? key}) : super(key: key);
final logic = Get.find<Help_BackLogic>();
@override
Widget build(BuildContext context) {
return GetBuilder(builder: (Help_BackLogic controller) {
return GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBaseImage("home_back")),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
centerTitle: '获取帮助',
),
body: SingleChildScrollView(
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(
left: 16.0.sp,
top: 16.0.sp,
right: 16.0.sp,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.0.sp),
color: const Color(
0xFF4C3E5F),
),
height: 40.0.sp,
child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
alignment: Alignment.centerLeft,
padding:
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
child: Text(
"+86",
style: TextStyle(
color: Colors.white,
fontSize: 14.0.sp,
),
)),
Expanded(
child: Container(
height: 32.sp,
alignment: Alignment.center,
child: TextField(
controller: logic.photoController,
textAlignVertical: TextAlignVertical.center,
maxLines: 1,
decoration: InputDecoration(
hintText: '请输入手机号,方便我们联系您',
counterText:"",
hintStyle: TextStyle(
color: Colors.grey.shade300,
fontSize: 14.0.sp,
),
border: InputBorder.none,
),
style: TextStyle(
color: Colors.white,
fontSize: 14.0.sp,
height: 1.0.sp,
),
),
),
)
],
),
),
Stack(
children: [
Container(
height: 200,
margin: EdgeInsets.symmetric(
horizontal: 16.sp, vertical: 16.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(13),
color: const Color(
0xFF4C3E5F),
),
padding: EdgeInsets.all(13),
child: TextField(
maxLength: 200,
controller: controller.textEditingController,
onChanged: (msg){
print(msg);
controller.maxMsg = '${msg.length}/200';
controller.update();
},
decoration: InputDecoration(
hintText: '请详细描述问题,方便我们帮您处理~',
counterText: '',
hintStyle: TextStyle(
color: Color(0xFFB7BECC), fontSize: 14.sp),
border: InputBorder.none,
),
maxLines: null,
style: TextStyle(color: Colors.white),
),
),
Positioned(
right: 30.sp,
bottom: 30.sp,
child: Text(
controller.maxMsg,
style: TextStyle(color: Colors.white),
))
],
),
Container(
height: 120.sp,
margin: EdgeInsets.only(left: 8.sp, right: 16.sp),
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, //
),
itemCount:controller.imaglist.length<3 ? controller.imaglist.length+1: controller.imaglist.length, // Replace with your item count
itemBuilder: (context, index) {
if (index == 0&&controller.imaglist.length<3) {
//
return GestureDetector(
onTap: () {
controller.getImageFile();
},
child: Container(
margin: EdgeInsets.all(5.sp),
child: Image(
image:
AssetImage(getMineImage("icon_img_add")),
),
),
);
} else {
//
// data
// var itemData = data[index - 1]; //
return Container(
margin: EdgeInsets.all(5.sp),
child: Center(
child: _buildImageItem(controller.imaglist.length<3 ?
controller.imaglist[index-1]: controller.imaglist[index], // Replace with your item count
controller,controller.imaglist.length<3 ? index-1:index ),
),
);
}
},
),
),
Padding(
padding: EdgeInsets.only(left: 18.sp, top: 8.sp),
child: Text(
'最多选择3张图片',
style:
TextStyle(color: Color(0xFFB7BECC), fontSize: 12),
),
),
SizedBox(height: 50),
GestureDetector(
onTap: () {
// showToast("完善资料");
controller.getFeedBack();
// Get.toNamed(AppRoutes.Complete_materialPage, arguments: "user");
// controller.onInit();
},
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21.sp),
gradient: AppColor.mainVerLinearGradient
),
padding: EdgeInsets.only(
top: 14.sp, bottom: 14.sp, left: 95.sp, right: 95.sp),
child: Text(
"提交",
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
),
),
),
),
),
],
),
),
)),
),
);
});
}
Widget _buildImageItem(String url, Help_BackLogic controller, int index) {
return Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(0.0),
child: Container(
width: double.infinity, //
height: double.infinity, //
child: ClipRRect(
borderRadius: BorderRadius.circular(0.0),
child: GestureDetector(
onTap: () {
Get.toNamed(Routes.SwiperPage, arguments: {
'imaglist': controller.imaglist,
'index': index
});
},
child: Image.network(
fit: BoxFit.cover,
url,
),
),
),
),
),
Positioned(
top: 0,
right: 0,
child: GestureDetector(
onTap: () {
controller.imaglist.removeAt(index);
controller.update();
},
child: Image(
image: AssetImage(getMineImage("icon_img_del")),
width: 20.sp,
height: 20.sp,
),
))
],
);
}
}

View File

@ -751,11 +751,7 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
));
});
})
: (widget.emptyBuilder != null
? widget.emptyBuilder!()
: recommendCircleFriendData.isNotEmpty
? recommendCircleFriendWidget()
: Container());
: Container();
}
// EasyRefresh(

View File

@ -139,37 +139,37 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
@override
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
int vipType = 0;
// if (userInfo != null && myuserInfo != null) {
// if (userInfo!.customInfo!
// .containsKey('Label')) {
// if (userInfo!.customInfo!['Label']
// .toString()
// .isNotEmpty) {
// Map otherInfo = jsonDecode(userInfo!
// .customInfo!['Label']
// .toString());
// Map myInfo = jsonDecode(myuserInfo!
// .customInfo!['Label']
// .toString());
//
// if (otherInfo.containsKey('mark')) {
// mark = otherInfo['mark'] ?? 0;
// }
// }
// }
//
// if (userInfo != null) {
// List<String> userIdList =
// userInfo!.userID!.split('_');
// if (userIdList.length >= 4) {
// if (int.parse(userIdList[2]) == 10) {
// isOfficial = true;
// } else {
// isOfficial = false;
// }
// }
// }
// }
if (userInfo != null && myuserInfo != null) {
if (userInfo!.customInfo!
.containsKey('Label')) {
if (userInfo!.customInfo!['Label']
.toString()
.isNotEmpty) {
Map otherInfo = jsonDecode(userInfo!
.customInfo!['Label']
.toString());
Map myInfo = jsonDecode(myuserInfo!
.customInfo!['Label']
.toString());
if (otherInfo.containsKey('mark')) {
mark = otherInfo['mark'] ?? 0;
}
}
}
if (userInfo != null) {
List<String> userIdList =
userInfo!.userID!.split('_');
if (userIdList.length >= 4) {
if (int.parse(userIdList[2]) == 10) {
isOfficial = true;
} else {
isOfficial = false;
}
}
}
}
final TUITheme theme = value.theme;
final isDesktopScreen =
TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop;
@ -229,10 +229,10 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6.5.sp),
gradient: sexBgGradient(userInfo!.role ?? 0)),
child: Text(getGenderStr(userInfo!.role ?? 0),
gradient: sexBgGradient(userInfo?.role ?? 0)),
child: Text(getGenderStr(userInfo?.role ?? 0),
style: TextStyle(
color: sexBgColor(userInfo!.role ?? 0),
color: sexBgColor(userInfo?.role ?? 0),
fontSize: 9.sp,
),),
)
@ -252,7 +252,7 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
Row(
children: [
Text(
nickName,
nickName ?? '',
softWrap: true,
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
@ -279,7 +279,7 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
// if (vipType > 0)
Container(
margin: EdgeInsets.only(left: 5.sp,bottom: isOfficial ? 5.sp : 0.sp),
child: UserTagWidget(mark)),
child: UserTagWidget(mark ?? 0)),
Expanded(
child:Container()),

View File

@ -139,9 +139,10 @@ class _TIMLastMsgState extends TIMUIKitState<TIMLastMsg> {
final msgStatus = widget.lastMsg!.status;
final theme = Provider.of<TUIThemeViewModel>(context).theme;
final msgType = widget.lastMsg;
if (msgStatus == MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL && msgType != MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) {
if (msgStatus == MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL && msgType?.elemType != MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) {
return Icon(Icons.error, color: theme.cautionColor, size: 16);
}
if (msgStatus == MessageStatus.V2TIM_MSG_STATUS_SENDING) {
return Icon(Icons.arrow_back, color: theme.weakTextColor, size: 16);
}