|
@@ -30,9 +30,17 @@ class XhcpHomeViewModel : BaseViewModel(){
|
|
|
*/
|
|
*/
|
|
|
val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
|
|
val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页广告
|
|
|
|
|
+ */
|
|
|
val bannerList : MutableLiveData<List<BannerData>> = MutableLiveData()
|
|
val bannerList : MutableLiveData<List<BannerData>> = MutableLiveData()
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 推广图片
|
|
|
|
|
+ */
|
|
|
|
|
+ var imageList: MutableLiveData<List<BannerData>> = MutableLiveData()
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 公告信息
|
|
* 公告信息
|
|
|
*/
|
|
*/
|
|
|
val noticeDataList : MutableLiveData<List<NoticeData>> = MutableLiveData()
|
|
val noticeDataList : MutableLiveData<List<NoticeData>> = MutableLiveData()
|
|
@@ -85,7 +93,8 @@ class XhcpHomeViewModel : BaseViewModel(){
|
|
|
*/
|
|
*/
|
|
|
fun getBanner(){
|
|
fun getBanner(){
|
|
|
val params = mutableMapOf<String,String>()
|
|
val params = mutableMapOf<String,String>()
|
|
|
- params.put("imageType","1")
|
|
|
|
|
|
|
+ // 获取目标:1,4
|
|
|
|
|
+// params.put("imageType","1")
|
|
|
MyOkHttpUtils().query(URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/Common/QueryImageConfigs",
|
|
MyOkHttpUtils().query(URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/Common/QueryImageConfigs",
|
|
|
callback = object : ResponseCallback<BaseResult<List<BannerData>>>() {
|
|
callback = object : ResponseCallback<BaseResult<List<BannerData>>>() {
|
|
|
override fun onResponse(response: BaseResult<List<BannerData>>?, id: Int) {
|
|
override fun onResponse(response: BaseResult<List<BannerData>>?, id: Int) {
|
|
@@ -103,17 +112,28 @@ class XhcpHomeViewModel : BaseViewModel(){
|
|
|
* @param datalist List<BannerEntity>
|
|
* @param datalist List<BannerEntity>
|
|
|
*/
|
|
*/
|
|
|
fun getBannerUrlList(datalist : List<BannerData>){
|
|
fun getBannerUrlList(datalist : List<BannerData>){
|
|
|
- val bannerUrlList = arrayListOf<String>()
|
|
|
|
|
- datalist.forEach {
|
|
|
|
|
- if (SPUtils.getInstance().getString(Constant.uploadUrl).contains("upload")){
|
|
|
|
|
-
|
|
|
|
|
- bannerUrlList.add(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + it.imagepath.substring(1))
|
|
|
|
|
- }else{
|
|
|
|
|
- bannerUrlList.add(SPUtils.getInstance().getString(Constant.uploadUrl) + it.imagepath.substring(1))
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// val bannerUrlList = arrayListOf<String>()
|
|
|
|
|
+// val imageUrlList = arrayListOf<String>()
|
|
|
|
|
+// datalist.forEach {
|
|
|
|
|
+// if (SPUtils.getInstance().getString(Constant.uploadUrl).contains("upload")){
|
|
|
|
|
+// if (it.imagetype == "1") {
|
|
|
|
|
+// bannerUrlList.add(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + it.imagepath.substring(1))
|
|
|
|
|
+// } else if (it.imagetype == "4") {
|
|
|
|
|
+// imageUrlList.add(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + it.imagepath.substring(1))
|
|
|
|
|
+// }
|
|
|
|
|
+// }else{
|
|
|
|
|
+// if (it.imagetype == "1") {
|
|
|
|
|
+// bannerUrlList.add(SPUtils.getInstance().getString(Constant.uploadUrl) + it.imagepath.substring(1))
|
|
|
|
|
+// } else if (it.imagetype == "4") {
|
|
|
|
|
+// imageUrlList.add(SPUtils.getInstance().getString(Constant.uploadUrl) + it.imagepath.substring(1))
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
bannerList.postValue(datalist.remove {
|
|
bannerList.postValue(datalist.remove {
|
|
|
- it.isshow == "0"
|
|
|
|
|
|
|
+ it.isshow == "0" || it.imagetype != "1"
|
|
|
|
|
+ })
|
|
|
|
|
+ imageList.postValue(datalist.remove {
|
|
|
|
|
+ it.isshow == "0" || it.imagetype != "4"
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|