@tplc/business 0.4.177 → 0.4.178

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,15 @@
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.4.178](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.177...v0.4.178) (2025-07-31)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * list 支持调整样式 ([37bf166](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/37bf1660d5b2acc33ab794b6b0a4aa3a6e82fbb5))
11
+ * 支持及定位 ([1f014bd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1f014bdcd2ca74fe75fdb3833263fe64a77b6d5b))
12
+ * 新增map ([aef14fd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/aef14fd48ed636fcef128a52873b87ad6637e59f))
13
+
5
14
  ### [0.4.177](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.168...v0.4.177) (2025-07-30)
6
15
 
7
16
 
@@ -36,6 +36,14 @@ export interface LcbListProps extends LcbBlockProps {
36
36
  tagSelectTextColor?: string
37
37
  tagSelectActiveBgColor?: string
38
38
  tagSelectActiveTextColor?: string
39
+
40
+ /** 地图标签 */
41
+ mapTags?: {
42
+ label: string
43
+ value: string
44
+ }[]
45
+ mapTagMode?: 'single' | 'multiple'
46
+ mapConfigParams?: Record<string, any>
39
47
  }
40
48
  export interface Option {
41
49
  label: string
@@ -9,7 +9,7 @@
9
9
  show-location
10
10
  show-compass
11
11
  show-scale
12
- :scale="14"
12
+ :scale="mapScale"
13
13
  class="w-full h-full"
14
14
  id="map"
15
15
  @regionchange="onRegionChange"
@@ -19,8 +19,26 @@
19
19
  src="./images/2.png"
20
20
  class="w-36rpx h-66rpx absolute left-0 top-0 m-auto bottom-0 right-0"
21
21
  />
22
-
23
- <view class="absolute bottom-0 left-0 p-3 box-border w-full h-fit" v-if="list[current]">
22
+ <!-- 重新定位到当前位置 -->
23
+ <view
24
+ class="absolute bottom-80 left-3 ox-border w-fit h-fit bg-white shadow-lg px-2 py-1 z-1 rounded-1 box-border text-2.5 text-center text-[var(--wot-color-theme)]"
25
+ @click="getCurrentLocation"
26
+ >
27
+ <wd-icon name="dingwei" class-prefix="lcb" />
28
+ <view class="mt-0.5 font-600">定位</view>
29
+ </view>
30
+ <view class="absolute top-3 right-2 flex flex-col gap-2">
31
+ <view
32
+ v-for="item in mapTags"
33
+ :key="item.value"
34
+ class="flex-center map-tag"
35
+ :class="{ 'map-tag-active': selectedTag.includes(item.value) }"
36
+ @click="onTagClick(item.value)"
37
+ >
38
+ {{ item.label }}
39
+ </view>
40
+ </view>
41
+ <view class="absolute bottom-0 left-0 py-3 px-4 box-border w-full h-fit" v-if="list[current]">
24
42
  <lcb-action-view v-bind="list[current].link">
25
43
  <lcb-product-item
26
44
  v-bind="{
@@ -40,17 +58,17 @@
40
58
  </lcb-action-view>
41
59
  <wd-icon
42
60
  class-prefix="lcb"
43
- size="28"
61
+ size="32"
44
62
  name="youbian"
45
- custom-class="icon right-0"
63
+ custom-class="icon right-1"
46
64
  @click="onCurrentChange(1)"
47
65
  v-if="list[current + 1]"
48
66
  />
49
67
  <wd-icon
50
68
  class-prefix="lcb"
51
- size="28"
69
+ size="32"
52
70
  name="zuobian"
53
- custom-class="icon left-0"
71
+ custom-class="icon left-1"
54
72
  @click="onCurrentChange(-1)"
55
73
  v-if="list[current - 1]"
56
74
  />
@@ -82,7 +100,9 @@ const attrs = useAttrs()
82
100
  const { proxy } = getCurrentInstance()!
83
101
  const mapContext = ref<UniApp.MapContext>()
84
102
  const { userLatLon, getLocation } = useLocation()
85
- const props = defineProps<LcbListProps & LcbListInfo>()
103
+ const props = withDefaults(defineProps<LcbListProps & LcbListInfo>(), {
104
+ mapTagMode: 'multiple',
105
+ })
86
106
  const themeColor = inject('theme-color', '#3875FF')
87
107
  const callout: MapMarker['callout'] = {
88
108
  content: '腾讯总部大楼',
@@ -96,21 +116,42 @@ const callout: MapMarker['callout'] = {
96
116
  bgColor: '#ffffff',
97
117
  color: themeColor,
98
118
  }
119
+ const selectedTag = ref<string[]>([])
99
120
  const info = reactive({
100
121
  covers: [] as MapMarker[],
101
122
  })
102
123
  const form = inject<Record<string, any>>(FORM_KEY, {})
103
124
  const current = ref(0)
104
125
  const list = ref<MapItem[]>([])
126
+ const mapScale = ref(14)
127
+ const isConfig = ref(false)
128
+
129
+ const onTagClick = (value: string) => {
130
+ if (props.mapTagMode === 'single') {
131
+ if (selectedTag.value.includes(value)) {
132
+ selectedTag.value = []
133
+ } else {
134
+ selectedTag.value = [value]
135
+ }
136
+ return
137
+ }
138
+ if (selectedTag.value.includes(value)) {
139
+ selectedTag.value = selectedTag.value.filter((item) => item !== value)
140
+ } else {
141
+ selectedTag.value = [...selectedTag.value, value]
142
+ }
143
+ }
105
144
 
106
145
  const getData = debounce(() => {
107
146
  mapContext.value?.getRegion({
108
147
  async success(res) {
109
- const { data = [] } = (await uni.$lcb.http.post('/productInfo/map', {
148
+ const { data = [] } = (await uni.$lcb.http.post('/productInfoMap/list', {
110
149
  ...props.baseParam,
111
150
  ...form?.value,
151
+ mapScale: mapScale.value,
112
152
  mapCornerLongitude: res.southwest.longitude,
113
153
  mapCornerLatitude: res.southwest.latitude,
154
+ productTypeList: selectedTag.value.length ? selectedTag.value : undefined,
114
155
  })) as {
115
156
  data: MapItem[]
116
157
  }
@@ -119,21 +160,54 @@ const getData = debounce(() => {
119
160
  },
120
161
  })
121
162
  }, 50)
163
+ watch(
164
+ () => selectedTag.value,
165
+ () => {
166
+ getData()
167
+ },
168
+ {
169
+ deep: true,
170
+ },
171
+ )
172
+
173
+ const getConfig = async () => {
174
+ isConfig.value = true
175
+ const {
176
+ data: { mapLatitude, mapLongitude, mapScale: scale },
177
+ } = await uni.$lcb.http.post<{
178
+ mapLatitude: number
179
+ mapLongitude: number
180
+ mapScale: number
181
+ }>('/productInfoMap/config', {
182
+ ...props.baseParam,
183
+ ...form?.value,
184
+ ...props.mapConfigParams,
185
+ })
186
+ form.value.userLatitude = mapLatitude
187
+ form.value.userLongitude = mapLongitude
188
+ mapScale.value = scale
189
+ }
122
190
 
123
191
  watch(
124
192
  () => userLatLon.value,
125
- (val) => {
126
- if (!val) return
193
+ async (val, old) => {
194
+ if (!val || JSON.stringify(val) === JSON.stringify(old)) return
127
195
  form.value.mapLatitude = val.latitude
128
196
  form.value.mapLongitude = val.longitude
129
197
  form.value.userLongitude = val.longitude
130
198
  form.value.userLatitude = val.latitude
199
+ if (!isConfig.value) {
200
+ getConfig()
201
+ }
131
202
  },
132
203
  {
133
204
  immediate: true,
134
205
  deep: true,
135
206
  },
136
207
  )
208
+ const getCurrentLocation = async () => {
209
+ getLocation(true)
210
+ }
137
211
  getLocation()
138
212
  const onRegionChange = (e: {
139
213
  type: string
@@ -148,6 +222,7 @@ const onRegionChange = (e: {
148
222
  if (e.type === 'end') {
149
223
  form.value.mapLatitude = e.detail.centerLocation.latitude
150
224
  form.value.mapLongitude = e.detail.centerLocation.longitude
225
+ mapScale.value = e.detail.scale
151
226
  }
152
227
  }
153
228
  const onCurrentChange = (p: number) => {
@@ -211,7 +286,7 @@ onMounted(() => {
211
286
  getData()
212
287
  })
213
288
  </script>
214
- <style lang="scss">
289
+ <style lang="scss" scoped>
215
290
  .icon {
216
291
  position: absolute;
217
292
  top: 0;
@@ -220,4 +295,19 @@ onMounted(() => {
220
295
  margin: auto;
221
296
  color: #666;
222
297
  }
298
+ .map-tag {
299
+ width: 140rpx;
300
+ text-align: center;
301
+ box-sizing: border-box;
302
+ border-radius: 30rpx;
303
+ padding: 12rpx 12rpx;
304
+ background-color: #fff;
305
+ box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.1);
306
+ font-size: 28rpx;
307
+ &.map-tag-active {
308
+ font-weight: 600;
309
+ background-color: var(--wot-color-theme);
310
+ color: #fff;
311
+ }
312
+ }
223
313
  </style>
@@ -1,5 +1,3 @@
1
- import { LcbActionViewProps } from '../lcb-action-view/types'
2
-
3
1
  export interface MapMarker {
4
2
  id: number
5
3
  name?: string
@@ -35,5 +33,5 @@ export interface MapItem {
35
33
  productName: string
36
34
  longitude: number
37
35
  productId: string
38
- link: LcbActionViewProps
36
+ link: any
39
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.177",
3
+ "version": "0.4.178",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -89,6 +89,12 @@ declare const __VLS_component: import('vue').DefineComponent<
89
89
  wrapperBgColor: string
90
90
  wrapperTextColor: string
91
91
  hiddenBoxShadow: boolean
92
+ mapTags: {
93
+ label: string
94
+ value: string
95
+ }[]
96
+ mapTagMode: 'single' | 'multiple'
97
+ mapConfigParams: Record<string, any>
92
98
  },
93
99
  {}
94
100
  >
@@ -34,6 +34,13 @@ export interface LcbListProps extends LcbBlockProps {
34
34
  tagSelectTextColor?: string
35
35
  tagSelectActiveBgColor?: string
36
36
  tagSelectActiveTextColor?: string
37
+ /** 地图标签 */
38
+ mapTags?: {
39
+ label: string
40
+ value: string
41
+ }[]
42
+ mapTagMode?: 'single' | 'multiple'
43
+ mapConfigParams?: Record<string, any>
37
44
  }
38
45
  export interface Option {
39
46
  label: string
@@ -1,7 +1,12 @@
1
1
  import { LcbListProps } from '@tplc/business/components/lcb-list/types'
2
2
  import { LcbListInfo } from '@tplc/business/components/lcb-list/api'
3
3
  declare const _default: import('vue').DefineComponent<
4
- __VLS_TypePropsToOption<LcbListProps & LcbListInfo>,
4
+ __VLS_WithDefaults<
5
+ __VLS_TypePropsToOption<LcbListProps & LcbListInfo>,
6
+ {
7
+ mapTagMode: string
8
+ }
9
+ >,
5
10
  {},
6
11
  unknown,
7
12
  {},
@@ -11,11 +16,34 @@ declare const _default: import('vue').DefineComponent<
11
16
  {},
12
17
  string,
13
18
  import('vue').PublicProps,
14
- Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<LcbListProps & LcbListInfo>>>,
15
- {},
19
+ Readonly<
20
+ import('vue').ExtractPropTypes<
21
+ __VLS_WithDefaults<
22
+ __VLS_TypePropsToOption<LcbListProps & LcbListInfo>,
23
+ {
24
+ mapTagMode: string
25
+ }
26
+ >
27
+ >
28
+ >,
29
+ {
30
+ mapTagMode: 'single' | 'multiple'
31
+ },
16
32
  {}
17
33
  >
18
34
  export default _default
35
+ type __VLS_WithDefaults<P, D> = {
36
+ [K in keyof Pick<P, keyof P>]: K extends keyof D
37
+ ? __VLS_Prettify<
38
+ P[K] & {
39
+ default: D[K]
40
+ }
41
+ >
42
+ : P[K]
43
+ }
44
+ type __VLS_Prettify<T> = {
45
+ [K in keyof T]: T[K]
46
+ } & {}
19
47
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
20
48
  type __VLS_TypePropsToOption<T> = {
21
49
  [K in keyof T]-?: {} extends Pick<T, K>
@@ -1,4 +1,3 @@
1
- import { LcbActionViewProps } from '../lcb-action-view/types'
2
1
  export interface MapMarker {
3
2
  id: number
4
3
  name?: string
@@ -33,5 +32,5 @@ export interface MapItem {
33
32
  productName: string
34
33
  longitude: number
35
34
  productId: string
36
- link: LcbActionViewProps
35
+ link: any
37
36
  }
@@ -180,10 +180,10 @@ declare const _default: import('vue').DefineComponent<
180
180
  width: string | number
181
181
  height: string | number
182
182
  showScrollbar: boolean
183
- columnCount: string | number
184
- columnGap: string | number
185
183
  idKey: string
186
184
  addTime: number
185
+ columnCount: string | number
186
+ columnGap: string | number
187
187
  leftGap: string | number
188
188
  rightGap: string | number
189
189
  },