作者 杨谦

1.测试文档确认修改

正在显示 19 个修改的文件 包含 194 行增加104 行删除
... ... @@ -10,8 +10,9 @@ import java.io.File
*/
object Constant {
// const val BASE_URL = "https://security.brofirst.cn/"
const val BASE_URL = "http://security.brofirst.cn/"
// const val BASE_URL = "https://test.mobile.anqixing.com/"
// const val BASE_URL = "http://security.brofirst.cn/"
// const val BASE_URL = "https://test.admin.anqixing.com"
const val BASE_URL = "https://test.admin.anqixing.com"
// const val BASE_URL = "http://admin.anqixing.com"
const val USERNAME_KEY = "username"
const val USERID_KEY = "userid"
... ...
... ... @@ -65,7 +65,6 @@ interface LessonApi : ApiService {
/**
* 视频课程详情
* @param id 课程id
* @param train_class_id 班级id
*/
@FormUrlEncoded
@POST("/api/lesson/lesson_detail")
... ...
... ... @@ -106,7 +106,7 @@ object TrainCourseDetailItemType {
open class TrainCourseData(var type: Int) {
var lessonBean: LessonTrainVideoDetail? = null
var lessonBeanNormal: LessonClassDetail? = null
var lessonBeanNormal: LessonTrainVideoDetail? = null
var lessonLive: LessonLive? = null
var lessonOff: LessonOfflineDetail? = null
... ... @@ -117,7 +117,7 @@ open class TrainCourseData(var type: Int) {
open class TrainCourseDetailItem(var type: Int) : MultiItemEntity {
var lessonVideo: LessonClazz? = null
var lessonVideoNormal: LessonClassDetail? = null
var lessonVideoNormal: LessonClazz? = null
var lessonLive: LessonLive? = null
var lessonOff: LessonOfflineDetail? = null
... ...
... ... @@ -102,6 +102,7 @@ class DatabaseActivity :
override fun initData() {
super.initData()
mViewModel.type.value = 1
mViewModel.geClassify()
}
... ... @@ -112,7 +113,7 @@ class DatabaseActivity :
mViewModel.getDataList(page)
}
fun loadMore() {
private fun loadMore() {
page++
binding.refresh.setEnableRefresh(false)
binding.refresh.setEnableLoadMore(false)
... ... @@ -128,9 +129,20 @@ class DatabaseActivity :
mClassifyAdapter?.addListener(object : OnItemClickListener<MaterialClassify> {
override fun onClick(position: Int, data: MaterialClassify) {
mViewModel.sortId.value = data.id
mClassifyAdapter?.let { classifyAdapter ->
val oldIndex = classifyAdapter.index;
if (oldIndex != position) {
classifyAdapter.index = position
if (oldIndex >= 0) {
classifyAdapter.notifyItemChanged(oldIndex)
}
classifyAdapter.notifyItemChanged(position)
}
}
}
})
if (data.list.isNotEmpty()) {
page = 1
mViewModel.sortId.value = data.list[0].id
}
})
... ... @@ -143,7 +155,18 @@ class DatabaseActivity :
binding.refresh.setEnableRefresh(true)
binding.refresh.finishRefresh()
binding.refresh.finishLoadMore()
val bool = data.list.data.isEmpty();
if (page == 1) {
binding.refresh.visibility = if (bool) {
View.GONE
} else {
View.VISIBLE
}
binding.none.visibility = if (bool) {
View.VISIBLE
} else {
View.GONE
}
mRecommendAdapter = RecommendDataAdapter()
mRecommendAdapter?.addList(data.list.data)
binding.databaseRecycler.adapter = mRecommendAdapter
... ...
... ... @@ -3,6 +3,7 @@ package com.br_technology.securitytrain_master.ui.view.home.activity
import android.content.Intent
import android.content.res.Configuration
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COMMON_URL
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.DOC_ID
... ... @@ -51,13 +52,17 @@ class DatabaseDetailActivity :
}
})
mViewModel.mDetailMaterialNormal.observe(this, {
binding.videoPlayer.initVideoBuilderMode(
it.data.detail.image,
it.data.detail.video,
this@DatabaseDetailActivity,
false,
lifecycle
)
if (!TextUtils.isEmpty(it.data.detail.video)) {
binding.videoPlayer.initVideoBuilderMode(
it.data.detail.image,
it.data.detail.video,
this@DatabaseDetailActivity,
false,
lifecycle
)
} else {
binding.videoPlayer.visibility = View.GONE
}
binding.start.isSelected = it.data.detail.is_favorite == 1
... ... @@ -85,7 +90,6 @@ class DatabaseDetailActivity :
mViewModel.materialDetail(intent.getIntExtra(DOC_ID, 0))
}
override fun onBackPressed() {
binding.videoPlayer.onBackPressed()
if (GSYVideoManager.backFromWindowFull(this)) {
... ... @@ -99,5 +103,4 @@ class DatabaseDetailActivity :
//如果旋转了就全屏
binding.videoPlayer.onConfigurationChanged(newConfig, this)
}
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.databinding.ActivityOnlineBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
import com.br_technology.securitytrain_master.ui.bean.CourseParam
import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItemType
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseAdapter
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
... ... @@ -40,7 +41,7 @@ class OnlineActivity :
val data = videoLessonList!![position]
course.mLessonId = "${data.id}"
course.isTrainClass = false
course.type = 1
course.type = TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO
startActivity(
Intent(
this@OnlineActivity,
... ...
... ... @@ -34,6 +34,7 @@ class CourseDetailActivity
private var mapWork = mutableMapOf<Int, WorkTypeBean.ListBean>()
override fun initDataObserver() {
// 培训视频课程
mViewModel.mVideoLesson.observe(this, {
binding.apply {
val posIds = it.data.detail.pos_ids
... ... @@ -43,53 +44,79 @@ class CourseDetailActivity
supportFragmentManager,
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
)
val list =
mutableListOf(
OnlineDetailFragment(
TrainClassDes(
it.data.detail.name,
setPosName(posIds),
it.data.detail.content
), TYPE_COURSE_DETAIL_ITEM_VIDEO
),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply {
this.lessonBean = it.data
}, "${courseBean?.mTrainClassId}")
)
courseBean?.type?.let { type ->
when (type) {
0 -> {
val list = mutableListOf(
OnlineDetailFragment(
TrainClassDes(
courseLesson?.name ?: "",
courseLesson?.pos_ids ?: "",
courseLesson?.content ?: ""
), TYPE_COURSE_DETAIL_ITEM_NORMAL
),
CourseListFragment(
TrainCourseData(
TYPE_COURSE_DETAIL_ITEM_NORMAL
).apply {
this.lessonBeanNormal = it.data
}, "${courseBean?.mTrainClassId}"
)
)
searchResultAdapter?.addData(list.toMutableList())
}
1 -> {
val list = mutableListOf(
OnlineDetailFragment(
TrainClassDes(
it.data.detail.name,
setPosName(posIds),
it.data.detail.content
), TYPE_COURSE_DETAIL_ITEM_VIDEO
),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_VIDEO).apply {
this.lessonBean = it.data
}, "${courseBean?.mTrainClassId}")
)
searchResultAdapter?.addData(list.toMutableList())
}
else -> {}
}
}
val titles = listOf("课程详情", "课程列表")
searchResultAdapter?.addData(list.toMutableList())
searchResultAdapter?.addTitle(titles)
viewPager.adapter = searchResultAdapter
tabLayout.setupWithViewPager(viewPager)
}
})
mViewModel.mVideoLessonNormal.observe(this, {
binding.apply {
searchResultAdapter = BasePagerAdapter(
supportFragmentManager,
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
)
val list =
mutableListOf(
OnlineDetailFragment(
TrainClassDes(
courseLesson?.name ?: "",
courseLesson?.pos_ids ?: "",
courseLesson?.content ?: ""
), TYPE_COURSE_DETAIL_ITEM_NORMAL
),
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
this.lessonBeanNormal = it.data.detail
}, "${courseBean?.mTrainClassId}")
)
val titles = listOf("课程详情", "课程列表")
searchResultAdapter?.addData(list.toMutableList())
searchResultAdapter?.addTitle(titles)
viewPager.adapter = searchResultAdapter
tabLayout.setupWithViewPager(viewPager)
}
})
// // 视频数据
// mViewModel.mVideoLessonNormal.observe(this, {
// binding.apply {
// searchResultAdapter = BasePagerAdapter(
// supportFragmentManager,
// FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
// )
// val list =
// mutableListOf(
// OnlineDetailFragment(
// TrainClassDes(
// courseLesson?.name ?: "",
// courseLesson?.pos_ids ?: "",
// courseLesson?.content ?: ""
// ), TYPE_COURSE_DETAIL_ITEM_NORMAL
// ),
// CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
// this.lessonBeanNormal = it.data.detail
// }, "${courseBean?.mTrainClassId}")
// )
// val titles = listOf("课程详情", "课程列表")
// searchResultAdapter?.addData(list.toMutableList())
// searchResultAdapter?.addTitle(titles)
// viewPager.adapter = searchResultAdapter
// tabLayout.setupWithViewPager(viewPager)
// }
// })
mViewModel.mLiveLesson.observe(this, {
binding.apply {
... ... @@ -171,20 +198,23 @@ class CourseDetailActivity
for (data in it.data.list) {
mapWork.put(data.id, data)
}
//1=视频课,2=直播课,3=线下培训课,4=文本课
//1=视频课,2=直播课,3=线下培训课,4=文本课 0普通视频
courseBean?.let {
when (it.type) {
1 -> {
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
mViewModel.videoLessonsDetail(it.mLessonId.toInt())
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
if (courseBean?.isTrainClass == true) {
mViewModel.videoLessonsDetail(it.mLessonId.toInt())
} else {
mViewModel.videoLessonNormal(it.mLessonId.toInt())
}
}
2 -> {
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
mViewModel.liveLessonDetail(it.mLessonId.toInt())
}
3 -> {
TYPE_COURSE_DETAIL_ITEM_OFF -> {
mViewModel.offLessonDetail(it.mLessonId.toInt())
}
}
... ...
... ... @@ -102,9 +102,11 @@ fun transData(data: TrainCourseDetailItem, pos: Int): List<TrainCourseDetailItem
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
data.lessonVideoNormal?.apply {
list.add(TrainCourseDetailItemChild(TYPE_COURSE_DETAIL_ITEM_NORMAL, pos).apply {
lessonVideoNormalChild = data.lessonVideoNormal
})
for (p in lessonclassdetail) {
list.add(TrainCourseDetailItemChild(TYPE_COURSE_DETAIL_ITEM_NORMAL, pos).apply {
lessonVideoNormalChild = p
})
}
}
}
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
... ...
... ... @@ -48,9 +48,13 @@ class CourseListFragment(var courseData: TrainCourseData,var tranClassId:String)
}
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
lessonVideoNormal = courseData.lessonBeanNormal
})
courseData.lessonBeanNormal?.apply {
for (p in class_list) {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
lessonVideoNormal = p
})
}
}
}
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
dataList.add(TrainCourseDetailItem(TYPE_COURSE_DETAIL_ITEM_LIVE).apply {
... ...
... ... @@ -12,6 +12,7 @@ import com.br_technology.securitytrain_master.base.common.ConstantParamKey.DOC_I
import com.br_technology.securitytrain_master.databinding.FragmentHomeBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
import com.br_technology.securitytrain_master.ui.bean.CourseParam
import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItemType
import com.br_technology.securitytrain_master.ui.view.home.activity.*
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.RecommendDataAdapter
... ... @@ -224,7 +225,7 @@ class HomeFragment :
val data = videoLessonList!![position]
course.mLessonId = "${data.id}"
course.isTrainClass = false
course.type = 1
course.type = TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO
//视频详情
startActivity(
Intent(
... ...
... ... @@ -2,6 +2,7 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.FragmentOnliveCourseBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
... ... @@ -9,7 +10,6 @@ import com.br_technology.securitytrain_master.ui.bean.LessonLiveBean
import com.br_technology.securitytrain_master.ui.view.home.adapter.LiveAdapter
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnLiveCourseFragmentViewModel
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.LiveWebViewModel
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
/**
... ... @@ -35,6 +35,13 @@ class OnLiveCourseFragment
binding.smartRefresh.setNoMoreData(true)
}
if (page == 1) {
if (it.data.list.data.isEmpty()) {
binding.smartRefresh.visibility = View.GONE
binding.none.visibility = View.VISIBLE
} else {
binding.smartRefresh.visibility = View.VISIBLE
binding.none.visibility = View.GONE
}
adapter.setNewInstance(it.data.list.data as MutableList<LessonLiveBean>)
} else {
adapter.addData(it.data.list.data)
... ... @@ -94,7 +101,6 @@ class OnLiveCourseFragment
}
}
companion object {
fun newInstance(type: Int): OnLiveCourseFragment {
val fragment = OnLiveCourseFragment()
... ... @@ -104,6 +110,4 @@ class OnLiveCourseFragment
return fragment
}
}
}
\ No newline at end of file
... ...
... ... @@ -21,7 +21,8 @@ class OnlineDetailFragment(val data: TrainClassDes, var type: Int) :
override fun initData() {
super.initData()
if (TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_NORMAL == type) {
if (TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_NORMAL == type
|| TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO == type) {
binding.llContent.visibility = View.GONE
}
binding.tvPos.text = data.pos
... ...
... ... @@ -24,7 +24,7 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() {
if (it.isTrainClass) {
val map = hashMapOf("class_id" to it.mClassId)
mRepository.recordTrainLesson(
it.type,
1,
it.mLessonId,
it.mTrainClassId,
view_len,
... ... @@ -33,7 +33,7 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() {
)
} else {
val map = hashMapOf("view_len" to view_len, "class_id" to it.mClassId)
mRepository.recordNormalLesson(it.type, it.mLessonId, map, record)
mRepository.recordNormalLesson(1, it.mLessonId, map, record)
}
}
}
... ...
... ... @@ -28,7 +28,7 @@
android:layout_marginEnd="32dp"
android:background="@null"
android:digits="1234567890Xx"
android:hint="身份证号码"
android:hint="请输入账号"
android:textColor="@color/black"
android:textColorHint="#CECED6"
android:textSize="18sp" />
... ... @@ -55,7 +55,7 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:hint="登录密码"
android:hint="请输入6-12位数(英文字母/数字)"
android:importantForAutofill="no"
android:inputType="textPassword"
android:lines="1"
... ...
... ... @@ -53,38 +53,53 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:visibility="gone"
android:drawableEnd="@mipmap/bold_arrow"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="通用知识"
android:textColor="@color/color_25"
android:textSize="12sp" />
android:textSize="12sp"
android:visibility="gone" />
</FrameLayout>
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refresh"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<com.scwang.smart.refresh.header.ClassicsHeader
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content">
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/database_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/database_recycler"
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
<TextView
android:id="@+id/none"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
android:gravity="center"
android:padding="32dp"
android:text="暂无资料"
android:visibility="gone" />
</FrameLayout>
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -80,8 +80,6 @@
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginBottom="40dp"
android:scrollbars="none" />
<androidx.recyclerview.widget.RecyclerView
... ...
... ... @@ -27,7 +27,7 @@
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:background="@null"
android:hint="手机号"
android:hint="手机号"
android:inputType="phone"
android:textColor="@color/black"
android:textColorHint="#CECED6"
... ... @@ -54,7 +54,7 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:hint="验证码"
android:hint="短信验证码"
android:inputType="phone"
android:textColor="@color/black"
android:textColorHint="#CECED6"
... ...
... ... @@ -16,7 +16,6 @@
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:textStyle="bold"
android:padding="12dp"
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/smart_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/online_recycler"
android:layout_width="match_parent"
... ... @@ -23,4 +24,12 @@
app:spanCount="2" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
<TextView
android:id="@+id/none"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="32dp"
android:text="暂无数据"
android:visibility="gone" />
</FrameLayout>
\ No newline at end of file
... ...