1.普通视频记录ok,可更新课程完成状态
2.班级视频课程任务进度记录成功,完成状态异常
正在显示
7 个修改的文件
包含
27 行增加
和
61 行删除
app/src/main/assets/index.html
已删除
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html lang="en"> | ||
3 | -<head> | ||
4 | - <meta charset="UTF-8"> | ||
5 | - <meta name="viewport" | ||
6 | - content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/> | ||
7 | - <title>Document</title> | ||
8 | - <style type="text/css"> | ||
9 | - canvas { | ||
10 | - width: 100%; | ||
11 | - height: 100%; | ||
12 | - border: 1px solid black; | ||
13 | - } | ||
14 | - </style> | ||
15 | - <script src="https://unpkg.com/pdfjs-dist@1.9.426/build/pdf.min.js"></script> | ||
16 | - <script type="text/javascript" src="index.js"></script> | ||
17 | -</head> | ||
18 | -<body> | ||
19 | -</body> | ||
20 | -</html> |
app/src/main/assets/index.js
已删除
100644 → 0
1 | -var url = location.search.substring(1); | ||
2 | - | ||
3 | -PDFJS.cMapUrl = 'https://unpkg.com/pdfjs-dist@1.9.426/cmaps/'; | ||
4 | -PDFJS.cMapPacked = true; | ||
5 | - | ||
6 | -var pdfDoc = null; | ||
7 | - | ||
8 | -function createPage() { | ||
9 | - var div = document.createElement("canvas"); | ||
10 | - document.body.appendChild(div); | ||
11 | - return div; | ||
12 | -} | ||
13 | - | ||
14 | -function renderPage(num) { | ||
15 | - pdfDoc.getPage(num).then(function (page) { | ||
16 | - var viewport = page.getViewport(2.0); | ||
17 | - var canvas = createPage(); | ||
18 | - var ctx = canvas.getContext('2d'); | ||
19 | - | ||
20 | - canvas.height = viewport.height; | ||
21 | - canvas.width = viewport.width; | ||
22 | - | ||
23 | - page.render({ | ||
24 | - canvasContext: ctx, | ||
25 | - viewport: viewport | ||
26 | - }); | ||
27 | - }); | ||
28 | -} | ||
29 | - | ||
30 | -PDFJS.getDocument(url).then(function (pdf) { | ||
31 | - pdfDoc = pdf; | ||
32 | - for (var i = 1; i <= pdfDoc.numPages; i++) { | ||
33 | - renderPage(i) | ||
34 | - } | ||
35 | -}); |
@@ -9,9 +9,9 @@ import java.io.File | @@ -9,9 +9,9 @@ import java.io.File | ||
9 | * Description: 初见时你很迷人 | 9 | * Description: 初见时你很迷人 |
10 | */ | 10 | */ |
11 | object Constant { | 11 | object Constant { |
12 | - const val BASE_URL = "https://admin.anqixing.com" | 12 | +// const val BASE_URL = "https://admin.anqixing.com" |
13 | // const val BASE_URL = "https://security.brofirst.cn" | 13 | // const val BASE_URL = "https://security.brofirst.cn" |
14 | -// const val BASE_URL = "https://test.admin.anqixing.com" | 14 | + const val BASE_URL = "https://test.admin.anqixing.com" |
15 | const val USERNAME_KEY = "username" | 15 | const val USERNAME_KEY = "username" |
16 | const val USERID_KEY = "userid" | 16 | const val USERID_KEY = "userid" |
17 | const val LOGIN_KEY = "login" | 17 | const val LOGIN_KEY = "login" |
@@ -46,7 +46,6 @@ object Constant { | @@ -46,7 +46,6 @@ object Constant { | ||
46 | 46 | ||
47 | const val KEY_TODO_DATE = "todo_date" | 47 | const val KEY_TODO_DATE = "todo_date" |
48 | 48 | ||
49 | - | ||
50 | const val KEY_TODO_PRIORITY = "todo_priority" | 49 | const val KEY_TODO_PRIORITY = "todo_priority" |
51 | 50 | ||
52 | const val KEY_TODO_ID = "todo_id" | 51 | const val KEY_TODO_ID = "todo_id" |
@@ -234,4 +234,13 @@ interface LessonApi : ApiService { | @@ -234,4 +234,13 @@ interface LessonApi : ApiService { | ||
234 | @FieldMap fieldMap: HashMap<String, String> | 234 | @FieldMap fieldMap: HashMap<String, String> |
235 | ): Observable<BaseResponse<Void>> | 235 | ): Observable<BaseResponse<Void>> |
236 | 236 | ||
237 | + @FormUrlEncoded | ||
238 | + @POST("/api/lesson/user_class_log") | ||
239 | + fun recordTrainLesson( | ||
240 | + @Field("type") type: Int, | ||
241 | + @Field("lesson_id") lesson_id: String, | ||
242 | + @Field("train_class_id") train_class_id: String, | ||
243 | + @Field("view_len") view_len: String?, | ||
244 | + @Field("class_id") class_id: String? | ||
245 | + ): Observable<BaseResponse<Void>> | ||
237 | } | 246 | } |
@@ -172,6 +172,20 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo | @@ -172,6 +172,20 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo | ||
172 | ) | 172 | ) |
173 | } | 173 | } |
174 | 174 | ||
175 | + fun recordTrainLesson( | ||
176 | + type: Int, | ||
177 | + lesson_id: String, | ||
178 | + train_class_id: String, | ||
179 | + view_len: String?, | ||
180 | + class_id: String?, | ||
181 | + liveData: MutableLiveData<BaseResponse<Void>> | ||
182 | + ) { | ||
183 | + addRequest( | ||
184 | + lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len, class_id), | ||
185 | + liveData | ||
186 | + ) | ||
187 | + } | ||
188 | + | ||
175 | fun recordNormalLesson( | 189 | fun recordNormalLesson( |
176 | type: Int, | 190 | type: Int, |
177 | lesson_id: String, | 191 | lesson_id: String, |
@@ -64,7 +64,7 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | @@ -64,7 +64,7 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | ||
64 | var data = "" | 64 | var data = "" |
65 | val decemal = BigDecimal(str) | 65 | val decemal = BigDecimal(str) |
66 | val ddd = BigDecimal("1000") | 66 | val ddd = BigDecimal("1000") |
67 | - data = decemal.divide(ddd).toString() | 67 | + data = decemal.divide(ddd).toInt().toString() |
68 | return data | 68 | return data |
69 | } | 69 | } |
70 | 70 |
@@ -25,13 +25,12 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() { | @@ -25,13 +25,12 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() { | ||
25 | ) { | 25 | ) { |
26 | courseParam.value?.let { | 26 | courseParam.value?.let { |
27 | if (it.isTrainClass) { | 27 | if (it.isTrainClass) { |
28 | - val map = hashMapOf("class_id" to it.mClassId) | ||
29 | mRepository.recordTrainLesson( | 28 | mRepository.recordTrainLesson( |
30 | 1, | 29 | 1, |
31 | it.mLessonId, | 30 | it.mLessonId, |
32 | it.mTrainClassId, | 31 | it.mTrainClassId, |
33 | view_len, | 32 | view_len, |
34 | - map, | 33 | + it.mClassId, |
35 | record | 34 | record |
36 | ) | 35 | ) |
37 | } else { | 36 | } else { |
-
请 注册 或 登录 后发表评论