You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
csamsclient/background/src/main/java/com/gyf/csams/main/model/CheckActViewModel.kt

46 lines
1.1 KiB

package com.gyf.csams.main.model
import android.app.Application
import androidx.lifecycle.viewModelScope
import com.gyf.lib.model.ApplyViewModel
import com.gyf.lib.util.ApplyActVo
import com.gyf.lib.util.format
import com.gyf.lib.util.randomChinese
import com.gyf.lib.util.randomDateTime
import kotlinx.coroutines.launch
/**
* 活动数据管理
*
*/
class CheckActViewModel(application: Application) : ApplyViewModel<ApplyActVo>(application) {
override val initSize: Int = 10
init {
load()
}
fun load() {
viewModelScope.launch {
_data.value?.apply {
repeat(initSize) {
add(
ApplyActVo(
activityName = randomChinese(5),
activityTime = randomDateTime().format(),
location = randomChinese(10),
desc = randomChinese(10),
size = 10
)
)
}
}
}
}
fun loadMore(callback: (message: String) -> Unit) {
TODO("Not yet implemented")
}
}