作者 zhangji

修改线下培训不能签到问题

修改班级任务-课程-课程列表 课节名称英文问题
... ... @@ -231,7 +231,7 @@ interface LessonApi : ApiService {
@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("view_len") view_len: String?,
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<Void>>
... ...
... ... @@ -155,7 +155,7 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
type: Int,
lesson_id: String,
train_class_id: String,
view_len: String,
view_len: String?,
map: HashMap<String, String>,
liveData: MutableLiveData<BaseResponse<Void>>
) {
... ...
... ... @@ -52,7 +52,7 @@ class CourseDetailActivity
),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply {
this.lessonBean = it.data
})
},"${courseBean?.mTrainClassId}")
)
val titles = listOf("课程详情", "课程列表")
searchResultAdapter?.addData(list.toMutableList())
... ... @@ -74,7 +74,7 @@ class CourseDetailActivity
OnlineDetailFragment(TrainClassDes(it.data.detail.name, "", "")),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
this.lessonBeanNormal = it.data.detail
})
},"${courseBean?.mTrainClassId}")
)
val titles = listOf("课程详情", "课程列表")
searchResultAdapter?.addData(list.toMutableList())
... ... @@ -96,7 +96,7 @@ class CourseDetailActivity
OnlineDetailFragment(TrainClassDes(it.data.detail.name, "", "")),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_LIVE).apply {
this.lessonLive = it.data.detail
})
},"${courseBean?.mTrainClassId}")
)
val titles = listOf("课程详情", "课程列表")
searchResultAdapter?.addData(list.toMutableList())
... ... @@ -125,7 +125,7 @@ class CourseDetailActivity
),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_OFF).apply {
this.lessonOff = it.data.detail
})
},"${courseBean?.mTrainClassId}")
)
val titles = listOf("课程详情", "课程列表")
searchResultAdapter?.addData(list.toMutableList())
... ...
... ... @@ -3,7 +3,10 @@ package com.br_technology.securitytrain_master.ui.view.home.activity.course
import android.Manifest
import android.location.LocationManager
import android.util.Log
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.CLASS_ID
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.LESSON_ID
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.TRAIN_CLASS_ID
import com.br_technology.securitytrain_master.base.view.BaseApplication
import com.br_technology.securitytrain_master.databinding.ActivityLocationSignBinding
import com.br_technology.securitytrain_master.ext.initPermissions
... ... @@ -29,6 +32,8 @@ class LocationSignActivity :
), TencentLocationListener {
var mClassId: String? = null
var mLessonId: String? = null
var mTrainClassId: String? = null
private var mLocation: TencentLocation? = null
override fun initView() {
... ... @@ -39,8 +44,18 @@ class LocationSignActivity :
BaseApplication.instance.mLocationManager.coordinateType =
TencentLocationManager.COORDINATE_TYPE_GCJ02;
rvSign.setOnClickListener {
if (mLocation != null && mClassId != null) {
mViewModel.sign(mClassId?:"", "${mLocation?.latitude}", "${mLocation?.longitude}")
if (mLocation != null && mLessonId != null&&mTrainClassId!=null&&mClassId!=null) {
// mViewModel.sign(
// mClassId ?: "",
// "${mLocation?.latitude}",
// "${mLocation?.longitude}"
// )
val map = hashMapOf<String,String>()
map.put("class_id",mClassId?:"")
map.put("lat","${mLocation?.latitude}")
map.put("lng","${mLocation?.longitude}")
mViewModel.recordTrainLesson("$mLessonId","$mTrainClassId",null, map)
}
}
}
... ... @@ -49,6 +64,8 @@ class LocationSignActivity :
override fun initData() {
super.initData()
mClassId = intent.getStringExtra(CLASS_ID)
mLessonId = intent.getStringExtra(LESSON_ID)
mTrainClassId = intent.getStringExtra(TRAIN_CLASS_ID)
}
override fun onStart() {
... ...
... ... @@ -42,7 +42,7 @@ class CourseDetailListAdapter :
isNestedScrollingEnabled = false
}
holder.getView<TextView>(R.id.tv_title).apply {
text = getTitle(item).toString()
text = getTitle(item)
setOnClickListener {
if (it.isPressed) {
index = pos
... ... @@ -57,33 +57,35 @@ class CourseDetailListAdapter :
}
}
fun getTitle(data: TrainCourseDetailItem) {
fun getTitle(data: TrainCourseDetailItem): String {
var title = ""
when (data.itemType) {
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
val res = data.lessonVideo
res?.apply {
res.name
title = res.name
}
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
val res = data.lessonVideoNormal
res?.apply {
res.name
title = res.name
}
}
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
val res = data.lessonLive
res?.apply {
res.name
title = res.name
}
}
TYPE_COURSE_DETAIL_ITEM_OFF -> {
val res = data.lessonOff
res?.apply {
res.name
title = res.name
}
}
}
return title
}
fun transData(data: TrainCourseDetailItem, pos: Int): List<TrainCourseDetailItemChild> {
... ...
... ... @@ -25,7 +25,7 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
* Author: Captain
* Description: 初见时你很迷人
*/
class CourseListFragment(var data: TrainCourseData) :
class CourseListFragment(var courseData: TrainCourseData,var tranClassId:String) :
BaseLifeCycleFragment<CourseListViewModel, FragmentCourseListBinding>(FragmentCourseListBinding::inflate) {
override fun initDataObserver() {
}
... ... @@ -37,9 +37,9 @@ class CourseListFragment(var data: TrainCourseData) :
private fun transData() {
val dataList = mutableListOf<TrainCourseDetailItem>()
when (data.getTypeData()) {
when (courseData.getTypeData()) {
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
data.lessonBean?.apply {
courseData.lessonBean?.apply {
for (p in class_list) {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply {
lessonVideo = p
... ... @@ -49,16 +49,16 @@ class CourseListFragment(var data: TrainCourseData) :
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
lessonVideoNormal = data.lessonBeanNormal
lessonVideoNormal = courseData.lessonBeanNormal
})
}
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_LIVE).apply {
lessonLive = data.lessonLive
lessonLive = courseData.lessonLive
})
}
TYPE_COURSE_DETAIL_ITEM_OFF -> {
data.lessonOff?.apply {
courseData.lessonOff?.apply {
for (p in lessonofflineclass) {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_OFF).apply {
lessonOff = p
... ... @@ -107,6 +107,8 @@ class CourseListFragment(var data: TrainCourseData) :
startActivity(
Intent(activity, LocationSignActivity::class.java)
.putExtra(ConstantParamKey.CLASS_ID, item.lessonOffChild?.id.toString())
.putExtra(ConstantParamKey.LESSON_ID, item.lessonOffChild?.lesson_id.toString())
.putExtra(ConstantParamKey.TRAIN_CLASS_ID,tranClassId )
)
}
}
... ...
... ... @@ -17,4 +17,11 @@ class LocationSignViewModel : BaseViewModel<LessonRepository>() {
fun sign(lessonId: String, lat: String, lng: String) {
mRepository.lessonOffSignup(lessonId, lat, lng, liveData)
}
fun recordTrainLesson(lesson_id: String,
train_class_id: String,
view_len: String?,
map: HashMap<String, String>,) {
mRepository.recordTrainLesson(3, lesson_id, train_class_id, view_len,map,liveData)
}
}
\ No newline at end of file
... ...