Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
c5ddd28c
提交
c5ddd28c
authored
4月 07, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
阅读页 需要购买处理
上级
55d58582
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
137 行增加
和
13 行删除
+137
-13
read.css
assets/html/assets/css/read.css
+43
-3
icon_lock_content@1x.png
assets/html/assets/images/icon_lock_content@1x.png
+0
-0
icon_lock_content@2x.png
assets/html/assets/images/icon_lock_content@2x.png
+0
-0
icon_lock_content@3x.png
assets/html/assets/images/icon_lock_content@3x.png
+0
-0
request.dev.js
assets/html/assets/js/dist/request.dev.js
+1
-2
request.js
assets/html/assets/js/request.js
+3
-3
read.html
assets/html/read.html
+37
-3
controller.dart
lib/pages/answer/controller.dart
+12
-0
index.dart
lib/pages/answer/index.dart
+5
-0
view.dart
lib/pages/answer/view.dart
+13
-1
view.dart
lib/pages/read_web/view.dart
+23
-1
没有找到文件。
assets/html/assets/css/read.css
浏览文件 @
c5ddd28c
...
...
@@ -422,9 +422,49 @@ light.c-ff4500::selection {
width
:
100%
;
height
:
auto
;
}
.chapter-container
.chapter-content-list
p
{
font-size
:
0.3466666666666667rem
;
line-height
:
0.6933333333333334rem
;
.chapter-container
.chapter-content-list
.lock-content
{
padding-top
:
50px
;
}
.chapter-container
.chapter-content-list
.lock-content
.lock-img
{
justify-content
:
center
;
display
:
flex
;
}
.chapter-container
.chapter-content-list
.lock-content
.lock-img
.img
{
width
:
4.573333333333333rem
;
height
:
3.8666666666666667rem
;
background-image
:
url("../images/icon_lock_content@1x.png")
;
background-size
:
cover
;
}
@media
only
screen
and
(
-webkit-min-device-pixel-ratio
:
2
),
(
min-resolution
:
192dpi
)
{
.chapter-container
.chapter-content-list
.lock-content
.lock-img
.img
{
background-image
:
url("../images/icon_lock_content@2x.png")
;
}
}
@media
only
screen
and
(
-webkit-min-device-pixel-ratio
:
3
),
(
min-resolution
:
288dpi
)
{
.chapter-container
.chapter-content-list
.lock-content
.lock-img
.img
{
background-image
:
url("../images/icon_lock_content@3x.png")
;
}
}
.chapter-container
.chapter-content-list
.lock-content
.lock-desc
{
font-size
:
16px
;
text-align
:
center
;
color
:
#999
;
margin
:
15px
0
;
}
.chapter-container
.chapter-content-list
.lock-content
.lock-button
{
text-align
:
center
;
}
.chapter-container
.chapter-content-list
.lock-content
.lock-button
span
{
font-size
:
16px
;
color
:
#fff
;
background-color
:
#aa1941
;
display
:
inline-block
;
width
:
40vw
;
height
:
40px
;
border-radius
:
20px
;
line-height
:
40px
;
cursor
:
pointer
;
box-shadow
:
0
0
5px
1px
rgba
(
170
,
25
,
65
,
0.5
);
}
.chapter-container
.range-controll
{
-webkit-user-select
:
none
;
...
...
assets/html/assets/images/icon_lock_content@1x.png
0 → 100644
浏览文件 @
c5ddd28c
5.6 KB
assets/html/assets/images/icon_lock_content@2x.png
0 → 100644
浏览文件 @
c5ddd28c
12.6 KB
assets/html/assets/images/icon_lock_content@3x.png
0 → 100644
浏览文件 @
c5ddd28c
25.3 KB
assets/html/assets/js/dist/request.dev.js
浏览文件 @
c5ddd28c
...
...
@@ -86,8 +86,7 @@ request.interceptors.response.use(function (response) {
if
(
response
.
data
&&
response
.
data
.
code
===
200
)
{
return
response
.
data
;
}
else
{
console
.
log
(
JSON
.
stringify
(
response
));
return
false
;
return
response
.
data
;
}
}
...
...
assets/html/assets/js/request.js
浏览文件 @
c5ddd28c
...
...
@@ -80,11 +80,11 @@ request.interceptors.response.use(
if
(
response
.
data
&&
response
.
data
.
code
===
200
)
{
return
response
.
data
;
}
else
{
console
.
log
(
JSON
.
stringify
(
response
));
return
false
;
return
response
;
}
}
else
{
return
response
;
}
return
false
;
},
function
(
error
)
{
const
str
=
`message:
${
error
.
message
}
\n data:
${
error
.
config
.
data
}
\n token:
${
error
.
config
.
headers
.
Authorization
}
`
;
...
...
assets/html/read.html
浏览文件 @
c5ddd28c
...
...
@@ -56,14 +56,23 @@ function countSubstringOccurrences(str, substring) {
<div
class=
"chapter-content-list"
id=
"chapter-content-list"
>
<div
class=
"show"
>
<!-- <div style="height: 60px"><a href="javascript:;" class="reload" style="font-size: 20px" onclick="window.location.reload(true)">刷新页面</a></div> -->
<div
class=
"chapter-item"
:class=
"[`chapter-item-${chapter_id}`]"
id=
"chapter-item"
:data-id=
"chapter_id"
v-html=
"chapterContent"
v-show=
"!lockedContent"
></div>
<div
class=
"lock-content"
v-show=
"lockedContent"
>
<div
class=
"lock-img"
>
<div
class=
"img"
></div>
</div>
<div
class=
"lock-desc"
>
未解锁章节
</div>
<div
class=
"lock-button"
>
<span>
获取完整版
</span>
</div>
</div>
</div>
</div>
<div
class=
"range-controll"
>
...
...
@@ -285,6 +294,7 @@ function countSubstringOccurrences(str, substring) {
friction
:
0.03
,
// 摩擦系数
animationId
:
null
,
// 动画id
animationType
:
null
,
// 上滑还是下滑
lockedContent
:
false
,
// 章节被锁
},
created
()
{},
async
mounted
()
{
...
...
@@ -333,6 +343,8 @@ function countSubstringOccurrences(str, substring) {
});
if
(
res
&&
(
res
.
code
===
200
||
res
.
code
===
"200"
))
{
this
.
lockedContent
=
false
;
this
.
next_chapter
=
res
.
data
.
next_chapter
;
// 下一节的内容
this
.
prev_chapter
=
res
.
data
.
up_chapter
;
// 上一节的内容
this
.
color_line
=
res
.
data
.
color_line
;
// 高亮
...
...
@@ -364,9 +376,15 @@ function countSubstringOccurrences(str, substring) {
this
.
nextChapterLoading
=
false
;
}
}
else
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
3001
)
{
clearInterval
(
this
.
readTimer
);
this
.
lockedContent
=
true
;
this
.
callHandlerNoticeFlutterSubmit
(
"dismissLoadingCallback"
);
}
else
if
(
res
&&
res
.
response
.
status
===
403
)
{
this
.
nextChapterLoading
=
false
;
this
.
callHandlerNoticeFlutterSubmit
(
"refreshTokenCallback"
);
}
}
this
.
callHandlerNoticeFlutterSubmit
(
"dismissLoadingCallback"
);
},
// 添加学习进度
async
uploadReadProgress
(
chapter_id
,
progress
)
{
...
...
@@ -772,6 +790,10 @@ function countSubstringOccurrences(str, substring) {
}
event
.
stopPropagation
();
event
.
preventDefault
();
}
else
if
(
$
(
target
).
closest
(
".lock-button"
).
length
)
{
_that
.
callHandlerNoticeFlutterSubmit
(
'payCallback'
);
event
.
stopPropagation
();
event
.
preventDefault
();
}
}
else
if
(
target
.
nodeName
.
toLowerCase
()
===
"a"
)
{
const
href
=
$
(
target
).
attr
(
"href"
);
...
...
@@ -2157,6 +2179,15 @@ function countSubstringOccurrences(str, substring) {
console
.
log
(
e
);
}
},
async
refreshTokenSuccess
(
args
)
{
try
{
this
.
token
=
args
.
token
;
localStorage
.
setItem
(
"token"
,
args
.
token
);
this
.
getBookChapterData
();
}
catch
(
e
)
{
console
.
log
(
e
);
}
},
// 通知flutter组件
callHandlerNoticeFlutterSubmit
(
funcname
=
"evaluatingSubmit"
,
data
)
{
if
(
...
...
@@ -2176,7 +2207,10 @@ function countSubstringOccurrences(str, substring) {
const
callbackInFlutterComponent
=
(
arguments
)
=>
{
return
app
.
callbackInFlutterComponent
(
arguments
);
};
// callbackInFlutterComponent(',175,2834,8840845189b938e3456ea4c98705dcd5');
const
refreshTokenSuccess
=
(
arguments
)
=>
{
return
app
.
refreshTokenSuccess
(
arguments
);
};
// callbackInFlutterComponent(',368,2901,bc398dd1d424aea905b05fc7de6af8f5b');
</script>
</body>
</html>
lib/pages/answer/controller.dart
0 → 100644
浏览文件 @
c5ddd28c
part of
answer
;
class
AnswerController
extends
GetxController
{
// 刷新token
Future
<
String
?>
refreshToken
()
async
{
final
result
=
await
CommonAPI
.
refreshToken
();
return
result
;
}
}
\ No newline at end of file
lib/pages/answer/index.dart
浏览文件 @
c5ddd28c
library
answer
;
import
'dart:convert'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'package:get/get.dart'
;
import
'package:go_router/go_router.dart'
;
import
'../../apis/index.dart'
;
import
'../../utils/index.dart'
;
import
'../../widgets/index.dart'
;
part
'view.dart'
;
part
'controller.dart'
;
lib/pages/answer/view.dart
浏览文件 @
c5ddd28c
...
...
@@ -22,7 +22,9 @@ class _AnswerPageState extends State<AnswerPage> {
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
GetBuilder
(
init:
AnswerController
(),
builder:
(
aController
)
=>
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'
${widget.params['title']}
'
),
),
...
...
@@ -57,12 +59,22 @@ class _AnswerPageState extends State<AnswerPage> {
url:
WebUri
.
uri
(
Uri
.
parse
(
kAnswerResult
))
));
});
// 前端 token过期回调
controller
.
addJavaScriptHandler
(
handlerName:
'refreshTokenCallback'
,
callback:
(
args
)
async
{
final
result
=
await
aController
.
refreshToken
();
Map
<
String
,
dynamic
>
param
=
{
'token'
:
result
,
};
String
jsonStr
=
jsonEncode
(
param
);
controller
.
evaluateJavascript
(
source
:
'refreshTokenSuccess(
$jsonStr
)'
);
});
},
onConsoleMessage:
(
controller
,
consoleMessage
)
{
// 接收从 WebView 发送的消息
Console
.
log
(
"知识测评-------Received message from WebView-----------------------------:
${consoleMessage.message}
"
);
},
)
),
);
}
}
lib/pages/read_web/view.dart
浏览文件 @
c5ddd28c
...
...
@@ -100,8 +100,8 @@ class _ReadPageState extends State<ReadPage> {
readController
.
getOffLineInfo
();
}
else
{
Console
.
log
(
'-----------------加载在线数据---------------'
);
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
");'
);
}
...
...
@@ -225,6 +225,26 @@ class _ReadPageState extends State<ReadPage> {
context
.
pushNamed
(
Routes
.
readInfo
,
queryParameters:
params
);
});
// 购买回调
controller
.
addJavaScriptHandler
(
handlerName:
'payCallback'
,
callback:
(
args
){
List
<
CourseModel
>
buy
=
[];
CourseModel
model
=
CourseModel
(
bookId:
readController
.
bookDetailModel
.
bookId
,
price:
readController
.
bookDetailModel
.
price
,
vipPrice:
readController
.
bookDetailModel
.
vipPrice
,
img:
readController
.
bookDetailModel
.
img
,
bookName:
readController
.
bookDetailModel
.
bookName
,
cartId:
0
,
status:
1
,
selected:
true
);
buy
.
add
(
model
);
context
.
pushNamed
(
Routes
.
bookPay
,
extra:
buy
).
then
((
value
){
controller
.
reload
();
});
});
// 图片预览
controller
.
addJavaScriptHandler
(
handlerName:
'scaleImageCallback'
,
callback:
(
args
){
String
url
=
args
.
first
[
0
].
toString
();
...
...
@@ -239,11 +259,13 @@ class _ReadPageState extends State<ReadPage> {
// 前端 token过期回调
controller
.
addJavaScriptHandler
(
handlerName:
'refreshTokenCallback'
,
callback:
(
args
)
async
{
Console
.
log
(
'刷新token------------------------'
);
final
result
=
await
readController
.
refreshToken
();
Map
<
String
,
dynamic
>
param
=
{
'token'
:
result
,
};
String
jsonStr
=
jsonEncode
(
param
);
Console
.
log
(
'刷新token------------------------
$jsonStr
'
);
controller
.
evaluateJavascript
(
source
:
'refreshTokenSuccess(
$jsonStr
)'
);
});
controller
.
addJavaScriptHandler
(
handlerName:
'showLoadingCallback'
,
callback:
(
args
)
async
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论