From 26622676ed4f4898385d8e9e686296eb56adf4be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=96=E7=A0=81=E5=B7=A5=E7=A8=8B=E5=B8=88?= Date: Thu, 20 Aug 2026 03:51:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(mobile-next):=20=E5=B7=A5=E5=8F=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=98=B2=E6=8A=96=E3=80=81=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=EF=BC=8C=E8=B5=84=E6=96=99=E9=A1=B5=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E6=8A=8A=E5=B7=A5=E5=8F=B7=E5=BD=93=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor Co-authored-by: multica-agent --- .../lib/company/ui/add_colleague_page.dart | 17 +++++++--- .../lib/company/ui/company_login_page.dart | 32 ++++--------------- .../personal_info/personal_info_view.dart | 7 ++-- .../lib/pages/mine/my_info/my_info_view.dart | 10 ++++-- mobile-next/lib/routes/app_pages.dart | 3 ++ 5 files changed, 33 insertions(+), 36 deletions(-) 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,