Commit 2d83176b authored by david's avatar david Committed by 杨秀秀

bug修复

parent c85c664b
package com.xx.hbhconsumer.adapter;
import android.content.Context;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.bumptech.glide.Glide;
import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.data.http.respons.OrderBean;
import com.xx.hbhconsumer.data.http.respons.ShopAndGoodsBean;
import com.xx.hbhconsumer.data.http.respons.ShopBean;
import com.xx.hbhconsumer.databinding.ItemShopBinding;
import com.xx.hbhconsumer.utils.RetrofitClient;
import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter;
import java.util.ArrayList;
import java.util.List;
public class ShopAdapter extends xxBaseRecyclerViewAdapter<ItemShopBinding, ShopAndGoodsBean> {
public ShopAdapter(Context context) {
super(context);
......@@ -44,6 +40,13 @@ public class ShopAdapter extends xxBaseRecyclerViewAdapter<ItemShopBinding, Shop
//把adapterset进去
dataBind.rvGoods.setAdapter(orderListAdapter);
orderListAdapter.mList = data.getCommodityList();
if (data.getCommodityList().isEmpty()) {
dataBind.rlNoData.setVisibility(View.VISIBLE);
dataBind.rvGoods.setVisibility(View.GONE);
} else {
dataBind.rlNoData.setVisibility(View.GONE);
dataBind.rvGoods.setVisibility(View.VISIBLE);
}
}
......
......@@ -60,8 +60,8 @@ interface ApiService {
* 登陆
*/
@Headers("Content-type:application/json")
@GET("app/agreement/")
open fun agreement(@Query("basicName") basicName: String): Observable<BaseResponse<List<AgreementBean>>>
@GET("app/agreement/{basic}")
open fun agreement(@Path(value="basic") basic: String): Observable<BaseResponse<String>>
/**
* 登陆
......@@ -375,7 +375,7 @@ interface ApiService {
*/
@Headers("Content-type:application/json")
@POST("app/activity/queryAppActivityList")
fun getActivityList(@Body requestBody: RequestBody): Observable<BaseResponse<List<ActivityCenterBean>>>
fun getActivityList(@Body requestBody: RequestBody): Observable<BasePageResponse<ActivityCenterBean>>
/**
* 查询活动列表信息
*/
......
......@@ -32,7 +32,7 @@ public class ActivityRequest extends BaseRespons {
/**
* 活动列表
*/
public Observable<BaseResponse<List<ActivityCenterBean>>> getActivityList() {
public Observable<BasePageResponse<ActivityCenterBean>> getActivityList() {
ApiParams<GetActivityListRequestBody> apiParams = new ApiParams<>();
GetActivityListRequestBody requestBody = new GetActivityListRequestBody(LocalData.getAffiliatedCompany(), "1");
......
......@@ -14,7 +14,7 @@ public class AgreementRequest extends BaseRespons {
/**
* 低价好物商品列表
*/
public Observable<BaseResponse<List<AgreementBean>>> agreement(String basicName) {
return getApiService().agreement(basicName);
public Observable<BaseResponse<String>> agreement(String basic) {
return getApiService().agreement(basic);
}
}
......@@ -5,6 +5,7 @@ import com.xx.hbhconsumer.data.http.respons.CreditDetailBean;
import com.xx.hbhconsumer.data.http.respons.CreditGoodsBean;
import com.xx.hbhconsumer.data.http.respons.CreditGoodsDetailBean;
import com.xx.hbhconsumer.data.http.respons.CreditRecordBean;
import com.xx.hbhconsumer.data.http.respons.MemberInfoBean;
import io.reactivex.rxjava3.core.Observable;
import me.goldze.mvvmhabit.http.ApiParams;
......@@ -14,6 +15,14 @@ import okhttp3.RequestBody;
public class CreditRequest extends BaseRespons {
/**
* 获取会员信息
* @return
*/
public Observable<BaseResponse<MemberInfoBean>> memberInfo() {
return getApiService().memberInfo();
}
/**
* 低价好物商品列表
*/
......
......@@ -8,11 +8,11 @@ import me.goldze.mvvmhabit.http.ApiParams
class RegisterRequest: BaseRespons() {
/**
* 登陆
* 注册
*/
fun register(phone:String, pwd:String, code: String ): Observable<me.goldze.mvvmhabit.http.BaseResponse<RegisterBean>>
{
return apiService.register(ApiParams<RegisterRequestBody>().setParams(RegisterRequestBody(phone, pwd, code,"13")))
return apiService.register(ApiParams<RegisterRequestBody>().setParams(RegisterRequestBody(phone, pwd, "13",code)))
}
/**
......
package com.xx.hbhconsumer.data.http.respons
data class OrderBean(
val actualPayment: Double,
val actualPayment: Int,
val businessId: String,
val commodityList: List<Commodity>,
val couponId: String,
val couponList: List<Coupon>,
val couponList: List<CouponBean>,
val createBy: String,
val createTime: String,
val delFlag: String,
val delFlag: Any,
val inPay: String,
val member: Member,
val memberAccount: String,
......@@ -18,16 +18,19 @@ data class OrderBean(
val orderAmount: Double,
val orderNumber: String,
val orderStatus: String,
val payType: String,
val procedureRate: Int,
val payModeMessage: Any,
val payType: Any,
val payeeUserId: Any,
val procedureRate: Any,
val quantity: Int,
val rate: Int,
val rate: Any,
val remark: String,
val updateBy: String,
val updateTime: String
)
data class Commodity(
val businessId: String,
val commodityCategory: String,
val commodityCategoryId: String,
val commodityName: String,
......@@ -38,67 +41,48 @@ data class Commodity(
val price: String
)
data class Coupon(
val couponName: String,
val couponNumber: String,
val couponType: String,
val discountAmount: Int,
val giftName: String,
val receiveTime: String
)
data class Member(
val businessId: String,
val businessId: Any,
val gradeName: String,
val memberNickname: String,
val memberNumber: String,
val memberPhone: String,
val memberPictureFile: MemberPictureFile
val memberPictureFile: Any
)
data class Merchant(
val affiliatedCompany: String,
val boothNumber: String,
val companyLogoFile: CompanyLogoFile,
val companyName: String,
val logoFile: LogoFile,
val storeName: String
)
data class CommodityPicture(
val businessId: String,
val createBy: String,
val createTime: String,
val delFlag: String,
val businessId: Any,
val createBy: Any,
val createTime: Any,
val delFlag: Any,
val filePath: String,
val newFileName: String,
val originalFileName: String,
val remark: String,
val updateBy: String,
val updateTime: String,
val url: String
)
data class MemberPictureFile(
val businessId: String,
val createBy: String,
val createTime: String,
val delFlag: String,
val filePath: String,
val newFileName: String,
val originalFileName: String,
val remark: String,
val updateBy: String,
val updateTime: String,
val remark: Any,
val updateBy: Any,
val updateTime: Any,
val url: String
)
data class CompanyLogoFile(
val businessId: String,
val createBy: String,
val createTime: String,
val delFlag: String,
val businessId: Any,
val createBy: Any,
val createTime: Any,
val delFlag: Any,
val filePath: String,
val newFileName: String,
val originalFileName: String,
val remark: String,
val updateBy: String,
val updateTime: String,
val remark: Any,
val updateBy: Any,
val updateTime: Any,
val url: String
)
\ No newline at end of file
......@@ -59,13 +59,10 @@ public class ActivityFragment extends BaseFragment<FragmentActivityBinding, Acti
viewModel.goActivityDetail(data.getActivityUrl());
}
});
viewModel.activityList.observe(this, new Observer<List<ActivityCenterBean>>() {
@Override
public void onChanged(List<ActivityCenterBean> activityCenterBeans) {
if (activityCenterBeans != null && !activityCenterBeans.isEmpty()) {
adapter.mList = activityCenterBeans;
adapter.notifyDataSetChanged();
}
viewModel.activityList.observe(this, activityCenterBeans -> {
if (activityCenterBeans != null && !activityCenterBeans.isEmpty()) {
adapter.mList = activityCenterBeans;
adapter.notifyDataSetChanged();
}
});
}
......
......@@ -135,7 +135,7 @@ public class ActivityViewModel extends BaseViewModel<ActivityRequest> {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).subscribe(new ApiDisposableObserver<List<ActivityCenterBean>>() {
}).subscribe(new ApiDisposablePageObserver<ActivityCenterBean>() {
@Override
public void onSuccess(List<ActivityCenterBean> resultBean) {
activityList.postValue(resultBean);
......@@ -146,6 +146,11 @@ public class ActivityViewModel extends BaseViewModel<ActivityRequest> {
dismissDialog();
}
@Override
public void getTotal(int total) {
}
});
}
......
......@@ -82,7 +82,13 @@ public class CouponListViewModel extends BaseViewModel<CouponRequest> {
}).subscribe(new ApiDisposablePageObserver<ActivityCouponBean>() {
@Override
public void onSuccess(List<ActivityCouponBean> resultBean) {
couponList.postValue(resultBean);
List<ActivityCouponBean> list = new ArrayList<>();
for (ActivityCouponBean activityCouponBean : resultBean) {
if ("1".equals(activityCouponBean.getCouponType())) {
list.add(activityCouponBean);
}
}
couponList.postValue(list);
}
@Override
......
......@@ -3,13 +3,9 @@ package com.xx.hbhconsumer.ui.credit;
import android.os.Bundle;
import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.adapter.CouponAdapter;
import com.xx.hbhconsumer.data.http.respons.OrderBean;
import com.xx.hbhconsumer.databinding.ActivityCouponListBinding;
import com.xx.hbhconsumer.data.http.requst.AgreementRequest;
import com.xx.hbhconsumer.databinding.ActivityCreditDescriptionBinding;
import java.util.ArrayList;
import java.util.List;
import com.xx.hbhconsumer.utils.RetrofitClient;
import me.goldze.mvvmhabit.base.BaseActivity;
import me.tatarka.bindingcollectionadapter2.BR;
......@@ -19,6 +15,12 @@ public class CreditDescriptionActivity extends BaseActivity<ActivityCreditDescri
@Override
public void initData() {
super.initData();
viewModel.url.observe(this, agreementBean -> {
if (agreementBean != null) {
binding.webview.loadUrl(RetrofitClient.baseH5Url + agreementBean);
}
});
}
@Override
......@@ -31,4 +33,9 @@ public class CreditDescriptionActivity extends BaseActivity<ActivityCreditDescri
return BR.creditDescriptionViewModel;
}
@Override
public CreditDescriptionViewModel initViewModel() {
AgreementRequest loginRequest = new AgreementRequest();
return new CreditDescriptionViewModel(getApplication(), loginRequest);
}
}
......@@ -3,17 +3,66 @@ package com.xx.hbhconsumer.ui.credit;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import com.xx.hbhconsumer.data.http.requst.AgreementRequest;
import com.xx.hbhconsumer.data.http.requst.PhoneRequest;
import com.xx.hbhconsumer.ui.storeservices.StoreServicesViewModel;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.http.ApiDisposableObserver;
import me.goldze.mvvmhabit.utils.RxUtils;
public class CreditDescriptionViewModel extends BaseViewModel<PhoneRequest> {
public class CreditDescriptionViewModel extends BaseViewModel<AgreementRequest> {
public MutableLiveData<String> url = new MutableLiveData<>(null);
public CreditDescriptionViewModel(@NonNull Application application) {
super(application);
}
public CreditDescriptionViewModel(@NonNull Application application, PhoneRequest model) {
public CreditDescriptionViewModel(@NonNull Application application, AgreementRequest model) {
super(application, model);
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onResume() {
super.onResume();
loadAgreement();
}
public void loadAgreement() {
model.agreement("4")
.compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(CreditDescriptionViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).subscribe(new ApiDisposableObserver<String>() {
@Override
public void onSuccess(String resultBean) {
url.postValue(resultBean);
}
@Override
public void onError(String Error) {
dismissDialog();
}
});
}
}
......@@ -27,7 +27,7 @@ public class MyCreditActivity extends BaseActivity<ActivityMyCreditBinding, MyCr
@Override
public void initData() {
super.initData();
viewModel.integralTotal.observe(this, integralTotal -> binding.tvCreditNum.setText(String.valueOf(integralTotal)));
viewModel.creditGoodsBeanList.observe(this, creditGoodsBeanList -> {
GridLayoutManager manager = new GridLayoutManager(this,2);
binding.rvCreditGoodsList.setLayoutManager(manager);
......
......@@ -9,6 +9,8 @@ import androidx.lifecycle.MutableLiveData;
import com.xx.hbhconsumer.data.http.requst.CreditRequest;
import com.xx.hbhconsumer.data.http.respons.CreditGoodsBean;
import com.xx.hbhconsumer.data.http.respons.CreditRecordBean;
import com.xx.hbhconsumer.data.http.respons.MemberInfoBean;
import com.xx.hbhconsumer.ui.mine.MineViewModel;
import com.xx.hbhconsumer.ui.useragreement.UserAgreementActivity;
import java.util.ArrayList;
......@@ -19,11 +21,12 @@ import io.reactivex.rxjava3.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.http.ApiDisposableObserver;
import me.goldze.mvvmhabit.http.ApiDisposablePageObserver;
import me.goldze.mvvmhabit.utils.RxUtils;
public class MyCreditViewModel extends BaseViewModel<CreditRequest> {
public MutableLiveData<Integer> integralTotal = new MutableLiveData<>(0);
public MutableLiveData<List<CreditGoodsBean>> creditGoodsBeanList = new MutableLiveData<>(new ArrayList<>());
public MutableLiveData<List<CreditRecordBean>> creditRecordBeanList = new MutableLiveData<>(new ArrayList<>());
......@@ -50,6 +53,27 @@ public class MyCreditViewModel extends BaseViewModel<CreditRequest> {
super.onResume();
loadGoodsList();
loadCreditRecordList();
memberInfo();
}
/**
* 获取积分
*/
private void memberInfo() {
model.memberInfo().compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(MyCreditViewModel.this)
.doOnSubscribe((Consumer<Disposable>) disposable -> {
}).subscribe(new ApiDisposableObserver<MemberInfoBean>() {
@Override
public void onSuccess(MemberInfoBean resultBean) {
integralTotal.postValue(resultBean.getUsableIntegral());
}
@Override
public void onError(String Error) {
dismissDialog();
}
});
}
private void loadCreditRecordList() {
......@@ -63,7 +87,13 @@ public class MyCreditViewModel extends BaseViewModel<CreditRequest> {
}).subscribe(new ApiDisposablePageObserver<CreditRecordBean>() {
@Override
public void onSuccess(List<CreditRecordBean> resultBean) {
creditRecordBeanList.postValue(resultBean);
if (resultBean != null && resultBean.size() <= 3) {
creditRecordBeanList.postValue(resultBean);
}
if (resultBean != null && resultBean.size() > 3) {
creditRecordBeanList.postValue(resultBean.subList(0, 3));
}
}
@Override
......@@ -119,8 +149,9 @@ public class MyCreditViewModel extends BaseViewModel<CreditRequest> {
@Override
public void call() {
Bundle bundle = new Bundle();
bundle.putString("basicName", " 积分说明");
startActivity(UserAgreementActivity.class);
bundle.putString("basic", "4");
bundle.putString("basicName", "积分说明");
startActivity(UserAgreementActivity.class, bundle);
}
});
......
......@@ -59,9 +59,9 @@ public class CreditOrderListFragment extends BaseFragment<FragmentCreditOrderLis
Integer orderStatus = args.getInt("orderStatus");
String status = "";
if (orderStatus == 1) {
status = "2";
} else if (orderStatus == 2) {
status = "1";
} else if (orderStatus == 2) {
status = "0";
}
return new CreditOrderListViewModel(getActivity().getApplication(), model, status);
}
......
......@@ -2,6 +2,7 @@ package com.xx.hbhconsumer.ui.goods;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
......@@ -53,6 +54,14 @@ public class GoodFragment extends BaseFragment<FragmentGoodBinding, GoodViewMode
viewModel.secondBeanList.observe(this, secondBeanList -> {
if (secondBeanList.isEmpty()) {
binding.rlNoData.setVisibility(View.VISIBLE);
binding.rvSecondCategoryList.setVisibility(View.GONE);
} else {
binding.rlNoData.setVisibility(View.GONE);
binding.rvSecondCategoryList.setVisibility(View.VISIBLE);
}
//获取适配器上下文
GridLayoutManager manager = new GridLayoutManager(getActivity(),2);
binding.rvSecondCategoryList.setLayoutManager(manager);
......
......@@ -42,6 +42,8 @@ public class GoodViewModel extends BaseViewModel<CategoryRequest> {
@Override
public void onCreate() {
super.onCreate();
String affiliatedCompany = LocalData.getAffiliatedCompany();
loadData(affiliatedCompany);
}
@Override
......@@ -52,8 +54,6 @@ public class GoodViewModel extends BaseViewModel<CategoryRequest> {
@Override
public void onResume() {
super.onResume();
String affiliatedCompany = LocalData.getAffiliatedCompany();
loadData(affiliatedCompany);
}
private void loadData(String affiliatedCompany) {
......
package com.xx.hbhconsumer.ui.goods;
import android.os.Bundle;
import android.view.View;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.GridLayoutManager;
......@@ -32,18 +33,28 @@ public class GoodsListActivity extends BaseActivity<ActivityGoodsListBinding, Go
public void initData() {
super.initData();
//获取适配器上下文
GoodsAdapter goodsAdapter = new GoodsAdapter(GoodsListActivity.this);
//获取适配器上下文
GridLayoutManager manager = new GridLayoutManager(GoodsListActivity.this,2);
binding.rvGoodsList.setLayoutManager(manager);
//把adapterset进去
binding.rvGoodsList.setAdapter(goodsAdapter);
goodsAdapter.setOnItemClick((position, data) -> viewModel.goGoodsDetail(data.getBusinessId()));
viewModel.goodsBeanList.observe(this, new Observer<List<GoodsBean>>() {
@Override
public void onChanged(List<GoodsBean> goodsBeanList) {
//获取适配器上下文
GoodsAdapter goodsAdapter = new GoodsAdapter(GoodsListActivity.this);
//获取适配器上下文
GridLayoutManager manager = new GridLayoutManager(GoodsListActivity.this,2);
binding.rvGoodsList.setLayoutManager(manager);
//把adapterset进去
binding.rvGoodsList.setAdapter(goodsAdapter);
if (goodsBeanList.isEmpty()) {
binding.rlNoData.setVisibility(View.VISIBLE);
binding.rvGoodsList.setVisibility(View.GONE);
} else {
binding.rlNoData.setVisibility(View.GONE);
binding.rvGoodsList.setVisibility(View.VISIBLE);
}
goodsAdapter.mList = goodsBeanList;
goodsAdapter.setOnItemClick((position, data) -> viewModel.goGoodsDetail(data.getBusinessId()));
goodsAdapter.notifyDataSetChanged();
}
});
......
......@@ -72,8 +72,9 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
@Override
public void call() {
Bundle bundle = new Bundle();
bundle.putString("basicName", " 隐私协议");
startActivity(UserAgreementActivity.class);
bundle.putString("basic", "3");
bundle.putString("basicName", "隐私协议");
startActivity(UserAgreementActivity.class, bundle);
}
});
......@@ -82,8 +83,9 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
@Override
public void call() {
Bundle bundle = new Bundle();
bundle.putString("basicName", " 用户协议");
startActivity(UserAgreementActivity.class);
bundle.putString("basicName", "用户协议");
bundle.putString("basic", "5");
startActivity(UserAgreementActivity.class, bundle);
}
});
......@@ -117,8 +119,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
}else if (!consentAgreementFlag.getValue()) {
ToastUtils.showShort("请勾选同意协议");
}else {
model.Login(/*userName.get().toString(), password.get().toString()*/"18622655123","Aa123456")
// model.Login(userName.get().toString(), password.get().toString())
// model.Login(/*userName.get().toString(), password.get().toString()*/"18622655123","Aa123456")
model.Login(userName.get().toString(), password.get().toString())
.compose(RxUtils.schedulersTransformer()) //线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
.doOnSubscribe(LoginViewModel.this)
......
......@@ -113,7 +113,6 @@ public class OrderDetailActivity extends BaseActivity<ActivityOrderDetailBinding
binding.tvDiscountLabel.setVisibility(View.VISIBLE);
binding.llDiscountPrice.setVisibility(View.VISIBLE);
binding.llCoupon.setVisibility(View.GONE);
binding.llNoPay.setVisibility(View.GONE);
if (!orderBean.getCouponList().isEmpty() && "2".equals(orderBean.getCouponList().get(0).getCouponType())) {
......@@ -130,7 +129,6 @@ public class OrderDetailActivity extends BaseActivity<ActivityOrderDetailBinding
} else if ("3".equals(orderBean.getOrderStatus())) {
binding.ivStatusIcon.setImageDrawable(getDrawable(R.mipmap.dingdanxiangqing_icon_guanbi));
binding.tvStatus.setText("已关闭");
binding.rlButton.setVisibility(View.GONE);
binding.tvDiscountLabel.setVisibility(View.GONE);
binding.llDiscountPrice.setVisibility(View.GONE);
......
......@@ -46,8 +46,9 @@ public class RegisterViewModel extends BaseViewModel<RegisterRequest> {
@Override
public void call() {
Bundle bundle = new Bundle();
bundle.putString("basicName", " 隐私协议");
startActivity(UserAgreementActivity.class);
bundle.putString("basic", "3");
bundle.putString("basicName", "隐私协议");
startActivity(UserAgreementActivity.class, bundle);
}
});
......@@ -56,8 +57,9 @@ public class RegisterViewModel extends BaseViewModel<RegisterRequest> {
@Override
public void call() {
Bundle bundle = new Bundle();
bundle.putString("basicName", " 用户协议");
startActivity(UserAgreementActivity.class);
bundle.putString("basic", "5");
bundle.putString("basicName", "用户协议");
startActivity(UserAgreementActivity.class, bundle);
}
});
......
......@@ -36,8 +36,9 @@ public class SettingsViewModel extends BaseViewModel<SettingsRequest> {
@Override
public void call() {
Bundle bundle = new Bundle();
bundle.putString("basicName", " 隐私协议");
startActivity(UserAgreementActivity.class);
bundle.putString("basicName", "隐私协议");
bundle.putString("basic", "3");
startActivity(UserAgreementActivity.class, bundle);
}
});
......
package com.xx.hbhconsumer.ui.storeservices;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import android.view.View;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.data.http.requst.AgreementRequest;
import com.xx.hbhconsumer.databinding.ActivityStoreServicesBinding;
import com.xx.hbhconsumer.ui.order.OrderListFragment;
import com.xx.hbhconsumer.ui.useragreement.UserAgreementViewModel;
import com.xx.hbhconsumer.utils.RetrofitClient;
import me.goldze.mvvmhabit.base.BaseActivity;
import me.tatarka.bindingcollectionadapter2.BR;
......@@ -25,9 +19,14 @@ public class StoreServicesActivity extends BaseActivity<ActivityStoreServicesBin
super.initData();
viewModel.agreementBean.observe(this, agreementBean -> {
if (agreementBean != null) {
String baseHtml = "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"></head><body style=\"margin: 0; padding: 0;\">";
binding.webview.loadDataWithBaseURL(null, baseHtml + agreementBean.getBasicContent() + "</body></html>", "text/html", "utf-8", null);
if ("1".equals(viewModel.basic)) {
binding.webview1.setVisibility(View.VISIBLE);
binding.webview2.setVisibility(View.GONE);
binding.webview1.loadUrl(RetrofitClient.baseH5Url + agreementBean);
} else {
binding.webview1.setVisibility(View.GONE);
binding.webview2.setVisibility(View.VISIBLE);
binding.webview2.loadUrl(RetrofitClient.baseH5Url + agreementBean);
}
});
......@@ -39,10 +38,12 @@ public class StoreServicesActivity extends BaseActivity<ActivityStoreServicesBin
switch (tab.getPosition()) {
case 0:
viewModel.loadAgreement("会员体系");
viewModel.basic = "1";
viewModel.loadAgreement();
break;
case 1:
viewModel.loadAgreement("服务条款");
viewModel.basic = "2";
viewModel.loadAgreement();
break;
}
}
......
......@@ -20,7 +20,7 @@ import me.goldze.mvvmhabit.utils.RxUtils;
public class StoreServicesViewModel extends BaseViewModel<AgreementRequest> {
public MutableLiveData<AgreementBean> agreementBean = new MutableLiveData<>(null);
public MutableLiveData<String> agreementBean = new MutableLiveData<>(null);
public StoreServicesViewModel(@NonNull Application application) {
super(application);
......@@ -30,6 +30,7 @@ public class StoreServicesViewModel extends BaseViewModel<AgreementRequest> {
super(application, model);
}
public String basic = "1";
@Override
public void onCreate() {
......@@ -44,24 +45,21 @@ public class StoreServicesViewModel extends BaseViewModel<AgreementRequest> {
@Override
public void onResume() {
super.onResume();
loadAgreement("会员体系");
loadAgreement();
}
public void loadAgreement(String basicName) {
model.agreement(basicName)
public void loadAgreement() {
model.agreement(basic)
.compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(StoreServicesViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).subscribe(new ApiDisposableObserver<List<AgreementBean>>() {
}).subscribe(new ApiDisposableObserver<String>() {
@Override
public void onSuccess(List<AgreementBean> resultBean) {
if (resultBean != null && !resultBean.isEmpty()) {
agreementBean.postValue(resultBean.get(0));
}
public void onSuccess(String resultBean) {
agreementBean.postValue(resultBean);
}
@Override
......
......@@ -4,9 +4,9 @@ import android.os.Bundle;
import com.xx.hbhconsumer.BR;
import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.adapter.ImageBannerAdapter;
import com.xx.hbhconsumer.data.http.requst.AgreementRequest;
import com.xx.hbhconsumer.databinding.ActivityUserAgreementBinding;
import com.xx.hbhconsumer.utils.RetrofitClient;
import me.goldze.mvvmhabit.base.BaseActivity;
......@@ -24,8 +24,7 @@ public class UserAgreementActivity extends BaseActivity<ActivityUserAgreementBin
binding.bar.tv_title.setText(basicName);
viewModel.agreementBean.observe(this, agreementBean -> {
if (agreementBean != null) {
String baseHtml = "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"></head><body style=\"margin: 0; padding: 0;\">";
binding.webview.loadDataWithBaseURL(null, baseHtml + agreementBean.getBasicContent() + "</body></html>", "text/html", "utf-8", null);
binding.webview.loadUrl(RetrofitClient.baseH5Url + agreementBean);
}
});
}
......@@ -42,7 +41,7 @@ public class UserAgreementActivity extends BaseActivity<ActivityUserAgreementBin
@Override
public UserAgreementViewModel initViewModel() {
AgreementRequest loginRequest = new AgreementRequest();
String basicName = getIntent().getStringExtra("basicName");
return new UserAgreementViewModel(getApplication(), loginRequest, basicName);
String basic = getIntent().getStringExtra("basic");
return new UserAgreementViewModel(getApplication(), loginRequest, basic);
}
}
......@@ -7,10 +7,6 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import com.xx.hbhconsumer.data.http.requst.AgreementRequest;
import com.xx.hbhconsumer.data.http.respons.AgreementBean;
import java.util.List;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseViewModel;
......@@ -19,11 +15,11 @@ import me.goldze.mvvmhabit.utils.RxUtils;
public class UserAgreementViewModel extends BaseViewModel<AgreementRequest> {
public MutableLiveData<AgreementBean> agreementBean = new MutableLiveData<>(null);
private String basicName;
public UserAgreementViewModel(@NonNull Application application, AgreementRequest model, String basicName) {
public MutableLiveData<String> agreementBean = new MutableLiveData<>(null);
private String basic;
public UserAgreementViewModel(@NonNull Application application, AgreementRequest model, String basic) {
super(application, model);
this.basicName = basicName;
this.basic = basic;
}
@Override
......@@ -43,30 +39,24 @@ public class UserAgreementViewModel extends BaseViewModel<AgreementRequest> {
}
private void loadAgreement() {
model.agreement(basicName)
model.agreement(basic)
.compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(UserAgreementViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).subscribe(new ApiDisposableObserver<List<AgreementBean>>() {
}).subscribe(new ApiDisposableObserver<String>() {
@Override
public void onSuccess(List<AgreementBean> resultBean) {
if (resultBean != null && !resultBean.isEmpty()) {
agreementBean.postValue(resultBean.get(0));
public void onSuccess(String resultBean) {
if (resultBean != null) {
agreementBean.postValue(resultBean);
}
}
@Override
public void onError(String Error) {
dismissDialog();
}
});
}
}
......
......@@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/zhanwei_img_wushuju"/>
android:src="@mipmap/zhanwei_img_wushuju" />
</RelativeLayout>
......
......@@ -101,6 +101,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv_new_password_label"
android:layout_below="@id/view_divider1"
android:layout_marginTop="24dp"
android:text="*"
android:textSize="16sp"
......@@ -141,6 +142,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv_repeat_password_label"
android:layout_below="@id/view_divider2"
android:layout_marginTop="24dp"
android:text="*"
android:textSize="16sp"
......
......@@ -33,6 +33,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<wendu.dsbridge.DWebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_marginTop="11dp"
android:layout_marginBottom="17dp" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
......
......@@ -16,7 +16,7 @@
<com.xx.xxviewlibrary.witget.XxBar
android:id="@+id/bar"
bar_title="@{@string/my_order}"
bar_title="@{@string/my_credit_order}"
on_click="@{creditOrderViewModel.clickFinish}"
android:layout_width="match_parent"
android:layout_height="55dp"
......
......@@ -18,7 +18,7 @@
<com.xx.xxviewlibrary.witget.XxBar
android:id="@+id/bar"
on_click="@{creditsExchangeViewModel.clickFinish}"
bar_title="积分兑换"
bar_title="@{@string/credit_exchange}"
android:layout_width="match_parent"
android:layout_height="55dp" />
......
......@@ -130,10 +130,25 @@
android:id="@+id/rv_goods_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="17dp"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_below="@id/rl_category_bar"/>
<RelativeLayout
android:id="@+id/rl_no_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rl_category_bar">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/zhanwei_img_wushuju" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -19,7 +19,7 @@
<com.xx.xxviewlibrary.witget.XxBar
android:id="@+id/bar"
on_click="@{myCreditViewModel.clickFinish}"
bar_title="我的积分"
bar_title="@{@string/my_credit}"
android:layout_width="match_parent"
android:layout_height="55dp" />
......
......@@ -17,7 +17,7 @@
<com.xx.xxviewlibrary.witget.XxBar
android:id="@+id/bar"
on_click="@{newProductsViewModel.clickFinish}"
bar_title="新品速递"
bar_title="@{@string/new_product}"
android:layout_width="match_parent"
android:layout_height="55dp"/>
......
......@@ -30,7 +30,7 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="92dp"
android:layout_above="@id/rl_button"
android:background="@color/bg_grey"
android:layout_below="@id/bar">
......
......@@ -12,21 +12,31 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fitsSystemWindows="true">
<com.xx.xxviewlibrary.witget.XxBar
android:id="@+id/bar"
bar_title="@{@string/my_order}"
bar_title="@{@string/shop_services}"
on_click="@{storeServicesViewModel.clickFinish}"
android:layout_width="match_parent"
android:layout_height="55dp"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_below="@id/bar"
android:src="@mipmap/mendiangfuwu_img_banner"/>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/bg_grey"
android:layout_marginTop="25dp"
android:background="@color/white"
app:tabIndicatorColor="#5971A4"
app:tabIndicatorHeight="2dp"
app:tabIndicatorFullWidth="false"
......@@ -34,7 +44,7 @@
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabSelectedTextColor="#5971A4"
android:layout_below="@id/bar"
android:layout_below="@id/iv_banner"
app:tabTextColor="@color/black"
app:tabBackground="@null"
app:tabRippleColor="@null"
......@@ -53,11 +63,19 @@
</com.google.android.material.tabs.TabLayout>
<wendu.dsbridge.DWebView
android:id="@+id/webview"
android:id="@+id/webview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="17dp"
android:layout_below="@id/tabLayout" />
<wendu.dsbridge.DWebView
android:id="@+id/webview2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="17dp"
android:paddingRight="17dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="17dp"
android:layout_below="@id/tabLayout" />
</RelativeLayout>
......
......@@ -17,15 +17,12 @@
<com.xx.xxviewlibrary.witget.XxBar
android:id="@+id/bar"
on_click="@{userAgreementViewModel.clickFinish}"
bar_title="@{@string/my_order}"
android:layout_width="match_parent"
android:layout_height="55dp"
app:layout_constraintTop_toTopOf="parent" />
<wendu.dsbridge.DWebView
android:id="@+id/webview"
android:paddingLeft="17dp"
android:paddingRight="17dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/bar"/>
......
......@@ -49,6 +49,21 @@
android:layout_height="match_parent"
binding:layoutManager="@{LayoutManagers.linear(1,false)}"/>
<RelativeLayout
android:id="@+id/rl_no_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@id/rv_first_category_list"
android:layout_below="@id/tv_title">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/zhanwei_img_wushuju" />
</RelativeLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -317,7 +317,7 @@
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/home_icon_huanbohai"
android:src="@mipmap/wode_icon_daifukuan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -349,7 +349,7 @@
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/home_icon_rencaizhaopin"
android:src="@mipmap/wode_icon_yiwancheng"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -382,7 +382,7 @@
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/home_icon_jifen"
android:src="@mipmap/wode_icon_yiguanbi"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -463,7 +463,7 @@
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/home_icon_huanbohai"
android:src="@mipmap/wode_icon_jifendailing"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -495,7 +495,7 @@
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/home_icon_rencaizhaopin"
android:src="@mipmap/wode_icon_jifenwancheng"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
......@@ -18,6 +18,7 @@
android:id="@+id/iv_idb_select"
android:layout_width="match_parent"
android:layout_height="170dp"
android:scaleType="fitXY"
android:layout_marginBottom="13dp"/>
</LinearLayout>
......
......@@ -19,6 +19,7 @@
android:id="@+id/iv_goods_img"
android:layout_width="165dp"
android:layout_height="165dp"
android:scaleType="fitXY"
android:src="@mipmap/home_img_rexiaoqu"/>
<RadioGroup
......
......@@ -10,15 +10,15 @@
</data>
<RelativeLayout
android:layout_width="165dp"
android:layout_width="152dp"
android:layout_height="wrap_content"
android:layout_marginBottom="31dp"
android:background="@drawable/bg_white_radius_12">
<ImageView
android:id="@+id/iv_goods_img"
android:layout_width="165dp"
android:layout_height="165dp"
android:layout_width="152dp"
android:layout_height="152dp"
android:scaleType="centerCrop"
android:src="@mipmap/home_img_rexiaoqu"/>
......
......@@ -14,6 +14,7 @@
<RelativeLayout
android:layout_width="165dp"
android:layout_height="wrap_content"
android:layout_marginBottom="11dp"
android:background="@drawable/bg_white_radius_12">
<ImageView
......@@ -32,26 +33,17 @@
android:layout_marginLeft="13dp"
android:layout_marginTop="21dp"
android:layout_marginRight="13dp"
android:ellipsize="end"
android:singleLine="true"
android:text="ULVSBODA乌斯博"
android:textColor="#FF333333"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_goods_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_goods_name"
android:layout_marginLeft="13dp"
android:layout_marginTop="13dp"
android:layout_marginRight="13dp"
android:text="电动躺椅,列库恩,蓝黑色,194*702*32"
android:textColor="#FF757575"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_goods_desc"
android:layout_below="@id/tv_goods_name"
android:layout_marginLeft="13dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="14dp"
......
......@@ -19,6 +19,7 @@
android:id="@+id/iv_goods_img"
android:layout_width="165dp"
android:layout_height="165dp"
android:scaleType="fitXY"
android:src="@mipmap/home_img_rexiaoqu"/>
<TextView
......@@ -28,6 +29,8 @@
android:layout_below="@id/iv_goods_img"
android:layout_marginTop="17dp"
android:layout_marginLeft="11dp"
android:ellipsize="end"
android:singleLine="true"
android:text="单人沙发扶手椅"
android:textSize="16sp"
android:textColor="#FF333333"
......
......@@ -12,8 +12,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="21dp"
android:background="@color/white">
android:layout_marginBottom="21dp">
<LinearLayout
android:layout_width="match_parent"
......@@ -27,6 +26,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:textSize="16sp"
android:textColor="#333333"
android:text="@={shopAndGoodsBean.storeName}"/>
......@@ -36,6 +36,21 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<RelativeLayout
android:id="@+id/rl_no_data"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"
android:src="@mipmap/zhanwei_img_wushuju" />
</RelativeLayout>
</LinearLayout>
<ImageView
......@@ -44,6 +59,7 @@
android:layout_height="72dp"
android:layout_marginTop="8dp"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:src="@mipmap/home_img_rexiaoqu"/>
</RelativeLayout>
......
......@@ -28,6 +28,8 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/iv_category_image"
android:ellipsize="end"
android:singleLine="true"
android:layout_marginTop="13dp"
android:textSize="13sp"
android:textColor="#FF333333"/>
......
......@@ -11,10 +11,11 @@
<!--navigationBar底部菜单-->
<!--首页-->
<string name="navigation_home">首页</string>
<string name="news_detail">咨询详情</string>
<string name="news_detail">资讯详情</string>
<string name="recruit_detail">招聘详情</string>
<string name="credit_detail">积分明细</string>
<!--环渤海-->
<string name="new_product">新品速递</string>
<string name="navigation_sea">环渤海</string>
<string name="navigation_shop">店铺</string>
<string name="navigation_activity">活动</string>
......@@ -99,6 +100,10 @@
<!--我的模块 菜单列表-->
<string name="setting">账号设置</string>
<string name="my_order">我的订单</string>
<string name="credit_info">积分说明</string>
<string name="credit_exchange">积分兑换</string>
<string name="my_credit_order">积分订单</string>
<string name="my_credit">我的积分</string>
<string name="my_coupon">我的优惠券</string>
<!--2-->
<string name="change_password">修改密码</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment