Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
fc75646a
提交
fc75646a
authored
2月 20, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、没有网络的时候才使用缓存
上级
e74a0d00
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
63 行增加
和
41 行删除
+63
-41
key.properties
android/key.properties
+3
-3
Podfile.lock
ios/Podfile.lock
+17
-0
project.pbxproj
ios/Runner.xcodeproj/project.pbxproj
+3
-0
controller.dart
lib/pages/login/controller.dart
+4
-4
controller.dart
lib/pages/read_web/controller.dart
+1
-27
view.dart
lib/pages/read_web/view.dart
+2
-3
http.dart
lib/services/http.dart
+3
-2
index.dart
lib/utils/index.dart
+1
-0
tools.dart
lib/utils/tools.dart
+27
-0
validator.dart
lib/utils/validator.dart
+2
-2
没有找到文件。
android/key.properties
浏览文件 @
fc75646a
...
...
@@ -4,5 +4,5 @@ keyPassword=123456
keyAlias
=
zijing
#storeFile=/Users/apple/zijiing_key.jks
storeFile
=
zijiing_key.jks
\ No newline at end of file
storeFile
=
/Users/apple/zijiing_key.jks
#
storeFile
=
zijiing_key.jks
\ No newline at end of file
ios/Podfile.lock
浏览文件 @
fc75646a
PODS:
- audio_session (0.0.1):
- Flutter
- connectivity_plus (0.0.1):
- Flutter
- ReachabilitySwift
- Flutter (1.0.0)
- flutter_app_update (0.0.1):
- Flutter
...
...
@@ -37,9 +40,13 @@ PODS:
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
- ReachabilitySwift (5.0.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- tobias (0.0.1):
- Flutter
- tobias/normal (= 0.0.1)
...
...
@@ -49,6 +56,7 @@ PODS:
DEPENDENCIES:
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- Flutter (from `Flutter`)
- flutter_app_update (from `.symlinks/plugins/flutter_app_update/ios`)
- flutter_inapp_purchase (from `.symlinks/plugins/flutter_inapp_purchase/ios`)
...
...
@@ -62,17 +70,21 @@ DEPENDENCIES:
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- tobias (from `.symlinks/plugins/tobias/ios`)
SPEC REPOS:
trunk:
- flutter_sound_core
- OrderedSet
- ReachabilitySwift
- WechatOpenSDK-XCFramework
EXTERNAL SOURCES:
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
Flutter:
:path: Flutter
flutter_app_update:
...
...
@@ -99,11 +111,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
tobias:
:path: ".symlinks/plugins/tobias/ios"
SPEC CHECKSUMS:
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_app_update: 65f61da626cb111d1b24674abc4b01728d7723bc
flutter_inapp_purchase: 5c6a1ac3f11b11d0c8c0321c0c41c1f05805e4c8
...
...
@@ -118,7 +133,9 @@ SPEC CHECKSUMS:
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
tobias: 22f69183b14af82a2ac8ff698af084c352744e5f
WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69
...
...
ios/Runner.xcodeproj/project.pbxproj
浏览文件 @
fc75646a
...
...
@@ -489,6 +489,7 @@
INFOPLIST_FILE
=
Runner/Info.plist
;
INFOPLIST_KEY_CFBundleDisplayName
=
"紫荆数智学堂"
;
INFOPLIST_KEY_LSApplicationCategoryType
=
"public.app-category.books"
;
IPHONEOS_DEPLOYMENT_TARGET
=
12.0
;
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"@executable_path/Frameworks"
,
...
...
@@ -658,6 +659,7 @@
INFOPLIST_FILE
=
Runner/Info.plist
;
INFOPLIST_KEY_CFBundleDisplayName
=
"紫荆数智学堂"
;
INFOPLIST_KEY_LSApplicationCategoryType
=
"public.app-category.books"
;
IPHONEOS_DEPLOYMENT_TARGET
=
12.0
;
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"@executable_path/Frameworks"
,
...
...
@@ -680,6 +682,7 @@
INFOPLIST_FILE
=
Runner/Info.plist
;
INFOPLIST_KEY_CFBundleDisplayName
=
"紫荆数智学堂"
;
INFOPLIST_KEY_LSApplicationCategoryType
=
"public.app-category.books"
;
IPHONEOS_DEPLOYMENT_TARGET
=
12.0
;
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"@executable_path/Frameworks"
,
...
...
lib/pages/login/controller.dart
浏览文件 @
fc75646a
...
...
@@ -87,10 +87,10 @@ class LoginController extends GetxController {
// 定时器回调
});
/// 测试账号
if
(
kDebugMode
)
{
phoneInput
.
text
=
'13521054068'
;
passwordInput
.
text
=
'123456'
;
}
//
if (kDebugMode) {
//
phoneInput.text = '13521054068';
//
passwordInput.text = '123456';
//
}
super
.
onInit
();
}
...
...
lib/pages/read_web/controller.dart
浏览文件 @
fc75646a
...
...
@@ -67,7 +67,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 上报开始阅读时间
_addReadTime
(
type:
'open'
);
_getChapters
();
final
netStatus
=
await
_
checkCurrentNetStatus
();
final
netStatus
=
await
Tools
.
checkCurrentNetStatus
();
// 判断是否有离线文件 如果有使用离线阅读
final
exist
=
await
_isExistFile
(
bookId
);
// 没有网并且有离线文件 离线阅读
...
...
@@ -435,32 +435,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
// 判断当前网络状态
Future
<
bool
>
_checkCurrentNetStatus
()
async
{
final
connectivityResult
=
await
(
Connectivity
().
checkConnectivity
());
if
(
connectivityResult
==
ConnectivityResult
.
none
){
return
false
;
}
return
true
;
// if (connectivityResult == ConnectivityResult.mobile) {
// // I am connected to a mobile network.
// } else if (connectivityResult == ConnectivityResult.wifi) {
// // I am connected to a wifi network.
// } else if (connectivityResult == ConnectivityResult.ethernet) {
// // I am connected to a ethernet network.
// } else if (connectivityResult == ConnectivityResult.vpn) {
// // I am connected to a vpn network.
// // Note for iOS and macOS:
// // There is no separate network interface type for [vpn].
// // It returns [other] on any device (also simulator)
// } else if (connectivityResult == ConnectivityResult.bluetooth) {
// // I am connected to a bluetooth.
// } else if (connectivityResult == ConnectivityResult.other) {
// // I am connected to a network which is not in the above mentioned networks.
// } else if (connectivityResult == ConnectivityResult.none) {
// // I am not connected to any network.
// }
}
// 判断是否存在离线文件
Future
<
bool
>
_isExistFile
(
String
bookId
)
async
{
...
...
lib/pages/read_web/view.dart
浏览文件 @
fc75646a
...
...
@@ -52,8 +52,7 @@ class _ReadPageState extends State<ReadPage> {
floatingActionButton:
readController
.
show
&&
!
readController
.
toolModel
.
selected
?
GestureDetector
(
onTap:
(){
readController
.
setShowChat
(
true
);
readController
.
noteTitle
=
'你好你问你你等您第五年对哦in我ID呢哦win地哦为内地那打卡你打困哪'
;
readController
.
setChatType
(
1
);
readController
.
setChatType
(
0
);
},
child:
Image
.
asset
(
'assets/images/chat.png'
),
):
null
,
...
...
@@ -118,7 +117,7 @@ class _ReadPageState extends State<ReadPage> {
controller
.
addJavaScriptHandler
(
handlerName:
'discussCallBack'
,
callback:
(
args
){
readController
.
setShowChat
(
true
);
readController
.
setChatType
(
0
);
readController
.
titleInput
.
text
=
'11111'
;
readController
.
titleInput
.
text
=
args
.
toString
()
;
});
},
...
...
lib/services/http.dart
浏览文件 @
fc75646a
...
...
@@ -103,7 +103,7 @@ class HttpService extends GetxService {
// 如果启用缓存,将cacheEnabled参数添加到请求选项中
if
(
cacheEnabled
){
requestOptions
.
extra
??=
{};
requestOptions
.
extra
![
'cacheEnabled'
]
=
fals
e
;
requestOptions
.
extra
![
'cacheEnabled'
]
=
tru
e
;
}
final
response
=
await
_dio
.
post
(
url
,
...
...
@@ -335,7 +335,8 @@ class _CacheInterceptor extends Interceptor {
void
onRequest
(
RequestOptions
options
,
RequestInterceptorHandler
handler
)
async
{
final
cacheEnabled
=
options
.
extra
?[
'cacheEnabled'
]
??
false
;
if
(
cacheEnabled
)
{
final
status
=
await
Tools
.
checkCurrentNetStatus
();
if
(
cacheEnabled
&&
!
status
)
{
// 在发起请求之前,检查缓存是否存在有效数据
final
cachedFile
=
await
DefaultCacheManager
().
getFileFromCache
(
options
.
uri
.
toString
());
if
(
cachedFile
!=
null
&&
cachedFile
.
validTill
.
isAfter
(
DateTime
.
now
()))
{
...
...
lib/utils/index.dart
浏览文件 @
fc75646a
...
...
@@ -7,6 +7,7 @@ import 'dart:io';
import
'dart:ui'
;
// import 'package:encrypt/encrypt.dart';
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dio/dio.dart'
;
import
'package:encrypt/encrypt.dart'
as
encrypt
;
// 使用别名 'encrypt'
import
'package:flutter/cupertino.dart'
;
...
...
lib/utils/tools.dart
浏览文件 @
fc75646a
...
...
@@ -48,6 +48,33 @@ abstract class Tools {
String
formattedDate
=
DateFormat
(
'yyyyMMddHHmmss'
).
format
(
now
);
return
'voice_
$formattedDate
.mp4'
;
}
// 判断当前网络状态
static
Future
<
bool
>
checkCurrentNetStatus
()
async
{
final
connectivityResult
=
await
(
Connectivity
().
checkConnectivity
());
if
(
connectivityResult
==
ConnectivityResult
.
none
){
return
false
;
}
return
true
;
// if (connectivityResult == ConnectivityResult.mobile) {
// // I am connected to a mobile network.
// } else if (connectivityResult == ConnectivityResult.wifi) {
// // I am connected to a wifi network.
// } else if (connectivityResult == ConnectivityResult.ethernet) {
// // I am connected to a ethernet network.
// } else if (connectivityResult == ConnectivityResult.vpn) {
// // I am connected to a vpn network.
// // Note for iOS and macOS:
// // There is no separate network interface type for [vpn].
// // It returns [other] on any device (also simulator)
// } else if (connectivityResult == ConnectivityResult.bluetooth) {
// // I am connected to a bluetooth.
// } else if (connectivityResult == ConnectivityResult.other) {
// // I am connected to a network which is not in the above mentioned networks.
// } else if (connectivityResult == ConnectivityResult.none) {
// // I am not connected to any network.
// }
}
}
...
...
lib/utils/validator.dart
浏览文件 @
fc75646a
...
...
@@ -91,9 +91,9 @@ class ValidatorTool {
// 密码
static
bool
isValidPassword
(
String
value
)
{
//
RegExp passwordPattern = RegExp(r'^[A-Za-z0-9!@#\$%^&*()_+{}\[\]:;<>,.?~\\/-]{8,12}$');
RegExp
passwordPattern
=
RegExp
(
r'^[A-Za-z0-9!@#\$%^&*()_+{}\[\]:;<>,.?~\\/-]{8,12}$'
);
// RegExp passwordPattern = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)(?=.*[~@#%$*()_+{}\[\]:;<>,.?\\/-])[A-Za-z0-9~@#%$*()_+{}\[\]:;<>,.?\\/-]{8,12}$');
RegExp
passwordPattern
=
RegExp
(
r'^\d{6}$'
);
//
RegExp passwordPattern = RegExp(r'^\d{6}$');
return
passwordPattern
.
hasMatch
(
value
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论