添加我的发布页面

This commit is contained in:
wangyu 2026-01-08 15:58:03 +08:00
parent ec58f1c53a
commit e924a9f2a7
149 changed files with 1808 additions and 465 deletions

View File

@ -2,11 +2,11 @@ package com.cheng.bole.bean
import java.io.Serializable
class AreaBean(
class AreaEntity(
val id: Int = 0,
val pid: Int = 0,
val name: String = "",
val amount: String = "",
var children: MutableList<AreaBean> = mutableListOf(),
var children: MutableList<AreaEntity> = mutableListOf(),
var isChecked: Boolean = false
) : Serializable

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class AttachmentBean(
data class AttachmentEntity(
val id: String = "",
val url: String,
val type: String,

View File

@ -2,11 +2,11 @@ package com.cheng.bole.bean
import java.io.Serializable
data class BidDetailBean(
data class BidDetailEntity(
val city: Int,
val city_id: String,
val city_name: String,
val contact: List<ContactsInfoBean>,
val contact: List<ContactsEntity>,
val contact_name: String,
val contact_phone: String,
val content_type: String,
@ -14,7 +14,7 @@ data class BidDetailBean(
val info_source: String,
val is_fav: Boolean,
val issue_time: String,
val origin_attachment: List<AttachmentBean>,
val origin_attachment: List<AttachmentEntity>,
val origin_title: String,
val origin_content: Any,
val origin_url: String,

View File

@ -1,6 +1,6 @@
package com.cheng.bole.bean
data class BidItemBean(
data class BidItemEntity(
val id: String,
val recommend_id: String, //订阅消息
val info_source: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class BidTypeBean(
data class BidTypeEntity(
val id: String = "",
val name: String = "",
val sort: Int = 0,

View File

@ -2,11 +2,11 @@ package com.cheng.bole.bean
import java.io.Serializable
data class CompanyBean(
data class CompanyEntity(
val city_id: String,
val city_name: String,
val company_name: String,
val contact: List<ContactsInfoBean>,
val city_name: String?,
val company_name: String?,
val contact: List<ContactsEntity>,
val create_time: String,
val extra: Any?,
val file_id: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
class ContactsInfoBean(
class ContactsEntity(
val id: String,
var name: String,
var phone: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class CorpInfoBean(
data class CorpEntity(
val id: String,
val corp_name: String,
val sub_user_limit: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class GuideTotalBidInfoBean(
data class GuideTotalBidEntity(
val bidCount: Int,
val hasContact: Int,
val maxMoney: Int,

View File

@ -1,6 +1,6 @@
package com.cheng.bole.bean
data class GuideUpdateInfoBean(
data class GuideUpdateEntity(
val count: Int,
val day: String
)

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class HotWordBean(
data class HotWordEntity(
val id: Int,
val name: String,
val children: List<Child> = emptyList(),

View File

@ -2,11 +2,11 @@ package com.cheng.bole.bean
import java.io.Serializable
data class MerchantGoodsBean(
data class MerchantGoodsEntity(
val city_id: String,
val city_name: String,
val company: CompanyBean,
val contact: List<ContactsInfoBean>,
val company: CompanyEntity,
val contact: List<ContactsEntity>,
val create_time: String,
val file: List<UploadFileEntity>,
val goods_description: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class OrderBean(
data class OrderEntity(
val create_time: String,
val goods_name: String,
val id: String,

View File

@ -3,7 +3,7 @@ package com.cheng.bole.bean
import com.cheng.bole.manager.UserConfigManager
import java.io.Serializable
class SearchOptionBean(
class SearchOptionEntity(
val title: String,
val items: List<OptionItem>,
var isChecked: Boolean = false
@ -18,10 +18,10 @@ class SearchOptionBean(
) : Serializable
companion object {
fun getAreaOptionList(): List<SearchOptionBean> {
fun getAreaOptionList(): List<SearchOptionEntity> {
val areaList = UserConfigManager.getAreaList()
val list = mutableListOf<SearchOptionBean>()
list.add(SearchOptionBean("全国地区", listOf(
val list = mutableListOf<SearchOptionEntity>()
list.add(SearchOptionEntity("全国地区", listOf(
OptionItem(0, "全国", true)
)))
areaList.forEach { area ->
@ -30,14 +30,14 @@ class SearchOptionBean(
area.children.forEach { city ->
cityList.add(OptionItem(city.id, city.name))
}
list.add(SearchOptionBean(area.name, cityList))
list.add(SearchOptionEntity(area.name, cityList))
}
return list
}
fun getTimeOptionList(): List<SearchOptionBean> {
val list = mutableListOf<SearchOptionBean>()
list.add(SearchOptionBean("时间排序", listOf(
fun getTimeOptionList(): List<SearchOptionEntity> {
val list = mutableListOf<SearchOptionEntity>()
list.add(SearchOptionEntity("时间排序", listOf(
OptionItem(0, "全部时间", true),
OptionItem(1, "近三天"),
OptionItem(2, "近七天"),
@ -48,22 +48,22 @@ class SearchOptionBean(
return list
}
fun getSortOptionList(): List<SearchOptionBean> {
val list = mutableListOf<SearchOptionBean>()
list.add(SearchOptionBean("排序方式", listOf(
fun getSortOptionList(): List<SearchOptionEntity> {
val list = mutableListOf<SearchOptionEntity>()
list.add(SearchOptionEntity("排序方式", listOf(
OptionItem(0, "综合排序", true),
OptionItem(1, "时间排序")
)))
return list
}
fun getTypeOptionList(): List<SearchOptionBean> {
val list = mutableListOf<SearchOptionBean>()
fun getTypeOptionList(): List<SearchOptionEntity> {
val list = mutableListOf<SearchOptionEntity>()
val typeList = mutableListOf<OptionItem>()
UserConfigManager.getBidTypes().forEach {
typeList.add(OptionItem(it.id.toInt(), it.name))
}
list.add(SearchOptionBean("信息类型", typeList))
list.add(SearchOptionEntity("信息类型", typeList))
return list
}
}

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class SeatItemBean(
data class SeatItemEntity(
val avatar: String,
val create_time: String,
val id: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class SourceBean(
data class SourceEntity(
val id: String,
val name: String
): Serializable

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class SubscriptionBean(
data class SubscriptionEntity(
val city_id: List<String>,
val city_name: ArrayList<String>,
val create_time: String,
@ -13,7 +13,7 @@ data class SubscriptionBean(
val push_receiver: String,
val push_receiver_ks: String,
val push_type: String,
val source: List<SourceBean>,
val source: List<SourceEntity>,
val source_id: List<String>,
val source_name: List<String>,
val type: Int,

View File

@ -1,10 +1,10 @@
package com.cheng.bole.bean
data class SubscriptionMessageBean(
data class SubscriptionMessageEntity(
val id: String,
val title: String,
val message: String,
val type: String,
val create_time: String,
val extra: BidItemBean
val extra: BidItemEntity
)

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class UserAuthBean(
data class UserAuthEntity(
val auth: Boolean,
val auth_ad: Boolean,
val scene: String,

View File

@ -2,7 +2,7 @@ package com.cheng.bole.bean
import java.io.Serializable
data class ZZDBInfoBean(
data class ZZDBInfoEntity(
val id: String,
val name: String,
val createTime: String,
@ -14,5 +14,5 @@ data class ZZDBInfoBean(
val range: String,
val status: String,
val updateTime: String,
val children: List<ZZDBInfoBean>
val children: List<ZZDBInfoEntity>
) : Serializable

View File

@ -13,7 +13,7 @@ object Constants {
const val AppFilter = "${BuildConfig.APPLICATION_ID}.fileprovider"
const val WechatAppId = ""//微信APPID
const val WechatAppId = "wx2339becbc48e741d"//微信APPID
const val WechatAppSecret = ""//微信secret
const val UmengAppkey = "692528cc8560e34872f36551"//友盟appKey

View File

@ -70,6 +70,8 @@ object EventConstants {
const val JUMP_TO_SEAT_MANAGE = "client.jump.to.seat.manage" //跳转到席位管理
const val JUMP_TO_MY_PUBLISH = "client.jump.to.my.publish" //跳转到我的发布
const val JUMP_TO_FEEDBACK = "client.jump.to.feedback" //跳转到意见反馈
const val JUMP_TO_SERVICE = "client.jump.to.service" //跳转到联系客服

View File

@ -1,6 +1,6 @@
package com.cheng.bole.event
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
class ContactsEvent(val contacts: ContactsInfoBean) {
class ContactsEvent(val contacts: ContactsEntity) {
}

View File

@ -1,6 +1,6 @@
package com.cheng.bole.event
import com.cheng.bole.bean.SourceBean
import com.cheng.bole.bean.SourceEntity
class SourceDataEvent(val list: List<SourceBean>) {
class SourceDataEvent(val list: List<SourceEntity>) {
}

View File

@ -1,20 +1,20 @@
package com.cheng.bole.manager
import android.text.TextUtils
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
import com.example.base.utils.MMKVUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
object ContactsManager {
fun add(contacts: ContactsInfoBean) {
fun add(contacts: ContactsEntity) {
val list = all()
list.add(contacts)
MMKVUtils.put("contacts_list", Gson().toJson(list))
}
fun update(contacts: ContactsInfoBean) {
fun update(contacts: ContactsEntity) {
val list = all()
val oldContacts = list.find { it.id == contacts.id }
if (oldContacts != null) {
@ -34,10 +34,10 @@ object ContactsManager {
MMKVUtils.put("contacts_list", Gson().toJson(list))
}
fun all(): MutableList<ContactsInfoBean> {
fun all(): MutableList<ContactsEntity> {
val str = MMKVUtils.getString("contacts_list")
return if (!TextUtils.isEmpty(str)) {
Gson().fromJson(str, object : TypeToken<MutableList<ContactsInfoBean>>(){}.type)
Gson().fromJson(str, object : TypeToken<MutableList<ContactsEntity>>(){}.type)
} else {
mutableListOf()
}

View File

@ -3,8 +3,8 @@ package com.cheng.bole.manager
import android.os.Build
import android.text.TextUtils
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.MMKVUtils
@ -226,16 +226,16 @@ object UserConfigManager {
/**
* 地区列表
*/
fun saveAreaList(list: List<AreaBean>) {
fun saveAreaList(list: List<AreaEntity>) {
if (list.isNotEmpty()) {
MMKVUtils.put("area_list", Gson().toJson(list))
}
}
fun getAreaList(): MutableList<AreaBean> {
fun getAreaList(): MutableList<AreaEntity> {
val str = MMKVUtils.getString("area_list")
if (!TextUtils.isEmpty(str)) {
return Gson().fromJson(str, object : TypeToken<MutableList<AreaBean>>() {}.type)
return Gson().fromJson(str, object : TypeToken<MutableList<AreaEntity>>() {}.type)
}
return mutableListOf()
}
@ -243,8 +243,8 @@ object UserConfigManager {
/**
* 城市列表
*/
fun getCityList(): List<AreaBean> {
val list = mutableListOf<AreaBean>()
fun getCityList(): List<AreaEntity> {
val list = mutableListOf<AreaEntity>()
getAreaList().forEach {
list.addAll(it.children)
}
@ -254,14 +254,14 @@ object UserConfigManager {
/**
* 招标类型
*/
fun saveBidTypes(list: List<BidTypeBean>) {
fun saveBidTypes(list: List<BidTypeEntity>) {
MMKVUtils.put("bid_type", Gson().toJson(list))
}
fun getBidTypes(): List<BidTypeBean> {
fun getBidTypes(): List<BidTypeEntity> {
val str = MMKVUtils.getString("bid_type")
if (!TextUtils.isEmpty(str)) {
return Gson().fromJson(str, object : TypeToken<List<BidTypeBean>>() {}.type)
return Gson().fromJson(str, object : TypeToken<List<BidTypeEntity>>() {}.type)
}
return emptyList()
}

View File

@ -1,28 +1,28 @@
package com.cheng.bole.net
import com.cheng.bole.bean.AccountEntity
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.CompanyBean
import com.cheng.bole.bean.CorpInfoBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.bean.CompanyEntity
import com.cheng.bole.bean.CorpEntity
import com.cheng.bole.bean.CouponEntity
import com.cheng.bole.bean.GuideTotalBidInfoBean
import com.cheng.bole.bean.GuideUpdateInfoBean
import com.cheng.bole.bean.HotWordBean
import com.cheng.bole.bean.GuideTotalBidEntity
import com.cheng.bole.bean.GuideUpdateEntity
import com.cheng.bole.bean.HotWordEntity
import com.cheng.bole.bean.LoginEntity
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.OrderBean
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.bean.OrderEntity
import com.cheng.bole.bean.OrderPayEntity
import com.cheng.bole.bean.ZZDBInfoBean
import com.cheng.bole.bean.SeatItemBean
import com.cheng.bole.bean.ZZDBInfoEntity
import com.cheng.bole.bean.SeatItemEntity
import com.cheng.bole.bean.SendCodeEntity
import com.cheng.bole.bean.SourceBean
import com.cheng.bole.bean.SubscriptionBean
import com.cheng.bole.bean.SubscriptionMessageBean
import com.cheng.bole.bean.SourceEntity
import com.cheng.bole.bean.SubscriptionEntity
import com.cheng.bole.bean.SubscriptionMessageEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.bean.UserConfigEntity
import com.cheng.bole.bean.UserEntity
import com.cheng.bole.bean.VipGoodsEntity
@ -175,13 +175,13 @@ interface ApiService {
* 订单列表查询
*/
@GET("/api/order")
suspend fun getOrderList(@Query("status") status: String): HttpBaseResult<List<OrderBean>>
suspend fun getOrderList(@Query("status") status: String): HttpBaseResult<List<OrderEntity>>
/**
* 订单查询
*/
@GET("/api/order")
suspend fun getOrderInfo(@Query("order_id") orderId: String): HttpBaseResult<OrderBean>
suspend fun getOrderInfo(@Query("order_id") orderId: String): HttpBaseResult<OrderEntity>
/**
* 更新订单
@ -193,7 +193,7 @@ interface ApiService {
* 权限验证
*/
@GET("/api/user/auth")
suspend fun checkAuth(@Query("scene") scene: String? = "info"): HttpBaseResult<UserAuthBean>
suspend fun checkAuth(@Query("scene") scene: String? = "info"): HttpBaseResult<UserAuthEntity>
/**
* 权限上报
@ -205,19 +205,19 @@ interface ApiService {
* 引导页推荐热词树
*/
@GET("/api/hot_word")
suspend fun getHotWordList(): HttpBaseResult<List<HotWordBean>>
suspend fun getHotWordList(): HttpBaseResult<List<HotWordEntity>>
/**
* 城市列表
*/
@GET("/api/city")
suspend fun getAreaList(): HttpBaseResult<List<AreaBean>>
suspend fun getAreaList(): HttpBaseResult<List<AreaEntity>>
/**
* 获取当前城市
*/
@GET("/api/city/default")
suspend fun getUserCity(): HttpBaseResult<AreaBean>
suspend fun getUserCity(): HttpBaseResult<AreaEntity>
/**
* 总计商机
@ -227,13 +227,13 @@ interface ApiService {
@Query("keyword") keywords: String,
@Query("city_id") cityIds: String,
@Query("second_kind_num") kindCount: String
): HttpBaseResult<GuideTotalBidInfoBean>
): HttpBaseResult<GuideTotalBidEntity>
/**
* 每日更新
*/
@GET("/api/info/update/num")
suspend fun getUpdateNum(@Query("size") size: String): HttpBaseResult<List<GuideUpdateInfoBean>>
suspend fun getUpdateNum(@Query("size") size: String): HttpBaseResult<List<GuideUpdateEntity>>
/**
* 会员页轮播提示
@ -245,13 +245,13 @@ interface ApiService {
* 订阅列表
*/
@GET("/api/recommend/subscription")
suspend fun getSubscriptionList(): HttpBaseResult<HttpListResult<SubscriptionBean>>
suspend fun getSubscriptionList(): HttpBaseResult<HttpListResult<SubscriptionEntity>>
/**
* 订阅推荐列表
*/
@GET("/api/recommend")
suspend fun getRecommendList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemBean>>
suspend fun getRecommendList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemEntity>>
/**
* 添加订阅
@ -275,7 +275,7 @@ interface ApiService {
* 招标公告类型
*/
@GET("/api/info/type")
suspend fun getBidTypeList(): HttpBaseResult<List<BidTypeBean>>
suspend fun getBidTypeList(): HttpBaseResult<List<BidTypeEntity>>
/**
* 标讯详情
@ -287,13 +287,13 @@ interface ApiService {
@Query("id") id: String,
@Query("source") source: String,
@Query("info_source") infoSource: String
): HttpBaseResult<BidDetailBean>
): HttpBaseResult<BidDetailEntity>
/**
* 收藏列表
*/
@GET("/api/info/favorite/search")
suspend fun getFavoriteList(): HttpBaseResult<HttpListResult<BidItemBean>>
suspend fun getFavoriteList(): HttpBaseResult<HttpListResult<BidItemEntity>>
/**
* 收藏标讯
@ -317,37 +317,37 @@ interface ApiService {
* 热门数据源
*/
@GET("/api/source/hot")
suspend fun getHotSources(): HttpBaseResult<HttpListResult<SourceBean>>
suspend fun getHotSources(): HttpBaseResult<HttpListResult<SourceEntity>>
/**
* 搜索数据源
*/
@GET("/api/source/search")
suspend fun searchSource(@Query("keyword") keyword: String, @Query("size") size: String = "10"): HttpBaseResult<HttpListResult<SourceBean>>
suspend fun searchSource(@Query("keyword") keyword: String, @Query("size") size: String = "10"): HttpBaseResult<HttpListResult<SourceEntity>>
/**
* 搜索页最新标讯和本地标讯
*/
@GET("/api/info/ks/search")
suspend fun getNewestLocalBidList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemBean>>
suspend fun getNewestLocalBidList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemEntity>>
/**
* 项目搜索
*/
@GET("/api/search")
suspend fun search(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemBean>>
suspend fun search(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidItemEntity>>
/**
* 供应商搜索
*/
@GET("/api/user/goods/search")
suspend fun searchSupplier(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<MerchantGoodsBean>>
suspend fun searchSupplier(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<MerchantGoodsEntity>>
/**
* 浏览历史
*/
@GET("/api/info/history")
suspend fun getViewHistoryList(): HttpBaseResult<HttpListResult<BidDetailBean>>
suspend fun getViewHistoryList(): HttpBaseResult<HttpListResult<BidDetailEntity>>
/**
* 添加代办
@ -359,19 +359,19 @@ interface ApiService {
* 资质代办列表
*/
@GET("/api/agency/cert")
suspend fun getAgencyList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<ZZDBInfoBean>>
suspend fun getAgencyList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<ZZDBInfoEntity>>
/**
* 我的标讯列表
*/
@GET("/api/user/info")
suspend fun getMyBidList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidDetailBean>>
suspend fun getMyBidList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<BidDetailEntity>>
/**
* 查询标讯
*/
@GET("/api/user/info/{id}")
suspend fun getBidInfo(@Path("id") id: String): HttpBaseResult<BidItemBean>
suspend fun getBidInfo(@Path("id") id: String): HttpBaseResult<BidItemEntity>
/**
* 添加标讯
@ -395,13 +395,13 @@ interface ApiService {
* 我的商品列表
*/
@GET("/api/user/goods")
suspend fun getMyGoodsList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<MerchantGoodsBean>>
suspend fun getMyGoodsList(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<MerchantGoodsEntity>>
/**
* 查询商品
*/
@GET("/api/user/goods/{id}")
suspend fun getGoodsInfo(@Path("id") id: String): HttpBaseResult<MerchantGoodsBean>
suspend fun getGoodsInfo(@Path("id") id: String): HttpBaseResult<MerchantGoodsEntity>
/**
* 添加商品
@ -425,7 +425,7 @@ interface ApiService {
* 获取用户公司信息
*/
@GET("/api/user/company")
suspend fun getCompanyInfo(): HttpBaseResult<CompanyBean>
suspend fun getCompanyInfo(): HttpBaseResult<CompanyEntity>
/**
* 提交用户公司信息
@ -443,13 +443,13 @@ interface ApiService {
* 席位信息
*/
@GET("/api/corp")
suspend fun getSeatInfo(): HttpBaseResult<CorpInfoBean>
suspend fun getSeatInfo(): HttpBaseResult<CorpEntity>
/**
* 席位列表
*/
@GET("/api/corp/user")
suspend fun getSeatList(@Query("page") page: String = "1", @Query("size") size: String = "100"): HttpBaseResult<HttpListResult<SeatItemBean>>
suspend fun getSeatList(@Query("page") page: String = "1", @Query("size") size: String = "100"): HttpBaseResult<HttpListResult<SeatItemEntity>>
/**
* 添加席位
@ -467,5 +467,5 @@ interface ApiService {
* 订阅消息列表
*/
@GET("/api/message/ks")
suspend fun getSubscriptionMessage(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<SubscriptionMessageBean>>
suspend fun getSubscriptionMessage(@QueryMap map: Map<String, String>): HttpBaseResult<HttpListResult<SubscriptionMessageEntity>>
}

View File

@ -14,7 +14,7 @@ import androidx.lifecycle.lifecycleScope
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.AttachmentBean
import com.cheng.bole.bean.AttachmentEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.DialogDownloadAttachmentBinding
import com.cheng.bole.manager.DialogEnum
@ -34,7 +34,7 @@ import kotlinx.coroutines.launch
class DownloadAttachmentDialog : DialogFragment() {
private val mAdapter by lazy { AttachmentAdapter() }
private val attachmentList = mutableListOf<AttachmentBean>()
private val attachmentList = mutableListOf<AttachmentEntity>()
private val loadingDialog by lazy { LoadingDialog(requireContext()) }
@ -67,7 +67,7 @@ class DownloadAttachmentDialog : DialogFragment() {
val listStr = arguments?.getString("list")
if (!TextUtils.isEmpty(listStr)) {
attachmentList.addAll(Gson().fromJson(listStr, object : TypeToken<List<AttachmentBean>>() {}.type))
attachmentList.addAll(Gson().fromJson(listStr, object : TypeToken<List<AttachmentEntity>>() {}.type))
}
binding.rvAttachment.adapter = mAdapter
mAdapter.setList(attachmentList)
@ -89,7 +89,7 @@ class DownloadAttachmentDialog : DialogFragment() {
return dialog
}
private fun download(bean: AttachmentBean) {
private fun download(bean: AttachmentEntity) {
loadingDialog.show()
lifecycleScope.launch(Dispatchers.IO) {
DownLoadUtils.getInstance()
@ -118,7 +118,7 @@ class DownloadAttachmentDialog : DialogFragment() {
}
companion object {
fun newInstance(list: List<AttachmentBean>): DownloadAttachmentDialog {
fun newInstance(list: List<AttachmentEntity>): DownloadAttachmentDialog {
val arg = Bundle()
arg.putString("list", Gson().toJson(list))
val fragment = DownloadAttachmentDialog()
@ -127,12 +127,12 @@ class DownloadAttachmentDialog : DialogFragment() {
}
}
inner class AttachmentAdapter : BaseQuickAdapter<AttachmentBean, BaseViewHolder>(R.layout.listitem_bid_attachment) {
inner class AttachmentAdapter : BaseQuickAdapter<AttachmentEntity, BaseViewHolder>(R.layout.listitem_bid_attachment) {
init {
addChildClickViewIds(R.id.btn_download)
}
override fun convert(holder: BaseViewHolder, item: AttachmentBean) {
override fun convert(holder: BaseViewHolder, item: AttachmentEntity) {
SpanUtils.with(holder.getView(R.id.tv_name))
.appendImage(R.mipmap.ic_pdf_attachment)
.appendSpace(DensityUtils.dp2px(8f))

View File

@ -10,7 +10,7 @@ import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.fragment.app.FragmentManager
import com.cheng.bole.R
import com.cheng.bole.bean.SearchOptionBean
import com.cheng.bole.bean.SearchOptionEntity
import com.cheng.bole.databinding.PopAboutTipBinding
import com.cheng.bole.databinding.PopupSearchOptionsBinding
import com.cheng.bole.ui.activity.PublicActivity
@ -19,7 +19,6 @@ import com.cheng.bole.ui.fragment.mine.about.AppConfigFragment
import com.cheng.bole.ui.fragment.search.list.SearchOptionChildAdapter
import com.cheng.bole.ui.fragment.search.list.SearchOptionParentAdapter
import com.cheng.bole.utils.DateUtils
import com.efs.sdk.memleaksdk.monitor.internal.bi
import com.example.base.decoration.DividerItemDecoration
import com.example.base.extensions.getColor
import com.example.base.extensions.getYYYYMMDD
@ -56,7 +55,7 @@ object PopupDialog {
popWindow.showAsDropDown(v, 0, 0)
}
fun showSearchAreaOptions(context: Context, v: View, cityList: List<SearchOptionBean.OptionItem>, onDismiss: () -> Unit, callback: (List<SearchOptionBean.OptionItem>) -> Unit) {
fun showSearchAreaOptions(context: Context, v: View, cityList: List<SearchOptionEntity.OptionItem>, onDismiss: () -> Unit, callback: (List<SearchOptionEntity.OptionItem>) -> Unit) {
val view = LayoutInflater.from(context).inflate(R.layout.popup_search_options, null, false)
val binding = PopupSearchOptionsBinding.bind(view)
@ -66,7 +65,7 @@ object PopupDialog {
val childAdapter = SearchOptionChildAdapter(true)
binding.rvChild.adapter = childAdapter
val optionList = SearchOptionBean.getAreaOptionList()
val optionList = SearchOptionEntity.getAreaOptionList()
if (cityList.isNotEmpty()) {
optionList[0].isChecked = false
optionList[0].items[0].isChecked = false
@ -144,14 +143,14 @@ object PopupDialog {
}
binding.btnReset.onClick {
val optionList = SearchOptionBean.getAreaOptionList()
val optionList = SearchOptionEntity.getAreaOptionList()
optionList[0].isChecked = true
parentAdapter.setList(optionList)
childAdapter.setList(optionList[0].items)
}
binding.btnNext.onClick {
val list = mutableListOf<SearchOptionBean.OptionItem>()
val list = mutableListOf<SearchOptionEntity.OptionItem>()
parentAdapter.data.forEachIndexed { index, option ->
if (index != 0) {
list.addAll(option.items.filter { it.isChecked && it.id != 0 })
@ -171,7 +170,7 @@ object PopupDialog {
}
@SuppressLint("NotifyDataSetChanged")
fun showSearchTimeOptions(context: Context, v: View, manager: FragmentManager, time: SearchOptionBean.OptionItem?, onDismiss: () -> Unit, callback: (SearchOptionBean.OptionItem) -> Unit) {
fun showSearchTimeOptions(context: Context, v: View, manager: FragmentManager, time: SearchOptionEntity.OptionItem?, onDismiss: () -> Unit, callback: (SearchOptionEntity.OptionItem) -> Unit) {
val view = LayoutInflater.from(context).inflate(R.layout.popup_search_options, null, false)
val binding = PopupSearchOptionsBinding.bind(view)
@ -185,7 +184,7 @@ object PopupDialog {
binding.rvChild.adapter = adapter
binding.rvChild.addItemDecoration(DividerItemDecoration(DensityUtils.dp2px(16f), DensityUtils.dp2px(16f), color = getColor(R.color.color_eeeeee)))
val optionList = SearchOptionBean.getTimeOptionList()[0]
val optionList = SearchOptionEntity.getTimeOptionList()[0]
if (time != null) {
if (time.id == -1) {
optionList.items[0].isChecked = false
@ -273,7 +272,7 @@ object PopupDialog {
binding.tvStartTime.text = ""
binding.tvEndTime.text = ""
adapter.setList(SearchOptionBean.getTimeOptionList()[0].items)
adapter.setList(SearchOptionEntity.getTimeOptionList()[0].items)
}
binding.btnNext.onClick {
@ -290,7 +289,7 @@ object PopupDialog {
toast("请选择结束时间")
return@onClick
}
option = SearchOptionBean.OptionItem(-1, startTime = "${startTime / 1000}", endTime = "${endTime / 1000}")
option = SearchOptionEntity.OptionItem(-1, startTime = "${startTime / 1000}", endTime = "${endTime / 1000}")
}
callback.invoke(option)
popWindow.dismiss()
@ -301,7 +300,7 @@ object PopupDialog {
popWindow.showAsDropDown(v, 0, 0)
}
fun showSearchSortOptions(context: Context, v: View, sort: SearchOptionBean.OptionItem?, onDismiss: () -> Unit, callback: (SearchOptionBean.OptionItem) -> Unit) {
fun showSearchSortOptions(context: Context, v: View, sort: SearchOptionEntity.OptionItem?, onDismiss: () -> Unit, callback: (SearchOptionEntity.OptionItem) -> Unit) {
val view = LayoutInflater.from(context).inflate(R.layout.popup_search_options, null, false)
val binding = PopupSearchOptionsBinding.bind(view)
@ -311,7 +310,7 @@ object PopupDialog {
binding.rvChild.adapter = adapter
binding.rvChild.addItemDecoration(DividerItemDecoration(DensityUtils.dp2px(16f), DensityUtils.dp2px(16f), color = getColor(R.color.color_eeeeee)))
val optionList = SearchOptionBean.getSortOptionList()[0]
val optionList = SearchOptionEntity.getSortOptionList()[0]
if (sort != null) {
optionList.items.forEach {
it.isChecked = it.id == sort.id
@ -333,7 +332,7 @@ object PopupDialog {
adapter.notifyDataSetChanged()
}
binding.btnReset.onClick { adapter.setList(SearchOptionBean.getSortOptionList()[0].items) }
binding.btnReset.onClick { adapter.setList(SearchOptionEntity.getSortOptionList()[0].items) }
binding.btnNext.onClick {
val option = adapter.data.find { it.isChecked }
@ -348,7 +347,7 @@ object PopupDialog {
popWindow.showAsDropDown(v, 0, 0)
}
fun showSearchTypeOptions(context: Context, v: View, typeList: List<SearchOptionBean.OptionItem>, onDismiss: () -> Unit, callback: (List<SearchOptionBean.OptionItem>) -> Unit) {
fun showSearchTypeOptions(context: Context, v: View, typeList: List<SearchOptionEntity.OptionItem>, onDismiss: () -> Unit, callback: (List<SearchOptionEntity.OptionItem>) -> Unit) {
val view = LayoutInflater.from(context).inflate(R.layout.popup_search_options, null, false)
val binding = PopupSearchOptionsBinding.bind(view)
@ -358,7 +357,7 @@ object PopupDialog {
binding.rvChild.adapter = adapter
binding.rvChild.addItemDecoration(DividerItemDecoration(DensityUtils.dp2px(16f), DensityUtils.dp2px(16f), color = getColor(R.color.color_eeeeee)))
val optionList = SearchOptionBean.getTypeOptionList()[0]
val optionList = SearchOptionEntity.getTypeOptionList()[0]
if (typeList.isNotEmpty()) {
optionList.items.forEach { item ->
if (typeList.find { it.id == item.id } != null) {
@ -381,7 +380,7 @@ object PopupDialog {
adapter.notifyDataSetChanged()
}
binding.btnReset.onClick { adapter.setList(SearchOptionBean.getTypeOptionList()[0].items) }
binding.btnReset.onClick { adapter.setList(SearchOptionEntity.getTypeOptionList()[0].items) }
binding.btnNext.onClick {
val list = adapter.data.filter { it.isChecked }

View File

@ -14,7 +14,7 @@ import androidx.fragment.app.DialogFragment
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.databinding.DialogSelectAreaBinding
import com.cheng.bole.manager.UserConfigManager
import com.example.base.extensions.getColor
@ -29,7 +29,7 @@ class SelectAreaDialog : DialogFragment() {
private val isSingle by lazy { arguments?.getBoolean("isSingle") ?: false }
private val showAll by lazy { arguments?.getBoolean("showAll") ?: false }
private var mOnBackListener: ((List<AreaBean>) -> Unit)? = null //回调事件
private var mOnBackListener: ((List<AreaEntity>) -> Unit)? = null //回调事件
private lateinit var binding: DialogSelectAreaBinding
@ -57,8 +57,8 @@ class SelectAreaDialog : DialogFragment() {
val listStr = arguments?.getString("list")
val defaultCityList = if (!TextUtils.isEmpty(listStr)) {
Gson().fromJson(listStr, object : TypeToken<List<AreaBean>>() {}.type)
} else emptyList<AreaBean>()
Gson().fromJson(listStr, object : TypeToken<List<AreaEntity>>() {}.type)
} else emptyList<AreaEntity>()
val areaAdapter = AreaAdapter()
binding.rvParent.adapter = areaAdapter
@ -68,8 +68,8 @@ class SelectAreaDialog : DialogFragment() {
val areaList = UserConfigManager.getAreaList()
if (!isSingle) {
areaList.add(0, AreaBean(0, name = "全国地区"))
areaList.forEach { it.children.add(0, AreaBean(0, name = "全部")) }
areaList.add(0, AreaEntity(0, name = "全国地区"))
areaList.forEach { it.children.add(0, AreaEntity(0, name = "全部")) }
if (defaultCityList.size == UserConfigManager.getCityList().size) {
areaList[0].isChecked = true
areaList[0].children[0].isChecked = true
@ -91,7 +91,7 @@ class SelectAreaDialog : DialogFragment() {
}
} else {
if (showAll) {
areaList.add(0, AreaBean(0, name = "全国地区", children = mutableListOf(AreaBean(0, name = "全国"))))
areaList.add(0, AreaEntity(0, name = "全国地区", children = mutableListOf(AreaEntity(0, name = "全国"))))
if (defaultCityList.isEmpty()) {
areaList[0].isChecked = true
areaList[0].children[0].isChecked = true
@ -166,7 +166,7 @@ class SelectAreaDialog : DialogFragment() {
}
binding.btnNext.onClick {
val selectedCityList = mutableListOf<AreaBean>()
val selectedCityList = mutableListOf<AreaEntity>()
if (areaAdapter.data[0].children[0].id == 0 && areaAdapter.data[0].children[0].isChecked) {
areaAdapter.data.forEach {
selectedCityList.addAll(it.children.filter { item -> item.id != 0 })
@ -191,12 +191,12 @@ class SelectAreaDialog : DialogFragment() {
return dialog
}
fun setOnSelectListener(listener: ((List<AreaBean>) -> Unit)) {
fun setOnSelectListener(listener: ((List<AreaEntity>) -> Unit)) {
mOnBackListener = listener
}
companion object {
fun newInstance(list: List<AreaBean> = emptyList(), isSingle: Boolean = false, showAll: Boolean = false): SelectAreaDialog {
fun newInstance(list: List<AreaEntity> = emptyList(), isSingle: Boolean = false, showAll: Boolean = false): SelectAreaDialog {
val arg = Bundle()
arg.putString("list", Gson().toJson(list))
arg.putBoolean("isSingle", isSingle)
@ -207,9 +207,9 @@ class SelectAreaDialog : DialogFragment() {
}
}
class AreaAdapter() : BaseQuickAdapter<AreaBean, BaseViewHolder>(R.layout.listitem_search_option_parent) {
class AreaAdapter() : BaseQuickAdapter<AreaEntity, BaseViewHolder>(R.layout.listitem_search_option_parent) {
@SuppressLint("NotifyDataSetChanged")
override fun convert(holder: BaseViewHolder, item: AreaBean) {
override fun convert(holder: BaseViewHolder, item: AreaEntity) {
holder.setText(R.id.tv_name, item.name)
holder.setVisible(R.id.view_tag, item.isChecked)
holder.itemView.setBackgroundColor(if (item.isChecked) Color.WHITE else Color.TRANSPARENT)
@ -260,8 +260,8 @@ class SelectAreaDialog : DialogFragment() {
}
}
class CityAdapter : BaseQuickAdapter<AreaBean, BaseViewHolder>(R.layout.listitem_search_option_child) {
override fun convert(holder: BaseViewHolder, item: AreaBean) {
class CityAdapter : BaseQuickAdapter<AreaEntity, BaseViewHolder>(R.layout.listitem_search_option_child) {
override fun convert(holder: BaseViewHolder, item: AreaEntity) {
holder.setText(R.id.tv_name, item.name)
holder.setTextColor(R.id.tv_name, if (item.isChecked) getColor(R.color.color_125ffe) else getColor(R.color.color_1a1a1a))
holder.setVisible(R.id.iv_check, item.isChecked)

View File

@ -16,7 +16,7 @@ import androidx.fragment.app.DialogFragment
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.databinding.DialogSelectBidTypeBinding
import com.cheng.bole.manager.UserConfigManager
import com.example.base.extensions.getColor
@ -27,9 +27,9 @@ import com.example.base.utils.ScreenUtils
class SelectBidTypeDialog : DialogFragment() {
private val mAdapter by lazy { BidTypeAdapter() }
private var bidType: BidTypeBean? = null
private var bidType: BidTypeEntity? = null
private var mOnBackListener: ((BidTypeBean) -> Unit)? = null //回调事件
private var mOnBackListener: ((BidTypeEntity) -> Unit)? = null //回调事件
private lateinit var binding: DialogSelectBidTypeBinding
@ -56,9 +56,9 @@ class SelectBidTypeDialog : DialogFragment() {
binding = DialogSelectBidTypeBinding.bind(view)
bidType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("type", BidTypeBean::class.java)
arguments?.getSerializable("type", BidTypeEntity::class.java)
} else {
arguments?.getSerializable("type") as? BidTypeBean
arguments?.getSerializable("type") as? BidTypeEntity
}
binding.mRecyclerView.adapter = mAdapter
@ -92,12 +92,12 @@ class SelectBidTypeDialog : DialogFragment() {
return dialog
}
fun setOnSelectListener(listener: ((BidTypeBean) -> Unit)) {
fun setOnSelectListener(listener: ((BidTypeEntity) -> Unit)) {
mOnBackListener = listener
}
companion object {
fun newInstance(type: BidTypeBean?): SelectBidTypeDialog {
fun newInstance(type: BidTypeEntity?): SelectBidTypeDialog {
val arg = Bundle()
arg.putSerializable("type", type)
val fragment = SelectBidTypeDialog()
@ -106,8 +106,8 @@ class SelectBidTypeDialog : DialogFragment() {
}
}
class BidTypeAdapter : BaseQuickAdapter<BidTypeBean, BaseViewHolder>(R.layout.listitem_bid_type) {
override fun convert(holder: BaseViewHolder, item: BidTypeBean) {
class BidTypeAdapter : BaseQuickAdapter<BidTypeEntity, BaseViewHolder>(R.layout.listitem_bid_type) {
override fun convert(holder: BaseViewHolder, item: BidTypeEntity) {
holder.setText(R.id.tv_name, item.name)
holder.setTextColor(R.id.tv_name, if (item.isChecked) getColor(R.color.color_125ffe) else getColor(R.color.color_1a1a1a))
holder.getView<TextView>(R.id.tv_name).typeface = if (item.isChecked) Typeface.DEFAULT_BOLD else Typeface.DEFAULT

View File

@ -14,7 +14,7 @@ import androidx.fragment.app.DialogFragment
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
import com.cheng.bole.databinding.DialogSelectContactsBinding
import com.cheng.bole.event.ContactsEvent
import com.cheng.bole.manager.ContactsManager
@ -37,7 +37,7 @@ class SelectContactsDialog : DialogFragment() {
private var contactsEvent: Disposable? = null
private var mOnBackListener: ((List<ContactsInfoBean>) -> Unit)? = null //回调事件
private var mOnBackListener: ((List<ContactsEntity>) -> Unit)? = null //回调事件
private lateinit var binding: DialogSelectContactsBinding
@ -111,7 +111,7 @@ class SelectContactsDialog : DialogFragment() {
val selectList = if (init) {
val listStr = arguments?.getString("list") ?: ""
if (!TextUtils.isEmpty(listStr)) {
Gson().fromJson(listStr, object : TypeToken<MutableList<ContactsInfoBean>>() {}.type)
Gson().fromJson(listStr, object : TypeToken<MutableList<ContactsEntity>>() {}.type)
} else mutableListOf()
} else {
mAdapter.data.filter { it.isChecked }
@ -137,12 +137,12 @@ class SelectContactsDialog : DialogFragment() {
super.onDestroyView()
}
fun setOnSelectListener(listener: ((List<ContactsInfoBean>) -> Unit)) {
fun setOnSelectListener(listener: ((List<ContactsEntity>) -> Unit)) {
mOnBackListener = listener
}
companion object {
fun newInstance(list: List<ContactsInfoBean>): SelectContactsDialog {
fun newInstance(list: List<ContactsEntity>): SelectContactsDialog {
val arg = Bundle()
arg.putString("list", Gson().toJson(list))
val fragment = SelectContactsDialog()
@ -151,13 +151,13 @@ class SelectContactsDialog : DialogFragment() {
}
}
class ContactsAdapter : BaseQuickAdapter<ContactsInfoBean, BaseViewHolder>(R.layout.listitem_contacts) {
class ContactsAdapter : BaseQuickAdapter<ContactsEntity, BaseViewHolder>(R.layout.listitem_contacts) {
init {
addChildClickViewIds(R.id.iv_edit)
}
override fun convert(holder: BaseViewHolder, item: ContactsInfoBean) {
override fun convert(holder: BaseViewHolder, item: ContactsEntity) {
holder.setText(R.id.tv_phone, item.phone)
holder.setText(R.id.tv_name, "${item.name} | ${item.job}")
holder.setImageResource(R.id.iv_check, if (item.isChecked) R.mipmap.ic_rb_checked else R.mipmap.ic_rb_default)

View File

@ -15,7 +15,7 @@ import androidx.fragment.app.DialogFragment
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.databinding.DialogSelectGoodsTypeBinding
import com.example.base.extensions.getColor
import com.example.base.extensions.onClick
@ -25,18 +25,18 @@ import com.example.base.utils.ScreenUtils
class SelectGoodsTypeDialog : DialogFragment() {
private val typeList by lazy {
listOf(
BidTypeBean("1", "提供服务"),
BidTypeBean("2", "提供产品"),
BidTypeBean("3", "其他")
BidTypeEntity("1", "提供服务"),
BidTypeEntity("2", "提供产品"),
BidTypeEntity("3", "其他")
)
}
private val type by lazy { arguments?.getString("type") ?: "" }
private val mAdapter by lazy { GoodsTypeAdapter() }
private var bidType: BidTypeBean? = null
private var bidType: BidTypeEntity? = null
private var mOnBackListener: ((BidTypeBean) -> Unit)? = null //回调事件
private var mOnBackListener: ((BidTypeEntity) -> Unit)? = null //回调事件
private lateinit var binding: DialogSelectGoodsTypeBinding
@ -90,7 +90,7 @@ class SelectGoodsTypeDialog : DialogFragment() {
return dialog
}
fun setOnSelectListener(listener: ((BidTypeBean) -> Unit)) {
fun setOnSelectListener(listener: ((BidTypeEntity) -> Unit)) {
mOnBackListener = listener
}
@ -104,8 +104,8 @@ class SelectGoodsTypeDialog : DialogFragment() {
}
}
class GoodsTypeAdapter : BaseQuickAdapter<BidTypeBean, BaseViewHolder>(R.layout.listitem_bid_type) {
override fun convert(holder: BaseViewHolder, item: BidTypeBean) {
class GoodsTypeAdapter : BaseQuickAdapter<BidTypeEntity, BaseViewHolder>(R.layout.listitem_bid_type) {
override fun convert(holder: BaseViewHolder, item: BidTypeEntity) {
holder.setText(R.id.tv_name, item.name)
holder.setTextColor(R.id.tv_name, if (item.isChecked) getColor(R.color.color_125ffe) else getColor(R.color.color_1a1a1a))
holder.getView<TextView>(R.id.tv_name).typeface = if (item.isChecked) Typeface.DEFAULT_BOLD else Typeface.DEFAULT

View File

@ -4,15 +4,15 @@ import android.text.Html
import android.text.TextUtils
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.utils.BidTypeUtils
import com.cheng.bole.widget.CommonShapeView
import com.example.base.ui.list.LoadMoreAdapter
import java.text.DecimalFormat
class BidAdapter(private val showTipsTime: Boolean = false) : LoadMoreAdapter<BidItemBean>(R.layout.listitem_bid) {
class BidAdapter(private val showTipsTime: Boolean = false) : LoadMoreAdapter<BidItemEntity>(R.layout.listitem_bid) {
override fun convert(holder: BaseViewHolder, item: BidItemBean) {
override fun convert(holder: BaseViewHolder, item: BidItemEntity) {
val tvTag = holder.getView<CommonShapeView>(R.id.tv_tag)
tvTag.setBgColor(BidTypeUtils.getTypeColor(item.typeName))
tvTag.text = BidTypeUtils.getShortName(item.typeName)

View File

@ -9,7 +9,7 @@ import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import com.cheng.bole.R
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.bean.WxShareEntity
import com.cheng.bole.common.Constants
@ -43,7 +43,7 @@ class BidDetailFragment: BaseFragment<FragmentBidDetailBinding, BidDetailViewMod
private val contactsAdapter by lazy { ContactsAdapter() }
private val imageAdapter by lazy { BidImageAdapter() }
private var detail: BidDetailBean? = null
private var detail: BidDetailEntity? = null
private var isFavorite: Boolean = false
@ -156,6 +156,7 @@ class BidDetailFragment: BaseFragment<FragmentBidDetailBinding, BidDetailViewMod
binding.tvTag.text = BidTypeUtils.getShortName(detail!!.type_name)
binding.tvTag.setBgColor(BidTypeUtils.getTypeColor(detail!!.type_name))
binding.tvAmount.text = detail!!.project_amount
binding.tvLocation.text = detail!!.city_name
binding.tvTime.text = detail!!.tips_time
contactsAdapter.setList(detail!!.contact)

View File

@ -1,7 +1,7 @@
package com.cheng.bole.ui.fragment.bid.detail
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
@ -10,7 +10,7 @@ import com.google.gson.JsonObject
import okhttp3.RequestBody.Companion.toRequestBody
class BidDetailViewModel: BaseViewModel() {
val detailLiveData = MutableLiveData<BidDetailBean>()
val detailLiveData = MutableLiveData<BidDetailEntity>()
val favoriteLiveData = MutableLiveData<Any>()
val cancelLiveData = MutableLiveData<Any>()

View File

@ -3,14 +3,14 @@ package com.cheng.bole.ui.fragment.bid.detail
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
class ContactsAdapter: BaseQuickAdapter<ContactsInfoBean, BaseViewHolder>(R.layout.listitem_bid_detail_contact) {
class ContactsAdapter: BaseQuickAdapter<ContactsEntity, BaseViewHolder>(R.layout.listitem_bid_detail_contact) {
init {
addChildClickViewIds(R.id.iv_call)
}
override fun convert(holder: BaseViewHolder, item: ContactsInfoBean) {
override fun convert(holder: BaseViewHolder, item: ContactsEntity) {
holder.setText(R.id.tv_name, item.name)
holder.setText(R.id.tv_phone, item.phone)
}

View File

@ -0,0 +1,14 @@
package com.cheng.bole.ui.fragment.bid.publish
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ContactsEntity
class AddBidContactsAdapter: BaseQuickAdapter<ContactsEntity, BaseViewHolder>(R.layout.listitem_publish_bid_contacts) {
override fun convert(holder: BaseViewHolder, item: ContactsEntity) {
holder.setText(R.id.tv_phone, item.phone)
holder.setText(R.id.tv_name, "${item.name} | ${item.job}")
}
}

View File

@ -1,17 +1,17 @@
package com.cheng.bole.ui.fragment.bid.publish.bid
package com.cheng.bole.ui.fragment.bid.publish
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.AttachmentBean
import com.cheng.bole.bean.AttachmentEntity
class AddBidFileAdapter : BaseQuickAdapter<AttachmentBean, BaseViewHolder>(R.layout.listitem_publish_bid_file) {
class AddBidFileAdapter : BaseQuickAdapter<AttachmentEntity, BaseViewHolder>(R.layout.listitem_publish_bid_file) {
init {
addChildClickViewIds(R.id.iv_delete)
}
override fun convert(holder: BaseViewHolder, item: AttachmentBean) {
override fun convert(holder: BaseViewHolder, item: AttachmentEntity) {
holder.setText(R.id.tv_name, item.title)
}

View File

@ -1,4 +1,4 @@
package com.cheng.bole.ui.fragment.bid.publish.bid
package com.cheng.bole.ui.fragment.bid.publish
import android.annotation.SuppressLint
import android.content.Context

View File

@ -1,14 +0,0 @@
package com.cheng.bole.ui.fragment.bid.publish.bid
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ContactsInfoBean
class AddBidContactsAdapter: BaseQuickAdapter<ContactsInfoBean, BaseViewHolder>(R.layout.listitem_publish_bid_contacts) {
override fun convert(holder: BaseViewHolder, item: ContactsInfoBean) {
holder.setText(R.id.tv_phone, item.phone)
holder.setText(R.id.tv_name, "${item.name} | ${item.job}")
}
}

View File

@ -0,0 +1,68 @@
package com.cheng.bole.ui.fragment.bid.publish.bid
import android.text.TextUtils
import android.widget.TextView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.utils.BidTypeUtils
import com.cheng.bole.utils.StringUtils
import com.cheng.bole.widget.CommonShapeView
import com.example.base.extensions.getColor
import com.example.base.ui.list.LoadMoreAdapter
class MyBidAdapter : LoadMoreAdapter<BidDetailEntity>(R.layout.listitem_my_bid) {
init {
addChildClickViewIds(R.id.btn_delete, R.id.btn_edit, R.id.btn_view)
}
override fun convert(holder: BaseViewHolder, item: BidDetailEntity) {
val tvTag = holder.getView<CommonShapeView>(R.id.tv_tag)
tvTag.setBgColor(BidTypeUtils.getTypeColor(item.type_name))
tvTag.text = BidTypeUtils.getShortName(item.type_name)
holder.setText(R.id.tv_title, item.origin_title)
holder.setText(R.id.tv_location, if (TextUtils.isEmpty(item.city_name)) "全国" else item.city_name)
holder.setText(R.id.tv_amount, StringUtils.formatAmount(item.project_amount))
holder.setText(R.id.tv_time, item.tips_time)
holder.setGone(R.id.tv_refuse_reason, true)
holder.setGone(R.id.btn_delete, true)
holder.setGone(R.id.btn_edit, true)
when (item.status) {
"1" -> {
holder.setText(R.id.tv_status, "待审核")
holder.setTextColor(R.id.tv_status, getColor(R.color.color_ff9234))
holder.setBackgroundResource(R.id.tv_status, R.drawable.shape_publish_status_bg1)
holder.getView<TextView>(R.id.tv_status).setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_publish_status1, 0, 0, 0)
}
"2" -> {
holder.setText(R.id.tv_status, "已发布")
holder.setTextColor(R.id.tv_status, getColor(R.color.color_e3fae7))
holder.setBackgroundResource(R.id.tv_status, R.drawable.shape_publish_status_bg2)
holder.getView<TextView>(R.id.tv_status).setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_publish_status2, 0, 0, 0)
holder.setGone(R.id.btn_delete, true)
}
"3" -> {
holder.setText(R.id.tv_status, "已驳回")
holder.setTextColor(R.id.tv_status, getColor(R.color.color_ffede7))
holder.setBackgroundResource(R.id.tv_status, R.drawable.shape_publish_status_bg3)
holder.getView<TextView>(R.id.tv_status).setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_publish_status3, 0, 0, 0)
holder.setText(R.id.tv_refuse_reason, "理由:${item.review_remark}")
holder.setVisible(R.id.tv_refuse_reason, true)
holder.setGone(R.id.btn_delete, true)
holder.setGone(R.id.btn_edit, true)
}
}
holder.setGone(R.id.tv_location, TextUtils.isEmpty(item.city_name))
holder.setGone(R.id.tv_amount, TextUtils.isEmpty(item.project_amount))
holder.setGone(R.id.tv_time, TextUtils.isEmpty(item.tips_time))
}
}

View File

@ -0,0 +1,75 @@
package com.cheng.bole.ui.fragment.bid.publish.bid
import com.cheng.bole.R
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.databinding.FragmentMyBidBinding
import com.cheng.bole.event.BidEvent
import com.cheng.bole.manager.DialogEnum
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.dialog.TipDialog
import com.cheng.bole.ui.fragment.bid.detail.BidDetailFragment
import com.example.base.common.RxBus
import com.example.base.extensions.onClick
import com.example.base.ui.list.ListFragment
class MyBidFragment: ListFragment<FragmentMyBidBinding, MyBidViewModel, BidDetailEntity>() {
override fun noDataClick() {
}
override fun bindAdapter() = MyBidAdapter()
override fun initView() {
super.initView()
mEmptyView.setNoDataText("暂无数据")
mEmptyView.setNoDataLogo(R.mipmap.ic_empty_seat)
}
override fun initData() {
super.initData()
firstLoad()
}
override fun initListener() {
super.initListener()
binding.btnNext.onClick {
PublicActivity.start(requireActivity(), PublishBidMessageFragment::class.java)
}
mAdapter.setOnItemChildClickListener { _, view, position ->
val item = mAdapter.getItem(position)
when(view.id) {
R.id.btn_delete -> {
val f = TipDialog.newInstance("温馨提示", "您确定要删除标书吗?")
f.setOnSelectListener {
if (it == DialogEnum.CLICK_OK) {
mViewModel.deleteBid(item.id)
}
}
f.show(childFragmentManager, TipDialog::class.java.simpleName)
}
R.id.btn_edit -> {
PublicActivity.start(requireContext(), PublishBidMessageFragment::class.java, Pair("item", item))
}
R.id.btn_view -> {
PublicActivity.start(
requireContext(),
BidDetailFragment::class.java,
Pair("id", item.id),
Pair("info_source", item.info_source)
)
}
}
}
}
override fun initObserve() {
super.initObserve()
val bidEvent = RxBus.defaultInstance.toObservable(BidEvent::class.java).subscribe {
firstLoad()
}
addDisposable(bidEvent)
}
}

View File

@ -0,0 +1,33 @@
package com.cheng.bole.ui.fragment.bid.publish.bid
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class MyBidViewModel: ListViewModel<BidDetailEntity>() {
val deleteLiveData = MutableLiveData<Any>()
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidDetailEntity>> {
return ApiFactory.apiService.getMyBidList(params).toListResult()
}
fun deleteBid(id: String) {
showDialog()
launchOnUiTryCatch({
val response = ApiFactory.apiService.deleteBidInfo(id)
if (response.status) {
deleteLiveData.postValue(Any())
} else toast(response.message, true)
dismissDialog()
}, {
dismissDialog()
setError(it)
L.d(it)
})
}
}

View File

@ -8,21 +8,28 @@ import android.view.ViewTreeObserver
import androidx.activity.result.contract.ActivityResultContracts
import androidx.constraintlayout.widget.ConstraintLayout
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AttachmentBean
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.AttachmentEntity
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentPublishBidMessageBinding
import com.cheng.bole.event.BidEvent
import com.cheng.bole.impl.TextWatcherImpl
import com.cheng.bole.manager.UserConfigManager
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.dialog.SelectAreaDialog
import com.cheng.bole.ui.dialog.SelectBidTypeDialog
import com.cheng.bole.ui.dialog.SelectContactsDialog
import com.cheng.bole.ui.fragment.bid.publish.AddBidContactsAdapter
import com.cheng.bole.ui.fragment.bid.publish.AddBidFileAdapter
import com.cheng.bole.ui.fragment.bid.publish.AddBidImageAdapter
import com.cheng.bole.ui.fragment.bid.publish.my.MyPublishFragment
import com.cheng.bole.utils.FileProviderUtils
import com.cheng.bole.utils.GlideEngine
import com.cheng.bole.utils.PermissionUtils
import com.example.base.common.RxBus
import com.example.base.extensions.getColor
import com.example.base.extensions.gone
import com.example.base.extensions.onClick
@ -41,7 +48,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
import java.io.File
class PublishBidMessageFragment : BaseFragment<FragmentPublishBidMessageBinding, PublishBidMessageViewModel>() {
private var bidDetail: BidDetailBean? = null
private var bidDetail: BidDetailEntity? = null
private val imageAdapter by lazy { AddBidImageAdapter(requireContext(), uploadedImgList) }
private var uploadedImgList: ArrayList<UploadFileEntity> = ArrayList()
@ -55,8 +62,8 @@ class PublishBidMessageFragment : BaseFragment<FragmentPublishBidMessageBinding,
private var contentType: Int = 1 //1 文字 2 图片
private var city: AreaBean? = null
private var bidType: BidTypeBean? = null
private var city: AreaEntity? = null
private var bidType: BidTypeEntity? = null
private val textWatcher = object : TextWatcherImpl() {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
@ -95,9 +102,9 @@ class PublishBidMessageFragment : BaseFragment<FragmentPublishBidMessageBinding,
override fun initData() {
super.initData()
bidDetail = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", BidDetailBean::class.java)
arguments?.getSerializable("item", BidDetailEntity::class.java)
} else {
arguments?.getSerializable("item") as? BidDetailBean
arguments?.getSerializable("item") as? BidDetailEntity
}
if (bidDetail != null) {
setData(bidDetail!!)
@ -251,10 +258,10 @@ class PublishBidMessageFragment : BaseFragment<FragmentPublishBidMessageBinding,
override fun initObserve() {
super.initObserve()
mViewModel.addLiveData.observe(this) {
/*toast("提交成功")
toast("提交成功")
RxBus.defaultInstance.post(BidEvent())
PublicActivity.start(requireContext(), MyBiddingDocFragment::class.java)
requireActivity().finish()*/
PublicActivity.start(requireContext(), MyPublishFragment::class.java, Pair("type", 1))
requireActivity().finish()
}
mViewModel.imageLiveData.observe(this) {
@ -270,7 +277,7 @@ class PublishBidMessageFragment : BaseFragment<FragmentPublishBidMessageBinding,
mViewModel.fileLiveData.observe(this) { list ->
list.forEachIndexed { index, file ->
fileAdapter.addData(AttachmentBean(file.id, file.url, "pdf", selectedFileList[index].name))
fileAdapter.addData(AttachmentEntity(file.id, file.url, "pdf", selectedFileList[index].name))
}
SpanUtils.with(binding.tvFileCount)
.append("(")
@ -337,7 +344,7 @@ class PublishBidMessageFragment : BaseFragment<FragmentPublishBidMessageBinding,
}
@SuppressLint("SetTextI18n", "NotifyDataSetChanged")
private fun setData(detail: BidDetailBean) {
private fun setData(detail: BidDetailEntity) {
if (detail.status == "3") {
binding.tvReason.text = "理由:${detail.review_remark}"
binding.tvTime.text = detail.review_time

View File

@ -5,7 +5,7 @@ import android.graphics.Color
import android.os.Build
import android.text.TextUtils
import android.view.View
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
import com.cheng.bole.databinding.FragmentAddContactsBinding
import com.cheng.bole.event.ContactsEvent
import com.cheng.bole.manager.ContactsManager
@ -22,7 +22,7 @@ import java.util.UUID
class AddContactsFragment: BaseFragment<FragmentAddContactsBinding, AddContactsViewModel>() {
private val mAdapter by lazy { ContactsJobAdapter() }
private var contactsInfo: ContactsInfoBean? = null
private var contactsInfo: ContactsEntity? = null
override fun initView() {
super.initView()
@ -30,15 +30,15 @@ class AddContactsFragment: BaseFragment<FragmentAddContactsBinding, AddContactsV
binding.rvJob.adapter = mAdapter
binding.rvJob.addItemDecoration(GridSpaceItemDecoration(3, DensityUtils.dp2px(8f), DensityUtils.dp2px(8f)))
mAdapter.setList(ContactsInfoBean.getPositionList())
mAdapter.setList(ContactsEntity.getPositionList())
}
override fun initData() {
super.initData()
contactsInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", ContactsInfoBean::class.java)
arguments?.getSerializable("item", ContactsEntity::class.java)
} else {
arguments?.getSerializable("item") as? ContactsInfoBean
arguments?.getSerializable("item") as? ContactsEntity
}
setData()
}
@ -86,7 +86,7 @@ class AddContactsFragment: BaseFragment<FragmentAddContactsBinding, AddContactsV
return@onClick
}
if (contactsInfo == null) {
contactsInfo = ContactsInfoBean(UUID.randomUUID().toString(), name, phone, mAdapter.data.find { it.isChecked }?.name ?: job)
contactsInfo = ContactsEntity(UUID.randomUUID().toString(), name, phone, mAdapter.data.find { it.isChecked }?.name ?: job)
ContactsManager.add(contactsInfo!!)
} else {
contactsInfo!!.name = name

View File

@ -5,11 +5,11 @@ import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
import com.example.base.extensions.getColor
class ContactsJobAdapter : BaseQuickAdapter<ContactsInfoBean.Job, BaseViewHolder>(R.layout.listitem_contacts_job) {
override fun convert(holder: BaseViewHolder, item: ContactsInfoBean.Job) {
class ContactsJobAdapter : BaseQuickAdapter<ContactsEntity.Job, BaseViewHolder>(R.layout.listitem_contacts_job) {
override fun convert(holder: BaseViewHolder, item: ContactsEntity.Job) {
holder.setText(R.id.tv_name, item.name)
holder.setTextColor(R.id.tv_name, if (item.isChecked) getColor(R.color.color_125ffe) else getColor(R.color.color_1a1a1a))
holder.getView<TextView>(R.id.tv_name).typeface = if (item.isChecked) Typeface.DEFAULT_BOLD else Typeface.DEFAULT

View File

@ -0,0 +1,65 @@
package com.cheng.bole.ui.fragment.bid.publish.goods
import android.widget.ImageView
import android.widget.TextView
import coil.load
import coil.transform.RoundedCornersTransformation
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.MerchantGoodsEntity
import com.example.base.extensions.getColor
import com.example.base.utils.DensityUtils
class MyGoodsAdapter: BaseQuickAdapter<MerchantGoodsEntity, BaseViewHolder>(R.layout.listitem_my_goods) {
init {
addChildClickViewIds(R.id.btn_delete, R.id.btn_edit, R.id.btn_view)
}
override fun convert(holder: BaseViewHolder, item: MerchantGoodsEntity) {
if (item.file.isNotEmpty()) {
holder.getView<ImageView>(R.id.iv_cover).load(item.file[0].url){
transformations(RoundedCornersTransformation(DensityUtils.dp2px(6f).toFloat()))
}
}
holder.setText(R.id.tv_title, item.goods_name)
holder.setText(R.id.tv_content, item.goods_description)
holder.setText(R.id.tv_amount, "${item.goods_price_show}")
holder.setText(R.id.tv_area, item.city_name)
holder.setGone(R.id.tv_refuse_reason, true)
holder.setGone(R.id.btn_delete, true)
holder.setGone(R.id.btn_edit, true)
when (item.status) {
"1" -> {
holder.setText(R.id.tv_status, "待审核")
holder.setTextColor(R.id.tv_status, getColor(R.color.color_ff9234))
holder.setBackgroundResource(R.id.tv_status, R.drawable.shape_publish_status_bg1)
holder.getView<TextView>(R.id.tv_status).setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_publish_status1, 0, 0, 0)
}
"2" -> {
holder.setText(R.id.tv_status, "已发布")
holder.setTextColor(R.id.tv_status, getColor(R.color.color_e3fae7))
holder.setBackgroundResource(R.id.tv_status, R.drawable.shape_publish_status_bg2)
holder.getView<TextView>(R.id.tv_status).setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_publish_status2, 0, 0, 0)
holder.setGone(R.id.btn_delete, true)
}
"3" -> {
holder.setText(R.id.tv_status, "已驳回")
holder.setTextColor(R.id.tv_status, getColor(R.color.color_ffede7))
holder.setBackgroundResource(R.id.tv_status, R.drawable.shape_publish_status_bg3)
holder.getView<TextView>(R.id.tv_status).setCompoundDrawablesWithIntrinsicBounds(R.mipmap.ic_publish_status3, 0, 0, 0)
holder.setText(R.id.tv_refuse_reason, "理由:${item.remark}")
holder.setVisible(R.id.tv_refuse_reason, true)
holder.setGone(R.id.btn_delete, true)
holder.setGone(R.id.btn_edit, true)
}
}
}
}

View File

@ -0,0 +1,128 @@
package com.cheng.bole.ui.fragment.bid.publish.goods
import android.graphics.Typeface
import android.widget.TextView
import com.cheng.bole.R
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentMyGoodsBinding
import com.cheng.bole.event.SupplyEvent
import com.cheng.bole.manager.DialogEnum
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.dialog.TipDialog
import com.cheng.bole.ui.fragment.merchant.detail.MerchantGoodsDetailFragment
import com.example.base.common.RxBus
import com.example.base.extensions.onClick
import com.example.base.ui.BaseFragment
import com.example.base.widget.EmptyView
import com.example.base.widget.PageStatus
class MyGoodsFragment: BaseFragment<FragmentMyGoodsBinding, MyGoodsViewModel>() {
private val allGoodsList = mutableListOf<MerchantGoodsEntity>()
private val mAdapter by lazy { MyGoodsAdapter() }
private val mEmptyView by lazy { EmptyView(requireContext()) }
private var currentPosition = 0
private var page = 1
override fun initView() {
super.initView()
binding.mRecyclerView.adapter = mAdapter
mEmptyView.setNoDataText("暂无数据")
mEmptyView.setNoDataLogo(R.mipmap.ic_empty_seat)
mAdapter.setEmptyView(mEmptyView)
}
override fun initData() {
super.initData()
mViewModel.getGoodsList(page)
}
override fun initListener() {
super.initListener()
binding.tabLayout.observeIndexChange { fromIndex, toIndex, _, _ ->
currentPosition = toIndex
if (fromIndex != -1) {
(binding.tabLayout.getChildAt(fromIndex) as TextView).typeface = Typeface.DEFAULT
(binding.tabLayout.getChildAt(fromIndex) as TextView).setBackgroundResource(R.drawable.shape_push_bid_type_default)
}
(binding.tabLayout.getChildAt(toIndex) as TextView).typeface = Constants.douyinsansB
(binding.tabLayout.getChildAt(toIndex) as TextView).setBackgroundResource(R.drawable.shape_push_bid_type_checked)
setData()
}
binding.mRefreshLayout.setOnRefreshListener {
page = 1
mViewModel.getGoodsList(page)
}
binding.mRefreshLayout.setOnLoadMoreListener {
page++
mViewModel.getGoodsList(page)
}
mAdapter.setOnItemChildClickListener { _, view, position ->
val item = mAdapter.getItem(position)
when(view.id) {
R.id.btn_delete -> {
val f = TipDialog.newInstance("温馨提示", "您确定要删除供应服务吗?")
f.setOnSelectListener {
if (it == DialogEnum.CLICK_OK) {
mViewModel.deleteGoods(item.id)
}
}
f.show(childFragmentManager, TipDialog::class.java.simpleName)
}
R.id.btn_edit -> {
PublicActivity.start(requireContext(), PublishGoodsMessageFragment::class.java, Pair("item", item))
}
R.id.btn_view -> {
PublicActivity.start(requireActivity(), MerchantGoodsDetailFragment::class.java, Pair("item", item))
}
}
}
binding.btnNext.onClick {
PublicActivity.start(requireActivity(), PublishGoodsMessageFragment::class.java)
}
}
override fun initObserve() {
super.initObserve()
mViewModel.goodsLiveData.observe(this) { list ->
if (page == 1) allGoodsList.clear()
allGoodsList.addAll(list)
if (page == 1) {
binding.mRefreshLayout.finishRefresh()
} else {
binding.mRefreshLayout.finishLoadMore()
binding.mRefreshLayout.setNoMoreData(list.size < 20)
}
binding.mRefreshLayout.setEnableLoadMore(list.size == 20)
setData()
}
val supplyEvent = RxBus.defaultInstance.toObservable(SupplyEvent::class.java).subscribe {
binding.mRefreshLayout.autoRefresh()
}
addDisposable(supplyEvent)
}
private fun setData() {
when(currentPosition) {
0 -> mAdapter.setList(allGoodsList)
1 -> mAdapter.setList(allGoodsList.filter { it.type == "1" })
2 -> mAdapter.setList(allGoodsList.filter { it.type == "2" })
3 -> mAdapter.setList(allGoodsList.filter { it.type == "3" })
}
if (mAdapter.data.isNotEmpty()) {
mEmptyView.setStatus(PageStatus.GONG)
} else {
mEmptyView.setStatus(PageStatus.NO_DATA)
}
}
}

View File

@ -0,0 +1,43 @@
package com.cheng.bole.ui.fragment.bid.publish.goods
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel
class MyGoodsViewModel: BaseViewModel() {
val goodsLiveData = MutableLiveData<List<MerchantGoodsEntity>>()
val deleteLiveData = MutableLiveData<Any>()
fun getGoodsList(page: Int) {
launchOnUiTryCatch({
val params = mutableMapOf<String, String>()
params["page"] = "$page"
params["size"] = "20"
val response = ApiFactory.apiService.getMyGoodsList(params)
if (response.status) {
goodsLiveData.postValue(response.data.items)
} else toast(response.message, true)
}, {
setError(it)
L.d(it)
})
}
fun deleteGoods(id: String) {
showDialog()
launchOnUiTryCatch({
val response = ApiFactory.apiService.deleteGoodsInfo(id)
if (response.status) {
deleteLiveData.postValue(Any())
} else toast(response.message, true)
dismissDialog()
}, {
dismissDialog()
setError(it)
L.d(it)
})
}
}

View File

@ -7,20 +7,24 @@ import android.view.ViewOutlineProvider
import android.view.ViewTreeObserver
import androidx.constraintlayout.widget.ConstraintLayout
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentPublishGoodsMessageBinding
import com.cheng.bole.event.SupplyEvent
import com.cheng.bole.impl.TextWatcherImpl
import com.cheng.bole.manager.UserConfigManager
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.dialog.SelectAreaDialog
import com.cheng.bole.ui.dialog.SelectContactsDialog
import com.cheng.bole.ui.dialog.SelectGoodsTypeDialog
import com.cheng.bole.ui.fragment.bid.publish.bid.AddBidContactsAdapter
import com.cheng.bole.ui.fragment.bid.publish.bid.AddBidImageAdapter
import com.cheng.bole.ui.fragment.bid.publish.AddBidContactsAdapter
import com.cheng.bole.ui.fragment.bid.publish.AddBidImageAdapter
import com.cheng.bole.ui.fragment.bid.publish.my.MyPublishFragment
import com.cheng.bole.utils.GlideEngine
import com.cheng.bole.utils.PermissionUtils
import com.example.base.common.RxBus
import com.example.base.extensions.getColor
import com.example.base.extensions.gone
import com.example.base.extensions.onClick
@ -40,7 +44,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBinding, PublishGoodsMessageViewModel>() {
private val from by lazy { arguments?.getInt("from") ?: 0 }
private var goodsDetail: MerchantGoodsBean? = null
private var goodsDetail: MerchantGoodsEntity? = null
private val imageAdapter by lazy { AddBidImageAdapter(requireContext(), uploadedImgList) }
private var uploadedImgList: ArrayList<UploadFileEntity> = ArrayList()
@ -51,7 +55,7 @@ class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBindi
private var goodsType: String = "" // 1 提供服务 2 提供产品 3其他
private var priceType: Int = 1 // 1 具体价格 2 面议
private var city: AreaBean? = null
private var city: AreaEntity? = null
private val textWatcher = object : TextWatcherImpl() {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
@ -90,9 +94,9 @@ class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBindi
override fun initData() {
super.initData()
goodsDetail = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", MerchantGoodsBean::class.java)
arguments?.getSerializable("item", MerchantGoodsEntity::class.java)
} else {
arguments?.getSerializable("item") as? MerchantGoodsBean
arguments?.getSerializable("item") as? MerchantGoodsEntity
}
if (goodsDetail != null) {
setData(goodsDetail!!)
@ -223,12 +227,12 @@ class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBindi
override fun initObserve() {
super.initObserve()
mViewModel.addLiveData.observe(this) {
/*toast("提交成功")
toast("提交成功")
RxBus.defaultInstance.post(SupplyEvent(from))
if (from == 1) {
PublicActivity.start(requireContext(), MySupplierFragment::class.java)
PublicActivity.start(requireContext(), MyPublishFragment::class.java, Pair("type", 2))
}
requireActivity().finish()*/
requireActivity().finish()
}
mViewModel.imageLiveData.observe(this) {
@ -280,7 +284,7 @@ class PublishGoodsMessageFragment: BaseFragment<FragmentPublishGoodsMessageBindi
}
@SuppressLint("SetTextI18n", "NotifyDataSetChanged")
private fun setData(detail: MerchantGoodsBean) {
private fun setData(detail: MerchantGoodsEntity) {
if (detail.status == "3") {
binding.tvReason.text = "理由:${detail.remark}"
binding.tvTime.text = detail.review_time

View File

@ -0,0 +1,77 @@
package com.cheng.bole.ui.fragment.bid.publish.my
import android.graphics.Color
import android.graphics.Typeface
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentStatePagerAdapter
import com.angcyo.tablayout.delegate.ViewPager1Delegate
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentMyPublishBinding
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.base.BasePageAdapter
import com.cheng.bole.ui.fragment.bid.publish.bid.MyBidFragment
import com.cheng.bole.ui.fragment.bid.publish.goods.MyGoodsFragment
import com.cheng.bole.ui.fragment.mine.auth.CompanyAuthFragment
import com.example.base.extensions.onClick
import com.example.base.extensions.visible
import com.example.base.ui.BaseFragment
class MyPublishFragment: BaseFragment<FragmentMyPublishBinding, MyPublishViewModel>() {
private val tabText = listOf("招标信息", "合作信息")
private val fragmentList by lazy { mutableListOf<Fragment>() }
private val pageAdapter by lazy {
BasePageAdapter(
childFragmentManager,
tabText,
fragmentList,
FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
)
}
override fun initView() {
super.initView()
mTitleBar?.setBackgroundColor(Color.WHITE)
initFragment()
binding.viewPager.adapter = pageAdapter
binding.viewPager.offscreenPageLimit = fragmentList.size
binding.tabLayout.setupViewPager(ViewPager1Delegate.install(binding.viewPager, binding.tabLayout))
}
private fun initFragment() {
fragmentList.add(MyBidFragment())
fragmentList.add(MyGoodsFragment())
}
override fun initData() {
super.initData()
mViewModel.getCompanyInfo()
}
override fun initListener() {
super.initListener()
binding.tabLayout.observeIndexChange { fromIndex, toIndex, _, _ ->
binding.viewPager.currentItem = toIndex
if (fromIndex != -1) {
(binding.tabLayout.getChildAt(fromIndex) as TextView).typeface = Typeface.DEFAULT
}
(binding.tabLayout.getChildAt(toIndex) as TextView).typeface = Constants.douyinsansB
}
binding.layoutAuthTip.onClick {
PublicActivity.start(requireActivity(), CompanyAuthFragment::class.java)
}
}
override fun initObserve() {
super.initObserve()
mViewModel.companyLiveData.observe(this) {
if (it == null || it.status == "3") {
binding.layoutAuthTip.visible()
}
}
}
}

View File

@ -0,0 +1,27 @@
package com.cheng.bole.ui.fragment.bid.publish.my
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.CompanyEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel
class MyPublishViewModel: BaseViewModel() {
val companyLiveData = MutableLiveData<CompanyEntity>()
fun getCompanyInfo() {
showDialog()
launchOnUiTryCatch({
val response = ApiFactory.apiService.getCompanyInfo()
if (response.status) {
companyLiveData.postValue(response.data)
} else toast(response.message, true)
dismissDialog()
}, {
dismissDialog()
setError(it)
L.d(it)
})
}
}

View File

@ -1,10 +1,9 @@
package com.cheng.bole.ui.fragment.home
import android.text.TextUtils
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.recyclerview.widget.RecyclerView.HORIZONTAL
import com.cheng.bole.R
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.bean.MenuEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.common.EventConstants
@ -38,7 +37,7 @@ import kotlin.math.abs
/**
* 首页
*/
class HomeFragment : ListFragment<FragmentHomeBinding, HomeViewModel, BidItemBean>() {
class HomeFragment : ListFragment<FragmentHomeBinding, HomeViewModel, BidItemEntity>() {
private val menuAdapter by lazy { HomeMenuAdapter() }
private val keywordAdapter by lazy { HomeKeywordAdapter() }
@ -47,7 +46,7 @@ class HomeFragment : ListFragment<FragmentHomeBinding, HomeViewModel, BidItemBea
override fun bindAdapter() = BidAdapter()
private var item: BidItemBean? = null
private var item: BidItemEntity? = null
override fun initView() {
super.initView()

View File

@ -2,23 +2,23 @@ package com.cheng.bole.ui.fragment.home
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class HomeViewModel : ListViewModel<BidItemBean>() {
class HomeViewModel : ListViewModel<BidItemEntity>() {
val totalLiveData = MutableLiveData<String>()
val typeLiveData = MutableLiveData<List<BidTypeBean>>()
val authLiveData = MutableLiveData<UserAuthBean>()
val typeLiveData = MutableLiveData<List<BidTypeEntity>>()
val authLiveData = MutableLiveData<UserAuthEntity>()
val recommendLiveData = MutableLiveData<List<String>>()
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidItemBean>> {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidItemEntity>> {
val response = ApiFactory.apiService.getRecommendList(params)
if (response.status) {
totalLiveData.postValue(response.data.total)

View File

@ -1,16 +1,14 @@
package com.cheng.bole.ui.fragment.home.bszz
import android.annotation.SuppressLint
import android.graphics.Color
import android.text.TextUtils
import android.view.ViewTreeObserver
import androidx.constraintlayout.widget.ConstraintLayout
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.databinding.FragmentBszzBinding
import com.cheng.bole.impl.TextWatcherImpl
import com.cheng.bole.ui.dialog.SelectAreaDialog
import com.efs.sdk.memleaksdk.monitor.internal.bi
import com.example.base.extensions.onClick
import com.example.base.extensions.toast
import com.example.base.ui.BaseFragment
@ -22,7 +20,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
class BSZZFragment: BaseFragment<FragmentBszzBinding, BSZZViewModel>() {
private var timestamp = ""
private var city: AreaBean? = null
private var city: AreaEntity? = null
private val textWatcher = object : TextWatcherImpl() {
@SuppressLint("SetTextI18n")

View File

@ -2,7 +2,7 @@ package com.cheng.bole.ui.fragment.home.dljz
import android.annotation.SuppressLint
import android.text.TextUtils
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentDljzBinding
import com.cheng.bole.impl.TextWatcherImpl
@ -16,7 +16,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
class DLJZFragment: BaseFragment<FragmentDljzBinding, DLJZViewModel>() {
private var timestamp = ""
private var city: AreaBean? = null
private var city: AreaEntity? = null
private val textWatcher = object : TextWatcherImpl() {
@SuppressLint("SetTextI18n")

View File

@ -1,15 +1,13 @@
package com.cheng.bole.ui.fragment.home.qyzc
import android.annotation.SuppressLint
import android.graphics.Color
import android.text.TextUtils
import android.view.ViewTreeObserver
import androidx.constraintlayout.widget.ConstraintLayout
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.databinding.FragmentQyzcBinding
import com.cheng.bole.ui.dialog.SelectAreaDialog
import com.efs.sdk.memleaksdk.monitor.internal.bi
import com.example.base.extensions.onClick
import com.example.base.extensions.toast
import com.example.base.ui.BaseFragment
@ -23,7 +21,7 @@ import java.util.concurrent.TimeUnit
class QYZCFragment : BaseFragment<FragmentQyzcBinding, QYZCViewModel>() {
private var timestamp = ""
private var city: AreaBean? = null
private var city: AreaEntity? = null
private val companyAdapter by lazy { QYZCCompanyAdapter(requireContext(), companyList) }
private val companyList = mutableListOf<String>()

View File

@ -3,10 +3,10 @@ package com.cheng.bole.ui.fragment.home.zzdb
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ZZDBInfoBean
import com.cheng.bole.bean.ZZDBInfoEntity
class ZZDBAdapter: BaseQuickAdapter<ZZDBInfoBean, BaseViewHolder>(R.layout.listitem_zzdb_info) {
override fun convert(holder: BaseViewHolder, item: ZZDBInfoBean) {
class ZZDBAdapter: BaseQuickAdapter<ZZDBInfoEntity, BaseViewHolder>(R.layout.listitem_zzdb_info) {
override fun convert(holder: BaseViewHolder, item: ZZDBInfoEntity) {
holder.setText(R.id.tv_name, item.name)
holder.setGone(R.id.tv_level1, true)
holder.setGone(R.id.tv_level2, true)

View File

@ -1,14 +1,14 @@
package com.cheng.bole.ui.fragment.home.zzdb
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.ZZDBInfoBean
import com.cheng.bole.bean.ZZDBInfoEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel
class ZZDBViewModel: BaseViewModel() {
val listLiveData = MutableLiveData<List<ZZDBInfoBean>>()
val listLiveData = MutableLiveData<List<ZZDBInfoEntity>>()
fun getAgencyList(page: Int, name: String) {
launchOnUiTryCatch({

View File

@ -5,8 +5,8 @@ import android.os.Build
import android.text.TextUtils
import androidx.constraintlayout.widget.ConstraintLayout
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.ZZDBInfoBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.ZZDBInfoEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentZzdbDetailBinding
import com.cheng.bole.ui.dialog.SelectAreaDialog
@ -22,8 +22,8 @@ import com.gyf.immersionbar.ktx.actionBarHeight
import okhttp3.RequestBody.Companion.toRequestBody
class ZZDBDetailFragment : BaseFragment<FragmentZzdbDetailBinding, ZZDBDetailViewModel>() {
private var info: ZZDBInfoBean? = null
private var childInfo: ZZDBInfoBean? = null
private var info: ZZDBInfoEntity? = null
private var childInfo: ZZDBInfoEntity? = null
private val deviceAdapter by lazy { ZZDBDeviceAdapter() }
@ -31,7 +31,7 @@ class ZZDBDetailFragment : BaseFragment<FragmentZzdbDetailBinding, ZZDBDetailVie
private var timestamp = ""
private var city: AreaBean? = null
private var city: AreaEntity? = null
override fun initView() {
super.initView()
@ -48,9 +48,9 @@ class ZZDBDetailFragment : BaseFragment<FragmentZzdbDetailBinding, ZZDBDetailVie
override fun initData() {
super.initData()
info = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", ZZDBInfoBean::class.java)
arguments?.getSerializable("item", ZZDBInfoEntity::class.java)
} else {
arguments?.getSerializable("item") as? ZZDBInfoBean
arguments?.getSerializable("item") as? ZZDBInfoEntity
}
setBaseData()
}
@ -179,7 +179,7 @@ class ZZDBDetailFragment : BaseFragment<FragmentZzdbDetailBinding, ZZDBDetailVie
}
}
private fun setDetailData(info: ZZDBInfoBean) {
private fun setDetailData(info: ZZDBInfoEntity) {
binding.tvRange.text = info.range
binding.tvAsset.text = info.property
binding.tvPerson.text = info.person
@ -203,7 +203,7 @@ class ZZDBDetailFragment : BaseFragment<FragmentZzdbDetailBinding, ZZDBDetailVie
setExpandStyle(info)
}
private fun setExpandStyle(info: ZZDBInfoBean) {
private fun setExpandStyle(info: ZZDBInfoEntity) {
if (isExpand) {
binding.tvMore.text = "收起更多资质说明"
binding.tvMore.setCompoundDrawablesWithIntrinsicBounds(0 , 0, R.mipmap.ic_more_arrow_up, 0)

View File

@ -1,7 +1,7 @@
package com.cheng.bole.ui.fragment.main
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.UserEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
@ -13,7 +13,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
class MainViewModel : BaseViewModel() {
val userInfoLiveData = MutableLiveData<UserEntity>()
val areaLiveData = MutableLiveData<List<AreaBean>>()
val areaLiveData = MutableLiveData<List<AreaEntity>>()
val getCouponLiveData = MutableLiveData<Int>()
fun userInfo() {

View File

@ -3,15 +3,15 @@ package com.cheng.bole.ui.fragment.merchant
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.ContactsInfoBean
import com.cheng.bole.bean.ContactsEntity
class MerchantContactsAdapter: BaseQuickAdapter<ContactsInfoBean, BaseViewHolder>(R.layout.listitem_merchant_contacts) {
class MerchantContactsAdapter: BaseQuickAdapter<ContactsEntity, BaseViewHolder>(R.layout.listitem_merchant_contacts) {
init {
addChildClickViewIds(R.id.iv_call)
}
override fun convert(holder: BaseViewHolder, item: ContactsInfoBean) {
override fun convert(holder: BaseViewHolder, item: ContactsEntity) {
holder.setText(R.id.tv_phone, item.phone)
holder.setText(R.id.tv_name, "${item.name} | ${item.job}")
}

View File

@ -10,7 +10,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentStatePagerAdapter
import com.angcyo.tablayout.delegate.ViewPager1Delegate
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.common.EventConstants
import com.cheng.bole.databinding.FragmentMerchantBinding
@ -31,6 +31,7 @@ class MerchantFragment : BaseFragment<FragmentMerchantBinding, MerchantViewModel
private val keyword by lazy { arguments?.getString("keyword") ?: "" }
private val tabText = listOf("全部", "服务", "产品", "其他")
private val fragmentList by lazy { mutableListOf<Fragment>() }
private val pageAdapter by lazy {
BasePageAdapter(
@ -41,7 +42,7 @@ class MerchantFragment : BaseFragment<FragmentMerchantBinding, MerchantViewModel
)
}
private var city: AreaBean? = AreaBean(0, name = "全国")
private var city: AreaEntity? = AreaEntity(0, name = "全国")
private val textWatcher = object : TextWatcherImpl() {
@SuppressLint("SetTextI18n")

View File

@ -9,7 +9,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.net.toUri
import androidx.viewpager2.widget.ViewPager2
import com.cheng.bole.R
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.common.EventConstants
import com.cheng.bole.databinding.FragmentMerchantGoodsDetailBinding
@ -19,14 +19,16 @@ import com.cheng.bole.ui.fragment.merchant.MerchantContactsAdapter
import com.cheng.bole.ui.fragment.merchant.home.MerchantHomeFragment
import com.cheng.bole.ui.fragment.photo.PhotoViewFragment
import com.example.base.decoration.SpacesItemDecoration
import com.example.base.extensions.gone
import com.example.base.extensions.onClick
import com.example.base.extensions.visible
import com.example.base.ui.BaseFragment
import com.example.base.utils.DensityUtils
import com.example.base.utils.SpanUtils
import java.text.DecimalFormat
class MerchantGoodsDetailFragment : BaseFragment<FragmentMerchantGoodsDetailBinding, MerchantGoodsDetailViewModel>() {
private var goodsInfo: MerchantGoodsBean? = null
private var goodsInfo: MerchantGoodsEntity? = null
private val contactsAdapter by lazy { MerchantContactsAdapter() }
private val imageAdapter by lazy { MerchantGoodsImageAdapter() }
@ -54,9 +56,9 @@ class MerchantGoodsDetailFragment : BaseFragment<FragmentMerchantGoodsDetailBind
override fun initData() {
super.initData()
goodsInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", MerchantGoodsBean::class.java)
arguments?.getSerializable("item", MerchantGoodsEntity::class.java)
} else {
arguments?.getSerializable("item") as? MerchantGoodsBean
arguments?.getSerializable("item") as? MerchantGoodsEntity
}
setData()
mViewModel.sendAuth()
@ -99,10 +101,15 @@ class MerchantGoodsDetailFragment : BaseFragment<FragmentMerchantGoodsDetailBind
@SuppressLint("SetTextI18n")
private fun setData() {
if (goodsInfo != null) {
binding.tvCompanyAvatar.text = goodsInfo!!.company.company_name.substring(0, 2) + "\n" + goodsInfo!!.company.company_name.substring(2, 4)
binding.tvCompanyName.text = goodsInfo!!.company.company_name
binding.tvCompanyCity.text = goodsInfo!!.company.city_name
binding.tvExtra.text = if (!TextUtils.isEmpty(goodsInfo!!.company.extra?.toString())) goodsInfo!!.company.extra.toString() else ""
if (!TextUtils.isEmpty(goodsInfo!!.company.company_name)) {
binding.tvCompanyAvatar.text = goodsInfo!!.company.company_name!!.substring(0, 2) + "\n" + goodsInfo!!.company.company_name!!.substring(2, 4)
binding.tvCompanyName.text = goodsInfo!!.company.company_name
binding.tvCompanyCity.text = goodsInfo!!.company.city_name
binding.tvExtra.text = if (!TextUtils.isEmpty(goodsInfo!!.company.extra?.toString())) goodsInfo!!.company.extra.toString() else ""
binding.layoutCompanyInfo.visible()
} else {
binding.layoutCompanyInfo.gone()
}
contactsAdapter.setList(goodsInfo!!.contact)
imageAdapter.setList(goodsInfo!!.file)
binding.tvIndicator.text = "1/${imageAdapter.data.size}"

View File

@ -7,17 +7,15 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentStatePagerAdapter
import com.angcyo.tablayout.delegate.ViewPager1Delegate
import com.cheng.bole.R
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.common.EventConstants
import com.cheng.bole.databinding.FragmentMerchantHomeBinding
import com.cheng.bole.manager.EventReportManager
import com.cheng.bole.ui.base.BasePageAdapter
import com.cheng.bole.ui.fragment.merchant.list.MerchantGoodsListFragment
import com.example.base.ui.BaseFragment
class MerchantHomeFragment : BaseFragment<FragmentMerchantHomeBinding, MerchantHomeViewModel>() {
private var goodsInfo: MerchantGoodsBean? = null
private var goodsInfo: MerchantGoodsEntity? = null
private val tabText = listOf("全部", "服务", "产品", "其他")
private val fragmentList by lazy { mutableListOf<Fragment>() }
@ -35,9 +33,9 @@ class MerchantHomeFragment : BaseFragment<FragmentMerchantHomeBinding, MerchantH
mTitleBar?.background = null
goodsInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", MerchantGoodsBean::class.java)
arguments?.getSerializable("item", MerchantGoodsEntity::class.java)
} else {
arguments?.getSerializable("item") as? MerchantGoodsBean
arguments?.getSerializable("item") as? MerchantGoodsEntity
}
binding.tvTitle.text = goodsInfo?.company?.company_name

View File

@ -7,13 +7,16 @@ import coil.load
import coil.transform.RoundedCornersTransformation
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.common.Constants
import com.example.base.ui.list.LoadMoreAdapter
import com.example.base.utils.DensityUtils
class MerchantGoodsAdapter: LoadMoreAdapter<MerchantGoodsBean>(R.layout.listitem_merchant_goods) {
override fun convert(holder: BaseViewHolder, item: MerchantGoodsBean) {
class MerchantGoodsAdapter: LoadMoreAdapter<MerchantGoodsEntity>(R.layout.listitem_merchant_goods) {
override fun convert(holder: BaseViewHolder, item: MerchantGoodsEntity) {
holder.getView<TextView>(R.id.tv_price).typeface = Constants.dDIN_PRO_M
holder.getView<TextView>(R.id.tv_company_avatar).typeface = Constants.almmsht
if (item.file.isNotEmpty()) {
holder.getView<ImageView>(R.id.iv_cover).load(item.file[0].url){
transformations(RoundedCornersTransformation(DensityUtils.dp2px(8f).toFloat()))
@ -22,11 +25,20 @@ class MerchantGoodsAdapter: LoadMoreAdapter<MerchantGoodsBean>(R.layout.listitem
holder.setText(R.id.tv_name, item.goods_name)
holder.setText(R.id.tv_desc, item.goods_description)
holder.setText(R.id.tv_price, item.goods_price_show)
holder.setText(R.id.tv_location, if (TextUtils.isEmpty(item.city_name)) "全国" else item.city_name)
holder.setText(R.id.tv_company_avatar, item.company.company_name.take(2) + "\n" + item.company.company_name.substring(2, 4))
holder.setText(R.id.tv_company_name, item.company.company_name)
holder.setText(R.id.tv_view_count, "已浏览 ${if (!TextUtils.isEmpty(item.view_count)) item.view_count else 0}")
holder.getView<TextView>(R.id.tv_price).typeface = Constants.dDIN_PRO_M
holder.getView<TextView>(R.id.tv_company_avatar).typeface = Constants.almmsht
holder.setGone(R.id.tv_company_avatar, true)
holder.setGone(R.id.tv_company_name, true)
holder.setGone(R.id.tv_location, true)
if (!TextUtils.isEmpty(item.company.company_name)) {
holder.setText(R.id.tv_company_avatar, item.company.company_name!!.take(2) + "\n" + item.company.company_name.substring(2, 4))
holder.setText(R.id.tv_company_name, item.company.company_name)
holder.setVisible(R.id.tv_company_avatar, true)
holder.setVisible(R.id.tv_company_name, true)
}
if (!TextUtils.isEmpty(item.company.city_name)) {
holder.setText(R.id.tv_location, if (TextUtils.isEmpty(item.city_name)) "全国" else item.city_name)
holder.setVisible(R.id.tv_location, true)
}
}
}

View File

@ -2,7 +2,7 @@ package com.cheng.bole.ui.fragment.merchant.list
import android.os.Bundle
import com.cheng.bole.R
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.databinding.FragmentMerchantGoodsListBinding
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.fragment.merchant.detail.MerchantGoodsDetailFragment
@ -11,13 +11,13 @@ import com.example.base.decoration.FirstItemOffsetDecoration
import com.example.base.ui.list.ListFragment
import com.example.base.utils.DensityUtils
class MerchantGoodsListFragment : ListFragment<FragmentMerchantGoodsListBinding, MerchantGoodsListViewModel, MerchantGoodsBean>() {
class MerchantGoodsListFragment : ListFragment<FragmentMerchantGoodsListBinding, MerchantGoodsListViewModel, MerchantGoodsEntity>() {
private val type by lazy { arguments?.getString("type") ?: "" }
private val userId by lazy { arguments?.getString("userId") ?: "" }
private var keyword: String = ""
private var item: MerchantGoodsBean? = null
private var item: MerchantGoodsEntity? = null
companion object {
fun newInstance(type: String, userId: String = ""): MerchantGoodsListFragment {

View File

@ -2,20 +2,20 @@ package com.cheng.bole.ui.fragment.merchant.list
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.MerchantGoodsBean
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.MerchantGoodsEntity
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class MerchantGoodsListViewModel: ListViewModel<MerchantGoodsBean>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<MerchantGoodsBean>> {
class MerchantGoodsListViewModel: ListViewModel<MerchantGoodsEntity>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<MerchantGoodsEntity>> {
return ApiFactory.apiService.searchSupplier(params).toListResult()
}
val authLiveData = MutableLiveData<UserAuthBean>()
val authLiveData = MutableLiveData<UserAuthEntity>()
fun checkAuth() {
launchOnUiTryCatch({

View File

@ -18,6 +18,7 @@ import com.cheng.bole.manager.UserConfigManager
import com.cheng.bole.ui.activity.LoginActivity
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.dialog.ShareDialog
import com.cheng.bole.ui.fragment.bid.publish.my.MyPublishFragment
import com.cheng.bole.ui.fragment.mine.auth.CompanyAuthFragment
import com.cheng.bole.ui.fragment.mine.favorite.FavoriteFragment
import com.cheng.bole.ui.fragment.mine.feedback.FeedbackFragment
@ -121,7 +122,8 @@ class MineFragment : BaseFragment<FragmentMineBinding, MineViewModel>() {
}
binding.tvMyPublish.onClick {
PublicActivity.start(requireContext(), MyPublishFragment::class.java)
EventReportManager.eventReport(EventConstants.JUMP_TO_MY_PUBLISH, "", "")
}
binding.tvAuth.onClick {

View File

@ -1,8 +1,7 @@
package com.cheng.bole.ui.fragment.mine
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.CompanyBean
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.bean.CompanyEntity
import com.cheng.bole.bean.UserEntity
import com.cheng.bole.bean.WxServiceEntity
import com.cheng.bole.common.Constants
@ -17,7 +16,7 @@ import com.tencent.mm.opensdk.openapi.WXAPIFactory
class MineViewModel : BaseViewModel() {
val userInfoLiveData = MutableLiveData<UserEntity>()
val companyLiveData = MutableLiveData<CompanyBean>()
val companyLiveData = MutableLiveData<CompanyEntity>()
fun userInfo(showLoading: Boolean = false) {
if (showLoading) showDialog()

View File

@ -8,8 +8,8 @@ import androidx.constraintlayout.widget.ConstraintLayout
import coil.load
import coil.transform.RoundedCornersTransformation
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.CompanyBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.CompanyEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.databinding.FragmentCompanyAuthBinding
@ -18,7 +18,7 @@ import com.cheng.bole.manager.UserConfigManager
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.dialog.SelectAreaDialog
import com.cheng.bole.ui.dialog.SelectContactsDialog
import com.cheng.bole.ui.fragment.bid.publish.bid.AddBidContactsAdapter
import com.cheng.bole.ui.fragment.bid.publish.AddBidContactsAdapter
import com.cheng.bole.ui.fragment.mine.vip.VipFragment
import com.cheng.bole.ui.fragment.photo.PhotoViewFragment
import com.cheng.bole.utils.FileProviderUtils
@ -35,13 +35,13 @@ import com.google.gson.JsonObject
import okhttp3.RequestBody.Companion.toRequestBody
class CompanyAuthFragment : BaseFragment<FragmentCompanyAuthBinding, CompanyAuthViewModel>() {
private var companyDetail: CompanyBean? = null
private var companyDetail: CompanyEntity? = null
private var image: UploadFileEntity? = null
private val contactsAdapter by lazy { AddBidContactsAdapter() }
private var city: AreaBean? = null
private var city: AreaEntity? = null
private val imageLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) {
it?.let {
@ -202,7 +202,7 @@ class CompanyAuthFragment : BaseFragment<FragmentCompanyAuthBinding, CompanyAuth
}
@SuppressLint("SetTextI18n")
private fun setData(detail: CompanyBean) {
private fun setData(detail: CompanyEntity) {
when (detail.status) {
"1" -> {
binding.etName.isEnabled = false

View File

@ -2,7 +2,7 @@ package com.cheng.bole.ui.fragment.mine.auth
import android.content.Context
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.CompanyBean
import com.cheng.bole.bean.CompanyEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.utils.BitmapUtils
@ -14,7 +14,7 @@ import okhttp3.MultipartBody
import okhttp3.RequestBody
class CompanyAuthViewModel: BaseViewModel() {
val companyLiveData = MutableLiveData<CompanyBean>()
val companyLiveData = MutableLiveData<CompanyEntity>()
val addLiveData = MutableLiveData<Any>()
val imageLiveData = MutableLiveData<UploadFileEntity>()

View File

@ -1,7 +1,7 @@
package com.cheng.bole.ui.fragment.mine.favorite
import com.cheng.bole.R
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.databinding.FragmentFavoriteBinding
import com.cheng.bole.event.FavoriteEvent
import com.cheng.bole.ui.activity.PublicActivity
@ -11,8 +11,8 @@ import com.cheng.bole.ui.fragment.mine.vip.VipFragment
import com.example.base.common.RxBus
import com.example.base.ui.list.ListFragment
class FavoriteFragment: ListFragment<FragmentFavoriteBinding, FavoriteViewModel, BidItemBean>() {
private var item: BidItemBean? = null
class FavoriteFragment: ListFragment<FragmentFavoriteBinding, FavoriteViewModel, BidItemEntity>() {
private var item: BidItemEntity? = null
override fun noDataClick() {

View File

@ -2,20 +2,20 @@ package com.cheng.bole.ui.fragment.mine.favorite
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class FavoriteViewModel: ListViewModel<BidItemBean>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidItemBean>> {
class FavoriteViewModel: ListViewModel<BidItemEntity>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidItemEntity>> {
return ApiFactory.apiService.getFavoriteList().toListResult()
}
val authLiveData = MutableLiveData<UserAuthBean>()
val authLiveData = MutableLiveData<UserAuthEntity>()
fun checkAuth() {
launchOnUiTryCatch({

View File

@ -3,15 +3,15 @@ package com.cheng.bole.ui.fragment.mine.history
import android.text.TextUtils
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.utils.BidTypeUtils
import com.cheng.bole.widget.CommonShapeView
import com.example.base.ui.list.LoadMoreAdapter
import java.text.DecimalFormat
class HistoryAdapter: LoadMoreAdapter<BidDetailBean>(R.layout.listitem_bid) {
class HistoryAdapter: LoadMoreAdapter<BidDetailEntity>(R.layout.listitem_bid) {
override fun convert(holder: BaseViewHolder, item: BidDetailBean) {
override fun convert(holder: BaseViewHolder, item: BidDetailEntity) {
val tvTag = holder.getView<CommonShapeView>(R.id.tv_tag)
tvTag.setBgColor(BidTypeUtils.getTypeColor(item.type_name))
tvTag.text = BidTypeUtils.getShortName(item.type_name)

View File

@ -1,15 +1,15 @@
package com.cheng.bole.ui.fragment.mine.history
import com.cheng.bole.R
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.databinding.FragmentHistoryBinding
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.fragment.bid.detail.BidDetailFragment
import com.cheng.bole.ui.fragment.mine.vip.VipFragment
import com.example.base.ui.list.ListFragment
class HistoryFragment: ListFragment<FragmentHistoryBinding, HistoryViewModel, BidDetailBean>() {
private var item: BidDetailBean? = null
class HistoryFragment: ListFragment<FragmentHistoryBinding, HistoryViewModel, BidDetailEntity>() {
private var item: BidDetailEntity? = null
override fun noDataClick() {

View File

@ -2,20 +2,20 @@ package com.cheng.bole.ui.fragment.mine.history
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidDetailBean
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.BidDetailEntity
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class HistoryViewModel: ListViewModel<BidDetailBean>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidDetailBean>> {
class HistoryViewModel: ListViewModel<BidDetailEntity>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidDetailEntity>> {
return ApiFactory.apiService.getViewHistoryList().toListResult()
}
val authLiveData = MutableLiveData<UserAuthBean>()
val authLiveData = MutableLiveData<UserAuthEntity>()
fun checkAuth() {
launchOnUiTryCatch({

View File

@ -3,15 +3,15 @@ package com.cheng.bole.ui.fragment.mine.message
import android.text.TextUtils
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.SubscriptionMessageBean
import com.cheng.bole.bean.SubscriptionMessageEntity
import com.cheng.bole.utils.BidTypeUtils
import com.cheng.bole.utils.StringUtils
import com.cheng.bole.widget.CommonShapeView
import com.example.base.ui.list.LoadMoreAdapter
import java.text.DecimalFormat
class MessageAdapter: LoadMoreAdapter<SubscriptionMessageBean>(R.layout.listitem_message) {
override fun convert(holder: BaseViewHolder, item: SubscriptionMessageBean) {
class MessageAdapter: LoadMoreAdapter<SubscriptionMessageEntity>(R.layout.listitem_message) {
override fun convert(holder: BaseViewHolder, item: SubscriptionMessageEntity) {
val tvTag = holder.getView<CommonShapeView>(R.id.tv_tag)
tvTag.setBgColor(BidTypeUtils.getTypeColor(item.extra.typeName))
tvTag.text = BidTypeUtils.getShortName(item.extra.typeName)

View File

@ -2,15 +2,15 @@ package com.cheng.bole.ui.fragment.mine.message
import android.graphics.Color
import com.cheng.bole.R
import com.cheng.bole.bean.SubscriptionMessageBean
import com.cheng.bole.bean.SubscriptionMessageEntity
import com.cheng.bole.databinding.FragmentMessageBinding
import com.cheng.bole.ui.activity.PublicActivity
import com.cheng.bole.ui.fragment.bid.detail.BidDetailFragment
import com.cheng.bole.ui.fragment.mine.vip.VipFragment
import com.example.base.ui.list.ListFragment
class MessageFragment: ListFragment<FragmentMessageBinding, MessageViewModel, SubscriptionMessageBean>() {
private var item: SubscriptionMessageBean? = null
class MessageFragment: ListFragment<FragmentMessageBinding, MessageViewModel, SubscriptionMessageEntity>() {
private var item: SubscriptionMessageEntity? = null
override fun noDataClick() {
}

View File

@ -2,20 +2,20 @@ package com.cheng.bole.ui.fragment.mine.message
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.SubscriptionMessageBean
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.SubscriptionMessageEntity
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class MessageViewModel: ListViewModel<SubscriptionMessageBean>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<SubscriptionMessageBean>> {
class MessageViewModel: ListViewModel<SubscriptionMessageEntity>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<SubscriptionMessageEntity>> {
return ApiFactory.apiService.getSubscriptionMessage(params).toListResult()
}
val authLiveData = MutableLiveData<UserAuthBean>()
val authLiveData = MutableLiveData<UserAuthEntity>()
fun checkAuth() {
launchOnUiTryCatch({

View File

@ -5,7 +5,7 @@ import android.text.TextUtils
import androidx.activity.result.contract.ActivityResultContracts
import coil.load
import coil.transform.RoundedCornersTransformation
import com.cheng.bole.bean.OrderBean
import com.cheng.bole.bean.OrderEntity
import com.cheng.bole.databinding.FragmentCertificateBinding
import com.cheng.bole.event.OrderEvent
import com.cheng.bole.ui.activity.PublicActivity
@ -28,8 +28,8 @@ import java.text.DecimalFormat
class CertificateFragment: BaseFragment<FragmentCertificateBinding, CertificateViewModel>() {
private val orderId by lazy { arguments?.getString("orderId") ?: "" }
private var orderInfo: OrderBean? = null
private var transInfo: OrderBean.TransInfo? = null
private var orderInfo: OrderEntity? = null
private var transInfo: OrderEntity.TransInfo? = null
private var imagePath: String? = null
@ -97,7 +97,7 @@ class CertificateFragment: BaseFragment<FragmentCertificateBinding, CertificateV
mViewModel.orderLiveData.observe(this) {
orderInfo = it
if (!TextUtils.isEmpty(it.pay_params)) {
transInfo = Gson().fromJson(it.pay_params, OrderBean.TransInfo::class.java)
transInfo = Gson().fromJson(it.pay_params, OrderEntity.TransInfo::class.java)
setTransInfo()
}
}

View File

@ -2,7 +2,7 @@ package com.cheng.bole.ui.fragment.mine.order.cert
import android.content.Context
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.OrderBean
import com.cheng.bole.bean.OrderEntity
import com.cheng.bole.bean.UploadFileEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.utils.BitmapUtils
@ -14,7 +14,7 @@ import okhttp3.MultipartBody
import okhttp3.RequestBody
class CertificateViewModel : BaseViewModel() {
val orderLiveData = MutableLiveData<OrderBean>()
val orderLiveData = MutableLiveData<OrderEntity>()
val updateLiveData = MutableLiveData<Any>()
val imageLiveData = MutableLiveData<UploadFileEntity>()

View File

@ -4,7 +4,7 @@ import android.graphics.Color
import android.os.Build
import android.text.TextUtils
import com.cheng.bole.R
import com.cheng.bole.bean.OrderBean
import com.cheng.bole.bean.OrderEntity
import com.cheng.bole.databinding.FragmentInvoiceBinding
import com.cheng.bole.event.OrderEvent
import com.example.base.common.RxBus
@ -21,7 +21,7 @@ class InvoiceFragment : BaseFragment<FragmentInvoiceBinding, InvoiceViewModel>()
private var userType = 0 // 0 企业 1 个人
private var invoiceType = 0 // 0 普票 1 专票
private var orderInfo: OrderBean? = null
private var orderInfo: OrderEntity? = null
override fun initView() {
super.initView()
@ -32,9 +32,9 @@ class InvoiceFragment : BaseFragment<FragmentInvoiceBinding, InvoiceViewModel>()
override fun initData() {
super.initData()
orderInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", OrderBean::class.java)
arguments?.getSerializable("item", OrderEntity::class.java)
} else {
arguments?.getSerializable("item") as? OrderBean
arguments?.getSerializable("item") as? OrderEntity
}
binding.tvAmount.text = DecimalFormat("0.00").format(orderInfo!!.total_fee.toFloat())

View File

@ -5,17 +5,17 @@ import android.text.TextUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.OrderBean
import com.cheng.bole.bean.OrderEntity
import com.cheng.bole.widget.CommonShapeView
import java.text.DecimalFormat
class OrderAdapter : BaseQuickAdapter<OrderBean, BaseViewHolder>(R.layout.listitem_order) {
class OrderAdapter : BaseQuickAdapter<OrderEntity, BaseViewHolder>(R.layout.listitem_order) {
init {
addChildClickViewIds(R.id.btn_invoice, R.id.btn_certificate)
}
override fun convert(holder: BaseViewHolder, item: OrderBean) {
override fun convert(holder: BaseViewHolder, item: OrderEntity) {
holder.setText(R.id.tv_name, item.goods_name)
holder.setText(R.id.tv_order_no, item.out_trade_no)
holder.setText(

View File

@ -1,14 +1,14 @@
package com.cheng.bole.ui.fragment.mine.order.list
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.OrderBean
import com.cheng.bole.bean.OrderEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel
class OrderListViewModel : BaseViewModel() {
val orderLiveData = MutableLiveData<List<OrderBean>>()
val orderLiveData = MutableLiveData<List<OrderEntity>>()
fun getOrderList(status: String) {
showDialog()

View File

@ -7,15 +7,15 @@ import coil.transform.CircleCropTransformation
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.SeatItemBean
import com.cheng.bole.bean.SeatItemEntity
class SeatManageAdapter: BaseQuickAdapter<SeatItemBean, BaseViewHolder>(R.layout.listitem_seat_manage) {
class SeatManageAdapter: BaseQuickAdapter<SeatItemEntity, BaseViewHolder>(R.layout.listitem_seat_manage) {
init {
addChildClickViewIds(R.id.btn_delete)
}
override fun convert(holder: BaseViewHolder, item: SeatItemBean) {
override fun convert(holder: BaseViewHolder, item: SeatItemEntity) {
holder.getView<ImageView>(R.id.iv_avatar).load(item.avatar) {
transformations(CircleCropTransformation())
}

View File

@ -2,7 +2,7 @@ package com.cheng.bole.ui.fragment.mine.seat
import android.annotation.SuppressLint
import com.cheng.bole.R
import com.cheng.bole.bean.CorpInfoBean
import com.cheng.bole.bean.CorpEntity
import com.cheng.bole.databinding.FragmentSeatManageBinding
import com.cheng.bole.event.PaySuccessEvent
import com.cheng.bole.manager.DialogEnum
@ -22,7 +22,7 @@ class SeatManageFragment: BaseFragment<FragmentSeatManageBinding, SeatManageView
private val mEmptyView by lazy { EmptyView(requireContext()) }
private val mAdapter by lazy { SeatManageAdapter() }
private var corpInfo: CorpInfoBean? = null
private var corpInfo: CorpEntity? = null
private var seatDialog: BuySeatDialog? = null
private var dismissDialog = false

View File

@ -1,8 +1,8 @@
package com.cheng.bole.ui.fragment.mine.seat
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.CorpInfoBean
import com.cheng.bole.bean.SeatItemBean
import com.cheng.bole.bean.CorpEntity
import com.cheng.bole.bean.SeatItemEntity
import com.cheng.bole.bean.VipGoodsEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
@ -12,8 +12,8 @@ import okhttp3.RequestBody
class SeatManageViewModel: BaseViewModel() {
val goodsLiveData = MutableLiveData<List<VipGoodsEntity>>()
val corpInfoLiveData = MutableLiveData<CorpInfoBean>()
val seatListLiveData = MutableLiveData<List<SeatItemBean>>()
val corpInfoLiveData = MutableLiveData<CorpEntity>()
val seatListLiveData = MutableLiveData<List<SeatItemEntity>>()
val addLiveData = MutableLiveData<Any>()
val deleteLiveData = MutableLiveData<Any>()

View File

@ -10,7 +10,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.cheng.bole.R
import com.cheng.bole.bean.CorpInfoBean
import com.cheng.bole.bean.CorpEntity
import com.cheng.bole.bean.OrderPayEntity
import com.cheng.bole.bean.UserEntity
import com.cheng.bole.bean.VipGoodsEntity
@ -76,7 +76,7 @@ class VipFragment : BaseFragment<FragmentVipBinding, VipViewModel>() {
private var userInfo: UserEntity? = null
private var goodsEntity: VipGoodsEntity? = null
private var orderEntity: OrderPayEntity? = null
private var corpInfo: CorpInfoBean? = null
private var corpInfo: CorpEntity? = null
private var payTypeCheckedRes = R.mipmap.ic_pay_checked1

View File

@ -1,7 +1,7 @@
package com.cheng.bole.ui.fragment.mine.vip
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.CorpInfoBean
import com.cheng.bole.bean.CorpEntity
import com.cheng.bole.bean.CouponEntity
import com.cheng.bole.bean.OrderPayEntity
import com.cheng.bole.bean.UserEntity
@ -17,7 +17,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
class VipViewModel : BaseViewModel() {
val userInfoLiveData = MutableLiveData<UserEntity>()
val goodsListLiveData = MutableLiveData<List<VipGoodsEntity>>()
val corpInfoLiveData = MutableLiveData<CorpInfoBean>()
val corpInfoLiveData = MutableLiveData<CorpEntity>()
val createOrderLiveData = MutableLiveData<OrderPayEntity>()
val payTipsLiveData = MutableLiveData<List<String>>()
val couponListLiveData = MutableLiveData<List<CouponEntity>>()

View File

@ -1,16 +1,16 @@
package com.cheng.bole.ui.fragment.push
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.SubscriptionBean
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.bean.SubscriptionEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel
class PushViewModel : BaseViewModel() {
val subscribeLiveData = MutableLiveData<List<SubscriptionBean>>()
val typeLiveData = MutableLiveData<List<BidTypeBean>>()
val subscribeLiveData = MutableLiveData<List<SubscriptionEntity>>()
val typeLiveData = MutableLiveData<List<BidTypeEntity>>()
fun getSubscriptionList() {
showDialog()

View File

@ -6,8 +6,8 @@ import android.view.Gravity
import android.widget.TextView
import com.angcyo.tablayout.DslTabLayout
import com.cheng.bole.R
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.BidTypeBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.bean.BidTypeEntity
import com.cheng.bole.common.Constants
import com.cheng.bole.common.EventConstants
import com.cheng.bole.databinding.FragmentPushListBinding
@ -24,11 +24,11 @@ import com.example.base.utils.DensityUtils
import com.example.base.widget.PageStatus
import androidx.core.view.isNotEmpty
class PushListFragment : ListFragment<FragmentPushListBinding, PushListViewModel, BidItemBean>() {
class PushListFragment : ListFragment<FragmentPushListBinding, PushListViewModel, BidItemEntity>() {
private val subId by lazy { arguments?.getString("subId") ?: "" }
private val bidType by lazy { UserConfigManager.getBidTypes() }
private var item: BidItemBean? = null
private var item: BidItemEntity? = null
companion object {
fun newInstance(subId: String): PushListFragment {
@ -101,7 +101,7 @@ class PushListFragment : ListFragment<FragmentPushListBinding, PushListViewModel
}
}
private fun createTab(type: BidTypeBean): TextView {
private fun createTab(type: BidTypeEntity): TextView {
val tvTab = TextView(requireContext())
tvTab.text = type.name
tvTab.gravity = Gravity.CENTER

View File

@ -2,20 +2,20 @@ package com.cheng.bole.ui.fragment.push.list
import androidx.collection.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.BidItemBean
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.BidItemEntity
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.cheng.bole.net.model.toListResult
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.ListViewModel
class PushListViewModel: ListViewModel<BidItemBean>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidItemBean>> {
class PushListViewModel: ListViewModel<BidItemEntity>() {
override suspend fun requestApi(params: ArrayMap<String, String>): Result<List<BidItemEntity>> {
return ApiFactory.apiService.getRecommendList(params).toListResult()
}
val authLiveData = MutableLiveData<UserAuthBean>()
val authLiveData = MutableLiveData<UserAuthEntity>()
fun checkAuth() {
launchOnUiTryCatch({

View File

@ -4,16 +4,16 @@ import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.SubscriptionBean
import com.cheng.bole.bean.SubscriptionEntity
import com.cheng.bole.manager.UserConfigManager
class SubscribeAdapter: BaseQuickAdapter<SubscriptionBean, BaseViewHolder>(R.layout.listitem_subscribe) {
class SubscribeAdapter: BaseQuickAdapter<SubscriptionEntity, BaseViewHolder>(R.layout.listitem_subscribe) {
init {
addChildClickViewIds(R.id.tv_delete, R.id.tv_edit)
}
override fun convert(holder: BaseViewHolder, item: SubscriptionBean) {
override fun convert(holder: BaseViewHolder, item: SubscriptionEntity) {
holder.setText(R.id.tv_name, item.name)
val rvKeyword = holder.getView<RecyclerView>(R.id.rv_keywords)

View File

@ -1,14 +1,14 @@
package com.cheng.bole.ui.fragment.push.subscribe
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.SubscriptionBean
import com.cheng.bole.bean.SubscriptionEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel
class SubscribeViewModel: BaseViewModel() {
val subscribeLiveData = MutableLiveData<List<SubscriptionBean>>()
val subscribeLiveData = MutableLiveData<List<SubscriptionEntity>>()
val deleteLiveData = MutableLiveData<Any>()
fun getSubscriptionList() {

View File

@ -7,10 +7,10 @@ import android.text.TextUtils
import android.view.View
import android.view.animation.RotateAnimation
import com.cheng.bole.R
import com.cheng.bole.bean.AreaBean
import com.cheng.bole.bean.HotWordBean
import com.cheng.bole.bean.SourceBean
import com.cheng.bole.bean.SubscriptionBean
import com.cheng.bole.bean.AreaEntity
import com.cheng.bole.bean.HotWordEntity
import com.cheng.bole.bean.SourceEntity
import com.cheng.bole.bean.SubscriptionEntity
import com.cheng.bole.databinding.FragmentAddSubscribeBinding
import com.cheng.bole.event.SourceDataEvent
import com.cheng.bole.event.SubscriptionEvent
@ -42,13 +42,13 @@ import okhttp3.RequestBody.Companion.toRequestBody
class AddSubscribeFragment : BaseFragment<FragmentAddSubscribeBinding, AddSubscribeViewModel>() {
private val type by lazy { arguments?.getInt("type") ?: 1 } // 1 地区 2 数据源
private var subscription: SubscriptionBean? = null
private var subscription: SubscriptionEntity? = null
private val selectedKeywordAdapter by lazy { SelectedKeywordAdapter() }
private val keywordAdapter by lazy { RecommendKeywordAdapter() }
private val selectedCity = arrayListOf<AreaBean>()
private val selectedSource = arrayListOf<SourceBean>()
private val selectedCity = arrayListOf<AreaEntity>()
private val selectedSource = arrayListOf<SourceEntity>()
private var pushType = 3 //1 短信 2 邮箱 3 app推送
@ -70,9 +70,9 @@ class AddSubscribeFragment : BaseFragment<FragmentAddSubscribeBinding, AddSubscr
override fun initData() {
super.initData()
subscription = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
arguments?.getSerializable("item", SubscriptionBean::class.java)
arguments?.getSerializable("item", SubscriptionEntity::class.java)
} else {
arguments?.getSerializable("item") as? SubscriptionBean
arguments?.getSerializable("item") as? SubscriptionEntity
}
setData()
@ -205,9 +205,9 @@ class AddSubscribeFragment : BaseFragment<FragmentAddSubscribeBinding, AddSubscr
override fun initObserve() {
super.initObserve()
mViewModel.keywordsLiveData.observe(this) {
val list = mutableListOf<HotWordBean.Child>()
val list = mutableListOf<HotWordEntity.Child>()
it.forEach { keyword ->
list.add(HotWordBean.Child(name = keyword))
list.add(HotWordEntity.Child(name = keyword))
}
keywordAdapter.setList(list)
}

View File

@ -1,7 +1,7 @@
package com.cheng.bole.ui.fragment.push.subscribe.add
import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.UserAuthBean
import com.cheng.bole.bean.UserAuthEntity
import com.cheng.bole.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
@ -57,7 +57,7 @@ class AddSubscribeViewModel : BaseViewModel() {
})
}
val authLiveData = MutableLiveData<UserAuthBean>()
val authLiveData = MutableLiveData<UserAuthEntity>()
fun checkAuth() {
launchOnUiTryCatch({

View File

@ -3,10 +3,10 @@ package com.cheng.bole.ui.fragment.push.subscribe.add
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.HotWordBean
import com.cheng.bole.bean.HotWordEntity
class RecommendKeywordAdapter: BaseQuickAdapter<HotWordBean.Child, BaseViewHolder>(R.layout.listitem_recommend_keywords) {
override fun convert(holder: BaseViewHolder, item: HotWordBean.Child) {
class RecommendKeywordAdapter: BaseQuickAdapter<HotWordEntity.Child, BaseViewHolder>(R.layout.listitem_recommend_keywords) {
override fun convert(holder: BaseViewHolder, item: HotWordEntity.Child) {
holder.setText(R.id.tv_name, item.name)
}
}

View File

@ -3,10 +3,10 @@ package com.cheng.bole.ui.fragment.push.subscribe.source
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.bole.R
import com.cheng.bole.bean.SourceBean
import com.cheng.bole.bean.SourceEntity
class RecommendSourceAdapter: BaseQuickAdapter<SourceBean, BaseViewHolder>(R.layout.listitem_recommend_source) {
override fun convert(holder: BaseViewHolder, item: SourceBean) {
class RecommendSourceAdapter: BaseQuickAdapter<SourceEntity, BaseViewHolder>(R.layout.listitem_recommend_source) {
override fun convert(holder: BaseViewHolder, item: SourceEntity) {
holder.setText(R.id.tv_name, item.name)
when(holder.layoutPosition) {
0 -> {

Some files were not shown because too many files have changed in this diff Show More