@tplc/business 0.0.48 → 0.0.50

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/action.d.ts +7 -2
  3. package/api/user.ts +6 -0
  4. package/components/lcb-action-view/types.ts +2 -2
  5. package/components/lcb-block/types.ts +1 -0
  6. package/components/lcb-button/lcb-button.vue +32 -0
  7. package/components/lcb-button/types.ts +8 -0
  8. package/components/lcb-city-select/components/lcb-city-letter/index.vue +1 -1
  9. package/components/lcb-city-select/components/lcb-city-list/index.vue +1 -1
  10. package/components/lcb-city-select/components/lcb-city-list/types.ts +1 -1
  11. package/components/lcb-dynamic-data/lcb-dynamic-data.vue +10 -3
  12. package/components/lcb-image/Image/index.vue +15 -25
  13. package/components/lcb-list/components/FilterList/index.vue +9 -4
  14. package/components/lcb-list/components/FilterList/mockData.ts +575 -0
  15. package/components/lcb-list/hooks/useSelect.ts +2 -0
  16. package/components/lcb-list/lcb-list.vue +32 -17
  17. package/components/lcb-list/types.ts +0 -13
  18. package/components/lcb-nav/lcb-nav.vue +1 -1
  19. package/components/lcb-notice/api/index.ts +21 -0
  20. package/components/lcb-notice/lcb-notice.vue +66 -50
  21. package/components/lcb-notice/types.ts +11 -26
  22. package/components/lcb-product/lcb-product.vue +37 -33
  23. package/components/lcb-product-item/components/ItemValue.vue +103 -22
  24. package/components/lcb-product-item/lcb-product-item.vue +249 -70
  25. package/components/lcb-product-item/types.ts +15 -14
  26. package/components/lcb-text/lcb-text.vue +20 -0
  27. package/components/lcb-text/types.ts +5 -0
  28. package/components/lcb-user-top/Nums/index.vue +19 -10
  29. package/components/lcb-user-top/lcb-user-top.vue +51 -43
  30. package/constants.ts +2 -0
  31. package/global.d.ts +2 -0
  32. package/hooks/useUpload.ts +3 -6
  33. package/index.ts +1 -1
  34. package/package.json +2 -2
  35. package/tsconfig.json +24 -0
  36. package/types/api/user.d.ts +6 -0
  37. package/types/components/lcb-action-view/types.d.ts +2 -2
  38. package/types/components/lcb-block/types.d.ts +1 -0
  39. package/types/components/{lcb-notice/Item/index.vue.d.ts → lcb-button/lcb-button.vue.d.ts} +4 -18
  40. package/types/components/lcb-button/types.d.ts +7 -0
  41. package/types/components/lcb-city-select/components/lcb-city-letter/index.vue.d.ts +1 -1
  42. package/types/components/lcb-city-select/components/lcb-city-list/types.d.ts +1 -1
  43. package/types/components/lcb-list/components/FilterList/mockData.d.ts +63 -0
  44. package/types/components/lcb-list/lcb-list.vue.d.ts +7 -3
  45. package/types/components/lcb-list/types.d.ts +0 -1
  46. package/types/components/lcb-notice/api/index.d.ts +19 -0
  47. package/types/components/lcb-notice/lcb-notice.vue.d.ts +25 -19
  48. package/types/components/lcb-notice/types.d.ts +11 -24
  49. package/types/components/lcb-product/lcb-product.vue.d.ts +2 -22
  50. package/types/components/lcb-product-item/components/ItemValue.vue.d.ts +26 -8
  51. package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +63 -23
  52. package/types/components/lcb-product-item/types.d.ts +14 -13
  53. package/types/components/lcb-text/lcb-text.vue.d.ts +42 -0
  54. package/types/components/lcb-text/types.d.ts +4 -0
  55. package/types/constants.d.ts +2 -0
  56. package/types/hooks/useUpload.d.ts +1 -3
  57. package/types/utils/auth.d.ts +2 -0
  58. package/types/utils/utils.d.ts +2 -0
  59. package/utils/auth.ts +19 -0
  60. package/utils/utils.ts +6 -1
  61. package/components/lcb-notice/Item/index.vue +0 -112
  62. package/components/lcb-user-top/api/index.ts +0 -13
  63. package/types/components/lcb-user-top/api/index.d.ts +0 -10
@@ -1,8 +1,10 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, provide, useAttrs } from 'vue'
3
- import { lcbProductItemContentTypes, LcbProductItemProps } from './types'
3
+ import { LcbProductItemProps } from './types'
4
4
  import ItemValue from './components/ItemValue.vue'
5
5
 
6
+ const isNumber = (value: any) => typeof value === 'number'
7
+
6
8
  defineOptions({
7
9
  name: 'LcbProductItem',
8
10
  options: {
@@ -14,36 +16,54 @@ defineOptions({
14
16
 
15
17
  const props = withDefaults(defineProps<LcbProductItemProps>(), {
16
18
  layoutType: 'horizontal',
19
+ titleLineClamp: 1,
20
+ tagOverflowWrap: false,
21
+ tagType: 'primary',
22
+ tagPlain: true,
23
+ tagMark: false,
24
+ tagRound: false,
25
+ distanceUnit: 'km',
26
+
17
27
  priceUnit: '¥',
18
28
  originPriceUnit: '¥',
19
29
  imageVisible: true,
20
30
  titleVisible: true,
21
- subTitleVisible: true,
31
+ subTitleVisible: false,
22
32
  priceVisible: true,
23
33
  priceUnitVisible: true,
24
34
  priceSuffixVisible: true,
25
35
  originPriceVisible: true,
26
36
  originPriceUnitVisible: true,
37
+ originPriceSuffixVisible: true,
27
38
  tagsVisible: true,
28
39
  locationVisible: true,
29
- distanceVisible: true,
40
+ distanceVisible: false,
30
41
  })
31
42
  const attrs = useAttrs()
32
43
 
33
44
  provide('lcb-product-item-props', props)
34
45
 
35
46
  defineSlots<{
36
- image(): any
37
- title(): any
38
- subTitle(): any
39
- price(): any
40
- priceUnit(): any
41
- priceSuffix(): any
42
- originPrice(): any
43
- originPriceUnit(): any
44
- tags(): any
45
- location(): any
46
- distance(): any
47
+ image(props: { value: any }): any
48
+ title(props: { value: any }): any
49
+ subTitle(props: { value: any }): any
50
+ price(props: { value: any }): any
51
+ priceUnit(props: { value: any }): any
52
+ priceSuffix(props: { value: any }): any
53
+ originPrice(props: { value: any }): any
54
+ originPriceUnit(props: { value: any }): any
55
+ originPriceSuffix(props: { value: any }): any
56
+ tags(props: { value: any }): any
57
+ location(props: { value: any }): any
58
+ distance(props: { value: any }): any
59
+
60
+ itemSection(): any
61
+ itemTopSection(): any
62
+ itemBottomSection(): any
63
+ itemLeftSection(): any
64
+ itemRightSection(): any
65
+ imageSection(): any
66
+ contentSection(): any
47
67
  }>()
48
68
 
49
69
  // console.log('attrs', attrs)
@@ -51,87 +71,246 @@ defineSlots<{
51
71
 
52
72
  <template>
53
73
  <!-- 横向布局 -->
54
- <view v-if="layoutType === 'horizontal'" :class="className" class="flex gap-3 px-2 py-3 bg-white">
55
- <ItemValue prop="image" className="w-1/3 h-220rpx bg-gray-100 rounded-sm overflow-hidden">
56
- <template
57
- v-for="slotName in lcbProductItemContentTypes"
58
- :key="slotName"
59
- #[slotName]="slotContext"
74
+ <view
75
+ v-if="layoutType === 'horizontal'"
76
+ :class="className"
77
+ class="flex flex-col gap-1 px-2 py-3 bg-white relative"
78
+ >
79
+ <slot name="itemSection" />
80
+ <slot name="itemTopSection" />
81
+ <view class="flex gap-2">
82
+ <slot name="itemLeftSection" />
83
+ <ItemValue
84
+ v-if="!!$slots?.['image']"
85
+ prop="image"
86
+ className="w-1/3 h-220rpx bg-gray-100 rounded-sm overflow-hidden relative"
60
87
  >
61
- <slot :name="slotName" v-bind="slotContext" />
62
- </template>
63
- </ItemValue>
64
- <view class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden">
65
- <view class="flex flex-col gap-2 overflow-hidden">
66
- <ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop">
88
+ <template #default>
89
+ <slot name="imageSection" />
90
+ </template>
91
+ <template #image="{ value }">
92
+ <slot name="image" :value="value" />
93
+ </template>
94
+ </ItemValue>
95
+ <ItemValue
96
+ v-else
97
+ prop="image"
98
+ className="w-1/3 h-220rpx bg-gray-100 rounded-sm overflow-hidden relative"
99
+ >
100
+ <template #default>
101
+ <slot name="imageSection" />
102
+ </template>
103
+ </ItemValue>
104
+ <view class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden relative">
105
+ <slot name="contentSection" />
106
+ <view class="flex flex-col gap-2 overflow-hidden">
67
107
  <template
68
- v-for="slotName in lcbProductItemContentTypes"
69
- :key="slotName"
70
- #[slotName]="slotContext"
108
+ v-for="propName in ['title', 'subTitle', 'location', 'distance', 'tags']"
109
+ :key="propName"
71
110
  >
72
- <slot :name="slotName" v-bind="slotContext" />
111
+ <ItemValue :prop="propName" v-if="!!$slots?.[propName]">
112
+ <template #image="{ value }"><slot name="image" :value="value" /></template>
113
+ <template #title="{ value }"><slot name="title" :value="value" /></template>
114
+ <template #subTitle="{ value }"><slot name="subTitle" :value="value" /></template>
115
+ <template #price="{ value }"><slot name="price" :value="value" /></template>
116
+ <template #priceUnit="{ value }"><slot name="priceUnit" :value="value" /></template>
117
+ <template #priceSuffix="{ value }">
118
+ <slot name="priceSuffix" :value="value" />
119
+ </template>
120
+ <template #originPrice="{ value }">
121
+ <slot name="originPrice" :value="value" />
122
+ </template>
123
+ <template #originPriceUnit="{ value }">
124
+ <slot name="originPriceUnit" :value="value" />
125
+ </template>
126
+ <template #tags="{ value }"><slot name="tags" :value="value" /></template>
127
+ <template #location="{ value }"><slot name="location" :value="value" /></template>
128
+ <template #distance="{ value }"><slot name="distance" :value="value" /></template>
129
+ </ItemValue>
130
+ <ItemValue :prop="propName" v-else />
73
131
  </template>
74
- </ItemValue>
75
- </view>
132
+ </view>
76
133
 
77
- <view class="flex gap-2">
78
- <view class="flex gap-[4rpx] items-end">
79
- <ItemValue v-for="prop in ['priceUnit', 'price', 'priceSuffix']" :prop="prop" :key="prop">
134
+ <view class="flex gap-2">
135
+ <view class="flex gap-[4rpx] items-end" v-if="priceVisible && isNumber(price)">
136
+ <template v-for="propName in ['priceUnit', 'price', 'priceSuffix']" :key="propName">
137
+ <ItemValue :prop="propName" v-if="!!$slots?.[propName]">
138
+ <template #image="{ value }"><slot name="image" :value="value" /></template>
139
+ <template #title="{ value }"><slot name="title" :value="value" /></template>
140
+ <template #subTitle="{ value }"><slot name="subTitle" :value="value" /></template>
141
+ <template #price="{ value }"><slot name="price" :value="value" /></template>
142
+ <template #priceUnit="{ value }"><slot name="priceUnit" :value="value" /></template>
143
+ <template #priceSuffix="{ value }">
144
+ <slot name="priceSuffix" :value="value" />
145
+ </template>
146
+ <template #originPrice="{ value }">
147
+ <slot name="originPrice" :value="value" />
148
+ </template>
149
+ <template #originPriceUnit="{ value }">
150
+ <slot name="originPriceUnit" :value="value" />
151
+ </template>
152
+ <template #tags="{ value }"><slot name="tags" :value="value" /></template>
153
+ <template #location="{ value }"><slot name="location" :value="value" /></template>
154
+ <template #distance="{ value }"><slot name="distance" :value="value" /></template>
155
+ </ItemValue>
156
+ <ItemValue :prop="propName" v-else />
157
+ </template>
158
+ </view>
159
+ <view
160
+ class="flex gap-[2rpx] items-end line-through"
161
+ v-if="originPriceVisible && isNumber(originPrice)"
162
+ >
80
163
  <template
81
- v-for="slotName in lcbProductItemContentTypes"
82
- :key="slotName"
83
- #[slotName]="slotContext"
164
+ v-for="propName in ['originPriceUnit', 'originPrice', 'originPriceSuffix']"
165
+ :key="propName"
84
166
  >
85
- <slot :name="slotName" v-bind="slotContext" />
167
+ <ItemValue :prop="propName" v-if="!!$slots?.[propName]">
168
+ <template #image="{ value }"><slot name="image" :value="value" /></template>
169
+ <template #title="{ value }"><slot name="title" :value="value" /></template>
170
+ <template #subTitle="{ value }"><slot name="subTitle" :value="value" /></template>
171
+ <template #price="{ value }"><slot name="price" :value="value" /></template>
172
+ <template #priceUnit="{ value }"><slot name="priceUnit" :value="value" /></template>
173
+ <template #priceSuffix="{ value }">
174
+ <slot name="priceSuffix" :value="value" />
175
+ </template>
176
+ <template #originPrice="{ value }">
177
+ <slot name="originPrice" :value="value" />
178
+ </template>
179
+ <template #originPriceUnit="{ value }">
180
+ <slot name="originPriceUnit" :value="value" />
181
+ </template>
182
+ <template #originPriceSuffix="{ value }">
183
+ <slot name="originPriceSuffix" :value="value" />
184
+ </template>
185
+ <template #tags="{ value }"><slot name="tags" :value="value" /></template>
186
+ <template #location="{ value }"><slot name="location" :value="value" /></template>
187
+ <template #distance="{ value }"><slot name="distance" :value="value" /></template>
188
+ </ItemValue>
189
+ <ItemValue :prop="propName" v-else />
86
190
  </template>
87
- </ItemValue>
191
+ </view>
88
192
  </view>
89
193
  </view>
194
+ <slot name="itemRightSection" />
90
195
  </view>
196
+ <slot name="itemBottomSection" />
91
197
  </view>
92
198
 
93
199
  <!-- 竖向布局 -->
94
- <view v-if="layoutType === 'vertical'" :class="className" class="flex flex-col gap-2 bg-white">
95
- <ItemValue prop="image" className="overflow-hidden">
96
- <template
97
- v-for="slotName in lcbProductItemContentTypes"
98
- :key="slotName"
99
- #[slotName]="slotContext"
200
+ <view v-if="layoutType === 'vertical'" class="flex bg-white relative" :class="className">
201
+ <slot name="itemSection" />
202
+ <slot name="itemLeftSection" />
203
+ <view class="flex-1 flex flex-col w-full overflow-hidden">
204
+ <slot name="itemTopSection" />
205
+ <ItemValue v-if="!!$slots?.['image']" prop="image" className="overflow-hidden relative">
206
+ <template #default>
207
+ <slot name="imageSection" />
208
+ </template>
209
+ <template #image="{ value }">
210
+ <slot name="image" :value="value" />
211
+ </template>
212
+ </ItemValue>
213
+ <ItemValue v-else prop="image" className="overflow-hidden relative">
214
+ <template #default>
215
+ <slot name="imageSection" />
216
+ </template>
217
+ </ItemValue>
218
+ <view
219
+ :class="'p-2'"
220
+ class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden relative"
100
221
  >
101
- <slot :name="slotName" v-bind="slotContext" />
102
- </template>
103
- </ItemValue>
104
- <view
105
- :class="'p-2'"
106
- class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden"
107
- >
108
- <view class="flex flex-col gap-2 overflow-hidden">
109
- <!-- <ItemValue prop="title"></ItemValue> -->
110
- <ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop">
222
+ <slot name="contentSection" />
223
+ <view class="flex flex-col gap-2 overflow-hidden">
111
224
  <template
112
- v-for="slotName in lcbProductItemContentTypes"
113
- :key="slotName"
114
- #[slotName]="slotContext"
225
+ v-for="propName in ['title', 'subTitle', 'location', 'distance', 'tags']"
226
+ :key="propName"
115
227
  >
116
- <slot :name="slotName" v-bind="slotContext" />
228
+ <ItemValue :prop="propName" v-if="!!$slots?.[propName]">
229
+ <template #image="{ value }"><slot name="image" :value="value" /></template>
230
+ <template #title="{ value }"><slot name="title" :value="value" /></template>
231
+ <template #subTitle="{ value }"><slot name="subTitle" :value="value" /></template>
232
+ <template #price="{ value }"><slot name="price" :value="value" /></template>
233
+ <template #priceUnit="{ value }"><slot name="priceUnit" :value="value" /></template>
234
+ <template #priceSuffix="{ value }">
235
+ <slot name="priceSuffix" :value="value" />
236
+ </template>
237
+ <template #originPrice="{ value }">
238
+ <slot name="originPrice" :value="value" />
239
+ </template>
240
+ <template #originPriceUnit="{ value }">
241
+ <slot name="originPriceUnit" :value="value" />
242
+ </template>
243
+ <template #tags="{ value }"><slot name="tags" :value="value" /></template>
244
+ <template #location="{ value }"><slot name="location" :value="value" /></template>
245
+ <template #distance="{ value }"><slot name="distance" :value="value" /></template>
246
+ </ItemValue>
247
+ <ItemValue :prop="propName" v-else />
117
248
  </template>
118
- </ItemValue>
119
- </view>
249
+ </view>
120
250
 
121
- <view class="flex gap-2">
122
- <view class="flex gap-[4rpx] items-end">
123
- <ItemValue v-for="prop in ['priceUnit', 'price', 'priceSuffix']" :prop="prop" :key="prop">
251
+ <view class="flex gap-2">
252
+ <view class="flex gap-[4rpx] items-end" v-if="priceVisible && isNumber(price)">
253
+ <template v-for="propName in ['priceUnit', 'price', 'priceSuffix']" :key="propName">
254
+ <ItemValue :prop="propName" v-if="!!$slots?.[propName]">
255
+ <template #image="{ value }"><slot name="image" :value="value" /></template>
256
+ <template #title="{ value }"><slot name="title" :value="value" /></template>
257
+ <template #subTitle="{ value }"><slot name="subTitle" :value="value" /></template>
258
+ <template #price="{ value }"><slot name="price" :value="value" /></template>
259
+ <template #priceUnit="{ value }"><slot name="priceUnit" :value="value" /></template>
260
+ <template #priceSuffix="{ value }">
261
+ <slot name="priceSuffix" :value="value" />
262
+ </template>
263
+ <template #originPrice="{ value }">
264
+ <slot name="originPrice" :value="value" />
265
+ </template>
266
+ <template #originPriceUnit="{ value }">
267
+ <slot name="originPriceUnit" :value="value" />
268
+ </template>
269
+ <template #tags="{ value }"><slot name="tags" :value="value" /></template>
270
+ <template #location="{ value }"><slot name="location" :value="value" /></template>
271
+ <template #distance="{ value }"><slot name="distance" :value="value" /></template>
272
+ </ItemValue>
273
+ <ItemValue :prop="propName" v-else />
274
+ </template>
275
+ </view>
276
+ <view
277
+ class="flex gap-[2rpx] items-end line-through"
278
+ v-if="originPriceVisible && isNumber(originPrice)"
279
+ >
124
280
  <template
125
- v-for="slotName in lcbProductItemContentTypes"
126
- :key="slotName"
127
- #[slotName]="slotContext"
281
+ v-for="propName in ['originPriceUnit', 'originPrice', 'originPriceSuffix']"
282
+ :key="propName"
128
283
  >
129
- <slot :name="slotName" v-bind="slotContext" />
284
+ <ItemValue :prop="propName" v-if="!!$slots?.[propName]">
285
+ <template #image="{ value }"><slot name="image" :value="value" /></template>
286
+ <template #title="{ value }"><slot name="title" :value="value" /></template>
287
+ <template #subTitle="{ value }"><slot name="subTitle" :value="value" /></template>
288
+ <template #price="{ value }"><slot name="price" :value="value" /></template>
289
+ <template #priceUnit="{ value }"><slot name="priceUnit" :value="value" /></template>
290
+ <template #priceSuffix="{ value }">
291
+ <slot name="priceSuffix" :value="value" />
292
+ </template>
293
+ <template #originPrice="{ value }">
294
+ <slot name="originPrice" :value="value" />
295
+ </template>
296
+ <template #originPriceUnit="{ value }">
297
+ <slot name="originPriceUnit" :value="value" />
298
+ </template>
299
+ <template #originPriceSuffix="{ value }">
300
+ <slot name="originPriceSuffix" :value="value" />
301
+ </template>
302
+ <template #tags="{ value }"><slot name="tags" :value="value" /></template>
303
+ <template #location="{ value }"><slot name="location" :value="value" /></template>
304
+ <template #distance="{ value }"><slot name="distance" :value="value" /></template>
305
+ </ItemValue>
306
+ <ItemValue :prop="propName" v-else />
130
307
  </template>
131
- </ItemValue>
308
+ </view>
132
309
  </view>
133
310
  </view>
311
+ <slot name="itemBottomSection" />
134
312
  </view>
313
+ <slot name="itemRightSection" />
135
314
  </view>
136
315
  </template>
137
316
 
@@ -1,23 +1,20 @@
1
1
  import { CSSProperties } from 'vue'
2
-
3
- export const lcbProductItemContentTypes = [
4
- 'image',
5
- 'title',
6
- 'subTitle',
7
- 'price',
8
- 'priceUnit',
9
- 'priceSuffix',
10
- 'originPrice',
11
- 'originPriceUnit',
12
- 'tags',
13
- 'location',
14
- 'distance',
15
- ] as const
2
+ import { TagType } from '@tplc/wot/components/wd-tag/types'
16
3
 
17
4
  export interface LcbProductItemProps {
18
5
  // Define the component's prop types here
19
6
  className?: string
20
7
  layoutType?: 'vertical' | 'horizontal'
8
+ titleLineClamp?: number
9
+ tagOverflowWrap?: boolean
10
+ tagType?: TagType
11
+ tagContentColor?: string
12
+ tagBgColor?: string
13
+ tagPlain?: boolean
14
+ tagMark?: boolean
15
+ tagRound?: boolean
16
+ distanceUnit?: string
17
+
21
18
  image?: any
22
19
  title?: any
23
20
  subTitle?: any
@@ -26,6 +23,7 @@ export interface LcbProductItemProps {
26
23
  priceSuffix?: any
27
24
  originPrice?: any
28
25
  originPriceUnit?: any
26
+ originPriceSuffix?: any
29
27
  tags?: any
30
28
  location?: any
31
29
  distance?: any
@@ -38,6 +36,7 @@ export interface LcbProductItemProps {
38
36
  priceSuffixVisible?: boolean
39
37
  originPriceVisible?: boolean
40
38
  originPriceUnitVisible?: boolean
39
+ originPriceSuffixVisible?: boolean
41
40
  tagsVisible?: boolean
42
41
  locationVisible?: boolean
43
42
  distanceVisible?: boolean
@@ -50,6 +49,7 @@ export interface LcbProductItemProps {
50
49
  priceSuffixClass?: string
51
50
  originPriceClass?: string
52
51
  originPriceUnitClass?: string
52
+ originPriceSuffixClass?: string
53
53
  tagsClass?: string
54
54
  tagsWrapperClass?: string
55
55
  locationClass?: string
@@ -63,6 +63,7 @@ export interface LcbProductItemProps {
63
63
  priceSuffixStyle?: CSSProperties
64
64
  originPriceStyle?: CSSProperties
65
65
  originPriceUnitStyle?: CSSProperties
66
+ originPriceSuffixStyle?: CSSProperties
66
67
  tagsStyle?: CSSProperties
67
68
  tagsWrapperStyle?: CSSProperties
68
69
  locationStyle?: CSSProperties
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <lcb-block>
3
+ {{ text }}
4
+ </lcb-block>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { LcbTextProps } from './types'
9
+ defineOptions({
10
+ name: 'LcbText',
11
+ options: {
12
+ addGlobalClass: true,
13
+ virtualHost: true,
14
+ styleIsolation: 'shared',
15
+ },
16
+ })
17
+ withDefaults(defineProps<LcbTextProps>(), {})
18
+ </script>
19
+
20
+ <style lang="scss" scoped></style>
@@ -0,0 +1,5 @@
1
+ import { LcbBlockProps } from '../lcb-block/types'
2
+
3
+ export interface LcbTextProps extends LcbBlockProps {
4
+ text: string
5
+ }
@@ -1,13 +1,23 @@
1
1
  <template>
2
2
  <View class="">
3
- <view class="font-bold leading-none" :style="{
4
- fontSize: transformValueUnit(numsSize),
5
- color: numsColor,
6
- }">0</view>
7
- <view class="mt-15rpx" :style="{
8
- fontSize: transformValueUnit(titleSize),
9
- color: titleColor,
10
- }">{{ title }}</view>
3
+ <view
4
+ class="font-bold leading-none"
5
+ :style="{
6
+ fontSize: transformValueUnit(numsSize),
7
+ color: numsColor,
8
+ }"
9
+ >
10
+ 0
11
+ </view>
12
+ <view
13
+ class="mt-15rpx"
14
+ :style="{
15
+ fontSize: transformValueUnit(titleSize),
16
+ color: titleColor,
17
+ }"
18
+ >
19
+ {{ title }}
20
+ </view>
11
21
  </View>
12
22
  </template>
13
23
 
@@ -16,5 +26,4 @@ import { NumsItemProps } from '../types'
16
26
  import { transformValueUnit } from '../../../utils/transform'
17
27
 
18
28
  defineProps<NumsItemProps>()
19
-
20
- </script>
29
+ </script>
@@ -13,29 +13,23 @@
13
13
  }"
14
14
  />
15
15
  <view class="flex flex-items-center">
16
- <wd-img
17
- v-if="photoUrl"
18
- v-bind="{
19
- width: transformValueUnit(photoSize),
20
- height: transformValueUnit(photoSize),
21
- round: photoRound,
22
- src: photoUrl,
23
- }"
24
- class="mr-20rpx"
25
- />
26
- <view
27
- v-if="!photoUrl"
28
- :style="{
29
- width: transformValueUnit(photoSize),
30
- height: transformValueUnit(photoSize),
31
- borderRadius: photoRound ? '50%' : '',
32
- }"
33
- class="bg-#eee userPlace mr-40rpx"
34
- />
16
+ <lcb-action-view :jump-type="101" @avatar="onAvatar">
17
+ <wd-img
18
+ v-bind="{
19
+ width: transformValueUnit(photoSize),
20
+ height: transformValueUnit(photoSize),
21
+ round: photoRound,
22
+ src:
23
+ userStore?.userInfo?.headImgUrl ||
24
+ 'https://lycs.eluying.com/material/icon/1/20240925185540/userPhoto.jpg',
25
+ }"
26
+ custom-class="mr-40rpx bg-#eee"
27
+ />
28
+ </lcb-action-view>
35
29
  <view class="flex-1">
36
- <lcb-action-view :jumpType="88" @phone="getPhone">
30
+ <lcb-action-view :jumpType="88" @phone="phoneHandler" v-if="!userStore?.userInfo?.phone">
37
31
  <view
38
- class="font-bold"
32
+ class="font-500"
39
33
  :style="{
40
34
  fontSize: transformValueUnit(textSize),
41
35
  color: textColor,
@@ -44,19 +38,24 @@
44
38
  授权登录
45
39
  </view>
46
40
  </lcb-action-view>
47
- <view class="flex" v-if="editBtn">
48
- <view
49
- class="flex flex-content-center flex-items-center mt-5px border-style-solid"
50
- :style="{
51
- color: textColor,
52
- borderWidth: editBorder ? transformValueUnit(1) : 0,
53
- borderColor: textColor,
54
- padding: editBorder ? `2px ${editSize / 2.5}px 2px ${editSize / 2.5}px` : '',
55
- borderRadius: transformValueUnit(30),
56
- fontSize: transformValueUnit(editSize),
57
- }"
58
- >
59
- <view>{{ editText }}</view>
41
+ <view v-else class="leading-none">
42
+ <view class="text-32rpx font-#333 font-500 mb-20rpx">
43
+ {{ userStore?.userInfo?.userName || '微信用户' }}
44
+ </view>
45
+ <view class="flex" @click="toEdit">
46
+ <view
47
+ class="flex flex-content-center flex-items-center mt-5px border-style-solid"
48
+ :style="{
49
+ color: textColor,
50
+ borderWidth: editBorder ? transformValueUnit(1) : 0,
51
+ borderColor: textColor,
52
+ padding: editBorder ? `2px ${editSize / 2.5}px 2px ${editSize / 2.5}px` : '',
53
+ borderRadius: transformValueUnit(30),
54
+ fontSize: transformValueUnit(editSize),
55
+ }"
56
+ >
57
+ <view>{{ editText }}</view>
58
+ </view>
60
59
  </view>
61
60
  </view>
62
61
  </view>
@@ -103,10 +102,10 @@
103
102
  import { LcbUserTopProps } from './types'
104
103
  import { transformValueUnit } from '../../utils/transform'
105
104
  import Nums from './Nums/index.vue'
106
- import { computed, inject } from 'vue'
105
+ import { computed } from 'vue'
107
106
  import { addUnit } from '@tplc/wot/components/common/util'
108
- import { PAGE_PROVIDE_KEY } from '../../constants'
109
- import { getUserInfo, getUserPhone } from './api'
107
+ import { getPhone } from '../../utils/auth'
108
+
110
109
  const { statusBarHeight } = uni.getSystemInfoSync()
111
110
  defineOptions({
112
111
  name: 'LcbUserTop',
@@ -116,9 +115,8 @@ defineOptions({
116
115
  styleIsolation: 'shared',
117
116
  },
118
117
  })
119
- const pageInfo = inject(PAGE_PROVIDE_KEY)
120
- const photoUrl = ''
121
- const editBtn = ''
118
+ const userStore = uni.$lcb.userStore?.()
119
+ userStore?.getUser()
122
120
  withDefaults(defineProps<LcbUserTopProps>(), {
123
121
  photoSize: 100,
124
122
  paddingLeft: 35,
@@ -139,10 +137,20 @@ withDefaults(defineProps<LcbUserTopProps>(), {
139
137
  const padTop = computed(() => {
140
138
  return addUnit(statusBarHeight || 0)
141
139
  })
142
- const getPhone = async (e) => {
143
- await getUserPhone(e.detail)
140
+ const phoneHandler = async (e) => {
141
+ await getPhone(e)
142
+ userStore?.getUser()
143
+ }
144
+ const onAvatar = (headImgUrl) => {
145
+ userStore?.updateUser({
146
+ headImgUrl,
147
+ })
148
+ }
149
+ const toEdit = () => {
150
+ uni.navigateTo({
151
+ url: '/pages/user/edit',
152
+ })
144
153
  }
145
- getUserInfo()
146
154
  </script>
147
155
  <style lang="scss" scoped>
148
156
  .userPlace {
package/constants.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export const FORM_KEY = 'form'
2
2
  /** 页面信息 */
3
3
  export const PAGE_PROVIDE_KEY = 'page_provide'
4
+ /** 页面类型 */
5
+ export const PAGE_TYPE_PROVIDE_KEY = 'page_type_provide'