作者 杨谦

...各种修改变更

正在显示 100 个修改的文件 包含 1218 行增加467 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
... ...
... ... @@ -12,6 +12,7 @@
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/Library" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
... ...
... ... @@ -51,5 +51,15 @@
<option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/groups/public" />
</remote-repository>
<remote-repository>
<option name="id" value="maven5" />
<option name="name" value="maven5" />
<option name="url" value="https://oss.sonatype.org/content/groups/public" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://repo1.maven.org/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
... ...
... ... @@ -11,6 +11,7 @@ import java.io.File
object Constant {
// const val BASE_URL = "https://admin.anqixing.com"
// const val BASE_URL = "https://security.brofirst.cn"
// const val BASE_URL = "https://test.admin.anqixing.com"
const val BASE_URL = "https://test.admin.anqixing.com"
const val USERNAME_KEY = "username"
const val USERID_KEY = "userid"
... ...
... ... @@ -19,6 +19,8 @@ object ConstantParamKey {
// 课程id
const val LESSON_ID = "lesson_id"
const val LESSON_DETAIL_ID = "lesson_detail_id"
const val LESSON_COMPLETE = "lesson_complete"
// lessonType
const val LESSON_TYPE = "lesson_type"
... ...
... ... @@ -43,7 +43,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/paper_list")
fun specialPracticeList(
@Field("pos_id") pos_id: Int, // 工种ID
@Field("pos_id") pos_id: String, // 工种ID
@Field("type") type: Int, //
@Field("page") page: Int,
@Field("page_num") page_num: Int,
... ... @@ -78,7 +78,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/test_daily_list")
fun dayPracticeList(
@Field("pos_id") pos_ia: Int, // 工种id
@Field("pos_id") pos_ia: String, // 工种id
@Field("page") page: Int, // 页数
@Field("pageNum") pageNum: Int // 每页条数
): Observable<BaseResponse<CommonDataList<CommonPage<PaperDaily>>>>
... ... @@ -92,8 +92,8 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/start_item")
fun itemStart(
@Field("pos_id") pos_id: Int,
@Field("paper_id") paper_id: Int?,
@Field("pos_id") pos_id: String,
@Field("paper_id") paper_id: String?,
@Field("type") type: Int
): Observable<BaseResponse<StartItemBean>>
... ... @@ -104,7 +104,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/item_list")
fun itemList(
@Field("user_item_id") user_item_id: Int
@Field("user_item_id") user_item_id: String
): Observable<BaseResponse<SubjectData>>
/**
... ... @@ -114,7 +114,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/get_challenge_info")
fun challengeInfo(
@Field("user_item_id") user_item_id: Int
@Field("user_item_id") user_item_id: String
): Observable<BaseResponse<ChallengeInfo>>
/**
... ... @@ -138,7 +138,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/user_error_detail")
fun errorDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<ErrorDetail>>
/**
... ... @@ -149,7 +149,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/item_sub_error")
fun subError(
@Field("error_id") error_id: Int,
@Field("error_id") error_id: String,
@Field("answer") answer: String
): Observable<BaseResponse<Void>>
... ... @@ -162,7 +162,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/item_del_error")
fun delError(
@Field("item_id") item_id: Int,
@Field("item_id") item_id: String,
@Field("type") type: Int,
@Field("item_type") item_type: Int
): Observable<BaseResponse<Void>>
... ... @@ -190,7 +190,7 @@ interface AllItemApi : ApiService {
@FormUrlEncoded
@POST("/api/item/user_item_list_detail")
fun errorSubDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<CommonList<AnswerDetail>>>
}
\ No newline at end of file
... ...
... ... @@ -20,6 +20,13 @@ import retrofit2.http.*
interface ApiService {
/**
* 我的班级列表
*/
@POST("/api/train/train_class_list")
fun getClazzList(
): Observable<BaseResponse<CommonList<ClazzBean>>>
/**
* 答题相关参数
*/
@POST("/api/item/item_about")
... ... @@ -95,7 +102,7 @@ interface ApiService {
fun videoLessons(
@Field("is_rec") is_rec: Int,
@Field("keyword") keyword: String,
@Field("pos_id") pos_id: Int,
@Field("pos_id") pos_id: String,
@Field("page") page: Int,
@Field("page_num") page_num: Int,
): Observable<BaseResponse<VideoLessonBean>>
... ... @@ -106,7 +113,7 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_detail")
fun videoLessonsDetail(
@Field("id") id: Int,
@Field("id") id: String,
): Observable<BaseResponse<VideoLessonDetailBean>>
... ... @@ -117,7 +124,7 @@ interface ApiService {
@POST("/api/lesson/lesson_word")
fun textLessons(
@Field("keyword") keyword: String,
@Field("pos_id") pos_id: Int,
@Field("pos_id") pos_id: String,
@Field("page") page: Int,
@Field("page_num") page_num: Int,
): Observable<BaseResponse<TextLessonBean>>
... ... @@ -135,7 +142,7 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_word_detail")
fun textLessonsDetail(
@Field("id") id: Int,
@Field("id") id: String,
): Observable<BaseResponse<TextLessonDetailBean>>
/**
... ... @@ -158,7 +165,7 @@ interface ApiService {
@POST("/api/item/paper_list")
fun practiceList(
@Field("type") type: Int, //所属类型:1=模拟考试,2=专项练习
@Field("pos_id") pos_id: Int,
@Field("pos_id") pos_id: String,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<CommonList<PracticeBean>>>
... ... @@ -259,7 +266,7 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/train/train_chat_detail")
fun academicFeedbackDetail(
@Field("train_class_id") train_class_id: Int,
@Field("train_class_id") train_class_id: String,
): Observable<BaseResponse<AcademicFeedbackDetailBean>>
/**
... ... @@ -269,7 +276,7 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/material/material_detail")
fun getDocDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<CommonDetail<MaterialDetail>>>
/**
... ... @@ -311,8 +318,8 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/item/item_sub_single")
fun subSingle(
@Field("user_item_id") user_item_id: Int,
@Field("item_id") item_id: Int,
@Field("user_item_id") user_item_id: String,
@Field("item_id") item_id: String,
@Field("answer") answer: String
): Observable<BaseResponse<SubSingle>>
... ... @@ -324,7 +331,7 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/item/item_sub")
fun subAnswer(
@Field("item_id") item_id: Int,
@Field("item_id") item_id: String,
@Field("answer") answer: String
): Observable<BaseResponse<SubResult>>
... ... @@ -335,7 +342,7 @@ interface ApiService {
@FormUrlEncoded
@POST("/api/item/item_sub_paper")
fun subPaper(
@Field("user_item_id") user_item_id: Int
@Field("user_item_id") user_item_id: String
): Observable<BaseResponse<SubResult>>
/**
... ...
... ... @@ -38,7 +38,7 @@ interface DocApi : ApiService {
@POST("/api/material/material_list")
fun getDocList(
@Field("type") type: Int,
@Field("sort_id") sort_id: Int,
@Field("sort_id") sort_id: String,
@Field("keyword") keyword: String,
@Field("page") page: Int,
@Field("page_num") page_num: Int
... ...
... ... @@ -27,7 +27,6 @@ interface LessonApi : ApiService {
@POST("/api/lesson/lesson_word")
fun lessonTxtList(
@Field("keyword") keyword: String,
@Field("pos_id") pos_id: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int,
): Observable<BaseResponse<CommonDataList<CommonPage<LessonBean>>>>
... ... @@ -69,8 +68,8 @@ interface LessonApi : ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_detail")
fun lessonVideoDetail(
@Field("id") id: Int
, @Field("train_class_id") train_class_id: Int
@Field("id") id: String
, @Field("train_class_id") train_class_id: String
): Observable<BaseResponse<LessonTrainVideoDetail>>
... ... @@ -81,7 +80,7 @@ interface LessonApi : ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_detail")
fun lessonVideoDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<LessonTrainVideoDetail>>
/**
... ... @@ -92,11 +91,23 @@ interface LessonApi : ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_class_detail")
fun videoDetail(
@Field("id") id: Int
@Field("id") id: String
// , @Field("train_class_id") train_class_id: Int
): Observable<BaseResponse<CommonDetail<LessonClassDetail>>>
/**
* 视频详情
* @param id 视频id
* @param train_class_id 培训计划课程id
*/
@FormUrlEncoded
@POST("/api/lesson/lesson_class_detail")
fun videoDetail(
@Field("id") id: String
, @Field("train_class_id") train_class_id: String
): Observable<BaseResponse<CommonDetail<LessonClassDetail>>>
/**
* 资料库列表
* @param keyword 搜索关键词
* @param page 页数
... ... @@ -106,7 +117,6 @@ interface LessonApi : ApiService {
@POST("/api/material/material_list")
fun searchDocList(
@Field("keyword") keyword: String,
@Field("sort_id") sort_id: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<MaterialPage>>
... ... @@ -123,7 +133,7 @@ interface LessonApi : ApiService {
@POST("/api/lesson/lesson")
fun searchVideoList(
@Field("keyword") keyword: String, // 搜索关键词
@Field("pos_id") pos_id: String, // 工种id
// @Field("pos_id") pos_id: String, // 工种id
@Field("page") page: Int,
@Field("page_num") page_num: Int,
): Observable<BaseResponse<VideoLessonBean>>
... ... @@ -166,7 +176,7 @@ interface LessonApi : ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_live_detail")
fun lessonLiveDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<CommonDetail<LessonLive>>>
/**
... ... @@ -177,8 +187,8 @@ interface LessonApi : ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_offline")
fun lessonOffList(
@Field("id") id: Int,
@Field("train_class_id") train_class_id: Int
@Field("id") id: String,
@Field("train_class_id") train_class_id: String
): Observable<BaseResponse<LessonOffline>>
/**
... ... @@ -188,7 +198,7 @@ interface LessonApi : ApiService {
@FormUrlEncoded
@POST("/api/lesson/lesson_offline_detail")
fun lessonOffDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<CommonDetail<LessonOfflineDetail>>>
/**
... ...
... ... @@ -16,6 +16,7 @@ import retrofit2.http.POST
* PS: Not easy to write code, please indicate.
*/
interface TrainApi : ApiService {
/**
* 我的任务(课程)
* @param type 状态0=全部1=已完成2=未完成
... ... @@ -26,6 +27,7 @@ interface TrainApi : ApiService {
@POST("/api/train/train_lesson_list")
fun getTrainLessonList(
@Field("type") type: Int,
@Field("train_class_id") train_class_id: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<LessonList>>
... ... @@ -40,6 +42,7 @@ interface TrainApi : ApiService {
@POST("/api/train/train_practise_list")
fun getTrainPractiseList(
@Field("type") type: Int,
@Field("train_class_id") train_class_id: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<CommonList<PractiseBean>>>
... ... @@ -54,6 +57,7 @@ interface TrainApi : ApiService {
@POST("/api/train/train_exam_list")
fun getTrainExamList(
@Field("type") type: Int,
@Field("train_class_id") train_class_id: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<CommonList<ExamBean>>>
... ... @@ -65,7 +69,7 @@ interface TrainApi : ApiService {
@FormUrlEncoded
@POST("/api/train/train_exam_detail")
fun getTrainExamDetail(
@Field("train_exam_id") train_exam_id: Int
@Field("train_exam_id") train_exam_id: String
): Observable<BaseResponse<CommonDetail<ExamDetail>>>
/**
... ... @@ -75,7 +79,7 @@ interface TrainApi : ApiService {
@FormUrlEncoded
@POST("/api/train/start_practise")
fun startPractise(
@Field("train_practise_id") train_practise_id: Int
@Field("train_practise_id") train_practise_id: String
): Observable<BaseResponse<SubjectData>>
/**
... ... @@ -95,7 +99,7 @@ interface TrainApi : ApiService {
@FormUrlEncoded
@POST("/api/train/start_exam_exp")
fun startExamExp(
@Field("train_exam_id") train_exam_id: Int
@Field("train_exam_id") train_exam_id: String
): Observable<BaseResponse<SubjectData>>
/**
... ... @@ -117,7 +121,7 @@ interface TrainApi : ApiService {
@FormUrlEncoded
@POST("/api/train/train_chat_detail")
fun trainChatDetail(
@Field("train_class_id") train_class_id: Int
@Field("train_class_id") train_class_id: String
): Observable<BaseResponse<TrainDetail>>
/**
... ... @@ -127,7 +131,7 @@ interface TrainApi : ApiService {
@FormUrlEncoded
@POST("/api/train/train_chat_read")
fun trainChatRead(
@Field("train_class_id") train_class_id: Int
@Field("train_class_id") train_class_id: String
): Observable<BaseResponse<Void>>
/**
... ...
... ... @@ -205,7 +205,7 @@ interface UserApi : ApiService {
@FormUrlEncoded
@POST("/api/user/my_cert_detail")
fun certDetail(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<CommonDetail<UserCertDetail>>>
/**
... ... @@ -237,8 +237,8 @@ interface UserApi : ApiService {
@FormUrlEncoded
@POST("/api/user/my_cert_add")
fun certAdd(
@Field("id") id: Int?,
@Field("cert_id") cert_id: Int,
@Field("id") id: String?,
@Field("cert_id") cert_id: String,
@Field("image") image: String,
@Field("start_time") start_time: String,
@Field("end_time") end_time: String?
... ... @@ -279,7 +279,7 @@ interface UserApi : ApiService {
fun msgDetail(
@Field("page") page: Int,
@Field("page_num") page_num: Int,
@Field("teacher_id") teacherId: Int,
@Field("teacher_id") teacherId: String,
): Observable<BaseResponse<CommonDetail<CommonPage<ChatDetailBean>>>>
/**
... ... @@ -290,7 +290,7 @@ interface UserApi : ApiService {
@FormUrlEncoded
@POST("/api/teachermessage/return_msg")
fun sendMsg(
@Field("teacher_id") teacherId: Int,
@Field("teacher_id") teacherId: String,
@Field("content") content: String,
): Observable<BaseResponse<Any>>
... ... @@ -302,7 +302,7 @@ interface UserApi : ApiService {
@FormUrlEncoded
@POST("/api/user/my_cert_del")
fun certDel(
@Field("id") id: Int
@Field("id") id: String
): Observable<BaseResponse<Void>>
... ...
... ... @@ -4,10 +4,17 @@ import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.bean.RegisterCompany
import com.br_technology.securitytrain_master.ui.bean.SearchLog
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
import com.br_technology.securitytrain_master.ui.bean.UserRule
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
/**
* Author by YSir
... ... @@ -15,7 +22,7 @@ import com.br_technology.securitytrain_master.ui.bean.UserRule
* description
* PS: Not easy to write code, please indicate.
*/
class CommonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState) {
class CommonRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
//注册企业
fun registerCompany(
type: Int,
... ... @@ -78,4 +85,36 @@ class CommonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
commonService.requestInit(type, lng, lat), liveData
)
}
fun uploadFile(
path: String,
liveData: MutableLiveData<BaseResponse<UploadFileData>>
) {
val file = File(path)
if (file.exists()) {
MultipartBody.Part.createFormData(
"file", file.name, RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
apiService.uploadFile(
MultipartBody.Part.createFormData(
"file",
file.name,
RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
BaseObserver(
liveData,
loadState,
this
)
)
}
}
fun checkFace(url: String, liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(apiService.checkFace(url), liveData)
}
}
\ No newline at end of file
... ...
... ... @@ -27,7 +27,7 @@ class DocRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState
//资料库列表
fun getDocList(
type: Int,
sort_id: Int,
sort_id: String,
keyword: String,
page: Int,
page_num: Int,
... ... @@ -38,7 +38,7 @@ class DocRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState
//资料库详情
fun getDocDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<MaterialDetail>>>
) {
addRequest(docService.getDocDetail(id), liveData)
... ...
... ... @@ -7,7 +7,10 @@ import com.br_technology.securitytrain_master.base.network.response.CommonDataLi
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.network.response.CommonPage
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.ui.view.bank.bean.StartItemBean
import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
/**
* Author by YSir
... ... @@ -34,7 +37,7 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
//专项练习列表
fun specialPracticeList(
pos_id: Int, // 工种ID
pos_id: String, // 工种ID
type: Int, //
page: Int,
page_num: Int,
... ... @@ -61,7 +64,7 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
//每日一练获取列表
fun dayPracticeList(
pos_id: Int,
pos_id: String,
page: Int,
pageNum: Int,
liveData: MutableLiveData<BaseResponse<CommonDataList<CommonPage<PaperDaily>>>>
... ... @@ -71,8 +74,8 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
//开始答题
fun itemStart(
pos_id: Int,
paper_id: Int?,
pos_id: String,
paper_id: String?,
type: Int,
liveData: MutableLiveData<BaseResponse<StartItemBean>>
) {
... ... @@ -80,19 +83,19 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
}
//题目列表
fun itemList(pos_id: Int, liveData: MutableLiveData<BaseResponse<SubjectData>>) {
fun itemList(pos_id: String, liveData: MutableLiveData<BaseResponse<SubjectData>>) {
addRequest(itemService.itemList(pos_id), liveData)
}
//获取挑战答题弹板信息
fun challengeInfo(user_item_id: Int, liveData: MutableLiveData<BaseResponse<ChallengeInfo>>) {
fun challengeInfo(user_item_id: String, liveData: MutableLiveData<BaseResponse<ChallengeInfo>>) {
addRequest(itemService.challengeInfo(user_item_id), liveData)
}
//提交答题(某一题)
fun subSingle(
user_item_id: Int,
item_id: Int,
user_item_id: String,
item_id: String,
answer: String,
liveData: MutableLiveData<BaseResponse<SubSingle>>
) {
... ... @@ -101,7 +104,7 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
//subAnswer
fun subAnswer(
item_id: Int,
item_id: String,
answer: String,
liveData: MutableLiveData<BaseResponse<SubResult>>
) {
... ... @@ -109,19 +112,19 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
}
//交卷
fun subPaper(user_item_id: Int, liveData: MutableLiveData<BaseResponse<SubResult>>) {
fun subPaper(user_item_id: String, liveData: MutableLiveData<BaseResponse<SubResult>>) {
addRequest(itemService.subPaper(user_item_id), liveData)
}
//错题详情
fun errorDetail(id: Int, liveData: MutableLiveData<BaseResponse<ErrorDetail>>) {
fun errorDetail(id: String, liveData: MutableLiveData<BaseResponse<ErrorDetail>>) {
addRequest(itemService.errorDetail(id), liveData)
}
//提交错题
fun subError(
error_id: Int,
error_id: String,
answer: String,
liveData: MutableLiveData<BaseResponse<Void>>
) {
... ... @@ -140,7 +143,7 @@ class ItemRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
//答题记录详情
fun errorSubDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<CommonList<AnswerDetail>>>
) {
addRequest(itemService.errorSubDetail(id), liveData)
... ...
... ... @@ -34,15 +34,14 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
fun lessonTxtList(
keyword: String,
pos_id: Int,
page: Int, page_num: Int,
liveData: MutableLiveData<BaseResponse<CommonDataList<CommonPage<LessonBean>>>>
) {
addRequest(lessonService.lessonTxtList(keyword, pos_id, page, page_num), liveData)
addRequest(lessonService.lessonTxtList(keyword, page, page_num), liveData)
}
fun materialDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<MaterialDetail>>>
) {
addRequest(lessonService.getDocDetail(id), liveData)
... ... @@ -67,29 +66,37 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
}
fun lessonVideoDetail(
id: Int,
trainClassId: Int,
id: String,
trainClassId: String,
liveData: MutableLiveData<BaseResponse<LessonTrainVideoDetail>>
) {
addRequest(lessonService.lessonVideoDetail(id,trainClassId), liveData)
addRequest(lessonService.lessonVideoDetail(id, trainClassId), liveData)
}
fun lessonVideoDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<LessonTrainVideoDetail>>
) {
addRequest(lessonService.lessonVideoDetail(id), liveData)
}
fun videoDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<LessonClassDetail>>>
) {
addRequest(lessonService.videoDetail(id), liveData)
}
fun videoDetail(
id: String,
train_class_id: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<LessonClassDetail>>>
) {
addRequest(lessonService.videoDetail(id,train_class_id), liveData)
}
fun lessonLiveList(
keyword: String?=null,
keyword: String? = null,
type: Int,
page: Int,
page_num: Int,
... ... @@ -109,49 +116,46 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
fun searchVideoList(
keyword: String,
pos_id: String,
page: Int,
page_num: Int,
liveData: MutableLiveData<BaseResponse<VideoLessonBean>>
) {
addRequest(lessonService.searchVideoList(keyword, pos_id, page, page_num), liveData)
addRequest(lessonService.searchVideoList(keyword, page, page_num), liveData)
}
fun searchTxtList(
keyword: String,
pos_id: Int,
page: Int, page_num: Int,
liveData: MutableLiveData<BaseResponse<CommonDataList<CommonPage<LessonBean>>>>
) {
addRequest(lessonService.lessonTxtList(keyword, pos_id, page, page_num), liveData)
addRequest(lessonService.lessonTxtList(keyword, page, page_num), liveData)
}
fun searchMaterialList(
keyword: String,
pos_id: Int,
page: Int, page_num: Int,
liveData: MutableLiveData<BaseResponse<MaterialPage>>
) {
addRequest(lessonService.searchDocList(keyword, pos_id, page, page_num), liveData)
addRequest(lessonService.searchDocList(keyword, page, page_num), liveData)
}
fun lessonLiveDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<LessonLive>>>
) {
addRequest(lessonService.lessonLiveDetail(id), liveData)
}
fun lessonOffList(
id: Int,
train_class_id: Int,
id: String,
train_class_id: String,
liveData: MutableLiveData<BaseResponse<LessonOffline>>
) {
addRequest(lessonService.lessonOffList(id, train_class_id), liveData)
}
fun lessonOffDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<LessonOfflineDetail>>>
) {
addRequest(lessonService.lessonOffDetail(id), liveData)
... ... @@ -206,7 +210,7 @@ class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(lo
}
fun txtLessonDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<TextLessonDetailBean>>
) {
addRequest(lessonService.textLessonsDetail(id), liveData)
... ...
... ... @@ -5,6 +5,7 @@ import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.*
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
import com.br_technology.securitytrain_master.util.current_class_id
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
... ... @@ -21,12 +22,24 @@ import java.io.File
*/
class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
fun getClazzList(
liveData: MutableLiveData<BaseResponse<CommonList<ClazzBean>>>
) {
addRequest(
trainService.getClazzList(),
liveData
)
}
fun getTrainLessonList(
type: Int,
page: Int,
page_num: Int, liveData: MutableLiveData<BaseResponse<LessonList>>
) {
addRequest(trainService.getTrainLessonList(type, page, page_num), liveData)
addRequest(
trainService.getTrainLessonList(type, current_class_id.toInt(), page, page_num),
liveData
)
}
fun getTrainPractiseList(
... ... @@ -34,7 +47,10 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
page: Int,
page_num: Int, liveData: MutableLiveData<BaseResponse<CommonList<PractiseBean>>>
) {
addRequest(trainService.getTrainPractiseList(type, page, page_num), liveData)
addRequest(
trainService.getTrainPractiseList(type, current_class_id.toInt(), page, page_num),
liveData
)
}
fun getTrainExamList(
... ... @@ -42,24 +58,24 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
page: Int,
page_num: Int, liveData: MutableLiveData<BaseResponse<CommonList<ExamBean>>>
) {
addRequest(trainService.getTrainExamList(type, page, page_num), liveData)
addRequest(trainService.getTrainExamList(type, current_class_id.toInt(), page, page_num), liveData)
}
fun getTrainExamDetail(
train_exam_id: Int, liveData: MutableLiveData<BaseResponse<CommonDetail<ExamDetail>>>
train_exam_id: String, liveData: MutableLiveData<BaseResponse<CommonDetail<ExamDetail>>>
) {
addRequest(trainService.getTrainExamDetail(train_exam_id), liveData)
}
fun startPractise(
train_practise_id: Int,
train_practise_id: String,
liveData: MutableLiveData<BaseResponse<SubjectData>>
) {
addRequest(trainService.startPractise(train_practise_id), liveData)
}
fun startExamExp(
train_exam_id: Int,
train_exam_id: String,
liveData: MutableLiveData<BaseResponse<SubjectData>>
) {
addRequest(trainService.startExamExp(train_exam_id), liveData)
... ... @@ -73,13 +89,13 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
}
fun trainChatDetail(
train_class_id: Int,
train_class_id: String,
liveData: MutableLiveData<BaseResponse<TrainDetail>>
) {
addRequest(trainService.trainChatDetail(train_class_id), liveData)
}
fun trainChatRead(train_class_id: Int, liveData: MutableLiveData<BaseResponse<Void>>) {
fun trainChatRead(train_class_id: String, liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(trainService.trainChatRead(train_class_id), liveData)
}
... ... @@ -93,8 +109,8 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
//提交答题(某一题)
fun subSingle(
user_item_id: Int,
item_id: Int,
user_item_id: String,
item_id: String,
answer: String,
liveData: MutableLiveData<BaseResponse<SubSingle>>
) {
... ... @@ -103,7 +119,7 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
//subAnswer
fun subAnswer(
item_id: Int,
item_id: String,
answer: String,
liveData: MutableLiveData<BaseResponse<SubResult>>
) {
... ... @@ -111,7 +127,7 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
}
//交卷
fun subPaper(user_item_id: Int, liveData: MutableLiveData<BaseResponse<SubResult>>) {
fun subPaper(user_item_id: String, liveData: MutableLiveData<BaseResponse<SubResult>>) {
addRequest(itemService.subPaper(user_item_id), liveData)
}
... ...
... ... @@ -119,7 +119,7 @@ class UserRepository(val loadState: MutableLiveData<State>) : ApiRepository(load
}
fun certDetail(
id: Int, liveData: MutableLiveData<BaseResponse<CommonDetail<UserCertDetail>>>
id: String, liveData: MutableLiveData<BaseResponse<CommonDetail<UserCertDetail>>>
) {
addRequest(userService.certDetail(id), liveData)
}
... ... @@ -136,8 +136,8 @@ class UserRepository(val loadState: MutableLiveData<State>) : ApiRepository(load
}
fun certAdd(
id: Int?,
cert_id: Int,
id: String?,
cert_id: String,
image: String,
start_time: String,
end_time: String?,
... ... @@ -154,7 +154,7 @@ class UserRepository(val loadState: MutableLiveData<State>) : ApiRepository(load
}
fun certDel(
id: Int, liveData: MutableLiveData<BaseResponse<Void>>
id: String, liveData: MutableLiveData<BaseResponse<Void>>
) {
addRequest(userService.certDel(id), liveData)
}
... ...
... ... @@ -9,8 +9,6 @@ import androidx.appcompat.widget.Toolbar
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.viewbinding.ViewBinding
import com.br_technology.securitytrain_master.util.sp_job_id
import com.br_technology.securitytrain_master.util.token
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.CommonUtil
import com.br_technology.securitytrain_master.base.common.State
... ... @@ -20,6 +18,9 @@ import com.br_technology.securitytrain_master.base.common.callback.LoadingCallBa
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.expand.statusBarHeight
import com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity
import com.br_technology.securitytrain_master.util.is_set_face
import com.br_technology.securitytrain_master.util.sp_job_id
import com.br_technology.securitytrain_master.util.token
import com.kingja.loadsir.callback.SuccessCallback
/**
... ... @@ -39,6 +40,14 @@ abstract class BaseLifeCycleActivity<VM : BaseViewModel<*>, VB : ViewBinding>(pr
return binding.root
}
fun toastSetFace() {
Toast.makeText(this, "您当前还未设置人脸识别的照片,请前去设置", Toast.LENGTH_SHORT).show()
}
fun hasSetFace(): Boolean {
return is_set_face;
}
override fun initView() {
val statusBar: Toolbar? = binding.root.findViewById(R.id.status_bar)
statusBar?.post {
... ... @@ -103,7 +112,7 @@ abstract class BaseLifeCycleActivity<VM : BaseViewModel<*>, VB : ViewBinding>(pr
private fun toLogin() {
token = ""
sp_job_id = 0
sp_job_id = ""
startActivity(AccountLoginActivity::class.java)
}
... ...
... ... @@ -12,8 +12,6 @@ import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.viewbinding.ViewBinding
import com.br_technology.securitytrain_master.util.sp_job_id
import com.br_technology.securitytrain_master.util.token
import com.br_technology.securitytrain_master.base.common.CommonUtil
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.common.StateType
... ... @@ -21,6 +19,8 @@ import com.br_technology.securitytrain_master.base.common.callback.EmptyCallBack
import com.br_technology.securitytrain_master.base.common.callback.LoadingCallBack
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity
import com.br_technology.securitytrain_master.util.sp_job_id
import com.br_technology.securitytrain_master.util.token
import com.kingja.loadsir.callback.SuccessCallback
/**
... ... @@ -112,7 +112,7 @@ abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>, VB : ViewBinding>(
private fun toLogin() {
token = ""
sp_job_id = 0
sp_job_id = ""
startActivity(AccountLoginActivity::class.java)
}
... ...
package com.br_technology.securitytrain_master.expand
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Point
import android.graphics.Rect
import android.text.Spannable
... ... @@ -10,7 +12,11 @@ import android.view.View
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.view.marginLeft
import androidx.core.view.marginRight
import androidx.recyclerview.widget.RecyclerView
import com.br_technology.securitytrain_master.R
/**
... ... @@ -98,6 +104,44 @@ fun RecyclerView.addItemDecoration2(spanCount: Int, spacing: Int, top: Int) {
})
}
fun RecyclerView.addItemDecorationVertical() {
this.addItemDecoration(object : RecyclerView.ItemDecoration() {
var paint: Paint? = null
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
super.getItemOffsets(outRect, view, parent, state)
//这里是关键,需要根据你有几列来判断
outRect.top = 0
outRect.left = 0
outRect.right = 0
outRect.bottom = 2
}
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
super.onDraw(c, parent, state)
if (paint == null) {
paint = Paint().apply {
color = ContextCompat.getColor(context, R.color.color_eb)
}
}
val childCount = parent.childCount
for (i in 0 until childCount) {
val view = parent.getChildAt(i)
val dividerTop = view.bottom.toFloat()
val dividerLeft = paddingLeft + marginLeft.toFloat()
val dividerRight = parent.width - paddingRight - marginRight.toFloat()
val dividerBottom = view.bottom + 2.toFloat()
c.drawRect(dividerLeft, dividerTop, dividerRight, dividerBottom, paint!!)
}
}
})
}
fun RecyclerView.addItemDecorationCustom(spacing: Int) {
this.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(
... ...
... ... @@ -17,7 +17,7 @@ open class FileBean(
)
open class Teacher(
var id: Int,
var id: String,
var name: String,//"测试讲师2", // 讲师名称
var avatar: String//"http://security.cn/assets/img/avatar.png" // 讲师头像
) : Serializable
... ... @@ -34,11 +34,11 @@ open class UserRule(
//历史搜索记录
open class SearchLog(
var id: Int,
var id: String,
var keyword: String
)
// 做题答案
open class Answer(var id: Int, var answer: String)
open class Answer(var id: String, var answer: String)
... ...
... ... @@ -7,14 +7,14 @@ package com.br_technology.securitytrain_master.ui.bean
* PS: Not easy to write code, please indicate.
*/
open class HomeBanner(
var id: Int,
var id: String,
var title: String, // 标题
var image: String,//"/uploads/20210914/d19a69b89974e3876ca6c61ff32e2f79.jpg", // 图片地址
var href: String//"https://www.baidu.com" // 跳转链接
)
open class HomeNotice(
var id: Int,
var id: String,
var type: String, // 发布来源:1=平台,2=企业,3=培训师
var title: String,//"测试通知", // 标题
var des: String,//"1234213", // 描述
... ... @@ -25,9 +25,9 @@ open class HomeNotice(
)
open class HomeMaterialRec(
var id: Int,
var company_id: Int,
var material_sort_id: Int,
var id: String,
var company_id: String,
var material_sort_id: String,
var name: String, // 名称
var des: String, // 描述
var image: String,//"/uploads/20210914/d19a69b89974e3876ca6c61ff32e2f79.jpg", // 图片
... ...
... ... @@ -2,7 +2,6 @@ package com.br_technology.securitytrain_master.ui.bean
import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.base.network.response.CommonDetail
import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
/**
... ... @@ -22,15 +21,15 @@ open class ChallengeRule(
)
open class WorkerClassify(
var id: Int,
var id: String,
var name: String, // 职位名称
var is_choose: Int, // 是否为当前登录用户工种0=否1=是
)
open class PaperListDetail(
var id: Int,
var company_id: Int,
var item_sort_id: Int,
var id: String,
var company_id: String,
var item_sort_id: String,
var pos_id: String,
var name: String,
var score: Int,
... ... @@ -49,9 +48,9 @@ open class PaperListDetail(
)
open class PaperDaily(
var id: Int,
var company_id: Int,
var pos_id: Int,
var id: String,
var company_id: String,
var pos_id: String,
var type: String,
var title: String,
var count: Int,
... ... @@ -85,7 +84,7 @@ open class SubResult(
//错题列表
open class ErrorListItem(
var id: Int,
var id: String,
var title: String, // 错题标题
var item_type: String, // 类型1=每日一练2=挑战答题3=专项练习4=模拟考试
var type: String, // 类型1=单选2=多选3=判断
... ... @@ -99,9 +98,9 @@ open class ErrorDetail(
)
open class ErrorDetailData(
var id: Int,
var item_sort_id: Int,
var company_id: Int,
var id: String,
var item_sort_id: String,
var company_id: String,
var pos_ids: String,
var title: String,
var type: String,
... ... @@ -117,9 +116,9 @@ open class ErrorDetailData(
//答题记录
open class AnswerRecord(
var id: Int,
var id: String,
var type: String, // 题目类型:1=单选,2=多选,3=判断
var pos_id: Int,
var pos_id: String,
var title: String, // 标题
var count: Int,
var correct: Int,
... ... @@ -131,7 +130,7 @@ open class AnswerRecord(
//答题记录详情
open class AnswerDetail(
val type: String,
val item_id: Int,
val item_id: String,
val answer: String,
val is_correct: String,
val item: TestSubject,
... ...
... ... @@ -9,7 +9,7 @@ import java.io.Serializable
* PS: Not easy to write code, please indicate.
*/
open class LessonWord(
var id: Int,
var id: String,
var name: String, // 课程名称
var des: String, // 描述
var image: String, // 图片
... ... @@ -19,7 +19,7 @@ open class LessonWord(
open class LessonTrainVideoDetail(var detail: LessonVideoDetail, var class_list: List<LessonClazz>)
open class LessonWordDetail(
var id: Int,
var id: String,
var name: String, // 课程名称
var des: String, // 描述
var intro: Int, // 简介信息
... ... @@ -32,7 +32,7 @@ open class LessonWordDetail(
)
open class LessonVideo(
var id: Int,
var id: String,
var name: String, // 课程名称
var des: String, // 描述
var image: String, // 图片
... ... @@ -42,14 +42,14 @@ open class LessonVideo(
)
open class LessonClazz(
var id: Int,
var id: String,
var name: String,
var lesson_id: String,
var lessonclassdetail: List<LessonClassDetail>
) : Serializable
open class LessonClassDetail(
var id: Int,
var id: String,
var is_complete: Int,
var name: String,
var lesson_id: String,
... ... @@ -60,7 +60,7 @@ open class LessonClassDetail(
) : Serializable
open class LessonLive(
var id: Int,
var id: String,
var company_id: String,
var name: String, // 课程名称
var image: String,//"http://security.cn/assets/img/qrcode.png", // 图片
... ... @@ -74,12 +74,12 @@ open class LessonLive(
data class LessonLiveBean(
val average_study: String,
val company_id: Int,
val company_id: String,
val create_time: Int,
val create_time_text: String,
val delete_time: Any,
val delete_time_text: String,
val id: Int,
val id: String,
val lesson_id: String,
val lessonlive: LessonLiveEntity,
val name: String,
... ... @@ -103,7 +103,7 @@ data class LessonLiveEntity(
val delete_time: Any,
val delete_time_text: String,
val end_time: String,
val id: Int,
val id: String,
val image: String,
val is_open: String,
val is_open_text: String,
... ... @@ -133,7 +133,7 @@ data class TrainclassBean(
val des: String,
val end_time: Int,
val end_time_text: String,
val id: Int,
val id: String,
val is_exam: String,
val is_exam_text: String,
val is_parctise: String,
... ... @@ -169,7 +169,7 @@ data class Teachers(
val create_time_text: String,
val delete_time_text: String,
val gender_text: String,
val id: Int,
val id: String,
val name: String,
val update_time_text: String
)
... ... @@ -192,7 +192,7 @@ open class TrainClass(
) : Serializable
open class LessonOfflineItem(
var id: Int,
var id: String,
var type: String,
var company_id: Int,
var name: String,
... ... @@ -210,8 +210,8 @@ open class LessonOfflineItem(
) : Serializable
open class LessonOfflineClazz(
var id: Int,
var lesson_id: Int,
var id: String,
var lesson_id: String,
var name: String,
var start_time: String,
var end_time: String,
... ... @@ -220,7 +220,7 @@ open class LessonOfflineClazz(
) : Serializable
open class LessonOfflineDetail(
var id: Int,
var id: String,
var image: String, // 课程名称
var name: String, // 课程名称
var content: String,
... ...
... ... @@ -13,9 +13,9 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendBean
* 资料库分类
*/
open class MaterialClassify(
var id: Int,
var company_id: Int,
var pid: Int,
var id: String,
var company_id: String,
var pid: String,
var type: Int,
var name: String,
var weigh: Int,
... ... @@ -31,9 +31,9 @@ open class MaterialPage(
* 资料库分类子分类
*/
open class MaterialChild(
var id: Int,
var company_id: Int,
var pid: Int,
var id: String,
var company_id: String,
var pid: String,
var type: Int,
var name: String,
var weigh: Int,
... ... @@ -45,9 +45,9 @@ open class MaterialChild(
* 资料库分类子次级分类
*/
open class MaterialChildSecond(
var id: Int,
var company_id: Int,
var pid: Int,
var id: String,
var company_id: String,
var pid: String,
var type: Int,
var name: String,
var weigh: Int,
... ... @@ -58,8 +58,8 @@ open class MaterialChildSecond(
* 资料库列表item
*/
open class MaterialListItem(
var id: Int,
var company_id: Int,
var id: String,
var company_id: String,
var material_sort_id: Int,
var name: String, // 名称
var des: String, // 描述
... ... @@ -78,7 +78,7 @@ open class MaterialListItem(
* 资料库详情
*/
open class MaterialDetail(
var id: Int,
var id: String,
var pid: Int,
var company_id: Int,
var material_sort_id: Int,
... ...
... ... @@ -7,9 +7,9 @@ package com.br_technology.securitytrain_master.ui.bean
* PS: Not easy to write code, please indicate.
*/
open class UserInfo(
var id: Int,
var department_id: Int,
var pos_id: Int,
var id: String,
var department_id: String,
var pos_id: String,
var username: String,
var nickname: String, // 昵称
var mobile: String, // 手机号
... ... @@ -30,7 +30,7 @@ open class ContactBean(
)
open class FavoriteData(
var id: Int,
var id: String,
var object_id: String,
var user_id: Int,
var title: String,
... ... @@ -40,9 +40,9 @@ open class FavoriteData(
)
open class UserCert(
var id: Int,
var credentials_id: Int,
var user_id: Int,
var id: String,
var credentials_id: String,
var user_id: String,
var credentials_name: String, // 证件名称
var name: String, // 姓名
var identity: String, // 身份证号
... ... @@ -57,13 +57,13 @@ open class UserCert(
)
open class UserCertData(
var id: Int,
var id: String,
var name: String // 证书名称
)
open class CertType(
val id:Int,
val company_id:Int,
val id:String,
val company_id:String,
val name:String,// 证件名称
val valid:Int,// 有效期
val weigh:Int,
... ... @@ -73,8 +73,8 @@ open class CertType(
)
open class UserCertDetail(
var id: Int,
var credentials_id: Int,
var id: String,
var credentials_id: String,
var user_id: Int,
var credentials_name: String, // 证件名称
var name: String, // 姓名
... ... @@ -95,7 +95,7 @@ open class CertEndTime(
)
open class CertLog(
var id: Int,
var id: String,
var start_time: String, // 生效时间
var before_start_time: Long,
var end_time: String, // 截止时间
... ... @@ -103,7 +103,7 @@ open class CertLog(
)
open class ScoreLog(
var id: Int,
var id: String,
var createtime: String,
var score: Int, // 获得积分
var type: String, // 获取方式:类型:1=每日一练,2=挑战答题,3=专项练习,4=培训计划考试.5=培训计划练习,6=模拟考试[未完待续……],7=班级任务
... ...
... ... @@ -13,8 +13,8 @@ open class NoticeUnread(
//消息列表
open class NoticeItem(
var id: Int,
var user_id: Int,
var id: String,
var user_id: String,
var msg_sort: String,
var type: String, // 类型:1=站内信,2=短信提醒
var content: String, // 消息内容
... ... @@ -24,8 +24,8 @@ open class NoticeItem(
//消息详情
open class NoticeDetail(
var id: Int,
var user_id: Int,
var id: String,
var user_id: String,
var msg_sort: String,
var type: String, // 类型:1=站内信,2=短信提醒
var content: String, // 消息内容
... ...
... ... @@ -7,10 +7,10 @@ package com.br_technology.securitytrain_master.ui.view.bank.bean
* PS: Not easy to write code, please indicate.
*/
open class TestSubject(
var id: Int,
var company_id: Int,
var paper_id: Int,
var item_id: Int,
var id: String,
var company_id: String,
var paper_id: String,
var item_id: String,
var title: String,
var options: String,
var type: String,
... ... @@ -34,7 +34,7 @@ open class OptionArr(
* 考试开始(练习)(考试)(模拟考试)
*/
open class SubjectData(
var user_item_id: Int, // 答题id
var user_item_id: String, // 答题id
var over_second: Int, // 答题剩余时间
var list: List<UserSubject>,
var remark: String
... ... @@ -42,7 +42,7 @@ open class SubjectData(
//专项答题
open class SubjectSpecial(
user_item_id: Int, // 答题id
user_item_id: String, // 答题id
over_second: Int, // 答题剩余时间
list: List<UserSubject>,
remark: String,
... ... @@ -55,7 +55,7 @@ open class SubjectSpecial(
)
open class UserSubject(
var id: Int,
var id: String,
var title: String, // 职位名称
var type: String, // 类型1=单选2=多选3=判断
var difficulty: String, // 难度1=简单2=适中3=困难
... ...
... ... @@ -17,9 +17,18 @@ open class LessonList(
var list: List<LessonBean>
)
/**
* 班级信息
*/
open class ClazzBean(
var id: String,
var name: String,
var status: String
)
open class LessonBean(
var id: Int, // 课程id
var class_id: Int, // 视频/班级课程id,对应课程进度的class_id
var id: String, // 课程id
var class_id: String, // 视频/班级课程id,对应课程进度的class_id
// var class_name: String, // 班级名称
var train_class_id: Int, // 班级课程id
var train_id: Int, // 培训计划id
... ... @@ -44,11 +53,11 @@ open class LessonBean(
* 我的任务(练习)
*/
open class PractiseBean(
var id: Int,
var company_id: Int,
var train_id: Int,
var train_class_id: Int,
var paper_id: Int,
var id: String,
var company_id: String,
var train_id: String,
var train_class_id: String,
var paper_id: String,
var times: Int,
var score: Int,
var pass: Int,
... ... @@ -66,11 +75,11 @@ open class PractiseBean(
* 我的任务(考试)
*/
open class ExamBean(
var id: Int,
var company_id: Int,
var id: String,
var company_id: String,
var train_id: Int,
var train_class_id: Int,
var paper_id: Int,
var train_class_id: String,
var paper_id: String,
var times: Int,
var score: Int,
var pass: Int,
... ... @@ -93,7 +102,7 @@ open class ExamBean(
* 考试详情
*/
open class ExamDetail(
var id: Int,
var id: String,
var name: String, //测试", // 考试名称
var times: String, // 考试时间(分钟)
var count: Int, // 考试题数
... ... @@ -105,7 +114,7 @@ open class ExamDetail(
* 学情反馈item
*/
open class TrainChatItem(
var id: Int, // 班级id
var id: String, // 班级id
var name: Int, // 班级名称
var image: String, //http://security.cn/assets/img/avatar.png", // 图片
var class_hours: Int, // 已学课时
... ... @@ -117,7 +126,7 @@ open class TrainChatItem(
* 学情反馈详情
*/
open class TrainDetail(
var id: Int, // 班级id
var id: String, // 班级id
var name: Int, // 班级名称
var image: String, //http://security.cn/assets/img/avatar.png", // 图片
var class_hours: Int, // 已学课时
... ... @@ -136,14 +145,14 @@ open class TrainReport(
)
open class TrainReportUser(
var id: Int,
var id: String,
var nickname: String, // 姓名
var mobile: String,//手机号", // 手机号
var gender: Int, // 性别1=男2=女
var avatar: String,//"https://security.brofirst.cn/uploads/20211030/e777a39142bf8ab8dd3e02b6eb9f9d9f.jpg", // 头像
var score: Int, // 积分
var identity: String, // 身份证号
var user_id: Int,
var user_id: String,
var createtime: String, // 建档日期
var class_hours_count: Int, // 培训总学时
var item_count: Int, // 练习题量
... ... @@ -157,9 +166,9 @@ open class TrainReportUser(
)
open class TrainStudyTrain(
var id: Int,
var company_id: Int,
var pid: Int,
var id: String,
var company_id: String,
var pid: String,
var train_sort_id: String,
var name: String, // 培训名称
var depart_ids: String,
... ... @@ -171,18 +180,18 @@ open class TrainStudyTrain(
var status: String,
var trainsort: TrainStudySort,
var update_time_text: String,
var trainclass:TrainClass
var trainclass: TrainClass
)
open class TrainStudySort(
var id: Int,
var company_id: Int,
var id: String,
var company_id: String,
var name: String, // 培训类型
var weigh: Int
)
open class TrainReportStudy(
var id: Int,
var id: String,
var distance: String,
var status: String, // 结业状态0=未结业1=已结业
var view_len: String,
... ... @@ -193,7 +202,7 @@ open class TrainReportStudy(
)
open class TrainReportClass(
var id: Int,
var id: String,
var name: String, // 培训班级名称
var sort_id: String,
var students: Int,
... ... @@ -205,7 +214,7 @@ open class TrainReportClass(
)
open class TrainReportExam(
var id: Int,
var id: String,
var title: String,
var count: Int,
var correct: Int,
... ... @@ -218,7 +227,7 @@ open class TrainReportExam(
)
open class TrainReportExamMsg(
var id: Int,
var id: String,
var name: String, // 考试名称
var times: Int,
var start_time: Int,
... ...
... ... @@ -12,7 +12,7 @@ import java.util.List;
* PS: Not easy to write code, please indicate.
*/
public class LessonVideoDetail implements Serializable {
private int id;
private String id;
private String type;
private String pos_ids;
private String train_class_id;
... ... @@ -85,11 +85,11 @@ public class LessonVideoDetail implements Serializable {
this.pos_ids = pos_ids;
}
public int getId() {
public String getId() {
return id;
}
public void setId(int id) {
public void setId(String id) {
this.id = id;
}
... ...
... ... @@ -141,7 +141,7 @@ open class TrainCourseDetailItemChild(var type: Int, var pos: Int) : MultiItemEn
get() = type
}
open class SearchEvent(var search: String)
open class SearchEvent(var search: String, var index: Int)
open class SearchBean(var type: Int) : MultiItemEntity {
var txtData: LessonBean? = null
... ...
package com.br_technology.securitytrain_master.ui.view.bank.activity
import android.app.Activity
import android.content.ClipData
import android.content.Intent
import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
... ... @@ -9,8 +8,6 @@ import androidx.core.content.ContextCompat
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.ActivityAnswerRecordDetailsBinding
import com.br_technology.securitytrain_master.ui.view.bank.adapter.AnswerRecordDetailsAdapter
import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr
import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -60,8 +57,8 @@ class AnswerRecordDetailsActivity :
override fun initData() {
super.initData()
val id = intent.getIntExtra("id", 0)
mViewModel.errorSubDetail(id)
val id = intent.getStringExtra("id")
mViewModel.errorSubDetail(id?:"")
binding.apply {
toolBar.setRightText("答题卡")
toolBar.setRightTextDrawable(
... ...
... ... @@ -26,7 +26,7 @@ class ChallengeActivity :
private val mPagerAdapter = PracticePaperAdapter(false)
private var userItemId = 0
private var userItemId = ""
private val titleDialog by lazy {
DialogTitle(this)
}
... ... @@ -64,6 +64,10 @@ class ChallengeActivity :
})
// 下一题
next.setOnClickListener {
if (mPagerAdapter.getCount() <= 0) {
ToastUtils.s(baseContext, "暂无数据")
return@setOnClickListener
}
next.isClickable = false
val answer = mPagerAdapter.getAnswer()[practicePager.currentItem]
if (answer.answer.isEmpty()) {
... ... @@ -104,7 +108,7 @@ class ChallengeActivity :
override fun initDataObserver() {
mViewModel.itemStartData.observe(this) {
if (it.code == 1) {
userItemId = it.data.user_item_id.toInt()
userItemId = it.data.user_item_id
mPagerAdapter.addList(it.data.list)
binding.practicePager.adapter = mPagerAdapter
} else {
... ...
... ... @@ -26,7 +26,7 @@ class ExamDetailActivity :
BaseLifeCycleActivity<PracticeViewModel, ActivityPracticeBinding>(ActivityPracticeBinding::inflate) {
private val mPagerAdapter = PracticePaperAdapter()
private var userItemId = 0
private var userItemId = ""
private var overSecond = 0
private var isFinish = false
private var countDownTimer: CountDownTimer? = null
... ... @@ -62,7 +62,7 @@ class ExamDetailActivity :
override fun initData() {
super.initData()
val paperId = intent.getIntExtra("paper_id", 0)
val paperId = intent.getStringExtra("paper_id")
val type = intent.getIntExtra("type", 0)
mViewModel.itemStart(paperId, type)
... ... @@ -157,7 +157,7 @@ class ExamDetailActivity :
override fun initDataObserver() {
mViewModel.itemStartData.observe(this) {
// 试卷id
userItemId = it.data.user_item_id.toInt()
userItemId = it.data.user_item_id
// 倒计时 秒
overSecond = it.data.over_second
mPagerAdapter.addList(it.data.list)
... ...
... ... @@ -30,17 +30,21 @@ class MockExamActivity :
smartRefresh.autoRefresh()
// 刷新回调函数
smartRefresh.setOnRefreshListener {
refresh()
refresh()
}
// 加载回调函数
smartRefresh.setOnLoadMoreListener {
loadMore()
loadMore()
}
// 适配器item点击函数
mockExamAdapter.setOnItemClickListener { _, _, position ->
val id = mockExamAdapter.data[position].id
mViewModel.specialPracticeDetail(id.toString())
val data = mockExamAdapter.data[position]
if (data.count > 0) {
val id = data.id
mViewModel.specialPracticeDetail(id.toString())
} else {
toast("该模拟考试暂无题目")
}
}
// 设置列表适配器
recycler.adapter = mockExamAdapter
... ... @@ -48,14 +52,14 @@ class MockExamActivity :
}
}
private fun refresh(){
private fun refresh() {
// 初始化页码为1
page = 1
// 请求接口
mViewModel.specialPracticeList(page)
}
private fun loadMore(){
private fun loadMore() {
// 页码自动加1
++page
// 请求接口
... ...
package com.br_technology.securitytrain_master.ui.view.bank.activity
import android.app.Activity
import android.content.Intent
import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantType
import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding
import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter
... ... @@ -10,6 +13,7 @@ import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeVie
import com.br_technology.securitytrain_master.view.DialogDetermine
import com.br_technology.securitytrain_master.view.DialogTitle
import com.br_technology.securitytrain_master.view.listener.DialogListener
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
/**
... ... @@ -21,7 +25,7 @@ class PracticeActivity :
BaseLifeCycleActivity<PracticeViewModel, ActivityPracticeBinding>(ActivityPracticeBinding::inflate) {
// 请求id
private var contentId = 0
private var contentId = ""
private val mPagerAdapter = PracticePaperAdapter()
private var userItemId: String = ""
private val startForResult =
... ... @@ -59,7 +63,7 @@ class PracticeActivity :
override fun initData() {
super.initData()
contentId = intent.getIntExtra("contentId", 0)
contentId = intent.getStringExtra("contentId") ?: ""
val contentType = intent.getIntExtra("contentType", 0)
binding.toolBar.setTitle(ConstantType.getTestType(contentType))
mViewModel.itemStart(contentId, contentType)
... ... @@ -79,6 +83,9 @@ class PracticeActivity :
}
// 下一题
next.setOnClickListener {
if (mPagerAdapter.getCount() <= 0) {
return@setOnClickListener
}
val index = practicePager.currentItem
if (index < mPagerAdapter.itemCount - 1) {
practicePager.currentItem = index + 1
... ... @@ -104,7 +111,7 @@ class PracticeActivity :
return@setOnClickListener
}
// 答完题提交答案到服务器
mViewModel.submitAnswer(userItemId.toInt(), mPagerAdapter.getAnswer())
mViewModel.submitAnswer(userItemId, mPagerAdapter.getAnswer())
}
}
// 标题弹窗
... ... @@ -134,6 +141,23 @@ class PracticeActivity :
})
mViewModel.subAnswer.observe(this) {
binding.toolBar.setRightText("答题卡")
binding.toolBar.setRightTextDrawable(
ContextCompat.getDrawable(
baseContext,
R.mipmap.answer_sheet
)
)
// 答题卡点击事件
binding.toolBar.addRightListener(object : ToolBarClickListener {
override fun onClick(view: View) {
val intent = Intent(this@PracticeActivity, AnswerSheetActivity::class.java)
.putStringArrayListExtra("resultData", mPagerAdapter.getArrayList())
.putExtra("showCorrect", mPagerAdapter.showCorrect)
.putExtra("title", binding.toolBar.getTitle())
startForResult.launch(intent)
}
})
binding.finishJob.isClickable = true
if (!titleDialog.isShowing) {
// 点击外部不取消
... ...
... ... @@ -41,6 +41,10 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr
ToastUtils.s(baseContext, "该试题已完成")
return@setOnItemClickListener
}
if (listAdapter.data[position].count <= 0) {
toast("该练习暂无题目")
return@setOnItemClickListener
}
val id = listAdapter.data[position].id
startActivity(
Intent(
... ...
... ... @@ -26,7 +26,7 @@ class QuestionsActivity :
BaseLifeCycleActivity<PracticeViewModel, ActivityPracticeBinding>(ActivityPracticeBinding::inflate) {
private val mPagerAdapter = PracticePaperAdapter()
private var userItemId = 0
private var userItemId = ""
private var isFinish = false
private val titleDialog by lazy {
DialogTitle(this)
... ... @@ -60,7 +60,7 @@ class QuestionsActivity :
override fun initData() {
super.initData()
val paperId = intent.getIntExtra("paper_id", 0)
val paperId = intent.getStringExtra("paper_id")
val type = intent.getIntExtra("type", 0)
mViewModel.itemStart(paperId, type)
... ... @@ -154,7 +154,7 @@ class QuestionsActivity :
override fun initDataObserver() {
mViewModel.itemStartData.observe(this) {
if (it.code == 1) {
userItemId = it.data.user_item_id.toInt()
userItemId = it.data.user_item_id
mPagerAdapter.addList(it.data.list)
binding.practicePager.adapter = mPagerAdapter
} else {
... ...
... ... @@ -17,7 +17,7 @@ class WrongQuestionsActivity :
BaseLifeCycleActivity<PracticeViewModel, ActivityWrongQuestionsBinding>(
ActivityWrongQuestionsBinding::inflate
) {
private var itemId: Int = 0
private var itemId: String = ""
private var type by Delegates.notNull<Int>()
private val adapter by lazy {
PracticePaperAdapter()
... ... @@ -25,7 +25,7 @@ class WrongQuestionsActivity :
override fun initDataObserver() {
mViewModel.errorDetail.observe(this) {
itemId = it.data.error_id.toInt()
itemId = it.data.error_id
adapter.addData(it.data.detail)
}
mViewModel.subErrorLiveData.observe(this) {
... ... @@ -37,10 +37,10 @@ class WrongQuestionsActivity :
override fun initData() {
super.initData()
val id = intent.getIntExtra("id", 0)
val id = intent.getStringExtra("id")
type = intent.getIntExtra("type", 1)
MyErrorQuestionFragment.map[type] = true
mViewModel.errorDetail(id)
mViewModel.errorDetail(id?:"")
binding.apply {
errorPager.isUserInputEnabled = false
errorPager.adapter = adapter
... ...
package com.br_technology.securitytrain_master.ui.view.bank.fragment
import android.content.Intent
import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantType
... ... @@ -36,7 +37,9 @@ class BankFragment :
DialogStar(requireActivity())
}
private var posId: Int = if (sp_job_id_select == 0) {
private var hasMore = true
private var posId: String = if (sp_job_id_select == "") {
sp_job_id
} else {
sp_job_id_select
... ... @@ -70,11 +73,11 @@ class BankFragment :
}
change.setOnClickListener {
if (it.isPressed) {
refresh()
change()
}
}
refreshLayout.setOnLoadMoreListener {
initLoadMore()
// initLoadMore()
}
// 模拟考试
mockExam.setOnClickListener {
... ... @@ -101,14 +104,21 @@ class BankFragment :
practice.layoutManager = LinearLayoutManager(activity)
practiceAdapter?.setOnItemClickListener { _, _, position ->
activity?.startActivity(
Intent(
activity,
QuestionsActivity::class.java
)
.putExtra("paper_id", practiceAdapter?.data?.get(position)?.id)
.putExtra("type", ConstantType.TEST_TYPE_PRACTICE)
)
val data = practiceAdapter?.data?.get(position)
data?.let {
if (it.count > 0) {
activity?.startActivity(
Intent(
activity,
QuestionsActivity::class.java
)
.putExtra("paper_id", "${practiceAdapter?.data?.get(position)?.id}")
.putExtra("type", ConstantType.TEST_TYPE_PRACTICE)
)
} else {
Toast.makeText(activity, "该试卷暂无题目", Toast.LENGTH_SHORT).show()
}
}
}
initLoadMore()
... ... @@ -117,6 +127,7 @@ class BankFragment :
// 挑战答题弹框
dialogStarDialog.setListener(object : DialogListener {
override fun determine() {
// 挑战答题,跳转前先获取判断是否具有题目
startActivity(ChallengeActivity::class.java)
dialogStarDialog.dismiss()
}
... ... @@ -125,17 +136,38 @@ class BankFragment :
private fun refresh() {
page = 1
mViewModel.practiceList(page, 20, posId)
mViewModel.practiceList(page, 6, posId)
binding.refreshLayout.setEnableRefresh(false)
binding.refreshLayout.setEnableLoadMore(false)
}
private fun change() {
if (hasMore) {
page++
} else {
page = 1;
}
mViewModel.practiceList(page, 6, posId)
binding.refreshLayout.setEnableRefresh(false)
binding.refreshLayout.setEnableLoadMore(false)
}
private fun initLoadMore() {
page++
mViewModel.practiceList(page, 20, posId)
val needReset =
practiceAdapter != null
&& practiceAdapter?.data?.isNotEmpty() == true
&& practiceAdapter?.data?.size?.rem(
6
) != 0
if (!needReset) {
page = 1
} else {
page++
}
mViewModel.practiceList(page, 6, posId)
binding.refreshLayout.setEnableRefresh(false)
binding.refreshLayout.setEnableLoadMore(false)
practiceAdapter?.loadMoreModule?.isAutoLoadMore = true
practiceAdapter?.loadMoreModule?.isAutoLoadMore = false
practiceAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
}
... ... @@ -154,12 +186,9 @@ class BankFragment :
mViewModel.mPracticeBean.observe(this, {
binding.refreshLayout.finishLoadMore()
binding.refreshLayout.finishRefresh()
binding.refreshLayout.setEnableLoadMore(it.data.list.size == 20)
if (page == 1) {
practiceAdapter?.setList(it.data.list)
} else {
practiceAdapter?.addData(it.data.list)
}
binding.refreshLayout.setEnableLoadMore(false)
hasMore = (!(it.data.list.size < 6))
practiceAdapter?.setList(it.data.list)
})
}
}
\ No newline at end of file
... ...
... ... @@ -6,11 +6,16 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.bean.AnswerAbout
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
/**
* createTime:2021/7/27 15:49
... ... @@ -40,7 +45,7 @@ class BankRepository(val loadState: MutableLiveData<State>): ApiRepository(loadS
}
fun practiceList(
pos_id : Int,
pos_id : String,
page : Int,
page_num : Int,
liveData: MutableLiveData<BaseResponse<CommonList<PracticeBean>>>
... ... @@ -55,6 +60,37 @@ class BankRepository(val loadState: MutableLiveData<State>): ApiRepository(loadS
this
)
)
}
fun uploadFile(
path: String,
liveData: MutableLiveData<BaseResponse<UploadFileData>>
) {
val file = File(path)
if (file.exists()) {
MultipartBody.Part.createFormData(
"file", file.name, RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
apiService.uploadFile(
MultipartBody.Part.createFormData(
"file",
file.name,
RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
BaseObserver(
liveData,
loadState,
this
)
)
}
}
fun checkFace(url: String, liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(apiService.checkFace(url), liveData)
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.AnswerAbout
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.ui.view.bank.repository.BankRepository
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
... ... @@ -19,6 +20,9 @@ class BankViewModel : BaseViewModel<BankRepository>() {
var mWorkTypeBean: MutableLiveData<BaseResponse<WorkTypeBean>> = MutableLiveData()
var mAnswerAbout: MutableLiveData<BaseResponse<AnswerAbout>> = MutableLiveData()
var mFaceFile = MutableLiveData<BaseResponse<UploadFileData>>()
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
fun beanData(): LiveData<BaseResponse<WorkTypeBean>> {
return mWorkTypeBean
}
... ... @@ -36,8 +40,16 @@ class BankViewModel : BaseViewModel<BankRepository>() {
fun practiceList(
page: Int,
page_num: Int,
pos_id: Int
pos_id: String
) {
mRepository.practiceList(pos_id, page, page_num, mPracticeBean)
}
fun uploadFace(filePath: String) {
mRepository.uploadFile(filePath, mFaceFile)
}
fun checkFace(url: String) {
mRepository.checkFace(url, mFaceCheck)
}
}
\ No newline at end of file
... ...
... ... @@ -2,13 +2,16 @@ package com.br_technology.securitytrain_master.ui.view.bank.viewmodel
import androidx.lifecycle.MutableLiveData
import com.alibaba.fastjson.JSON
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDataList
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.network.response.CommonPage
import com.br_technology.securitytrain_master.base.repository.ItemRepository
import com.br_technology.securitytrain_master.base.network.response.*
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr
import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
import com.br_technology.securitytrain_master.ui.view.bank.bean.StartItemBean
import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
import com.br_technology.securitytrain_master.util.sp_job_id
/**
... ... @@ -60,7 +63,7 @@ class PracticeViewModel : BaseViewModel<ItemRepository>() {
pagerListData.value = dataList
}
fun submitAnswer(itemId: Int, list: ArrayList<Answer>) {
fun submitAnswer(itemId: String, list: ArrayList<Answer>) {
val jsonArray = JSON.toJSONString(list)
mRepository.subAnswer(itemId, jsonArray, subAnswer)
}
... ... @@ -68,27 +71,27 @@ class PracticeViewModel : BaseViewModel<ItemRepository>() {
/**
* 提交错题
*/
fun subError(itemId: Int, answer: String) {
fun subError(itemId: String, answer: String) {
mRepository.subError(itemId, answer, subErrorLiveData)
}
// 开始答题
fun itemStart(
paper_id: Int?,
paper_id: String?,
type: Int,
) {
mRepository.itemStart(sp_job_id, paper_id, type, itemStartData)
}
//获取挑战答题弹板信息
fun challengeInfo(user_item_id: Int) {
fun challengeInfo(user_item_id: String) {
mRepository.challengeInfo(user_item_id, challengeInfoLiveData)
}
// 提交某一题
fun subSingle(
user_item_id: Int,
item_id: Int,
user_item_id: String,
item_id: String,
answer: String,
) {
mRepository.subSingle(user_item_id, item_id, answer, subSingleData)
... ... @@ -96,7 +99,7 @@ class PracticeViewModel : BaseViewModel<ItemRepository>() {
// 提交答卷
fun subFinish(user_item_id: Int) {
fun subFinish(user_item_id: String) {
mRepository.subPaper(user_item_id, subFinish)
}
... ... @@ -109,14 +112,14 @@ class PracticeViewModel : BaseViewModel<ItemRepository>() {
fun errorSubDetail(
id: Int
id: String
) {
mRepository.errorSubDetail(id, errorSubDetailLiveData)
}
fun errorDetail(
id: Int
id: String
) {
mRepository.errorDetail(id, errorDetail)
}
... ...
... ... @@ -46,9 +46,14 @@ class DatabaseActivity :
}
mViewModel.sortSecond.value?.let { second -> popData?.addList(list!!, second, popChild!!) }
popData?.iClickChild = object : DatabaseListPop.IClickChild {
override fun child(child: MaterialChild, data: MaterialChildSecond) {
override fun child(child: MaterialChild, data: MaterialChildSecond?) {
mViewModel.popChild.value = child
mViewModel.sortSecond.value = data
if (child.child == null || child.child?.isEmpty() == true) {
mViewModel.sortChild.value = child
mViewModel.sortSecond.value = null
} else {
mViewModel.sortSecond.value = data
}
}
}
popData?.showAsDropDown(binding.type)
... ... @@ -122,7 +127,12 @@ class DatabaseActivity :
})
type.setOnClickListener {
showPopData()
val classify = mViewModel.selectClassify.value
if (classify?.child == null || classify.child.isEmpty()) {
} else {
showPopData()
}
}
}
}
... ... @@ -152,6 +162,7 @@ class DatabaseActivity :
mClassifyAdapter?.addListener(object : OnItemClickListener<MaterialClassify> {
override fun onClick(position: Int, data: MaterialClassify) {
val list = data.child
val id = data.id
mClassifyAdapter?.let { classifyAdapter ->
val oldIndex = classifyAdapter.index;
if (oldIndex != position) {
... ... @@ -162,12 +173,17 @@ class DatabaseActivity :
classifyAdapter.notifyItemChanged(position)
}
}
if (list.isNotEmpty()) {
mViewModel.selectClassify.value = data
} else {
mViewModel.classifyDataList.value = BaseResponse(
MaterialPage(CommonPage(0, "10", 1, 1, listOf()))
)
mViewModel.selectClassify.value = data
if (list.isNullOrEmpty()) {
binding.type.text = "全部"
if (id.isNotEmpty()) {
page = 1
mViewModel.getDataList(page)
} else {
mViewModel.classifyDataList.value = BaseResponse(
MaterialPage(CommonPage(0, "10", 1, 1, listOf()))
)
}
}
}
})
... ... @@ -182,16 +198,25 @@ class DatabaseActivity :
if (list.isNotEmpty()) {
mViewModel.sortChild.value = list[0]
mViewModel.popChild.value = list[0]
} else {
binding.type.text = "全部"
}
})
mViewModel.sortSecond.observe(this, {
mViewModel.getDataList(page)
binding.type.text = it.name
if (it != null) {
page = 1
mViewModel.getDataList(page)
binding.type.text = it.name
}
})
mViewModel.sortChild.observe(this, {
val child = it.child
if (child != null && child.isNotEmpty()) {
mViewModel.sortSecond.value = child[0]
} else {
mViewModel.sortSecond.value = null
page = 1
mViewModel.getDataList(page)
}
})
mViewModel.classifyDataList.observe(this, {
... ... @@ -220,7 +245,7 @@ class DatabaseActivity :
override fun onClick(position: Int, data: RecommendBean.ListBean) {
startActivity(
Intent(this@DatabaseActivity, DatabaseDetailActivity::class.java)
.putExtra(DOC_ID, data.id)
.putExtra(DOC_ID, "${data.id}")
)
}
})
... ...
... ... @@ -87,7 +87,7 @@ class DatabaseDetailActivity :
override fun initData() {
super.initData()
mViewModel.materialDetail(intent.getIntExtra(DOC_ID, 0))
mViewModel.materialDetail(intent.getStringExtra(DOC_ID)?:"")
}
override fun onBackPressed() {
... ...
package com.br_technology.securitytrain_master.ui.view.home.activity
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityLiveCourseBinding
import com.br_technology.securitytrain_master.ext.initPermissions
import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.BankViewModel
import com.br_technology.securitytrain_master.ui.view.home.event.CheckLiveFace
import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEvent
import com.br_technology.securitytrain_master.ui.view.home.fragment.OnLiveCourseFragment
import com.br_technology.securitytrain_master.util.TYPE_All
import com.br_technology.securitytrain_master.util.TYPE_LIVE
import com.br_technology.securitytrain_master.util.sp_job_name
import com.br_technology.securitytrain_master.util.*
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.DialogCheckIDCard
import com.br_technology.securitytrain_master.view.DialogTrainLoading
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.google.android.material.tabs.TabLayout
import com.gyf.immersionbar.ImmersionBar
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import java.io.File
/**
* Time: 7/31/2021 10:43
* Author: Captain
* Description: 初见时你很迷人
* Description: 初见时你很迷人lessonLiveList()
*/
class LiveCourseActivity
:
... ... @@ -34,6 +41,49 @@ class LiveCourseActivity
ClassifyPop(this, TYPE_All)
}
private var isCheckFace: Boolean = false
private var dialogId: DialogCheckIDCard? = null
private var permissionCount = 0
private var fileUploadTemp: File? = null
private val faceUtil = FaceUtil()
private var dialogLoading: DialogTrainLoading? = null
fun hasCheckFace(): Boolean {
return isCheckFace || company_is_check
}
private fun dialogLoading() {
if (dialogLoading == null) {
dialogLoading = DialogTrainLoading(this)
}
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 {
override fun compress(file: File) {
dialogLoading()
mViewModel.uploadFace(file.path)
}
})
}
} else {
dismissLoading()
}
}
}
override fun initView() {
super.initView()
ImmersionBar.with(this@LiveCourseActivity).statusBarDarkFont(true).init();
... ... @@ -49,6 +99,38 @@ class LiveCourseActivity
EventBus.getDefault().unregister(this)
}
private fun showDialogId() {
if (dialogId == null) {
dialogId = DialogCheckIDCard(this)
dialogId!!.setListener({
dialogId!!.dismiss()
finish()
}, {
initPermissions(
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onGranted = {
if (permissionCount == 0) {
permissionCount++
if (CameraUtil.isSupportFrontCamera()) {
faceUtil.startCaptureFace(this, object : FaceUtil.ICapture {
override fun capture(file: File) {
fileUploadTemp = file
}
})
}
}
},
onDenied = {
dialogId!!.dismiss()
}, onDeniedNever = {
dialogId!!.dismiss()
})
})
}
dialogId!!.show()
}
override fun initDataObserver() {
//岗位
mViewModel.mWorkTypeBean.observe(this, {
... ... @@ -57,6 +139,35 @@ class LiveCourseActivity
classifyPop.showAsDropDown(binding.toolBar)
}
})
mViewModel.mFaceFile.observe(this, {
it.let {
if (!TextUtils.isEmpty(it.data.fullurl)) {
mViewModel.checkFace(it.data.fullurl)
} else {
showTip(it.msg)
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
}
}
})
mViewModel.mFaceCheck.observe(this, {
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
it.let {
if (it.code == 1) {
if (dialogId != null) {
dialogId!!.dismiss()
}
isCheckFace = true
} else {
finish()
showTip(it.msg)
}
}
})
}
override fun initData() {
... ... @@ -115,4 +226,9 @@ class LiveCourseActivity
binding.toolBar.setRightText(data.name)
}
}
@Subscribe
fun eventCheck(data: CheckLiveFace) {
showDialogId()
}
}
\ No newline at end of file
... ...
... ... @@ -36,7 +36,7 @@ class OnlineActivity :
private val classifyPop by lazy {
ClassifyPop(this, TYPE_All)
}
private var posId: Int = sp_job_id_select
private var posId: String = sp_job_id_select
var videoCourseAdapter: VideoCourseAdapter? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
... ...
package com.br_technology.securitytrain_master.ui.view.home.activity
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivitySearchBinding
import com.br_technology.securitytrain_master.ext.initPermissions
import com.br_technology.securitytrain_master.ui.bean.SearchEvent
import com.br_technology.securitytrain_master.ui.bean.SearchLog
import com.br_technology.securitytrain_master.ui.view.home.adapter.HistoryAdapter
import com.br_technology.securitytrain_master.ui.view.home.event.CheckSearchFace
import com.br_technology.securitytrain_master.ui.view.home.fragment.ResultFragment
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.SearchViewModel
import com.br_technology.securitytrain_master.util.CameraUtil
import com.br_technology.securitytrain_master.util.FaceUtil
import com.br_technology.securitytrain_master.util.company_is_check
import com.br_technology.securitytrain_master.view.DialogCheckIDCard
import com.br_technology.securitytrain_master.view.DialogSureCancel
import com.br_technology.securitytrain_master.view.DialogTrainLoading
import com.br_technology.securitytrain_master.view.listener.DialogListener
import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import java.io.File
/**
* createTime:2021/7/28 11:13
... ... @@ -23,6 +36,81 @@ import org.greenrobot.eventbus.EventBus
*/
class SearchActivity :
BaseLifeCycleActivity<SearchViewModel, ActivitySearchBinding>(ActivitySearchBinding::inflate) {
private var isCheckFace: Boolean = false
private var dialogId: DialogCheckIDCard? = null
private var permissionCount = 0
private var fileUploadTemp: File? = null
private val faceUtil = FaceUtil()
private var dialogLoading: DialogTrainLoading? = null
fun hasCheckFace(): Boolean {
return isCheckFace || company_is_check
}
private fun dialogLoading() {
if (dialogLoading == null) {
dialogLoading = DialogTrainLoading(this)
}
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 {
override fun compress(file: File) {
dialogLoading()
mViewModel.uploadFace(file.path)
}
})
}
} else {
dismissLoading()
}
}
}
private fun showDialogId() {
if (dialogId == null) {
dialogId = DialogCheckIDCard(this)
dialogId!!.setListener({
dialogId!!.dismiss()
finish()
}, {
initPermissions(
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onGranted = {
if (permissionCount == 0) {
permissionCount++
if (CameraUtil.isSupportFrontCamera()) {
faceUtil.startCaptureFace(this, object : FaceUtil.ICapture {
override fun capture(file: File) {
fileUploadTemp = file
}
})
}
}
},
onDenied = {
dialogId!!.dismiss()
}, onDeniedNever = {
dialogId!!.dismiss()
})
})
}
dialogId!!.show()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.apply {
... ... @@ -49,7 +137,8 @@ class SearchActivity :
search.setOnClickListener {
// 点击搜索时隐藏历史记录
showData(true)
EventBus.getDefault().post(SearchEvent(searchEdit.text.toString()))
EventBus.getDefault()
.post(SearchEvent(searchEdit.text.toString(), viewPager.currentItem))
}
searchEdit.setOnClickListener {
... ... @@ -75,6 +164,12 @@ class SearchActivity :
viewPager.offscreenPageLimit = 3
tabLayout.setupWithViewPager(viewPager)
}
EventBus.getDefault().register(this)
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this)
}
override fun onResume() {
... ... @@ -103,15 +198,55 @@ class SearchActivity :
historyAdapter.addList(it.data.list)
historyAdapter.addListener(object : OnItemClickListener<SearchLog> {
override fun onClick(position: Int, data: SearchLog) {
EventBus.getDefault().post(SearchEvent(data.keyword))
binding.searchEdit.setText(data.keyword)
EventBus.getDefault()
.post(SearchEvent(data.keyword, binding.viewPager.currentItem))
showData(true)
}
})
})
mViewModel.clearData.observe(this, {
mViewModel.searchLog()
EventBus.getDefault().post(SearchEvent(""))
showData(true)
// EventBus.getDefault().post(SearchEvent("", binding.viewPager.currentItem))
// showData(true)
})
mViewModel.mFaceFile.observe(this, {
it.let {
if (!TextUtils.isEmpty(it.data.fullurl)) {
mViewModel.checkFace(it.data.fullurl)
} else {
showTip(it.msg)
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
}
}
})
mViewModel.mFaceCheck.observe(this, {
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
it.let {
if (it.code == 1) {
if (dialogId != null) {
dialogId!!.dismiss()
}
isCheckFace = true
} else {
finish()
showTip(it.msg)
}
}
})
}
fun getCurrentIndex(): SearchEvent {
return SearchEvent(binding.searchEdit.text.toString(), binding.viewPager.currentItem)
}
@Subscribe
public fun searchFace(data: CheckSearchFace) {
showDialogId()
}
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ class TextCourseActivity :
private val classifyPop by lazy {
ClassifyPop(this, TYPE_All)
}
private var posId: Int = sp_job_id_select
private var posId: String = sp_job_id_select
private fun loadData() {
mViewModel.textLessons("", page, posId)
... ...
... ... @@ -21,6 +21,7 @@ import com.br_technology.securitytrain_master.ui.view.home.fragment.OnlineDetail
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.CourseDetailViewModel
import com.br_technology.securitytrain_master.util.CameraUtil
import com.br_technology.securitytrain_master.util.FaceUtil
import com.br_technology.securitytrain_master.util.company_is_check
import com.br_technology.securitytrain_master.view.DialogCheckIDCard
import com.br_technology.securitytrain_master.view.DialogTrainLoading
import com.bumptech.glide.Glide
... ... @@ -28,7 +29,7 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import java.io.File
/**
/**AllItemApi.itemStart
* Time: 7/30/2021 13:56
* Author: Captain
* Description: 初见时你很迷人
... ... @@ -41,7 +42,7 @@ class CourseDetailActivity
private var courseBean: CourseParam? = null
private var courseLesson: VideoLessonBean.ListBean.DataBean? = null
private var mWorkBean: WorkTypeBean? = null
private var mapWork = mutableMapOf<Int, WorkTypeBean.ListBean>()
private var mapWork = mutableMapOf<String, WorkTypeBean.ListBean>()
private var dialogId: DialogCheckIDCard? = null
private var permissionCount = 0
... ... @@ -166,6 +167,7 @@ class CourseDetailActivity
searchResultAdapter?.addTitle(titles)
viewPager.adapter = searchResultAdapter
tabLayout.setupWithViewPager(viewPager)
viewPager.currentItem = 1
}
})
... ... @@ -256,7 +258,7 @@ class CourseDetailActivity
private fun setPosName(posIds: String): String {
val str = StringBuilder("适用于:")
for (data in posIds.split(",")) {
str.append(mapWork[data.toInt()]?.name).append(",")
str.append(mapWork[data]?.name).append(",")
}
return str.toString().substring(0, str.toString().length - 1)
}
... ... @@ -283,29 +285,33 @@ class CourseDetailActivity
when (it.type) {
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
mViewModel.videoLessonsDetail(
it.mLessonId.toInt(),
it.mTrainClassId.toInt()
it.mLessonId,
it.mTrainClassId
)
}
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
if (courseBean?.isTrainClass == true) {
mViewModel.videoLessonsDetail(
it.mLessonId.toInt(),
it.mTrainClassId.toInt()
it.mLessonId,
it.mTrainClassId
)
} else {
mViewModel.videoLessonNormal(it.mLessonId.toInt())
mViewModel.videoLessonNormal(it.mLessonId)
}
}
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
mViewModel.liveLessonDetail(it.mLessonId.toInt())
mViewModel.liveLessonDetail(it.mLessonId)
}
TYPE_COURSE_DETAIL_ITEM_OFF -> {
mViewModel.offLessonDetail(it.mLessonId.toInt())
mViewModel.offLessonDetail(it.mLessonId)
}
}
if (it.type != TYPE_COURSE_DETAIL_ITEM_OFF && !it.isFinished) {
showDialogId()
if (!company_is_check && it.type != TYPE_COURSE_DETAIL_ITEM_OFF && !it.isFinished) {
if (hasSetFace()) {
showDialogId()
} else {
toastSetFace()
}
}
}
})
... ...
... ... @@ -37,7 +37,7 @@ class CoursePractiseActivity :
private var courseBean: CourseParam? = null
private val mPagerAdapter = CourseTestPaperAdapter()
private var userItemId = 0
private var userItemId = ""
private var isFinish = false
private val titleDialog by lazy {
DialogTitle(this)
... ... @@ -75,9 +75,9 @@ class CoursePractiseActivity :
val isExam = intent.getBooleanExtra("isExam", false)
courseBean?.let {
if (isExam) {
mViewModel.startExam(it.mTrainClassId.toInt())
mViewModel.startExam(it.mTrainClassId)
} else {
mViewModel.startPractise(it.mTrainClassId.toInt())
mViewModel.startPractise(it.mTrainClassId)
}
}
binding.apply {
... ...
... ... @@ -40,9 +40,9 @@ class TextDetailActivity :
courseBean = intent.getParcelableExtra(COURSE_BEAN)
courseBean?.let { course ->
if (course.isTrainClass) {
mViewModel.textLessonsDetail(course.mLessonId.toInt())
mViewModel.textLessonsDetail(course.mLessonId)
} else {
mViewModel.materialDetail(course.mLessonId.toInt())
mViewModel.materialDetail(course.mLessonId)
}
binding.start.setOnClickListener {
if (course.isTrainClass) {
... ...
... ... @@ -24,20 +24,6 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
var courseBean: CourseParam? = null
override fun initDataObserver() {
mViewModel.mVideoLesson.observe(this, {
val url = it.data.detail.clazz[0].lessonclassdetail[0].video_url
val bool = it.data.detail.clazz[0].lessonclassdetail[0].is_complete == 1
binding.videoPlayer.apply {
initVideoBuilderMode(
"it.data.detail.image",
url,
this@VideoDetailActivity,
true,
lifecycle
)
setCantTouch(bool)
}
})
}
override fun initView() {
... ... @@ -58,10 +44,24 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
override fun initData() {
super.initData()
val id = intent.getIntExtra(ConstantParamKey.LESSON_ID, 0)
val id = intent.getStringExtra(ConstantParamKey.LESSON_ID)?:""
val detailId = intent.getStringExtra(ConstantParamKey.LESSON_DETAIL_ID)?:""
val url = intent.getStringExtra(ConstantParamKey.COURSE_LESSON)?:""
val bool = intent.getBooleanExtra(ConstantParamKey.LESSON_COMPLETE,false)
courseBean = intent.getParcelableExtra(ConstantParamKey.COURSE_BEAN)
mViewModel.videoLessonsDetail(id)
courseBean?.mClassId = detailId
mViewModel.courseParam.value = courseBean
// mViewModel.videoDetail(detailId)
binding.videoPlayer.apply {
initVideoBuilderMode(
"it.data.detail.image",
url,
this@VideoDetailActivity,
true,
lifecycle
)
setCantTouch(bool)
}
}
fun timeGet(str: String): String {
... ... @@ -79,5 +79,4 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
}
super.onBackPressed()
}
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.expand.TranslateUnit
import com.br_technology.securitytrain_master.expand.glideRound
import com.br_technology.securitytrain_master.ui.bean.LessonBean
import com.br_technology.securitytrain_master.ui.bean.LessonLive
... ... @@ -43,6 +44,18 @@ class SearchAdapter : BaseMultiItemQuickAdapter<SearchBean, BaseViewHolder>() {
mClickItem = iClickItem
}
override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
super.onItemViewHolderCreated(viewHolder, viewType)
if (viewType == 0) {
val width =
(viewHolder.itemView.resources.displayMetrics.widthPixels - TranslateUnit.dp2px(
viewHolder.itemView.context,
32f
) - 15) / 2
viewHolder.getView<ImageView>(R.id.video_pic).layoutParams.width = width
}
}
override fun convert(holder: BaseViewHolder, item: SearchBean) {
when (item.type) {
0 -> {
... ...
... ... @@ -34,7 +34,7 @@ class VideoCourseListSecondProvider : BaseNodeProvider() {
context.startActivity(
Intent(context, VideoDetailActivity::class.java)
.putExtra(ConstantParamKey.LESSON_ID, lessonDetailBean.lesson_id)
.putExtra("train_class_id", lessonDetailBean.lesson_id)
.putExtra("train_class_id", "${lessonDetailBean.lesson_id}")
)
}
}
\ No newline at end of file
... ...
... ... @@ -19,9 +19,9 @@ public class WorkTypeBean {
}
public static class ListBean {
private Integer id;
private Integer company_id;
private Integer department_id;
private String id;
private String company_id;
private String department_id;
private String name;
private Integer weigh;
private Integer create_time;
... ... @@ -29,27 +29,27 @@ public class WorkTypeBean {
private Object delete_time;
private Integer is_choose;
public Integer getId() {
public String getId() {
return id;
}
public void setId(Integer id) {
public void setId(String id) {
this.id = id;
}
public Integer getCompany_id() {
public String getCompany_id() {
return company_id;
}
public void setCompany_id(Integer company_id) {
public void setCompany_id(String company_id) {
this.company_id = company_id;
}
public Integer getDepartment_id() {
public String getDepartment_id() {
return department_id;
}
public void setDepartment_id(Integer department_id) {
public void setDepartment_id(String department_id) {
this.department_id = department_id;
}
... ...
... ... @@ -5,12 +5,23 @@ package com.br_technology.securitytrain_master.ui.view.home.event
* Author: Captain
* Description: 初见时你很迷人
*/
class GetWorkTypeEvent(var id: Int, var name: String, var type: Int)
// 职位选择
class GetWorkTypeEvent(var id: String, var name: String, var type: Int)
// 课程页面状态选择
class StatusTypeEvent(var id: Int, var name: String)
class TransType(var id: Int)
// 班级选择
class ClazzChangeEvent(var id: String)
class CheckFace()
// 直播课程类型切换
class TransType(var id: String)
// 直播页面人脸检测
class CheckLiveFace()
// 搜索页面人脸检测
class CheckSearchFace()
// 视频波安防页面进度刷新
class VideoClassChange(var lessonId: String, var isFinish: Boolean)
\ No newline at end of file
... ...
... ... @@ -4,6 +4,8 @@ import android.content.Intent
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COMMON_URL
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_BEAN
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.LESSON_COMPLETE
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.LESSON_DETAIL_ID
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.LESSON_ID
import com.br_technology.securitytrain_master.databinding.FragmentCourseListBinding
import com.br_technology.securitytrain_master.ui.bean.TrainCourseData
... ... @@ -53,7 +55,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin
courseData.lessonBean?.apply {
for ((index, p) in class_list.withIndex()) {
if (p.lesson_id == search.lessonId) {
if (p.lessonclassdetail.isNotEmpty()){
if (p.lessonclassdetail.isNotEmpty()) {
p.lessonclassdetail[0].is_complete = 1
}
adapter.notifyItemChanged(index)
... ... @@ -110,7 +112,12 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin
startActivity(
Intent(activity, VideoDetailActivity::class.java)
.putExtra(COMMON_URL, item.lessonVideoChild?.video_url)
.putExtra(LESSON_ID, item.lessonVideoChild?.lesson_id?.toInt())
.putExtra(LESSON_ID, item.lessonVideoChild?.lesson_id)
.putExtra(LESSON_DETAIL_ID, item.lessonVideoChild?.id)
.putExtra(
LESSON_COMPLETE,
item.lessonVideoChild?.is_complete == 1
)
.putExtra(COURSE_BEAN, param)
)
}
... ... @@ -121,8 +128,13 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin
.putExtra(COMMON_URL, item.lessonVideoNormalChild?.video_url)
.putExtra(
LESSON_ID,
item.lessonVideoNormalChild?.lesson_id?.toInt()
item.lessonVideoNormalChild?.lesson_id
)
.putExtra(
LESSON_COMPLETE,
item.lessonVideoChild?.is_complete == 1
)
.putExtra(LESSON_DETAIL_ID, item.lessonVideoChild?.id)
.putExtra(
COURSE_BEAN,
(activity as CourseDetailActivity).getCourseBean()
... ...
... ... @@ -226,7 +226,7 @@ class HomeFragment :
override fun onClick(position: Int, data: RecommendBean.ListBean) {
startActivity(
Intent(requireContext(), DatabaseDetailActivity::class.java)
.putExtra(DOC_ID, data.id)
.putExtra(DOC_ID, data.id.toString())
)
}
})
... ...
... ... @@ -7,11 +7,14 @@ import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.FragmentOnliveCourseBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
import com.br_technology.securitytrain_master.ui.bean.LessonLiveBean
import com.br_technology.securitytrain_master.ui.view.home.activity.LiveCourseActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.LiveAdapter
import com.br_technology.securitytrain_master.ui.view.home.event.CheckLiveFace
import com.br_technology.securitytrain_master.ui.view.home.event.TransType
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnLiveCourseFragmentViewModel
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
/**
... ... @@ -84,6 +87,15 @@ class OnLiveCourseFragment
url = adapter.data.get(position).lessonlive.playback_url
}
if (status == "1") {
if (!(activity as LiveCourseActivity).hasCheckFace()) {
if (!(activity as LiveCourseActivity).hasSetFace()) {
(activity as LiveCourseActivity).toastSetFace()
return@setOnItemClickListener
} else {
EventBus.getDefault().post(CheckLiveFace())
return@setOnItemClickListener
}
}
url = adapter.data.get(position).playerUrl
}
val title = adapter.data[position].name
... ... @@ -95,7 +107,6 @@ class OnLiveCourseFragment
}
}
override fun onResume() {
super.onResume()
if (map[type] == true) {
... ...
... ... @@ -7,14 +7,17 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.databinding.FragmentResultBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
import com.br_technology.securitytrain_master.expand.addItemDecorationCustom
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.home.activity.DatabaseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.SearchActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.SearchAdapter
import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendBean
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.ui.view.home.event.CheckSearchFace
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.ResultViewModel
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
import com.br_technology.securitytrain_master.util.TranslateUnit
... ... @@ -43,6 +46,7 @@ class ResultFragment(val type: Int) :
}
ResultViewModel.ResultType.TYPE_ONE -> {
str = "暂无直播课程"
binding.result.setPadding(0, 0, 0, 0)
}
ResultViewModel.ResultType.TYPE_TWO -> {
str = "暂无文本课程"
... ... @@ -55,8 +59,13 @@ class ResultFragment(val type: Int) :
binding.apply {
when (type) {
0 -> {
result.addItemDecorationCustom(TranslateUnit.dp2px(context, 16f))
result.layoutManager = GridLayoutManager(requireActivity(), 2)
result.addItemDecoration2(
2,
15,
15
)
val gridLayoutManager = GridLayoutManager(requireActivity(), 2)
result.layoutManager = gridLayoutManager
}
else -> {
result.addItemDecorationCustom(TranslateUnit.dp2px(context, 16f))
... ... @@ -64,12 +73,17 @@ class ResultFragment(val type: Int) :
}
}
}
binding.smartRefresh.setOnRefreshListener {
search((activity as SearchActivity).getCurrentIndex())
}
}
var searchAdapter: SearchAdapter? = null
override fun initData() {
super.initData()
val searchEvent = (activity as SearchActivity).getCurrentIndex()
keywords = searchEvent.search
refresh()
}
... ... @@ -115,7 +129,6 @@ class ResultFragment(val type: Int) :
} else {
View.VISIBLE
}
}
private fun transData(data: List<Any>): List<SearchBean> {
... ... @@ -162,7 +175,9 @@ class ResultFragment(val type: Int) :
@Subscribe
fun search(search: SearchEvent) {
keywords = search.search
refresh()
if (search.index == type) {
refresh()
}
}
override fun clickItem(item: SearchBean) {
... ... @@ -181,12 +196,33 @@ class ResultFragment(val type: Int) :
)
}
ResultViewModel.ResultType.TYPE_ONE -> {
val status = item.liveData?.live_status ?: "3"
if (status == "3") {
showTip("还未开播")
return
}
var url = ""
if (status == "2") {
url = item.liveData?.webrtc_url ?: ""
}
if (status == "1") {
if (!(activity as SearchActivity).hasCheckFace()) {
if ((activity as SearchActivity).hasSetFace()) {
EventBus.getDefault().post(CheckSearchFace())
return
} else {
(activity as SearchActivity).toastSetFace()
return
}
}
url = item.liveData?.webrtc_url ?: ""
}
val title = item.liveData?.name
//todo 直播未写
// val title = item.videoData
val intent = Intent(requireActivity(), LiveWebActivity::class.java)
// intent.putExtra("url", url)
// intent.putExtra("title", title)
intent.putExtra("url", url)
intent.putExtra("title", title)
startActivity(intent)
}
ResultViewModel.ResultType.TYPE_TWO -> {
... ... @@ -211,5 +247,4 @@ class ResultFragment(val type: Int) :
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,10 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
... ... @@ -16,7 +16,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
*/
class OnlineDetailRepository (val loadState: MutableLiveData<State>): ApiRepository(loadState) {
fun videoLessonsDetail(
id: Int,
id: String,
liveData: MutableLiveData<BaseResponse<VideoLessonDetailBean>>
) {
apiService.videoLessonsDetail(id)
... ...
... ... @@ -2,11 +2,11 @@ package com.br_technology.securitytrain_master.ui.view.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
... ... @@ -19,7 +19,7 @@ class OnlineRepository(val loadState: MutableLiveData<State>): ApiRepository(loa
fun videoLessons(
is_rec: Int,
keyword: String,
pos_id: Int,
pos_id: String,
page: Int,
page_num: Int,
liveData: MutableLiveData<BaseResponse<VideoLessonBean>>
... ...
... ... @@ -2,11 +2,11 @@ package com.br_technology.securitytrain_master.ui.view.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
... ... @@ -18,7 +18,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
class TextCourseRepository(val loadState: MutableLiveData<State>): ApiRepository(loadState) {
fun textLessons(
keyword: String,
pos_id: Int,
pos_id: String,
page: Int,
page_num: Int,
liveData: MutableLiveData<BaseResponse<TextLessonBean>>
... ...
... ... @@ -24,21 +24,21 @@ class CourseDetailViewModel : BaseViewModel<LessonRepository>() {
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
fun videoLessonsDetail(
id: Int,
trainClassId: Int
id: String,
trainClassId: String
) {
mRepository.lessonVideoDetail(id,trainClassId, mVideoLesson)
mRepository.lessonVideoDetail(id, trainClassId, mVideoLesson)
}
fun videoLessonNormal(id: Int) {
fun videoLessonNormal(id: String) {
mRepository.videoDetail(id, mVideoLessonNormal)
}
fun liveLessonDetail(id: Int) {
fun liveLessonDetail(id: String) {
mRepository.lessonLiveDetail(id, mLiveLesson)
}
fun offLessonDetail(id: Int) {
fun offLessonDetail(id: String) {
mRepository.lessonOffDetail(id, mLessonOff)
}
... ...
... ... @@ -35,29 +35,29 @@ class CoursePracticeViewModel : BaseViewModel<TrainRepository>() {
// 开始练习
fun startPractise(
train_practise_id: Int,
train_practise_id: String,
) {
mRepository.startPractise(train_practise_id, exam)
}
// 开始答题
fun startExam(
train_practise_id: Int,
train_practise_id: String,
) {
mRepository.startExamExp(train_practise_id, exam)
}
// 提交某一题
fun subSingle(
user_item_id: Int,
item_id: Int,
user_item_id: String,
item_id: String,
answer: String,
) {
mRepository.subSingle(user_item_id, item_id, answer, subSingleData)
}
// 提交答卷
fun subFinish(user_item_id: Int) {
fun subFinish(user_item_id: String) {
mRepository.subPaper(user_item_id, subFinish)
}
}
\ No newline at end of file
... ...
... ... @@ -16,7 +16,7 @@ class DatabaseDetailViewModel : BaseViewModel<LessonRepository>() {
var mDetailMaterialNormal = MutableLiveData<BaseResponse<CommonDetail<MaterialDetail>>>()
var collectResponse = MutableLiveData<BaseResponse<Void>>()
fun materialDetail(id: Int) {
fun materialDetail(id: String) {
mRepository.materialDetail(id, mDetailMaterialNormal)
}
... ...
... ... @@ -19,7 +19,7 @@ class OnlineViewModel : BaseViewModel<OnlineRepository>() {
is_rec: Int,
keyword: String,
page: Int,
pos_id: Int
pos_id: String
) {
mRepository.videoLessons(is_rec, keyword, pos_id, page, 10, mVideoLessonBean)
}
... ...
... ... @@ -10,7 +10,6 @@ import com.br_technology.securitytrain_master.ui.bean.LessonBean
import com.br_technology.securitytrain_master.ui.bean.LessonLive
import com.br_technology.securitytrain_master.ui.bean.MaterialPage
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.util.sp_job_id
/**
* createTime:2021/7/27 15:48
... ... @@ -55,7 +54,7 @@ class ResultViewModel : BaseViewModel<LessonRepository>() {
keyword: String,
page: Int
) {
mRepository.searchVideoList(keyword, sp_job_id.toString(), page, 10, videoData)
mRepository.searchVideoList(keyword, page, 10, videoData)
}
fun searchLiveList(
... ... @@ -69,13 +68,13 @@ class ResultViewModel : BaseViewModel<LessonRepository>() {
keyword: String,
page: Int
) {
mRepository.searchTxtList(keyword, sp_job_id, page, 10, txtData)
mRepository.searchTxtList(keyword, page, 10, txtData)
}
fun searchMaterialList(
keyword: String,
page: Int
) {
mRepository.searchMaterialList(keyword, sp_job_id, page, 10, materialData)
mRepository.searchMaterialList(keyword, page, 10, materialData)
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.repository.CommonRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.SearchLog
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
/**
* createTime:2021/7/27 15:48
... ... @@ -17,6 +18,9 @@ class SearchViewModel : BaseViewModel<CommonRepository>() {
val liveData = MutableLiveData<BaseResponse<CommonList<SearchLog>>>()
val clearData = MutableLiveData<BaseResponse<CommonList<SearchLog>>>()
var mFaceFile = MutableLiveData<BaseResponse<UploadFileData>>()
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
fun searchLog() {
mRepository.searchLog(liveData)
}
... ... @@ -24,4 +28,12 @@ class SearchViewModel : BaseViewModel<CommonRepository>() {
fun clearLog() {
mRepository.searchLogClear(clearData)
}
fun uploadFace(filePath: String) {
mRepository.uploadFile(filePath, mFaceFile)
}
fun checkFace(url: String) {
mRepository.checkFace(url, mFaceCheck)
}
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,7 @@ class TextCourseViewModel : BaseViewModel<TextCourseRepository>() {
fun textLessons(
keyword: String,
page: Int,
pos_id: Int
pos_id: String
) {
mRepository.textLessons(keyword, pos_id, page, 10, mTextLessonBean)
}
... ...
... ... @@ -29,12 +29,12 @@ class TextDetailViewModel : BaseViewModel<LessonRepository>() {
var favoriteResponse = MutableLiveData<BaseResponse<Void>>()
fun textLessonsDetail(
id: Int
id: String
) {
mRepository.txtLessonDetail(id, mTextLessonDetailBean)
}
fun materialDetail(id: Int) {
fun materialDetail(id: String) {
mRepository.materialDetail(id, mDetailMaterialNormal)
}
... ...
... ... @@ -2,10 +2,11 @@ package com.br_technology.securitytrain_master.ui.view.home.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDetail
import com.br_technology.securitytrain_master.base.repository.LessonRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.CourseParam
import com.br_technology.securitytrain_master.ui.bean.LessonTrainVideoDetail
import com.br_technology.securitytrain_master.ui.bean.LessonClassDetail
/**
* Time: 12/8/2021 15:46
... ... @@ -18,7 +19,9 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() {
val record = MutableLiveData<BaseResponse<Void>>()
val mVideoLesson = MutableLiveData<BaseResponse<LessonTrainVideoDetail>>()
// val mVideoLesson = MutableLiveData<BaseResponse<LessonTrainVideoDetail>>()
val mVideoLessonDetail = MutableLiveData<BaseResponse<CommonDetail<LessonClassDetail>>>()
fun record(
view_len: String
... ... @@ -40,9 +43,17 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() {
}
}
fun videoLessonsDetail(
id: Int
) {
mRepository.lessonVideoDetail(id, mVideoLesson)
// fun videoLessonsDetail(
// id: String
// ) {
// mRepository.lessonVideoDetail(id, mVideoLesson)
// }
fun videoDetail(id: String) {
mRepository.videoDetail(id, mVideoLessonDetail)
}
fun videoDetail(id: String, classId: String) {
mRepository.videoDetail(id, classId, mVideoLessonDetail)
}
}
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@ public class LoginBean {
private Integer id;
private Integer company_id;
private Integer department_id;
private Integer pos_id;
private String pos_id;
private String username;
private String nickname;
private String mobile;
... ... @@ -59,11 +59,11 @@ public class LoginBean {
this.department_id = department_id;
}
public Integer getPos_id() {
public String getPos_id() {
return pos_id;
}
public void setPos_id(Integer pos_id) {
public void setPos_id(String pos_id) {
this.pos_id = pos_id;
}
... ...
... ... @@ -8,6 +8,8 @@ import com.br_technology.securitytrain_master.ui.view.bank.fragment.BankFragment
import com.br_technology.securitytrain_master.ui.view.home.fragment.HomeFragment
import com.br_technology.securitytrain_master.ui.view.main.viewmodel.MainViewModel
import com.br_technology.securitytrain_master.ui.view.mine.fragment.MineFragment
import com.br_technology.securitytrain_master.util.company_is_check
import com.br_technology.securitytrain_master.util.is_set_face
import com.gyf.immersionbar.ImmersionBar
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -49,6 +51,10 @@ class MainActivity :
}
override fun initDataObserver() {
mViewModel.mMineInfoBean.observe(this, {
company_is_check = it.data.info.company_check_face.equals("0") // 0为关闭人脸检测
is_set_face = it.data.info.is_check_face.equals("1")
})
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,12 @@ package com.br_technology.securitytrain_master.ui.view.main.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
/**
* createTime:2021/7/27 14:51
... ... @@ -10,4 +15,19 @@ import com.br_technology.securitytrain_master.base.repository.ApiRepository
* des:
*/
class MainRepository(val loadState: MutableLiveData<State>): ApiRepository(loadState) {
fun getMineInfo(
liveData: MutableLiveData<BaseResponse<MineInfoBean>>
) {
apiService.getMineInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
BaseObserver(
liveData,
loadState,
this
)
)
}
}
\ No newline at end of file
... ...
... ... @@ -2,11 +2,13 @@ package com.br_technology.securitytrain_master.ui.view.main.viewmodel
import androidx.fragment.app.Fragment
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.view.bank.fragment.BankFragment
import com.br_technology.securitytrain_master.ui.view.home.fragment.HomeFragment
import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
import com.br_technology.securitytrain_master.ui.view.main.repository.MainRepository
import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean
import com.br_technology.securitytrain_master.ui.view.mine.fragment.MineFragment
/**
... ... @@ -15,15 +17,21 @@ import com.br_technology.securitytrain_master.ui.view.mine.fragment.MineFragment
* des:
*/
class MainViewModel : BaseViewModel<MainRepository>() {
var mMineInfoBean: MutableLiveData<BaseResponse<MineInfoBean>> = MutableLiveData()
fun getMineInfo() {
mRepository.getMineInfo(mMineInfoBean)
}
val liveData: MutableLiveData<List<Fragment>> by lazy {
MutableLiveData()
}
val pos_id_get: MutableLiveData<LoginBean> = MutableLiveData()
init {
val list = listOf(HomeFragment(), BankFragment(), MineFragment())
liveData.postValue(list as List<Fragment>?)
getMineInfo()
}
}
\ No newline at end of file
... ...
... ... @@ -70,7 +70,7 @@ class AcademicFeedbackActivity :
iChat = object : AcademicFeedbackAdapter.IChat {
override fun chat(teacherId: String) {
val intent = Intent(baseContext, ChatActivity::class.java)
intent.putExtra("id", teacherId.toInt())
intent.putExtra("id", teacherId)
startActivity(intent)
}
}
... ...
... ... @@ -33,7 +33,7 @@ class ChatActivity :
ChatAdapter()
}
private var page = 1
private var teacherId = -1
private var teacherId = ""
override fun initDataObserver() {
mViewModel.detailLiveData.observe(this) {
... ... @@ -69,7 +69,7 @@ class ChatActivity :
.init()
// 教师id
teacherId = intent.getIntExtra("id", -1)
teacherId = intent.getStringExtra("id")?:""
// 请求网络
mViewModel.msgDetail(page, teacherId)
binding.apply {
... ...
... ... @@ -56,7 +56,7 @@ class ChatRecordActivity :
chatRecordAdapter.setOnItemClickListener { _, _, position ->
val id = chatRecordAdapter.data[position].teacher_id
val intent = Intent(baseContext,ChatActivity::class.java)
intent.putExtra("id",id)
intent.putExtra("id",id.toString())
startActivity(intent)
}
}
... ...
... ... @@ -15,12 +15,15 @@ import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityClassDutyBinding
import com.br_technology.securitytrain_master.ext.initPermissions
import com.br_technology.securitytrain_master.ui.view.home.adapter.StatusName
import com.br_technology.securitytrain_master.ui.view.home.event.ClazzChangeEvent
import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent
import com.br_technology.securitytrain_master.ui.view.mine.fragment.ClassDutyCourseFragment
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyViewModel
import com.br_technology.securitytrain_master.util.CameraUtil
import com.br_technology.securitytrain_master.util.FaceUtil
import com.br_technology.securitytrain_master.util.company_is_check
import com.br_technology.securitytrain_master.view.DialogCheckIDCard
import com.br_technology.securitytrain_master.view.DialogClassList
import com.br_technology.securitytrain_master.view.DialogTrainLoading
import com.br_technology.securitytrain_master.view.StatusPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
... ... @@ -43,6 +46,7 @@ class ClassDutyActivity :
private val faceUtil = FaceUtil()
private var dialogLoading: DialogTrainLoading? = null
private var isChecked = false
private var dialogClassList: DialogClassList? = null
fun showDialogId() {
if (dialogId == null) {
... ... @@ -64,13 +68,23 @@ class ClassDutyActivity :
}
},
onDenied = {
}, onDeniedNever = {
dialogId!!.dismiss()
},
onDeniedNever = {
dialogId!!.dismiss()
})
})
}
dialogId!!.show()
}
@Subscribe
fun selectClazz(clazzId: ClazzChangeEvent) {
if (dialogClassList != null) {
dialogClassList?.dismiss()
}
}
private fun dialogLoading() {
if (dialogLoading == null) {
dialogLoading = DialogTrainLoading(this)
... ... @@ -103,6 +117,7 @@ class ClassDutyActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
EventBus.getDefault().register(this)
mViewModel.getClazzList()
}
override fun onDestroy() {
... ... @@ -116,6 +131,12 @@ class ClassDutyActivity :
}
override fun initDataObserver() {
mViewModel.mClazzList.observe(this, {
runOnUiThread {
dialogClassList = DialogClassList(this@ClassDutyActivity, it.data.list)
dialogClassList?.show()
}
})
mViewModel.mFaceFile.observe(this, {
it.let {
if (!TextUtils.isEmpty(it.data.fullurl)) {
... ... @@ -186,6 +207,6 @@ class ClassDutyActivity :
}
fun isChecked(): Boolean {
return isChecked
return isChecked || company_is_check
}
}
\ No newline at end of file
... ...
... ... @@ -36,8 +36,8 @@ class CredentialsUpLoadActivity :
private var path: String = ""
private var dateTime: String = ""
private var typeId: Int = 0
private var id: Int? = 0
private var typeId: String = ""
private var id: String = ""
private var endTime: String? = ""
private val certTypeAdapter: CertTypeAdapter by lazy {
CertTypeAdapter()
... ... @@ -90,11 +90,6 @@ class CredentialsUpLoadActivity :
binding.certTypeTv.text = user.cert.name
}
id = if (id == 0) {
null
} else {
id
}
endTime = if (endTime?.isEmpty() == true) {
null
} else {
... ... @@ -110,7 +105,7 @@ class CredentialsUpLoadActivity :
tvUpload.isClickable = true
return@setOnClickListener
}
if (typeId == 0) {
if (typeId == "") {
tvUpload.isClickable = true
showTip("请选择证件类型")
return@setOnClickListener
... ...
... ... @@ -46,7 +46,7 @@ class MyCredentialsDetailActivity :
override fun onResume() {
super.onResume()
val id = intent.getIntExtra("id", -1)
mViewModel.certDetail(id)
val id = intent.getStringExtra("id")
mViewModel.certDetail(id?:"")
}
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ class QuestionRecordActivity :
SpecialExercisesFragment.newInstance(5),
SpecialExercisesFragment.newInstance(6)
)
val titles = listOf("专项练习", "培训计划考试", "培训计划联系", "模拟考试")
val titles = listOf("专项练习", "培训计划考试", "培训计划练习", "模拟考试")
searchResultAdapter.addData(list.toMutableList())
searchResultAdapter.addTitle(titles)
viewPager.adapter = searchResultAdapter
... ...
... ... @@ -69,7 +69,7 @@ public class AcademicFeedbackBean {
private Integer id;
private Integer company_id;
private Integer train_id;
private Integer train_class_id;
private String train_class_id;
private Integer user_id;
private Integer teacher_id;
private Integer class_hours;
... ... @@ -114,11 +114,11 @@ public class AcademicFeedbackBean {
this.train_id = train_id;
}
public Integer getTrain_class_id() {
public String getTrain_class_id() {
return train_class_id;
}
public void setTrain_class_id(Integer train_class_id) {
public void setTrain_class_id(String train_class_id) {
this.train_class_id = train_class_id;
}
... ...
... ... @@ -9,7 +9,7 @@ import com.chad.library.adapter.base.entity.MultiItemEntity
* updateInfo:
*/
data class ChatRecordBean(
val id: Int,
val id: String,
val is_read: String,
val last_content: String,
val teacher: Teacher,
... ... @@ -30,14 +30,14 @@ data class ChatDetailBean(
val content: String,
val create_time: String,
val delete_time: String,
val from_id: Int,
val from_id: String,
val from_id_type: String,
val from_id_type_text: String,
val id: Int,
val id: String,
val is_read: String,
val is_read_text: String,
val is_show_time: Int,
val msg_id: Int,
val to_id: Int,
val msg_id: String,
val to_id: String,
val update_time: String, override var itemType: Int
) : MultiItemEntity
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.base.common.ConstantType
import com.br_technology.securitytrain_master.databinding.FragmentClassDutyCourseBinding
... ... @@ -13,6 +14,7 @@ import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CoursePractiseActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.event.ClazzChangeEvent
import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent
import com.br_technology.securitytrain_master.ui.view.mine.activity.ClassDutyActivity
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
... ... @@ -20,6 +22,7 @@ import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter
import com.br_technology.securitytrain_master.ui.view.mine.adapter.TrainTestAdapter
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel
import com.br_technology.securitytrain_master.util.TranslateUnit
import com.br_technology.securitytrain_master.util.current_class_id
import com.br_technology.securitytrain_master.view.DialogMention
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import org.greenrobot.eventbus.EventBus
... ... @@ -65,6 +68,11 @@ class ClassDutyCourseFragment(val type: Int) :
refreshData()
}
@Subscribe
fun selectClazz(clazzId: ClazzChangeEvent) {
refreshData()
}
private fun boolData(boolean: Boolean) {
if (boolean) {
binding.layData.visibility = View.VISIBLE
... ... @@ -180,11 +188,17 @@ class ClassDutyCourseFragment(val type: Int) :
}
private fun refreshData() {
if (current_class_id == "") {
return
}
page = 1
getData()
}
private fun loadMore() {
if (current_class_id == "") {
return
}
page++
getData()
}
... ... @@ -252,8 +266,12 @@ class ClassDutyCourseFragment(val type: Int) :
if (activity is ClassDutyActivity) {
val classDutyActivity = activity as ClassDutyActivity
if (!classDutyActivity.isChecked()) {
classDutyActivity.showDialogId()
return
if (classDutyActivity.hasSetFace()) {
classDutyActivity.showDialogId()
return
} else {
classDutyActivity.toastSetFace()
}
}
}
try {
... ... @@ -279,6 +297,14 @@ class ClassDutyCourseFragment(val type: Int) :
}
fun startNext(item: TrainTestData) {
if (item.isTest && item.exam?.count!! <= 0) {
Toast.makeText(activity, "该考试暂无题目", Toast.LENGTH_SHORT).show()
return
}
if (item.isTest && item.practice?.count!! <= 0) {
Toast.makeText(activity, "该练习暂无题目", Toast.LENGTH_SHORT).show()
return
}
this@ClassDutyCourseFragment.startActivity(
Intent(
requireActivity(),
... ... @@ -303,6 +329,10 @@ class ClassDutyCourseFragment(val type: Int) :
url = response.playback_url
}
if (status == "1") {
if (!(activity as ClassDutyActivity).isChecked()) {
(activity as ClassDutyActivity).showDialogId()
return
}
url = response.playerUrl
}
val title = response.name
... ...
... ... @@ -63,7 +63,7 @@ class DatabaseFragment :
override fun onClick(position: Int, data: FavoriteData) {
this@DatabaseFragment.startActivity(
Intent(requireActivity(), DatabaseDetailActivity::class.java)
.putExtra(ConstantParamKey.DOC_ID, data.object_id.toInt())
.putExtra(ConstantParamKey.DOC_ID, data.object_id)
)
}
})
... ...
... ... @@ -7,6 +7,8 @@ import com.br_technology.securitytrain_master.databinding.FragmentMineBinding
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.MineViewModel
import com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity
import com.br_technology.securitytrain_master.ui.view.mine.activity.*
import com.br_technology.securitytrain_master.util.company_is_check
import com.br_technology.securitytrain_master.util.is_set_face
import com.br_technology.securitytrain_master.util.token
import com.br_technology.securitytrain_master.view.DialogSureCancel
import com.br_technology.securitytrain_master.view.listener.DialogListener
... ... @@ -36,6 +38,8 @@ class MineFragment
.placeholder(R.mipmap.placeholder_head).into(binding.ivIcon)
identity = it.data.info.identity
binding.departmentName.text = it.data.info.department_name.plus(" - ").plus(it.data.info.pos_name)
company_is_check = it.data.info.company_check_face.equals("0") // 0为关闭人脸检测
is_set_face = it.data.info.is_check_face.equals("1");
})
mViewModel.mCommonBean.observe(this,{
... ...
... ... @@ -2,11 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.mine.fragment
import android.content.Intent
import android.os.Bundle
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.FragmentMyErrorQuestionBinding
import com.br_technology.securitytrain_master.ui.bean.ErrorListItem
import com.br_technology.securitytrain_master.ui.view.bank.activity.WrongQuestionsActivity
import com.br_technology.securitytrain_master.ui.view.home.pojo.VideoCourse
import com.br_technology.securitytrain_master.ui.view.mine.adapter.MyErrorQuestionAdapter
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.MyErrorQuestionFragmentViewModel
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
... ... @@ -66,7 +64,7 @@ class MyErrorQuestionFragment :
questionAdapter.setOnItemChildClickListener { adapter, view, position ->
val errorListItem = adapter.data.get(position) as ErrorListItem
mViewModel.delError(
errorListItem.item_id.toInt(),
errorListItem.item_id,
type,
errorListItem.item_type.toInt()
)
... ...
... ... @@ -2,11 +2,11 @@ package com.br_technology.securitytrain_master.ui.view.mine.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.view.mine.bean.AcademicFeedbackBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.AcademicFeedbackDetailBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
... ... @@ -35,7 +35,7 @@ class AcademicFeedbackRepository(val loadState: MutableLiveData<State>) : ApiRep
}
fun academicFeedbackDetail(
train_class_id: Int,
train_class_id: String,
liveData: MutableLiveData<BaseResponse<AcademicFeedbackDetailBean>>
) {
apiService.academicFeedbackDetail(train_class_id)
... ...
... ... @@ -2,11 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.mine.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDataList
import com.br_technology.securitytrain_master.base.network.response.CommonDetail
import com.br_technology.securitytrain_master.base.network.response.CommonPage
import com.br_technology.securitytrain_master.base.network.response.*
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.bean.ClazzBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.ChatDetailBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.ChatRecordBean
... ... @@ -18,6 +16,14 @@ import com.br_technology.securitytrain_master.ui.view.mine.bean.ChatRecordBean
*/
class ChatRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
fun getClazzList(
liveData: MutableLiveData<BaseResponse<CommonList<ClazzBean>>>
) {
addRequest(
userService.getClazzList(),
liveData
)
}
fun msgList(
page: Int,
... ... @@ -28,7 +34,7 @@ class ChatRepository(val loadState: MutableLiveData<State>) : ApiRepository(load
fun msgDetail(
page: Int,
teacherId: Int,
teacherId: String,
liveData: MutableLiveData<BaseResponse<CommonDetail<CommonPage<ChatDetailBean>>>>
) {
addRequest(userService.msgDetail(page, 10, teacherId), liveData)
... ... @@ -36,7 +42,7 @@ class ChatRepository(val loadState: MutableLiveData<State>) : ApiRepository(load
fun sendMsg(
content: String,
teacherId: Int,
teacherId: String,
liveData: MutableLiveData<BaseResponse<Any>>
) {
addRequest(userService.sendMsg(teacherId, content), liveData)
... ...
... ... @@ -4,7 +4,6 @@ import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDataList
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.network.response.CommonPage
import com.br_technology.securitytrain_master.base.repository.ApiRepository
import com.br_technology.securitytrain_master.ui.bean.ErrorListItem
... ... @@ -28,7 +27,7 @@ class MyErrorQuestionFragmentRepository(val loadState: MutableLiveData<State>) :
//删除错题
fun delError(
item_id: Int,
item_id: String,
type: Int,
item_type: Int,
liveData: MutableLiveData<BaseResponse<Void>>
... ...
package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.view.mine.bean.AcademicFeedbackBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.AcademicFeedbackDetailBean
import com.br_technology.securitytrain_master.ui.view.mine.repository.AcademicFeedbackRepository
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
/**
* Time: 8/2/2021 14:29
... ... @@ -21,7 +21,7 @@ class AcademicFeedbackViewModel : BaseViewModel<AcademicFeedbackRepository>() {
var mAcademicFeedbackDetailBean: MutableLiveData<BaseResponse<AcademicFeedbackDetailBean>> = MutableLiveData()
fun academicFeedbackDetail(train_class_id: Int) {
fun academicFeedbackDetail(train_class_id: String) {
mRepository.academicFeedbackDetail(train_class_id, mAcademicFeedbackDetailBean)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDataList
import com.br_technology.securitytrain_master.base.network.response.CommonDetail
import com.br_technology.securitytrain_master.base.network.response.CommonPage
import com.br_technology.securitytrain_master.base.network.response.*
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.ClazzBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.ChatDetailBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.ChatRecordBean
import com.br_technology.securitytrain_master.ui.view.mine.repository.ChatRepository
... ... @@ -23,17 +21,23 @@ class ChatRecordViewModel : BaseViewModel<ChatRepository>() {
val detailLiveData: MutableLiveData<BaseResponse<CommonDetail<CommonPage<ChatDetailBean>>>> =
MutableLiveData()
val sendLiveData: MutableLiveData<BaseResponse<Any>> = MutableLiveData()
val listClazz = MutableLiveData<BaseResponse<CommonList<ClazzBean>>>()
fun msgList(page: Int) {
mRepository.msgList(page, liveData)
}
fun msgDetail(page: Int, teacherId: Int) {
fun getClazzList() {
mRepository.getClazzList(listClazz)
}
fun msgDetail(page: Int, teacherId: String) {
mRepository.msgDetail(page, teacherId, detailLiveData)
}
fun sendMsg(content: String, teacherId: Int) {
fun sendMsg(content: String, teacherId: String) {
mRepository.sendMsg(content, teacherId, sendLiveData)
}
}
\ No newline at end of file
... ...
... ... @@ -2,8 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.repository.TrainRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.ClazzBean
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
/**
... ... @@ -14,6 +16,11 @@ import com.br_technology.securitytrain_master.ui.bean.UploadFileData
class ClassDutyViewModel : BaseViewModel<TrainRepository>() {
var mFaceFile = MutableLiveData<BaseResponse<UploadFileData>>()
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
var mClazzList = MutableLiveData<BaseResponse<CommonList<ClazzBean>>>()
fun getClazzList() {
mRepository.getClazzList(mClazzList)
}
fun uploadFace(filePath: String) {
mRepository.uploadFile(filePath, mFaceFile)
... ...
... ... @@ -7,7 +7,6 @@ import com.br_technology.securitytrain_master.base.repository.UserRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.CertType
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
import com.br_technology.securitytrain_master.ui.view.mine.repository.CredentialsUpLoadRepository
/**
* Time: 8/2/2021 13:56
... ... @@ -32,8 +31,8 @@ class CredentialsUpLoadViewModel : BaseViewModel<UserRepository>() {
}
fun certAdd(
id: Int?,
cert_id: Int,
id: String?,
cert_id: String,
image: String,
start_time: String,
end_time: String?
... ...
... ... @@ -45,11 +45,27 @@ class DatabaseFViewModel : BaseViewModel<DocRepository>() {
fun getDataList(page: Int) {
type.value?.let {
sortSecond.value?.let { it1 ->
mRepository.getDocList(
it,
it1.id, "", page, 10, classifyDataList
)
if (sortSecond.value != null) {
sortSecond.value?.let { it1 ->
mRepository.getDocList(
it,
it1.id, "", page, 10, classifyDataList
)
}
} else if (sortChild.value != null) {
sortChild.value?.let { it1 ->
mRepository.getDocList(
it,
it1.id, "", page, 10, classifyDataList
)
}
} else {
selectClassify.value?.let { it1 ->
mRepository.getDocList(
it,
it1.id, "", page, 10, classifyDataList
)
}
}
}
}
... ...
... ... @@ -6,7 +6,6 @@ import com.br_technology.securitytrain_master.base.network.response.CommonDetail
import com.br_technology.securitytrain_master.base.repository.UserRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.UserCertDetail
import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredentialsDetailRepository
/**
* Time: 8/2/2021 11:42
... ... @@ -15,7 +14,7 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredenti
*/
class MyCredentialDetailViewModel : BaseViewModel<UserRepository>() {
val liveData: MutableLiveData<BaseResponse<CommonDetail<UserCertDetail>>> = MutableLiveData()
fun certDetail(id:Int){
fun certDetail(id:String){
mRepository.certDetail(id,liveData)
}
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDataList
import com.br_technology.securitytrain_master.base.network.response.CommonList
import com.br_technology.securitytrain_master.base.network.response.CommonPage
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.ErrorListItem
... ... @@ -29,7 +28,7 @@ class MyErrorQuestionFragmentViewModel : BaseViewModel<MyErrorQuestionFragmentRe
//删除错题
fun delError(
item_id: Int,
item_id: String,
type: Int,
item_type: Int,
) {
... ...