Browse Source

1.积分藏品。

shihuiyun 2 years ago
parent
commit
c1b1fbed68

+ 9 - 1
app/src/main/java/com/zswc/creativity/fragment/CollectionFragment.kt

@@ -173,9 +173,17 @@ class CollectionFragment : MBFragment<CollectionVModel, FragmentCollectionBindin
         return null
     }
 
-    @Subscribe(tags = [Tag(ConfigRx.REFRESH_STORE_INTER)])
+
+    @Subscribe(tags = [Tag(ConfigRx.REFRESH_HOME_LIST)])
     fun setRefreshList(type: String) {
+        if(type=="2") {
+            vm.toGetCollectionListTo()
+        }
 
+    }
+
+    @Subscribe(tags = [Tag(ConfigRx.REFRESH_STORE_INTER)])
+    fun setRefreshStore(type: String) {
         vm.toGetCollectionListTo()
 
     }

+ 3 - 1
app/src/main/java/com/zswc/creativity/fragment/HomeFirstFragment.kt

@@ -53,7 +53,6 @@ class HomeFirstFragment : MBFragment<HomeFirstVModel, FragmentHomeFirstBinding>(
 
     var fragments = emptyArray<Fragment>()
     private var adapter: FragAdapter? = null
-    var type = 1//1精选 2预约
 
 
     override fun init(savedInstanceState: Bundle?) {
@@ -127,6 +126,7 @@ class HomeFirstFragment : MBFragment<HomeFirstVModel, FragmentHomeFirstBinding>(
     override fun listeners() {
         super.listeners()
         binding.tvMyChose.setOnClickListener(View.OnClickListener { view: View? ->
+            vm.type=1
             switchContent(0)
             binding.tvMyChose.setTextColor(Color.parseColor("#222222"))
             binding.tvMyCollection.setTextColor(Color.parseColor("#888888"))
@@ -135,6 +135,7 @@ class HomeFirstFragment : MBFragment<HomeFirstVModel, FragmentHomeFirstBinding>(
 
         })
         binding.tvMyCollection.setOnClickListener(View.OnClickListener { view: View? ->
+            vm.type=2
             switchContent(1)
             binding.tvMyChose.setTextColor(Color.parseColor("#888888"))
             binding.tvMyCollection.setTextColor(Color.parseColor("#222222"))
@@ -143,6 +144,7 @@ class HomeFirstFragment : MBFragment<HomeFirstVModel, FragmentHomeFirstBinding>(
 
 
         binding.tvMyAppointment.setOnClickListener(View.OnClickListener { view: View? ->
+            vm.type=3
             switchContent(2)
             binding.tvMyChose.setTextColor(Color.parseColor("#888888"))
             binding.tvMyCollection.setTextColor(Color.parseColor("#888888"))

+ 3 - 2
app/src/main/java/com/zswc/creativity/fragment/MyCalendarFragment.kt

@@ -102,8 +102,9 @@ class MyCalendarFragment : MBFragment<MyCalendarVModel, FragmentMyCalendarBindin
     }
     @Subscribe(tags = [Tag(ConfigRx.REFRESH_HOME_LIST)])
     fun setRefreshList(type: String) {
-
-        vm.getInfo()
+        if(type=="3") {
+            vm.getInfo()
+        }
 
     }
 

+ 3 - 1
app/src/main/java/com/zswc/creativity/fragment/RecommendFragment.kt

@@ -173,7 +173,9 @@ class RecommendFragment : MBFragment<RecommendVModel, FragmentRecommendBinding>(
     @Subscribe(tags = [Tag(ConfigRx.REFRESH_HOME_LIST)])
     fun setRefreshList(type: String) {
 
-        vm.toGetCollectionListTo()
+        if(type=="1") {
+            vm.toGetCollectionListTo()
+        }
 
     }
 }

+ 3 - 1
app/src/main/java/com/zswc/creativity/vmodel/HomeFirstVModel.kt

@@ -26,6 +26,8 @@ import kotlinx.coroutines.launch
  */
 open class HomeFirstVModel(application: Application) : BViewModel<BRepository>(application) {
 
+    var type = 1//1精选  2积分藏品 3预约
+
     //默认登录状态
     var isLogin=MutableLiveData<Boolean>(true)
 
@@ -56,7 +58,7 @@ open class HomeFirstVModel(application: Application) : BViewModel<BRepository>(a
 
     override fun firstReq() {
         super.firstReq()
-        RxBus.get().post(ConfigRx.REFRESH_HOME_LIST,"")
+        RxBus.get().post(ConfigRx.REFRESH_HOME_LIST,type.toString())
 
         toGetBanner()
     }