@tplc/business 0.1.3 → 0.1.5

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/action.d.ts CHANGED
@@ -34,6 +34,7 @@ export interface LcbGlobal {
34
34
  userStore?: () => {
35
35
  userInfo: Record<string, any>
36
36
  updateUser: (data: Record<string, any>) => void
37
+ getUser: () => void
37
38
  }
38
39
  }
39
40
 
@@ -3,8 +3,3 @@ export const getUserPhone = (data: { encryptedData: string; iv: string; code?: s
3
3
  ...data,
4
4
  appId: (import.meta as any).env.VITE_WX_APPID,
5
5
  })
6
-
7
- export const saveUserInfo = (data: { nickName?: string; avatarUrl?: string }) =>
8
- uni.$lcb.http.post('/wechatProgram/saveUserInfo', data)
9
-
10
- // /api/login/getUserInfo
@@ -15,23 +15,15 @@
15
15
  <view class="flex flex-items-center">
16
16
  <lcb-action-view :jump-type="101" @avatar="onAvatar">
17
17
  <wd-img
18
- v-if="userStore?.userInfo?.avatarUrl"
19
18
  v-bind="{
20
19
  width: transformValueUnit(photoSize),
21
20
  height: transformValueUnit(photoSize),
22
21
  round: photoRound,
23
- src: userStore?.userInfo?.avatarUrl,
22
+ src:
23
+ userStore?.userInfo?.headImgUrl ||
24
+ 'https://lycs.eluying.com/material/icon/1/20240925185540/userPhoto.jpg',
24
25
  }"
25
- class="mr-20rpx"
26
- />
27
- <view
28
- v-if="!userStore?.userInfo?.avatarUrl"
29
- :style="{
30
- width: transformValueUnit(photoSize),
31
- height: transformValueUnit(photoSize),
32
- borderRadius: photoRound ? '50%' : '',
33
- }"
34
- class="bg-#eee userPlace mr-40rpx"
26
+ custom-class="mr-40rpx bg-#eee"
35
27
  />
36
28
  </lcb-action-view>
37
29
  <view class="flex-1">
@@ -46,21 +38,26 @@
46
38
  授权登录
47
39
  </view>
48
40
  </lcb-action-view>
49
- <view class="flex" v-else>
50
- <view
51
- class="flex flex-content-center flex-items-center mt-5px border-style-solid"
52
- :style="{
53
- color: textColor,
54
- borderWidth: editBorder ? transformValueUnit(1) : 0,
55
- borderColor: textColor,
56
- padding: editBorder ? `2px ${editSize / 2.5}px 2px ${editSize / 2.5}px` : '',
57
- borderRadius: transformValueUnit(30),
58
- fontSize: transformValueUnit(editSize),
59
- }"
60
- >
61
- <view>{{ editText }}</view>
41
+ <template v-else>
42
+ <view class="text-32rpx font-#333 font-bold mb-20rpx">
43
+ {{ userStore?.userInfo?.nickName || '微信用户' }}
44
+ </view>
45
+ <view class="flex">
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>
62
59
  </view>
63
- </view>
60
+ </template>
64
61
  </view>
65
62
  <!-- 右边按钮 -->
66
63
  <lcb-action-view v-if="moreIcon" v-bind="rightIconLink">
@@ -118,6 +115,7 @@ defineOptions({
118
115
  },
119
116
  })
120
117
  const userStore = uni.$lcb.userStore?.()
118
+ userStore?.getUser()
121
119
  withDefaults(defineProps<LcbUserTopProps>(), {
122
120
  photoSize: 100,
123
121
  paddingLeft: 35,
@@ -150,9 +148,9 @@ const getPhone = async (e) => {
150
148
  },
151
149
  })
152
150
  }
153
- const onAvatar = (avatarUrl) => {
151
+ const onAvatar = (headImgUrl) => {
154
152
  userStore?.updateUser({
155
- avatarUrl,
153
+ headImgUrl,
156
154
  })
157
155
  }
158
156
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -3,7 +3,3 @@ export declare const getUserPhone: (data: {
3
3
  iv: string
4
4
  code?: string
5
5
  }) => Promise<import('../../../action').IResData<unknown>>
6
- export declare const saveUserInfo: (data: {
7
- nickName?: string
8
- avatarUrl?: string
9
- }) => Promise<import('../../../action').IResData<unknown>>