社团主界面设置下拉菜单

题库界面拆分为入团申请表和入团题库
master
pan 4 years ago
parent 707684bda3
commit 31e1d9fd92
  1. 28
      app/src/main/java/com/gyf/csams/association/model/ExamViewModel.kt

@ -2,8 +2,10 @@ package com.gyf.csams.association.model
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.gyf.csams.uikit.ScrollList import com.gyf.csams.uikit.ScrollList
import com.gyf.csams.uikit.StringForm import com.gyf.csams.uikit.StringForm
import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
/** /**
@ -174,20 +176,22 @@ class ExamViewModel:ScrollList<Exam>() {
* *
*/ */
override fun load() { override fun load() {
_data.value?.apply { viewModelScope.launch {
repeat(initSize) { _data.value?.apply {
if (Random.nextBoolean()){ repeat(initSize) {
add(OpenQuestionsVo(question = StringForm(formDesc = "问题",textLength = QUESTION_TEXT_LENGTH,value = "这是一道开放题:$size"))) if (Random.nextBoolean()){
} else{ add(OpenQuestionsVo(question = StringForm(formDesc = "问题",textLength = QUESTION_TEXT_LENGTH,value = "这是一道开放题:$size")))
add( } else{
ChoiceQuestionVo( add(
question = StringForm(formDesc = "问题",textLength = QUESTION_TEXT_LENGTH,value = "这是一道选择题:$size"), ChoiceQuestionVo(
answers = ('A'..'D').map { StringForm(formDesc = "选项",textLength = ANSWER_TEXT_LENGTH,value = "选项$it") }, question = StringForm(formDesc = "问题",textLength = QUESTION_TEXT_LENGTH,value = "这是一道选择题:$size"),
rightAnswer = Random.nextInt(ANSWER_SIZE) answers = ('A'..'D').map { StringForm(formDesc = "选项",textLength = ANSWER_TEXT_LENGTH,value = "选项$it") },
rightAnswer = Random.nextInt(ANSWER_SIZE)
)
) )
) }
}
}
} }
} }
} }

Loading…
Cancel
Save