作者 杨谦

1.普通视频记录ok,可更新课程完成状态

2.班级视频课程任务进度记录成功,完成状态异常
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<title>Document</title>
<style type="text/css">
canvas {
width: 100%;
height: 100%;
border: 1px solid black;
}
</style>
<script src="https://unpkg.com/pdfjs-dist@1.9.426/build/pdf.min.js"></script>
<script type="text/javascript" src="index.js"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
var url = location.search.substring(1);
PDFJS.cMapUrl = 'https://unpkg.com/pdfjs-dist@1.9.426/cmaps/';
PDFJS.cMapPacked = true;
var pdfDoc = null;
function createPage() {
var div = document.createElement("canvas");
document.body.appendChild(div);
return div;
}
function renderPage(num) {
pdfDoc.getPage(num).then(function (page) {
var viewport = page.getViewport(2.0);
var canvas = createPage();
var ctx = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
page.render({
canvasContext: ctx,
viewport: viewport
});
});
}
PDFJS.getDocument(url).then(function (pdf) {
pdfDoc = pdf;
for (var i = 1; i <= pdfDoc.numPages; i++) {
renderPage(i)
}
});
\ No newline at end of file
... ... @@ -9,9 +9,9 @@ import java.io.File
* Description: 初见时你很迷人
*/
object Constant {
const val BASE_URL = "https://admin.anqixing.com"
// const val BASE_URL = "https://admin.anqixing.com"
// const val BASE_URL = "https://security.brofirst.cn"
// const val BASE_URL = "https://test.admin.anqixing.com"
const val BASE_URL = "https://test.admin.anqixing.com"
const val USERNAME_KEY = "username"
const val USERID_KEY = "userid"
const val LOGIN_KEY = "login"
... ... @@ -46,7 +46,6 @@ object Constant {
const val KEY_TODO_DATE = "todo_date"
const val KEY_TODO_PRIORITY = "todo_priority"
const val KEY_TODO_ID = "todo_id"
... ...
... ... @@ -234,4 +234,13 @@ interface LessonApi : ApiService {
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<Void>>
@FormUrlEncoded
@POST("/api/lesson/user_class_log")
fun recordTrainLesson(
@Field("type") type: Int,
@Field("lesson_id") lesson_id: String,
@Field("train_class_id") train_class_id: String,
@Field("view_len") view_len: String?,
@Field("class_id") class_id: String?
): Observable<BaseResponse<Void>>
}
\ No newline at end of file
... ...
... ... @@ -172,6 +172,20 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
)
}
fun recordTrainLesson(
type: Int,
lesson_id: String,
train_class_id: String,
view_len: String?,
class_id: String?,
liveData: MutableLiveData<BaseResponse<Void>>
) {
addRequest(
lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len, class_id),
liveData
)
}
fun recordNormalLesson(
type: Int,
lesson_id: String,
... ...
... ... @@ -64,7 +64,7 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
var data = ""
val decemal = BigDecimal(str)
val ddd = BigDecimal("1000")
data = decemal.divide(ddd).toString()
data = decemal.divide(ddd).toInt().toString()
return data
}
... ...
... ... @@ -25,13 +25,12 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() {
) {
courseParam.value?.let {
if (it.isTrainClass) {
val map = hashMapOf("class_id" to it.mClassId)
mRepository.recordTrainLesson(
1,
it.mLessonId,
it.mTrainClassId,
view_len,
map,
it.mClassId,
record
)
} else {
... ...