|
@@ -1,15 +1,24 @@
|
|
|
package com.yingyang.healthconsultation.record
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
+import android.os.Bundle
|
|
|
import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
|
+import com.tencent.imsdk.v2.V2TIMConversation
|
|
|
+import com.tencent.qcloud.tuicore.TUIConstants
|
|
|
+import com.tencent.qcloud.tuicore.TUICore
|
|
|
+import com.tencent.qcloud.tuicore.TUILogin
|
|
|
+import com.tencent.qcloud.tuicore.interfaces.TUICallback
|
|
|
import com.yingyang.healthconsultation.R
|
|
|
import com.yingyang.healthconsultation.adapter.ConsultationRecordAdapter
|
|
|
import com.yingyang.healthconsultation.databinding.ActivityConsultationRecordBinding
|
|
|
+import com.yingyang.healthconsultation.dialog.EvaluateDialog
|
|
|
import com.yingyang.healthconsultation.entity.ConsultationRecordsBean
|
|
|
import com.yingyang.healthconsultation.entity.PurchaseConsultationBean
|
|
|
+import com.yingyangfly.baselib.config.AccountConfig
|
|
|
+import com.yingyangfly.baselib.db.DoctorBean
|
|
|
import com.yingyangfly.baselib.dialog.TipsDialog
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
@@ -19,6 +28,7 @@ import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
import com.yingyangfly.baselib.utils.JumpUtil
|
|
|
import com.yingyangfly.baselib.utils.RxBusCodes
|
|
|
+import com.yingyangfly.baselib.utils.User
|
|
|
import gorden.rxbus2.Subscribe
|
|
|
import gorden.rxbus2.ThreadMode
|
|
|
|
|
@@ -53,7 +63,9 @@ class ConsultationRecordActivity :
|
|
|
}
|
|
|
"2" -> {
|
|
|
//2接诊中
|
|
|
- loginIM()
|
|
|
+ if (bean.doctor != null) {
|
|
|
+ getUserSign(bean.doctor)
|
|
|
+ }
|
|
|
}
|
|
|
"3" -> {
|
|
|
//3已拒诊
|
|
@@ -61,7 +73,7 @@ class ConsultationRecordActivity :
|
|
|
}
|
|
|
"4" -> {
|
|
|
//4已完成
|
|
|
- evaluationOrder()
|
|
|
+ evaluationOrder(bean)
|
|
|
}
|
|
|
"5" -> {
|
|
|
//已取消
|
|
@@ -133,8 +145,10 @@ class ConsultationRecordActivity :
|
|
|
/**
|
|
|
* 评价订单
|
|
|
*/
|
|
|
- private fun evaluationOrder() {
|
|
|
-
|
|
|
+ private fun evaluationOrder(bean: ConsultationRecordsBean) {
|
|
|
+ val diaslog = EvaluateDialog()
|
|
|
+ diaslog.setId(bean.id)
|
|
|
+ diaslog.show(supportFragmentManager, "EvaluateDialog")
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -217,11 +231,44 @@ class ConsultationRecordActivity :
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取密钥
|
|
|
+ */
|
|
|
+ private fun getUserSign(bean: DoctorBean) {
|
|
|
+ viewModel.getUserSign(User.getUserId(), fail = {
|
|
|
+ it.toast()
|
|
|
+ }, success = {
|
|
|
+ it?.let {
|
|
|
+ runOnUiThread {
|
|
|
+ loginIM(it, bean)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 跳转IM
|
|
|
*/
|
|
|
- private fun loginIM() {
|
|
|
+ private fun loginIM(sign: String, bean: DoctorBean) {
|
|
|
+ TUILogin.login(mContext, AccountConfig.TENCENT_IM_APPID, User.getUserId(), sign, object :
|
|
|
+ TUICallback() {
|
|
|
+ override fun onSuccess() {
|
|
|
+ runOnUiThread {
|
|
|
+ val param = Bundle()
|
|
|
+ param.putInt(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C)
|
|
|
+ param.putString(TUIConstants.TUIChat.CHAT_ID, bean.id)
|
|
|
+ param.putString(TUIConstants.TUIChat.CHAT_NAME, bean.userName)
|
|
|
+ param.putString(TUIConstants.TUIChat.FACE_URL, bean.avatar)
|
|
|
+ TUICore.startActivity(TUIConstants.TUIChat.C2C_CHAT_ACTIVITY_NAME, param)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ override fun onError(errorCode: Int, errorMessage: String?) {
|
|
|
+ runOnUiThread {
|
|
|
+ "IM登陆失败".toast()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
}
|