feat:为了上架,新增客服功能
This commit is contained in:
parent
dafb40954a
commit
8d149ef4b3
40
lib/login/login/app_get_version.dart
Normal file
40
lib/login/login/app_get_version.dart
Normal file
@ -0,0 +1,40 @@
|
||||
class GetAppInfo {
|
||||
GetAppInfo({this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
GetAppInfo.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
if (json['data'] is Map) {
|
||||
data = Data.fromJson(json['data']);
|
||||
}
|
||||
}
|
||||
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
data['data'] = this.data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
wechatServiceUrl = json['wechat_service_url'];
|
||||
}
|
||||
|
||||
String? wechatServiceUrl;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['wechat_service_url'] = wechatServiceUrl;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -35,6 +36,12 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
haveBack: false,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
IconButton(
|
||||
onPressed: CustomerTool.openCustomerService,
|
||||
icon: Icon(
|
||||
Icons.support_agent,
|
||||
color: AppColors.mainColor,
|
||||
)),
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
@ -239,22 +246,24 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
if (F.isLite) Container() else GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
if (F.isLite)
|
||||
Container()
|
||||
else
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_state.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -33,7 +36,7 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
top: 120.h,
|
||||
top: 110.h,
|
||||
),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
@ -41,12 +44,24 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${"欢迎使用".tr}${F.title}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 48.sp,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${"欢迎使用".tr}${F.title}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 48.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: CustomerTool.openCustomerService,
|
||||
icon: Icon(
|
||||
Icons.support_agent,
|
||||
color: AppColors.mainColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
GestureDetector(
|
||||
|
||||
@ -10,6 +10,7 @@ import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
@ -352,6 +353,12 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
action: () {
|
||||
logic.showToast('功能暂未开放'.tr);
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.supportStaff!.tr,
|
||||
isHaveLine: widget.showAbout,
|
||||
isHaveDirection: true,
|
||||
action: CustomerTool.openCustomerService,
|
||||
),
|
||||
if (widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.about!.tr,
|
||||
|
||||
@ -239,4 +239,5 @@ abstract class Api {
|
||||
|
||||
final String lockDataUploadUrl = '/lockRecords/lockDataUpload'; // 锁数据上传
|
||||
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板
|
||||
final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息
|
||||
}
|
||||
|
||||
@ -2122,6 +2122,11 @@ class ApiProvider extends BaseProvider {
|
||||
'keyId': keyId,
|
||||
'channelType': channelType,
|
||||
}));
|
||||
|
||||
// 获取App基本信息
|
||||
Future<Response<dynamic>> getAppInfo() =>
|
||||
post(appGetAppInfoURL.toUrl, jsonEncode(<String, int>{}),
|
||||
isShowErrMsg: false);
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/entity/lock_user_no_list_entity.dart';
|
||||
import 'package:star_lock/login/login/app_get_version.dart';
|
||||
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||
@ -2150,4 +2151,11 @@ class ApiRepository {
|
||||
await apiProvider.getNoticeTemplate(lockId, keyId, channelType);
|
||||
return NoticeTemplateEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 电子钥匙获取短信模板
|
||||
Future<GetAppInfo> getAppInfo() async {
|
||||
final Response<dynamic> res =
|
||||
await apiProvider.getAppInfo();
|
||||
return GetAppInfo.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,9 @@ import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/app_get_version.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../versionUndate/versionUndateTool.dart';
|
||||
@ -41,6 +44,8 @@ class AppFirstEnterHandle {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
final GetAppInfo entity = await ApiRepository.to.getAppInfo();
|
||||
CustomerTool.init(entity.data?.wechatServiceUrl?? '');
|
||||
}
|
||||
|
||||
//隐私协议弹窗
|
||||
|
||||
18
lib/tools/customer_tool.dart
Normal file
18
lib/tools/customer_tool.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
//客服工具类
|
||||
class CustomerTool {
|
||||
static String _customerServiceUrl = '';
|
||||
|
||||
//初始化
|
||||
static Future<void> init(String customerServiceUrl) async {
|
||||
_customerServiceUrl = customerServiceUrl;
|
||||
}
|
||||
|
||||
//打开客服
|
||||
static void openCustomerService() {
|
||||
if (_customerServiceUrl.isNotEmpty) {
|
||||
launchUrl(Uri.parse(_customerServiceUrl));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user