...
 
Commits (3)
    https://gitcode.net/O2OA/o2oa-flutter/-/commit/9e8ea9829138a7164f2d67e6cbd16d71f1a30e56 主页其他三个页面支持门户替换 2024-04-08T14:34:45+08:00 fancy fancylou@outlook.com https://gitcode.net/O2OA/o2oa-flutter/-/commit/e4c7b72a0059defa1ebd4d801748e81aa4a34dfe 设置页面支持门户 2024-04-08T17:01:17+08:00 fancy fancylou@outlook.com https://gitcode.net/O2OA/o2oa-flutter/-/commit/eb3ef9227e97b8f3e9f01b097f8b4d741a3b4a6f 8.3.7 2024-04-08T17:05:15+08:00 fancy fancylou@outlook.com
......@@ -254,6 +254,15 @@ class ProgramCenterService extends GetxService {
return {};
}
/// 首页tab 门户 扩展参数
ExtendParamHomeTabPortal? getExtendParamHomeTabPortal(String key) {
final p = extendParam();
if (p[key] != null) {
return ExtendParamHomeTabPortal.fromJson(p[key]);
}
return null;
}
/// 首页居中,如果居中页面个数就固定了 5 个。appIndexPages无效了
bool isIndexCentered() {
if (appStyle != null) {
......
......@@ -89,6 +89,28 @@ class AppStyle {
};
}
class ExtendParamHomeTabPortal {
String? portalId;
bool? hiddenAppBar;
String? appBarTitle;
ExtendParamHomeTabPortal({this.portalId, this.hiddenAppBar, this.appBarTitle});
factory ExtendParamHomeTabPortal.fromJson(Map<String, dynamic> json) => ExtendParamHomeTabPortal(
portalId: json["portalId"],
hiddenAppBar: json["hiddenAppBar"],
appBarTitle: json["appBarTitle"],
);
Map<String, dynamic> toJson() => {
"portalId": portalId,
"hiddenAppBar": hiddenAppBar,
"appBarTitle": appBarTitle,
};
}
class AppStyleImage {
AppStyleImage({
this.name,
......@@ -260,9 +282,7 @@ class EnumValues<T> {
EnumValues(this.map);
Map<T, String> get reverse {
if (reverseMap == null) {
reverseMap = map.map((k, v) => MapEntry(v, k));
}
reverseMap ??= map.map((k, v) => MapEntry(v, k));
return reverseMap!;
}
}
......@@ -3,8 +3,8 @@ typedef EventCallback = void Function(dynamic arg);
class EventBus {
// home 双击底部导航栏按钮
static const homeNavItemMsg = "homeNavItemMsg";
// 刷新门户事件
static const refreshPortalMsg = "refreshPortalMsg";
// im消息
static const websocketCreateImMsg = "websocketCreateImMsg";
static const websocketRevokeImMsg = "websocketRevokeImMsg";
......
import 'dart:convert';
import 'dart:io';
import 'package:app_settings/app_settings.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......@@ -171,12 +172,33 @@ class O2JavascriptHandler {
case 'navigation.share':
_share(jsMessage);
break;
case 'settings.openMyProfile':
_settingOpenMyProfile(jsMessage);
break;
case 'settings.safeAndAccount':
_settingOpenSafeAndAccount(jsMessage);
break;
case 'settings.skin':
_settingOpenAppSkin(jsMessage);
break;
case 'settings.notice':
_settingOpenAppNotice(jsMessage);
break;
case 'settings.common':
_settingOpenAppCommon(jsMessage);
break;
case 'settings.about':
_settingOpenAppAbout(jsMessage);
break;
case 'settings.logout':
_settingLogout(jsMessage);
break;
default:
OLogger.e('错误的类型 ${jsMessage.type}');
break;
}
}
/// o2mNotification 模块处理
_notification(String msg) {
OLogger.d("执行 Notification , 命令:$msg");
......@@ -1019,4 +1041,64 @@ class O2JavascriptHandler {
}
}
}
/// 打开我的页面
_settingOpenMyProfile(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
Get.toNamed(O2OARoutes.homeSettingsMyProfile);
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
_settingOpenSafeAndAccount(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
Get.toNamed(O2OARoutes.homeSettingsAccountSafe);
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
_settingOpenAppSkin(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
Get.toNamed(O2OARoutes.homeSettingsSkin);
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
_settingOpenAppNotice(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
if (GetPlatform.isMobile) {
AppSettings.openNotificationSettings();
}
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
_settingOpenAppCommon(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
Get.toNamed(O2OARoutes.homeSettingsCommon);
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
_settingOpenAppAbout(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
Get.toNamed(O2OARoutes.homeSettingsAbout);
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
_settingLogout(JsMessage jsMessage) async {
final callback = jsMessage.callback ?? '';
O2Utils.logout();
if (callback.isNotEmpty) {
webviewController?.evaluateJavascript(source: '$callback()');
}
}
}
......@@ -83,9 +83,9 @@ class PortalController extends GetxController implements JsNavigationInterface {
_refreshPage();
OLogger.d('流程工作文档 关闭后刷新portal页面。。。。。');
});
_eventBus.on(EventBus.homeNavItemMsg, _eventId, (arg) {
_eventBus.on(EventBus.refreshPortalMsg, _eventId, (arg) {
_refreshPage();
OLogger.d('首页双击刷新!!!!');
OLogger.d('刷新门户, $arg');
});
super.onReady();
......@@ -96,7 +96,7 @@ class PortalController extends GetxController implements JsNavigationInterface {
void onClose() {
_eventBus.off(EventBus.cmsDocumentCloseMsg, _eventId);
_eventBus.off(EventBus.processWorkCloseMsg, _eventId);
_eventBus.off(EventBus.homeNavItemMsg, _eventId);
_eventBus.off(EventBus.refreshPortalMsg, _eventId);
super.onClose();
}
......
......@@ -132,23 +132,14 @@ class HomeController extends GetxController with WidgetsBindingObserver {
/// 点击底部菜单
void handleNavBarClick(int index) {
if (state.currentIndex == index) { // 重复点击 发送事件消息
eventBus.emit(EventBus.homeNavItemMsg, state.homeTabList[index]);
if (state.currentIndex == index) { // 重复点击 发送刷新事件消息
eventBus.emit(EventBus.refreshPortalMsg, state.homeTabList[index]);
return;
}
state.currentIndex = index;
pageController.jumpToPage(index);
}
// /// 双击底部菜单
// void handleNavBarDoubleClick(int index) {
// if (state.currentIndex != index) {
// return;
// }
// eventBus.emit(EventBus.homeNavItemMsg, state.homeTabList[index]);
// OLogger.d('双击 $index');
// }
/// 在 widget 内存中分配后立即调用。
@override
void onInit() {
......
......@@ -135,10 +135,12 @@ class MyProfileController extends GetxController {
/// 刷新设置页面的签名
void _emitToUpdateSignature() {
eventBus.emit(EventBus.mySignatureUpdateMsg, 'signature');
eventBus.emit(EventBus.refreshPortalMsg, 'signature');
}
/// 刷新设置页面的头像
void _emitToUpdateAvatar() {
eventBus.emit(EventBus.avatarUpdateMsg, 'avatarUpdateMsg');
eventBus.emit(EventBus.refreshPortalMsg, 'avatarUpdateMsg');
}
......
......@@ -202,14 +202,44 @@ class HomePage extends GetView<HomeController> {
/// 应用页面
Widget _appsPageView() {
AppsBinding().dependencies();
return const AppsPage();
final portal = ProgramCenterService.to.getExtendParamHomeTabPortal('appTabPortal');
if (portal!= null && portal.portalId?.isNotEmpty == true ) {
final portalId = portal.portalId!;
final hiddenAppBar = portal.hiddenAppBar ?? false;
final appBarTitle = portal.appBarTitle ?? 'home_tab_apps'.tr;
Get.lazyPut<PortalController>(
() => PortalController(initMap: {
"portalId": portalId,
"hiddenAppBar": hiddenAppBar,
"title": appBarTitle
}),
tag: 'app_tag_$portalId');
return PortalPage(tag: 'app_tag_$portalId');
} else {
AppsBinding().dependencies();
return const AppsPage();
}
}
/// 通讯录页面
Widget _contactPageView() {
ContactBinding().dependencies();
return const ContactPage();
final portal = ProgramCenterService.to.getExtendParamHomeTabPortal('contactTabPortal');
if (portal!= null && portal.portalId?.isNotEmpty == true ) {
final portalId = portal.portalId!;
final hiddenAppBar = portal.hiddenAppBar ?? false;
final appBarTitle = portal.appBarTitle ?? 'home_tab_contact'.tr;
Get.lazyPut<PortalController>(
() => PortalController(initMap: {
"portalId": portalId,
"hiddenAppBar": hiddenAppBar,
"title": appBarTitle
}),
tag: 'app_tag_$portalId');
return PortalPage(tag: 'app_tag_$portalId');
} else {
ContactBinding().dependencies();
return const ContactPage();
}
}
/// 首页
......@@ -237,13 +267,43 @@ class HomePage extends GetView<HomeController> {
/// 消息页面
Widget _imPageView() {
ImBinding().dependencies();
return const ImPage();
final portal = ProgramCenterService.to.getExtendParamHomeTabPortal('imTabPortal');
if (portal!= null && portal.portalId?.isNotEmpty == true ) {
final portalId = portal.portalId!;
final hiddenAppBar = portal.hiddenAppBar ?? false;
final appBarTitle = portal.appBarTitle ?? 'home_tab_im'.tr;
Get.lazyPut<PortalController>(
() => PortalController(initMap: {
"portalId": portalId,
"hiddenAppBar": hiddenAppBar,
"title": appBarTitle
}),
tag: 'app_tag_$portalId');
return PortalPage(tag: 'app_tag_$portalId');
} else {
ImBinding().dependencies();
return const ImPage();
}
}
/// 设置页面
Widget _settingsPageView() {
SettingsBinding().dependencies();
return const SettingsPage();
final portal = ProgramCenterService.to.getExtendParamHomeTabPortal('settingsTabPortal');
if (portal!= null && portal.portalId?.isNotEmpty == true ) {
final portalId = portal.portalId!;
final hiddenAppBar = portal.hiddenAppBar ?? false;
final appBarTitle = portal.appBarTitle ?? 'home_tab_settings'.tr;
Get.lazyPut<PortalController>(
() => PortalController(initMap: {
"portalId": portalId,
"hiddenAppBar": hiddenAppBar,
"title": appBarTitle
}),
tag: 'app_tag_$portalId');
return PortalPage(tag: 'app_tag_$portalId');
} else {
SettingsBinding().dependencies();
return const SettingsPage();
}
}
}
......@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 8.3.6+336
version: 8.3.7+337
environment:
sdk: ">=3.0.0 < 4.0.0"
......