正在显示
7 个修改的文件
包含
48 行增加
和
20 行删除
@@ -231,7 +231,7 @@ interface LessonApi : ApiService { | @@ -231,7 +231,7 @@ interface LessonApi : ApiService { | ||
231 | @Field("type") type: Int, | 231 | @Field("type") type: Int, |
232 | @Field("lesson_id") lesson_id: String, | 232 | @Field("lesson_id") lesson_id: String, |
233 | @Field("train_class_id") train_class_id: String, | 233 | @Field("train_class_id") train_class_id: String, |
234 | - @Field("view_len") view_len: String, | 234 | + @Field("view_len") view_len: String?, |
235 | @FieldMap fieldMap: HashMap<String, String> | 235 | @FieldMap fieldMap: HashMap<String, String> |
236 | ): Observable<BaseResponse<Void>> | 236 | ): Observable<BaseResponse<Void>> |
237 | 237 |
@@ -155,7 +155,7 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt | @@ -155,7 +155,7 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt | ||
155 | type: Int, | 155 | type: Int, |
156 | lesson_id: String, | 156 | lesson_id: String, |
157 | train_class_id: String, | 157 | train_class_id: String, |
158 | - view_len: String, | 158 | + view_len: String?, |
159 | map: HashMap<String, String>, | 159 | map: HashMap<String, String>, |
160 | liveData: MutableLiveData<BaseResponse<Void>> | 160 | liveData: MutableLiveData<BaseResponse<Void>> |
161 | ) { | 161 | ) { |
@@ -52,7 +52,7 @@ class CourseDetailActivity | @@ -52,7 +52,7 @@ class CourseDetailActivity | ||
52 | ), | 52 | ), |
53 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply { | 53 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply { |
54 | this.lessonBean = it.data | 54 | this.lessonBean = it.data |
55 | - }) | 55 | + },"${courseBean?.mTrainClassId}") |
56 | ) | 56 | ) |
57 | val titles = listOf("课程详情", "课程列表") | 57 | val titles = listOf("课程详情", "课程列表") |
58 | searchResultAdapter?.addData(list.toMutableList()) | 58 | searchResultAdapter?.addData(list.toMutableList()) |
@@ -74,7 +74,7 @@ class CourseDetailActivity | @@ -74,7 +74,7 @@ class CourseDetailActivity | ||
74 | OnlineDetailFragment(TrainClassDes(it.data.detail.name, "", "")), | 74 | OnlineDetailFragment(TrainClassDes(it.data.detail.name, "", "")), |
75 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply { | 75 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply { |
76 | this.lessonBeanNormal = it.data.detail | 76 | this.lessonBeanNormal = it.data.detail |
77 | - }) | 77 | + },"${courseBean?.mTrainClassId}") |
78 | ) | 78 | ) |
79 | val titles = listOf("课程详情", "课程列表") | 79 | val titles = listOf("课程详情", "课程列表") |
80 | searchResultAdapter?.addData(list.toMutableList()) | 80 | searchResultAdapter?.addData(list.toMutableList()) |
@@ -96,7 +96,7 @@ class CourseDetailActivity | @@ -96,7 +96,7 @@ class CourseDetailActivity | ||
96 | OnlineDetailFragment(TrainClassDes(it.data.detail.name, "", "")), | 96 | OnlineDetailFragment(TrainClassDes(it.data.detail.name, "", "")), |
97 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_LIVE).apply { | 97 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_LIVE).apply { |
98 | this.lessonLive = it.data.detail | 98 | this.lessonLive = it.data.detail |
99 | - }) | 99 | + },"${courseBean?.mTrainClassId}") |
100 | ) | 100 | ) |
101 | val titles = listOf("课程详情", "课程列表") | 101 | val titles = listOf("课程详情", "课程列表") |
102 | searchResultAdapter?.addData(list.toMutableList()) | 102 | searchResultAdapter?.addData(list.toMutableList()) |
@@ -125,7 +125,7 @@ class CourseDetailActivity | @@ -125,7 +125,7 @@ class CourseDetailActivity | ||
125 | ), | 125 | ), |
126 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_OFF).apply { | 126 | CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_OFF).apply { |
127 | this.lessonOff = it.data.detail | 127 | this.lessonOff = it.data.detail |
128 | - }) | 128 | + },"${courseBean?.mTrainClassId}") |
129 | ) | 129 | ) |
130 | val titles = listOf("课程详情", "课程列表") | 130 | val titles = listOf("课程详情", "课程列表") |
131 | searchResultAdapter?.addData(list.toMutableList()) | 131 | searchResultAdapter?.addData(list.toMutableList()) |
@@ -3,7 +3,10 @@ package com.br_technology.securitytrain_master.ui.view.home.activity.course | @@ -3,7 +3,10 @@ package com.br_technology.securitytrain_master.ui.view.home.activity.course | ||
3 | import android.Manifest | 3 | import android.Manifest |
4 | import android.location.LocationManager | 4 | import android.location.LocationManager |
5 | import android.util.Log | 5 | import android.util.Log |
6 | +import com.br_technology.securitytrain_master.base.common.ConstantParamKey | ||
6 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey.CLASS_ID | 7 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey.CLASS_ID |
8 | +import com.br_technology.securitytrain_master.base.common.ConstantParamKey.LESSON_ID | ||
9 | +import com.br_technology.securitytrain_master.base.common.ConstantParamKey.TRAIN_CLASS_ID | ||
7 | import com.br_technology.securitytrain_master.base.view.BaseApplication | 10 | import com.br_technology.securitytrain_master.base.view.BaseApplication |
8 | import com.br_technology.securitytrain_master.databinding.ActivityLocationSignBinding | 11 | import com.br_technology.securitytrain_master.databinding.ActivityLocationSignBinding |
9 | import com.br_technology.securitytrain_master.ext.initPermissions | 12 | import com.br_technology.securitytrain_master.ext.initPermissions |
@@ -29,6 +32,8 @@ class LocationSignActivity : | @@ -29,6 +32,8 @@ class LocationSignActivity : | ||
29 | ), TencentLocationListener { | 32 | ), TencentLocationListener { |
30 | 33 | ||
31 | var mClassId: String? = null | 34 | var mClassId: String? = null |
35 | + var mLessonId: String? = null | ||
36 | + var mTrainClassId: String? = null | ||
32 | private var mLocation: TencentLocation? = null | 37 | private var mLocation: TencentLocation? = null |
33 | 38 | ||
34 | override fun initView() { | 39 | override fun initView() { |
@@ -39,8 +44,18 @@ class LocationSignActivity : | @@ -39,8 +44,18 @@ class LocationSignActivity : | ||
39 | BaseApplication.instance.mLocationManager.coordinateType = | 44 | BaseApplication.instance.mLocationManager.coordinateType = |
40 | TencentLocationManager.COORDINATE_TYPE_GCJ02; | 45 | TencentLocationManager.COORDINATE_TYPE_GCJ02; |
41 | rvSign.setOnClickListener { | 46 | rvSign.setOnClickListener { |
42 | - if (mLocation != null && mClassId != null) { | ||
43 | - mViewModel.sign(mClassId?:"", "${mLocation?.latitude}", "${mLocation?.longitude}") | 47 | + if (mLocation != null && mLessonId != null&&mTrainClassId!=null&&mClassId!=null) { |
48 | +// mViewModel.sign( | ||
49 | +// mClassId ?: "", | ||
50 | +// "${mLocation?.latitude}", | ||
51 | +// "${mLocation?.longitude}" | ||
52 | +// ) | ||
53 | + val map = hashMapOf<String,String>() | ||
54 | + map.put("class_id",mClassId?:"") | ||
55 | + map.put("lat","${mLocation?.latitude}") | ||
56 | + map.put("lng","${mLocation?.longitude}") | ||
57 | + | ||
58 | + mViewModel.recordTrainLesson("$mLessonId","$mTrainClassId",null, map) | ||
44 | } | 59 | } |
45 | } | 60 | } |
46 | } | 61 | } |
@@ -49,6 +64,8 @@ class LocationSignActivity : | @@ -49,6 +64,8 @@ class LocationSignActivity : | ||
49 | override fun initData() { | 64 | override fun initData() { |
50 | super.initData() | 65 | super.initData() |
51 | mClassId = intent.getStringExtra(CLASS_ID) | 66 | mClassId = intent.getStringExtra(CLASS_ID) |
67 | + mLessonId = intent.getStringExtra(LESSON_ID) | ||
68 | + mTrainClassId = intent.getStringExtra(TRAIN_CLASS_ID) | ||
52 | } | 69 | } |
53 | 70 | ||
54 | override fun onStart() { | 71 | override fun onStart() { |
@@ -42,7 +42,7 @@ class CourseDetailListAdapter : | @@ -42,7 +42,7 @@ class CourseDetailListAdapter : | ||
42 | isNestedScrollingEnabled = false | 42 | isNestedScrollingEnabled = false |
43 | } | 43 | } |
44 | holder.getView<TextView>(R.id.tv_title).apply { | 44 | holder.getView<TextView>(R.id.tv_title).apply { |
45 | - text = getTitle(item).toString() | 45 | + text = getTitle(item) |
46 | setOnClickListener { | 46 | setOnClickListener { |
47 | if (it.isPressed) { | 47 | if (it.isPressed) { |
48 | index = pos | 48 | index = pos |
@@ -57,33 +57,35 @@ class CourseDetailListAdapter : | @@ -57,33 +57,35 @@ class CourseDetailListAdapter : | ||
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | -fun getTitle(data: TrainCourseDetailItem) { | 60 | +fun getTitle(data: TrainCourseDetailItem): String { |
61 | + var title = "" | ||
61 | when (data.itemType) { | 62 | when (data.itemType) { |
62 | TYPE_COURSE_DETAIL_ITEM_VIDEO -> { | 63 | TYPE_COURSE_DETAIL_ITEM_VIDEO -> { |
63 | val res = data.lessonVideo | 64 | val res = data.lessonVideo |
64 | res?.apply { | 65 | res?.apply { |
65 | - res.name | 66 | + title = res.name |
66 | } | 67 | } |
67 | } | 68 | } |
68 | TYPE_COURSE_DETAIL_ITEM_NORMAL -> { | 69 | TYPE_COURSE_DETAIL_ITEM_NORMAL -> { |
69 | val res = data.lessonVideoNormal | 70 | val res = data.lessonVideoNormal |
70 | res?.apply { | 71 | res?.apply { |
71 | - res.name | 72 | + title = res.name |
72 | } | 73 | } |
73 | } | 74 | } |
74 | TYPE_COURSE_DETAIL_ITEM_LIVE -> { | 75 | TYPE_COURSE_DETAIL_ITEM_LIVE -> { |
75 | val res = data.lessonLive | 76 | val res = data.lessonLive |
76 | res?.apply { | 77 | res?.apply { |
77 | - res.name | 78 | + title = res.name |
78 | } | 79 | } |
79 | } | 80 | } |
80 | TYPE_COURSE_DETAIL_ITEM_OFF -> { | 81 | TYPE_COURSE_DETAIL_ITEM_OFF -> { |
81 | val res = data.lessonOff | 82 | val res = data.lessonOff |
82 | res?.apply { | 83 | res?.apply { |
83 | - res.name | 84 | + title = res.name |
84 | } | 85 | } |
85 | } | 86 | } |
86 | } | 87 | } |
88 | + return title | ||
87 | } | 89 | } |
88 | 90 | ||
89 | fun transData(data: TrainCourseDetailItem, pos: Int): List<TrainCourseDetailItemChild> { | 91 | fun transData(data: TrainCourseDetailItem, pos: Int): List<TrainCourseDetailItemChild> { |
app/src/main/java/com/br_technology/securitytrain_master/ui/view/home/fragment/CourseListFragment.kt
@@ -25,7 +25,7 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment | @@ -25,7 +25,7 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment | ||
25 | * Author: Captain | 25 | * Author: Captain |
26 | * Description: 初见时你很迷人 | 26 | * Description: 初见时你很迷人 |
27 | */ | 27 | */ |
28 | -class CourseListFragment(var data: TrainCourseData) : | 28 | +class CourseListFragment(var courseData: TrainCourseData,var tranClassId:String) : |
29 | BaseLifeCycleFragment<CourseListViewModel, FragmentCourseListBinding>(FragmentCourseListBinding::inflate) { | 29 | BaseLifeCycleFragment<CourseListViewModel, FragmentCourseListBinding>(FragmentCourseListBinding::inflate) { |
30 | override fun initDataObserver() { | 30 | override fun initDataObserver() { |
31 | } | 31 | } |
@@ -37,9 +37,9 @@ class CourseListFragment(var data: TrainCourseData) : | @@ -37,9 +37,9 @@ class CourseListFragment(var data: TrainCourseData) : | ||
37 | 37 | ||
38 | private fun transData() { | 38 | private fun transData() { |
39 | val dataList = mutableListOf<TrainCourseDetailItem>() | 39 | val dataList = mutableListOf<TrainCourseDetailItem>() |
40 | - when (data.getTypeData()) { | 40 | + when (courseData.getTypeData()) { |
41 | TYPE_COURSE_DETAIL_ITEM_VIDEO -> { | 41 | TYPE_COURSE_DETAIL_ITEM_VIDEO -> { |
42 | - data.lessonBean?.apply { | 42 | + courseData.lessonBean?.apply { |
43 | for (p in class_list) { | 43 | for (p in class_list) { |
44 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply { | 44 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply { |
45 | lessonVideo = p | 45 | lessonVideo = p |
@@ -49,16 +49,16 @@ class CourseListFragment(var data: TrainCourseData) : | @@ -49,16 +49,16 @@ class CourseListFragment(var data: TrainCourseData) : | ||
49 | } | 49 | } |
50 | TYPE_COURSE_DETAIL_ITEM_NORMAL -> { | 50 | TYPE_COURSE_DETAIL_ITEM_NORMAL -> { |
51 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply { | 51 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply { |
52 | - lessonVideoNormal = data.lessonBeanNormal | 52 | + lessonVideoNormal = courseData.lessonBeanNormal |
53 | }) | 53 | }) |
54 | } | 54 | } |
55 | TYPE_COURSE_DETAIL_ITEM_LIVE -> { | 55 | TYPE_COURSE_DETAIL_ITEM_LIVE -> { |
56 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_LIVE).apply { | 56 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_LIVE).apply { |
57 | - lessonLive = data.lessonLive | 57 | + lessonLive = courseData.lessonLive |
58 | }) | 58 | }) |
59 | } | 59 | } |
60 | TYPE_COURSE_DETAIL_ITEM_OFF -> { | 60 | TYPE_COURSE_DETAIL_ITEM_OFF -> { |
61 | - data.lessonOff?.apply { | 61 | + courseData.lessonOff?.apply { |
62 | for (p in lessonofflineclass) { | 62 | for (p in lessonofflineclass) { |
63 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_OFF).apply { | 63 | dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_OFF).apply { |
64 | lessonOff = p | 64 | lessonOff = p |
@@ -107,6 +107,8 @@ class CourseListFragment(var data: TrainCourseData) : | @@ -107,6 +107,8 @@ class CourseListFragment(var data: TrainCourseData) : | ||
107 | startActivity( | 107 | startActivity( |
108 | Intent(activity, LocationSignActivity::class.java) | 108 | Intent(activity, LocationSignActivity::class.java) |
109 | .putExtra(ConstantParamKey.CLASS_ID, item.lessonOffChild?.id.toString()) | 109 | .putExtra(ConstantParamKey.CLASS_ID, item.lessonOffChild?.id.toString()) |
110 | + .putExtra(ConstantParamKey.LESSON_ID, item.lessonOffChild?.lesson_id.toString()) | ||
111 | + .putExtra(ConstantParamKey.TRAIN_CLASS_ID,tranClassId ) | ||
110 | ) | 112 | ) |
111 | } | 113 | } |
112 | } | 114 | } |
@@ -17,4 +17,11 @@ class LocationSignViewModel : BaseViewModel<LessonRepository>() { | @@ -17,4 +17,11 @@ class LocationSignViewModel : BaseViewModel<LessonRepository>() { | ||
17 | fun sign(lessonId: String, lat: String, lng: String) { | 17 | fun sign(lessonId: String, lat: String, lng: String) { |
18 | mRepository.lessonOffSignup(lessonId, lat, lng, liveData) | 18 | mRepository.lessonOffSignup(lessonId, lat, lng, liveData) |
19 | } | 19 | } |
20 | + | ||
21 | + fun recordTrainLesson(lesson_id: String, | ||
22 | + train_class_id: String, | ||
23 | + view_len: String?, | ||
24 | + map: HashMap<String, String>,) { | ||
25 | + mRepository.recordTrainLesson(3, lesson_id, train_class_id, view_len,map,liveData) | ||
26 | + } | ||
20 | } | 27 | } |
-
请 注册 或 登录 后发表评论