实现了热量值计算
This commit is contained in:
@@ -5,9 +5,10 @@ import com.arcsoft.face.ErrorInfo
|
||||
import com.sw.dualscreen.GlobalData
|
||||
import com.sw.dualscreen.GlobalKey
|
||||
import com.sw.dualscreen.model.request.UserNutritionParam
|
||||
import com.sw.dualscreen.model.response.DinnerTypeInfo
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.NutritionData
|
||||
import com.sw.dualscreen.model.response.UserFaceModel
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.inbound.utils.SPUtil
|
||||
import com.sw.plate.App
|
||||
import com.sw.plate.utils.Base64
|
||||
@@ -35,8 +36,15 @@ class UserViewModel : BaseViewModel() {
|
||||
val searchFoodInfoList: StateFlow<List<FoodInfo>> = _searchFoodInfoList
|
||||
|
||||
// 就餐数据
|
||||
private val _nutritionData = MutableStateFlow<NutritionData?>(null)
|
||||
val nutritionData: StateFlow<NutritionData?> = _nutritionData
|
||||
private val _nutritionData = MutableStateFlow<UserNutritionData?>(null)
|
||||
val nutritionData: StateFlow<UserNutritionData?> = _nutritionData
|
||||
|
||||
/**
|
||||
* 饭点类型
|
||||
*/
|
||||
private val _dinnerTypeInfo = MutableStateFlow<DinnerTypeInfo?>(null)
|
||||
val dinnerTypeInfo: StateFlow<DinnerTypeInfo?> = _dinnerTypeInfo
|
||||
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
@@ -179,6 +187,16 @@ class UserViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getDinnerType() {
|
||||
Timber.d("getDinnerType")
|
||||
launchWithLoading {
|
||||
val response = repository.getDinnerType()
|
||||
if (parseResponse(response)) {
|
||||
_dinnerTypeInfo.value = response.result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交就餐数据
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user