Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
54541654
提交
54541654
authored
2月 07, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add
上级
8059be8c
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
189 行增加
和
20 行删除
+189
-20
common.dart
lib/apis/common.dart
+9
-0
library.dart
lib/models/library.dart
+37
-0
view.dart
lib/pages/change_pwd/view.dart
+1
-1
controller.dart
lib/pages/read_web/controller.dart
+25
-5
index.dart
lib/pages/read_web/index.dart
+3
-0
view.dart
lib/pages/read_web/view.dart
+3
-3
index.dart
lib/pages/user_coin_recharge/index.dart
+1
-0
view.dart
lib/pages/user_coin_recharge/view.dart
+11
-6
controller.dart
lib/pages/user_info/controller.dart
+6
-2
http.dart
lib/services/http.dart
+1
-1
index.dart
lib/utils/index.dart
+8
-2
oss.dart
lib/utils/oss.dart
+50
-0
pubspec.lock
pubspec.lock
+32
-0
pubspec.yaml
pubspec.yaml
+2
-0
没有找到文件。
lib/apis/common.dart
浏览文件 @
54541654
...
...
@@ -165,6 +165,14 @@ abstract class CommonAPI {
return
result
.
data
[
'filesUrl'
];
}
/// 11、获取OSS临时token
static
Future
<
OssModel
>
oss
()
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/common/Alioss/getUploadToken'
,
);
if
(
result
.
data
is
!
Map
)
return
OssModel
();
return
OssModel
.
fromJson
(
result
.
data
);
}
}
\ No newline at end of file
lib/models/library.dart
浏览文件 @
54541654
...
...
@@ -494,4 +494,41 @@ class BookDownloadModel {
}
class
OssModel
{
OssModel
({
this
.
securityToken
,
this
.
accessKeyId
,
this
.
accessKeySecret
,
this
.
expiration
,});
OssModel
.
fromJson
(
dynamic
json
)
{
securityToken
=
json
[
'SecurityToken'
];
accessKeyId
=
json
[
'AccessKeyId'
];
accessKeySecret
=
json
[
'AccessKeySecret'
];
expiration
=
json
[
'Expiration'
];
}
String
?
securityToken
;
String
?
accessKeyId
;
String
?
accessKeySecret
;
String
?
expiration
;
OssModel
copyWith
({
String
?
securityToken
,
String
?
accessKeyId
,
String
?
accessKeySecret
,
String
?
expiration
,
})
=>
OssModel
(
securityToken:
securityToken
??
this
.
securityToken
,
accessKeyId:
accessKeyId
??
this
.
accessKeyId
,
accessKeySecret:
accessKeySecret
??
this
.
accessKeySecret
,
expiration:
expiration
??
this
.
expiration
,
);
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
map
[
'SecurityToken'
]
=
securityToken
;
map
[
'AccessKeyId'
]
=
accessKeyId
;
map
[
'AccessKeySecret'
]
=
accessKeySecret
;
map
[
'Expiration'
]
=
expiration
;
return
map
;
}
}
lib/pages/change_pwd/view.dart
浏览文件 @
54541654
...
...
@@ -113,7 +113,7 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
),
Container
(
margin:
EdgeInsets
.
only
(
left:
5
.
w
,
top:
5
.
w
),
child:
Text
(
'密码必须是
6-20个英文字母、数字或符号
'
,
style:
TextStyle
(
fontSize:
10
.
w
,
color:
Colours
.
c9
),),
child:
Text
(
'密码必须是
8-20个英文字母、数字或符号(除空格)
'
,
style:
TextStyle
(
fontSize:
10
.
w
,
color:
Colours
.
c9
),),
),
Gaps
.
vGaps40
,
CustomGradientButton
(
...
...
lib/pages/read_web/controller.dart
浏览文件 @
54541654
...
...
@@ -55,6 +55,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
void
onInit
()
{
discussTitleFocusNode
.
addListener
(
_onCommentFocusChanged
);
openTheRecorder
();
super
.
onInit
();
}
...
...
@@ -116,8 +117,10 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
void
record
()
async
{
startRecording
=
true
;
String
filePath
=
await
_getDocumentsDirectory
();
String
fileName
=
generateVoiceFileName
();
_mRecorder
.
startRecorder
(
toFile:
'
$filePath
/
tau_file.mp4
'
,
toFile:
'
$filePath
/
$fileName
'
,
audioSource:
AudioSource
.
microphone
,
codec:
Codec
.
aacMP4
,
...
...
@@ -134,14 +137,27 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
// 停止录音
void
stopRecorder
()
async
{
just_audio
.
AudioPlayer
audioPlayer
=
just_audio
.
AudioPlayer
();
startRecording
=
false
;
_mRecorder
.
stopRecorder
().
then
((
value
){
print
(
'------value-------------------
$value
---------------------------------------'
);
});
final
path
=
await
_mRecorder
.
stopRecorder
();
var
duration
=
await
audioPlayer
.
setFilePath
(
path
!);
print
(
'-----duration---------------------
$duration
------'
);
update
();
}
// 语音文件名称
String
generateVoiceFileName
(){
DateTime
now
=
DateTime
.
now
();
String
formattedDate
=
DateFormat
(
'yyyyMMddHHmmss'
).
format
(
now
);
return
'voice_
$formattedDate
.mp4'
;
}
// 添加语音路径
void
addVoiceFilePath
(){
}
// 添加讨论图片
void
addDiscussInputImages
(
String
path
){
discussInputImages
.
add
(
path
);
...
...
@@ -389,6 +405,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
//获取存储目录
Future
<
String
>
_getDocumentsDirectory
()
async
{
// getTemporaryDirectory
final
directory
=
await
getExternalStorageDirectory
();
return
directory
!.
path
;
}
...
...
@@ -436,3 +453,6 @@ class ToolModel {
String
activeIcon
;
}
class
AudioModel
{
}
lib/pages/read_web/index.dart
浏览文件 @
54541654
...
...
@@ -9,13 +9,16 @@ import 'package:flutter/material.dart';
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_oss_aliyun/flutter_oss_aliyun.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_sound/public/flutter_sound_recorder.dart'
;
import
'package:flutter_sound/public/util/flutter_sound_helper.dart'
;
import
'package:flutter_sound_platform_interface/flutter_sound_platform_interface.dart'
;
import
'package:flutter_sound_platform_interface/flutter_sound_recorder_platform_interface.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'package:intl/intl.dart'
;
import
'package:just_audio/just_audio.dart'
as
just_audio
;
import
'package:path_provider/path_provider.dart'
;
import
'dart:async'
;
import
'package:plugin_platform_interface/plugin_platform_interface.dart'
;
...
...
lib/pages/read_web/view.dart
浏览文件 @
54541654
...
...
@@ -63,7 +63,7 @@ class _ReadPageState extends State<ReadPage> {
),
InAppWebView
(
initialUrlRequest:
URLRequest
(
url:
Uri
.
parse
(
'http://1
92.168.11.46
:9200/read.html'
),
url:
Uri
.
parse
(
'http://1
50.158.138.40
:9200/read.html'
),
),
contextMenu:
ContextMenu
(
options:
ContextMenuOptions
(
hideDefaultSystemContextMenuItems:
true
),
...
...
@@ -71,8 +71,8 @@ class _ReadPageState extends State<ReadPage> {
onLoadStop:
(
controller
,
url
)
{
// flutter 主动给 js 传参数
Map
<
String
,
dynamic
>
param
=
{
'book_id'
:
110
,
'chapter_id'
:
1
,
'book_id'
:
widget
.
bookId
,
'chapter_id'
:
widget
.
chapterId
,
'token'
:
UserStore
.
to
.
token
};
controller
.
evaluateJavascript
(
source
:
'callbackInFlutterComponent("
$param
");'
);
...
...
lib/pages/user_coin_recharge/index.dart
浏览文件 @
54541654
...
...
@@ -16,6 +16,7 @@ import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import
'package:go_router/go_router.dart'
;
import
'package:tobias/tobias.dart'
;
import
'../../routes/index.dart'
;
import
'../../services/index.dart'
;
import
'../../utils/index.dart'
;
import
'../../widgets/index.dart'
;
...
...
lib/pages/user_coin_recharge/view.dart
浏览文件 @
54541654
...
...
@@ -68,12 +68,17 @@ class _CoinRechargePageState extends State<CoinRechargePage> with AutomaticKeepA
),
),
Gaps
.
vGaps15
,
RichText
(
text:
TextSpan
(
children:
[
TextSpan
(
text:
'充值即代表同意'
,
style:
TextStyle
(
fontSize:
13
.
w
,
height:
1.5
,
color:
Colours
.
c9
)),
TextSpan
(
text:
'《用户充值协议》'
,
style:
TextStyle
(
fontSize:
13
.
w
,
height:
1.5
,
color:
Color
(
0xFF2A82D9
))),
]
)),
GestureDetector
(
onTap:
(){
context
.
pushNamed
(
Routes
.
terms
);
},
child:
RichText
(
text:
TextSpan
(
children:
[
TextSpan
(
text:
'充值即代表同意'
,
style:
TextStyle
(
fontSize:
13
.
w
,
height:
1.5
,
color:
Colours
.
c9
)),
TextSpan
(
text:
'《用户充值协议》'
,
style:
TextStyle
(
fontSize:
13
.
w
,
height:
1.5
,
color:
Color
(
0xFF2A82D9
))),
]
)),
),
Gaps
.
vGaps15
],
),
...
...
lib/pages/user_info/controller.dart
浏览文件 @
54541654
...
...
@@ -8,8 +8,12 @@ class UserInfoController extends GetxController {
void
upload
({
required
String
path
})
async
{
String
result
=
await
CommonAPI
.
upload
(
path:
path
,
fileTypes:
'user'
);
_changeInfo
(
result
);
// String result = await CommonAPI.upload(path:path,fileTypes: 'user');
OssTool
tool
=
OssTool
(
'zxts-user-file'
);
print
(
'------path--------------------------
$path
'
);
final
response
=
await
tool
.
putObjectFile
(
path
);
print
(
'------response--------------------------
${response.data}
'
);
// _changeInfo(result);
}
/// 修改用用户信息
...
...
lib/services/http.dart
浏览文件 @
54541654
...
...
@@ -226,7 +226,7 @@ class _RequestInterceptor extends Interceptor {
var
msg
=
'服务器错误'
;
switch
(
statusCode
)
{
case
403
:
print
(
'-------------------access_token-------------------------
${UserStore.to.accessToken}
--------------------'
);
print
(
'----------
403
---------access_token-------------------------
${UserStore.to.accessToken}
--------------------'
);
msg
=
'
$statusCode
- Unauthorized'
;
final
newToken
=
await
refreshToken
();
if
(
newToken
!=
null
)
{
...
...
lib/utils/index.dart
浏览文件 @
54541654
...
...
@@ -5,10 +5,12 @@ import 'dart:io';
import
'dart:ui'
;
// import 'package:encrypt/encrypt.dart';
import
'package:dio/dio.dart'
;
import
'package:encrypt/encrypt.dart'
as
encrypt
;
// 使用别名 'encrypt'
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/apis/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'package:intl/intl.dart'
;
...
...
@@ -18,6 +20,9 @@ import 'package:convert/convert.dart';
import
'package:oktoast/oktoast.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:flutter_oss_aliyun/flutter_oss_aliyun.dart'
;
import
'../models/index.dart'
;
import
'../widgets/index.dart'
;
...
...
@@ -33,4 +38,5 @@ part 'validator.dart';
part
'toast_utils.dart'
;
part
'clear_cache_util.dart'
;
part
'access.dart'
;
part
'assets_picker.dart'
;
\ No newline at end of file
part
'assets_picker.dart'
;
part
'oss.dart'
;
\ No newline at end of file
lib/utils/oss.dart
0 → 100644
浏览文件 @
54541654
part of
utils
;
//'bucket_comment' => 'zxts-comment-file', 'bucket_user' => 'zxts-user-file', 'endpoint' => 'zijingebook.com',
class
OssTool
{
late
OssModel
ossModel
;
final
String
bucketName
;
OssTool
(
this
.
bucketName
){
initOss
(
bucketName
);
}
void
initOss
(
String
bucketName
)
async
{
Client
.
init
(
ossEndpoint:
'zijingebook.com'
,
bucketName:
bucketName
,
authGetter:
_authGetter
);
}
// 获取临时凭证
Future
<
Auth
>
_authGetter
()
async
{
final
result
=
await
CommonAPI
.
oss
();
return
Auth
(
accessKey:
result
.
accessKeyId
!,
accessSecret:
result
.
accessKeySecret
!,
expire:
result
.
expiration
!,
secureToken:
result
.
securityToken
!,
);
}
// 本地文件上传
Future
<
Response
<
dynamic
>>
putObjectFile
(
String
filePath
){
print
(
'------------------222222222222222222222--------------'
);
return
Client
().
putObjectFile
(
filePath
,
);
}
// 批量本地文件上传
Future
<
List
<
Response
>>
putObjectFiles
(
List
<
String
>
filePaths
){
return
Client
().
putObjectFiles
(
filePaths
.
map
((
e
){
return
AssetFileEntity
(
filepath:
e
);
}).
toList
()
);
}
}
\ No newline at end of file
pubspec.lock
浏览文件 @
54541654
...
...
@@ -243,6 +243,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_oss_aliyun:
dependency: "direct main"
description:
name: flutter_oss_aliyun
sha256: d4e7423a29a3ff41aff6ab8278e0371716a3c3c1d086f937a9695a70ea8f8d39
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.4.1"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
...
...
@@ -437,6 +445,30 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.7"
just_audio:
dependency: "direct main"
description:
name: just_audio
sha256: b607cd1a43bac03d85c3aaee00448ff4a589ef2a77104e3d409889ff079bf823
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.36"
just_audio_platform_interface:
dependency: transitive
description:
name: just_audio_platform_interface
sha256: c3dee0014248c97c91fe6299edb73dc4d6c6930a2f4f713579cd692d9e47f4a1
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.2.2"
just_audio_web:
dependency: transitive
description:
name: just_audio_web
sha256: "134356b0fe3d898293102b33b5fd618831ffdc72bb7a1b726140abdf22772b70"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.9"
lints:
dependency: transitive
description:
...
...
pubspec.yaml
浏览文件 @
54541654
...
...
@@ -104,6 +104,8 @@ dependencies:
# 内购
flutter_inapp_purchase
:
^5.6.1
encrypt
:
^5.0.3
flutter_oss_aliyun
:
^6.4.1
just_audio
:
^0.9.36
dev_dependencies
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论