feat: 增加客服2
This commit is contained in:
parent
2ea6cd2379
commit
1d2a89a80a
@ -61,6 +61,11 @@ class HIMenuView extends GetView<HIMenuController> implements HasSwipeConfig {
|
|||||||
title: '在线客服',
|
title: '在线客服',
|
||||||
onTap: () => KRCommonUtil.kr_openCustomerService(),
|
onTap: () => KRCommonUtil.kr_openCustomerService(),
|
||||||
),
|
),
|
||||||
|
const MenuItem(
|
||||||
|
iconName: 'icon-5',
|
||||||
|
title: '在线客服2',
|
||||||
|
route: Routes.KR_CHATWOOT,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
return HIBaseScaffold(
|
return HIBaseScaffold(
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import '../controllers/kr_chatwoot_controller.dart';
|
||||||
|
|
||||||
|
/// 客服2(Chatwoot)依赖绑定
|
||||||
|
class KRChatwootBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut<KRChatwootController>(
|
||||||
|
() => KRChatwootController(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
/// 客服2(Chatwoot)控制器
|
||||||
|
class KRChatwootController extends GetxController {
|
||||||
|
/// Chatwoot 客服链接
|
||||||
|
final String kr_chatwootUrl = 'https://app.chatwoot.com/widget?website_token=YXQmh16ymNYW1SVybhnoQQ9w';
|
||||||
|
|
||||||
|
/// 加载状态
|
||||||
|
final RxBool kr_isLoading = true.obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 设置加载状态
|
||||||
|
/// [loading] 是否正在加载
|
||||||
|
void kr_setLoading(bool loading) {
|
||||||
|
kr_isLoading.value = loading;
|
||||||
|
}
|
||||||
|
}
|
||||||
52
lib/app/modules/kr_chatwoot/views/kr_chatwoot_view.dart
Normal file
52
lib/app/modules/kr_chatwoot/views/kr_chatwoot_view.dart
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
|
import 'package:kaer_with_panels/app/widgets/hi_base_scaffold.dart';
|
||||||
|
import 'package:kaer_with_panels/app/widgets/kr_simple_loading.dart';
|
||||||
|
import '../controllers/kr_chatwoot_controller.dart';
|
||||||
|
|
||||||
|
/// 客服2(Chatwoot)视图页面
|
||||||
|
class KRChatwootView extends GetView<KRChatwootController> {
|
||||||
|
const KRChatwootView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return HIBaseScaffold(
|
||||||
|
showBack: true,
|
||||||
|
topContentAreaHeight: 0,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
InAppWebView(
|
||||||
|
initialUrlRequest: URLRequest(
|
||||||
|
url: WebUri(controller.kr_chatwootUrl),
|
||||||
|
),
|
||||||
|
initialSettings: InAppWebViewSettings(
|
||||||
|
javaScriptEnabled: true,
|
||||||
|
domStorageEnabled: true,
|
||||||
|
allowsInlineMediaPlayback: true,
|
||||||
|
),
|
||||||
|
onLoadStart: (controller, url) {
|
||||||
|
this.controller.kr_setLoading(true);
|
||||||
|
},
|
||||||
|
onLoadStop: (controller, url) {
|
||||||
|
this.controller.kr_setLoading(false);
|
||||||
|
},
|
||||||
|
onReceivedError: (controller, request, error) {
|
||||||
|
this.controller.kr_setLoading(false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Obx(() {
|
||||||
|
if (controller.kr_isLoading.value) {
|
||||||
|
return const Center(
|
||||||
|
child: KRSimpleLoading(
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -57,7 +57,7 @@ class KRCrispController extends GetxController {
|
|||||||
_nativeConfig = native_crisp.CrispConfig(
|
_nativeConfig = native_crisp.CrispConfig(
|
||||||
websiteID: AppConfig.getInstance().kr_website_id,
|
websiteID: AppConfig.getInstance().kr_website_id,
|
||||||
user: native_crisp.User(
|
user: native_crisp.User(
|
||||||
email: identifier,
|
email: null,
|
||||||
nickName: identifier,
|
nickName: identifier,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import 'package:kaer_with_panels/app/modules/hi_user_info/views/hi_user_info_vie
|
|||||||
import 'package:kaer_with_panels/app/modules/hi_anti_lost/bindings/hi_anti_lost_binding.dart';
|
import 'package:kaer_with_panels/app/modules/hi_anti_lost/bindings/hi_anti_lost_binding.dart';
|
||||||
import 'package:kaer_with_panels/app/modules/hi_anti_lost/views/hi_anti_lost_view.dart';
|
import 'package:kaer_with_panels/app/modules/hi_anti_lost/views/hi_anti_lost_view.dart';
|
||||||
|
|
||||||
|
import '../modules/kr_chatwoot/bindings/kr_chatwoot_binding.dart';
|
||||||
|
import '../modules/kr_chatwoot/views/kr_chatwoot_view.dart';
|
||||||
import '../modules/kr_crisp_chat/bindings/kr_crisp_binding.dart';
|
import '../modules/kr_crisp_chat/bindings/kr_crisp_binding.dart';
|
||||||
import '../modules/kr_crisp_chat/views/kr_crisp_view.dart';
|
import '../modules/kr_crisp_chat/views/kr_crisp_view.dart';
|
||||||
import '../modules/kr_delete_account/bindings/kr_delete_account_binding.dart';
|
import '../modules/kr_delete_account/bindings/kr_delete_account_binding.dart';
|
||||||
@ -138,5 +140,11 @@ class AppPages {
|
|||||||
binding: HIAntiLostBinding(),
|
binding: HIAntiLostBinding(),
|
||||||
popGesture: false,
|
popGesture: false,
|
||||||
),
|
),
|
||||||
|
GetPage(
|
||||||
|
name: _Paths.KR_CHATWOOT,
|
||||||
|
page: () => SwipeWrapper.detect(() => const KRChatwootView()),
|
||||||
|
binding: KRChatwootBinding(),
|
||||||
|
popGesture: false,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ abstract class Routes {
|
|||||||
static const HI_HELP = _Paths.HI_HELP;
|
static const HI_HELP = _Paths.HI_HELP;
|
||||||
static const HI_USER_INFO = _Paths.HI_USER_INFO;
|
static const HI_USER_INFO = _Paths.HI_USER_INFO;
|
||||||
static const HI_ANTI_LOST = _Paths.HI_ANTI_LOST;
|
static const HI_ANTI_LOST = _Paths.HI_ANTI_LOST;
|
||||||
|
static const KR_CHATWOOT = _Paths.KR_CHATWOOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Paths {
|
abstract class _Paths {
|
||||||
@ -50,4 +51,5 @@ abstract class _Paths {
|
|||||||
static const HI_HELP = '/hi_help';
|
static const HI_HELP = '/hi_help';
|
||||||
static const HI_USER_INFO = '/hi-user-info';
|
static const HI_USER_INFO = '/hi-user-info';
|
||||||
static const HI_ANTI_LOST = '/hi-anti-lost';
|
static const HI_ANTI_LOST = '/hi-anti-lost';
|
||||||
|
static const KR_CHATWOOT = '/kr-chatwoot';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user