Browse Source

1.添加验证码登录接口

王鹏鹏 2 years ago
parent
commit
95a5d874dd

+ 2 - 10
healthconsultation/src/main/java/com/yingyang/healthconsultation/adapter/RecommendDoctorAdapter.kt

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
 import android.graphics.Color
 import android.text.SpannableString
 import android.text.Spanned
-import android.text.TextUtils
 import android.text.style.ForegroundColorSpan
 import android.view.MotionEvent
 import com.yingyang.healthconsultation.R
@@ -29,7 +28,7 @@ class RecommendDoctorAdapter(override val layoutId: Int = R.layout.item_recommen
         position: Int
     ) {
         binding.data = item
-        val price = "单次:¥" + item.price
+        val price = "单次:¥" + item.priceInfo()
         val priceSpannableString = SpannableString(price)
         priceSpannableString.setSpan(
             ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
@@ -37,20 +36,13 @@ class RecommendDoctorAdapter(override val layoutId: Int = R.layout.item_recommen
         )
         binding.tvPrice.text = priceSpannableString
 
-        val consultationTotal = "咨询量:" + item.consultationTotal
+        val consultationTotal = "咨询量:" + item.getConsultationTotalInfo()
         val spannableString = SpannableString(consultationTotal)
         spannableString.setSpan(
             ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
             3, spannableString.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
         )
         binding.tvConsult.text = spannableString
-
-        binding.tvStatus.text = if (TextUtils.equals("0", item.isOnline)) {
-            "在线"
-        } else {
-            "离线"
-        }
-
         binding.btnConsultation.setOnTouchListener { v, event ->
             when (event.action) {
                 MotionEvent.ACTION_DOWN -> {

+ 11 - 0
healthconsultation/src/main/java/com/yingyang/healthconsultation/doctordetails/DoctorDetailsActivity.kt

@@ -2,7 +2,11 @@ package com.yingyang.healthconsultation.doctordetails
 
 import android.annotation.SuppressLint
 import android.content.Intent
+import android.graphics.Color
 import android.os.Bundle
+import android.text.SpannableString
+import android.text.Spanned
+import android.text.style.ForegroundColorSpan
 import android.view.MotionEvent
 import android.view.View
 import com.alibaba.android.arouter.facade.annotation.Route
@@ -30,6 +34,13 @@ class DoctorDetailsActivity : BaseActivity<ActivityDoctorDetailsBinding>(), View
     override fun initViews() {
         if (doctorDetails != null) {
             binding.data = doctorDetails
+            val consultationTotal = "咨询量:" + doctorDetails!!.consultationTotal
+            val totalSpannableString = SpannableString(consultationTotal)
+            totalSpannableString.setSpan(
+                ForegroundColorSpan(Color.parseColor("#FF4A76FF")),
+                4, totalSpannableString.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
+            )
+            binding.tvPrice.text = totalSpannableString
         }
     }
 

+ 78 - 30
healthconsultation/src/main/java/com/yingyang/healthconsultation/entity/ConsultationBean.kt

@@ -1,38 +1,86 @@
 package com.yingyang.healthconsultation.entity
 
+import android.text.TextUtils
 import java.io.Serializable
 
 /**
  * 在在咨询bean
  */
-class ConsultationBean: Serializable {
-    val avatar: String? = null//头像地址
-    val certificate: String? = null//医生资格证
-    val consultationTotal: String? = null//问诊量
-    val createBy: String? = null
-    val createTime: String? = null
-    val departmentName: String? = null//所属部门
-    val email: String? = null//用户邮箱
-    val goodRate: String? = null//好评率
-    val id: String? = null//用户ID
-    val idCard: String? = null//身份证号
-    val isDoctor: String? = null//是否医生 0是 1否
-    val isOnline: String? = null//是否在线 0是 1否
-    val limit: String? = null
-    val mobile: String? = null//手机号码
-    val nickName: String? = null//用户昵称
-    val orgCode: String? = null
-    val orgName: String? = null//机构名字
-    val page: String? = null
-    val password: String? = null//密码
-    val price: String? = null//单价
-    val remark: String? = null//备注
-    val roleCodes: String? = null//用户关联的所有的角色,用逗号分隔
-    val sex: String? = null//用户性别(0男 1女 2未知)
-    val speciality: String? = null//擅长
-    val status: String? = null//帐号状态(0正常 1停用 2删除)
-    val title: String? = null//职称
-    val updateBy: String? = null
-    val updateTime: String? = null
-    val userName: String? = null//用户账号
+class ConsultationBean : Serializable {
+    val avatar: String = ""//头像地址
+    val certificate: String = ""//医生资格证
+    val consultationTotal: String = ""//问诊量
+    val createBy: String = ""
+    val createTime: String = ""
+    val departmentName: String = ""//所属部门
+    val goodRate: String = ""//好评率
+    val id: String = ""//用户ID
+    val idCard: String = ""//身份证号
+    val isDoctor: String = ""//是否医生 0是 1否
+    val isOnline: String = ""//是否在线 0是 1否
+    val limit: String = ""
+    val mobile: String = ""//手机号码
+    val nickName: String = ""//用户昵称
+    val orgCode: String = ""
+    val orgName: String = ""//机构名字
+    val page: String = ""
+    val password: String = ""//密码
+    val price: String = ""//单价
+    val remark: String = ""//备注
+    val roleCodes: String = ""//用户关联的所有的角色,用逗号分隔
+    val sex: String = ""//用户性别(0男 1女 2未知)
+    val speciality: String = ""//擅长
+    val status: String = ""//帐号状态(0正常 1停用 2删除)
+    val title: String = ""//职称
+    val updateBy: String = ""
+    val updateTime: String = ""
+    val userName: String = ""//用户账号
+
+    fun titleInfo(): String {
+        return if (title.isNullOrEmpty()) {
+            ""
+        } else {
+            title
+        }
+    }
+
+    fun departmentNameInfo(): String {
+        return if (departmentName.isNullOrEmpty()) {
+            ""
+        } else {
+            " $departmentName"
+        }
+    }
+
+    fun priceInfo(): String {
+        return if (price.isNullOrEmpty()) {
+            ""
+        } else {
+            price
+        }
+    }
+
+    fun getConsultationTotalInfo(): String {
+        return if (consultationTotal.isNullOrEmpty()) {
+            ""
+        } else {
+            consultationTotal
+        }
+    }
+
+    fun getGoodRateInfo(): String {
+        return if (goodRate.isNullOrEmpty()) {
+            ""
+        } else {
+            goodRate
+        }
+    }
+
+    fun getIsOnlineStatus(): String {
+        return if (TextUtils.equals("0", isOnline)) {
+            "在线"
+        } else {
+            "离线"
+        }
+    }
 }

+ 2 - 1
healthconsultation/src/main/res/layout/activity_doctor_details.xml

@@ -94,6 +94,7 @@
                     android:layout_marginTop="@dimen/divider_141px"
                     android:background="@drawable/bg_doctor_status"
                     android:gravity="center"
+                    android:text="@{data.getIsOnlineStatus()}"
                     android:textColor="@android:color/white"
                     android:textSize="@dimen/divider_24px"
                     app:layout_constraintStart_toStartOf="parent"
@@ -158,7 +159,7 @@
                     android:layout_height="wrap_content"
                     android:layout_marginTop="@dimen/divider_23px"
                     android:layout_marginEnd="@dimen/divider_26px"
-                    android:text='@{"好评率"+data.goodRate}'
+                    android:text='@{"好评率"+data.getGoodRateInfo()}'
                     android:textColor="@color/color_FFFF9E05"
                     android:textSize="@dimen/divider_24px"
                     app:layout_constraintEnd_toEndOf="parent"

+ 2 - 1
healthconsultation/src/main/res/layout/item_recommend_doctor.xml

@@ -34,6 +34,7 @@
             android:layout_marginBottom="@dimen/divider_27px"
             android:background="@drawable/bg_doctor_status"
             android:gravity="center"
+            android:text="@{data.getIsOnlineStatus()}"
             android:textColor="@android:color/white"
             android:textSize="@dimen/divider_24px"
             app:layout_constraintBottom_toBottomOf="parent"
@@ -59,7 +60,7 @@
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/divider_40px"
             android:layout_marginTop="@dimen/divider_36px"
-            android:text='@{data.title+":"+data.departmentName}'
+            android:text='@{data.titleInfo()+data.departmentNameInfo()}'
             android:textColor="@color/color_FF333333"
             android:textSize="@dimen/divider_24px"
             app:layout_constraintStart_toEndOf="@+id/tvName"