更新在线客服
This commit is contained in:
@@ -2,9 +2,11 @@ class CommonVariables {
|
||||
static bool isNetWorkOn = false;
|
||||
static String supabaseUrl = "https://zhmht.swes.com.cn:3443";
|
||||
// 企业微信客服拉起的url地址
|
||||
static String wxKfUrl = "https://work.weixin.qq.com/kfid/kfcab6a07e8aac68945";
|
||||
// static String wxKfUrl = "https://work.weixin.qq.com/kfid/kfcab6a07e8aac68945";
|
||||
static String wxKfUrl = "https://work.weixin.qq.com/kfid/kfc7d2337b9c07b1269";
|
||||
// 企业微信ID
|
||||
static String wxCorpId = "wwc17348c75dbde1dc";
|
||||
// static String wxCorpId = "wwc17348c75dbde1dc";
|
||||
static String wxCorpId = "ww51feda6026280cd0";
|
||||
//ICP备案号
|
||||
static String ICPRightCode = "皖ICP备2024068219号-1A";
|
||||
//公司名称
|
||||
|
||||
@@ -140,10 +140,13 @@ Future<void> initWX() async {
|
||||
Fluwx fluwx = Fluwx();
|
||||
fluwx.registerApi(
|
||||
//请填写自己的微信appid
|
||||
appId: "wxeb2688220799e2c5",
|
||||
// appId: "wxeb2688220799e2c5",//太和
|
||||
appId: "wx929c548fea6af9c7",//眠花糖
|
||||
doOnAndroid: true,
|
||||
doOnIOS: true,
|
||||
universalLink: "https://app.he-info.com/theh/");
|
||||
// universalLink: "https://app.he-info.com/theh/",
|
||||
universalLink: "https://zhmht.swes.com.cn/app/",
|
||||
);
|
||||
}
|
||||
|
||||
Timer? _messageTimer;
|
||||
|
||||
@@ -3,7 +3,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:fluwx/fluwx.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
@@ -13,6 +15,8 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart';
|
||||
|
||||
class NewMinePage extends StatefulWidget {
|
||||
const NewMinePage({super.key});
|
||||
|
||||
@@ -299,10 +303,17 @@ class _MinePageState extends State<NewMinePage> {
|
||||
'问题与帮助', '常见的问题汇总,如:智能床连接流程、如何查看睡眠报告',
|
||||
path: "/issueListpage"),
|
||||
_buildListTile(
|
||||
'assets/img/icon/customer_service.svg',
|
||||
'在线客服',
|
||||
'购买和使用智能床过程中,如果遇到疑问可与客服进行联系',
|
||||
path: ""),
|
||||
'assets/img/icon/customer_service.svg',
|
||||
'在线客服',
|
||||
'购买和使用智能床过程中,如果遇到疑问可与客服进行联系',
|
||||
path: "",
|
||||
onTap: () async {
|
||||
MHTLoginController mhtLoginController =
|
||||
Get.find<MHTLoginController>();
|
||||
await mhtLoginController
|
||||
.openWeChatCustomerService(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -334,85 +345,89 @@ class _MinePageState extends State<NewMinePage> {
|
||||
String svgPath,
|
||||
String title,
|
||||
String subtitle, {
|
||||
// VoidCallback? onTap,
|
||||
String? path,
|
||||
bool showTopLine = false,
|
||||
VoidCallback? onTap, // ✅ 新增可选 onTap 参数
|
||||
}) {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.white,
|
||||
padding: EdgeInsets.all(0.rpx),
|
||||
onTap: () {
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.white,
|
||||
padding: EdgeInsets.all(0.rpx),
|
||||
onTap: () {
|
||||
if (onTap != null) {
|
||||
onTap(); // ✅ 使用外部传入的 onTap
|
||||
} else {
|
||||
if (path == null || path.isEmpty) {
|
||||
TopSlideNotification.show(context, text: "待开发功能".tr);
|
||||
} else {
|
||||
Get.toNamed(path);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: showTopLine
|
||||
? BorderSide(color: Color(0xFF929699), width: 0.5.rpx)
|
||||
: BorderSide.none,
|
||||
bottom: BorderSide(color: Color(0xFF929699), width: 0.5.rpx),
|
||||
),
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: showTopLine
|
||||
? BorderSide(color: Color(0xFF929699), width: 0.5.rpx)
|
||||
: BorderSide.none,
|
||||
bottom: BorderSide(color: Color(0xFF929699), width: 0.5.rpx),
|
||||
),
|
||||
height: 116.rpx,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(40.rpx, 0.rpx, 40.rpx, 0.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
),
|
||||
height: 116.rpx,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(40.rpx, 0.rpx, 40.rpx, 0.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
svgPath,
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
),
|
||||
SizedBox(width: 30.rpx),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
color: Color(0xFF929699),
|
||||
fontSize: 20.rpx,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(right: 0),
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
svgPath,
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
'assets/img/icon/expand.svg',
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 30.rpx),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center, // 垂直方向居中对齐
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
// SizedBox(height: 6.rpx), // 加点间距
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
color: Color(0xFF929699),
|
||||
fontSize: 20.rpx,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: true, // 允许换行
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(right: 0),
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand.svg',
|
||||
color: Colors.white,
|
||||
))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSettingButton() {
|
||||
|
||||
@@ -6,11 +6,14 @@ import 'package:fluwx/fluwx.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/model/user_data.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
|
||||
|
||||
@@ -247,12 +250,54 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
|
||||
// await repository.logout();
|
||||
}
|
||||
|
||||
loginByWechatCode(String code) async {
|
||||
// return await repository.loginByWechatCode(code);
|
||||
Future<int> loginByWechatCode(String code) async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.login;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
String? language = "";
|
||||
var data = {
|
||||
"type": 2,
|
||||
"password": code,
|
||||
"khCode": "mht",
|
||||
};
|
||||
ApiResponse apiResponse = await requestWithLog(
|
||||
logTitle: "微信登录",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
userInfoController.model.login = 1;
|
||||
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
|
||||
String token = apiResponse.rawResponse.headers['token']!.first;
|
||||
EasyDartModule.dio.token = token;
|
||||
final box = GetStorage();
|
||||
box.write('token', token); // 存储 token
|
||||
box.write('user', userInfoController.model.user!.toJson()); // 存储用户信息
|
||||
}
|
||||
return apiResponse.code!;
|
||||
}
|
||||
|
||||
//注销账号
|
||||
deletedAccount() async {
|
||||
// return await repository.deletedAccount();
|
||||
}
|
||||
|
||||
Future<void> openWeChatCustomerService(BuildContext context) async {
|
||||
bool isWeChatInstalled = await fluwx.isWeChatInstalled;
|
||||
if (!isWeChatInstalled) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "请先安装微信APP,再联系客服".tr,
|
||||
textColor: themeController.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "正在打开微信客服...".tr,
|
||||
);
|
||||
await fluwx.open(
|
||||
target: CustomerServiceChat(
|
||||
corpId: CommonVariables.wxCorpId, url: CommonVariables.wxKfUrl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
textColor: themeController.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
String msg = await controller.loginByWechatCode(code);
|
||||
if (msg.isEmpty) {
|
||||
int rescode = await controller.loginByWechatCode(code);
|
||||
if (rescode == 1) {
|
||||
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
||||
controller.fluwxCancelable?.cancel();
|
||||
// 登录成功移出网络检查监听
|
||||
@@ -1785,25 +1785,29 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
borderRadius: 999.rpx,
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () async {
|
||||
//loginController.model.isIos == true &&
|
||||
// if (loginController
|
||||
// .model.register_agree ==
|
||||
// null ||
|
||||
// loginController
|
||||
// .model.register_agree !=
|
||||
// true) {
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "登录页.未同意协议".tr,
|
||||
// textColor:
|
||||
// themeController.currentColor.sc9,
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// await loginController
|
||||
// .wxLoginSendAuth(context);
|
||||
TopSlideNotification.show(context,
|
||||
text: "测试阶段,暂不支持".tr);
|
||||
// loginController.model.isIos == true &&
|
||||
MHTRegisterController
|
||||
registerController = Get.find();
|
||||
if (registerController
|
||||
.model.register_agree ==
|
||||
null ||
|
||||
registerController
|
||||
.model.register_agree !=
|
||||
true) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "登录页.未同意协议".tr,
|
||||
textColor:
|
||||
themeController.currentColor.sc9,
|
||||
);
|
||||
return;
|
||||
}
|
||||
MHTLoginController loginController =
|
||||
Get.find();
|
||||
await loginController
|
||||
.wxLoginSendAuth();
|
||||
// TopSlideNotification.show(context,
|
||||
// text: "测试阶段,暂不支持".tr);
|
||||
},
|
||||
child: Container(
|
||||
width: 90.rpx,
|
||||
|
||||
Reference in New Issue
Block a user