作者 杨谦

...班级视频课程进度

正在显示 20 个修改的文件 包含 76 行增加151 行删除
... ... @@ -70,7 +70,18 @@ interface LessonApi : ApiService {
@POST("/api/lesson/lesson_detail")
fun lessonVideoDetail(
@Field("id") id: Int
// , @Field("train_class_id") train_class_id: Int
, @Field("train_class_id") train_class_id: Int
): Observable<BaseResponse<LessonTrainVideoDetail>>
/**
* 视频课程详情
* @param id 课程id
*/
@FormUrlEncoded
@POST("/api/lesson/lesson_detail")
fun lessonVideoDetail(
@Field("id") id: Int
): Observable<BaseResponse<LessonTrainVideoDetail>>
/**
... ... @@ -230,8 +241,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?,
@FieldMap fieldMap: HashMap<String, String>
@Field("view_len") view_len: String?
): Observable<BaseResponse<Void>>
@FormUrlEncoded
... ...
... ... @@ -68,6 +68,14 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
fun lessonVideoDetail(
id: Int,
trainClassId: Int,
liveData: MutableLiveData<BaseResponse<LessonTrainVideoDetail>>
) {
addRequest(lessonService.lessonVideoDetail(id,trainClassId), liveData)
}
fun lessonVideoDetail(
id: Int,
liveData: MutableLiveData<BaseResponse<LessonTrainVideoDetail>>
) {
addRequest(lessonService.lessonVideoDetail(id), liveData)
... ... @@ -163,11 +171,10 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
lesson_id: String,
train_class_id: String,
view_len: String?,
map: HashMap<String, String>,
liveData: MutableLiveData<BaseResponse<Void>>
) {
addRequest(
lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len, map),
lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len),
liveData
)
}
... ... @@ -177,11 +184,11 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
lesson_id: String,
train_class_id: String,
view_len: String?,
class_id: String?,
mClassId: String?,
liveData: MutableLiveData<BaseResponse<Void>>
) {
addRequest(
lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len, class_id),
lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len, mClassId),
liveData
)
}
... ...
... ... @@ -37,7 +37,7 @@ open class LessonVideo(
var des: String, // 描述
var image: String, // 图片
var class_hours: Int, // 总课时
var pos_name: Int, // 工种
var pos_name: Int, // 岗位
var teacher: Teacher
)
... ...
... ... @@ -75,7 +75,7 @@ open class ExamBean(
var score: Int,
var pass: Int,
var name: String, // 考试名称
var pos_name: String, // 工种
var pos_name: String, // 岗位
var answer_count: Int, // 做过的人数
var is_complete: Int, // 答题状态0=未完成1=已完成
var count: Int, // 题目数量
... ...
... ... @@ -40,8 +40,11 @@ open class CourseParam() : Parcelable {
// 观看进度
var mViewLen: Int = 0
var isFinished: Boolean = false
constructor(parcel: Parcel) : this() {
isTrainClass = parcel.readByte() != 0.toByte()
title = parcel.readString().toString()
type = parcel.readInt()
mLessonId = parcel.readString().toString()
mClassId = parcel.readString().toString()
... ... @@ -49,11 +52,12 @@ open class CourseParam() : Parcelable {
lat = parcel.readString().toString()
lng = parcel.readString().toString()
mViewLen = parcel.readInt()
title = parcel.readString().toString()
isFinished = parcel.readByte() != 0.toByte()
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeByte(if (isTrainClass) 1 else 0)
parcel.writeString(title)
parcel.writeInt(type)
parcel.writeString(mLessonId)
parcel.writeString(mClassId)
... ... @@ -61,7 +65,7 @@ open class CourseParam() : Parcelable {
parcel.writeString(lat)
parcel.writeString(lng)
parcel.writeInt(mViewLen)
parcel.writeString(title)
parcel.writeByte(if (isFinished) 1 else 0)
}
override fun describeContents(): Int {
... ... @@ -77,6 +81,7 @@ open class CourseParam() : Parcelable {
return arrayOfNulls(size)
}
}
}
// 课程详情描述
... ...
... ... @@ -23,7 +23,7 @@ class MockExamActivity :
override fun initData() {
super.initData()
binding.apply {
// 工种
// 岗位
toolBar.setRightText("$sp_job_name")
binding.apply {
// 自动刷新
... ...
... ... @@ -22,7 +22,7 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr
override fun initData() {
super.initData()
binding.apply {
// 工种
// 岗位
// toolBar.setRightText(sp_job_name)
binding.apply {
// 自动刷新
... ...
... ... @@ -140,7 +140,7 @@ class BankFragment :
}
override fun initDataObserver() {
//工种
//岗位
mViewModel.mWorkTypeBean.observe(this, {
classifyPop.setList(it.data.list)
if (!classifyPop.isShowing) {
... ...
... ... @@ -50,7 +50,7 @@ class LiveCourseActivity
}
override fun initDataObserver() {
//工种
//岗位
mViewModel.mWorkTypeBean.observe(this, {
classifyPop.setList(it.data.list)
if (!classifyPop.isShowing) {
... ...
... ... @@ -94,7 +94,7 @@ class WebViewActivity :
ws.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
}
}
// WebView.setWebContentsDebuggingEnabled(true)
WebView.setWebContentsDebuggingEnabled(true)
webView?.webViewClient =
object : WebViewClient() {
override fun onReceivedSslError(
... ...
package com.br_technology.securitytrain_master.ui.view.home.activity.course
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.text.TextUtils
import androidx.fragment.app.FragmentPagerAdapter
... ... @@ -85,9 +86,16 @@ class CourseDetailActivity
dialogLoading!!.show()
}
private fun dismissLoading() {
if (dialogLoading != null && dialogLoading!!.isShowing) {
dialogLoading!!.dismiss()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == FaceUtil.FRONT_CAPTURE_CODE) {
if (resultCode == Activity.RESULT_OK) {
permissionCount = 0
fileUploadTemp?.let {
faceUtil.compressFile(this, fileUploadTemp!!, object : FaceUtil.ICompress {
... ... @@ -97,6 +105,9 @@ class CourseDetailActivity
}
})
}
} else {
dismissLoading()
}
}
}
... ... @@ -262,7 +273,7 @@ class CourseDetailActivity
Glide.with(this@CourseDetailActivity).load(it.image).into(binding.ivTop)
}
mViewModel.workType()
mViewModel.mWorkBean.observe(this, {
mViewModel.mWorkBean.observe(this, { it ->
mWorkBean = it.data
for (data in it.data.list) {
mapWork.put(data.id, data)
... ... @@ -271,11 +282,17 @@ class CourseDetailActivity
courseBean?.let {
when (it.type) {
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
mViewModel.videoLessonsDetail(it.mLessonId.toInt())
mViewModel.videoLessonsDetail(
it.mLessonId.toInt(),
it.mTrainClassId.toInt()
)
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
if (courseBean?.isTrainClass == true) {
mViewModel.videoLessonsDetail(it.mLessonId.toInt())
mViewModel.videoLessonsDetail(
it.mLessonId.toInt(),
it.mTrainClassId.toInt()
)
} else {
mViewModel.videoLessonNormal(it.mLessonId.toInt())
}
... ... @@ -287,7 +304,7 @@ class CourseDetailActivity
mViewModel.offLessonDetail(it.mLessonId.toInt())
}
}
if (it.type != TYPE_COURSE_DETAIL_ITEM_OFF) {
if (it.type != TYPE_COURSE_DETAIL_ITEM_OFF && !it.isFinished) {
showDialogId()
}
}
... ...
... ... @@ -54,7 +54,7 @@ class LocationSignActivity :
map.put("lat", "${mLocation?.latitude}")
map.put("lng", "${mLocation?.longitude}")
mViewModel.recordTrainLesson("$mLessonId", "$mTrainClassId", null, map)
mViewModel.recordTrainLesson("$mLessonId", "$mTrainClassId", null)
}
}
}
... ...
... ... @@ -77,7 +77,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin
val param = (activity as CourseDetailActivity).getCourseBean()
when (item.type) {
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
// param?.mClassId = item.lessonVideoChild?.id.toString()
param?.mClassId = item.lessonVideoChild?.id.toString()
startActivity(
Intent(activity, VideoDetailActivity::class.java)
.putExtra(COMMON_URL, item.lessonVideoChild?.video_url)
... ...
... ... @@ -164,7 +164,6 @@ class HomeFragment :
startActivity(
Intent(requireContext(), WebViewActivity::class.java)
.putExtra(COMMON_URL, res.href)
// .putExtra(COMMON_URL, url)
)
}
}
... ... @@ -240,122 +239,4 @@ class HomeFragment :
override fun immersionBarEnabled(): Boolean {
return true
}
}
\ No newline at end of file
//class HomeFragment : Fragment() {
// override fun onCreateView(
// inflater: LayoutInflater,
// container: ViewGroup?,
// savedInstanceState: Bundle?
// ): View? {
// return inflater.inflate(R.layout.fragment_home, container, false)
// }
//
// override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// super.onViewCreated(view, savedInstanceState)
//
//
// val banner: Banner<Int, BannerImageAdapter<Int>> = view.findViewById(R.id.banner)
// banner.setAdapter(object : BannerImageAdapter<Int>(
// mutableListOf(
// R.mipmap.banner,
// R.mipmap.banner,
// R.mipmap.banner
// )
// ) {
// override fun onBindView(
// holder: BannerImageHolder,
// data: Int,
// position: Int,
// size: Int
// ) {
// Glide.with(requireActivity())
// .load(data)
// .apply(RequestOptions.bitmapTransform(RoundedCorners(8)))
// .into(holder.imageView)
//
// }
// }).addBannerLifecycleObserver(this)
// .indicator = CircleIndicator(requireContext())
//
// // 共享资料库
// view.findViewById<TextView>(R.id.database).setOnClickListener {
// startActivity(DatabaseActivity::class.java)
// }
//
// // 共享资料库
// view.findViewById<TextView>(R.id.txt_course).setOnClickListener {
// startActivity(TextCourseActivity::class.java)
// }
// // 在线课程
// view.findViewById<TextView>(R.id.online_course).setOnClickListener {
//// startActivity()
// }
//
// // 视频课程
// val videoCourse: RecyclerView = view.findViewById(R.id.video_course)
// videoCourse.addItemDecoration(object : RecyclerView.ItemDecoration() {
// override fun getItemOffsets(
// outRect: Rect,
// view: View,
// parent: RecyclerView,
// state: RecyclerView.State
// ) {
// super.getItemOffsets(outRect, view, parent, state)
// if (parent.getChildAdapterPosition(view) % 2 == 0) {
// outRect.top = 24
// outRect.right = 15
// } else {
// outRect.top = 24
// outRect.left = 15
// }
// }
// })
// val videoCourseAdapter = VideoCourseAdapter()
// val list = mutableListOf(
// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
// )
// videoCourse.adapter = videoCourseAdapter
// videoCourseAdapter.addList(list)
//
// val recommendData: RecyclerView = view.findViewById(R.id.recommended_data)
// val recommendDataAdapter = RecommendDataAdapter()
// val recommendList = mutableListOf(
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
// )
// recommendData.adapter = recommendDataAdapter
// recommendDataAdapter.addList(recommendList)
//
//
// view.findViewById<View>(R.id.search).setOnClickListener {
// val intent = Intent(requireActivity(), SearchActivity::class.java)
// startActivity(intent)
// }
// }
//
//
// private fun startActivity(cls: Class<out Activity>) {
// startActivity(cls, null)
// }
//
// private fun startActivity(cls: Class<out Activity>, bundle: Bundle?) {
// val intent = Intent(requireActivity(), cls)
// if (bundle != null) {
// intent.putExtras(bundle)
// }
// startActivity(intent)
// }
//}
\ No newline at end of file
... ...
... ... @@ -24,9 +24,10 @@ class CourseDetailViewModel : BaseViewModel<LessonRepository>() {
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
fun videoLessonsDetail(
id: Int
id: Int,
trainClassId: Int
) {
mRepository.lessonVideoDetail(id, mVideoLesson)
mRepository.lessonVideoDetail(id,trainClassId, mVideoLesson)
}
fun videoLessonNormal(id: Int) {
... ...
... ... @@ -19,10 +19,11 @@ class LocationSignViewModel : BaseViewModel<LessonRepository>() {
mRepository.lessonOffSignup(lessonId, lat, lng, signData)
}
fun recordTrainLesson(lesson_id: String,
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)
view_len: String?
) {
mRepository.recordTrainLesson(3, lesson_id, train_class_id, view_len, liveData)
}
}
\ No newline at end of file
... ...
... ... @@ -55,7 +55,6 @@ class TextDetailViewModel : BaseViewModel<LessonRepository>() {
lesson_id,
train_class_id,
view_len,
HashMap(),
recordCalss
)
}
... ...
... ... @@ -145,7 +145,9 @@ class ClassDutyCourseFragment(val type: Int) :
val course = CourseParam()
course.mLessonId = "${data.id}"
course.isTrainClass = true
course.mClassId = "${data.class_id}"
course.isFinished = data.status == "1"
// course.mClassId = "${data.class_id}"
course.mClassId = "${data.train_id}"
course.mTrainClassId = "${data.train_class_id}"
course.type = data.itemType
return course
... ... @@ -157,8 +159,10 @@ class ClassDutyCourseFragment(val type: Int) :
course.mTrainClassId = "${
if (data.isTest) {
data.practice?.id
course.isFinished = data.practice?.is_complete == 1
} else {
data.exam?.id
course.isFinished = data.exam?.is_complete == 1
}
}"
course.type = data.itemType
... ...
... ... @@ -27,7 +27,7 @@ var is_login by SpUtil(IS_LOGIN, false)
var sp_job_id by SpUtil(POI_ID, 0)
var sp_job_id_select by SpUtil(POI_ID_, 0)
var sp_job_name by SpUtil(POI_NAME_, "")
var sp_job_name_select by SpUtil(POI_NAME_, "工种")
var sp_job_name_select by SpUtil(POI_NAME_, "岗位")
const val TYPE_LIVE = 0
const val TYPE_HOME = 1
... ...
... ... @@ -261,7 +261,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:text="部门:"
android:text="车间:"
android:textColor="@color/color_32"
android:textSize="14sp" />
... ...