Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 97ac92bf
authored
2025-11-28 18:48:26 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加分享到微信会话的接口
1 parent
a6391c5a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
33 deletions
lib/bloc/web_cubit.dart
lib/config/locator.dart
lib/data/repositories/message/set_title_handler.dart
lib/data/repositories/message/share_to_wx_handler.dart
lib/services/player_service.dart
lib/bloc/web_cubit.dart
View file @
97ac92b
...
@@ -346,6 +346,7 @@ class WebCubit extends Cubit<WebState> {
...
@@ -346,6 +346,7 @@ class WebCubit extends Cubit<WebState> {
'classCode=
${state.classCode}
&'
'classCode=
${state.classCode}
&'
'userType=
${state.userType}
&'
'userType=
${state.userType}
&'
'stuId=
${state.stuId}
'
;
'stuId=
${state.stuId}
'
;
// final String serverUrl = '${Constant.localServerUrl}/test/test2.html';
_controller
.
loadRequest
(
Uri
.
parse
(
serverUrl
));
_controller
.
loadRequest
(
Uri
.
parse
(
serverUrl
));
}
}
...
...
lib/config/locator.dart
View file @
97ac92b
...
@@ -22,6 +22,7 @@ import 'package:appframe/data/repositories/message/orientation_handler.dart';
...
@@ -22,6 +22,7 @@ import 'package:appframe/data/repositories/message/orientation_handler.dart';
import
'package:appframe/data/repositories/message/save_file_to_disk_handler.dart'
;
import
'package:appframe/data/repositories/message/save_file_to_disk_handler.dart'
;
import
'package:appframe/data/repositories/message/save_to_album_handler.dart'
;
import
'package:appframe/data/repositories/message/save_to_album_handler.dart'
;
import
'package:appframe/data/repositories/message/scan_code_handler.dart'
;
import
'package:appframe/data/repositories/message/scan_code_handler.dart'
;
import
'package:appframe/data/repositories/message/share_to_wx_handler.dart'
;
import
'package:appframe/data/repositories/message/storage_handler.dart'
;
import
'package:appframe/data/repositories/message/storage_handler.dart'
;
import
'package:appframe/data/repositories/message/title_bar_handler.dart'
;
import
'package:appframe/data/repositories/message/title_bar_handler.dart'
;
import
'package:appframe/data/repositories/message/upload_file.dart'
;
import
'package:appframe/data/repositories/message/upload_file.dart'
;
...
@@ -67,6 +68,9 @@ Future<void> setupLocator() async {
...
@@ -67,6 +68,9 @@ Future<void> setupLocator() async {
/// 打开小程序
/// 打开小程序
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
OpenWeappHandler
(),
instanceName:
'openWeapp'
);
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
OpenWeappHandler
(),
instanceName:
'openWeapp'
);
/// 分享微信会话
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
ShareToWxHandler
(),
instanceName:
'sharetowx'
);
/// 设备信息
/// 设备信息
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
DeviceInfoHandler
(),
instanceName:
'getDeviceInfo'
);
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
DeviceInfoHandler
(),
instanceName:
'getDeviceInfo'
);
...
@@ -169,7 +173,6 @@ Future<void> setupLocator() async {
...
@@ -169,7 +173,6 @@ Future<void> setupLocator() async {
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
DownloadFileHandler
(),
instanceName:
'downloadFile'
);
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
DownloadFileHandler
(),
instanceName:
'downloadFile'
);
/// 设置标题和返回按钮
/// 设置标题和返回按钮
// getIt.registerLazySingleton<MessageHandler>(() => SetTitleHandler(), instanceName: 'setTitle');
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
TitleBarHandler
(),
instanceName:
'setTitlebar'
);
getIt
.
registerLazySingleton
<
MessageHandler
>(()
=>
TitleBarHandler
(),
instanceName:
'setTitlebar'
);
/// 新路由打开链接
/// 新路由打开链接
...
...
lib/data/repositories/message/set_title_handler.dart
deleted
100644 → 0
View file @
a6391c5
// import 'package:appframe/bloc/web_cubit.dart';
// import 'package:appframe/services/dispatcher.dart';
//
// class SetTitleHandler extends MessageHandler {
// late WebCubit? _webCubit;
//
// @override
// void setCubit(WebCubit cubit) {
// this._webCubit = cubit;
// }
//
// void _unfollowCubit() {
// this._webCubit = null;
// }
//
// @override
// Future<dynamic> handleMessage(params) async {
// try {
// if (params is! Map<String, dynamic>) {
// throw Exception('参数错误');
// }
//
// final String title = params['title'] as String;
// final bool showBack = params['showBack'] as bool;
//
// return _webCubit!.setTitle(title, showBack);
// } finally {
// _unfollowCubit();
// }
// }
// }
lib/data/repositories/message/share_to_wx_handler.dart
0 → 100644
View file @
97ac92b
import
'package:appframe/config/locator.dart'
;
import
'package:appframe/services/dispatcher.dart'
;
import
'package:fluwx/fluwx.dart'
;
class
ShareToWxHandler
extends
MessageHandler
{
@override
Future
<
bool
>
handleMessage
(
params
)
async
{
if
(
params
is
!
Map
<
String
,
dynamic
>)
{
throw
Exception
(
'参数错误'
);
}
String
text
=
params
[
'text'
]
as
String
?
??
''
;
String
fileUrl
=
params
[
'fileUrl'
]
as
String
?
??
''
;
String
fileName
=
params
[
'fileName'
]
as
String
?
??
''
;
try
{
Fluwx
fluwx
=
getIt
.
get
<
Fluwx
>();
if
(
text
.
isNotEmpty
)
{
return
await
fluwx
.
share
(
WeChatShareTextModel
(
text
));
}
else
if
(
fileUrl
.
isNotEmpty
&&
fileName
.
isNotEmpty
)
{
return
await
fluwx
.
share
(
WeChatShareFileModel
(
WeChatFile
.
network
(
fileUrl
),
title:
fileName
));
}
else
{
return
false
;
}
}
catch
(
e
)
{
print
(
e
);
return
false
;
}
}
}
lib/services/player_service.dart
View file @
97ac92b
...
@@ -29,7 +29,7 @@ class PlayerService {
...
@@ -29,7 +29,7 @@ class PlayerService {
try
{
try
{
final
player
=
FlutterSoundPlayer
();
final
player
=
FlutterSoundPlayer
();
_player
=
(
await
player
.
openPlayer
())!;
_player
=
(
await
player
.
openPlayer
())!;
_player
!.
setSpeed
(
1
);
// 播放速度,默认1
await
_player
!.
setSpeed
(
1
);
// 播放速度,默认1
// 播放进度回调
// 播放进度回调
_player
!.
setSubscriptionDuration
(
Duration
(
seconds:
1
));
_player
!.
setSubscriptionDuration
(
Duration
(
seconds:
1
));
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment