merge
This commit is contained in:
parent
4f0c1f6f73
commit
2ba610ca7f
1
assets/animation/voice.json
Normal file
1
assets/animation/voice.json
Normal file
File diff suppressed because one or more lines are too long
BIN
assets/images/icon_logout.png
Normal file
BIN
assets/images/icon_logout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
@ -23,7 +23,6 @@ class IMMessage {
|
|||||||
String? groupID,
|
String? groupID,
|
||||||
String? cloudCustomData,
|
String? cloudCustomData,
|
||||||
String? groupName,
|
String? groupName,
|
||||||
bool isPush = true,
|
|
||||||
bool isExcludedFromUnreadCount = false,
|
bool isExcludedFromUnreadCount = false,
|
||||||
}) async {
|
}) async {
|
||||||
// 必须且只能设置一个:toUserID(单聊)或 groupID(群聊)
|
// 必须且只能设置一个:toUserID(单聊)或 groupID(群聊)
|
||||||
@ -67,7 +66,7 @@ class IMMessage {
|
|||||||
isSupportMessageExtension: false, // 支持消息扩展
|
isSupportMessageExtension: false, // 支持消息扩展
|
||||||
isExcludedFromContentModeration: false, // 绕过内容审核
|
isExcludedFromContentModeration: false, // 绕过内容审核
|
||||||
needReadReceipt: false, // 已读回执
|
needReadReceipt: false, // 已读回执
|
||||||
offlinePushInfo: isPush ? offlinePushInfo : null,
|
offlinePushInfo: offlinePushInfo,
|
||||||
cloudCustomData: cloudCustomData,
|
cloudCustomData: cloudCustomData,
|
||||||
localCustomData: "",
|
localCustomData: "",
|
||||||
);
|
);
|
||||||
@ -96,7 +95,7 @@ class IMMessage {
|
|||||||
isSupportMessageExtension: false,
|
isSupportMessageExtension: false,
|
||||||
isExcludedFromContentModeration: false,
|
isExcludedFromContentModeration: false,
|
||||||
needReadReceipt: false,
|
needReadReceipt: false,
|
||||||
offlinePushInfo: isPush ? offlinePushInfo : null,
|
offlinePushInfo: offlinePushInfo,
|
||||||
cloudCustomData: cloudCustomData,
|
cloudCustomData: cloudCustomData,
|
||||||
localCustomData: "",
|
localCustomData: "",
|
||||||
);
|
);
|
||||||
|
@ -13,6 +13,7 @@ import 'package:shirne_dialog/shirne_dialog.dart';
|
|||||||
import 'package:tencent_cloud_chat_sdk/enum/V2TimAdvancedMsgListener.dart';
|
import 'package:tencent_cloud_chat_sdk/enum/V2TimAdvancedMsgListener.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/enum/message_elem_type.dart';
|
import 'package:tencent_cloud_chat_sdk/enum/message_elem_type.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/enum/receive_message_opt.dart';
|
import 'package:tencent_cloud_chat_sdk/enum/receive_message_opt.dart';
|
||||||
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_group_info.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_group_info.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message_receipt.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message_receipt.dart';
|
||||||
@ -123,6 +124,14 @@ class ImMessageListenerService extends GetxService {
|
|||||||
// 获取失败默认也不提示;
|
// 获取失败默认也不提示;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 单聊的
|
||||||
|
final cRes = await ImService.instance.getConversation(conversationID: 'c2c_${message.userID}');
|
||||||
|
final V2TimConversation c2cConv = cRes.data;
|
||||||
|
if (c2cConv.recvOpt == ReceiveMsgOptType.kTIMRecvMsgOpt_Not_Notify) {
|
||||||
|
// 开启了免打扰模式, 现在只做了0=初始正常接受,3=在线接受,离线只接受@消息
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_debounceTimer?.cancel(); // 每次都取消旧的
|
_debounceTimer?.cancel(); // 每次都取消旧的
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
class CommonApi {
|
class CommonApi {
|
||||||
///----------get
|
///----------get
|
||||||
static const String getCode = '/resource/sms/code'; // 发送短信验证码 {'phonenumber'}
|
static const String getCode = '/resource/sms/code'; // 发送短信验证码 {'phonenumber'}
|
||||||
|
// /app/member/sms/code
|
||||||
|
static const String getDelCode = '/app/member/sms/code'; // 发送短信验证码 {'templateId'}
|
||||||
|
|
||||||
static const String accountInfo = '/app/member/info'; // 账户信息
|
static const String accountInfo = '/app/member/info'; // 账户信息
|
||||||
|
|
||||||
///---------post
|
///---------post
|
||||||
@ -11,11 +14,31 @@ class CommonApi {
|
|||||||
///[source]=wechat_open [clientId]=428a8310cd442757ae699df5d894f051 [grantType]=social [socialState]=1
|
///[source]=wechat_open [clientId]=428a8310cd442757ae699df5d894f051 [grantType]=social [socialState]=1
|
||||||
static const String wxLogin = '/app/member/bind/wechat';
|
static const String wxLogin = '/app/member/bind/wechat';
|
||||||
|
|
||||||
// 获取字典枚举
|
/// 获取字典枚举 用户注销[member_revoked]
|
||||||
static const String dictionaryApi = '/app/sys/dict/type/';
|
static const String dictionaryApi = '/app/sys/dict/type/';
|
||||||
|
|
||||||
// 聚合搜索
|
// 聚合搜索
|
||||||
static const String aggregationSearchApi = '/app/common/search';
|
static const String aggregationSearchApi = '/app/common/search';
|
||||||
|
|
||||||
|
///余额充值 [money]金额
|
||||||
|
// {
|
||||||
|
// "orderType": "RECHARGE",
|
||||||
|
// "clientType": "APP",
|
||||||
|
// "paymentMethod": "WECHAT",
|
||||||
|
// "paymentClient": "APP",
|
||||||
|
// "money": 100
|
||||||
|
// }
|
||||||
|
static const String addBalance = '/app/payment/pay';
|
||||||
|
|
||||||
|
///余额提现
|
||||||
|
// {
|
||||||
|
// "money": "1",
|
||||||
|
// "method": "1",
|
||||||
|
// }
|
||||||
|
static const String withdraw = '/app/member/withdraw';
|
||||||
|
|
||||||
|
///注销 /app/member/revoked
|
||||||
|
static const String revoked = '/app/member/revoked';
|
||||||
|
|
||||||
///resource/oss/upload
|
///resource/oss/upload
|
||||||
}
|
}
|
||||||
|
41
lib/components/animation.dart
Normal file
41
lib/components/animation.dart
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:lottie/lottie.dart';
|
||||||
|
|
||||||
|
class VoiceAnimation extends StatelessWidget {
|
||||||
|
/// 是否正在播放
|
||||||
|
final bool isPlaying;
|
||||||
|
|
||||||
|
/// Lottie 动画资源路径
|
||||||
|
final String animationAsset;
|
||||||
|
|
||||||
|
/// 静态图标
|
||||||
|
final IconData idleIcon;
|
||||||
|
|
||||||
|
/// 动画和图标的大小
|
||||||
|
final double size;
|
||||||
|
|
||||||
|
const VoiceAnimation({
|
||||||
|
super.key,
|
||||||
|
required this.isPlaying,
|
||||||
|
this.animationAsset = 'assets/animation/voice.json',
|
||||||
|
this.idleIcon = Icons.multitrack_audio, // 静态图标
|
||||||
|
this.size = 24.0,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (isPlaying) {
|
||||||
|
return Lottie.asset(
|
||||||
|
animationAsset,
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
repeat: true,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Icon(
|
||||||
|
idleIcon,
|
||||||
|
size: size,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,9 +17,11 @@ class MyQrcode extends StatelessWidget {
|
|||||||
MyQrcode({
|
MyQrcode({
|
||||||
super.key,
|
super.key,
|
||||||
this.prefix,
|
this.prefix,
|
||||||
|
this.text,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? prefix;
|
final String? prefix;
|
||||||
|
final String? text;
|
||||||
|
|
||||||
final controller = Get.find<ImUserInfoController>();
|
final controller = Get.find<ImUserInfoController>();
|
||||||
|
|
||||||
@ -106,13 +108,16 @@ class MyQrcode extends StatelessWidget {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
decoration: BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
),
|
),
|
||||||
child: RepaintBoundary(
|
child: RepaintBoundary(
|
||||||
key: _qrKey,
|
key: _qrKey,
|
||||||
child: PrettyQrView.data(
|
child: Column(
|
||||||
errorCorrectLevel: QrErrorCorrectLevel.H, // 高容错
|
mainAxisSize: MainAxisSize.min, // 根据内容高度自适应
|
||||||
|
children: [
|
||||||
|
PrettyQrView.data(
|
||||||
|
errorCorrectLevel: QrErrorCorrectLevel.H,
|
||||||
data: data, // 二维码内容
|
data: data, // 二维码内容
|
||||||
decoration: PrettyQrDecoration(
|
decoration: PrettyQrDecoration(
|
||||||
background: Colors.transparent,
|
background: Colors.transparent,
|
||||||
@ -123,13 +128,26 @@ class MyQrcode extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
image: PrettyQrDecorationImage(
|
image: PrettyQrDecorationImage(
|
||||||
image: face,
|
image: face,
|
||||||
scale: 0.3, // 默认
|
scale: 0.3,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
padding: EdgeInsets.all(8.0), // 图片与二维码的边距
|
padding: const EdgeInsets.all(8.0),
|
||||||
),
|
),
|
||||||
quietZone: const PrettyQrQuietZone.modules(2),
|
quietZone: const PrettyQrQuietZone.modules(2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (text != null && text!.trim().isNotEmpty) ...[
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
text!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -12,6 +12,7 @@ import 'package:loopin/IM/controller/chat_detail_controller.dart';
|
|||||||
import 'package:loopin/IM/im_message.dart';
|
import 'package:loopin/IM/im_message.dart';
|
||||||
import 'package:loopin/IM/im_result.dart';
|
import 'package:loopin/IM/im_result.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
|
import 'package:loopin/components/animation.dart';
|
||||||
import 'package:loopin/components/image_viewer.dart';
|
import 'package:loopin/components/image_viewer.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/components/preview_video.dart';
|
import 'package:loopin/components/preview_video.dart';
|
||||||
@ -56,6 +57,8 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
|||||||
bool hasMore = true; // 是否还有更多数据
|
bool hasMore = true; // 是否还有更多数据
|
||||||
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
||||||
|
|
||||||
|
RxMap<String, bool> voicePlayingMap = <String, bool>{}.obs;
|
||||||
|
|
||||||
// 表情json
|
// 表情json
|
||||||
List emoJson = emotionData;
|
List emoJson = emotionData;
|
||||||
|
|
||||||
@ -498,11 +501,15 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
|||||||
maxWidth: maxWidth,
|
maxWidth: maxWidth,
|
||||||
// maxWidth: (item.soundElem!.duration! / 1000) / 60 * 230,
|
// maxWidth: (item.soundElem!.duration! / 1000) / 60 * 230,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Obx(
|
||||||
|
() => Row(
|
||||||
mainAxisAlignment: !(item.isSelf ?? false) ? MainAxisAlignment.start : MainAxisAlignment.end,
|
mainAxisAlignment: !(item.isSelf ?? false) ? MainAxisAlignment.start : MainAxisAlignment.end,
|
||||||
children: !(item.isSelf ?? false)
|
children: !(item.isSelf ?? false)
|
||||||
? [
|
? [
|
||||||
const Icon(Icons.multitrack_audio),
|
// const Icon(Icons.multitrack_audio),
|
||||||
|
VoiceAnimation(
|
||||||
|
isPlaying: voicePlayingMap[item.id ?? '${item.timestamp ?? 0}'] ?? false,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 5.0,
|
width: 5.0,
|
||||||
),
|
),
|
||||||
@ -513,17 +520,28 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 5.0,
|
width: 5.0,
|
||||||
),
|
),
|
||||||
const Icon(Icons.multitrack_audio),
|
// const Icon(Icons.multitrack_audio),
|
||||||
|
VoiceAnimation(
|
||||||
|
isPlaying: voicePlayingMap[item.id ?? '${item.timestamp ?? 0}'] ?? false,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
),
|
||||||
|
onTap: () async {
|
||||||
final locUrl = item.soundElem?.path ?? '';
|
final locUrl = item.soundElem?.path ?? '';
|
||||||
final netUrl = item.soundElem?.url ?? '';
|
final netUrl = item.soundElem?.url ?? '';
|
||||||
|
final msgId = item.id ?? '${item.timestamp ?? 0}';
|
||||||
|
logger.w('本地地址$locUrl');
|
||||||
|
logger.w('网络地址$netUrl');
|
||||||
if (locUrl.isNotEmpty) {
|
if (locUrl.isNotEmpty) {
|
||||||
AudioPlayerService().playNetwork(locUrl);
|
voicePlayingMap[msgId] = true;
|
||||||
|
await AudioPlayerService().playLocal(locUrl);
|
||||||
|
voicePlayingMap[msgId] = false;
|
||||||
} else if (netUrl.isNotEmpty) {
|
} else if (netUrl.isNotEmpty) {
|
||||||
AudioPlayerService().playLocal(netUrl);
|
voicePlayingMap[msgId] = true;
|
||||||
|
await AudioPlayerService().playNetwork(netUrl);
|
||||||
|
voicePlayingMap[msgId] = false;
|
||||||
} else {
|
} else {
|
||||||
MyDialog.toast('音频文件已过期', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
MyDialog.toast('音频文件已过期', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
}
|
}
|
||||||
@ -1907,6 +1925,7 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
onPanStart: (details) async {
|
onPanStart: (details) async {
|
||||||
// 开始录音
|
// 开始录音
|
||||||
|
logger.w('开始录音');
|
||||||
final res = await VoiceService().startRecording();
|
final res = await VoiceService().startRecording();
|
||||||
if (res) {
|
if (res) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -1932,7 +1951,7 @@ class _ChatState extends State<Chat> with SingleTickerProviderStateMixin {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onPanEnd: (details) {
|
onPanEnd: (details) {
|
||||||
// print('停止录音');
|
logger.w('停止录音');
|
||||||
setState(() {
|
setState(() {
|
||||||
switch (voiceType) {
|
switch (voiceType) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -55,6 +55,7 @@ class _ChatGroupState extends State<ChatGroup> with SingleTickerProviderStateMix
|
|||||||
bool isLoading = false; // 是否在加载中
|
bool isLoading = false; // 是否在加载中
|
||||||
bool hasMore = true; // 是否还有更多数据
|
bool hasMore = true; // 是否还有更多数据
|
||||||
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
||||||
|
RxMap<String, bool> voicePlayingMap = <String, bool>{}.obs;
|
||||||
|
|
||||||
// 表情json
|
// 表情json
|
||||||
List emoJson = emotionData;
|
List emoJson = emotionData;
|
||||||
@ -457,13 +458,20 @@ class _ChatGroupState extends State<ChatGroup> with SingleTickerProviderStateMix
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
final locUrl = item.soundElem?.path ?? '';
|
final locUrl = item.soundElem?.path ?? '';
|
||||||
final netUrl = item.soundElem?.url ?? '';
|
final netUrl = item.soundElem?.url ?? '';
|
||||||
|
final msgId = item.id ?? '${item.timestamp ?? 0}';
|
||||||
|
logger.w('本地地址$locUrl');
|
||||||
|
logger.w('网络地址$netUrl');
|
||||||
if (locUrl.isNotEmpty) {
|
if (locUrl.isNotEmpty) {
|
||||||
AudioPlayerService().playNetwork(locUrl);
|
voicePlayingMap[msgId] = true;
|
||||||
|
await AudioPlayerService().playLocal(locUrl);
|
||||||
|
voicePlayingMap[msgId] = false;
|
||||||
} else if (netUrl.isNotEmpty) {
|
} else if (netUrl.isNotEmpty) {
|
||||||
AudioPlayerService().playLocal(netUrl);
|
voicePlayingMap[msgId] = true;
|
||||||
|
await AudioPlayerService().playNetwork(netUrl);
|
||||||
|
voicePlayingMap[msgId] = false;
|
||||||
} else {
|
} else {
|
||||||
MyDialog.toast('音频文件已过期', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
MyDialog.toast('音频文件已过期', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ class _ChatNoFriendState extends State<ChatNoFriend> with SingleTickerProviderSt
|
|||||||
bool hasMore = true; // 是否还有更多数据
|
bool hasMore = true; // 是否还有更多数据
|
||||||
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
||||||
|
|
||||||
|
RxMap<String, bool> voicePlayingMap = <String, bool>{}.obs;
|
||||||
|
|
||||||
// 表情json
|
// 表情json
|
||||||
List emoJson = emotionData;
|
List emoJson = emotionData;
|
||||||
|
|
||||||
@ -519,13 +521,20 @@ class _ChatNoFriendState extends State<ChatNoFriend> with SingleTickerProviderSt
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
final locUrl = item.soundElem?.path ?? '';
|
final locUrl = item.soundElem?.path ?? '';
|
||||||
final netUrl = item.soundElem?.url ?? '';
|
final netUrl = item.soundElem?.url ?? '';
|
||||||
|
final msgId = item.id ?? '${item.timestamp ?? 0}';
|
||||||
|
logger.w('本地地址$locUrl');
|
||||||
|
logger.w('网络地址$netUrl');
|
||||||
if (locUrl.isNotEmpty) {
|
if (locUrl.isNotEmpty) {
|
||||||
AudioPlayerService().playNetwork(locUrl);
|
voicePlayingMap[msgId] = true;
|
||||||
|
await AudioPlayerService().playLocal(locUrl);
|
||||||
|
voicePlayingMap[msgId] = false;
|
||||||
} else if (netUrl.isNotEmpty) {
|
} else if (netUrl.isNotEmpty) {
|
||||||
AudioPlayerService().playLocal(netUrl);
|
voicePlayingMap[msgId] = true;
|
||||||
|
await AudioPlayerService().playNetwork(netUrl);
|
||||||
|
voicePlayingMap[msgId] = false;
|
||||||
} else {
|
} else {
|
||||||
MyDialog.toast('音频文件已过期', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
MyDialog.toast('音频文件已过期', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,10 @@ import 'package:loopin/IM/controller/chat_controller.dart';
|
|||||||
import 'package:loopin/IM/global_badge.dart';
|
import 'package:loopin/IM/global_badge.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/api/shop_api.dart';
|
import 'package:loopin/api/shop_api.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/components/scan_util.dart';
|
import 'package:loopin/components/scan_util.dart';
|
||||||
|
import 'package:loopin/models/conversation_type.dart' as myConversationType;
|
||||||
import 'package:loopin/models/conversation_type.dart';
|
import 'package:loopin/models/conversation_type.dart';
|
||||||
import 'package:loopin/models/conversation_view_model.dart';
|
import 'package:loopin/models/conversation_view_model.dart';
|
||||||
import 'package:loopin/pages/chat/menu/add_friend.dart';
|
import 'package:loopin/pages/chat/menu/add_friend.dart';
|
||||||
@ -20,6 +22,8 @@ import 'package:loopin/utils/parse_message_summary.dart';
|
|||||||
import 'package:loopin/utils/scan_code_type.dart'; // 导入外部枚举
|
import 'package:loopin/utils/scan_code_type.dart'; // 导入外部枚举
|
||||||
import 'package:shirne_dialog/shirne_dialog.dart';
|
import 'package:shirne_dialog/shirne_dialog.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/enum/receive_message_opt.dart';
|
import 'package:tencent_cloud_chat_sdk/enum/receive_message_opt.dart';
|
||||||
|
import 'package:tencent_cloud_chat_sdk/enum/receive_message_opt_enum.dart';
|
||||||
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation_filter.dart';
|
||||||
|
|
||||||
import '../../behavior/custom_scroll_behavior.dart';
|
import '../../behavior/custom_scroll_behavior.dart';
|
||||||
import '../../styles/index.dart';
|
import '../../styles/index.dart';
|
||||||
@ -118,7 +122,6 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 处理推广码,先调用IM互相关注逻辑,成功后在调用绑定关系接口
|
// 处理推广码,先调用IM互相关注逻辑,成功后在调用绑定关系接口
|
||||||
void _handlePromotionCode(String value) async {
|
void _handlePromotionCode(String value) async {
|
||||||
await checkFollowType(value); // 检查当前用户是否关注了团长
|
await checkFollowType(value); // 检查当前用户是否关注了团长
|
||||||
@ -312,6 +315,19 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'cs',
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.qr_code_scanner, color: Colors.white, size: 18),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'测试',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -329,6 +345,10 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
logger.w('点击了扫一扫');
|
logger.w('点击了扫一扫');
|
||||||
ScanUtil.openScanner(onResult: handleScanResult);
|
ScanUtil.openScanner(onResult: handleScanResult);
|
||||||
break;
|
break;
|
||||||
|
case 'cs':
|
||||||
|
logger.w('去互动');
|
||||||
|
Get.toNamed('/newFoucs');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -424,7 +444,7 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
child: Obx(
|
child: Obx(
|
||||||
() {
|
() {
|
||||||
final chatList = controller.chatList;
|
final chatList = controller.chatList;
|
||||||
|
if (chatList.isEmpty) return EmptyTip();
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: BouncingScrollPhysics(),
|
physics: BouncingScrollPhysics(),
|
||||||
@ -434,7 +454,8 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
// logger.w(chatList[index].isCustomAdmin);
|
// logger.w(chatList[index].isCustomAdmin);
|
||||||
// logger.w(chatList[index].conversation.recvOpt);
|
// logger.w(chatList[index].conversation.recvOpt);
|
||||||
final item = chatList[index];
|
final item = chatList[index];
|
||||||
final bool quiet = [ReceiveMsgOptType.kTIMRecvMsgOpt_Not_Notify_Except_At].contains(chatList[index].conversation.recvOpt ?? 0)
|
final bool quiet = [ReceiveMsgOptType.kTIMRecvMsgOpt_Not_Notify_Except_At, ReceiveMsgOptType.kTIMRecvMsgOpt_Not_Notify]
|
||||||
|
.contains(chatList[index].conversation.recvOpt ?? 0)
|
||||||
? true
|
? true
|
||||||
: false; // 是否设置了免打扰
|
: false; // 是否设置了免打扰
|
||||||
final isNoFriend = chatList[index].conversation.conversationGroupList?.contains(ConversationType.noFriend.name) ?? false;
|
final isNoFriend = chatList[index].conversation.conversationGroupList?.contains(ConversationType.noFriend.name) ?? false;
|
||||||
@ -448,8 +469,22 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
motion: const DrawerMotion(), // 可以改成 StretchMotion 或 ScrollMotion ,DrawerMotion
|
motion: const DrawerMotion(), // 可以改成 StretchMotion 或 ScrollMotion ,DrawerMotion
|
||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (_) {
|
onPressed: (_) async {
|
||||||
//
|
logger.w(item.conversation.toLogString());
|
||||||
|
if (isNoFriend) {
|
||||||
|
// 单独处理陌生人聊天 这里只能处理一条,
|
||||||
|
// 获取所有陌生人会话
|
||||||
|
final noFriendData = await ImService.instance.getConversationListByFilter(
|
||||||
|
filter: V2TimConversationFilter(conversationGroup: myConversationType.ConversationType.noFriend.name),
|
||||||
|
nextSeq: 0,
|
||||||
|
count: 1,
|
||||||
|
);
|
||||||
|
await ImService.instance.clearConversationUnreadCount(
|
||||||
|
conversationID: 'c2c_${item.conversation.userID}', cleanTimestamp: item.conversation.lastMessage!.timestamp ?? 0);
|
||||||
|
} else {
|
||||||
|
// 清除未读
|
||||||
|
await ImService.instance.clearConversationUnreadCount(conversationID: item.conversation.conversationID);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -458,8 +493,30 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
),
|
),
|
||||||
if (!(isAdmin || isNoFriend))
|
if (!(isAdmin || isNoFriend))
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (_) {
|
onPressed: (_) async {
|
||||||
//
|
// 设置或取消免打扰
|
||||||
|
// logger.e(controller.info.value?.recvOpt);
|
||||||
|
// 群聊开启免打扰 = 3 单聊开启免打扰=2,关闭免打扰为0
|
||||||
|
if (item.conversation.type == 1) {
|
||||||
|
logger.w('当前单聊recvopt=${item.conversation.recvOpt}');
|
||||||
|
// 单聊
|
||||||
|
await ImService.instance.setC2CReceiveMessageOpt(
|
||||||
|
userIDList: ['${item.conversation.userID}'],
|
||||||
|
opt: item.conversation.recvOpt == 2
|
||||||
|
? ReceiveMsgOptEnum.V2TIM_RECEIVE_MESSAGE // 关闭免打扰 = 0
|
||||||
|
: ReceiveMsgOptEnum.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE); // 3=只接收at消息,2=正常接收不接受离线
|
||||||
|
} else if (item.conversation.type == 2) {
|
||||||
|
//群
|
||||||
|
logger.w('当前群聊recvopt=${item.conversation.recvOpt}');
|
||||||
|
await ImService.instance.setGroupReceiveMessageOpt(
|
||||||
|
groupID: item.conversation.groupID ?? '',
|
||||||
|
opt: item.conversation.recvOpt == 3
|
||||||
|
? ReceiveMsgOptEnum.V2TIM_RECEIVE_MESSAGE
|
||||||
|
: ReceiveMsgOptEnum.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE_EXCEPT_AT,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 初始化一次未读总数
|
||||||
|
Get.find<GlobalBadge>().initUnreadCount();
|
||||||
},
|
},
|
||||||
backgroundColor: FStyle.primaryColor,
|
backgroundColor: FStyle.primaryColor,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -568,7 +625,7 @@ class ChatPageState extends State<ChatPage> {
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (conversationTypeFromString(chatList[index].isCustomAdmin) != null) {
|
if (conversationTypeFromString(chatList[index].isCustomAdmin) != null) {
|
||||||
// 跳转对应的通知消息页
|
// 跳转对应的通知消息页 notify下的内容
|
||||||
logger.e(chatList[index].isCustomAdmin);
|
logger.e(chatList[index].isCustomAdmin);
|
||||||
Get.toNamed('/${chatList[index].isCustomAdmin}', arguments: chatList[index].conversation);
|
Get.toNamed('/${chatList[index].isCustomAdmin}', arguments: chatList[index].conversation);
|
||||||
} else if (chatList[index].conversation.conversationGroupList!.contains(ConversationType.noFriend.name)) {
|
} else if (chatList[index].conversation.conversationGroupList!.contains(ConversationType.noFriend.name)) {
|
||||||
|
@ -3,10 +3,12 @@ library;
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:easy_refresh/easy_refresh.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/models/conversation_type.dart';
|
import 'package:loopin/models/conversation_type.dart';
|
||||||
import 'package:loopin/models/notify_message.type.dart';
|
import 'package:loopin/models/notify_message.type.dart';
|
||||||
@ -29,9 +31,9 @@ class Interaction extends StatefulWidget {
|
|||||||
|
|
||||||
class InteractionState extends State<Interaction> with SingleTickerProviderStateMixin {
|
class InteractionState extends State<Interaction> with SingleTickerProviderStateMixin {
|
||||||
bool isLoading = false; // 是否在加载中
|
bool isLoading = false; // 是否在加载中
|
||||||
bool hasMore = true; // 是否还有更多数据
|
RxBool hasMore = true.obs; // 是否还有更多数据
|
||||||
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
// final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
||||||
final ScrollController chatController = ScrollController();
|
// final ScrollController chatController = ScrollController();
|
||||||
String page = '';
|
String page = '';
|
||||||
|
|
||||||
///-------------------
|
///-------------------
|
||||||
@ -58,24 +60,18 @@ class InteractionState extends State<Interaction> with SingleTickerProviderState
|
|||||||
msgList.add(lastmsg);
|
msgList.add(lastmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chatController.addListener(() {
|
// chatController.addListener(() {
|
||||||
if (_throttleFlag.value) return;
|
// if (_throttleFlag.value) return;
|
||||||
if (chatController.position.pixels >= chatController.position.maxScrollExtent - 50) {
|
// if (chatController.position.pixels >= chatController.position.maxScrollExtent - 50) {
|
||||||
_throttleFlag.value = true;
|
// _throttleFlag.value = true;
|
||||||
getMsgData().then((_) {
|
// getMsgData().then((_) {
|
||||||
// 解锁
|
// // 解锁
|
||||||
Future.delayed(Duration(milliseconds: 1000), () {
|
// Future.delayed(Duration(milliseconds: 1000), () {
|
||||||
_throttleFlag.value = false;
|
// _throttleFlag.value = false;
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
chatController.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页获取全部数据
|
// 分页获取全部数据
|
||||||
@ -90,7 +86,7 @@ class InteractionState extends State<Interaction> with SingleTickerProviderState
|
|||||||
if (res.success && res.data != null) {
|
if (res.success && res.data != null) {
|
||||||
msgList.addAll(res.data!);
|
msgList.addAll(res.data!);
|
||||||
if (res.data!.isEmpty) {
|
if (res.data!.isEmpty) {
|
||||||
hasMore = false;
|
hasMore.value = false;
|
||||||
}
|
}
|
||||||
logger.i('聊天数据加载成功');
|
logger.i('聊天数据加载成功');
|
||||||
} else {
|
} else {
|
||||||
@ -230,24 +226,54 @@ class InteractionState extends State<Interaction> with SingleTickerProviderState
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: RefreshIndicator(
|
child: EasyRefresh.builder(
|
||||||
backgroundColor: Colors.white,
|
callLoadOverOffset: 20, //触底距离
|
||||||
color: Color(0xFFFF5000),
|
callRefreshOverOffset: 20, // 下拉距离
|
||||||
displacement: 10.0,
|
header: ClassicHeader(
|
||||||
onRefresh: handleRefresh,
|
dragText: '下拉刷新',
|
||||||
child: Obx(() {
|
armedText: '释放刷新',
|
||||||
|
readyText: '加载中...',
|
||||||
|
processingText: '加载中...',
|
||||||
|
processedText: '加载完成',
|
||||||
|
failedText: '加载失败,请重试',
|
||||||
|
messageText: '最后更新于 %T',
|
||||||
|
),
|
||||||
|
footer: ClassicFooter(
|
||||||
|
dragText: '加载更多',
|
||||||
|
armedText: '释放加载',
|
||||||
|
readyText: '加载中...',
|
||||||
|
processingText: '加载中...',
|
||||||
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
|
failedText: '加载失败,请重试',
|
||||||
|
messageText: '最后更新于 %T',
|
||||||
|
),
|
||||||
|
onRefresh: () async {
|
||||||
|
await handleRefresh();
|
||||||
|
},
|
||||||
|
onLoad: () async {
|
||||||
|
if (hasMore.value) {
|
||||||
|
await getMsgData();
|
||||||
|
return hasMore.value ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
childBuilder: (context, physics) {
|
||||||
|
return Obx(
|
||||||
|
() {
|
||||||
|
// if (msgList.isEmpty) return EmptyTip();
|
||||||
|
if (demoList.isEmpty) return EmptyTip();
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
controller: chatController,
|
// controller: chatController,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: BouncingScrollPhysics(),
|
physics: physics,
|
||||||
// itemCount: msgList.length,
|
// itemCount: msgList.length,
|
||||||
itemCount: demoList.length,
|
itemCount: demoList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
//检测cloudCustomData
|
//检测cloudCustomData
|
||||||
// interactionComment, //互动->评论
|
// interactionComment, //互动->评论 评论
|
||||||
// interactionAt, //互动->视频评论中的@
|
// interactionAt, //互动->视频评论中的@ 评论
|
||||||
// interactionLike, //互动->点赞
|
// interactionLike, //互动->点赞 视频(暂时不涉及评论点赞)
|
||||||
// interactionReply, //互动->评论回复
|
// interactionReply, //互动->评论回复 评论
|
||||||
|
|
||||||
//----
|
//----
|
||||||
// final element =msgList[index].customElem!;
|
// final element =msgList[index].customElem!;
|
||||||
@ -272,9 +298,10 @@ class InteractionState extends State<Interaction> with SingleTickerProviderState
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
// 点击头像转到对方主页
|
// 点击头像转到对方主页
|
||||||
// 先获取视频详情
|
// 先获取视频详情
|
||||||
// 如果cloudCustomData是interactionComment,interactionAt,interactionReply,传参时带上评论id,
|
// 如果cloudCustomData是interactionComment,interactionAt,interactionReply,传参时带上评论id,这三个是评论相关的
|
||||||
//
|
//
|
||||||
// final res = await Http.get('${VideoApi.detail}/${item['vlogID']}');
|
// final res = await Http.get('${VideoApi.detail}/${item['vlogID']}');
|
||||||
|
// 此人存在才做跳转
|
||||||
// Get.toNamed('/vloger', arguments: res['data']);
|
// Get.toNamed('/vloger', arguments: res['data']);
|
||||||
Get.toNamed('/vloger');
|
Get.toNamed('/vloger');
|
||||||
},
|
},
|
||||||
@ -358,7 +385,10 @@ class InteractionState extends State<Interaction> with SingleTickerProviderState
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
})),
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -3,11 +3,13 @@ library;
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:easy_refresh/easy_refresh.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/api/video_api.dart';
|
import 'package:loopin/api/video_api.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/models/conversation_type.dart';
|
import 'package:loopin/models/conversation_type.dart';
|
||||||
import 'package:loopin/service/http.dart';
|
import 'package:loopin/service/http.dart';
|
||||||
@ -17,10 +19,7 @@ import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
|||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_custom_elem.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_custom_elem.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart';
|
||||||
|
|
||||||
// interactionComment, //互动->评论
|
// newFocus, 新的关注
|
||||||
// interactionAt, //互动->视频评论中的@
|
|
||||||
// interactionLike, //互动->点赞
|
|
||||||
// interactionReply, //互动->评论回复
|
|
||||||
|
|
||||||
class Newfoucs extends StatefulWidget {
|
class Newfoucs extends StatefulWidget {
|
||||||
const Newfoucs({super.key});
|
const Newfoucs({super.key});
|
||||||
@ -31,9 +30,7 @@ class Newfoucs extends StatefulWidget {
|
|||||||
|
|
||||||
class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin {
|
class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin {
|
||||||
bool isLoading = false; // 是否在加载中
|
bool isLoading = false; // 是否在加载中
|
||||||
bool hasMore = true; // 是否还有更多数据
|
RxBool hasMore = true.obs; // 是否还有更多数据
|
||||||
final RxBool _throttleFlag = false.obs; // 滚动节流锁
|
|
||||||
final ScrollController chatController = ScrollController();
|
|
||||||
String page = '';
|
String page = '';
|
||||||
|
|
||||||
///-------------------
|
///-------------------
|
||||||
@ -53,24 +50,6 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
msgList.add(lastmsg);
|
msgList.add(lastmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chatController.addListener(() {
|
|
||||||
if (_throttleFlag.value) return;
|
|
||||||
if (chatController.position.pixels >= chatController.position.maxScrollExtent - 50) {
|
|
||||||
_throttleFlag.value = true;
|
|
||||||
getMsgData().then((_) {
|
|
||||||
// 解锁
|
|
||||||
Future.delayed(Duration(milliseconds: 1000), () {
|
|
||||||
_throttleFlag.value = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
chatController.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页获取全部数据
|
// 分页获取全部数据
|
||||||
@ -86,7 +65,7 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
msgList.addAll(res.data!);
|
msgList.addAll(res.data!);
|
||||||
logger.e(msgList);
|
logger.e(msgList);
|
||||||
if (res.data!.isEmpty) {
|
if (res.data!.isEmpty) {
|
||||||
hasMore = false;
|
hasMore.value = false;
|
||||||
}
|
}
|
||||||
logger.i('聊天数据加载成功');
|
logger.i('聊天数据加载成功');
|
||||||
} else {
|
} else {
|
||||||
@ -138,19 +117,51 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: RefreshIndicator(
|
child: EasyRefresh.builder(
|
||||||
backgroundColor: Colors.white,
|
callLoadOverOffset: 20, //触底距离
|
||||||
color: Color(0xFFFF5000),
|
callRefreshOverOffset: 20, // 下拉距离
|
||||||
displacement: 10.0,
|
header: ClassicHeader(
|
||||||
onRefresh: handleRefresh,
|
dragText: '下拉刷新',
|
||||||
child: Obx(() {
|
armedText: '释放刷新',
|
||||||
|
readyText: '加载中...',
|
||||||
|
processingText: '加载中...',
|
||||||
|
processedText: '加载完成',
|
||||||
|
failedText: '加载失败,请重试',
|
||||||
|
messageText: '最后更新于 %T',
|
||||||
|
),
|
||||||
|
footer: ClassicFooter(
|
||||||
|
dragText: '加载更多',
|
||||||
|
armedText: '释放加载',
|
||||||
|
readyText: '加载中...',
|
||||||
|
processingText: '加载中...',
|
||||||
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
|
failedText: '加载失败,请重试',
|
||||||
|
messageText: '最后更新于 %T',
|
||||||
|
),
|
||||||
|
onRefresh: () async {
|
||||||
|
await handleRefresh();
|
||||||
|
},
|
||||||
|
onLoad: () async {
|
||||||
|
if (hasMore.value) {
|
||||||
|
await getMsgData();
|
||||||
|
return hasMore.value ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
childBuilder: (context, physics) {
|
||||||
|
return Obx(
|
||||||
|
() {
|
||||||
|
if (msgList.isEmpty) return EmptyTip();
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
controller: chatController,
|
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: BouncingScrollPhysics(),
|
physics: physics,
|
||||||
itemCount: msgList.length,
|
itemCount: msgList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
//检测cloudCustomData
|
//检测cloudCustomData
|
||||||
|
///发起关注人的[userID],
|
||||||
|
///发起关注人的昵称[nickName],
|
||||||
|
///发起关注人的头像地址[faceUrl],
|
||||||
|
|
||||||
//----正式数据
|
//----正式数据
|
||||||
V2TimMessage msg = msgList[index];
|
V2TimMessage msg = msgList[index];
|
||||||
@ -169,8 +180,8 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
// final jsonData = '{"faceUrl":"","nickName":"测试昵称","userID":"213213"}';
|
// final jsonData = '{"faceUrl":"","nickName":"测试昵称","userID":"213213"}';
|
||||||
// final item = jsonDecode(jsonData); // 数据
|
// final item = jsonDecode(jsonData); // 数据
|
||||||
// final desc = '测试desc';
|
// final desc = '测试desc';
|
||||||
// final cloudCustomData = 'interactionLike';
|
// final cloudCustomData = 'newFocus';
|
||||||
// V2TimMessage element = V2TimMessage(elemType: 2, isRead: index > 2 ? true : false);
|
// V2TimCustomElem msg = V2TimMessage(elemType: 2, isRead: index > 2 ? true : false);
|
||||||
// -----------
|
// -----------
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@ -202,10 +213,7 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// 点击头像转到对方主页
|
// 点击头像转到对方主页,先获取视频详情
|
||||||
// 先获取视频详情
|
|
||||||
// 如果cloudCustomData是interactionComment,interactionAt,interactionReply,传参时带上评论id,
|
|
||||||
//
|
|
||||||
final res = await Http.get('${VideoApi.detail}/${item['vlogID']}');
|
final res = await Http.get('${VideoApi.detail}/${item['vlogID']}');
|
||||||
Get.toNamed('/vloger', arguments: res['data']);
|
Get.toNamed('/vloger', arguments: res['data']);
|
||||||
// Get.toNamed('/vloger');
|
// Get.toNamed('/vloger');
|
||||||
@ -247,7 +255,7 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: true,
|
visible: false, // 新的关注不需要
|
||||||
// 视频首图
|
// 视频首图
|
||||||
child: NetworkOrAssetImage(
|
child: NetworkOrAssetImage(
|
||||||
imageUrl: item['firstFrameImg'],
|
imageUrl: item['firstFrameImg'],
|
||||||
@ -269,7 +277,10 @@ class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
})),
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,111 +1,81 @@
|
|||||||
/// 订单通知列表
|
/// 新关注通知
|
||||||
library;
|
library;
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:easy_refresh/easy_refresh.dart';
|
import 'package:easy_refresh/easy_refresh.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:loopin/IM/controller/chat_controller.dart';
|
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
|
import 'package:loopin/api/video_api.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
|
import 'package:loopin/models/conversation_type.dart';
|
||||||
|
import 'package:loopin/service/http.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
import 'package:loopin/utils/index.dart';
|
import 'package:loopin/utils/index.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_follow_type_check_result.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_custom_elem.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_user_full_info.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart';
|
||||||
|
|
||||||
class UserWithFollow {
|
// newFocus, 新的关注
|
||||||
final V2TimUserFullInfo userInfo;
|
|
||||||
int followType;
|
|
||||||
|
|
||||||
UserWithFollow({
|
class Newfoucs extends StatefulWidget {
|
||||||
required this.userInfo,
|
const Newfoucs({super.key});
|
||||||
this.followType = 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class Order extends StatefulWidget {
|
|
||||||
const Order({super.key});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<Order> createState() => OrderState();
|
State<Newfoucs> createState() => NewfoucsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class OrderState extends State<Order> with SingleTickerProviderStateMixin {
|
class NewfoucsState extends State<Newfoucs> with SingleTickerProviderStateMixin {
|
||||||
bool isLoading = false; // 是否在加载中
|
bool isLoading = false; // 是否在加载中
|
||||||
bool hasMore = true; // 是否还有更多数据
|
RxBool hasMore = true.obs; // 是否还有更多数据
|
||||||
String page = '';
|
String page = '';
|
||||||
List<UserWithFollow> dataList = <UserWithFollow>[];
|
|
||||||
|
|
||||||
///-------------------
|
///-------------------
|
||||||
|
V2TimConversation? conv;
|
||||||
|
RxList<V2TimMessage> msgList = <V2TimMessage>[].obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
getData();
|
if (Get.arguments != null && Get.arguments is V2TimConversation) {
|
||||||
|
// 如果有参数
|
||||||
|
conv = Get.arguments as V2TimConversation;
|
||||||
|
logger.e('lastmsg:$conv');
|
||||||
|
|
||||||
|
final lastmsg = conv?.lastMessage;
|
||||||
|
if (lastmsg != null) {
|
||||||
|
msgList.add(lastmsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页获取陌关注列表数据
|
// 分页获取全部数据
|
||||||
Future<void> getData() async {
|
Future<void> getMsgData() async {
|
||||||
/// 0:不是好友也没有关注
|
// 获取最旧一条消息作为游标
|
||||||
/// 1:你关注了对方(单向)
|
V2TimMessage? lastRealMsg;
|
||||||
/// 2:对方关注了你(单向)
|
lastRealMsg = msgList.last;
|
||||||
/// 3:互相关注(双向好友)
|
final res = await ImService.instance.getHistoryMessageList(
|
||||||
final res = await ImService.instance.getMyFollowingList(
|
userID: ConversationType.newFocus.name, // userID为固定的newFocus
|
||||||
nextCursor: page,
|
lastMsg: lastRealMsg,
|
||||||
);
|
);
|
||||||
if (res.success && res.data != null) {
|
if (res.success && res.data != null) {
|
||||||
logger.i('获取成功:${res.data!.nextCursor}');
|
msgList.addAll(res.data!);
|
||||||
final userInfoList = res.data!.userFullInfoList ?? [];
|
logger.e(msgList);
|
||||||
// 构建数据
|
if (res.data!.isEmpty) {
|
||||||
List<UserWithFollow> wrappedList = userInfoList.map((u) {
|
hasMore.value = false;
|
||||||
return UserWithFollow(userInfo: u);
|
|
||||||
}).toList();
|
|
||||||
// 获取id
|
|
||||||
final userIDList = userInfoList.map((item) => item.userID).whereType<String>().toList();
|
|
||||||
if (userIDList.isNotEmpty) {
|
|
||||||
final shiRes = await ImService.instance.checkFollowType(userIDList: userIDList);
|
|
||||||
if (shiRes.success && shiRes.data != null) {
|
|
||||||
final shipResData = shiRes.data!;
|
|
||||||
for (final uwf in wrappedList) {
|
|
||||||
final userID = uwf.userInfo.userID;
|
|
||||||
if (userID != null) {
|
|
||||||
// 查找对应关系
|
|
||||||
final match = shipResData.firstWhere(
|
|
||||||
(e) => e.userID == userID,
|
|
||||||
orElse: () => V2TimFollowTypeCheckResult(userID: ''),
|
|
||||||
);
|
|
||||||
if (match.userID?.isNotEmpty ?? false) {
|
|
||||||
uwf.followType = match.followType ?? 0;
|
|
||||||
}
|
}
|
||||||
}
|
logger.i('聊天数据加载成功');
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final isFinished = res.data!.nextCursor == null || res.data!.nextCursor!.isEmpty;
|
|
||||||
if (isFinished) {
|
|
||||||
setState(() {
|
|
||||||
hasMore = false;
|
|
||||||
});
|
|
||||||
// 加载没数据了
|
|
||||||
page = '';
|
|
||||||
} else {
|
} else {
|
||||||
page = res.data!.nextCursor ?? '';
|
logger.e('聊天数据加载失败:${res.desc}');
|
||||||
}
|
|
||||||
logger.i('获取数据成功:$userInfoList');
|
|
||||||
setState(() {
|
|
||||||
dataList.addAll(wrappedList);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
logger.e('获取数据失败:${res.desc}');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下拉刷新
|
// 下拉刷新
|
||||||
Future<void> handleRefresh() async {
|
Future<void> handleRefresh() async {
|
||||||
dataList.clear();
|
await Future.delayed(Duration(seconds: 5));
|
||||||
page = '';
|
|
||||||
getData();
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,15 +87,28 @@ class OrderState extends State<Order> with SingleTickerProviderStateMixin {
|
|||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
forceMaterialTransparency: true,
|
forceMaterialTransparency: true,
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(1.0),
|
preferredSize: Size.fromHeight(1.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.grey[300],
|
color: Colors.grey[300],
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: const Text(
|
title: Container(
|
||||||
'关注',
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'新的关注',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
actions: [],
|
actions: [],
|
||||||
),
|
),
|
||||||
@ -151,7 +134,8 @@ class OrderState extends State<Order> with SingleTickerProviderStateMixin {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
@ -159,66 +143,106 @@ class OrderState extends State<Order> with SingleTickerProviderStateMixin {
|
|||||||
await handleRefresh();
|
await handleRefresh();
|
||||||
},
|
},
|
||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (hasMore) {
|
if (hasMore.value) {
|
||||||
await getData();
|
await getMsgData();
|
||||||
|
return hasMore.value ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
childBuilder: (context, physics) {
|
childBuilder: (context, physics) {
|
||||||
|
return Obx(
|
||||||
|
() {
|
||||||
|
if (msgList.isEmpty) return EmptyTip();
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
physics: physics,
|
physics: physics,
|
||||||
itemCount: dataList.length,
|
itemCount: msgList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = dataList[index];
|
//检测cloudCustomData
|
||||||
return Ink(
|
///发起关注人的[userID],
|
||||||
key: ValueKey(item.userInfo.userID),
|
///发起关注人的昵称[nickName],
|
||||||
child: Container(
|
///发起关注人的头像地址[faceUrl],
|
||||||
|
|
||||||
|
//----正式数据
|
||||||
|
V2TimMessage msg = msgList[index];
|
||||||
|
V2TimCustomElem element = msgList[index].customElem!;
|
||||||
|
final cloudCustomData = msgList[index].cloudCustomData;
|
||||||
|
logger.w(cloudCustomData);
|
||||||
|
final desc = msgList[index].customElem!.desc!;
|
||||||
|
String? jsonData = msgList[index].customElem!.data;
|
||||||
|
jsonData = (jsonData == null || jsonData.isEmpty) ? '{"faceUrl":"","nickName":"data为空","userID":"213213"}' : jsonData;
|
||||||
|
|
||||||
|
final item = jsonDecode(jsonData ?? '{"faceUrl":"","nickName":"测试昵称","userID":"213213"}');
|
||||||
|
|
||||||
|
logger.w(element.toJson());
|
||||||
|
|
||||||
|
// ----测试数据
|
||||||
|
// final jsonData = '{"faceUrl":"","nickName":"测试昵称","userID":"213213"}';
|
||||||
|
// final item = jsonDecode(jsonData); // 数据
|
||||||
|
// final desc = '测试desc';
|
||||||
|
// final cloudCustomData = 'newFocus';
|
||||||
|
// V2TimCustomElem msg = V2TimMessage(elemType: 2, isRead: index > 2 ? true : false);
|
||||||
|
// -----------
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0),
|
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
spacing: 10.0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
// 左侧部分(头像 + 昵称 + 描述)
|
// 头像
|
||||||
Expanded(
|
InkWell(
|
||||||
child: InkWell(
|
onTap: () async {
|
||||||
onTap: () {
|
// 点击头像转到对方主页
|
||||||
Get.toNamed(
|
// 先获取视频详情
|
||||||
'/vloger',
|
// 如果cloudCustomData是interactionComment,interactionAt,interactionReply,传参时带上评论id,
|
||||||
arguments: item.userInfo.userID,
|
//
|
||||||
);
|
final res = await Http.get('${VideoApi.detail}/${item['vlogID']}');
|
||||||
|
Get.toNamed('/vloger', arguments: res['data']);
|
||||||
|
// Get.toNamed('/vloger');
|
||||||
},
|
},
|
||||||
child: Row(
|
child: ClipOval(
|
||||||
children: [
|
|
||||||
ClipOval(
|
|
||||||
child: NetworkOrAssetImage(
|
child: NetworkOrAssetImage(
|
||||||
imageUrl: item.userInfo.faceUrl,
|
imageUrl: item['faceUrl'],
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
),
|
||||||
|
|
||||||
|
// 消息
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
// 点击头像转到对方主页,先获取视频详情
|
||||||
|
final res = await Http.get('${VideoApi.detail}/${item['vlogID']}');
|
||||||
|
Get.toNamed('/vloger', arguments: res['data']);
|
||||||
|
// Get.toNamed('/vloger');
|
||||||
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
// 昵称
|
||||||
Text(
|
Text(
|
||||||
item.userInfo.nickName?.isNotEmpty == true ? item.userInfo.nickName! : '未知昵称',
|
item['nickName'] ?? '未知',
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (item.userInfo.selfSignature?.isNotEmpty ?? false) ...[
|
|
||||||
const SizedBox(height: 2.0),
|
const SizedBox(height: 2.0),
|
||||||
|
// 描述内容
|
||||||
Text(
|
Text(
|
||||||
item.userInfo.selfSignature!,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
fontSize: 13.0,
|
|
||||||
),
|
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(color: Colors.grey, fontSize: 12.0),
|
||||||
|
desc,
|
||||||
|
// '很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容很长文本内容',
|
||||||
),
|
),
|
||||||
],
|
Text(
|
||||||
],
|
Utils.formatTime(msg.timestamp ?? DateTime.now().millisecondsSinceEpoch ~/ 1000),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey[600],
|
||||||
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -226,74 +250,36 @@ class OrderState extends State<Order> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(width: 10),
|
// 右侧
|
||||||
|
Row(
|
||||||
// 右侧按钮
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
TextButton(
|
children: <Widget>[
|
||||||
style: TextButton.styleFrom(
|
Visibility(
|
||||||
backgroundColor: item.followType == 3 ? Colors.grey : FStyle.primaryColor,
|
visible: false, // 新的关注不需要
|
||||||
minimumSize: const Size(70, 32),
|
// 视频首图
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
child: NetworkOrAssetImage(
|
||||||
shape: RoundedRectangleBorder(
|
imageUrl: item['firstFrameImg'],
|
||||||
borderRadius: BorderRadius.circular(4),
|
placeholderAsset: 'assets/images/bk.jpg',
|
||||||
|
width: 40,
|
||||||
|
height: 60,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
const SizedBox(width: 5.0),
|
||||||
final ctl = Get.find<ChatController>();
|
// 角标
|
||||||
final checkRes = await ImService.instance.checkFollowType(userIDList: [item.userInfo.userID!]);
|
Visibility(
|
||||||
int realFollowType = 0;
|
visible: !(msg.isRead ?? true),
|
||||||
if (checkRes.success && checkRes.data != null) {
|
child: FStyle.badge(0, isdot: true),
|
||||||
realFollowType = checkRes.data!.first.followType ?? 0;
|
|
||||||
if ([1, 3].contains(realFollowType)) {
|
|
||||||
// 取关
|
|
||||||
final unRes = await ImService.instance.unfollowUser(userIDList: [item.userInfo.userID!]);
|
|
||||||
if (unRes.success) {
|
|
||||||
setState(() {
|
|
||||||
item.followType = 2;
|
|
||||||
});
|
|
||||||
ctl.mergeNoFriend(conversationID: 'c2c_${item.userInfo.userID!}');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 关注
|
|
||||||
final res = await ImService.instance.followUser(userIDList: [item.userInfo.userID!]);
|
|
||||||
if (res.success) {
|
|
||||||
setState(() {
|
|
||||||
item.followType = realFollowType == 0
|
|
||||||
? 1
|
|
||||||
: realFollowType == 2
|
|
||||||
? 3
|
|
||||||
: 0;
|
|
||||||
});
|
|
||||||
final chatRes = await ImService.instance.followUser(userIDList: [item.userInfo.userID!]);
|
|
||||||
if (chatRes.success) {
|
|
||||||
final res = await ImService.instance.getConversation(conversationID: 'c2c_${item.userInfo.userID}');
|
|
||||||
if (res.success) {
|
|
||||||
V2TimConversation conversation = res.data;
|
|
||||||
if (conversation.conversationGroupList?.isNotEmpty ?? false) {
|
|
||||||
await ImService.instance.deleteConversationsFromGroup(
|
|
||||||
groupName: conversation.conversationGroupList!.first!,
|
|
||||||
conversationIDList: [conversation.conversationID],
|
|
||||||
);
|
|
||||||
ctl.updateNoFriendMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
Utils.getTipText(item.followType),
|
|
||||||
style: const TextStyle(color: Colors.white, fontSize: 14),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -163,14 +163,15 @@ class _MemberActionSheetState extends State<InviteActionSheet> {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
//
|
|
||||||
if (hasMore) {
|
if (hasMore) {
|
||||||
await getMemberData();
|
await getMemberData();
|
||||||
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
@ -69,6 +69,7 @@ class _MemberActionSheetState extends State<MemberActionSheet> {
|
|||||||
final mem = res.data!.memberInfoList ?? [];
|
final mem = res.data!.memberInfoList ?? [];
|
||||||
setState(() {
|
setState(() {
|
||||||
members.addAll(mem);
|
members.addAll(mem);
|
||||||
|
hasMore = res.data!.nextSeq == '0' ? false : true;
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -197,18 +198,19 @@ class _MemberActionSheetState extends State<MemberActionSheet> {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
//
|
//
|
||||||
if (hasMore) {
|
if (_query.isNotEmpty && (!isFinished)) {
|
||||||
if (_query.isNotEmpty) {
|
|
||||||
await searchMember(loadMore: true);
|
await searchMember(loadMore: true);
|
||||||
} else {
|
return !isFinished ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
|
} else if (hasMore) {
|
||||||
await getMemberData();
|
await getMemberData();
|
||||||
}
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_group_info.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_group_info.dart';
|
||||||
@ -103,7 +104,8 @@ class GrouplistState extends State<Grouplist> with SingleTickerProviderStateMixi
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
@ -113,9 +115,12 @@ class GrouplistState extends State<Grouplist> with SingleTickerProviderStateMixi
|
|||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (hasMore) {
|
if (hasMore) {
|
||||||
await getData();
|
await getData();
|
||||||
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
childBuilder: (context, physics) {
|
childBuilder: (context, physics) {
|
||||||
|
if (dataList.isEmpty) return EmptyTip();
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
physics: physics,
|
physics: physics,
|
||||||
itemCount: dataList.length,
|
itemCount: dataList.length,
|
||||||
|
@ -135,7 +135,6 @@ class _StartGroupChatPageState extends State<StartGroupChatPage> {
|
|||||||
msg: msgRes.data!.messageInfo!,
|
msg: msgRes.data!.messageInfo!,
|
||||||
groupID: groupID,
|
groupID: groupID,
|
||||||
isExcludedFromUnreadCount: true,
|
isExcludedFromUnreadCount: true,
|
||||||
isPush: false,
|
|
||||||
groupName: groupName,
|
groupName: groupName,
|
||||||
cloudCustomData: 'tips',
|
cloudCustomData: 'tips',
|
||||||
);
|
);
|
||||||
@ -304,13 +303,17 @@ class _StartGroupChatPageState extends State<StartGroupChatPage> {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
onRefresh: () async => _loadData(reset: true),
|
onRefresh: () async => _loadData(reset: true),
|
||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (hasMore) await _loadData();
|
if (hasMore) {
|
||||||
|
await _loadData();
|
||||||
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: filteredList.isEmpty
|
child: filteredList.isEmpty
|
||||||
? _emptyTip('暂无数据')
|
? _emptyTip('暂无数据')
|
||||||
|
@ -4,6 +4,7 @@ import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
|||||||
import 'package:loopin/components/my_qrcode.dart';
|
import 'package:loopin/components/my_qrcode.dart';
|
||||||
import 'package:loopin/pages/my/merchant/balance/balance.dart';
|
import 'package:loopin/pages/my/merchant/balance/balance.dart';
|
||||||
import 'package:loopin/pages/my/merchant/balance/controller.dart';
|
import 'package:loopin/pages/my/merchant/balance/controller.dart';
|
||||||
|
import 'package:loopin/utils/index.dart';
|
||||||
import 'package:loopin/utils/scan_code_type.dart';
|
import 'package:loopin/utils/scan_code_type.dart';
|
||||||
|
|
||||||
class AllFunctionsPage extends StatefulWidget {
|
class AllFunctionsPage extends StatefulWidget {
|
||||||
@ -20,8 +21,8 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
'title': '主页展示',
|
'title': '主页展示',
|
||||||
'items': [
|
'items': [
|
||||||
{'id': 'home_order', 'icon': 'assets/images/ico_order.png', 'label': '订单'},
|
{'id': 'home_order', 'icon': 'assets/images/ico_order.png', 'label': '订单'},
|
||||||
{'id': 'home_balance', 'icon': 'assets/images/ico_dhx.png', 'label': '余额logout'},
|
{'id': 'home_balance', 'icon': 'assets/images/ico_dhx.png', 'label': '余额'},
|
||||||
{'id': 'home_withdraw', 'icon': 'assets/images/ico_sh.png', 'label': '提现vloger'},
|
{'id': 'home_hym', 'icon': 'assets/images/ico_tgm.png', 'label': '好友码'},
|
||||||
{'id': 'home_promo', 'icon': 'assets/images/ico_tgm.png', 'label': '推广码'},
|
{'id': 'home_promo', 'icon': 'assets/images/ico_tgm.png', 'label': '推广码'},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -72,7 +73,13 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
itemCount: functionList.length,
|
itemCount: functionList.length,
|
||||||
itemBuilder: (context, sectionIndex) {
|
itemBuilder: (context, sectionIndex) {
|
||||||
final section = functionList[sectionIndex];
|
final section = functionList[sectionIndex];
|
||||||
|
final role = controller.role.value;
|
||||||
|
final isSeller = Utils.hasRole(role, 2);
|
||||||
|
if (section['title'] == '更多功能' && !isSeller) {
|
||||||
|
return SizedBox();
|
||||||
|
} else {
|
||||||
return _buildSection(section);
|
return _buildSection(section);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -80,6 +87,8 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSection(Map<String, dynamic> section) {
|
Widget _buildSection(Map<String, dynamic> section) {
|
||||||
|
final role = controller.role.value;
|
||||||
|
final isSeller = Utils.hasRole(role, 2);
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -112,7 +121,8 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = (section['items'] as List)[index];
|
final item = (section['items'] as List)[index];
|
||||||
final role = controller.role.value;
|
final role = controller.role.value;
|
||||||
if (item['id'] == 'home_promo' && role != 4) {
|
final hasRole = Utils.hasRole(role, 5);
|
||||||
|
if (item['id'] == 'home_promo' && !hasRole) {
|
||||||
return SizedBox();
|
return SizedBox();
|
||||||
} else {
|
} else {
|
||||||
return _buildFunctionItem(item);
|
return _buildFunctionItem(item);
|
||||||
@ -121,7 +131,8 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// 分隔线 - 只在不是最后一个section时显示
|
// 分隔线 - 只在不是最后一个section时显示
|
||||||
if (functionList.indexOf(section) != functionList.length - 1)
|
// if (functionList.indexOf(section) != functionList.length - 1)
|
||||||
|
if (isSeller)
|
||||||
Container(
|
Container(
|
||||||
height: 2,
|
height: 2,
|
||||||
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 20),
|
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 20),
|
||||||
@ -191,14 +202,12 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
Get.to(() => Balance());
|
Get.to(() => Balance());
|
||||||
// showLogoutDialog(context);
|
// showLogoutDialog(context);
|
||||||
break;
|
break;
|
||||||
case 'home_withdraw':
|
case 'home_hym':
|
||||||
Get.toNamed('/vloger');
|
qrcodeAlertDialog(context);
|
||||||
break;
|
break;
|
||||||
case 'home_promo':
|
case 'home_promo':
|
||||||
// 推广码
|
// 推广码
|
||||||
Get.to(() => MyQrcode(
|
qrcodeAlertDialog(context);
|
||||||
prefix: QrTypeCode.tgm,
|
|
||||||
));
|
|
||||||
break;
|
break;
|
||||||
case 'more_seller_order':
|
case 'more_seller_order':
|
||||||
Get.toNamed('/sellerOrder');
|
Get.toNamed('/sellerOrder');
|
||||||
@ -209,6 +218,41 @@ class _AllFunctionsPageState extends State<AllFunctionsPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 二维码名片弹窗
|
||||||
|
void qrcodeAlertDialog(BuildContext context) {
|
||||||
|
final role = controller.role.value;
|
||||||
|
final isLeader = Utils.hasRole(role, 5);
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return UnconstrainedBox(
|
||||||
|
constrainedAxis: Axis.vertical,
|
||||||
|
child: SizedBox(
|
||||||
|
width: 350.0,
|
||||||
|
child: AlertDialog(
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
surfaceTintColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
|
||||||
|
content: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
MyQrcode(
|
||||||
|
prefix: QrTypeCode.tgm,
|
||||||
|
text: isLeader ? '推广码' : '',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 退出登录弹窗
|
// 退出登录弹窗
|
||||||
void showLogoutDialog(BuildContext context) {
|
void showLogoutDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
268
lib/pages/my/delete.dart
Normal file
268
lib/pages/my/delete.dart
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
/// 注册模板
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:loopin/IM/im_service.dart';
|
||||||
|
import 'package:loopin/api/common_api.dart';
|
||||||
|
import 'package:loopin/controller/video_module_controller.dart';
|
||||||
|
import 'package:loopin/service/http.dart';
|
||||||
|
import 'package:loopin/utils/common.dart';
|
||||||
|
import 'package:shirne_dialog/shirne_dialog.dart';
|
||||||
|
|
||||||
|
import '../../utils/index.dart';
|
||||||
|
|
||||||
|
class Delete extends StatefulWidget {
|
||||||
|
const Delete({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Delete> createState() => _DeleteState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeleteState extends State<Delete> {
|
||||||
|
final Map authObj = {'phonenumber': '', 'smsCode': '', 'clientId': '428a8310cd442757ae699df5d894f051', 'grantType': 'sms'};
|
||||||
|
|
||||||
|
final fieldController = TextEditingController();
|
||||||
|
Timer? timer;
|
||||||
|
String vcodeText = '获取验证码';
|
||||||
|
bool disabled = false;
|
||||||
|
int time = 60;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
timer?.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空文本框
|
||||||
|
void handleClear() {
|
||||||
|
fieldController.clear();
|
||||||
|
setState(() {
|
||||||
|
authObj['phonenumber'] = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//先退出,在注销
|
||||||
|
void handleLogout() async {}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
void handleSubmit() async {
|
||||||
|
FocusScope.of(context).unfocus(); // 收起键盘
|
||||||
|
if (authObj['phonenumber'] == '') {
|
||||||
|
MyDialog.toast('手机号不能为空', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
|
} else if (!Utils.checkTel(authObj['phonenumber'])) {
|
||||||
|
MyDialog.toast('手机号格式不正确', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
|
} else if (authObj['smsCode'] == '') {
|
||||||
|
MyDialog.toast('验证码不能为空', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
|
} else {
|
||||||
|
final dialogController = MyDialog.loading('注销中...');
|
||||||
|
// 执行退出登录逻辑,执行注销逻辑
|
||||||
|
final loginRes = await ImService.instance.logout();
|
||||||
|
if (loginRes.success) {
|
||||||
|
// 清除存储信息
|
||||||
|
Common.logout();
|
||||||
|
// 初始化视频
|
||||||
|
final videoController = Get.find<VideoModuleController>();
|
||||||
|
videoController.init();
|
||||||
|
// 执行主席到逻辑
|
||||||
|
final del = await Http.post('${CommonApi.revoked}?smsCode=${authObj['smsCode']}');
|
||||||
|
logger.w(del);
|
||||||
|
//
|
||||||
|
Get.offAllNamed('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 60s倒计时
|
||||||
|
void handleVcode() {
|
||||||
|
logger.i(authObj);
|
||||||
|
FocusScope.of(context).unfocus(); // 收起键盘
|
||||||
|
if (authObj['phonenumber'] == '') {
|
||||||
|
MyDialog.toast('手机号不能为空', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
|
} else if (!Utils.checkTel(authObj['phonenumber'])) {
|
||||||
|
MyDialog.toast('手机号格式不正确', icon: Icon(Icons.warning), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
disabled = true;
|
||||||
|
});
|
||||||
|
startTimer();
|
||||||
|
getCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startTimer() {
|
||||||
|
timer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
setState(() {
|
||||||
|
if (time > 0) {
|
||||||
|
vcodeText = '获取验证码(${time--})';
|
||||||
|
} else {
|
||||||
|
vcodeText = '获取验证码';
|
||||||
|
time = 60;
|
||||||
|
disabled = false;
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void getCode() async {
|
||||||
|
//
|
||||||
|
final res = await Http.get('${CommonApi.dictionaryApi}sms_template_id');
|
||||||
|
final dictData = res['data'] as List;
|
||||||
|
final templeId = dictData.first['dictValue'];
|
||||||
|
logger.w(templeId);
|
||||||
|
final resCode = await Http.get(CommonApi.getDelCode, params: {'templateId': templeId});
|
||||||
|
logger.i('注销验证短信:$resCode');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final phoneNum = authObj['phonenumber'] as String;
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.translucent,
|
||||||
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(
|
||||||
|
'注销账号',
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
forceMaterialTransparency: true,
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 30.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFFFAF8F5),
|
||||||
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
controller: fieldController,
|
||||||
|
inputFormatters: [
|
||||||
|
LengthLimitingTextInputFormatter(11), // 限制输入长度为 11
|
||||||
|
FilteringTextInputFormatter.digitsOnly, // 限制只能输入数字
|
||||||
|
],
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: '输入手机号',
|
||||||
|
hintStyle: const TextStyle(color: Colors.black38),
|
||||||
|
suffixIcon: Visibility(
|
||||||
|
visible: phoneNum.isNotEmpty,
|
||||||
|
child: InkWell(
|
||||||
|
hoverColor: Colors.transparent,
|
||||||
|
highlightColor: Colors.transparent,
|
||||||
|
splashColor: Colors.transparent,
|
||||||
|
onTap: handleClear,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.clear,
|
||||||
|
color: Colors.grey,
|
||||||
|
size: 16.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(vertical: 0, horizontal: 12.0),
|
||||||
|
border: const OutlineInputBorder(borderSide: BorderSide.none),
|
||||||
|
),
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
authObj['phonenumber'] = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 30.0),
|
||||||
|
decoration: BoxDecoration(color: Color(0xFFFAF8F5), borderRadius: BorderRadius.circular(15.0)),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
inputFormatters: [
|
||||||
|
LengthLimitingTextInputFormatter(6),
|
||||||
|
FilteringTextInputFormatter.digitsOnly, // 限制只能输入数字
|
||||||
|
],
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
hintText: '验证码',
|
||||||
|
hintStyle: TextStyle(color: Colors.black38),
|
||||||
|
contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 12.0),
|
||||||
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
||||||
|
),
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
authObj['smsCode'] = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25.0,
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.only(right: 8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStateProperty.all(Colors.white),
|
||||||
|
shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0))),
|
||||||
|
padding: WidgetStateProperty.all(EdgeInsets.symmetric(horizontal: 15.0))),
|
||||||
|
onPressed: !disabled ? handleVcode : null,
|
||||||
|
child: Text(vcodeText, style: const TextStyle(fontSize: 13.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'提示:\n'
|
||||||
|
'1. 账号注销后,平台会保留您的数据 7 天。\n'
|
||||||
|
'2. 若 7 天内未登录,平台将销毁所有保留数据。\n'
|
||||||
|
'3. 若在 7 天内重新登录,则视为放弃注销。\n'
|
||||||
|
'请谨慎操作。',
|
||||||
|
style: TextStyle(fontSize: 14, color: Colors.red[700]),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 30.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 45.0,
|
||||||
|
child: FilledButton(
|
||||||
|
style: ButtonStyle(shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)))),
|
||||||
|
onPressed: handleSubmit,
|
||||||
|
child: const Text(
|
||||||
|
'确认注销',
|
||||||
|
style: TextStyle(fontSize: 16.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:loopin/IM/controller/chat_controller.dart';
|
import 'package:loopin/IM/controller/chat_controller.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
import 'package:loopin/utils/index.dart';
|
import 'package:loopin/utils/index.dart';
|
||||||
@ -151,7 +152,8 @@ class FansState extends State<Fans> with SingleTickerProviderStateMixin {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
@ -161,9 +163,12 @@ class FansState extends State<Fans> with SingleTickerProviderStateMixin {
|
|||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (hasMore) {
|
if (hasMore) {
|
||||||
await getData();
|
await getData();
|
||||||
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
childBuilder: (context, physics) {
|
childBuilder: (context, physics) {
|
||||||
|
if (dataList.isEmpty) return EmptyTip();
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
physics: physics,
|
physics: physics,
|
||||||
itemCount: dataList.length,
|
itemCount: dataList.length,
|
||||||
|
@ -7,6 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:loopin/IM/controller/chat_controller.dart';
|
import 'package:loopin/IM/controller/chat_controller.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
import 'package:loopin/utils/index.dart';
|
import 'package:loopin/utils/index.dart';
|
||||||
@ -151,7 +152,8 @@ class FlowingState extends State<Flowing> with SingleTickerProviderStateMixin {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
@ -161,9 +163,12 @@ class FlowingState extends State<Flowing> with SingleTickerProviderStateMixin {
|
|||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (hasMore) {
|
if (hasMore) {
|
||||||
await getData();
|
await getData();
|
||||||
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
childBuilder: (context, physics) {
|
childBuilder: (context, physics) {
|
||||||
|
if (dataList.isEmpty) return EmptyTip();
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
physics: physics,
|
physics: physics,
|
||||||
itemCount: dataList.length,
|
itemCount: dataList.length,
|
||||||
|
@ -13,8 +13,9 @@ import 'package:loopin/components/my_qrcode.dart';
|
|||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/components/only_down_scroll_physics.dart';
|
import 'package:loopin/components/only_down_scroll_physics.dart';
|
||||||
import 'package:loopin/controller/video_module_controller.dart';
|
import 'package:loopin/controller/video_module_controller.dart';
|
||||||
|
import 'package:loopin/pages/my/merchant/balance/balance.dart';
|
||||||
|
import 'package:loopin/pages/my/merchant/balance/controller.dart';
|
||||||
import 'package:loopin/service/http.dart';
|
import 'package:loopin/service/http.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
|
||||||
import 'package:loopin/utils/index.dart';
|
import 'package:loopin/utils/index.dart';
|
||||||
import 'package:loopin/utils/scan_code_type.dart';
|
import 'package:loopin/utils/scan_code_type.dart';
|
||||||
import 'package:nested_scroll_view_plus/nested_scroll_view_plus.dart';
|
import 'package:nested_scroll_view_plus/nested_scroll_view_plus.dart';
|
||||||
@ -279,6 +280,8 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
|
|
||||||
// 二维码名片弹窗
|
// 二维码名片弹窗
|
||||||
void qrcodeAlertDialog(BuildContext context) {
|
void qrcodeAlertDialog(BuildContext context) {
|
||||||
|
final role = imUserInfoController?.role.value ?? 0;
|
||||||
|
final isLeader = Utils.hasRole(role, 5);
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
@ -288,7 +291,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
width: 350.0,
|
width: 350.0,
|
||||||
child: AlertDialog(
|
child: AlertDialog(
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
|
||||||
backgroundColor: const Color(0xff07c160),
|
backgroundColor: Colors.white,
|
||||||
surfaceTintColor: Colors.white,
|
surfaceTintColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
|
||||||
content: Padding(
|
content: Padding(
|
||||||
@ -296,14 +299,10 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
MyQrcode(prefix: QrTypeCode.tgm)
|
MyQrcode(
|
||||||
// Image.asset('assets/images/pic1.jpg', width: 250.0, fit: BoxFit.contain),
|
prefix: QrTypeCode.tgm,
|
||||||
// const SizedBox(height: 15.0),
|
text: isLeader ? '推广码' : '',
|
||||||
// const Text('扫一扫,加好友',
|
),
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white38,
|
|
||||||
// fontSize: 14.0,
|
|
||||||
// )),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -748,6 +747,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
nickname.isNotEmpty ? nickname : '昵称',
|
nickname.isNotEmpty ? nickname : '昵称',
|
||||||
|
// '啊啊啊啊啊啊啊啊',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -759,51 +759,52 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// 团长的二维码
|
// 团长的二维码
|
||||||
Obx(
|
// Obx(
|
||||||
() {
|
// () {
|
||||||
// MERCHANT(2, "商家"),
|
// // MERCHANT(2, "商家"),
|
||||||
// AGENT(3, "代理"),
|
// // AGENT(3, "代理"),
|
||||||
// PLATFORM(4, "平台"),
|
// // PLATFORM(4, "平台"),
|
||||||
// REFERENCE(5, "团长")
|
// // REFERENCE(5, "团长")
|
||||||
final role = imUserInfoController?.role.value;
|
// final role = imUserInfoController?.role.value;
|
||||||
if (role == 4) {
|
// final isLeader = Utils.hasRole(role ?? 0, 5);
|
||||||
return Row(children: [
|
// if (!isLeader) {
|
||||||
SizedBox(width: 8),
|
// return Row(children: [
|
||||||
//
|
// SizedBox(width: 8),
|
||||||
InkWell(
|
// //
|
||||||
onTap: () => qrcodeAlertDialog(context),
|
// InkWell(
|
||||||
child: Container(
|
// onTap: () => qrcodeAlertDialog(context),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 5),
|
// child: Container(
|
||||||
decoration: BoxDecoration(
|
// padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 5),
|
||||||
color: Colors.black.withAlpha(176),
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20),
|
// color: Colors.black.withAlpha(176),
|
||||||
),
|
// borderRadius: BorderRadius.circular(20),
|
||||||
child: Row(
|
// ),
|
||||||
children: [
|
// child: Row(
|
||||||
Icon(
|
// children: [
|
||||||
Icons.qr_code_outlined,
|
// Icon(
|
||||||
size: 18,
|
// Icons.qr_code_outlined,
|
||||||
color: FStyle.secondaryColor,
|
// size: 18,
|
||||||
),
|
// color: FStyle.secondaryColor,
|
||||||
SizedBox(width: 4),
|
// ),
|
||||||
Text(
|
// SizedBox(width: 4),
|
||||||
'团长邀请码',
|
// Text(
|
||||||
style: TextStyle(
|
// '团长邀请码',
|
||||||
fontSize: 12,
|
// style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
// fontSize: 12,
|
||||||
color: FStyle.secondaryColor, // 彩色文字
|
// fontWeight: FontWeight.bold,
|
||||||
),
|
// color: FStyle.secondaryColor, // 彩色文字
|
||||||
)
|
// ),
|
||||||
],
|
// )
|
||||||
),
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
]);
|
// ),
|
||||||
} else {
|
// ]);
|
||||||
return const SizedBox();
|
// } else {
|
||||||
}
|
// return const SizedBox();
|
||||||
},
|
// }
|
||||||
),
|
// },
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
@ -907,6 +908,8 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildOrderCard(BuildContext context) {
|
Widget _buildOrderCard(BuildContext context) {
|
||||||
|
final role = imUserInfoController?.role.value ?? 0;
|
||||||
|
final isLeader = Utils.hasRole(role, 5);
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -946,15 +949,16 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
|
|||||||
_buildOrderIcon('assets/images/ico_order.png', '订单', () {
|
_buildOrderIcon('assets/images/ico_order.png', '订单', () {
|
||||||
Get.toNamed('/myOrder');
|
Get.toNamed('/myOrder');
|
||||||
}),
|
}),
|
||||||
_buildOrderIcon('assets/images/ico_dhx.png', '余额logout', () {
|
_buildOrderIcon('assets/images/ico_dhx.png', '余额', () {
|
||||||
|
Get.put(BalanceController());
|
||||||
|
Get.to(() => Balance());
|
||||||
|
}),
|
||||||
|
_buildOrderIcon('assets/images/ico_tgm.png', isLeader ? '推广码' : '好友码', () {
|
||||||
|
qrcodeAlertDialog(context);
|
||||||
|
}),
|
||||||
|
_buildOrderIcon('assets/images/icon_logout.png', '退出登录', () {
|
||||||
showLogoutDialog(context);
|
showLogoutDialog(context);
|
||||||
}),
|
}),
|
||||||
_buildOrderIcon('assets/images/ico_sh.png', '提现vloger', () {
|
|
||||||
Get.toNamed('/vloger');
|
|
||||||
}),
|
|
||||||
_buildOrderIcon('assets/images/ico_tgm.png', '推广码', () {
|
|
||||||
logger.e('推广码');
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
import 'package:easy_refresh/easy_refresh.dart';
|
import 'package:easy_refresh/easy_refresh.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/pages/my/merchant/balance/controller.dart';
|
import 'package:loopin/pages/my/merchant/balance/controller.dart';
|
||||||
|
import 'package:loopin/utils/index.dart';
|
||||||
|
|
||||||
class Balance extends StatefulWidget {
|
class Balance extends StatefulWidget {
|
||||||
const Balance({super.key});
|
const Balance({super.key});
|
||||||
@ -14,12 +16,18 @@ class Balance extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _BalanceState extends State<Balance> {
|
class _BalanceState extends State<Balance> {
|
||||||
final controller = Get.put(BalanceController());
|
final controller = Get.find<BalanceController>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
Get.delete<BalanceController>();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text("我的钱包")),
|
appBar: AppBar(title: Text("我的余额")),
|
||||||
body: ScrollConfiguration(
|
body: ScrollConfiguration(
|
||||||
behavior: CustomScrollBehavior().copyWith(scrollbars: false),
|
behavior: CustomScrollBehavior().copyWith(scrollbars: false),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -30,6 +38,9 @@ class _BalanceState extends State<Balance> {
|
|||||||
color: Colors.blueAccent,
|
color: Colors.blueAccent,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
|
final ctl = Get.find<ImUserInfoController>();
|
||||||
|
final role = ctl.role.value;
|
||||||
|
final isLeader = Utils.hasRole(role, 5);
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -46,13 +57,35 @@ class _BalanceState extends State<Balance> {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
// if (isLeader) const SizedBox(height: 12),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => controller.recharge(100.0),
|
onPressed: () {
|
||||||
|
// 加充值
|
||||||
|
controller.recharge(money: '0.1');
|
||||||
|
// http
|
||||||
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.orange,
|
backgroundColor: Colors.orange,
|
||||||
),
|
),
|
||||||
child: const Text("充值 100 元"),
|
child: const Text("充值"),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
//
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
// 提现
|
||||||
|
// controller.recharge(money: '0.1');
|
||||||
|
controller.withDraw(money: '1000');
|
||||||
|
// http
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.orange,
|
||||||
|
),
|
||||||
|
child: const Text("提现"),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -61,8 +94,7 @@ class _BalanceState extends State<Balance> {
|
|||||||
|
|
||||||
// 下半部分:流水记录分页列表
|
// 下半部分:流水记录分页列表
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(() {
|
child: EasyRefresh.builder(
|
||||||
return EasyRefresh.builder(
|
|
||||||
callLoadOverOffset: 20, //触底距离
|
callLoadOverOffset: 20, //触底距离
|
||||||
callRefreshOverOffset: 20, // 下拉距离
|
callRefreshOverOffset: 20, // 下拉距离
|
||||||
header: ClassicHeader(
|
header: ClassicHeader(
|
||||||
@ -79,32 +111,45 @@ class _BalanceState extends State<Balance> {
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: controller.hasMore.value ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
succeededIcon: controller.hasMore.value ? Icon(Icons.check_circle, color: Colors.green) : Icon(Icons.warning, color: Colors.orange),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
await controller.getData(reset: true);
|
await controller.getData(reset: true);
|
||||||
},
|
},
|
||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (controller.hasMore.value) {
|
if (controller.hasMore.value) {
|
||||||
await controller.getData();
|
await controller.getData();
|
||||||
|
return controller.hasMore.value ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
childBuilder: (context, physics) {
|
childBuilder: (context, physics) {
|
||||||
|
return Obx(
|
||||||
|
() {
|
||||||
|
// 数据加载中
|
||||||
|
if (controller.isLoading.value && controller.data.isEmpty) {
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//空
|
||||||
|
if (controller.data.isEmpty) {
|
||||||
|
return EmptyTip();
|
||||||
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
physics: physics,
|
physics: physics,
|
||||||
itemCount: controller.data.length,
|
itemCount: controller.data.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final tx = controller.data[index];
|
final tx = controller.data[index];
|
||||||
logger.w(tx.source);
|
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(tx.source),
|
title: Text(tx.source),
|
||||||
subtitle: Text(tx.createTime),
|
subtitle: Text(tx.createTime),
|
||||||
trailing: Text(
|
trailing: Text(
|
||||||
"变动金额:${tx.changeType == 1 ? '+' : '-'}${tx.changeAmount}", // 变动金额
|
"变动金额:${tx.changeType == 1 ? '+' : '-'}${tx.changeAmount}${tx.id}", // 变动金额
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: tx.changeType == 1 ? Colors.green : Colors.red,
|
color: tx.changeType == 1 ? Colors.green : Colors.red,
|
||||||
@ -115,7 +160,8 @@ class _BalanceState extends State<Balance> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
||||||
|
import 'package:loopin/IM/im_friend_listeners.dart';
|
||||||
|
import 'package:loopin/api/common_api.dart';
|
||||||
import 'package:loopin/pages/my/merchant/balance/model.dart';
|
import 'package:loopin/pages/my/merchant/balance/model.dart';
|
||||||
|
import 'package:loopin/service/http.dart';
|
||||||
|
import 'package:loopin/utils/wxsdk.dart';
|
||||||
|
|
||||||
class BalanceController extends GetxController {
|
class BalanceController extends GetxController {
|
||||||
/// 钱包余额
|
/// 钱包余额
|
||||||
@ -21,36 +27,130 @@ class BalanceController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 充值
|
/// 充值
|
||||||
void recharge(double amount) {
|
Future<void> recharge({required String money}) async {
|
||||||
balance.value += amount;
|
// 获取支付参数
|
||||||
// 同时加一条流水
|
final data = {"orderType": "RECHARGE", "clientType": "APP", "paymentMethod": "WECHAT", "paymentClient": "APP", "money": money};
|
||||||
|
final res = await Http.post(CommonApi.addBalance, data: data);
|
||||||
|
logger.w(res);
|
||||||
|
final payParams = res['data'];
|
||||||
|
logger.w(payParams);
|
||||||
|
// 拉起支付
|
||||||
|
await Wxsdk.payWithWx(
|
||||||
|
appId: payParams['appid'],
|
||||||
|
partnerId: payParams['partnerid'],
|
||||||
|
prepayId: payParams['prepayid'],
|
||||||
|
packageValue: payParams['package'],
|
||||||
|
nonceStr: payParams['noncestr'],
|
||||||
|
timestamp: int.parse(payParams['timestamp']),
|
||||||
|
sign: payParams['sign'],
|
||||||
|
);
|
||||||
|
// 在回调结果中获取新的数据
|
||||||
|
// getData(reset: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 提现
|
||||||
|
Future<void> withDraw({required String money}) async {
|
||||||
|
final infoCtl = Get.find<ImUserInfoController>();
|
||||||
|
final openId = infoCtl.customInfo['openId'];
|
||||||
|
if (openId == null || openId.isEmpty) {
|
||||||
|
showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('微信授权'),
|
||||||
|
content: const Text('余额提现至您的微信零钱内,是否前往微信授权?', style: TextStyle(fontSize: 16.0)),
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
surfaceTintColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
|
||||||
|
elevation: 2.0,
|
||||||
|
actionsPadding: const EdgeInsets.all(15.0),
|
||||||
|
actions: [
|
||||||
|
TextButton(onPressed: () => {Get.back()}, child: Text('取消', style: TextStyle(color: Colors.red))),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
//去授权
|
||||||
|
await Wxsdk.login();
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: Text('确认')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// final res = await Http.post(CommonApi.withdraw, data: {
|
||||||
|
// "money": money,
|
||||||
|
// "method": "1",
|
||||||
|
// });
|
||||||
|
// MyDialog.('提现成功,系统将在一个工作日内将余额提现至您绑定的微信内');
|
||||||
|
showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('提现成功'),
|
||||||
|
content: const Text('系统将在一个工作日内将余额提现至您绑定的微信内', style: TextStyle(fontSize: 16.0)),
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
surfaceTintColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
|
||||||
|
elevation: 2.0,
|
||||||
|
actionsPadding: const EdgeInsets.all(15.0),
|
||||||
|
actions: [
|
||||||
|
TextButton(onPressed: () => {Get.back()}, child: Text('确认')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
getData(reset: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 分页数据
|
/// 分页数据
|
||||||
Future<void> getData({bool reset = false}) async {
|
Future<void> getData({bool reset = false}) async {
|
||||||
if (isLoading.value) return;
|
if (isLoading.value) {
|
||||||
|
logger.w('正在加载中,跳过');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
logger.w('开始加载数据,reset: $reset, currentPage: $currentPage');
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
|
logger.w('重置数据');
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
data.clear();
|
data.clear();
|
||||||
hasMore.value = true;
|
hasMore.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Future.delayed(const Duration(seconds: 3)); // 模拟网络延迟
|
|
||||||
|
|
||||||
List<AccountBill> newData = List.generate(
|
List<AccountBill> newData = List.generate(
|
||||||
10,
|
10,
|
||||||
(index) => AccountBill(id: index),
|
(index) {
|
||||||
|
int id = currentPage * 10 + index + 1;
|
||||||
|
// logger.w('生成数据: id=$id');
|
||||||
|
return AccountBill(
|
||||||
|
id: id,
|
||||||
|
source: '来源 $currentPage-${index + 1}',
|
||||||
|
changeAmount: (index + 1) * 10.0,
|
||||||
|
changeType: index % 2 + 1,
|
||||||
|
createTime: DateTime.now().toString(),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
data.addAll(newData);
|
data.addAll(newData);
|
||||||
currentPage++;
|
logger.w('添加了 ${newData.length} 条数据,总数据量: ${data.length}');
|
||||||
|
|
||||||
if (currentPage > 3) {
|
currentPage++;
|
||||||
|
logger.w('页码增加到: $currentPage');
|
||||||
|
|
||||||
|
if (currentPage > 5) {
|
||||||
hasMore.value = false;
|
hasMore.value = false;
|
||||||
|
logger.w('没有更多数据了');
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
|
logger.w('加载完成');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:loopin/IM/controller/chat_controller.dart';
|
import 'package:loopin/IM/controller/chat_controller.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
import 'package:loopin/behavior/custom_scroll_behavior.dart';
|
||||||
|
import 'package:loopin/components/empty_tip.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
import 'package:loopin/utils/index.dart';
|
import 'package:loopin/utils/index.dart';
|
||||||
@ -151,7 +152,8 @@ class MutualFollowersState extends State<MutualFollowers> with SingleTickerProvi
|
|||||||
armedText: '释放加载',
|
armedText: '释放加载',
|
||||||
readyText: '加载中...',
|
readyText: '加载中...',
|
||||||
processingText: '加载中...',
|
processingText: '加载中...',
|
||||||
processedText: hasMore ? '加载完成' : '没有更多了~',
|
processedText: '加载完成',
|
||||||
|
noMoreText: '没有更多了~',
|
||||||
failedText: '加载失败,请重试',
|
failedText: '加载失败,请重试',
|
||||||
messageText: '最后更新于 %T',
|
messageText: '最后更新于 %T',
|
||||||
),
|
),
|
||||||
@ -161,9 +163,12 @@ class MutualFollowersState extends State<MutualFollowers> with SingleTickerProvi
|
|||||||
onLoad: () async {
|
onLoad: () async {
|
||||||
if (hasMore) {
|
if (hasMore) {
|
||||||
await getData();
|
await getData();
|
||||||
|
return hasMore ? IndicatorResult.success : IndicatorResult.noMore;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
childBuilder: (context, physics) {
|
childBuilder: (context, physics) {
|
||||||
|
if (dataList.isEmpty) return EmptyTip();
|
||||||
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
physics: physics,
|
physics: physics,
|
||||||
itemCount: dataList.length,
|
itemCount: dataList.length,
|
||||||
|
@ -65,10 +65,10 @@ class _NickNameState extends State<NickName> {
|
|||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||||
),
|
),
|
||||||
maxLength: 20,
|
maxLength: 8,
|
||||||
validator: FormBuilderValidators.compose([
|
validator: FormBuilderValidators.compose([
|
||||||
FormBuilderValidators.required(errorText: '昵称不能为空'),
|
FormBuilderValidators.required(errorText: '昵称不能为空'),
|
||||||
FormBuilderValidators.maxLength(20, errorText: '昵称不能超过20个字符'),
|
FormBuilderValidators.maxLength(8, errorText: '昵称不能超过8个字符'),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
@ -14,9 +14,12 @@ class Setting extends StatelessWidget {
|
|||||||
'onTap': () => Get.toNamed('/userInfo'),
|
'onTap': () => Get.toNamed('/userInfo'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': Icons.notifications,
|
// 'icon': Icons.notifications,
|
||||||
'title': '通知设置',
|
// 'title': '通知设置',
|
||||||
'onTap': () => Get.toNamed('/notifications'),
|
// 'onTap': () => Get.toNamed('/notifications'),
|
||||||
|
'icon': Icons.logout,
|
||||||
|
'title': '注销账号',
|
||||||
|
'onTap': () => Get.toNamed('/delete'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': Icons.lock,
|
'icon': Icons.lock,
|
||||||
|
@ -8,6 +8,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:image_cropper/image_cropper.dart';
|
import 'package:image_cropper/image_cropper.dart';
|
||||||
import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
||||||
import 'package:loopin/api/common_api.dart';
|
import 'package:loopin/api/common_api.dart';
|
||||||
|
import 'package:loopin/components/my_toast.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/service/http.dart';
|
import 'package:loopin/service/http.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
@ -68,7 +69,12 @@ class _UserInfoState extends State<UserInfo> {
|
|||||||
|
|
||||||
/// 微信授权
|
/// 微信授权
|
||||||
Future<void> wechatLogin() async {
|
Future<void> wechatLogin() async {
|
||||||
|
final isNeed = userInfoController.customInfo['openId'];
|
||||||
|
if (isNeed == null || isNeed == '') {
|
||||||
await Wxsdk.login();
|
await Wxsdk.login();
|
||||||
|
} else {
|
||||||
|
MyToast().tip(title: '您已授权无需重复操作');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 选性别
|
/// 选性别
|
||||||
@ -239,7 +245,7 @@ class _UserInfoState extends State<UserInfo> {
|
|||||||
if (sizeInMB > 200) {
|
if (sizeInMB > 200) {
|
||||||
MyDialog.toast('图片大小不能超过200MB', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
MyDialog.toast('图片大小不能超过200MB', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.red.withAlpha(200)));
|
||||||
} else {
|
} else {
|
||||||
print("视频合法,大小:$sizeInMB MB");
|
print("图片合法,大小:$sizeInMB MB");
|
||||||
//走upload(file)上传图片拿到url地址
|
//走upload(file)上传图片拿到url地址
|
||||||
final istance = MyDialog.loading('上传中');
|
final istance = MyDialog.loading('上传中');
|
||||||
final res = await Http.upload(CommonApi.uploadFile, filePath: file.path);
|
final res = await Http.upload(CommonApi.uploadFile, filePath: file.path);
|
||||||
@ -371,10 +377,6 @@ class _UserInfoState extends State<UserInfo> {
|
|||||||
final imageUrl = userInfoController.customInfo['coverBg'];
|
final imageUrl = userInfoController.customInfo['coverBg'];
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => pickCover(context),
|
onTap: () => pickCover(context),
|
||||||
// child: Image(
|
|
||||||
// image: (imageUrl != null && imageUrl.isNotEmpty) ? NetworkImage(imageUrl) : const AssetImage('assets/images/pic2.jpg') as ImageProvider,
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
child: NetworkOrAssetImage(
|
child: NetworkOrAssetImage(
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
placeholderAsset: 'assets/images/bk.jpg',
|
placeholderAsset: 'assets/images/bk.jpg',
|
||||||
|
@ -4,14 +4,14 @@ import 'package:get/get.dart';
|
|||||||
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
||||||
import 'package:loopin/IM/controller/chat_controller.dart';
|
import 'package:loopin/IM/controller/chat_controller.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/service/http.dart';
|
|
||||||
import 'package:loopin/components/custom_sticky_header.dart';
|
|
||||||
import 'package:loopin/api/common_api.dart';
|
import 'package:loopin/api/common_api.dart';
|
||||||
import 'package:loopin/api/video_api.dart';
|
import 'package:loopin/api/video_api.dart';
|
||||||
import 'package:loopin/utils/index.dart';
|
import 'package:loopin/components/custom_sticky_header.dart';
|
||||||
import 'package:loopin/components/network_or_asset_image.dart';
|
import 'package:loopin/components/network_or_asset_image.dart';
|
||||||
import 'package:loopin/components/only_down_scroll_physics.dart';
|
import 'package:loopin/components/only_down_scroll_physics.dart';
|
||||||
|
import 'package:loopin/service/http.dart';
|
||||||
import 'package:loopin/styles/index.dart';
|
import 'package:loopin/styles/index.dart';
|
||||||
|
import 'package:loopin/utils/index.dart';
|
||||||
import 'package:nested_scroll_view_plus/nested_scroll_view_plus.dart';
|
import 'package:nested_scroll_view_plus/nested_scroll_view_plus.dart';
|
||||||
import 'package:shirne_dialog/shirne_dialog.dart';
|
import 'package:shirne_dialog/shirne_dialog.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_conversation.dart';
|
||||||
@ -82,7 +82,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
args = Get.arguments ?? {};
|
args = Get.arguments ?? {};
|
||||||
print('argsssssssssssssssssssssss${args}');
|
print('argsssssssssssssssssssssss$args');
|
||||||
itemsParams = PageParams();
|
itemsParams = PageParams();
|
||||||
favoriteParams = PageParams();
|
favoriteParams = PageParams();
|
||||||
selfInfo();
|
selfInfo();
|
||||||
@ -128,15 +128,14 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
// 获取用户的所有视频的点赞数量
|
// 获取用户的所有视频的点赞数量
|
||||||
void getUserLikesCount() async {
|
void getUserLikesCount() async {
|
||||||
try {
|
try {
|
||||||
final resData = await Http.get(CommonApi.accountInfo+'?memberId=${args['memberId']}');
|
final resData = await Http.get('${CommonApi.accountInfo}?memberId=${args['memberId']}');
|
||||||
print('aaaaaaaaaaaaaaaaaaa${resData}');
|
print('aaaaaaaaaaaaaaaaaaa$resData');
|
||||||
if (resData != null && resData['code'] == 200) {
|
if (resData != null && resData['code'] == 200) {
|
||||||
vlogLikeCount = resData['data']['vlogLikeCount'] ?? 0;
|
vlogLikeCount = resData['data']['vlogLikeCount'] ?? 0;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
void loadData([int? tabIndex]) async {
|
void loadData([int? tabIndex]) async {
|
||||||
final index = tabIndex ?? currentTabIndex.value;
|
final index = tabIndex ?? currentTabIndex.value;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
@ -394,7 +393,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
// placeholderAsset: 'assets/images/video_placeholder.png',
|
placeholderAsset: 'assets/images/bk.jpg',
|
||||||
),
|
),
|
||||||
// 半透明渐变底部背景
|
// 半透明渐变底部背景
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -421,7 +420,8 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
bottom: 8,
|
bottom: 8,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.favorite,
|
const Icon(
|
||||||
|
Icons.favorite,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 16,
|
size: 16,
|
||||||
),
|
),
|
||||||
@ -457,9 +457,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: params.hasMore
|
child: params.hasMore ? const CircularProgressIndicator() : const Text('没有更多数据了'),
|
||||||
? const CircularProgressIndicator()
|
|
||||||
: const Text('没有更多数据了'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -566,7 +564,11 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Column(children: [Text('${Utils.graceNumber(vlogLikeCount)}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), SizedBox(height: 3.0), Text('获赞')]),
|
Column(children: [
|
||||||
|
Text(Utils.graceNumber(vlogLikeCount), style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
||||||
|
SizedBox(height: 3.0),
|
||||||
|
Text('获赞')
|
||||||
|
]),
|
||||||
Column(children: [
|
Column(children: [
|
||||||
Text('${followInfo.value.followingCount}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
Text('${followInfo.value.followingCount}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
||||||
SizedBox(height: 3.0),
|
SizedBox(height: 3.0),
|
||||||
|
@ -56,7 +56,7 @@ class _UploadVideoPageState extends State<UploadVideoPage> {
|
|||||||
|
|
||||||
Future<void> pickVideo() async {
|
Future<void> pickVideo() async {
|
||||||
descFocusNode.unfocus();
|
descFocusNode.unfocus();
|
||||||
final hasPer = await Permissions.requestVideoPermission();
|
final hasPer = await Permissions.requestPhotoPermission();
|
||||||
|
|
||||||
if (!hasPer) {
|
if (!hasPer) {
|
||||||
Permissions.showPermissionDialog('相册');
|
Permissions.showPermissionDialog('相册');
|
||||||
|
@ -13,16 +13,17 @@ import 'package:loopin/pages/chat/notify/noFriend.dart';
|
|||||||
import 'package:loopin/pages/chat/notify/system.dart';
|
import 'package:loopin/pages/chat/notify/system.dart';
|
||||||
import 'package:loopin/pages/groupChat/groupList.dart';
|
import 'package:loopin/pages/groupChat/groupList.dart';
|
||||||
import 'package:loopin/pages/groupChat/index.dart';
|
import 'package:loopin/pages/groupChat/index.dart';
|
||||||
|
import 'package:loopin/pages/my/all_function.dart';
|
||||||
|
import 'package:loopin/pages/my/delete.dart';
|
||||||
import 'package:loopin/pages/my/des.dart';
|
import 'package:loopin/pages/my/des.dart';
|
||||||
import 'package:loopin/pages/my/fans.dart';
|
import 'package:loopin/pages/my/fans.dart';
|
||||||
import 'package:loopin/pages/my/flowing.dart';
|
import 'package:loopin/pages/my/flowing.dart';
|
||||||
|
import 'package:loopin/pages/my/merchant/income.dart';
|
||||||
import 'package:loopin/pages/my/mutual_followers.dart';
|
import 'package:loopin/pages/my/mutual_followers.dart';
|
||||||
import 'package:loopin/pages/my/nick_name.dart';
|
import 'package:loopin/pages/my/nick_name.dart';
|
||||||
import 'package:loopin/pages/my/setting.dart';
|
import 'package:loopin/pages/my/setting.dart';
|
||||||
import 'package:loopin/pages/my/user_info.dart';
|
import 'package:loopin/pages/my/user_info.dart';
|
||||||
import 'package:loopin/pages/my/vloger.dart';
|
import 'package:loopin/pages/my/vloger.dart';
|
||||||
import 'package:loopin/pages/my/all_function.dart';
|
|
||||||
import 'package:loopin/pages/my/merchant/income.dart';
|
|
||||||
import 'package:loopin/pages/order/my_order.dart';
|
import 'package:loopin/pages/order/my_order.dart';
|
||||||
import 'package:loopin/pages/order/seller_order.dart';
|
import 'package:loopin/pages/order/seller_order.dart';
|
||||||
import 'package:loopin/pages/search/index.dart';
|
import 'package:loopin/pages/search/index.dart';
|
||||||
@ -36,9 +37,9 @@ import '../pages/auth/login.dart';
|
|||||||
// 商品详细
|
// 商品详细
|
||||||
import '../pages/goods/detail.dart';
|
import '../pages/goods/detail.dart';
|
||||||
import '../pages/order/detail.dart';
|
import '../pages/order/detail.dart';
|
||||||
import '../pages/order/seller_detail.dart';
|
|
||||||
// 订单
|
// 订单
|
||||||
import '../pages/order/index.dart';
|
import '../pages/order/index.dart';
|
||||||
|
import '../pages/order/seller_detail.dart';
|
||||||
// 引入工具类
|
// 引入工具类
|
||||||
import '../utils/common.dart';
|
import '../utils/common.dart';
|
||||||
|
|
||||||
@ -68,9 +69,11 @@ final Map<String, Widget> routes = {
|
|||||||
'/about': const Setting(),
|
'/about': const Setting(),
|
||||||
'/des': const Des(),
|
'/des': const Des(),
|
||||||
'/nickName': const NickName(),
|
'/nickName': const NickName(),
|
||||||
|
'/delete': const Delete(),
|
||||||
|
|
||||||
//通知相关
|
//通知相关
|
||||||
'/noFriend': const Nofriend(),
|
'/noFriend': const Nofriend(),
|
||||||
'/newFocus': const Newfoucs(),
|
'/newFoucs': const Newfoucs(),
|
||||||
'/system': const System(),
|
'/system': const System(),
|
||||||
'/interaction': const Interaction(),
|
'/interaction': const Interaction(),
|
||||||
//关系链
|
//关系链
|
||||||
|
@ -2,6 +2,9 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
|
import 'package:loopin/IM/im_service.dart';
|
||||||
|
import 'package:loopin/controller/video_module_controller.dart';
|
||||||
|
import 'package:loopin/utils/common.dart';
|
||||||
|
|
||||||
class HttpConfig {
|
class HttpConfig {
|
||||||
static final Dio dio = Dio(BaseOptions(
|
static final Dio dio = Dio(BaseOptions(
|
||||||
@ -9,10 +12,10 @@ class HttpConfig {
|
|||||||
// baseUrl: 'http://111.62.22.190:8080',
|
// baseUrl: 'http://111.62.22.190:8080',
|
||||||
// baseUrl: 'http://cjh.wuzhongjie.com.cn',
|
// baseUrl: 'http://cjh.wuzhongjie.com.cn',
|
||||||
// baseUrl: 'http://82.156.121.2:8880',
|
// baseUrl: 'http://82.156.121.2:8880',
|
||||||
baseUrl: 'https://www.wuzhongjie.com.cn/prod-api',
|
// baseUrl: 'https://www.wuzhongjie.com.cn/prod-api',
|
||||||
|
|
||||||
// baseUrl: 'http://192.168.1.65:8880',
|
// baseUrl: 'http://192.168.1.65:8880',
|
||||||
// baseUrl: 'http://192.168.1.22:8080',
|
baseUrl: 'http://192.168.1.22:8080',
|
||||||
|
|
||||||
// connectTimeout: Duration(seconds: 30),
|
// connectTimeout: Duration(seconds: 30),
|
||||||
// receiveTimeout: Duration(seconds: 30),
|
// receiveTimeout: Duration(seconds: 30),
|
||||||
@ -23,6 +26,24 @@ class HttpConfig {
|
|||||||
|
|
||||||
static final box = GetStorage();
|
static final box = GetStorage();
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
static void handleLogout() async {
|
||||||
|
Get.offAllNamed(
|
||||||
|
'/login',
|
||||||
|
predicate: (route) {
|
||||||
|
return route.settings.name == '/';
|
||||||
|
},
|
||||||
|
);
|
||||||
|
final loginRes = await ImService.instance.logout();
|
||||||
|
if (loginRes.success) {
|
||||||
|
// 清除存储信息
|
||||||
|
Common.logout();
|
||||||
|
// 初始化视频
|
||||||
|
final videoController = Get.find<VideoModuleController>();
|
||||||
|
videoController.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void init() {
|
static void init() {
|
||||||
dio.interceptors.add(
|
dio.interceptors.add(
|
||||||
InterceptorsWrapper(
|
InterceptorsWrapper(
|
||||||
@ -46,6 +67,26 @@ class HttpConfig {
|
|||||||
// logger.e(response.requestOptions.data);
|
// logger.e(response.requestOptions.data);
|
||||||
final data = response.data;
|
final data = response.data;
|
||||||
if (data is Map<String, dynamic>) {
|
if (data is Map<String, dynamic>) {
|
||||||
|
// 处理token失效,强制退出
|
||||||
|
if (data['code'] == 20006) {
|
||||||
|
handleLogout();
|
||||||
|
Get.snackbar(
|
||||||
|
'登录状态已失效',
|
||||||
|
'您当前登录状态已失效,请重新登录',
|
||||||
|
duration: Duration(seconds: 5),
|
||||||
|
backgroundColor: Colors.red.withAlpha(230),
|
||||||
|
colorText: Colors.white,
|
||||||
|
icon: const Icon(Icons.error_outline, color: Colors.white),
|
||||||
|
);
|
||||||
|
return handler.reject(
|
||||||
|
DioException(
|
||||||
|
requestOptions: response.requestOptions,
|
||||||
|
error: data['msg'],
|
||||||
|
response: response,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 其他异常
|
||||||
if (data['code'] != 200) {
|
if (data['code'] != 200) {
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'错误码${data['code']}',
|
'错误码${data['code']}',
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:audioplayers/audioplayers.dart';
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
import 'package:loopin/IM/im_core.dart';
|
import 'package:loopin/IM/im_core.dart';
|
||||||
|
import 'package:loopin/components/my_toast.dart';
|
||||||
|
|
||||||
class AudioPlayerService {
|
class AudioPlayerService {
|
||||||
static final AudioPlayerService _instance = AudioPlayerService._internal();
|
static final AudioPlayerService _instance = AudioPlayerService._internal();
|
||||||
@ -11,10 +14,19 @@ class AudioPlayerService {
|
|||||||
/// 播放本地文件
|
/// 播放本地文件
|
||||||
Future<void> playLocal(String filePath) async {
|
Future<void> playLocal(String filePath) async {
|
||||||
try {
|
try {
|
||||||
|
final file = File(filePath);
|
||||||
|
if (!file.existsSync()) {
|
||||||
|
logger.e('本地音频文件不存在:$filePath');
|
||||||
|
MyToast().tip(title: '音频文件不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
await _audioPlayer.setSourceDeviceFile(filePath);
|
await _audioPlayer.setSourceDeviceFile(filePath);
|
||||||
await _audioPlayer.resume();
|
await _audioPlayer.resume();
|
||||||
|
// 等待播放完成
|
||||||
|
await _audioPlayer.onPlayerComplete.first;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.e('播放本地音频失败: $e');
|
logger.e('播放本地音频失败: $e');
|
||||||
|
MyToast().tip(title: '音频文件不存在');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,8 +35,11 @@ class AudioPlayerService {
|
|||||||
try {
|
try {
|
||||||
await _audioPlayer.setSourceUrl(url);
|
await _audioPlayer.setSourceUrl(url);
|
||||||
await _audioPlayer.resume();
|
await _audioPlayer.resume();
|
||||||
|
// 等待播放完成
|
||||||
|
await _audioPlayer.onPlayerComplete.first;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.e('播放网络音频失败: $e');
|
logger.e('播放网络音频失败: $e');
|
||||||
|
MyToast().tip(title: '音频文件不存在');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,4 +234,13 @@ class Utils {
|
|||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MERCHANT(2, "商家"),
|
||||||
|
// AGENT(3, "代理"),
|
||||||
|
// PLATFORM(4, "平台"),
|
||||||
|
// REFERENCE(5, "团长")
|
||||||
|
// 规则是将int按string去拼接
|
||||||
|
static bool hasRole(int roleValue, int targetRole) {
|
||||||
|
return roleValue.toString().contains(targetRole.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class NotificationBanner {
|
|||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
duration: const Duration(minutes: 1),
|
duration: const Duration(seconds: 5),
|
||||||
margin: const EdgeInsets.all(12),
|
margin: const EdgeInsets.all(12),
|
||||||
backgroundColor: FStyle.primaryColor.withAlpha(220),
|
backgroundColor: FStyle.primaryColor.withAlpha(220),
|
||||||
titleText: Row(
|
titleText: Row(
|
||||||
|
@ -10,13 +10,15 @@ class VoiceService {
|
|||||||
VoiceService._internal();
|
VoiceService._internal();
|
||||||
|
|
||||||
final AudioRecorder _recorder = AudioRecorder();
|
final AudioRecorder _recorder = AudioRecorder();
|
||||||
|
|
||||||
String? _voiceFilePath;
|
String? _voiceFilePath;
|
||||||
DateTime? _startTime;
|
DateTime? _startTime;
|
||||||
|
|
||||||
/// 开始录音
|
/// 开始录音
|
||||||
Future<bool> startRecording() async {
|
Future<bool> startRecording() async {
|
||||||
if (await _recorder.hasPermission()) {
|
if (await _recorder.hasPermission()) {
|
||||||
final dir = await getTemporaryDirectory(); // 临时目录
|
// final dir = await getTemporaryDirectory(); // 临时目录
|
||||||
|
final dir = await getApplicationDocumentsDirectory(); // 临时目录在ios不行
|
||||||
final filePath = '${dir.path}/${DateTime.now().millisecondsSinceEpoch}.m4a';
|
final filePath = '${dir.path}/${DateTime.now().millisecondsSinceEpoch}.m4a';
|
||||||
_voiceFilePath = filePath;
|
_voiceFilePath = filePath;
|
||||||
_startTime = DateTime.now();
|
_startTime = DateTime.now();
|
||||||
|
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
import 'package:loopin/IM/controller/im_user_info_controller.dart';
|
||||||
import 'package:loopin/IM/im_service.dart';
|
import 'package:loopin/IM/im_service.dart';
|
||||||
import 'package:loopin/api/common_api.dart';
|
import 'package:loopin/api/common_api.dart';
|
||||||
|
import 'package:loopin/pages/my/merchant/balance/controller.dart';
|
||||||
import 'package:loopin/service/http.dart';
|
import 'package:loopin/service/http.dart';
|
||||||
|
|
||||||
class Wxsdk {
|
class Wxsdk {
|
||||||
@ -48,10 +49,28 @@ class Wxsdk {
|
|||||||
info.customInfo.refresh();
|
info.customInfo.refresh();
|
||||||
logger.w(serverRes['data']['openId']);
|
logger.w(serverRes['data']['openId']);
|
||||||
}
|
}
|
||||||
|
//
|
||||||
} else {
|
} else {
|
||||||
logger.w('微信授权失败: ${res.errStr}-类型:${res.state}');
|
logger.w('微信授权失败: ${res.errStr}-类型:${res.state}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 支付
|
||||||
|
if (res is WeChatPaymentResponse) {
|
||||||
|
logger.e(res);
|
||||||
|
if (res.isSuccessful) {
|
||||||
|
logger.i("微信支付成功");
|
||||||
|
// 获取新的数据
|
||||||
|
final ctl = Get.find<BalanceController>();
|
||||||
|
// 刷新记录
|
||||||
|
ctl.getData(reset: true);
|
||||||
|
} else {
|
||||||
|
if (res.errCode == -2) {
|
||||||
|
logger.w("用户取消支付");
|
||||||
|
} else {
|
||||||
|
logger.e("微信支付失败: code=${res.errCode}, msg=${res.errStr}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 分享
|
// 分享
|
||||||
if (res is WeChatShareResponse) {
|
if (res is WeChatShareResponse) {
|
||||||
logger.w(res.isSuccessful);
|
logger.w(res.isSuccessful);
|
||||||
@ -141,4 +160,46 @@ class Wxsdk {
|
|||||||
);
|
);
|
||||||
Fluwx().open(target: miniProgram);
|
Fluwx().open(target: miniProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 微信支付
|
||||||
|
/// [appId] 微信开放平台申请的 appId
|
||||||
|
/// [partnerId] 商户号
|
||||||
|
/// [prepayId] 预支付交易会话ID
|
||||||
|
/// [packageValue] 固定值:Sign=WXPay
|
||||||
|
/// [nonceStr] 随机字符串
|
||||||
|
/// [timestamp] 时间戳(秒级,int 类型)
|
||||||
|
/// [sign] 签名
|
||||||
|
/// [signType] 非必传,默认 MD5
|
||||||
|
/// [extData] 业务自定义
|
||||||
|
static Future<void> payWithWx({
|
||||||
|
required String appId,
|
||||||
|
required String partnerId,
|
||||||
|
required String prepayId,
|
||||||
|
required String packageValue,
|
||||||
|
required String nonceStr,
|
||||||
|
required int timestamp,
|
||||||
|
required String sign,
|
||||||
|
String? signType,
|
||||||
|
String? extData,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final payParams = Payment(
|
||||||
|
appId: appId,
|
||||||
|
partnerId: partnerId,
|
||||||
|
prepayId: prepayId,
|
||||||
|
packageValue: packageValue,
|
||||||
|
nonceStr: nonceStr,
|
||||||
|
timestamp: timestamp,
|
||||||
|
sign: sign,
|
||||||
|
signType: signType,
|
||||||
|
extData: extData,
|
||||||
|
);
|
||||||
|
logger.e(payParams.arguments);
|
||||||
|
final result = await fluwx.pay(which: payParams);
|
||||||
|
|
||||||
|
logger.i("调用微信支付结果: $result");
|
||||||
|
} catch (e) {
|
||||||
|
logger.e("调用微信支付失败: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -829,6 +829,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
lottie:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: lottie
|
||||||
|
sha256: c5fa04a80a620066c15cf19cc44773e19e9b38e989ff23ea32e5903ef1015950
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "3.3.1"
|
||||||
lpinyin:
|
lpinyin:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -99,6 +99,7 @@ dependencies:
|
|||||||
cached_network_image: ^3.4.1
|
cached_network_image: ^3.4.1
|
||||||
image_cropper: ^9.1.0
|
image_cropper: ^9.1.0
|
||||||
pretty_qr_code: ^3.5.0
|
pretty_qr_code: ^3.5.0
|
||||||
|
lottie: ^3.3.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_launcher_icons: ^0.13.1 # 使用最新版本
|
flutter_launcher_icons: ^0.13.1 # 使用最新版本
|
||||||
@ -140,6 +141,7 @@ flutter:
|
|||||||
- assets/images/emotion/face05/
|
- assets/images/emotion/face05/
|
||||||
#update
|
#update
|
||||||
- assets/images/update/rocket.png
|
- assets/images/update/rocket.png
|
||||||
|
- assets/animation/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user