feat: opt ui

This commit is contained in:
2026-03-18 20:54:13 +08:00
parent c2b5e74156
commit aac2c860c6
8 changed files with 43 additions and 22 deletions

View File

@@ -20,7 +20,8 @@ class HbQueryListViewModel : BasePageViewModel() {
val date = MutableLiveData(DateUtils.getCurrentTime().formatDate())
val fNo = MutableLiveData("")
val range = MutableLiveData("")
val dep = MutableLiveData("") // 始发站
val dest = MutableLiveData("") // 目的站
val addressType = MutableLiveData("")
val serviceType = MutableLiveData("")
@@ -59,7 +60,7 @@ class HbQueryListViewModel : BasePageViewModel() {
"limit" to pageModel.limit,
"fdate" to date.value,
"fno" to fNo.value,
"range" to range.value,
"range" to buildRange(),
"countryType" to addressType.value,
"serviceType" to serviceType.value,
).toRequestBody()
@@ -72,6 +73,13 @@ class HbQueryListViewModel : BasePageViewModel() {
}
}
private fun buildRange(): String? {
val d = dep.value?.trim()
val a = dest.value?.trim()
if (d.isNullOrEmpty() && a.isNullOrEmpty()) return null
return "${d ?: ""}-${a ?: ""}"
}
override fun onItemClick(position: Int, type: Int) {
val bean = pageModel.rv!!.commonAdapter()!!.getItem(position) as FlightBean
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_FLIGHT_QUERY_DETAILS)

View File

@@ -46,13 +46,29 @@
android:layout_weight="1" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请输入航程"}'
hint='@{"始发站"}'
setTextAllCaps="@{true}"
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.range}"
value="@={viewModel.dep}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_weight="0.6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textSize="16sp" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"目的站"}'
setTextAllCaps="@{true}"
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.dest}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请选择地区类型"}'
@@ -127,7 +143,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{"合计:"+viewModel.count+"条"}'
android:text='@{"合计"+viewModel.count+"条"}'
android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp"
android:textStyle="bold"