@tplc/business 0.2.56 → 0.2.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.2.57](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.55...v0.2.57) (2025-01-03)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.2.56 ([5a16720](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5a16720b5e8f56f3f79a99d97d61af22f8fc6c65))
11
+
12
+
13
+ ### ✨ Features | 新功能
14
+
15
+ * nav 如果页面俩层以上支持home ([0d9607a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0d9607aab7406ec0baeefd00b6434ba53d2ff11d))
16
+ * 修改city选择字段 ([f07078f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/f07078fe0ad2bd0f7406202ab784a2714838ac02))
17
+ * 城市回显 ([2ae514e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/2ae514e8ba68fdceacf4ef3f2db66fe733ed97fc))
18
+
5
19
  ### [0.2.56](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.53...v0.2.56) (2025-01-03)
6
20
 
7
21
 
@@ -71,7 +71,12 @@ const { getLocation, userLocation } = useLocation()
71
71
  watch(
72
72
  () => addressCity.value,
73
73
  (val) => {
74
- if (val) form.value.cityId = val?.cityId
74
+ if (val) {
75
+ form.value.cityId = val?.cityId
76
+ if (val.keywords) {
77
+ form.value.keywords = val.keywords
78
+ }
79
+ }
75
80
  },
76
81
  )
77
82
  watch(
@@ -7,18 +7,19 @@ export interface HotAddress {
7
7
 
8
8
  export interface ChildHotAddress {
9
9
  addr: string
10
- addrFlag: boolean
11
- area: string
12
- categoryName: string
10
+ addrFlag?: boolean
11
+ area?: string
12
+ categoryName?: string
13
13
  createDate?: string
14
- hotAddressId: string
14
+ hotAddressId?: string
15
15
  icon?: string
16
16
  lastModifyDate?: string
17
17
  latitude?: string
18
+ keywords?: string
18
19
  className?: string
19
20
  cityId: string
20
21
  longitude?: string
21
- weightSort: string
22
+ weightSort?: string
22
23
  addressInfo?: string
23
24
  }
24
25
  export const getHotAddress = () => uni.$lcb.http.post<HotAddress[]>('/hotAddress/categoryList', {})
@@ -26,6 +27,7 @@ export interface LcbAddress {
26
27
  addr: string
27
28
  addrFlag: boolean
28
29
  categoryName: string
30
+ keywords?: string
29
31
  cityId: string
30
32
  hotAddressId: string
31
33
  provinceCityName: string
@@ -26,7 +26,9 @@
26
26
  <view
27
27
  class="flex justify-center items-center address-tag"
28
28
  :class="{
29
- 'current-address': modelValue && modelValue.cityId === city.cityId,
29
+ 'current-address':
30
+ modelValue &&
31
+ `${modelValue.addr},${modelValue.keywords}` === `${city.addr},${city.keywords}`,
30
32
  [city.className || '']: true,
31
33
  }"
32
34
  v-for="city in item.childHotAddress"
@@ -37,7 +39,7 @@
37
39
  >
38
40
  <view class="tag-view">
39
41
  <wd-icon v-if="city.icon" :name="city.icon" class="mr-0.5" />
40
- {{ city.addr }}
42
+ {{ city.keywords ? `${city.keywords},` : '' }} {{ city.addr }}
41
43
  </view>
42
44
  </view>
43
45
  </view>
@@ -55,8 +57,8 @@
55
57
 
56
58
  <script setup lang="ts">
57
59
  import { LcbCitySelectProps } from '../../../lcb-city-select/types'
58
- import { ChildHotAddress, getHotAddress, HotAddress } from '../../api'
59
- import { computed, onMounted, ref, watch } from 'vue'
60
+ import { ChildHotAddress, getHotAddress, HotAddress, LcbAddress } from '../../api'
61
+ import { computed, inject, onMounted, Ref, ref } from 'vue'
60
62
 
61
63
  defineOptions({
62
64
  name: 'LcbCityLetter',
@@ -70,7 +72,7 @@ const props = withDefaults(defineProps<LcbCitySelectProps>(), {})
70
72
  const indexBarRef = ref<{ scrollToIndex: (index: string) => void }>()
71
73
  const addressRef = ref<HotAddress[]>([])
72
74
  const letterList = ref<string[]>([])
73
- const historyAddress = ref<ChildHotAddress[]>([])
75
+ const historyList = inject('lcb-city-history') as Ref<LcbAddress[]>
74
76
  const modelValue = defineModel<ChildHotAddress>()
75
77
  onMounted(async () => {
76
78
  const { data } = await getHotAddress()
@@ -78,7 +80,6 @@ onMounted(async () => {
78
80
  .filter((v) => !v.categoryName.includes('热门'))
79
81
  .map((item) => item.categoryName)
80
82
  addressRef.value = data
81
- historyAddress.value = JSON.parse(uni.getStorageSync('historyAddress') || '[]')
82
83
  })
83
84
  const locationAddress = computed<HotAddress[]>(() => {
84
85
  return props.location
@@ -104,25 +105,18 @@ const locationAddress = computed<HotAddress[]>(() => {
104
105
  : []
105
106
  })
106
107
 
107
- const historyList = computed<HotAddress[]>(() => {
108
- return historyAddress.value.length
108
+ const historyLetter = computed<HotAddress[]>(() => {
109
+ return historyList.value.length
109
110
  ? [
110
111
  {
111
112
  categoryName: '历史',
112
113
  hint: '历史选择',
113
- childHotAddress: historyAddress.value,
114
+ childHotAddress: historyList.value,
114
115
  },
115
116
  ]
116
117
  : []
117
118
  })
118
- watch(
119
- () => historyAddress.value,
120
- (val) => {
121
- if (val.length) {
122
- uni.setStorageSync('historyAddress', JSON.stringify(val))
123
- }
124
- },
125
- )
119
+
126
120
  const onAddrClick = (city: ChildHotAddress, letter = false) => {
127
121
  if (letter) {
128
122
  indexBarRef.value?.scrollToIndex(city.addr)
@@ -133,11 +127,14 @@ const onAddrClick = (city: ChildHotAddress, letter = false) => {
133
127
  className: '',
134
128
  }
135
129
  modelValue.value = currentCity
136
- historyAddress.value = historyAddress.value.filter((item) => item.cityId !== city.cityId)
137
- if (historyAddress.value.length === 8) {
138
- historyAddress.value = [currentCity, ...historyAddress.value.slice(0, 7)]
130
+ historyList.value = historyList.value.filter(
131
+ (historyItem) =>
132
+ `${historyItem.keywords},${historyItem.addr}` !== `${city.keywords},${city.addr}`,
133
+ )
134
+ if (historyList.value.length === 8) {
135
+ historyList.value = [currentCity as unknown as LcbAddress, ...historyList.value.slice(0, 7)]
139
136
  } else {
140
- historyAddress.value = [currentCity, ...historyAddress.value]
137
+ historyList.value = [currentCity as unknown as LcbAddress, ...historyList.value]
141
138
  }
142
139
  }
143
140
  const indexBars = computed<HotAddress[]>(() => {
@@ -154,7 +151,7 @@ const indexBars = computed<HotAddress[]>(() => {
154
151
  },
155
152
  ] as HotAddress[])
156
153
  : ([] as HotAddress[])
157
- return [...locationAddress.value, ...historyList.value, ...letters, ...addressRef.value]
154
+ return [...locationAddress.value, ...historyLetter.value, ...letters, ...addressRef.value]
158
155
  })
159
156
  </script>
160
157
  <style lang="scss" scoped>
@@ -162,7 +159,7 @@ const indexBars = computed<HotAddress[]>(() => {
162
159
 
163
160
  .address-tag {
164
161
  background: #f7f7f7;
165
- height: 62rpx;
162
+ height: 70rpx;
166
163
  padding: 0rpx 16rpx;
167
164
  box-sizing: border-box;
168
165
  border-radius: 10rpx;
@@ -1,15 +1,15 @@
1
1
  <template>
2
- <view class="p-3 box-border h-full overflow-y-auto">
2
+ <view class="p-3 box-border h-full overflow-y-auto pt-0">
3
3
  <view v-for="item in list" :key="item.cityId" @click="onItemClick(item)">
4
- <view class="flex">
4
+ <view class="flex mt-3">
5
5
  <view class="tag">{{ item.categoryName }}</view>
6
6
  <view class="content">
7
- <rich-text :nodes="getText(item.addr)" />
7
+ <rich-text :nodes="getText(item.keywords || '-')" />
8
8
  <view>{{ item.provinceCityName || item.area }}</view>
9
9
  </view>
10
10
  </view>
11
11
  </view>
12
- <view v-if="!list.length">
12
+ <view v-if="!list.length" class="mt-3">
13
13
  <view v-if="historyList.length">
14
14
  <view class="flex justify-between items-center">
15
15
  <view class="text-28rpx text-#333 font-500x">历史搜索</view>
@@ -22,8 +22,8 @@
22
22
  @click="emits('click', item)"
23
23
  class="history-tag"
24
24
  >
25
- {{ item.addr }},
26
- {{ item.area || item.provinceCityName }}
25
+ {{ item.keywords ? `${item.keywords},` : '' }}
26
+ {{ item.addr }}
27
27
  </view>
28
28
  </view>
29
29
  </view>
@@ -38,9 +38,9 @@
38
38
  </template>
39
39
 
40
40
  <script setup lang="ts">
41
+ import { inject, Ref, ref } from 'vue'
41
42
  import { LcbAddress } from '../../api'
42
43
  import { LcbCityListProps } from './types'
43
- import { ref } from 'vue'
44
44
 
45
45
  defineOptions({
46
46
  name: 'LcbCityList',
@@ -51,25 +51,23 @@ defineOptions({
51
51
  },
52
52
  })
53
53
  const emits = defineEmits(['click'])
54
- const historyList = ref<LcbAddress[]>(uni.getStorageSync('lcb_city_select_history') || [])
54
+ const historyList = inject('lcb-city-history') as Ref<LcbAddress[]>
55
55
  const props = withDefaults(defineProps<LcbCityListProps>(), {})
56
56
  const getText = (text: string) => {
57
- const str = text.replace(props.keyword, `<div class="text-light">${props.keyword}</div>`)
57
+ const str = text.replace(props.keyword, `<div class="text-primary">${props.keyword}</div>`)
58
58
  return `<div class="flex">${str}</div>`
59
59
  }
60
60
  const onItemClick = (item: LcbAddress) => {
61
- if (historyList.value.some((historyItem) => historyItem.cityId === item.cityId)) {
62
- historyList.value = historyList.value.filter(
63
- (historyItem) => historyItem.cityId !== item.cityId,
64
- )
65
- }
61
+ const addr = `${item.keywords},${item.addr}`
62
+ historyList.value = historyList.value.filter(
63
+ (historyItem) => `${historyItem.keywords},${historyItem.addr}` !== addr,
64
+ )
66
65
  historyList.value.unshift(item)
67
- uni.setStorageSync('lcb_city_select_history', historyList.value)
68
66
  emits('click', item)
69
67
  }
70
68
  const onClear = () => {
71
69
  historyList.value = []
72
- uni.removeStorageSync('lcb_city_select_history')
70
+ uni.removeStorageSync('historyAddress')
73
71
  }
74
72
  </script>
75
73
  <style lang="scss" scoped>
@@ -176,6 +176,9 @@ watchEffect(() => {
176
176
  if (addressCity.value) {
177
177
  form.cityId = addressCity.value.cityId
178
178
  form.addr = addressCity.value.addr
179
+ if (addressCity.value.keywords) {
180
+ form.keywords = addressCity.value.keywords
181
+ }
179
182
  }
180
183
  })
181
184
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.2.56",
3
+ "version": "0.2.57",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -6,18 +6,19 @@ export interface HotAddress {
6
6
  }
7
7
  export interface ChildHotAddress {
8
8
  addr: string
9
- addrFlag: boolean
10
- area: string
11
- categoryName: string
9
+ addrFlag?: boolean
10
+ area?: string
11
+ categoryName?: string
12
12
  createDate?: string
13
- hotAddressId: string
13
+ hotAddressId?: string
14
14
  icon?: string
15
15
  lastModifyDate?: string
16
16
  latitude?: string
17
+ keywords?: string
17
18
  className?: string
18
19
  cityId: string
19
20
  longitude?: string
20
- weightSort: string
21
+ weightSort?: string
21
22
  addressInfo?: string
22
23
  }
23
24
  export declare const getHotAddress: () => Promise<import('../../../action').IResData<HotAddress[]>>
@@ -25,6 +26,7 @@ export interface LcbAddress {
25
26
  addr: string
26
27
  addrFlag: boolean
27
28
  categoryName: string
29
+ keywords?: string
28
30
  cityId: string
29
31
  hotAddressId: string
30
32
  provinceCityName: string