@uxda/appkit 4.1.54 → 4.1.56

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.
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <scroll-view :scroll-y="!userState.visible && !avatarVisible" class="user-info">
2
+ <scroll-view
3
+ :scroll-y="!userState.visible && !avatarVisible"
4
+ class="user-info"
5
+ >
3
6
  <DdSkeleton v-if="firstLoading" :row="3"></DdSkeleton>
4
7
  <div v-else class="user-info-wrap">
5
8
  <div class="user-info-tit">账号信息</div>
@@ -34,11 +37,25 @@
34
37
  :desc="encodePhone(userInfo.mobile || '')"
35
38
  @click="toBinding"
36
39
  />
40
+ <nut-cell title="昵称" :desc="userInfo?.nickName || '--'" />
41
+ <nut-cell title="认证信息" is-link @click="toAuth">
42
+ <template #desc>
43
+ <span v-if="userInfo?.verifyResult == 1">已认证</span>
44
+ <span v-if="userInfo?.verifyResult == 0" style="color: #e8523f"
45
+ >已失效,重新认证</span
46
+ >
47
+ <span v-else style="color: #017fff">未认证,去认证</span>
48
+ </template>
49
+ </nut-cell>
37
50
  </div>
38
51
 
39
52
  <div class="user-info-tit">企业/团队</div>
40
53
  <div class="user-info-team">
41
- <div v-for="(item, key) in userInfo.tenantInfoList" :key="key" class="user-info-team-item">
54
+ <div
55
+ v-for="(item, key) in userInfo.tenantInfoList"
56
+ :key="key"
57
+ class="user-info-team-item"
58
+ >
42
59
  <div class="user-info-team-item-avatar">
43
60
  <img
44
61
  v-if="item.tenantLogo"
@@ -65,7 +82,10 @@
65
82
  >
66
83
  {{ aitem.appAbbr }}
67
84
  </div>
68
- <div class="user-info-team-item-role-btn" @click="toShowRole(item)">
85
+ <div
86
+ class="user-info-team-item-role-btn"
87
+ @click="toShowRole(item)"
88
+ >
69
89
  角色详情
70
90
  <img
71
91
  :class="{ showRole: item.showRole }"
@@ -81,7 +101,9 @@
81
101
  v-for="(aitem, akey) in item.appRoleInfo || []"
82
102
  :key="akey"
83
103
  >
84
- <div class="user-info-team-item-role-item-name">{{ aitem.appAbbr }}</div>
104
+ <div class="user-info-team-item-role-item-name">
105
+ {{ aitem.appAbbr }}
106
+ </div>
85
107
  <div class="user-info-team-item-role-item-info">
86
108
  {{ aitem.roleName }}
87
109
  </div>
@@ -130,12 +152,24 @@
130
152
  v-model:visible="userState.visible"
131
153
  @cancel="onUserNameCancel"
132
154
  >
133
- <nut-input :max-length="20" placeholder="请输入新的用户名" v-model="userState.value" />
155
+ <nut-input
156
+ :max-length="20"
157
+ placeholder="请输入新的用户名"
158
+ v-model="userState.value"
159
+ />
134
160
  <template #footer>
135
- <nut-button class="change-username-popup-cancel" type="default" @click="onUserNameCancel">
161
+ <nut-button
162
+ class="change-username-popup-cancel"
163
+ type="default"
164
+ @click="onUserNameCancel"
165
+ >
136
166
  取消
137
167
  </nut-button>
138
- <nut-button class="change-username-popup-ok" type="primary" @click="onUserNameOk">
168
+ <nut-button
169
+ class="change-username-popup-ok"
170
+ type="primary"
171
+ @click="onUserNameOk"
172
+ >
139
173
  确定
140
174
  </nut-button>
141
175
  </template>
@@ -169,78 +203,78 @@
169
203
  </template>
170
204
 
171
205
  <script lang="ts" setup>
172
- import Taro, { useDidShow } from '@tarojs/taro'
173
- import { ref, onMounted, reactive, onUnmounted } from 'vue'
174
- import { useAppKitOptions } from '../../Appkit'
175
- import { useEncode } from '../../shared/composables/useEncode'
176
- import DdSkeleton from '../../components/dd-skeleton/index.vue'
177
- import { useHttp } from '../api'
206
+ import Taro, { useDidShow } from "@tarojs/taro";
207
+ import { ref, onMounted, reactive, onUnmounted } from "vue";
208
+ import { useAppKitOptions } from "../../Appkit";
209
+ import { useEncode } from "../../shared/composables/useEncode";
210
+ import DdSkeleton from "../../components/dd-skeleton/index.vue";
211
+ import { useHttp } from "../api";
178
212
 
179
213
  const props = withDefaults(
180
214
  defineProps<{
181
- miniType?: string
182
- app?: string
183
- userId: string
215
+ miniType?: string;
216
+ app?: string;
217
+ userId: string;
184
218
  }>(),
185
219
  {
186
- miniType: '05',
187
- app: '',
188
- userId: '',
220
+ miniType: "05",
221
+ app: "",
222
+ userId: "",
189
223
  }
190
- )
224
+ );
191
225
 
192
- const { encodePhone } = useEncode()
226
+ const { encodePhone } = useEncode();
193
227
 
194
228
  useDidShow(() => {
195
- getUserInfoByUserId()
196
- })
229
+ getUserInfoByUserId();
230
+ });
197
231
  onMounted(() => {
198
- Taro.eventCenter.on('USER-HEAD-CROP-OK', updateImage)
199
- })
232
+ Taro.eventCenter.on("USER-HEAD-CROP-OK", updateImage);
233
+ });
200
234
  onUnmounted(() => {
201
- Taro.eventCenter.off('USER-HEAD-CROP-OK')
202
- })
235
+ Taro.eventCenter.off("USER-HEAD-CROP-OK");
236
+ });
203
237
 
204
- const firstLoading = ref(true)
205
- const userInfo = ref<any>({})
238
+ const firstLoading = ref(true);
239
+ const userInfo = ref<any>({});
206
240
  // 根据用户id,查询用户所在租户列表
207
241
  function getUserInfoByUserId() {
208
- const $http = useHttp()
242
+ const $http = useHttp();
209
243
 
210
244
  $http
211
245
  .get(`/cas/sysAccount/getAccountInfo/${props.userId}`)
212
246
  .then((result: any) => {
213
- userInfo.value = result
214
- firstLoading.value = false
247
+ userInfo.value = result;
248
+ firstLoading.value = false;
215
249
  })
216
250
  .catch(() => {
217
- firstLoading.value = false
218
- })
251
+ firstLoading.value = false;
252
+ });
219
253
  }
220
254
 
221
255
  // 修改头像弹框
222
- const avatarVisible = ref(false)
256
+ const avatarVisible = ref(false);
223
257
 
224
258
  // 去上传头像
225
259
  async function toUpload() {
226
260
  if (!userInfo.value.avatar) {
227
261
  const profile = await Taro.getUserProfile({
228
- desc: '头像用于改变默认头像',
229
- })
262
+ desc: "头像用于改变默认头像",
263
+ });
230
264
 
231
265
  const res = await Taro.downloadFile({
232
266
  url: profile.userInfo.avatarUrl,
233
- })
267
+ });
234
268
 
235
- updateImage(res.tempFilePath)
269
+ updateImage(res.tempFilePath);
236
270
  } else {
237
271
  let res = await Taro.chooseImage({
238
272
  count: 1,
239
- })
273
+ });
240
274
  if (res.tempFilePaths) {
241
- const filePath = res.tempFilePaths[0]
275
+ const filePath = res.tempFilePaths[0];
242
276
 
243
- emits('crop', filePath)
277
+ emits("crop", filePath);
244
278
  }
245
279
  }
246
280
  }
@@ -248,15 +282,15 @@ async function toUpload() {
248
282
  // 上传图片
249
283
  async function updateImage(filePath: string) {
250
284
  Taro.showLoading({
251
- title: '上传中...',
252
- })
253
- const appkitOptions = useAppKitOptions()
254
- const $http = useHttp()
285
+ title: "上传中...",
286
+ });
287
+ const appkitOptions = useAppKitOptions();
288
+ const $http = useHttp();
255
289
 
256
290
  let Res: any = await Taro.uploadFile({
257
291
  url: `${appkitOptions.baseUrl()}/cas/file/uploadImg`,
258
292
  filePath: filePath,
259
- name: 'file',
293
+ name: "file",
260
294
  formData: {
261
295
  objectNo: `${userInfo.value.mobile}${Date.now()}`,
262
296
  objectTypeCode: `MINI_HEADIMAGE${props.miniType}`,
@@ -264,110 +298,122 @@ async function updateImage(filePath: string) {
264
298
  header: {
265
299
  token: appkitOptions.tempToken() || appkitOptions.token(),
266
300
  },
267
- })
268
- avatarVisible.value = false
301
+ });
302
+ avatarVisible.value = false;
269
303
 
270
- const res = JSON.parse(Res.data)
304
+ const res = JSON.parse(Res.data);
271
305
  if (res.success) {
272
306
  $http
273
- .post('/cas/sysUser/update', {
307
+ .post("/cas/sysUser/update", {
274
308
  appCode: props.app,
275
309
  avatar: res.result,
276
310
  userId: props.userId,
277
311
  })
278
312
  .then(() => {
279
- Taro.hideLoading()
280
- Taro.showToast({ title: '头像上传成功', icon: 'none' })
281
- getUserInfoByUserId()
282
- emits('avatar-success', res.result)
313
+ Taro.hideLoading();
314
+ Taro.showToast({ title: "头像上传成功", icon: "none" });
315
+ getUserInfoByUserId();
316
+ emits("avatar-success", res.result);
283
317
  })
284
318
  .catch(() => {
285
- Taro.hideLoading()
286
- })
319
+ Taro.hideLoading();
320
+ });
287
321
  } else {
288
- Taro.hideLoading()
322
+ Taro.hideLoading();
289
323
  }
290
324
  }
291
325
 
292
326
  // 查看角色详情
293
327
  function toShowRole(item: any) {
294
- item.showRole = !item.showRole
328
+ item.showRole = !item.showRole;
295
329
  }
296
330
 
297
331
  // 更换用户名
298
332
  const userState = reactive({
299
333
  visible: false,
300
- value: '',
301
- oldName: '',
302
- tenantId: '',
303
- })
334
+ value: "",
335
+ oldName: "",
336
+ tenantId: "",
337
+ });
304
338
  function toUserNameChange(item: any) {
305
- userState.visible = true
306
- userState.oldName = item.fullName
307
- userState.tenantId = item.tenantId
339
+ userState.visible = true;
340
+ userState.oldName = item.fullName;
341
+ userState.tenantId = item.tenantId;
308
342
  }
309
343
  function onUserNameCancel() {
310
- userState.visible = false
311
- userState.value = ''
312
- userState.oldName = ''
313
- userState.tenantId = ''
344
+ userState.visible = false;
345
+ userState.value = "";
346
+ userState.oldName = "";
347
+ userState.tenantId = "";
314
348
  }
315
349
  function onUserNameOk() {
316
350
  if (!userState.value) {
317
351
  return Taro.showToast({
318
- title: '请输入用户名',
319
- icon: 'none',
320
- })
352
+ title: "请输入用户名",
353
+ icon: "none",
354
+ });
321
355
  }
322
356
  if (userState.value === userState.oldName) {
323
357
  return Taro.showToast({
324
- title: '用户名不能与原用户名相同',
325
- icon: 'none',
326
- })
358
+ title: "用户名不能与原用户名相同",
359
+ icon: "none",
360
+ });
327
361
  }
328
362
 
329
- const $http = useHttp()
363
+ const $http = useHttp();
330
364
 
331
365
  $http
332
- .post('/cas/sysUser/updateUserInfoByTenantId', {
366
+ .post("/cas/sysUser/updateUserInfoByTenantId", {
333
367
  fullName: userState.value,
334
368
  tenantId: userState.tenantId,
335
369
  userId: props.userId,
336
370
  })
337
371
  .then(() => {
338
- Taro.showToast({ title: '用户名修改成功', icon: 'none' })
339
- getUserInfoByUserId()
340
- onUserNameCancel()
341
- emits('username-success')
342
- })
372
+ Taro.showToast({ title: "用户名修改成功", icon: "none" });
373
+ getUserInfoByUserId();
374
+ onUserNameCancel();
375
+ emits("username-success");
376
+ });
343
377
  }
344
378
 
345
379
  // 退出登录
346
380
  function toLogout() {
347
381
  Taro.showModal({
348
- title: '提示',
349
- content: '确定要退出登录吗?',
350
- confirmText: '确定',
382
+ title: "提示",
383
+ content: "确定要退出登录吗?",
384
+ confirmText: "确定",
351
385
  success: async (e: any) => {
352
386
  if (e.confirm) {
353
- emits('logout')
387
+ emits("logout");
354
388
  }
355
389
  },
356
- })
390
+ });
357
391
  }
358
392
 
359
393
  // 去绑定手机号
360
394
  function toBinding() {
361
- emits('binding', userInfo.value.mobile || '')
395
+ emits("binding", userInfo.value.mobile || "");
396
+ }
397
+
398
+ // 去认证页
399
+ function toAuth() {
400
+ emits("auth", props.userId);
362
401
  }
363
402
 
364
403
  // 父组件事件
365
- const emits = defineEmits(['avatar-success', 'logout', 'crop', 'binding', 'username-success'])
404
+ const emits = defineEmits([
405
+ "avatar-success",
406
+ "logout",
407
+ "crop",
408
+ "binding",
409
+ "username-success",
410
+ "auth",
411
+ ]);
366
412
 
367
413
  // 外部访问
368
414
  defineExpose({
369
415
  updateImage,
370
- })
416
+ });
371
417
  </script>
372
418
 
373
419
  <style lang="scss">
@@ -380,6 +426,7 @@ defineExpose({
380
426
  box-sizing: border-box;
381
427
  min-height: 100%;
382
428
  }
429
+
383
430
  &-tit {
384
431
  height: 38px;
385
432
  display: flex;
@@ -388,22 +435,26 @@ defineExpose({
388
435
  font-size: 12px;
389
436
  padding-left: 10px;
390
437
  }
438
+
391
439
  &-head {
392
440
  border-radius: 5px;
393
441
  background: #fff;
394
442
  padding: 30px 11px 0;
443
+
395
444
  &-avatar {
396
445
  position: relative;
397
446
  width: 80px;
398
447
  height: 80px;
399
448
  margin: 0 auto 25px;
400
449
  }
450
+
401
451
  &-img {
402
452
  width: 100%;
403
453
  height: 100%;
404
454
  overflow: hidden;
405
455
  border-radius: 50%;
406
456
  }
457
+
407
458
  &-upload {
408
459
  position: absolute;
409
460
  bottom: -2px;
@@ -416,12 +467,14 @@ defineExpose({
416
467
  display: flex;
417
468
  align-items: center;
418
469
  justify-content: center;
470
+
419
471
  &-icon {
420
472
  width: 17px;
421
473
  height: 17px;
422
474
  }
423
475
  }
424
476
  }
477
+
425
478
  &-team {
426
479
  &-item {
427
480
  border-radius: 5px;
@@ -429,6 +482,7 @@ defineExpose({
429
482
  display: flex;
430
483
  padding: 15px;
431
484
  margin-bottom: 10px;
485
+
432
486
  &-avatar {
433
487
  width: 38px;
434
488
  height: 38px;
@@ -438,24 +492,29 @@ defineExpose({
438
492
  display: flex;
439
493
  align-items: center;
440
494
  justify-content: center;
495
+
441
496
  &-img {
442
497
  width: 100%;
443
498
  height: 100%;
444
499
  }
500
+
445
501
  .empty {
446
502
  width: 20px;
447
503
  height: 40px;
448
504
  }
449
505
  }
506
+
450
507
  &-title {
451
508
  font-size: 16px;
452
509
  font-weight: 500;
453
510
  margin-bottom: 5px;
454
511
  }
512
+
455
513
  &-app {
456
514
  display: flex;
457
515
  align-items: center;
458
516
  flex-wrap: wrap;
517
+
459
518
  &-tag {
460
519
  border: 1px solid rgba(53, 53, 53, 0.2);
461
520
  font-size: 10px;
@@ -468,69 +527,83 @@ defineExpose({
468
527
  margin: 0 10px 6px 0;
469
528
  }
470
529
  }
530
+
471
531
  &-bd {
472
532
  flex: 1;
473
533
  }
534
+
474
535
  &-role {
475
536
  padding: 10px;
476
537
  background: rgba(245, 245, 245, 0.5);
477
538
  border-radius: 5px;
478
539
  margin-bottom: 10px;
540
+
479
541
  &-btn {
480
542
  color: var(--app-primary-color, #017fff);
481
543
  font-size: 10px;
482
544
  display: inline-flex;
483
545
  align-items: center;
484
546
  margin-bottom: 6px;
547
+
485
548
  &-icon {
486
549
  width: 12px;
487
550
  height: 12px;
488
551
  position: relative;
489
552
  top: 1px;
553
+
490
554
  &.showRole {
491
555
  transform: rotate(180deg);
492
556
  }
493
557
  }
494
558
  }
559
+
495
560
  &-item {
496
561
  display: flex;
497
562
  font-size: 10px;
498
563
  margin-bottom: 10px;
564
+
499
565
  &:last-child {
500
566
  margin-bottom: 0;
501
567
  }
568
+
502
569
  &-name {
503
570
  opacity: 0.5;
504
571
  white-space: nowrap;
505
572
  margin-right: 10px;
506
573
  min-width: 40px;
507
574
  }
575
+
508
576
  &-info {
509
577
  flex: 1;
510
578
  color: #1a1a1a;
511
579
  }
512
580
  }
513
581
  }
582
+
514
583
  &-user {
515
584
  margin-bottom: 4px;
516
585
  font-size: 12px;
517
586
  display: flex;
518
587
  align-items: center;
588
+
519
589
  &-icon {
520
590
  width: 10px;
521
591
  height: 10px;
522
592
  margin-left: 4px;
523
593
  }
524
594
  }
595
+
525
596
  &-dept {
526
597
  display: flex;
527
598
  flex-wrap: wrap;
528
599
  font-size: 10px;
529
600
  color: rgba(26, 26, 26, 0.8);
601
+
530
602
  &-item {
531
603
  font-size: 10px;
532
604
  color: rgba(26, 26, 26, 0.5);
533
605
  margin: 4px 10px 4px 0;
606
+
534
607
  &:first-child {
535
608
  color: rgba(26, 26, 26, 0.8);
536
609
  }
@@ -553,16 +626,19 @@ defineExpose({
553
626
  box-shadow: none;
554
627
  border-bottom: 1px solid #f0f0f0;
555
628
  font-size: 16px;
629
+
556
630
  .nut-cell__value {
557
631
  font-size: 16px;
558
632
  color: #000;
559
633
  }
634
+
560
635
  .nut-cell__link {
561
636
  color: #ccc;
562
637
  margin-left: 8px;
563
638
  }
564
639
  }
565
640
  }
641
+
566
642
  .upload-avatar-popup {
567
643
  &-box {
568
644
  display: flex;
@@ -570,6 +646,7 @@ defineExpose({
570
646
  align-items: center;
571
647
  justify-content: center;
572
648
  }
649
+
573
650
  &-avatar {
574
651
  width: 320px;
575
652
  height: 320px;
@@ -577,6 +654,7 @@ defineExpose({
577
654
  border-radius: 50%;
578
655
  margin-bottom: 50px;
579
656
  }
657
+
580
658
  &-btn {
581
659
  width: 106px;
582
660
  height: 37px;
@@ -589,10 +667,12 @@ defineExpose({
589
667
  font-size: 16px;
590
668
  }
591
669
  }
670
+
592
671
  .change-username-popup {
593
672
  .nut-dialog {
594
673
  min-height: auto;
595
674
  }
675
+
596
676
  .nut-input {
597
677
  height: 40px;
598
678
  padding: 0;
@@ -600,11 +680,13 @@ defineExpose({
600
680
  align-items: center;
601
681
  font-size: 16px;
602
682
  border: none;
683
+
603
684
  .input-text {
604
685
  width: 100%;
605
686
  height: 100%;
606
687
  font-size: 14px;
607
688
  }
689
+
608
690
  .nut-input-value,
609
691
  .nut-input-inner,
610
692
  .nut-input-box {
@@ -613,20 +695,24 @@ defineExpose({
613
695
  background: #f5f5f5;
614
696
  border-radius: 6px;
615
697
  }
698
+
616
699
  .nut-placeholder {
617
700
  color: #cccccc;
618
701
  line-height: 38px;
619
702
  height: 38px;
620
703
  }
704
+
621
705
  .nut-input-box {
622
706
  padding: 0 15px;
623
707
  }
624
708
  }
709
+
625
710
  &-cancel.nut-button {
626
711
  border-radius: 15px;
627
712
  font-size: 14px;
628
713
  height: 30px;
629
714
  }
715
+
630
716
  &-ok.nut-button {
631
717
  background: var(--app-primary-color, #017fff);
632
718
  height: 30px;
@@ -7,6 +7,7 @@ import UserFeedback from './UserFeedback.vue'
7
7
  import UserFeedbackEntry from './UserFeedbackEntry.vue'
8
8
  import LoginSetting from './LoginSetting.vue'
9
9
  import UserResourceEmpty from './UserResourceEmpty.vue'
10
+ import UserAuth from './UserAuth.vue'
10
11
 
11
12
  export {
12
13
  UserEntry,
@@ -18,4 +19,5 @@ export {
18
19
  UserFeedbackEntry,
19
20
  LoginSetting,
20
21
  UserResourceEmpty,
22
+ UserAuth,
21
23
  }