diff --git a/mobile-next/lib/company/ui/add_colleague_page.dart b/mobile-next/lib/company/ui/add_colleague_page.dart index 81f320e..2d6f7c4 100644 --- a/mobile-next/lib/company/ui/add_colleague_page.dart +++ b/mobile-next/lib/company/ui/add_colleague_page.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:get/get.dart'; @@ -18,6 +20,7 @@ class AddColleagueLogic extends GetxController { final loadFailed = false.obs; final _directory = DirectoryApi(); + Timer? _lookupDebounce; @override void onReady() { @@ -27,11 +30,18 @@ class AddColleagueLogic extends GetxController { @override void onClose() { + _lookupDebounce?.cancel(); staffCtrl.dispose(); msgCtrl.dispose(); super.onClose(); } + void onStaffChanged(String _) { + staffError.value = null; + _lookupDebounce?.cancel(); + _lookupDebounce = Timer(const Duration(milliseconds: 300), lookupDirectory); + } + Future reload() async { loading.value = true; loadFailed.value = false; @@ -98,7 +108,7 @@ class AddColleaguePage extends StatelessWidget { @override Widget build(BuildContext context) { - final logic = Get.put(AddColleagueLogic()); + final logic = Get.find(); return Scaffold( backgroundColor: AppColors.pageBg, appBar: AppBar( @@ -125,10 +135,7 @@ class AddColleaguePage extends StatelessWidget { height: 48, error: logic.staffError.value, enabled: !logic.sending.value, - onChanged: (_) { - logic.staffError.value = null; - logic.lookupDirectory(); - }, + onChanged: logic.onStaffChanged, ), Obx(() { final hint = logic.directoryHint.value; diff --git a/mobile-next/lib/company/ui/company_login_page.dart b/mobile-next/lib/company/ui/company_login_page.dart index b603343..f306c71 100644 --- a/mobile-next/lib/company/ui/company_login_page.dart +++ b/mobile-next/lib/company/ui/company_login_page.dart @@ -6,6 +6,7 @@ import 'package:openim_common/openim_common.dart'; import '../auth/company_login_logic.dart'; import '../brand/app_tokens.dart'; import '../feature_flags.dart'; +import 'state_views.dart'; /// 登录页第一批:v2 布局 + Token,保留 OpenIM 标识,不做畅联换标。 class CompanyLoginPage extends StatelessWidget { @@ -66,9 +67,13 @@ class CompanyLoginPage extends StatelessWidget { const SizedBox(height: AppGap.x4), Obx(() => _loginButton(logic)), const SizedBox(height: AppGap.x3), + if (!FeatureFlags.hideRegisterAndReset) + const SizedBox.shrink(), const Text( '登录即代表同意内部使用规范', - style: TextStyle(fontSize: AppFont.small, color: AppColors.textSecondary), + style: TextStyle( + fontSize: AppFont.small, + color: AppColors.textSecondary), ), const Spacer(flex: 3), ], @@ -79,30 +84,7 @@ class CompanyLoginPage extends StatelessWidget { }, ), ), - Obx(() { - final msg = logic.toast.value; - if (msg == null) return const SizedBox.shrink(); - return SafeArea( - child: Align( - alignment: Alignment.topCenter, - child: Padding( - padding: const EdgeInsets.fromLTRB(AppGap.x4, AppGap.x2, AppGap.x4, 0), - child: Material( - color: AppColors.bannerBg, - borderRadius: BorderRadius.circular(AppRadius.control), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: AppGap.x4, vertical: AppGap.x3), - child: Text( - msg, - textAlign: TextAlign.center, - style: const TextStyle(fontSize: AppFont.sub, color: Colors.white), - ), - ), - ), - ), - ), - ); - }), + Obx(() => CompanyToastBanner(message: logic.toast.value)), ], ), ); diff --git a/mobile-next/lib/pages/contacts/user_profile_panel/personal_info/personal_info_view.dart b/mobile-next/lib/pages/contacts/user_profile_panel/personal_info/personal_info_view.dart index f663bf4..c22a664 100644 --- a/mobile-next/lib/pages/contacts/user_profile_panel/personal_info/personal_info_view.dart +++ b/mobile-next/lib/pages/contacts/user_profile_panel/personal_info/personal_info_view.dart @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:openim_common/openim_common.dart'; +import '../../../company/feature_flags.dart'; import 'personal_info_logic.dart'; class PersonalInfoPage extends StatelessWidget { @@ -52,9 +53,9 @@ class PersonalInfoPage extends StatelessWidget { _buildCornerBgView( children: [ _buildItemView( - label: StrRes.mobile, - value: logic.phoneNumber, - onTap: logic.clickPhoneNumber, + label: FeatureFlags.staffLoginOnly ? '工号' : StrRes.mobile, + value: FeatureFlags.staffLoginOnly ? logic.userID : logic.phoneNumber, + onTap: FeatureFlags.staffLoginOnly ? null : logic.clickPhoneNumber, ), _buildItemView( label: StrRes.email, diff --git a/mobile-next/lib/pages/mine/my_info/my_info_view.dart b/mobile-next/lib/pages/mine/my_info/my_info_view.dart index 88d1c13..315a6a7 100644 --- a/mobile-next/lib/pages/mine/my_info/my_info_view.dart +++ b/mobile-next/lib/pages/mine/my_info/my_info_view.dart @@ -1,9 +1,11 @@ import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:openim_common/openim_common.dart'; +import '../../../company/feature_flags.dart'; import '../../../core/controller/im_controller.dart'; import 'my_info_logic.dart'; @@ -57,9 +59,11 @@ class MyInfoPage extends StatelessWidget { _buildCornerBgView( children: [ _buildItemView( - label: StrRes.mobile, - value: imLogic.userInfo.value.phoneNumber, - showRightArrow: false, + label: FeatureFlags.staffLoginOnly ? '工号' : StrRes.mobile, + value: FeatureFlags.staffLoginOnly + ? OpenIM.iMManager.userID + : imLogic.userInfo.value.phoneNumber, + showRightArrow: !FeatureFlags.staffLoginOnly, ), _buildItemView( label: StrRes.email, diff --git a/mobile-next/lib/routes/app_pages.dart b/mobile-next/lib/routes/app_pages.dart index 8dcd309..f3e2f50 100644 --- a/mobile-next/lib/routes/app_pages.dart +++ b/mobile-next/lib/routes/app_pages.dart @@ -168,6 +168,9 @@ class AppPages { _pageBuilder( name: AppRoutes.addColleague, page: () => const AddColleaguePage(), + binding: BindingsBuilder(() { + Get.lazyPut(() => AddColleagueLogic()); + }), ), _pageBuilder( name: AppRoutes.addContactsMethod,