jmash-core-mp 0.1.21 → 0.1.22

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 (150) hide show
  1. package/.editorconfig +9 -9
  2. package/README.md +60 -60
  3. package/babel.config.json +34 -34
  4. package/eslint.config.mjs +7 -7
  5. package/lib/api/auth/index.d.ts +21 -21
  6. package/lib/api/auth/index.js +199 -199
  7. package/lib/api/auth/types.d.ts +86 -86
  8. package/lib/api/auth/types.js +9 -9
  9. package/lib/api/cms/index.d.ts +20 -20
  10. package/lib/api/cms/index.js +161 -161
  11. package/lib/api/cms/types.d.ts +200 -200
  12. package/lib/api/cms/types.js +1 -1
  13. package/lib/api/constant.d.ts +5 -5
  14. package/lib/api/constant.js +6 -6
  15. package/lib/api/dict/index.d.ts +18 -18
  16. package/lib/api/dict/index.js +34 -34
  17. package/lib/api/dict/types.d.ts +28 -28
  18. package/lib/api/dict/types.js +1 -1
  19. package/lib/api/dicts.d.ts +18 -18
  20. package/lib/api/dicts.js +67 -67
  21. package/lib/api/files/index.d.ts +25 -25
  22. package/lib/api/files/index.js +135 -135
  23. package/lib/api/files/types.d.ts +38 -38
  24. package/lib/api/files/types.js +1 -1
  25. package/lib/api/index.d.ts +4 -4
  26. package/lib/api/index.js +6 -6
  27. package/lib/api/myorgan/types.d.ts +22 -22
  28. package/lib/api/myorgan/types.js +1 -1
  29. package/lib/api/region/index.d.ts +7 -7
  30. package/lib/api/region/index.js +19 -19
  31. package/lib/api/region/types.d.ts +19 -19
  32. package/lib/api/region/types.js +1 -1
  33. package/lib/api/storage/index.d.ts +10 -10
  34. package/lib/api/storage/index.js +43 -43
  35. package/lib/api/storage/types.d.ts +28 -28
  36. package/lib/api/storage/types.js +1 -1
  37. package/lib/api/types.d.ts +42 -42
  38. package/lib/api/types.js +1 -1
  39. package/lib/app.mpx.d.ts +1 -1
  40. package/lib/components/auth-user/jmash-update-user.mpx.d.ts +1 -1
  41. package/lib/components/auth-user/jmash-user.mpx.d.ts +1 -1
  42. package/lib/components/cms/jmash-cms-acticle-list.mpx.d.ts +1 -1
  43. package/lib/components/cms/jmash-cms-article-item.mpx.d.ts +1 -1
  44. package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +1 -0
  45. package/lib/components/cms/jmash-cms-article.mpx.d.ts +1 -1
  46. package/lib/components/cms/jmash-cms-like.mpx.d.ts +1 -1
  47. package/lib/components/common/jmash-upload-picture.mpx.d.ts +1 -0
  48. package/lib/components/core/jmash-login.mpx.d.ts +1 -0
  49. package/lib/index.d.ts +21 -21
  50. package/lib/index.js +14 -14
  51. package/lib/packages/pages/cms/cms-article-list.mpx.d.ts +1 -1
  52. package/lib/pages/index.mpx.d.ts +1 -0
  53. package/lib/store/user.d.ts +31 -31
  54. package/lib/store/user.js +227 -227
  55. package/lib/utils/common.d.ts +35 -35
  56. package/lib/utils/common.js +166 -166
  57. package/lib/utils/config.d.ts +5 -5
  58. package/lib/utils/config.js +29 -29
  59. package/lib/utils/db.d.ts +21 -21
  60. package/lib/utils/db.js +84 -84
  61. package/lib/utils/grpc.d.ts +5 -5
  62. package/lib/utils/grpc.js +20 -20
  63. package/lib/utils/net.d.ts +7 -7
  64. package/lib/utils/net.js +15 -15
  65. package/lib/utils/request.d.ts +2 -2
  66. package/lib/utils/request.js +123 -123
  67. package/mpx.config.js +27 -27
  68. package/package.json +1 -1
  69. package/postcss.config.js +11 -11
  70. package/project.config.json +24 -24
  71. package/project.private.config.json +13 -13
  72. package/public/index.html +15 -15
  73. package/src/api/auth/index.ts +227 -227
  74. package/src/api/auth/types.ts +166 -166
  75. package/src/api/cms/index.ts +218 -218
  76. package/src/api/cms/types.ts +379 -379
  77. package/src/api/constant.ts +6 -6
  78. package/src/api/dict/index.ts +44 -44
  79. package/src/api/dict/types.ts +49 -49
  80. package/src/api/dicts.ts +72 -72
  81. package/src/api/files/index.ts +163 -163
  82. package/src/api/files/types.ts +67 -67
  83. package/src/api/index.ts +11 -11
  84. package/src/api/myorgan/types.ts +42 -42
  85. package/src/api/region/index.ts +23 -23
  86. package/src/api/region/types.ts +36 -36
  87. package/src/api/storage/index.ts +62 -62
  88. package/src/api/storage/types.ts +54 -54
  89. package/src/api/types.ts +72 -72
  90. package/src/app.mpx +71 -71
  91. package/src/components/auth-user/jmash-logout.mpx +91 -91
  92. package/src/components/auth-user/jmash-update-user.mpx +386 -386
  93. package/src/components/auth-user/jmash-update-user.web.mpx +366 -366
  94. package/src/components/auth-user/jmash-user.mpx +359 -359
  95. package/src/components/cms/jmash-cms-acticle-list.mpx +182 -182
  96. package/src/components/cms/jmash-cms-article-item.mpx +241 -241
  97. package/src/components/cms/jmash-cms-article-view.mpx +131 -131
  98. package/src/components/cms/jmash-cms-article.mpx +68 -68
  99. package/src/components/cms/jmash-cms-like.mpx +151 -151
  100. package/src/components/common/jmash-avatar-edit.mpx +153 -153
  101. package/src/components/common/jmash-cascader-region.mpx +112 -112
  102. package/src/components/common/jmash-menu.mpx +129 -129
  103. package/src/components/common/jmash-none-data.mpx +82 -82
  104. package/src/components/common/jmash-pic-swiper.mpx +71 -71
  105. package/src/components/common/jmash-popup.mpx +137 -137
  106. package/src/components/common/jmash-search.mpx +126 -126
  107. package/src/components/common/jmash-single-btn.mpx +53 -53
  108. package/src/components/common/jmash-stepper.mpx +214 -214
  109. package/src/components/common/jmash-tab-bar.mpx +50 -50
  110. package/src/components/common/jmash-textarea.mpx +88 -88
  111. package/src/components/common/jmash-top-navigation.mpx +203 -203
  112. package/src/components/common/jmash-upload-picture.mpx +129 -126
  113. package/src/components/core/jmash-cms-protocol.mpx +66 -66
  114. package/src/components/core/jmash-login.ali.mpx +284 -284
  115. package/src/components/core/jmash-login.mpx +348 -348
  116. package/src/components/core/jmash-login.web.mpx +421 -421
  117. package/src/components/core/jmash-popup-login.ali.mpx +311 -311
  118. package/src/components/core/jmash-popup-login.mpx +415 -415
  119. package/src/components/core/jmash-popup-login.web.mpx +389 -389
  120. package/src/custom-tab-bar/index.mpx +10 -10
  121. package/src/global.d.ts +11 -11
  122. package/src/index.ts +71 -71
  123. package/src/packages/index.mpx +10 -10
  124. package/src/packages/pages/auth/cms-protocol.mpx +31 -31
  125. package/src/packages/pages/auth/login.mpx +59 -59
  126. package/src/packages/pages/auth/update-user.mpx +17 -17
  127. package/src/packages/pages/cms/cms-article-list.mpx +164 -164
  128. package/src/packages/pages/cms/cms-article.mpx +32 -32
  129. package/src/pages/basic-component.mpx +30 -30
  130. package/src/pages/half-home.mpx +58 -58
  131. package/src/pages/home.mpx +52 -52
  132. package/src/pages/home2.mpx +47 -47
  133. package/src/pages/index.mpx +13 -3
  134. package/src/pages/tabbar/home.mpx +77 -77
  135. package/src/pages/tabbar/my.mpx +80 -80
  136. package/src/store/user.ts +270 -270
  137. package/src/styles/index.scss +20 -20
  138. package/src/styles/vars.scss +27 -27
  139. package/src/utils/common.ts +179 -179
  140. package/src/utils/config.ts +35 -35
  141. package/src/utils/db.ts +100 -100
  142. package/src/utils/grpc.ts +21 -21
  143. package/src/utils/net.ts +18 -18
  144. package/src/utils/request.ts +134 -134
  145. package/static/ali/mini.project.json +4 -4
  146. package/static/dd/project.config.json +15 -15
  147. package/static/swan/project.swan.json +14 -14
  148. package/static/tt/project.config.json +11 -11
  149. package/static/wx/project.config.json +40 -40
  150. package/uno.config.js +9 -9
@@ -1,366 +1,366 @@
1
- <template>
2
- <!-- 我的页面 中个人信息编辑页面 -->
3
- <view class="my-information">
4
- <view class="main">
5
- <!-- 头像区域 -->
6
- <view class="main-profile" wx:if="{{ isUserAvatar }}">
7
- <view class="profile-left">头像</view>
8
- <view class="profile-right">
9
- <button class="avatar-wrapper">
10
- <image class="avatar-img" src="{{ resourceUrl + '/components/gray_head2x.png' }}" mode="aspectFill"
11
- wx:if="{{ !userInfo.avatar }}" />
12
- <image class="avatar-img" src="{{ imageUrl + userInfo.avatar }}" mode="aspectFill" wx:else />
13
- <view class="avatar-badge">
14
- <text class="badge-icon">✎</text>
15
- </view>
16
- </button>
17
- </view>
18
- </view>
19
-
20
- <!-- 昵称 -->
21
- <view class="main-nickname" wx:if="{{ isUserNickName }}">
22
- <view class="nickname-left">昵称</view>
23
- <view class="nickname-right">
24
- <input wx:model="{{ userInfo.nickName }}" wx:model-prop="value" type="nickname" class="nickname-input"
25
- placeholder="请输入昵称" />
26
- </view>
27
- </view>
28
-
29
- <!-- 姓名 -->
30
- <view class="main-nickname" wx:if="{{ isUserRealName }}">
31
- <view class="nickname-left">姓名</view>
32
- <view class="nickname-right">
33
- <input wx:model="{{ userInfo.realName }}" wx:model-prop="value" type="text" class="nickname-input"
34
- placeholder="请输入姓名" />
35
- </view>
36
- </view>
37
-
38
- </view>
39
- <!-- 保存按钮 -->
40
- <view class="main-btn">
41
- <button class="main-btn-item" bindtap="handleUpdateUser">保存</button>
42
- </view>
43
- </view>
44
- </template>
45
-
46
- <script lang="ts">
47
- import mpx, { createComponent } from '@mpxjs/core'
48
- import { UpdateUserReq, UserInfo } from '../../api/auth/types'
49
- import { authApi } from '../../api/auth/index'
50
- import { fileApi } from '../../api/files/index';
51
- import { FileInfo } from '../../api/files/types';
52
- import { useUserStore } from '../../store/user';
53
-
54
- createComponent({
55
- properties: {
56
- // 是否显示用户头像
57
- isUserAvatar: {
58
- type: Boolean,
59
- value: true
60
- },
61
- // 是否显示昵称
62
- isUserNickName: {
63
- type: Boolean,
64
- value: true
65
- },
66
- // 是否显示姓名
67
- isUserRealName: {
68
- type: Boolean,
69
- value: true
70
- },
71
- // 是否显示手机号
72
- isUserMobilePhone: {
73
- type: Boolean,
74
- value: true
75
- },
76
- // 是否显示更换手机号
77
- isChangePhone: {
78
- type: Boolean,
79
- value: true
80
- }
81
- },
82
- data: {
83
- resourceUrl: getApp().globalData.config.resourceUrl + "/images",
84
- imageUrl: getApp().globalData.config.baseUrl + "/v1/file/path/",
85
- userInfo: {} as UserInfo,
86
- userStore: {} as any
87
- },
88
- ready() {
89
- this.userStore = useUserStore();
90
- this.getUserInfo();
91
- },
92
- /**
93
- * 组件的方法列表
94
- */
95
- methods: {
96
- // 获取用户信息
97
- getUserInfo(cache: boolean = true) {
98
- console.log("getUserInfo");
99
- this.userStore.getUserInfo(cache).then((resp: UserInfo) => {
100
- this.userInfo = resp;
101
- });
102
- },
103
-
104
- // 获取微信头像
105
- onChooseAvatar(e: any) {
106
- console.log("onChooseAvatar", e);
107
- const { avatarUrl } = e.detail;
108
- fileApi.uploadFile(avatarUrl).then((res: FileInfo) => {
109
- console.log("uploadFile1", res);
110
- this.userInfo.avatar = res.fileSrc;
111
- });
112
- },
113
-
114
- // 更换手机号
115
- getPhoneNumberWechat(e: any) {
116
- console.log("getPhoneNumber", e);
117
- const config = getApp().globalData.config;
118
- if (e.detail.errMsg === "getPhoneNumber:ok") {
119
- // 授权成功后,调用rbac模块接口 已登陆状态小程序更换绑定手机号
120
- authApi.replaceBindphone({
121
- appId: config.appId,
122
- phoneCode: e.detail.code,
123
- componentAppid: config.componentAppid
124
- }).then((res) => {
125
- if (res.data) {
126
- this.getUserInfo(false);
127
- }
128
- })
129
- }
130
- },
131
- getPhoneNumberAli(e: any) {
132
- console.log("getPhoneNumber", e);
133
- const config = getApp().globalData.config;
134
- // 支付宝小程序获取手机号
135
- my.getPhoneNumber({
136
- success: (res: any) => {
137
- console.log("手机号授权", res);
138
- const { response } = res;
139
- authApi.replaceBindphone({
140
- appId: config.appId,
141
- phoneCode: response,
142
- componentAppid: config.componentAppid
143
- }).then((res) => {
144
- if (res.data) {
145
- this.getUserInfo(false);
146
- }
147
- })
148
- },
149
- fail: () => {
150
- mpx.showToast({
151
- title: "您已取消授权",
152
- icon: "none",
153
- duration: 2000,
154
- });
155
- }
156
- });
157
- },
158
- // 更新用户信息
159
- handleUpdateUser() {
160
- let updateReq: UpdateUserReq = { ...this.userInfo } as UpdateUserReq;
161
- updateReq.requestId = Math.random() * 10 + "";
162
- updateReq.updateMask = "nickName,avatar,realName";
163
- authApi.updateUserInfo(updateReq).then((res) => {
164
- // 保存成功后重新设置本地缓存信息,并跳转到我的页面
165
- if (res.statusCode === 200) {
166
- this.userStore.setUserInfo(res.data);
167
- mpx.navigateBack({
168
- delta: 1
169
- });
170
- };
171
- });
172
- },
173
- // 手机号授权失败回调
174
- onPhoneAuthFail() {
175
- mpx.showToast({
176
- title: "手机号授权失败",
177
- icon: "none",
178
- duration: 2000,
179
- });
180
- }
181
- }
182
- }
183
-
184
- )
185
- </script>
186
-
187
- <style lang="scss">
188
- @use "../../styles/index.scss" as *;
189
-
190
- // 颜色变量
191
- $primary: #07c160;
192
- $primary-dark: #06ad56;
193
- $text-1: #111111;
194
- $text-2: #555555;
195
- $text-3: #888888;
196
- $border: #e8e8e8;
197
- $bg-page: #f2f2f2;
198
- $bg-card: #ffffff;
199
-
200
- .my-information {
201
- background-color: $bg-page;
202
- width: 100%;
203
- min-height: 100vh;
204
- position: relative;
205
- padding: 30rpx 0;
206
-
207
- .main {
208
- background-color: $bg-card;
209
- margin: 0 30rpx;
210
- border-radius: 24rpx;
211
- overflow: hidden;
212
- box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
213
-
214
- .main-profile,
215
- .main-nickname,
216
- .main-phone {
217
- display: flex;
218
- justify-content: space-between;
219
- align-items: center;
220
- height: 120rpx;
221
- padding: 0 32rpx;
222
- border-bottom: 1rpx solid $border;
223
- transition: background-color 0.2s;
224
-
225
- &:last-child {
226
- border-bottom: none;
227
- }
228
-
229
- &:active {
230
- background-color: rgba(0, 0, 0, 0.02);
231
- }
232
-
233
- .profile-left,
234
- .nickname-left,
235
- .phone-left {
236
- font-size: 30rpx;
237
- color: $text-1;
238
- font-weight: 500;
239
- }
240
-
241
- .profile-right {
242
- .avatar-wrapper {
243
- position: relative;
244
- margin: 0;
245
- padding: 0;
246
- background: transparent;
247
- border: none;
248
- line-height: 1;
249
-
250
- .avatar-img {
251
- width: 88rpx;
252
- height: 88rpx;
253
- border-radius: 50%;
254
- border: 2rpx solid $border;
255
- display: block;
256
- }
257
-
258
- .avatar-badge {
259
- position: absolute;
260
- right: -4rpx;
261
- bottom: -4rpx;
262
- width: 36rpx;
263
- height: 36rpx;
264
- background: $primary;
265
- border-radius: 50%;
266
- border: 2rpx solid $bg-card;
267
- display: flex;
268
- align-items: center;
269
- justify-content: center;
270
-
271
- .badge-icon {
272
- font-size: 16rpx;
273
- color: #fff;
274
- }
275
- }
276
- }
277
- }
278
-
279
- .nickname-right,
280
- .phone-right {
281
- display: flex;
282
- justify-content: flex-end;
283
- align-items: center;
284
- flex: 1;
285
- margin-left: 30rpx;
286
- }
287
-
288
- .nickname-input {
289
- flex: 1;
290
- text-align: right;
291
- font-size: 30rpx;
292
- color: $text-1;
293
- background: transparent;
294
- border: none;
295
- outline: none;
296
- height: 80rpx;
297
- line-height: 80rpx;
298
- padding: 0;
299
-
300
- &::placeholder {
301
- color: $text-3;
302
- }
303
- }
304
-
305
- .phone-right {
306
- .phone-number {
307
- font-size: 30rpx;
308
- color: $text-1;
309
- font-weight: 500;
310
- }
311
-
312
- .phone-right-btn {
313
- background-color: #e6f7ff;
314
- border-radius: 24rpx;
315
- margin-left: 20rpx;
316
- border: none;
317
- font-size: 24rpx;
318
- color: $primary;
319
- padding: 12rpx 24rpx;
320
- height: auto;
321
- line-height: 1.4;
322
- }
323
- }
324
- }
325
-
326
- .main-phone {
327
- border-bottom: none;
328
- }
329
- }
330
-
331
- // 保存按钮样式
332
- .main-btn {
333
- display: flex;
334
- justify-content: center;
335
- align-items: center;
336
- padding: 60rpx 30rpx;
337
- }
338
-
339
- .main-btn-item {
340
- width: 100%;
341
- height: 88rpx;
342
- border-radius: 44rpx;
343
- font-size: 32rpx;
344
- font-weight: 600;
345
- letter-spacing: 2rpx;
346
- background-color: $primary;
347
- color: #fff;
348
- border: none;
349
- display: flex;
350
- align-items: center;
351
- justify-content: center;
352
- transition: background-color 0.2s;
353
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
354
-
355
- &:active {
356
- background-color: $primary-dark;
357
- }
358
- }
359
- }
360
- </style>
361
-
362
- <script type="application/json">
363
- {
364
- "component": true
365
- }
366
- </script>
1
+ <template>
2
+ <!-- 我的页面 中个人信息编辑页面 -->
3
+ <view class="my-information">
4
+ <view class="main">
5
+ <!-- 头像区域 -->
6
+ <view class="main-profile" wx:if="{{ isUserAvatar }}">
7
+ <view class="profile-left">头像</view>
8
+ <view class="profile-right">
9
+ <button class="avatar-wrapper">
10
+ <image class="avatar-img" src="{{ resourceUrl + '/components/gray_head2x.png' }}" mode="aspectFill"
11
+ wx:if="{{ !userInfo.avatar }}" />
12
+ <image class="avatar-img" src="{{ imageUrl + userInfo.avatar }}" mode="aspectFill" wx:else />
13
+ <view class="avatar-badge">
14
+ <text class="badge-icon">✎</text>
15
+ </view>
16
+ </button>
17
+ </view>
18
+ </view>
19
+
20
+ <!-- 昵称 -->
21
+ <view class="main-nickname" wx:if="{{ isUserNickName }}">
22
+ <view class="nickname-left">昵称</view>
23
+ <view class="nickname-right">
24
+ <input wx:model="{{ userInfo.nickName }}" wx:model-prop="value" type="nickname" class="nickname-input"
25
+ placeholder="请输入昵称" />
26
+ </view>
27
+ </view>
28
+
29
+ <!-- 姓名 -->
30
+ <view class="main-nickname" wx:if="{{ isUserRealName }}">
31
+ <view class="nickname-left">姓名</view>
32
+ <view class="nickname-right">
33
+ <input wx:model="{{ userInfo.realName }}" wx:model-prop="value" type="text" class="nickname-input"
34
+ placeholder="请输入姓名" />
35
+ </view>
36
+ </view>
37
+
38
+ </view>
39
+ <!-- 保存按钮 -->
40
+ <view class="main-btn">
41
+ <button class="main-btn-item" bindtap="handleUpdateUser">保存</button>
42
+ </view>
43
+ </view>
44
+ </template>
45
+
46
+ <script lang="ts">
47
+ import mpx, { createComponent } from '@mpxjs/core'
48
+ import { UpdateUserReq, UserInfo } from '../../api/auth/types'
49
+ import { authApi } from '../../api/auth/index'
50
+ import { fileApi } from '../../api/files/index';
51
+ import { FileInfo } from '../../api/files/types';
52
+ import { useUserStore } from '../../store/user';
53
+
54
+ createComponent({
55
+ properties: {
56
+ // 是否显示用户头像
57
+ isUserAvatar: {
58
+ type: Boolean,
59
+ value: true
60
+ },
61
+ // 是否显示昵称
62
+ isUserNickName: {
63
+ type: Boolean,
64
+ value: true
65
+ },
66
+ // 是否显示姓名
67
+ isUserRealName: {
68
+ type: Boolean,
69
+ value: true
70
+ },
71
+ // 是否显示手机号
72
+ isUserMobilePhone: {
73
+ type: Boolean,
74
+ value: true
75
+ },
76
+ // 是否显示更换手机号
77
+ isChangePhone: {
78
+ type: Boolean,
79
+ value: true
80
+ }
81
+ },
82
+ data: {
83
+ resourceUrl: getApp().globalData.config.resourceUrl + "/images",
84
+ imageUrl: getApp().globalData.config.baseUrl + "/v1/file/path/",
85
+ userInfo: {} as UserInfo,
86
+ userStore: {} as any
87
+ },
88
+ ready() {
89
+ this.userStore = useUserStore();
90
+ this.getUserInfo();
91
+ },
92
+ /**
93
+ * 组件的方法列表
94
+ */
95
+ methods: {
96
+ // 获取用户信息
97
+ getUserInfo(cache: boolean = true) {
98
+ console.log("getUserInfo");
99
+ this.userStore.getUserInfo(cache).then((resp: UserInfo) => {
100
+ this.userInfo = resp;
101
+ });
102
+ },
103
+
104
+ // 获取微信头像
105
+ onChooseAvatar(e: any) {
106
+ console.log("onChooseAvatar", e);
107
+ const { avatarUrl } = e.detail;
108
+ fileApi.uploadFile(avatarUrl).then((res: FileInfo) => {
109
+ console.log("uploadFile1", res);
110
+ this.userInfo.avatar = res.fileSrc;
111
+ });
112
+ },
113
+
114
+ // 更换手机号
115
+ getPhoneNumberWechat(e: any) {
116
+ console.log("getPhoneNumber", e);
117
+ const config = getApp().globalData.config;
118
+ if (e.detail.errMsg === "getPhoneNumber:ok") {
119
+ // 授权成功后,调用rbac模块接口 已登陆状态小程序更换绑定手机号
120
+ authApi.replaceBindphone({
121
+ appId: config.appId,
122
+ phoneCode: e.detail.code,
123
+ componentAppid: config.componentAppid
124
+ }).then((res) => {
125
+ if (res.data) {
126
+ this.getUserInfo(false);
127
+ }
128
+ })
129
+ }
130
+ },
131
+ getPhoneNumberAli(e: any) {
132
+ console.log("getPhoneNumber", e);
133
+ const config = getApp().globalData.config;
134
+ // 支付宝小程序获取手机号
135
+ my.getPhoneNumber({
136
+ success: (res: any) => {
137
+ console.log("手机号授权", res);
138
+ const { response } = res;
139
+ authApi.replaceBindphone({
140
+ appId: config.appId,
141
+ phoneCode: response,
142
+ componentAppid: config.componentAppid
143
+ }).then((res) => {
144
+ if (res.data) {
145
+ this.getUserInfo(false);
146
+ }
147
+ })
148
+ },
149
+ fail: () => {
150
+ mpx.showToast({
151
+ title: "您已取消授权",
152
+ icon: "none",
153
+ duration: 2000,
154
+ });
155
+ }
156
+ });
157
+ },
158
+ // 更新用户信息
159
+ handleUpdateUser() {
160
+ let updateReq: UpdateUserReq = { ...this.userInfo } as UpdateUserReq;
161
+ updateReq.requestId = Math.random() * 10 + "";
162
+ updateReq.updateMask = "nickName,avatar,realName";
163
+ authApi.updateUserInfo(updateReq).then((res) => {
164
+ // 保存成功后重新设置本地缓存信息,并跳转到我的页面
165
+ if (res.statusCode === 200) {
166
+ this.userStore.setUserInfo(res.data);
167
+ mpx.navigateBack({
168
+ delta: 1
169
+ });
170
+ };
171
+ });
172
+ },
173
+ // 手机号授权失败回调
174
+ onPhoneAuthFail() {
175
+ mpx.showToast({
176
+ title: "手机号授权失败",
177
+ icon: "none",
178
+ duration: 2000,
179
+ });
180
+ }
181
+ }
182
+ }
183
+
184
+ )
185
+ </script>
186
+
187
+ <style lang="scss">
188
+ @use "../../styles/index.scss" as *;
189
+
190
+ // 颜色变量
191
+ $primary: #07c160;
192
+ $primary-dark: #06ad56;
193
+ $text-1: #111111;
194
+ $text-2: #555555;
195
+ $text-3: #888888;
196
+ $border: #e8e8e8;
197
+ $bg-page: #f2f2f2;
198
+ $bg-card: #ffffff;
199
+
200
+ .my-information {
201
+ background-color: $bg-page;
202
+ width: 100%;
203
+ min-height: 100vh;
204
+ position: relative;
205
+ padding: 30rpx 0;
206
+
207
+ .main {
208
+ background-color: $bg-card;
209
+ margin: 0 30rpx;
210
+ border-radius: 24rpx;
211
+ overflow: hidden;
212
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
213
+
214
+ .main-profile,
215
+ .main-nickname,
216
+ .main-phone {
217
+ display: flex;
218
+ justify-content: space-between;
219
+ align-items: center;
220
+ height: 120rpx;
221
+ padding: 0 32rpx;
222
+ border-bottom: 1rpx solid $border;
223
+ transition: background-color 0.2s;
224
+
225
+ &:last-child {
226
+ border-bottom: none;
227
+ }
228
+
229
+ &:active {
230
+ background-color: rgba(0, 0, 0, 0.02);
231
+ }
232
+
233
+ .profile-left,
234
+ .nickname-left,
235
+ .phone-left {
236
+ font-size: 30rpx;
237
+ color: $text-1;
238
+ font-weight: 500;
239
+ }
240
+
241
+ .profile-right {
242
+ .avatar-wrapper {
243
+ position: relative;
244
+ margin: 0;
245
+ padding: 0;
246
+ background: transparent;
247
+ border: none;
248
+ line-height: 1;
249
+
250
+ .avatar-img {
251
+ width: 88rpx;
252
+ height: 88rpx;
253
+ border-radius: 50%;
254
+ border: 2rpx solid $border;
255
+ display: block;
256
+ }
257
+
258
+ .avatar-badge {
259
+ position: absolute;
260
+ right: -4rpx;
261
+ bottom: -4rpx;
262
+ width: 36rpx;
263
+ height: 36rpx;
264
+ background: $primary;
265
+ border-radius: 50%;
266
+ border: 2rpx solid $bg-card;
267
+ display: flex;
268
+ align-items: center;
269
+ justify-content: center;
270
+
271
+ .badge-icon {
272
+ font-size: 16rpx;
273
+ color: #fff;
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ .nickname-right,
280
+ .phone-right {
281
+ display: flex;
282
+ justify-content: flex-end;
283
+ align-items: center;
284
+ flex: 1;
285
+ margin-left: 30rpx;
286
+ }
287
+
288
+ .nickname-input {
289
+ flex: 1;
290
+ text-align: right;
291
+ font-size: 30rpx;
292
+ color: $text-1;
293
+ background: transparent;
294
+ border: none;
295
+ outline: none;
296
+ height: 80rpx;
297
+ line-height: 80rpx;
298
+ padding: 0;
299
+
300
+ &::placeholder {
301
+ color: $text-3;
302
+ }
303
+ }
304
+
305
+ .phone-right {
306
+ .phone-number {
307
+ font-size: 30rpx;
308
+ color: $text-1;
309
+ font-weight: 500;
310
+ }
311
+
312
+ .phone-right-btn {
313
+ background-color: #e6f7ff;
314
+ border-radius: 24rpx;
315
+ margin-left: 20rpx;
316
+ border: none;
317
+ font-size: 24rpx;
318
+ color: $primary;
319
+ padding: 12rpx 24rpx;
320
+ height: auto;
321
+ line-height: 1.4;
322
+ }
323
+ }
324
+ }
325
+
326
+ .main-phone {
327
+ border-bottom: none;
328
+ }
329
+ }
330
+
331
+ // 保存按钮样式
332
+ .main-btn {
333
+ display: flex;
334
+ justify-content: center;
335
+ align-items: center;
336
+ padding: 60rpx 30rpx;
337
+ }
338
+
339
+ .main-btn-item {
340
+ width: 100%;
341
+ height: 88rpx;
342
+ border-radius: 44rpx;
343
+ font-size: 32rpx;
344
+ font-weight: 600;
345
+ letter-spacing: 2rpx;
346
+ background-color: $primary;
347
+ color: #fff;
348
+ border: none;
349
+ display: flex;
350
+ align-items: center;
351
+ justify-content: center;
352
+ transition: background-color 0.2s;
353
+ box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
354
+
355
+ &:active {
356
+ background-color: $primary-dark;
357
+ }
358
+ }
359
+ }
360
+ </style>
361
+
362
+ <script type="application/json">
363
+ {
364
+ "component": true
365
+ }
366
+ </script>