feat: 更新代码仓库全部修改
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:kaer_with_panels/app/common/app_config.dart';
|
||||
import 'package:kaer_with_panels/app/common/app_run_data.dart';
|
||||
import 'package:kaer_with_panels/app/localization/kr_language_utils.dart';
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:kaer_with_panels/app/services/kr_site_config_service.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import '../../../services/kr_device_info_service.dart';
|
||||
@@ -77,6 +78,13 @@ class KRCrispController extends GetxController {
|
||||
|
||||
if (_kr_isDisposed) return;
|
||||
|
||||
final websiteId = AppConfig.getInstance().kr_website_id;
|
||||
if (websiteId.isEmpty) {
|
||||
// 如果为空,打印错误日志并终止函数
|
||||
print('Crisp 初始化失败:website_id 未配置');
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化 Crisp 控制器
|
||||
crispController = CrispController(
|
||||
websiteId: AppConfig.getInstance().kr_website_id,
|
||||
|
||||
@@ -6,6 +6,9 @@ import '../controllers/kr_crisp_controller.dart';
|
||||
import 'package:kaer_with_panels/app/localization/app_translations.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart';
|
||||
import '../../../widgets/kr_simple_loading.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/hi_base_scaffold.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
|
||||
|
||||
|
||||
/// Crisp 客服聊天视图
|
||||
class KRCrispView extends GetView<KRCrispController> {
|
||||
@@ -30,46 +33,60 @@ class KRCrispView extends GetView<KRCrispController> {
|
||||
/// 构建导航栏
|
||||
PreferredSizeWidget _kr_buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: Theme.of(context).cardColor,
|
||||
backgroundColor: Colors.transparent,
|
||||
toolbarHeight: 0.0,
|
||||
elevation: 0,
|
||||
title: Text(
|
||||
AppTranslations.kr_userInfo.customerService,
|
||||
style: KrAppTextStyle(
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 20.sp,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
onPressed: () => _kr_handleBack(),
|
||||
),
|
||||
automaticallyImplyLeading: false, // 1. 禁用自动生成的 leading
|
||||
// title: Text(
|
||||
// AppTranslations.kr_userInfo.customerService,
|
||||
// style: KrAppTextStyle(
|
||||
// color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建主体内容
|
||||
Widget _kr_buildBody(BuildContext context) {
|
||||
return Container(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: Obx(() {
|
||||
if (controller.kr_isLoading.value) {
|
||||
return _kr_buildLoadingView(context, '正在初始化客服系统...');
|
||||
}
|
||||
return Stack(
|
||||
children: [
|
||||
// --- 第一层:WebView 内容 ---
|
||||
// Obx 包裹的是 CrispView 和其他状态视图
|
||||
Obx(() {
|
||||
if (controller.kr_isLoading.value) {
|
||||
return _kr_buildLoadingView(context, '正在初始化客服系统...');
|
||||
}
|
||||
|
||||
if (controller.kr_isInitialized.value && controller.crispController != null) {
|
||||
return CrispView(
|
||||
crispController: controller.crispController!,
|
||||
clearCache: true,
|
||||
onSessionIdReceived: _kr_onSessionIdReceived,
|
||||
);
|
||||
}
|
||||
if (controller.kr_isInitialized.value && controller.crispController != null) {
|
||||
return CrispView(
|
||||
crispController: controller.crispController!,
|
||||
clearCache: true,
|
||||
onSessionIdReceived: _kr_onSessionIdReceived,
|
||||
);
|
||||
}
|
||||
|
||||
return _kr_buildErrorView(context);
|
||||
}),
|
||||
return _kr_buildErrorView(context);
|
||||
}),
|
||||
|
||||
// --- 第二层:悬浮的返回按钮 ---
|
||||
Positioned(
|
||||
// 4. 使用 MediaQuery 获取状态栏高度,确保按钮不会与系统UI重叠
|
||||
top: 40.w,
|
||||
left: 20.w,
|
||||
child: GestureDetector(
|
||||
onTap: () => _kr_handleBack(),
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: KrLocalImage(
|
||||
imageName: 'hi-back-icon',
|
||||
width: 48.w,
|
||||
height: 48.w,
|
||||
imageType: ImageType.svg,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +97,7 @@ class KRCrispView extends GetView<KRCrispController> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
KRSimpleLoading(
|
||||
color: Colors.blue,
|
||||
color: Theme.of(context).primaryColor,
|
||||
size: 50.0,
|
||||
),
|
||||
if (message.isNotEmpty) SizedBox(height: 16.sp),
|
||||
|
||||
Reference in New Issue
Block a user