王鹏鹏 2 лет назад
Родитель
Сommit
88d437ba2e

+ 25 - 2
evaluation/src/main/java/com/yingyangfly/evaluation/history/EvaluationHistoryActivity.kt

@@ -12,6 +12,7 @@ import com.yingyangfly.baselib.ext.toast
 import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
 import com.yingyangfly.baselib.router.RouterUrlCommon
 import com.yingyangfly.baselib.utils.JumpUtil
+import com.yingyangfly.baselib.utils.User
 import com.yingyangfly.evaluation.R
 import com.yingyangfly.evaluation.adapter.EvaluationHistoryAdapter
 import com.yingyangfly.evaluation.adapter.OtherEvaluationHistoryAdapter
@@ -73,6 +74,7 @@ class EvaluationHistoryActivity :
     override fun initListener() {
         binding {
             layoutHead.setOnTouchListener(this@EvaluationHistoryActivity)
+            loginOutLayout.setOnTouchListener(this@EvaluationHistoryActivity)
             radioEvaluation.setOnCheckedChangeListener { group, checkedId ->
                 if (checkedId == R.id.radioProfessionalEvaluation) {
                     showEvaluationsView(false)
@@ -155,7 +157,7 @@ class EvaluationHistoryActivity :
     override fun onTouch(v: View, event: MotionEvent): Boolean {
         when (event.action) {
             MotionEvent.ACTION_DOWN -> {
-                if (v.id == R.id.layoutHead) {
+                if (v.id == R.id.layoutHead || v.id == R.id.loginOutLayout) {
                     v.startAnimation(getScaleAnimation())
                 }
             }
@@ -166,11 +168,15 @@ class EvaluationHistoryActivity :
                     R.id.layoutHead -> {
                         finish()
                     }
+
+                    R.id.loginOutLayout -> {
+                        loginOut()
+                    }
                 }
             }
 
             MotionEvent.ACTION_CANCEL -> {
-                if (v.id == R.id.layoutHead) {
+                if (v.id == R.id.layoutHead || v.id == R.id.loginOutLayout) {
                     v.startAnimation(getEndAnimation())
                 }
             }
@@ -199,4 +205,21 @@ class EvaluationHistoryActivity :
             swipeOtherResult.finishLoadMore()
         }
     }
+
+
+    /**
+     * 退出登录
+     */
+    private fun loginOut() {
+        viewModel.logout(fail = {
+            "解绑失败,请重试".toast()
+        }, success = {
+            runOnUiThread {
+                "解绑成功".toast()
+                User.saveToken("")
+                User.savePhone("")
+                JumpUtil.jumpActivity(RouterUrlCommon.hospitalEvaluation, mContext)
+            }
+        })
+    }
 }

+ 8 - 1
evaluation/src/main/java/com/yingyangfly/evaluation/history/EvaluationHistoryViewModel.kt

@@ -50,5 +50,12 @@ class EvaluationHistoryViewModel : BaseViewModel() {
         success, fail
     )
 
-
+    fun logout(
+        fail: ((msg: String) -> Unit)? = null,
+        success: ((success: String?) -> Unit)? = null,
+    ) = launchFlow(true) {
+        EVALUATION_API.largeLogout()
+    }.runUI(
+        success, fail
+    )
 }

+ 2 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/hospital/HospitalActivity.kt

@@ -197,6 +197,7 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
         if (TextUtils.isEmpty(User.getToken())) {
             binding.imageLoginOut.show(false)
             binding.tvLoginOut.show(false)
+            showBindingPhoneDialog()
         } else {
             binding.imageLoginOut.show(true)
             binding.tvLoginOut.show(true)
@@ -261,6 +262,7 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
             "解绑失败,请重试".toast()
         }, success = {
             runOnUiThread {
+                "解绑成功".toast()
                 binding.imageLoginOut.show(false)
                 binding.tvLoginOut.show(false)
                 User.saveToken("")

+ 4 - 1
evaluation/src/main/java/com/yingyangfly/evaluation/hospital/HospitalViewModel.kt

@@ -5,7 +5,10 @@ import com.yingyangfly.baselib.db.QuestionsBean
 import com.yingyangfly.baselib.mvvm.BaseViewModel
 import com.yingyangfly.baselib.net.XUtils
 import com.yingyangfly.baselib.utils.GsonUtil
-import com.yingyangfly.evaluation.entity.*
+import com.yingyangfly.evaluation.entity.QuestionsTypeBean
+import com.yingyangfly.evaluation.entity.ReviewTask
+import com.yingyangfly.evaluation.entity.ReviewTaskListBean
+import com.yingyangfly.evaluation.entity.SlideShowListBean
 import com.yingyangfly.evaluation.net.EVALUATION_API
 
 /**

+ 26 - 5
evaluation/src/main/java/com/yingyangfly/evaluation/otherevaluation/OtherEvaluationActivity.kt

@@ -16,6 +16,8 @@ import com.yingyangfly.baselib.ext.getScaleAnimation
 import com.yingyangfly.baselib.ext.toast
 import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
 import com.yingyangfly.baselib.router.RouterUrlCommon
+import com.yingyangfly.baselib.utils.JumpUtil
+import com.yingyangfly.baselib.utils.User
 import com.yingyangfly.evaluation.R
 import com.yingyangfly.evaluation.adapter.EvaluationTypeAdapter
 import com.yingyangfly.evaluation.adapter.ExaminationAdapter
@@ -71,7 +73,7 @@ class OtherEvaluationActivity :
     override fun initListener() {
         binding {
             layoutHead.setOnTouchListener(this@OtherEvaluationActivity)
-
+            loginOutLayout.setOnTouchListener(this@OtherEvaluationActivity)
             swipeEvaluation.setOnRefreshListener {
                 getExaminationList(true, false)
             }
@@ -147,7 +149,7 @@ class OtherEvaluationActivity :
     override fun onTouch(v: View, event: MotionEvent): Boolean {
         when (event.action) {
             MotionEvent.ACTION_DOWN -> {
-                if (v.id == R.id.layoutHead) {
+                if (v.id == R.id.layoutHead || v.id == R.id.loginOutLayout) {
                     v.startAnimation(getScaleAnimation())
                 }
             }
@@ -158,11 +160,15 @@ class OtherEvaluationActivity :
                     R.id.layoutHead -> {
                         finish()
                     }
+
+                    R.id.loginOutLayout -> {
+                        loginOut()
+                    }
                 }
             }
 
             MotionEvent.ACTION_CANCEL -> {
-                if (v.id == R.id.layoutHead) {
+                if (v.id == R.id.layoutHead || v.id == R.id.loginOutLayout) {
                     v.startAnimation(getEndAnimation())
                 }
             }
@@ -192,8 +198,7 @@ class OtherEvaluationActivity :
                     questionOptionDao?.insertAll(questionOptionBean)
                 }
                 ARouter.getInstance().build(RouterUrlCommon.questionList)
-                    .withLong("examinationId", bean.id)
-                    .withString("examinationTitle", bean.title)
+                    .withLong("examinationId", bean.id).withString("examinationTitle", bean.title)
                     .withTransition(R.anim.leftin, R.anim.leftout).navigation(mContext)
             }
         })
@@ -208,4 +213,20 @@ class OtherEvaluationActivity :
             swipeEvaluation.finishLoadMore()
         }
     }
+
+    /**
+     * 退出登录
+     */
+    private fun loginOut() {
+        viewModel.logout(fail = {
+            "解绑失败,请重试".toast()
+        }, success = {
+            runOnUiThread {
+                "解绑成功".toast()
+                User.saveToken("")
+                User.savePhone("")
+                JumpUtil.jumpActivity(RouterUrlCommon.hospitalEvaluation, mContext)
+            }
+        })
+    }
 }

+ 8 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/otherevaluation/OtherEvaluationViewModel.kt

@@ -68,4 +68,12 @@ class OtherEvaluationViewModel : BaseViewModel() {
         success, fail
     )
 
+    fun logout(
+        fail: ((msg: String) -> Unit)? = null,
+        success: ((success: String?) -> Unit)? = null,
+    ) = launchFlow(true) {
+        EVALUATION_API.largeLogout()
+    }.runUI(
+        success, fail
+    )
 }

+ 30 - 0
evaluation/src/main/res/layout/activity_evaluation_history.xml

@@ -58,6 +58,36 @@
                 android:textSize="@dimen/divider_24px" />
         </RadioGroup>
 
+        <LinearLayout
+            android:id="@+id/loginOutLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/divider_33px"
+            android:paddingTop="@dimen/divider_36px"
+            android:paddingEnd="@dimen/divider_33px"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/imageLoginOut"
+                android:layout_width="@dimen/divider_33px"
+                android:layout_height="@dimen/divider_31px"
+                android:background="@mipmap/icon_evaluation_login_out"
+                android:scaleType="centerInside" />
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tvLoginOut"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/divider_8px"
+                android:text="@string/exit_binding"
+                android:textColor="@android:color/white"
+                android:textSize="@dimen/divider_18px"
+                android:textStyle="bold" />
+        </LinearLayout>
+
         <com.google.android.material.card.MaterialCardView
             android:layout_width="match_parent"
             android:layout_height="0dp"

+ 30 - 0
evaluation/src/main/res/layout/activity_other_evaluation.xml

@@ -31,6 +31,36 @@
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
 
+        <LinearLayout
+            android:id="@+id/loginOutLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/divider_33px"
+            android:paddingTop="@dimen/divider_36px"
+            android:paddingEnd="@dimen/divider_33px"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/imageLoginOut"
+                android:layout_width="@dimen/divider_33px"
+                android:layout_height="@dimen/divider_31px"
+                android:background="@mipmap/icon_evaluation_login_out"
+                android:scaleType="centerInside" />
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:id="@+id/tvLoginOut"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/divider_8px"
+                android:text="@string/exit_binding"
+                android:textColor="@android:color/white"
+                android:textSize="@dimen/divider_18px"
+                android:textStyle="bold" />
+        </LinearLayout>
+
         <com.google.android.material.card.MaterialCardView
             android:layout_width="match_parent"
             android:layout_height="0dp"

+ 1 - 1
evaluation/src/main/res/layout/item_guide.xml

@@ -17,7 +17,7 @@
             android:id="@+id/guideImage"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:scaleType="fitXY" />
+            android:scaleType="centerCrop" />
 
     </com.google.android.material.card.MaterialCardView>
 

+ 0 - 1
evaluation/src/main/res/layout/item_question_list.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     tools:ignore="ResourceName">