提交 838e9ddf authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!19
assets/images/2.0x/course.png

627 Bytes | W: | H:

assets/images/2.0x/course.png

627 Bytes | W: | H:

assets/images/2.0x/course.png
assets/images/2.0x/course.png
assets/images/2.0x/course.png
assets/images/2.0x/course.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/2.0x/library.png

409 Bytes | W: | H:

assets/images/2.0x/library.png

947 Bytes | W: | H:

assets/images/2.0x/library.png
assets/images/2.0x/library.png
assets/images/2.0x/library.png
assets/images/2.0x/library.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/2.0x/mine.png

795 Bytes | W: | H:

assets/images/2.0x/mine.png

776 Bytes | W: | H:

assets/images/2.0x/mine.png
assets/images/2.0x/mine.png
assets/images/2.0x/mine.png
assets/images/2.0x/mine.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/2.0x/shujia.png

1.7 KB | W: | H:

assets/images/2.0x/shujia.png

1.4 KB | W: | H:

assets/images/2.0x/shujia.png
assets/images/2.0x/shujia.png
assets/images/2.0x/shujia.png
assets/images/2.0x/shujia.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/course.png

1.2 KB | W: | H:

assets/images/3.0x/course.png

1.1 KB | W: | H:

assets/images/3.0x/course.png
assets/images/3.0x/course.png
assets/images/3.0x/course.png
assets/images/3.0x/course.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/library.png

615 Bytes | W: | H:

assets/images/3.0x/library.png

1.8 KB | W: | H:

assets/images/3.0x/library.png
assets/images/3.0x/library.png
assets/images/3.0x/library.png
assets/images/3.0x/library.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/mine.png

1.5 KB | W: | H:

assets/images/3.0x/mine.png

1.5 KB | W: | H:

assets/images/3.0x/mine.png
assets/images/3.0x/mine.png
assets/images/3.0x/mine.png
assets/images/3.0x/mine.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/shujia.png

3.2 KB | W: | H:

assets/images/3.0x/shujia.png

2.7 KB | W: | H:

assets/images/3.0x/shujia.png
assets/images/3.0x/shujia.png
assets/images/3.0x/shujia.png
assets/images/3.0x/shujia.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/course.png

386 Bytes | W: | H:

assets/images/course.png

374 Bytes | W: | H:

assets/images/course.png
assets/images/course.png
assets/images/course.png
assets/images/course.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/course_select.png

965 Bytes | W: | H:

assets/images/course_select.png

897 Bytes | W: | H:

assets/images/course_select.png
assets/images/course_select.png
assets/images/course_select.png
assets/images/course_select.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/library.png

273 Bytes | W: | H:

assets/images/library.png

521 Bytes | W: | H:

assets/images/library.png
assets/images/library.png
assets/images/library.png
assets/images/library.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/library_select.png

1.0 KB | W: | H:

assets/images/library_select.png

626 Bytes | W: | H:

assets/images/library_select.png
assets/images/library_select.png
assets/images/library_select.png
assets/images/library_select.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/mine.png

422 Bytes | W: | H:

assets/images/mine.png

424 Bytes | W: | H:

assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/mine_select.png

910 Bytes | W: | H:

assets/images/mine_select.png

848 Bytes | W: | H:

assets/images/mine_select.png
assets/images/mine_select.png
assets/images/mine_select.png
assets/images/mine_select.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/shujia.png

786 Bytes | W: | H:

assets/images/shujia.png

705 Bytes | W: | H:

assets/images/shujia.png
assets/images/shujia.png
assets/images/shujia.png
assets/images/shujia.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/shujia_select.png

1.0 KB | W: | H:

assets/images/shujia_select.png

1009 Bytes | W: | H:

assets/images/shujia_select.png
assets/images/shujia_select.png
assets/images/shujia_select.png
assets/images/shujia_select.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,17 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>紫荆数智学堂请求在您使用期间获取您的相册权限以便更改用户头像或上传笔记</string>
<key>NSCameraUsageDescription</key>
<string>紫荆数智学堂需要使用相机权限进行拍照</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
......@@ -50,8 +39,23 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>紫荆数智学堂需要访问媒体</string>
<key>NSCameraUsageDescription</key>
<string>紫荆数智学堂需要访问相机</string>
<key>NSMicrophoneUsageDescription</key>
<string>紫荆数智学堂需要使用麦克风进行录音</string>
<string>紫荆数智学堂需要访问麦克风</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>紫荆数智学堂需要访问照片</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>紫荆数智学堂需要语言识别</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
......@@ -60,16 +64,9 @@
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
......
......@@ -3,7 +3,9 @@ library answer;
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:go_router/go_router.dart';
import 'package:get/get.dart';
import '../../utils/index.dart';
import '../../widgets/index.dart';
part 'view.dart';
......@@ -34,6 +34,18 @@ class _AnswerPageState extends State<AnswerPage> {
context.pop();
// readController.titleInput.text = args.toString();
});
controller.addJavaScriptHandler(handlerName: 'showLoadingCallback', callback: (args) async {
CustomToast.loading();
});
controller.addJavaScriptHandler(handlerName: 'dismissLoadingCallback', callback: (args) async {
CustomToast.dismiss();
});
// 答完题展示答题结果页
controller.addJavaScriptHandler(handlerName: 'submitSuccessCallback', callback: (args) async {
controller.loadUrl(urlRequest: URLRequest(
url: WebUri.uri(Uri.parse(kAnswerResult))
));
});
},
onConsoleMessage: (controller, consoleMessage) {
// 接收从 WebView 发送的消息
......
......@@ -545,7 +545,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
_getModel.url!,
"zijing.apk",
"ic_launcher",
'https://itunes.apple.com/cn/app/抖音/id1142110895',
'https://apps.apple.com/us/app/%E7%B4%AB%E8%8D%86%E6%95%B0%E6%99%BA%E5%AD%A6%E5%A0%82/id6476735372',
);
AzhonAppUpdate.update(model).then((value) => debugPrint('$value'));
}
......
part of web;
class ReadController extends FullLifeCycleController with GetSingleTickerProviderStateMixin{
// 图书id
final String bookId;
// 章节id
String chapterId;
// 章节名称
String chapterName;
// 图书详细模型
final BookDetailModel bookDetailModel;
// 笔记id 用于我的笔记跳转阅读页对应位置
final String noteId;
ReadController({required this.bookId, required this.chapterId,required this.chapterName,required this.bookDetailModel,required this.noteId});
late InAppWebViewController webViewController;
// 目录
List <ChapterModel> chapters = [];
// 工具栏数组
List <ToolModel> tools = [
ToolModel(tag: 0,name: '目录',selected: false,icon: 'assets/images/category_unselect.png',activeIcon: 'assets/images/category_select.png'),
ToolModel(tag: 1,name: '笔记',selected: false,icon: 'assets/images/note_unselect.png',activeIcon:'assets/images/note_select.png'),
ToolModel(tag: 2,name: '讨论',selected: false,icon: 'assets/images/discuss_unselect.png',activeIcon:'assets/images/discuss_select.png'),
];
// 默认工具栏选项
late ToolModel toolModel = tools.first;
// 输入框窗口是否展示
......@@ -49,7 +55,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bool get show => _show;
// 录音
FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error);
final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error);
// 录音开始
bool startRecording = false;
// 是否存在离线文件
......@@ -74,23 +80,22 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 搜全文
List<SearchAllModel> searchALlResults = [];
// 刷新组件
final EasyRefreshController refreshController = EasyRefreshController(
controlFinishLoad: true,
controlFinishRefresh: true,
);
// 搜全文输入控制器
late TextEditingController searchInput = TextEditingController();
// 音频
just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer();
// 搜全文模型
late SearchAllModel sModel = SearchAllModel(bookId: '0');
// 本地文件地址
String localHtml5Path = '';
///------------------------------------------ 页面 生命周期--------------------------------------------------------
@override
void onInit() async {
......@@ -137,9 +142,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
contentInput.dispose();
flutterTts.stop();
searchInput.dispose();
if (_mRecorder != null) {
_mRecorder.closeRecorder();
}
// 关闭防截屏
// await ScreenProtector.preventScreenshotOff();
super.onClose();
......@@ -204,7 +207,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
String htmlStr = EncryptUtil.aesDecrypt(content!);
Console.log('解密-----------------$htmlStr');
Console.log('-------------使用本地文件-------------------');
webViewController.loadData(data: htmlStr??'');
webViewController.loadData(data: htmlStr);
}
......@@ -273,10 +276,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
await flutterTts.setSpeechRate(0.5);
await flutterTts.setPitch(1.0);
if (text != null) {
if (text!.isNotEmpty) {
await flutterTts.speak(text!);
}
if (text.isNotEmpty) {
await flutterTts.speak(text);
}
}
......@@ -338,9 +339,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final path = await _mRecorder.stopRecorder();
Console.log('stopRecorder-----------path---------------------$path');
if(path!=null && path.isNotEmpty){
var duration = await audioPlayer.setFilePath(path!);
var duration = await audioPlayer.setFilePath(path);
Console.log('-----duration---------------------$duration------');
AudioModel audioModel = AudioModel(path: path!,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00');
AudioModel audioModel = AudioModel(path: path,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00');
if(audioModel.duration !='0:00:00'){
discussInputAudios.add(audioModel);
}
......@@ -663,7 +664,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
CustomToast.dismiss();
Toast.show('离线成功');
final exit = await _isExistFile(bookId);
await _isExistFile(bookId);
update();
} else {
......@@ -714,6 +715,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final content = await readHtmlFileContent(toReadHtmlPath);
// 4、解密离线的内容
String htmlStr = EncryptUtil.aesDecrypt(content!);
// webViewController.evaluateJavascript(source: 'callbackInFlutterComponent($htmlStr);');
// 5、将离线内容写入临时文件
String directoryPath = path.dirname(toReadHtmlPath);
String writeFilePath = '$directoryPath/read.html';
......@@ -774,7 +778,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
if (file is File && file.path.toLowerCase().endsWith('.html')) {
String fileName = path.basenameWithoutExtension(file.path);
if (int.parse(fileName.split('-').first) == findIndex){
print('HTML File--------------------------------${file.path}');
Console.log('HTML File--------------------------------${file.path}');
toReadHtmlPath = file.path;
chapterId = fileName.split('-').last;
chapterName = getChapterName(chapterId);
......@@ -784,7 +788,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
// 开始读书
read(toReadHtmlPath);
......@@ -884,7 +887,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
ChapterModel? tModel = findChapterById(chapters, int.parse(chapterId));
if(tModel != null){
updateParentsStatus(chapters, tModel!);
updateParentsStatus(chapters, tModel);
}
}
......@@ -925,7 +928,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
/// 添加阅读时长
void _addReadTime({required type}) async{
final result = await LibraryAPI.addReadTime(bookId: bookId, readTypes: type);
LibraryAPI.addReadTime(bookId: bookId, readTypes: type);
}
/// 获取离线文件路径
void getBookDown() async{
......
......@@ -94,7 +94,7 @@ class _ReadPageState extends State<ReadPage> {
)
),
onWebViewCreated: (InAppWebViewController controller){
CustomToast.loading();
// CustomToast.loading();
readController.webViewController = controller;
},
onConsoleMessage: (controller, consoleMessage) {
......@@ -102,7 +102,7 @@ class _ReadPageState extends State<ReadPage> {
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
},
onLoadStop: (controller, url) {
CustomToast.dismiss();
// CustomToast.dismiss();
// flutter 主动给 js 传参数
Map<String, dynamic> param = {
'book_id': readController.bookId,
......@@ -193,9 +193,8 @@ class _ReadPageState extends State<ReadPage> {
'title':title
};
Console.log('监听答题回调---------------给页面传参---------------------------------$params');
context.pushNamed(Routes.answer,queryParameters: params);
// 跳转知识测评界面
context.pushNamed(Routes.answer,queryParameters: params);
});
......@@ -249,7 +248,7 @@ class _ReadPageState extends State<ReadPage> {
context.pushNamed(Routes.scaleImage,queryParameters: params);
});
// 前端 token过回调
// 前端 token过回调
controller.addJavaScriptHandler(handlerName: 'refreshTokenCallback', callback: (args) async {
final result = await readController.refreshToken();
Map<String, dynamic> param = {
......@@ -258,7 +257,12 @@ class _ReadPageState extends State<ReadPage> {
String jsonStr = jsonEncode(param);
controller.evaluateJavascript(source: 'refreshTokenSuccess($jsonStr)');
});
controller.addJavaScriptHandler(handlerName: 'showLoadingCallback', callback: (args) async {
CustomToast.loading();
});
controller.addJavaScriptHandler(handlerName: 'dismissLoadingCallback', callback: (args) async {
CustomToast.dismiss();
});
/// 离线需要参数
// //
......
......@@ -16,7 +16,7 @@ class ReadOfflinePage extends StatefulWidget {
}) : super(key: key);
@override
State<ReadPage> createState() => _ReadPageState();
State<ReadPage> createState() => _ReadOfflinePageState();
}
class _ReadOfflinePageState extends State<ReadPage> {
......@@ -53,11 +53,7 @@ class _ReadOfflinePageState extends State<ReadPage> {
child: Stack(
children: [
InAppWebView(
initialUrlRequest:URLRequest(
// url: Uri.parse(kReadBook),
url: readController.localHtml5Path.isNotEmpty?WebUri.uri(Uri.parse(readController.localHtml5Path)): WebUri.uri(Uri.parse(kReadBook))
// url: Uri.parse("/storage/emulated/0/Android/data/com.zijin.book.flutter_book/files/174/7-325.html"),
),
initialFile: 'assets/html/read.html',
initialSettings:InAppWebViewSettings(
clearCache:true,
// http的请求也不做限制
......@@ -71,7 +67,6 @@ class _ReadOfflinePageState extends State<ReadPage> {
)
),
onWebViewCreated: (InAppWebViewController controller){
CustomToast.loading();
readController.webViewController = controller;
},
onConsoleMessage: (controller, consoleMessage) {
......@@ -79,13 +74,7 @@ class _ReadOfflinePageState extends State<ReadPage> {
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
},
onLoadStop: (controller, url) {
CustomToast.dismiss();
// flutter 主动给 js 传参数
Map<String, dynamic> param = {
'book_id': readController.bookId,
'chapter_id': readController.chapterId,
'token':UserStore.to.token
};
String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token},${readController.noteId},${readController.sModel.bookId =='0'?'':readController.sModel.combinedContent}';
Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
......
......@@ -184,7 +184,7 @@ abstract class AppTheme {
type: BottomNavigationBarType.fixed,
elevation: 0,
backgroundColor: Colors.white,
unselectedItemColor: scheme.onBackground.withOpacity(0.5),
unselectedItemColor: const Color(0xFF666666),
selectedItemColor: scheme.primary,
unselectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium),
selectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论