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,416 +1,416 @@
1
- <template>
2
- <!-- 授权登录 -->
3
- <cube-modal wx:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false" z-index="999"
4
- bind:cancel="onClose" mask-opacity="0.1" class="login-popup">
5
- <!-- 标题区域 -->
6
- <view class="popup-header" slot="header">
7
- <view class="header-info">
8
- <h2 class="header-title">授权登录{{ appName }}</h2>
9
- </view>
10
- <view class="header-close" bind:tap="onClose">
11
- <text class="close-icon">×</text>
12
- </view>
13
- </view>
14
-
15
- <!-- 内容区域 -->
16
- <view class="popup-body" slot="content">
17
- <!-- 头像区域 -->
18
- <view class="avatar-section">
19
- <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
20
- <image class="avatar-img" src="{{ avatarUrl || avatar }}" mode="aspectFill" />
21
- <view class="avatar-badge">
22
- <text class="badge-icon">✎</text>
23
- </view>
24
- </button>
25
- <text class="avatar-tip">点击更换头像</text>
26
- </view>
27
-
28
- <!-- 姓名输入 -->
29
- <view class="name-section">
30
- <view class="name-field">
31
- <text class="field-icon">👤</text>
32
- <input type="nickname" class="weui-input name-input" bind:input="validate" placeholder="请输入您的姓名"
33
- wx:model="{{ nameValue }}" wx:model-prop="value" />
34
- </view>
35
- </view>
36
-
37
- <!-- 协议勾选 -->
38
- <view class="agreement-row">
39
- <cube-checkbox wx:model="{{ isCheckBox }}" bind:input="validate" wx:model-prop="value" shape="square"
40
- class="agreement-check">
41
- <text class="agreement-text">已阅读</text>
42
- <text id="user" class="agreement-link" catch:tap="goInfo">《用户使用协议》</text>
43
- <text class="agreement-text">和</text>
44
- <text id="privacy" class="agreement-link" catch:tap="goInfo">《隐私权政策》</text>
45
- </cube-checkbox>
46
- </view>
47
- <!-- 按钮组 -->
48
- <view class="action-area">
49
- <button primary wx:if="{{ !isValidate }}" bind:tap="onLogin" class="btn-login">
50
- 授权登录
51
- </button>
52
- <button wx:else open-type="getPhoneNumber" bind:getphonenumber="wxPhoneLogin" class="btn-login">
53
- 手机号授权登录
54
- </button>
55
- <view class="btn-cancel" bind:tap="onClose">
56
- <text class="cancel-text">暂不登录</text>
57
- </view>
58
- </view>
59
- </view>
60
- </cube-modal>
61
- </template>
62
-
63
- <script>
64
- import mpx, { createComponent, ref, watch, toRefs } from '@mpxjs/core'
65
- import { useUserStore } from '../../store/user';
66
-
67
- createComponent({
68
- properties: {
69
- visible: {
70
- type: Boolean,
71
- value: false,
72
- }
73
- },
74
- setup(props) {
75
- let config = getApp().globalData.config || { resourceUrl: '', name: '应用' };
76
- let resourceUrl = config.resourceUrl;
77
- let appName = config.name;
78
- let avatar = resourceUrl + "/images/components/gray_head2x.png";
79
- let avatarUrl = ref('');
80
- let nameValue = ref('');
81
- let isCheckBox = ref(false);
82
- let isValidate = ref(false);
83
- let isVisible = ref(props.visible);
84
- let userStore = useUserStore();
85
-
86
- const { visible } = toRefs(props)
87
- watch(visible, (newVal) => {
88
- isVisible.value = newVal;
89
- if (newVal) {
90
- avatarUrl.value = '';
91
- nameValue.value = '';
92
- isCheckBox.value = false;
93
- isValidate.value = false;
94
- }
95
- });
96
-
97
- return {
98
- resourceUrl,
99
- appName,
100
- avatar,
101
- avatarUrl,
102
- nameValue,
103
- isCheckBox,
104
- isValidate,
105
- isVisible,
106
- userStore
107
- };
108
- },
109
- methods: {
110
- onClose() {
111
- this.isVisible = false;
112
- this.triggerEvent('close', false);
113
- },
114
-
115
- onLogin() {
116
- let res = this.validate();
117
- if (!res.validate) {
118
- mpx.showToast({
119
- icon: "error",
120
- title: res.message,
121
- duration: 2000
122
- });
123
- }
124
- },
125
-
126
- onChooseAvatar(e) {
127
- this.avatarUrl = e.detail.avatarUrl;
128
- this.validate();
129
- },
130
-
131
- wxPhoneLogin(event) {
132
- console.log(event);
133
- if (event.detail.errMsg === "getPhoneNumber:ok") {
134
- mpx.showLoading({
135
- title: '登录中...',
136
- mask: true
137
- });
138
-
139
- this.userStore.mpRegister(event.detail.code).then((resp) => {
140
- mpx.hideLoading();
141
- if (resp.status) {
142
- this.triggerEvent("status", resp.status);
143
- this.onClose();
144
- } else {
145
- mpx.showToast({
146
- icon: "error",
147
- title: resp.message || '登录失败',
148
- duration: 2000
149
- });
150
- }
151
- }).catch(() => {
152
- mpx.hideLoading();
153
- mpx.showToast({
154
- icon: "error",
155
- title: '登录失败,请重试',
156
- duration: 2000
157
- });
158
- });
159
- }
160
- },
161
-
162
- validate() {
163
- if (!this.isCheckBox) {
164
- this.isValidate = false;
165
- return { validate: false, message: "请阅读并同意用户协议" };
166
- }
167
- if (!this.nameValue) {
168
- this.isValidate = false;
169
- return { validate: false, message: "请输入姓名" };
170
- }
171
- this.isValidate = true;
172
- return { validate: true, message: "" };
173
- },
174
-
175
- goInfo(e) {
176
- const id = e.currentTarget?.id;
177
- this.triggerEvent("policy", id);
178
- mpx.navigateTo({
179
- url: '/jmash/pages/auth/cms-protocol?channelAlias=' + id
180
- });
181
- },
182
- }
183
- })
184
- </script>
185
-
186
- <style lang="scss">
187
- $primary: #07c160;
188
- $primary-dark: #06ad56;
189
- $text-1: #111111;
190
- $text-2: #555555;
191
- $text-3: #888888;
192
- $border: #d0d0d0;
193
- $bg-page: #f2f2f2;
194
- $bg-card: #ffffff;
195
-
196
- .login-popup {
197
- background-color: $bg-card !important;
198
- border-radius: 32rpx 32rpx 0 0 !important;
199
- overflow: hidden;
200
- }
201
-
202
- .popup-header {
203
- display: flex;
204
- align-items: center;
205
- justify-content: space-between;
206
- padding: 36rpx 40rpx 28rpx;
207
- background: $bg-card;
208
-
209
- .header-info {
210
- flex: 1;
211
-
212
- .header-title {
213
- font-size: 36rpx;
214
- font-weight: 700;
215
- color: $text-1;
216
- margin: 0;
217
- letter-spacing: 1rpx;
218
- }
219
- }
220
-
221
- .header-close {
222
- width: 56rpx;
223
- height: 56rpx;
224
- display: flex;
225
- align-items: center;
226
- justify-content: center;
227
- background: $bg-page;
228
- border-radius: 50%;
229
-
230
- .close-icon {
231
- font-size: 28rpx;
232
- color: $text-3;
233
- line-height: 1;
234
- margin-top: -2rpx;
235
- }
236
- }
237
- }
238
-
239
- .popup-body {
240
- padding: 20rpx 48rpx 56rpx;
241
- background: $bg-card;
242
- }
243
-
244
- .avatar-section {
245
- display: flex;
246
- flex-direction: column;
247
- align-items: center;
248
- margin-bottom: 48rpx;
249
-
250
- .avatar-wrapper {
251
- position: relative;
252
- margin: 0;
253
- padding: 0;
254
- background: none;
255
- border: none;
256
- line-height: 1;
257
-
258
- .avatar-img {
259
- width: 120rpx;
260
- height: 120rpx;
261
- border-radius: 50%;
262
- border: 4rpx solid $border;
263
- display: block;
264
- }
265
-
266
- .avatar-badge {
267
- position: absolute;
268
- right: 0;
269
- bottom: 0;
270
- width: 36rpx;
271
- height: 36rpx;
272
- background: $primary;
273
- border-radius: 50%;
274
- border: 3rpx solid $bg-card;
275
- display: flex;
276
- align-items: center;
277
- justify-content: center;
278
-
279
- .badge-icon {
280
- font-size: 16rpx;
281
- color: #fff;
282
- }
283
- }
284
- }
285
-
286
- .avatar-tip {
287
- margin-top: 16rpx;
288
- font-size: 20rpx;
289
- color: $text-3;
290
- }
291
- }
292
-
293
- .name-section {
294
- margin-bottom: 36rpx;
295
-
296
- .name-field {
297
- display: flex;
298
- align-items: center;
299
- background: $bg-page;
300
- border-radius: 20rpx;
301
- padding: 0 28rpx;
302
- height: 88rpx;
303
- border: 2rpx solid transparent;
304
- transition: border-color 0.25s, background-color 0.25s;
305
-
306
- .field-icon {
307
- font-size: 32rpx;
308
- margin-right: 16rpx;
309
- flex-shrink: 0;
310
- }
311
-
312
- .name-input {
313
- flex: 1;
314
- min-width: 0;
315
- font-size: 28rpx;
316
- color: $text-1;
317
- background: transparent;
318
- border: none;
319
- outline: none;
320
- height: 80rpx;
321
- line-height: 80rpx;
322
- padding: 0;
323
- }
324
-
325
- .name-input::placeholder {
326
- font-size: 28rpx;
327
- color: $text-3;
328
- }
329
- }
330
-
331
- .name-field:focus-within {
332
- border-color: $primary;
333
- background: $bg-card;
334
- }
335
- }
336
-
337
- .agreement-row {
338
- margin-bottom: 48rpx;
339
- padding: 0 4rpx;
340
-
341
- .agreement-check {
342
- font-size: 24rpx;
343
-
344
- .agreement-text {
345
- color: $text-3;
346
- font-size: 24rpx;
347
- }
348
-
349
- .agreement-link {
350
- color: $primary;
351
- font-size: 24rpx;
352
- }
353
- }
354
- }
355
-
356
- .action-area {
357
- display: flex;
358
- flex-direction: column;
359
- align-items: center;
360
-
361
- .btn-login {
362
- width: 100%;
363
- height: 88rpx;
364
- border-radius: 44rpx;
365
- font-size: 30rpx;
366
- font-weight: 600;
367
- letter-spacing: 2rpx;
368
- background-color: $primary;
369
- color: #fff;
370
-
371
- &.btn-disabled {
372
- opacity: 0.5;
373
- }
374
- }
375
-
376
- .btn-cancel {
377
- margin-top: 28rpx;
378
- padding: 16rpx 32rpx;
379
-
380
- .cancel-text {
381
- font-size: 26rpx;
382
- color: $text-3;
383
- }
384
- }
385
- }
386
-
387
- :deep(.cube-button--primary) {
388
- background-color: $primary;
389
- border: none;
390
-
391
- &:active {
392
- background-color: $primary-dark;
393
- }
394
- }
395
-
396
- :deep(.cube-checkbox__input) {
397
- margin-right: 8rpx;
398
- }
399
-
400
- :deep(.cube-checkbox__content) {
401
- font-size: 20rpx;
402
- line-height: 1.5;
403
- }
404
- </style>
405
-
406
- <script type="application/json">
407
- {
408
- "component": true,
409
- "usingComponents": {
410
- "cube-modal": "@mpxjs/mpx-cube-ui/lib/components/modal/index.mpx",
411
- "cube-button": "@mpxjs/mpx-cube-ui/lib/components/button/index.mpx",
412
- "cube-checkbox": "@mpxjs/mpx-cube-ui/lib/components/checkbox/index.mpx",
413
- "cube-checkbox-group": "@mpxjs/mpx-cube-ui/lib/components/checkbox-group/index.mpx"
414
- }
415
- }
1
+ <template>
2
+ <!-- 授权登录 -->
3
+ <cube-modal wx:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false" z-index="999"
4
+ bind:cancel="onClose" mask-opacity="0.1" class="login-popup">
5
+ <!-- 标题区域 -->
6
+ <view class="popup-header" slot="header">
7
+ <view class="header-info">
8
+ <h2 class="header-title">授权登录{{ appName }}</h2>
9
+ </view>
10
+ <view class="header-close" bind:tap="onClose">
11
+ <text class="close-icon">×</text>
12
+ </view>
13
+ </view>
14
+
15
+ <!-- 内容区域 -->
16
+ <view class="popup-body" slot="content">
17
+ <!-- 头像区域 -->
18
+ <view class="avatar-section">
19
+ <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
20
+ <image class="avatar-img" src="{{ avatarUrl || avatar }}" mode="aspectFill" />
21
+ <view class="avatar-badge">
22
+ <text class="badge-icon">✎</text>
23
+ </view>
24
+ </button>
25
+ <text class="avatar-tip">点击更换头像</text>
26
+ </view>
27
+
28
+ <!-- 姓名输入 -->
29
+ <view class="name-section">
30
+ <view class="name-field">
31
+ <text class="field-icon">👤</text>
32
+ <input type="nickname" class="weui-input name-input" bind:input="validate" placeholder="请输入您的姓名"
33
+ wx:model="{{ nameValue }}" wx:model-prop="value" />
34
+ </view>
35
+ </view>
36
+
37
+ <!-- 协议勾选 -->
38
+ <view class="agreement-row">
39
+ <cube-checkbox wx:model="{{ isCheckBox }}" bind:input="validate" wx:model-prop="value" shape="square"
40
+ class="agreement-check">
41
+ <text class="agreement-text">已阅读</text>
42
+ <text id="user" class="agreement-link" catch:tap="goInfo">《用户使用协议》</text>
43
+ <text class="agreement-text">和</text>
44
+ <text id="privacy" class="agreement-link" catch:tap="goInfo">《隐私权政策》</text>
45
+ </cube-checkbox>
46
+ </view>
47
+ <!-- 按钮组 -->
48
+ <view class="action-area">
49
+ <button primary wx:if="{{ !isValidate }}" bind:tap="onLogin" class="btn-login">
50
+ 授权登录
51
+ </button>
52
+ <button wx:else open-type="getPhoneNumber" bind:getphonenumber="wxPhoneLogin" class="btn-login">
53
+ 手机号授权登录
54
+ </button>
55
+ <view class="btn-cancel" bind:tap="onClose">
56
+ <text class="cancel-text">暂不登录</text>
57
+ </view>
58
+ </view>
59
+ </view>
60
+ </cube-modal>
61
+ </template>
62
+
63
+ <script>
64
+ import mpx, { createComponent, ref, watch, toRefs } from '@mpxjs/core'
65
+ import { useUserStore } from '../../store/user';
66
+
67
+ createComponent({
68
+ properties: {
69
+ visible: {
70
+ type: Boolean,
71
+ value: false,
72
+ }
73
+ },
74
+ setup(props) {
75
+ let config = getApp().globalData.config || { resourceUrl: '', name: '应用' };
76
+ let resourceUrl = config.resourceUrl;
77
+ let appName = config.name;
78
+ let avatar = resourceUrl + "/images/components/gray_head2x.png";
79
+ let avatarUrl = ref('');
80
+ let nameValue = ref('');
81
+ let isCheckBox = ref(false);
82
+ let isValidate = ref(false);
83
+ let isVisible = ref(props.visible);
84
+ let userStore = useUserStore();
85
+
86
+ const { visible } = toRefs(props)
87
+ watch(visible, (newVal) => {
88
+ isVisible.value = newVal;
89
+ if (newVal) {
90
+ avatarUrl.value = '';
91
+ nameValue.value = '';
92
+ isCheckBox.value = false;
93
+ isValidate.value = false;
94
+ }
95
+ });
96
+
97
+ return {
98
+ resourceUrl,
99
+ appName,
100
+ avatar,
101
+ avatarUrl,
102
+ nameValue,
103
+ isCheckBox,
104
+ isValidate,
105
+ isVisible,
106
+ userStore
107
+ };
108
+ },
109
+ methods: {
110
+ onClose() {
111
+ this.isVisible = false;
112
+ this.triggerEvent('close', false);
113
+ },
114
+
115
+ onLogin() {
116
+ let res = this.validate();
117
+ if (!res.validate) {
118
+ mpx.showToast({
119
+ icon: "error",
120
+ title: res.message,
121
+ duration: 2000
122
+ });
123
+ }
124
+ },
125
+
126
+ onChooseAvatar(e) {
127
+ this.avatarUrl = e.detail.avatarUrl;
128
+ this.validate();
129
+ },
130
+
131
+ wxPhoneLogin(event) {
132
+ console.log(event);
133
+ if (event.detail.errMsg === "getPhoneNumber:ok") {
134
+ mpx.showLoading({
135
+ title: '登录中...',
136
+ mask: true
137
+ });
138
+
139
+ this.userStore.mpRegister(event.detail.code).then((resp) => {
140
+ mpx.hideLoading();
141
+ if (resp.status) {
142
+ this.triggerEvent("status", resp.status);
143
+ this.onClose();
144
+ } else {
145
+ mpx.showToast({
146
+ icon: "error",
147
+ title: resp.message || '登录失败',
148
+ duration: 2000
149
+ });
150
+ }
151
+ }).catch(() => {
152
+ mpx.hideLoading();
153
+ mpx.showToast({
154
+ icon: "error",
155
+ title: '登录失败,请重试',
156
+ duration: 2000
157
+ });
158
+ });
159
+ }
160
+ },
161
+
162
+ validate() {
163
+ if (!this.isCheckBox) {
164
+ this.isValidate = false;
165
+ return { validate: false, message: "请阅读并同意用户协议" };
166
+ }
167
+ if (!this.nameValue) {
168
+ this.isValidate = false;
169
+ return { validate: false, message: "请输入姓名" };
170
+ }
171
+ this.isValidate = true;
172
+ return { validate: true, message: "" };
173
+ },
174
+
175
+ goInfo(e) {
176
+ const id = e.currentTarget?.id;
177
+ this.triggerEvent("policy", id);
178
+ mpx.navigateTo({
179
+ url: '/jmash/pages/auth/cms-protocol?channelAlias=' + id
180
+ });
181
+ },
182
+ }
183
+ })
184
+ </script>
185
+
186
+ <style lang="scss">
187
+ $primary: #07c160;
188
+ $primary-dark: #06ad56;
189
+ $text-1: #111111;
190
+ $text-2: #555555;
191
+ $text-3: #888888;
192
+ $border: #d0d0d0;
193
+ $bg-page: #f2f2f2;
194
+ $bg-card: #ffffff;
195
+
196
+ .login-popup {
197
+ background-color: $bg-card !important;
198
+ border-radius: 32rpx 32rpx 0 0 !important;
199
+ overflow: hidden;
200
+ }
201
+
202
+ .popup-header {
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: space-between;
206
+ padding: 36rpx 40rpx 28rpx;
207
+ background: $bg-card;
208
+
209
+ .header-info {
210
+ flex: 1;
211
+
212
+ .header-title {
213
+ font-size: 36rpx;
214
+ font-weight: 700;
215
+ color: $text-1;
216
+ margin: 0;
217
+ letter-spacing: 1rpx;
218
+ }
219
+ }
220
+
221
+ .header-close {
222
+ width: 56rpx;
223
+ height: 56rpx;
224
+ display: flex;
225
+ align-items: center;
226
+ justify-content: center;
227
+ background: $bg-page;
228
+ border-radius: 50%;
229
+
230
+ .close-icon {
231
+ font-size: 28rpx;
232
+ color: $text-3;
233
+ line-height: 1;
234
+ margin-top: -2rpx;
235
+ }
236
+ }
237
+ }
238
+
239
+ .popup-body {
240
+ padding: 20rpx 48rpx 56rpx;
241
+ background: $bg-card;
242
+ }
243
+
244
+ .avatar-section {
245
+ display: flex;
246
+ flex-direction: column;
247
+ align-items: center;
248
+ margin-bottom: 48rpx;
249
+
250
+ .avatar-wrapper {
251
+ position: relative;
252
+ margin: 0;
253
+ padding: 0;
254
+ background: none;
255
+ border: none;
256
+ line-height: 1;
257
+
258
+ .avatar-img {
259
+ width: 120rpx;
260
+ height: 120rpx;
261
+ border-radius: 50%;
262
+ border: 4rpx solid $border;
263
+ display: block;
264
+ }
265
+
266
+ .avatar-badge {
267
+ position: absolute;
268
+ right: 0;
269
+ bottom: 0;
270
+ width: 36rpx;
271
+ height: 36rpx;
272
+ background: $primary;
273
+ border-radius: 50%;
274
+ border: 3rpx solid $bg-card;
275
+ display: flex;
276
+ align-items: center;
277
+ justify-content: center;
278
+
279
+ .badge-icon {
280
+ font-size: 16rpx;
281
+ color: #fff;
282
+ }
283
+ }
284
+ }
285
+
286
+ .avatar-tip {
287
+ margin-top: 16rpx;
288
+ font-size: 20rpx;
289
+ color: $text-3;
290
+ }
291
+ }
292
+
293
+ .name-section {
294
+ margin-bottom: 36rpx;
295
+
296
+ .name-field {
297
+ display: flex;
298
+ align-items: center;
299
+ background: $bg-page;
300
+ border-radius: 20rpx;
301
+ padding: 0 28rpx;
302
+ height: 88rpx;
303
+ border: 2rpx solid transparent;
304
+ transition: border-color 0.25s, background-color 0.25s;
305
+
306
+ .field-icon {
307
+ font-size: 32rpx;
308
+ margin-right: 16rpx;
309
+ flex-shrink: 0;
310
+ }
311
+
312
+ .name-input {
313
+ flex: 1;
314
+ min-width: 0;
315
+ font-size: 28rpx;
316
+ color: $text-1;
317
+ background: transparent;
318
+ border: none;
319
+ outline: none;
320
+ height: 80rpx;
321
+ line-height: 80rpx;
322
+ padding: 0;
323
+ }
324
+
325
+ .name-input::placeholder {
326
+ font-size: 28rpx;
327
+ color: $text-3;
328
+ }
329
+ }
330
+
331
+ .name-field:focus-within {
332
+ border-color: $primary;
333
+ background: $bg-card;
334
+ }
335
+ }
336
+
337
+ .agreement-row {
338
+ margin-bottom: 48rpx;
339
+ padding: 0 4rpx;
340
+
341
+ .agreement-check {
342
+ font-size: 24rpx;
343
+
344
+ .agreement-text {
345
+ color: $text-3;
346
+ font-size: 24rpx;
347
+ }
348
+
349
+ .agreement-link {
350
+ color: $primary;
351
+ font-size: 24rpx;
352
+ }
353
+ }
354
+ }
355
+
356
+ .action-area {
357
+ display: flex;
358
+ flex-direction: column;
359
+ align-items: center;
360
+
361
+ .btn-login {
362
+ width: 100%;
363
+ height: 88rpx;
364
+ border-radius: 44rpx;
365
+ font-size: 30rpx;
366
+ font-weight: 600;
367
+ letter-spacing: 2rpx;
368
+ background-color: $primary;
369
+ color: #fff;
370
+
371
+ &.btn-disabled {
372
+ opacity: 0.5;
373
+ }
374
+ }
375
+
376
+ .btn-cancel {
377
+ margin-top: 28rpx;
378
+ padding: 16rpx 32rpx;
379
+
380
+ .cancel-text {
381
+ font-size: 26rpx;
382
+ color: $text-3;
383
+ }
384
+ }
385
+ }
386
+
387
+ :deep(.cube-button--primary) {
388
+ background-color: $primary;
389
+ border: none;
390
+
391
+ &:active {
392
+ background-color: $primary-dark;
393
+ }
394
+ }
395
+
396
+ :deep(.cube-checkbox__input) {
397
+ margin-right: 8rpx;
398
+ }
399
+
400
+ :deep(.cube-checkbox__content) {
401
+ font-size: 20rpx;
402
+ line-height: 1.5;
403
+ }
404
+ </style>
405
+
406
+ <script type="application/json">
407
+ {
408
+ "component": true,
409
+ "usingComponents": {
410
+ "cube-modal": "@mpxjs/mpx-cube-ui/lib/components/modal/index.mpx",
411
+ "cube-button": "@mpxjs/mpx-cube-ui/lib/components/button/index.mpx",
412
+ "cube-checkbox": "@mpxjs/mpx-cube-ui/lib/components/checkbox/index.mpx",
413
+ "cube-checkbox-group": "@mpxjs/mpx-cube-ui/lib/components/checkbox-group/index.mpx"
414
+ }
415
+ }
416
416
  </script>