wenjuan.su hace 1 año
padre
commit
bf8af9f072

+ 3 - 3
.idea/deploymentTargetDropDown.xml

@@ -6,12 +6,12 @@
6 6
         <type value="RUNNING_DEVICE_TARGET" />
7 7
         <deviceKey>
8 8
           <Key>
9
-            <type value="VIRTUAL_DEVICE_PATH" />
10
-            <value value="$USER_HOME$/.android/avd/Pixel_7_API_33.avd" />
9
+            <type value="SERIAL_NUMBER" />
10
+            <value value="8a759d16" />
11 11
           </Key>
12 12
         </deviceKey>
13 13
       </Target>
14 14
     </runningDeviceTargetSelectedWithDropDown>
15
-    <timeTargetWasSelectedWithDropDown value="2025-04-23T06:20:47.641624Z" />
15
+    <timeTargetWasSelectedWithDropDown value="2025-04-23T06:39:36.995402Z" />
16 16
   </component>
17 17
 </project>

+ 2 - 2
.idea/deploymentTargetSelector.xml

@@ -4,10 +4,10 @@
4 4
     <selectionStates>
5 5
       <SelectionState runConfigName="app">
6 6
         <option name="selectionMode" value="DROPDOWN" />
7
-        <DropdownSelection timestamp="2025-04-19T06:37:06.884508Z">
7
+        <DropdownSelection timestamp="2025-04-23T05:51:25.734909100Z">
8 8
           <Target type="DEFAULT_BOOT">
9 9
             <handle>
10
-              <DeviceId pluginId="LocalEmulator" identifier="path=/Users/swj/.android/avd/Pixel4API30.avd" />
10
+              <DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=343b6e12" />
11 11
             </handle>
12 12
           </Target>
13 13
         </DropdownSelection>

+ 1 - 0
.idea/gradle.xml

@@ -16,6 +16,7 @@
16 16
             <option value="$PROJECT_DIR$/jd_sdk_lib" />
17 17
           </set>
18 18
         </option>
19
+        <option name="resolveExternalAnnotations" value="false" />
19 20
       </GradleProjectSettings>
20 21
     </option>
21 22
   </component>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 7 - 7
app/src/main/java/com/yihucha/hbyhc/config/Constants.java


+ 1 - 0
app/src/main/java/com/yihucha/hbyhc/presentation/login/view_model/LoginViewModel.java

@@ -229,6 +229,7 @@ public class LoginViewModel extends BaseViewModel {
229 229
         map.put("nickname",nickName);
230 230
         map.put("avatarUrl",avatar);
231 231
 
232
+        Log.d(TAG, "getWxBinding:api/third/binding wechat " + map);
232 233
         AuthService authService = NetworkApi.createService(AuthService.class);
233 234
         authService.wxloginbinding(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<LoginModel>>() {
234 235
             @Override

+ 24 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/mine/ThirdPartyBindingActivity.java

@@ -8,6 +8,7 @@ import android.os.Bundle;
8 8
 import android.os.Handler;
9 9
 import android.os.Message;
10 10
 import android.text.TextUtils;
11
+import android.util.Log;
11 12
 import android.view.View;
12 13
 import android.widget.Toast;
13 14
 
@@ -54,12 +55,16 @@ import java.util.Map;
54 55
  */
55 56
 public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<ActivityThirdPartyBindingBinding> implements View.OnClickListener {
56 57
     private static final int SDK_AUTH_FLAG = 2;
58
+    private static final String TAG = "ThirdPartyBindingActivity";
57 59
     private BindingStateBViewModel mBindingStateBViewModel;
58 60
 
59 61
     private   boolean flagAlipayAuthorization ; //表示支付宝是否授权
60 62
     private   boolean flagWechatAuthorization ; //表示微信是否授权
61 63
     private BindingStateBean wechatBean;
62 64
     private BindingStateBean alipayBean;
65
+    private  int number = 0;
66
+    private  boolean alipayBtnClickFlag = false;
67
+    private  boolean wechatBtnClickFlag = false;
63 68
     @SuppressLint("HandlerLeak")
64 69
     private final Handler mHandler = new Handler() {
65 70
         @SuppressWarnings("unused")
@@ -117,6 +122,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
117 122
     @Override
118 123
     protected void onResume() {
119 124
         super.onResume();
125
+        number = 0 ;
120 126
         mBindingStateBViewModel.getBindingState();
121 127
     }
122 128
 
@@ -127,6 +133,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
127 133
         mBindingStateBViewModel.mBindingStateBean.observe(this, new Observer<List<BindingStateBean>>() {
128 134
             @Override
129 135
             public void onChanged(List<BindingStateBean> bindingStateBeans) {
136
+
130 137
                 for (int i = 0; i < bindingStateBeans.size(); i++) {
131 138
                     if (bindingStateBeans.get(i).getType().equals("1")) {
132 139
                         wechatBean = bindingStateBeans.get(i);
@@ -145,11 +152,14 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
145 152
 //                        mViewBinding.llWechatAuthorization.setEnabled(false);
146 153
 //                        mViewBinding.llWechatAuthorization.setClickable(false);
147 154
                         flagWechatAuthorization = true ;
148
-                    } else if (bindingStateBeans.get(i).getType().equals("2")) {
155
+                        wechatBtnClickFlag = false;
156
+                    }
157
+                    else if (bindingStateBeans.get(i).getType().equals("2")) {
149 158
                         alipayBean = bindingStateBeans.get(i);
150 159
                         mViewBinding.tvAlipayBeAuthorized.setVisibility(View.VISIBLE);
151 160
                         mViewBinding.tvAlipayUnauthorized.setVisibility(View.GONE);
152 161
                         mViewBinding.llAlipayInfo.setVisibility(View.VISIBLE);
162
+                        alipayBtnClickFlag = false;
153 163
 //                        mViewBinding.llAlipayAuthorization.setEnabled(false);
154 164
 //                        mViewBinding.llAlipayAuthorization.setClickable(false);
155 165
                         String imageUrl = alipayBean.getAvater(); // Replace with your actual IP address and image path
@@ -164,10 +174,18 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
164 174
                         flagAlipayAuthorization = true;
165 175
                     }
166 176
                 }
177
+
178
+                if(wechatBtnClickFlag || alipayBtnClickFlag){
179
+                    mBindingStateBViewModel.getBindingState();
180
+                }
167 181
             }
168 182
         });
169 183
 
170
-        mBindingStateBViewModel.failed.observe(this, s -> ToastUtils.showLong(s));
184
+        mBindingStateBViewModel.failed.observe(this, s -> {
185
+            LogUtil.e("failed.-----","BindingState-----");
186
+            ToastUtils.showLong(s);
187
+
188
+        });
171 189
 
172 190
         //支付宝链接
173 191
         mBindingStateBViewModel.mAuthInfoSucceed.observe(this, new Observer<String>() {
@@ -236,6 +254,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
236 254
                 unbindAccountThird(2);
237 255
                 return ;
238 256
             }
257
+            alipayBtnClickFlag = true;
239 258
             mBindingStateBViewModel.getAuthInfo();
240 259
         }else if (v == mViewBinding.llWechatAuthorization){
241 260
 
@@ -244,6 +263,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
244 263
                 unbindAccountThird(1);
245 264
                return;
246 265
             }
266
+            wechatBtnClickFlag = true;
247 267
             regToWx();
248 268
         }
249 269
     }
@@ -268,6 +288,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
268 288
                                 mViewBinding.tvWxBeAuthorized.setVisibility(View.GONE);
269 289
                                 mViewBinding.tvWxUnauthorized.setVisibility(View.VISIBLE);
270 290
                                 flagWechatAuthorization = false;
291
+                                wechatBtnClickFlag = false ;
271 292
                                 mViewBinding.llWechatInfo.setVisibility(View.GONE);
272 293
                             }
273 294
                             else if(type == 2){
@@ -275,6 +296,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
275 296
                                 mViewBinding.tvAlipayUnauthorized.setVisibility(View.VISIBLE);
276 297
                                 mViewBinding.llAlipayInfo.setVisibility(View.GONE);
277 298
                                 flagAlipayAuthorization = false ;
299
+                                alipayBtnClickFlag = false ;
278 300
                             }
279 301
 
280 302
                         } else {

+ 8 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/mine/model/WechatOpenIdBean.java

@@ -17,7 +17,7 @@ public class WechatOpenIdBean {
17 17
     private String nickName ;
18 18
     private String avater ;
19 19
 
20
-
20
+    private String headimgurl ;
21 21
     public void  setNickname(String nickName){
22 22
         this.nickName = nickName ;
23 23
 
@@ -31,10 +31,16 @@ public class WechatOpenIdBean {
31 31
         this.avater = avater ;
32 32
 
33 33
     }
34
-
35 34
     public String getAvater() {
36 35
         return avater == null ? "" : avater;
37 36
     }
37
+    public void  setHeadimgurl(String headimgurl){
38
+        this.headimgurl = headimgurl ;
39
+
40
+    }
41
+    public String getHeadimgurl() {
42
+        return headimgurl == null ? "" : headimgurl;
43
+    }
38 44
     public String getUnionid() {
39 45
         return unionid == null ? "" : unionid;
40 46
     }

+ 6 - 1
app/src/main/java/com/yihucha/hbyhc/presentation/mine/view_model/BindingStateBViewModel.java

@@ -1,6 +1,7 @@
1 1
 package com.yihucha.hbyhc.presentation.mine.view_model;
2 2
 
3 3
 import android.annotation.SuppressLint;
4
+import android.util.Log;
4 5
 
5 6
 import androidx.lifecycle.MutableLiveData;
6 7
 
@@ -36,20 +37,24 @@ public class BindingStateBViewModel extends BaseViewModel {
36 37
      */
37 38
     @SuppressLint("CheckResult")
38 39
     public void getBindingState() {
40
+        LogUtil.e("BindingStateBViewModel.getBindingState-----","BindingState-----");
39 41
         UserService userService = NetworkApi.createService(UserService.class);
40 42
         userService.getBindingState().compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<List<BindingStateBean>>>() {
41 43
             @Override
42 44
             public void onSuccess(DataResponse<List<BindingStateBean>> listDataResponse) {
43 45
                 if (listDataResponse.responseCode == 200) {
46
+                    LogUtil.e("BindingStateBViewModel.getBindingState","200-----BindingState-----");
44 47
                     mBindingStateBean.postValue(listDataResponse.getData());
45 48
                 } else {
46 49
 //                    ToastUtils.showLong(listDataResponse.responseError);
47
-                    LogUtil.e("BindingStateBViewModel.getBindingState",listDataResponse.responseError);
50
+                    failed.postValue(listDataResponse.responseError);
51
+                    LogUtil.e("BindingStateBViewModel.getBindingState ---BindingState- ",listDataResponse.responseError);
48 52
                 }
49 53
             }
50 54
 
51 55
             @Override
52 56
             public void onFailure(Throwable e) {
57
+//                failed.postValue(e.responseError);
53 58
 //                failed.postValue(getString(R.string.failed_string));
54 59
             }
55 60
         }));

+ 23 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/JDActivity.kt

@@ -1,6 +1,7 @@
1 1
 package com.yihucha.hbyhc.presentation.pyyx.activity
2 2
 
3 3
 import android.os.Bundle
4
+import android.text.Editable
4 5
 import android.view.View
5 6
 import androidx.constraintlayout.widget.ConstraintLayout
6 7
 import androidx.core.widget.NestedScrollView
@@ -13,7 +14,6 @@ import com.yihucha.hbyhc.R
13 14
 import com.yihucha.hbyhc.base.BaseActivity
14 15
 import com.yihucha.hbyhc.config.BusinessConstants
15 16
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17 17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
18 18
 import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
19 19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
@@ -21,6 +21,7 @@ import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
21 21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
22 22
 import com.yihucha.hbyhc.utils.DensityUtils
23 23
 import com.yihucha.hbyhc.utils.LoginUtils
24
+import com.yihucha.hbyhc.utils.MyTextWathcer
24 25
 import qiu.niorgai.StatusBarCompat
25 26
 
26 27
 /**
@@ -45,7 +46,8 @@ class JDActivity : BaseActivity() {
45 46
     private val viewModel by lazy {
46 47
         ViewModelProvider(this)[ThirdPartViewModel::class.java].apply {
47 48
             topSelectTitles = listOf(
48
-                PyyxTvListBean("居家日用", true, 1),
49
+                PyyxTvListBean("全部", true, -1),
50
+                PyyxTvListBean("居家日用", false, 1),
49 51
                 PyyxTvListBean("食品", false, 2),
50 52
                 PyyxTvListBean("生鲜", false, 3),
51 53
                 PyyxTvListBean("图书", false, 4),
@@ -157,6 +159,25 @@ class JDActivity : BaseActivity() {
157 159
         binding.imgToTop.setOnClickListener {
158 160
             binding.scrollView.scrollTo(0, 0)
159 161
         }
162
+
163
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
164
+            override fun afterTextChanged(s: Editable?) {
165
+                super.afterTextChanged(s)
166
+                val str = s?.toString()?.trim() ?: ""
167
+                viewModel.keyWord = str
168
+                if (str.isEmpty()) {
169
+                    binding.imgClear.visibility = View.GONE
170
+                }else{
171
+                    binding.imgClear.visibility = View.VISIBLE
172
+                }
173
+            }
174
+        })
175
+        binding.imgClear.setOnClickListener {
176
+            binding.edtSearch.setText("")
177
+        }
178
+        binding.tvSearch.setOnClickListener {
179
+            viewModel.getJdList(viewModel.currentTitleBean.titleId)
180
+        }
160 181
     }
161 182
 
162 183
     private fun initData() {

+ 37 - 8
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/PDDActivity.kt

@@ -1,6 +1,7 @@
1 1
 package com.yihucha.hbyhc.presentation.pyyx.activity
2 2
 
3 3
 import android.os.Bundle
4
+import android.text.Editable
4 5
 import android.view.View
5 6
 import androidx.constraintlayout.widget.ConstraintLayout
6 7
 import androidx.core.widget.NestedScrollView
@@ -13,7 +14,6 @@ import com.yihucha.hbyhc.R
13 14
 import com.yihucha.hbyhc.base.BaseActivity
14 15
 import com.yihucha.hbyhc.config.BusinessConstants
15 16
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17 17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
18 18
 import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
19 19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
@@ -21,6 +21,7 @@ import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
21 21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
22 22
 import com.yihucha.hbyhc.utils.DensityUtils
23 23
 import com.yihucha.hbyhc.utils.LoginUtils
24
+import com.yihucha.hbyhc.utils.MyTextWathcer
24 25
 import qiu.niorgai.StatusBarCompat
25 26
 
26 27
 /**
@@ -45,7 +46,8 @@ class PDDActivity : BaseActivity() {
45 46
     }
46 47
     val catListAdapter by lazy {
47 48
         RvTextViewAdapter(
48
-            this,null)
49
+            this, null
50
+        )
49 51
     }
50 52
 
51 53
     private var titleId = 0
@@ -63,7 +65,8 @@ class PDDActivity : BaseActivity() {
63 65
         val params = binding.titleLayout.layoutParams as ConstraintLayout.LayoutParams
64 66
         params.topMargin = DensityUtils.getStatusBarHeight(this)
65 67
         binding.tvTitle.text = "拼多多"
66
-        Glide.with(this).load(BusinessConstants.HOST+"mweb/img/pinduoduo.jpg").into(binding.banner)
68
+        Glide.with(this).load(BusinessConstants.HOST + "mweb/img/pinduoduo.jpg")
69
+            .into(binding.banner)
67 70
         binding.bgView.setBackgroundResource(R.mipmap.home_bg)
68 71
         binding.rvProductList.layoutManager = LinearLayoutManager(context)
69 72
         binding.rvProductList.adapter = adapter
@@ -114,9 +117,9 @@ class PDDActivity : BaseActivity() {
114 117
 
115 118
         binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
116 119
             val rootPicHeight: Int = binding.banner.height
117
-            if (scrollY<rootPicHeight){
120
+            if (scrollY < rootPicHeight) {
118 121
                 binding.imgToTop.visibility = View.GONE
119
-            }else{
122
+            } else {
120 123
                 binding.imgToTop.visibility = View.VISIBLE
121 124
             }
122 125
         })
@@ -124,6 +127,24 @@ class PDDActivity : BaseActivity() {
124 127
             binding.scrollView.scrollTo(0, 0)
125 128
         }
126 129
 
130
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
131
+            override fun afterTextChanged(s: Editable?) {
132
+                super.afterTextChanged(s)
133
+                val str = s?.toString()?.trim() ?: ""
134
+                viewModel.keyWord = str
135
+                if (str.isEmpty()) {
136
+                    binding.imgClear.visibility = View.GONE
137
+                }else{
138
+                    binding.imgClear.visibility = View.VISIBLE
139
+                }
140
+            }
141
+        })
142
+        binding.imgClear.setOnClickListener {
143
+            binding.edtSearch.setText("")
144
+        }
145
+        binding.tvSearch.setOnClickListener {
146
+            viewModel.getPinduoduoList(titleId)
147
+        }
127 148
     }
128 149
 
129 150
     private fun initData() {
@@ -141,14 +162,22 @@ class PDDActivity : BaseActivity() {
141 162
                 val catBeans = it.mapIndexed { index, bean ->
142 163
                     PyyxTvListBean(
143 164
                         title = bean.name,
144
-                        checked = index == 0,
165
+                        checked = false,
145 166
                         titleId = bean.id
146 167
                     )
147 168
                 }
148
-                titleId = catBeans.first().titleId
169
+                val beans = catBeans.toMutableList()
170
+                beans.add(
171
+                    0, PyyxTvListBean(
172
+                        title = "全部",
173
+                        checked = true,
174
+                        titleId = -1
175
+                    )
176
+                )
177
+                titleId = beans.first().titleId
149 178
                 viewModel.getPinduoduoList(titleId)
150 179
                 binding.rvTopSelector.visibility = View.VISIBLE
151
-                catListAdapter.resetTitles(catBeans)
180
+                catListAdapter.resetTitles(beans)
152 181
             }
153 182
         }
154 183
 

+ 39 - 12
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/SNActivity.kt

@@ -1,6 +1,7 @@
1 1
 package com.yihucha.hbyhc.presentation.pyyx.activity
2 2
 
3 3
 import android.os.Bundle
4
+import android.text.Editable
4 5
 import android.view.View
5 6
 import androidx.constraintlayout.widget.ConstraintLayout
6 7
 import androidx.core.widget.NestedScrollView
@@ -9,17 +10,17 @@ import androidx.recyclerview.widget.LinearLayoutManager
9 10
 import com.bumptech.glide.Glide
10 11
 import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter
11 12
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
12
-import com.yihucha.hbyhc.R
13 13
 import com.yihucha.hbyhc.base.BaseActivity
14 14
 import com.yihucha.hbyhc.config.BusinessConstants
15 15
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17 16
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
17
+import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
18 18
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19 19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
20 20
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21 21
 import com.yihucha.hbyhc.utils.DensityUtils
22 22
 import com.yihucha.hbyhc.utils.LoginUtils
23
+import com.yihucha.hbyhc.utils.MyTextWathcer
23 24
 import qiu.niorgai.StatusBarCompat
24 25
 
25 26
 /**
@@ -59,7 +60,7 @@ class SNActivity : BaseActivity() {
59 60
         val params = binding.titleLayout.layoutParams as ConstraintLayout.LayoutParams
60 61
         params.topMargin = DensityUtils.getStatusBarHeight(this)
61 62
         binding.tvTitle.text = "苏宁"
62
-        Glide.with(this).load(BusinessConstants.HOST+"mweb/img/suning.jpg").into(binding.banner)
63
+        Glide.with(this).load(BusinessConstants.HOST + "mweb/img/suning.jpg").into(binding.banner)
63 64
         binding.rvProductList.layoutManager =
64 65
             LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
65 66
         binding.rvTopSelector.adapter = titleAdapter
@@ -102,11 +103,11 @@ class SNActivity : BaseActivity() {
102 103
 
103 104
 
104 105
         titleAdapter.setOnItemClickListener { pos ->
105
-            if (pos<viewModel.topSelectTitles.indexOf(viewModel.currentTitleBean)){
106
+            if (pos < viewModel.topSelectTitles.indexOf(viewModel.currentTitleBean)) {
106 107
                 //选前面的
107
-                if (pos>0)
108
+                if (pos > 0)
108 109
                     binding.rvTopSelector.smoothScrollToPosition(pos - 1)
109
-            }else{
110
+            } else {
110 111
                 //选后面的
111 112
                 if (pos < viewModel.topSelectTitles.size - 1)
112 113
                     binding.rvTopSelector.smoothScrollToPosition(pos + 1)
@@ -119,23 +120,49 @@ class SNActivity : BaseActivity() {
119 120
 
120 121
         binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
121 122
             val rootPicHeight: Int = binding.banner.height
122
-            if (scrollY<rootPicHeight){
123
+            if (scrollY < rootPicHeight) {
123 124
                 binding.imgToTop.visibility = View.GONE
124
-            }else{
125
+            } else {
125 126
                 binding.imgToTop.visibility = View.VISIBLE
126 127
             }
127 128
         })
128 129
         binding.imgToTop.setOnClickListener {
129 130
             binding.scrollView.scrollTo(0, 0)
130 131
         }
132
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
133
+            override fun afterTextChanged(s: Editable?) {
134
+                super.afterTextChanged(s)
135
+                val str = s?.toString()?.trim() ?: ""
136
+                viewModel.keyWord = str
137
+                if (str.isEmpty()) {
138
+                    binding.imgClear.visibility = View.GONE
139
+                } else {
140
+                    binding.imgClear.visibility = View.VISIBLE
141
+                }
142
+            }
143
+        })
144
+        binding.imgClear.setOnClickListener {
145
+            binding.edtSearch.setText("")
146
+        }
147
+        binding.tvSearch.setOnClickListener {
148
+            viewModel.getSuningList(viewModel.currentTitleBean.titleId)
149
+        }
131 150
     }
132 151
 
133 152
     private fun initData() {
134 153
         viewModel.getClassesType(4)
135
-        viewModel.classesLiveData.observe(this){
136
-            viewModel.topSelectTitles = it
154
+        viewModel.classesLiveData.observe(this) {
155
+            viewModel.topSelectTitles = it.toMutableList().apply {
156
+                add(
157
+                    0, PyyxTvListBean(
158
+                        title = "全部",
159
+                        checked = true,
160
+                        titleId = -1
161
+                    )
162
+                )
163
+            }
137 164
             titleAdapter.resetTitles(viewModel.topSelectTitles)
138
-            viewModel.currentTitleBean=viewModel.topSelectTitles.first { it.checked }
165
+            viewModel.currentTitleBean = viewModel.topSelectTitles.first { it.checked }
139 166
             viewModel.getSuningList(viewModel.currentTitleBean.titleId)
140 167
         }
141 168
 
@@ -145,7 +172,7 @@ class SNActivity : BaseActivity() {
145 172
             binding.llNoData.llNotFound.visibility = if (it.isEmpty()) View.VISIBLE else View.GONE
146 173
             adapter.updateData(it)
147 174
         }
148
-        viewModel.failed.observe(this){
175
+        viewModel.failed.observe(this) {
149 176
             binding.refreshLayout.finishRefreshing()
150 177
             binding.refreshLayout.finishLoadmore()
151 178
         }

+ 31 - 2
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/activity/VIPActivity.kt

@@ -2,6 +2,7 @@ package com.yihucha.hbyhc.presentation.pyyx.activity
2 2
 
3 3
 import android.graphics.Color
4 4
 import android.os.Bundle
5
+import android.text.Editable
5 6
 import android.view.View
6 7
 import androidx.constraintlayout.widget.ConstraintLayout
7 8
 import androidx.core.widget.NestedScrollView
@@ -13,13 +14,14 @@ import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
13 14
 import com.yihucha.hbyhc.base.BaseActivity
14 15
 import com.yihucha.hbyhc.config.BusinessConstants
15 16
 import com.yihucha.hbyhc.config.Constants
16
-import com.yihucha.hbyhc.config.HttpUrl
17 17
 import com.yihucha.hbyhc.databinding.ActivityTbBinding
18
+import com.yihucha.hbyhc.presentation.pyyx.PyyxTvListBean
18 19
 import com.yihucha.hbyhc.presentation.pyyx.adapter.ProductThirdPartAdapter
19 20
 import com.yihucha.hbyhc.presentation.pyyx.adapter.RvTextViewAdapter
20 21
 import com.yihucha.hbyhc.presentation.pyyx.viewmodel.ThirdPartViewModel
21 22
 import com.yihucha.hbyhc.utils.DensityUtils
22 23
 import com.yihucha.hbyhc.utils.LoginUtils
24
+import com.yihucha.hbyhc.utils.MyTextWathcer
23 25
 import qiu.niorgai.StatusBarCompat
24 26
 
25 27
 /**
@@ -128,13 +130,40 @@ class VIPActivity : BaseActivity() {
128 130
         binding.imgToTop.setOnClickListener {
129 131
             binding.scrollView.scrollTo(0, 0)
130 132
         }
133
+
134
+        binding.edtSearch.addTextChangedListener(object : MyTextWathcer() {
135
+            override fun afterTextChanged(s: Editable?) {
136
+                super.afterTextChanged(s)
137
+                val str = s?.toString()?.trim() ?: ""
138
+                viewModel.keyWord = str
139
+                if (str.isEmpty()) {
140
+                    binding.imgClear.visibility = View.GONE
141
+                }else{
142
+                    binding.imgClear.visibility = View.VISIBLE
143
+                }
144
+            }
145
+        })
146
+        binding.imgClear.setOnClickListener {
147
+            binding.edtSearch.setText("")
148
+        }
149
+        binding.tvSearch.setOnClickListener {
150
+            viewModel.getVipList(viewModel.currentTitleBean.titleId)
151
+        }
131 152
     }
132 153
 
133 154
     private fun initData() {
134 155
 
135 156
         viewModel.getClassesType(5)
136 157
         viewModel.classesLiveData.observe(this) {
137
-            viewModel.topSelectTitles = it
158
+            viewModel.topSelectTitles = it.toMutableList().apply {
159
+                add(
160
+                    0, PyyxTvListBean(
161
+                        title = "全部",
162
+                        checked = true,
163
+                        titleId = -1
164
+                    )
165
+                )
166
+            }
138 167
             titleAdapter.resetTitles(viewModel.topSelectTitles)
139 168
             viewModel.currentTitleBean = viewModel.topSelectTitles.first { it.checked }
140 169
             viewModel.getVipList(viewModel.currentTitleBean.titleId)

+ 38 - 15
app/src/main/java/com/yihucha/hbyhc/presentation/pyyx/viewmodel/ThirdPartViewModel.kt

@@ -34,11 +34,12 @@ class ThirdPartViewModel : BaseViewModel() {
34 34
     val pageDatasLiveData = MutableLiveData<MutableList<HomeProductBean>>()
35 35
 
36 36
     val classesLiveData = MutableLiveData<List<PyyxTvListBean>>()
37
-
37
+    var keyWord = ""
38 38
     lateinit var currentTitleBean: PyyxTvListBean
39 39
 
40 40
     var topSelectTitles = listOf(
41
-        PyyxTvListBean("美食", true, 6),
41
+        PyyxTvListBean("全部", true, -1),
42
+        PyyxTvListBean("美食", false, 6),
42 43
         PyyxTvListBean("女装", false, 1),
43 44
         PyyxTvListBean("母婴", false, 2),
44 45
         PyyxTvListBean("美妆", false, 3),
@@ -67,10 +68,10 @@ class ThirdPartViewModel : BaseViewModel() {
67 68
                 BaseObserver<DataResponse<List<ClassesTypeBean>>>() {
68 69
                 override fun onSuccess(t: DataResponse<List<ClassesTypeBean>>?) {
69 70
                     if (t?.responseCode == 200) {
70
-                        classesLiveData.postValue(t!!.data.mapIndexed { pos, bean ->
71
+                        classesLiveData.postValue(t.data.mapIndexed { pos, bean ->
71 72
                             PyyxTvListBean(
72 73
                                 title = bean.c_name,
73
-                                checked = pos == 0,
74
+                                checked = false,
74 75
                                 titleId = bean.cid.toInt()
75 76
                             )
76 77
                         })
@@ -123,7 +124,12 @@ class ThirdPartViewModel : BaseViewModel() {
123 124
         val map: MutableMap<String, Any> = HashMap()
124 125
         map["page"] = page
125 126
         map["limit"] = 10
126
-        map["cid"] = cid
127
+        if (cid != -1) {
128
+            map["cid"] = cid
129
+        }
130
+        if (keyWord.isNotEmpty()) {
131
+            map["keyword"] = keyWord
132
+        }
127 133
         val productService = NetworkApi.createService(ProductService::class.java)
128 134
         productService.getJdProductList(map)
129 135
             .compose(
@@ -156,7 +162,12 @@ class ThirdPartViewModel : BaseViewModel() {
156 162
         val map: MutableMap<String, Any> = java.util.HashMap()
157 163
         map["page"] = page
158 164
         map["limit"] = 10
159
-        map["cid"] = cid
165
+        if (cid != -1) {
166
+            map["cid"] = cid
167
+        }
168
+        if (keyWord.isNotEmpty()) {
169
+            map["keyword"] = keyWord
170
+        }
160 171
         val productService = NetworkApi.createService(ProductService::class.java)
161 172
         productService.getVipProductList(map)
162 173
             .compose(
@@ -223,11 +234,16 @@ class ThirdPartViewModel : BaseViewModel() {
223 234
      * 拼多多列表
224 235
      */
225 236
     @SuppressLint("CheckResult")
226
-    fun getPinduoduoList(catId:Int) {
237
+    fun getPinduoduoList(catId: Int) {
227 238
         val map: MutableMap<String, Any> = java.util.HashMap()
228 239
         map["page"] = page
229 240
         map["limit"] = 10
230
-        map["cat_id"] = catId
241
+        if (catId != -1) {
242
+            map["cat_id"] = catId
243
+        }
244
+        if (keyWord.isNotEmpty()) {
245
+            map["keyword"] = keyWord
246
+        }
231 247
         val productService = NetworkApi.createService(ProductService::class.java)
232 248
         productService.getPinduoduoProductList(map)
233 249
             .compose(
@@ -263,7 +279,12 @@ class ThirdPartViewModel : BaseViewModel() {
263 279
         val map: MutableMap<String, Any> = java.util.HashMap()
264 280
         map["page"] = page
265 281
         map["limit"] = 10
266
-        map["cid"] = cid
282
+        if (cid != -1) {
283
+            map["cid"] = cid
284
+        }
285
+        if (keyWord.isNotEmpty()) {
286
+            map["keyword"] = keyWord
287
+        }
267 288
         val productService = NetworkApi.createService(ProductService::class.java)
268 289
         productService.getSuningProductList(map)
269 290
             .compose(
@@ -292,19 +313,21 @@ class ThirdPartViewModel : BaseViewModel() {
292 313
     }
293 314
 
294 315
     val pddCatLiveData = MutableLiveData<List<PddClassesBean.Data>>()
316
+
295 317
     /**
296 318
      * pdd 分类
297 319
      */
298 320
     @SuppressLint("CheckResult")
299
-    fun requestPddCat(){
300
-        val map = mapOf<String,Any>(Pair("parentId","0"))
321
+    fun requestPddCat() {
322
+        val map = mapOf<String, Any>(Pair("parentId", "0"))
301 323
         val service = NetworkApi.createService(PyyxService::class.java)
302
-        service.requestPddCat(map).compose(NetworkApi.applySchedulers(object : BaseObserver<DataResponse<PddClassesBean>>(){
324
+        service.requestPddCat(map).compose(NetworkApi.applySchedulers(object :
325
+            BaseObserver<DataResponse<PddClassesBean>>() {
303 326
             override fun onSuccess(t: DataResponse<PddClassesBean>?) {
304 327
                 t?.apply {
305
-                    if (responseCode==200) {
306
-                        data?.let { catData->
307
-                            catData.data?.let { cats->
328
+                    if (responseCode == 200) {
329
+                        data?.let { catData ->
330
+                            catData.data?.let { cats ->
308 331
                                 pddCatLiveData.postValue(cats)
309 332
                             }
310 333
 

+ 15 - 5
app/src/main/java/com/yihucha/hbyhc/wxapi/WXEntryActivity.java

@@ -149,7 +149,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
149 149
 //                WXEventBean wxEventBean = new WXEventBean();
150 150
 //                wxEventBean.setCode(code);
151 151
 //                EventBus.getDefault().postSticky(wxEventBean);
152
-                    System.out.println(code+"WxEntity  err_ok");
152
+                    System.out.println(code+"   WxEntity  err_ok");
153 153
 //                    EventBus.getDefault().post("success");
154 154
                     getOpenId(code);
155 155
                     finish();
@@ -198,11 +198,14 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
198 198
                         //绑定
199 199
                         //提现微信绑定
200 200
                         System.out.println("sssssssssssssssssssssssssssssssss");
201
-                        getBandOpenid(wechatOpenIdBeanDataJavaResponse.getData().getOpenid());
201
+                        String nickName = wechatOpenIdBeanDataJavaResponse.getData().getNickName();
202
+                        String avatar = wechatOpenIdBeanDataJavaResponse.getData().getHeadimgurl();
203
+                        System.out.println("sssssssssssssssssssssssssssssssss"+ nickName);
204
+                        Log.d(TAG, "wechat onSuccess:---nickname "+ nickName);
205
+                        getBandOpenid(wechatOpenIdBeanDataJavaResponse.getData().getOpenid(),nickName,avatar);
202 206
 /*                        getUpdateAccount(wechatOpenIdBeanDataJavaResponse.getData().getUnionid(),
203 207
                                 wechatOpenIdBeanDataJavaResponse.getData().getUser().getNickname(),
204 208
                                 wechatOpenIdBeanDataJavaResponse.getData().getUser().getAvatar());*/
205
-
206 209
                         finish();
207 210
                     } else {
208 211
 //                    //授权逻辑
@@ -214,7 +217,9 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
214 217
 //                    AuthService authService= NetworkApi.createService(AuthService.class);
215 218
                         Log.d(TAG, "wechat onSuccess: "+ wechatOpenIdBeanDataJavaResponse.getData());
216 219
                         String nickName = wechatOpenIdBeanDataJavaResponse.getData().getNickName();
217
-                        String avatar = wechatOpenIdBeanDataJavaResponse.getData().getAvater();
220
+                        String avatar = wechatOpenIdBeanDataJavaResponse.getData().getHeadimgurl();
221
+                        System.out.println(nickName+"----"+avatar);
222
+                        Log.d(TAG, "else wechat onSuccess:---nickname "+ nickName);
218 223
 //                        getUpdateAccount(code,nickName,avatar);
219 224
                         getWechatLogin(wechatOpenIdBeanDataJavaResponse.getData().getUnionid(),nickName,avatar);
220 225
                         finish();
@@ -243,10 +248,14 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
243 248
      * @param openid
244 249
      */
245 250
     @SuppressLint("CheckResult")
246
-    private void getBandOpenid(String openid) {
251
+    private void getBandOpenid(String openid,String nickname,String avatar) {
247 252
         ShowLoadingDialog.showLoadingDialog(WXEntryActivity.this);
248 253
         Map<String, Object> map = new HashMap<>();
249 254
         map.put("openid", openid);
255
+        map.put("nickname",nickname);
256
+        map.put("avatar",avatar);
257
+
258
+        Log.d(TAG, "getBandOpenid:api/user/extract/band_openid wechat "+ map);
250 259
         AuthService authService = NetworkApi.createService(AuthService.class);
251 260
         authService.getBandOpenid(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse>() {
252 261
             @Override
@@ -323,6 +332,7 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
323 332
         map.put("openid", openid);
324 333
         map.put("nickname",nickname);
325 334
         map.put("avatar",avatar);
335
+        Log.d(TAG, "getWechatLogin:api/wechat/check wechat "+ map);
326 336
         AuthService authService = NetworkApi.createService(AuthService.class);
327 337
         authService.getWechatLogIn(map).compose(NetworkApi.applySchedulers(new BaseObserver<DataResponse<LoginModel>>() {
328 338
             @Override

+ 59 - 7
app/src/main/res/layout/activity_tb.xml

@@ -48,6 +48,59 @@
48 48
             android:src="@mipmap/back_white"
49 49
             android:visibility="invisible" />
50 50
     </LinearLayout>
51
+
52
+    <RelativeLayout
53
+        android:id="@+id/layout_search"
54
+        android:layout_width="match_parent"
55
+        android:layout_height="35dp"
56
+        android:layout_marginTop="@dimen/dp_10"
57
+        android:orientation="horizontal"
58
+        android:paddingLeft="@dimen/dp_10"
59
+        android:paddingTop="3dp"
60
+        android:paddingRight="@dimen/dp_10"
61
+        android:paddingBottom="3dp"
62
+        app:layout_constraintLeft_toLeftOf="parent"
63
+        app:layout_constraintRight_toRightOf="parent"
64
+        app:layout_constraintTop_toBottomOf="@+id/title_layout">
65
+
66
+        <EditText
67
+            android:id="@+id/edt_search"
68
+            android:layout_width="match_parent"
69
+            android:layout_height="match_parent"
70
+            android:background="@drawable/shape_white_50dp"
71
+            android:drawableLeft="@mipmap/img_store_search"
72
+            android:drawablePadding="3dp"
73
+            android:gravity="center_vertical"
74
+            android:hint="请输入搜索内容"
75
+            android:textSize="14sp"
76
+            android:paddingLeft="@dimen/dp_10"
77
+            android:textColor="@color/black_333333"
78
+            android:layout_toLeftOf="@+id/tv_search"
79
+            />
80
+        <ImageView
81
+            android:id="@+id/img_clear"
82
+            android:layout_width="20dp"
83
+            android:layout_height="20dp"
84
+            android:src="@mipmap/search_cha_220616"
85
+            android:scaleType="centerInside"
86
+            android:layout_centerVertical="true"
87
+            android:layout_alignRight="@id/edt_search"
88
+            android:layout_marginRight="5dp"
89
+            android:visibility="gone"
90
+            />
91
+        <TextView
92
+            android:id="@+id/tv_search"
93
+            android:layout_width="wrap_content"
94
+            android:layout_height="match_parent"
95
+            android:gravity="center"
96
+            android:paddingLeft="@dimen/dp_10"
97
+            android:text="@string/search"
98
+            android:textColor="@color/white"
99
+            android:textSize="16sp"
100
+            android:layout_alignParentRight="true"
101
+            />
102
+    </RelativeLayout>
103
+
51 104
     <com.yihucha.hbyhc.view.RoundCornerImageView
52 105
         android:id="@+id/banner"
53 106
         android:layout_width="match_parent"
@@ -55,10 +108,10 @@
55 108
         android:layout_marginLeft="@dimen/dp_10"
56 109
         android:layout_marginTop="10dp"
57 110
         android:layout_marginRight="@dimen/dp_10"
58
-        app:layout_constraintLeft_toLeftOf="parent"
59 111
         android:scaleType="centerCrop"
60
-        app:rciv_radius="10dp"
61
-        app:layout_constraintTop_toBottomOf="@+id/title_layout" />
112
+        app:layout_constraintLeft_toLeftOf="parent"
113
+        app:layout_constraintTop_toBottomOf="@+id/layout_search"
114
+        app:rciv_radius="10dp" />
62 115
 
63 116
     <androidx.recyclerview.widget.RecyclerView
64 117
         android:id="@+id/rv_top_selector"
@@ -107,11 +160,10 @@
107 160
         android:id="@+id/img_to_top"
108 161
         android:layout_width="wrap_content"
109 162
         android:layout_height="wrap_content"
110
-        android:src="@mipmap/to_top"
111
-        app:layout_constraintRight_toRightOf="parent"
112
-        app:layout_constraintBottom_toBottomOf="parent"
113 163
         android:layout_marginRight="@dimen/dp_10"
114 164
         android:layout_marginBottom="20dp"
165
+        android:src="@mipmap/to_top"
115 166
         android:visibility="gone"
116
-        />
167
+        app:layout_constraintBottom_toBottomOf="parent"
168
+        app:layout_constraintRight_toRightOf="parent" />
117 169
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 1
jd_sdk_lib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties

@@ -1,4 +1,4 @@
1
-#Sat Apr 19 15:35:25 CST 2025
1
+#Wed Apr 23 14:26:03 CST 2025
2 2
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_normal.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_back_normal.png
3 3
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_back_pressed.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_back_pressed.png
4 4
 com.jd.jdsdk.jd_sdk_lib-main-7\:/drawable-xxhdpi/kepler_selcet_more_normal.png=/Users/wenjuan.su/Downloads/yihucha/jd_sdk_lib/build/intermediates/packaged_res/debug/drawable-xxhdpi-v4/kepler_selcet_more_normal.png