|
@@ -11,36 +11,28 @@ import android.view.View
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.yingyang.healthconsultation.R
|
|
|
import com.yingyang.healthconsultation.databinding.ActivityDoctorDetailsBinding
|
|
|
-import com.yingyang.healthconsultation.entity.ConsultationBean
|
|
|
-import com.yingyangfly.baselib.base.BaseActivity
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
+import com.yingyangfly.baselib.ext.toast
|
|
|
+import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
|
|
|
/**
|
|
|
* 医生详情
|
|
|
*/
|
|
|
@Route(path = RouterUrlCommon.doctorDetails)
|
|
|
-class DoctorDetailsActivity : BaseActivity<ActivityDoctorDetailsBinding>(), View.OnTouchListener {
|
|
|
+class DoctorDetailsActivity :
|
|
|
+ BaseMVVMActivity<ActivityDoctorDetailsBinding, DoctorDetailsViewModel>(), View.OnTouchListener {
|
|
|
|
|
|
- private var doctorDetails: ConsultationBean? = null
|
|
|
+ private var id: String = ""
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
- doctorDetails = intent.getSerializableExtra("doctorDetails") as ConsultationBean
|
|
|
+ id = intent.getStringExtra("url") ?: ""
|
|
|
super.onCreate(savedInstanceState)
|
|
|
}
|
|
|
|
|
|
override fun initViews() {
|
|
|
- if (doctorDetails != null) {
|
|
|
- binding.data = doctorDetails
|
|
|
- val consultationTotal = "咨询量:" + doctorDetails!!.getConsultationTotalInfo()
|
|
|
- val totalSpannableString = SpannableString(consultationTotal)
|
|
|
- totalSpannableString.setSpan(
|
|
|
- ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
|
|
|
- 4, totalSpannableString.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
- )
|
|
|
- binding.tvConsult.text = totalSpannableString
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
@@ -51,7 +43,22 @@ class DoctorDetailsActivity : BaseActivity<ActivityDoctorDetailsBinding>(), View
|
|
|
}
|
|
|
|
|
|
override fun initData() {
|
|
|
-
|
|
|
+ if (id.isNotEmpty()) {
|
|
|
+ viewModel.getDoctorDetail(id, fail = {
|
|
|
+ it.toast()
|
|
|
+ }, success = {
|
|
|
+ if (it != null) {
|
|
|
+ binding.data = it
|
|
|
+ val consultationTotal = "咨询量:" + it.consultationTotal
|
|
|
+ val totalSpannableString = SpannableString(consultationTotal)
|
|
|
+ totalSpannableString.setSpan(
|
|
|
+ ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
|
|
|
+ 4, totalSpannableString.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
+ )
|
|
|
+ binding.tvConsult.text = totalSpannableString
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|