@uxda/appkit 4.1.62 → 4.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.1.62",
3
+ "version": "4.2.2",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -35,6 +35,7 @@
35
35
  "@tarojs/taro": "^4.0.0",
36
36
  "@types/wechat-miniprogram": "^3.4.7",
37
37
  "dayjs": "^1.11.10",
38
+ "lodash-es": "^4.17.21",
38
39
  "validator": "^13.12.0",
39
40
  "vue": "^3.5.0"
40
41
  },
@@ -62,6 +63,7 @@
62
63
  "rollup-plugin-esbuild": "^6.1.0",
63
64
  "rollup-plugin-postcss": "^4.0.2",
64
65
  "rollup-plugin-scss": "^4.0.0",
66
+ "rollup-plugin-visualizer": "^5.12.0",
65
67
  "rollup-plugin-vue": "^6.0.0",
66
68
  "style-loader": "^4.0.0",
67
69
  "stylelint": "^16.8.2",
package/rollup.config.mjs CHANGED
@@ -5,6 +5,7 @@ import postcss from 'rollup-plugin-postcss'
5
5
  import atImport from 'postcss-import'
6
6
  import NutUIResolver from '@nutui/auto-import-resolver'
7
7
  import Components from 'unplugin-vue-components/rollup'
8
+ import { visualizer } from "rollup-plugin-visualizer"
8
9
 
9
10
  export default [
10
11
  {
@@ -38,8 +39,18 @@ export default [
38
39
  Components({
39
40
  resolvers: [NutUIResolver({ taro: true })],
40
41
  }),
42
+ visualizer(),
43
+ ],
44
+ external: [
45
+ 'vue',
46
+ '@tarojs/components',
47
+ '@tarojs/shared',
48
+ '@nutui/nutui',
49
+ '@nutui/nutui-taro',
50
+ '@uxda/nutshell',
51
+ 'dayjs',
52
+ 'validator',
41
53
  ],
42
- external: ['vue', '@nutui/nutui-taro'],
43
54
  },
44
55
  // {
45
56
  // input: './src/main.scss',
@@ -129,7 +129,7 @@ import { AppDrawer, PageHeader, WithPaging } from '../../shared'
129
129
  import dayjs from 'dayjs'
130
130
  import EmptyView from '../../shared/components/EmptyView.vue'
131
131
  import Tip from './Tip.vue'
132
- import groupBy from 'lodash/groupBy'
132
+ import groupBy from 'lodash-es/groupBy'
133
133
  import { useAmount } from '../../shared/composables/useAmount'
134
134
 
135
135
  const refreshing = ref(false)
@@ -253,6 +253,7 @@ async function loadConsumptions(append: boolean = false) {
253
253
  } else {
254
254
  reachedLastPage.value = false
255
255
  }
256
+ }).finally(() => {
256
257
  Taro.hideLoading()
257
258
  })
258
259
  }
@@ -592,11 +593,11 @@ onMounted(() => {
592
593
 
593
594
  .operation-scroll {
594
595
  height: calc(100vh - 130px);
595
- padding: 0 15px;
596
596
  box-sizing: border-box;
597
597
  }
598
598
 
599
599
  .box {
600
+ padding: 0 10px;
600
601
  &-detail {
601
602
  .title {
602
603
  line-height: 22px;
@@ -40,7 +40,7 @@ import DdNoticeBar from '../../components/dd-notice-bar/index.vue'
40
40
  import NoticePopup from './NoticePopup.vue'
41
41
  import Taro from '@tarojs/taro'
42
42
  import { useNotice } from './useNotice'
43
- import debounce from 'lodash/debounce'
43
+ import debounce from 'lodash-es/debounce'
44
44
  import { useSafeArea } from '../../shared/composables'
45
45
 
46
46
  const props = withDefaults(
@@ -15,7 +15,7 @@ import { ref } from 'vue'
15
15
  import { useHttp } from '../api'
16
16
  import { useAppKitOptions } from '../../Appkit'
17
17
  import Taro, { useDidShow } from '@tarojs/taro'
18
- import debounce from 'lodash/debounce'
18
+ import debounce from 'lodash-es/debounce'
19
19
 
20
20
  const props = withDefaults(
21
21
  defineProps<{
@@ -14,7 +14,7 @@ import DdNoticeBar from '../../components/dd-notice-bar/index.vue'
14
14
  import { useSafeArea } from '../composables'
15
15
  import Taro from '@tarojs/taro'
16
16
  import { useHttp } from '../../balance/api'
17
- import debounce from 'lodash/debounce'
17
+ import debounce from 'lodash-es/debounce'
18
18
 
19
19
  const showAlert = ref(false)
20
20
  const safeArea = useSafeArea()
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * 通用表单校验器
3
3
  */
4
- import { isMobilePhone, isIdentityCard } from 'validator'
4
+ import isMobilePhone from 'validator/es/lib/isMobilePhone'
5
+ import isIdentityCard from 'validator/es/lib/isIdentityCard'
5
6
 
6
7
  export function useValidator() {
7
8
  // 身份证号码校验
@@ -16,7 +16,7 @@ import { useHttp } from '../api'
16
16
  import { useAppKitOptions } from '../../Appkit'
17
17
  import { useSafeArea } from '../../shared/composables'
18
18
  import { useDidShow } from '@tarojs/taro'
19
- import debounce from 'lodash/debounce'
19
+ import debounce from 'lodash-es/debounce'
20
20
 
21
21
  const props = withDefaults(
22
22
  defineProps<{
@@ -12,7 +12,7 @@
12
12
  :rules="['required']"
13
13
  >
14
14
  <template #append>
15
- <ocr-icon @complete="onOcrComplete" />
15
+ <ocr-icon v-if="!已认证" @complete="onOcrComplete" />
16
16
  </template>
17
17
  </ns-input>
18
18
  <ns-input
@@ -36,6 +36,7 @@
36
36
  placeholder="请输入电话号码"
37
37
  :maxlength="11"
38
38
  v-model="formData.电话号码"
39
+ :disabled="true"
39
40
  :rules="[
40
41
  {
41
42
  name: 'function',
@@ -76,7 +77,7 @@
76
77
  </template>
77
78
 
78
79
  <script lang="ts" setup>
79
- import { reactive, ref } from "vue";
80
+ import { reactive, ref, watch } from "vue";
80
81
  import {
81
82
  NsForm,
82
83
  NsInput,
@@ -89,22 +90,27 @@ import {
89
90
  import { OcrIcon } from "../../shared/components";
90
91
  import Taro from "@tarojs/taro";
91
92
  import { useNutshell } from "@uxda/nutshell/taro";
92
- import { isIdentityCard, isMobilePhone } from "validator";
93
+ import isMobilePhone from 'validator/es/lib/isMobilePhone'
94
+ import isIdentityCard from 'validator/es/lib/isIdentityCard'
93
95
  import { useHttp } from "../api";
94
96
 
95
97
  const props = withDefaults(
96
98
  defineProps<{
97
99
  userId: string;
100
+ verifyResult: number;
101
+ mobile: string;
98
102
  }>(),
99
103
  {
104
+ verifyResult: -1,
100
105
  userId: "",
106
+ mobile: "",
101
107
  }
102
108
  );
103
109
 
104
110
  const formRef = ref(),
105
111
  $n = useNutshell();
106
112
 
107
- const formData = reactive({
113
+ let formData = reactive({
108
114
  姓名: "",
109
115
  身份证号码: "",
110
116
  电话号码: "",
@@ -157,6 +163,22 @@ async function toSubmit() {
157
163
  Taro.showToast({ title: err?.errMsg || "认证失败", icon: "none" });
158
164
  });
159
165
  }
166
+ watch(
167
+ () => props.verifyResult,
168
+ () => {
169
+ if (props.verifyResult == 1) {
170
+ 已认证.value = true;
171
+ }
172
+ },
173
+ { deep: true, immediate: true }
174
+ );
175
+ watch(
176
+ () => props.mobile,
177
+ () => {
178
+ formData.电话号码 = props.mobile;
179
+ },
180
+ { deep: true, immediate: true }
181
+ );
160
182
 
161
183
  const emits = defineEmits(["toAgreement"]);
162
184
  </script>
@@ -37,14 +37,23 @@
37
37
  :desc="encodePhone(userInfo.mobile || '')"
38
38
  @click="toBinding"
39
39
  />
40
- <nut-cell title="昵称" :desc="userInfo?.nickName || '--'" />
40
+ <nut-cell
41
+ title="昵称"
42
+ is-link
43
+ @click="onNickNameChange"
44
+ :desc="userInfo?.nickName || '--'"
45
+ />
41
46
  <nut-cell title="认证信息" is-link @click="toAuth">
42
47
  <template #desc>
43
48
  <span v-if="userInfo?.verifyResult == 1">已认证</span>
44
49
  <span v-if="userInfo?.verifyResult == 0" style="color: #e8523f"
45
50
  >已失效,重新认证</span
46
51
  >
47
- <span v-else style="color: #017fff">未认证,去认证</span>
52
+ <span
53
+ v-if="userInfo?.verifyResult != 0 && userInfo?.verifyResult != 1"
54
+ style="color: #017fff"
55
+ >未认证,去认证</span
56
+ >
48
57
  </template>
49
58
  </nut-cell>
50
59
  </div>
@@ -175,6 +184,46 @@
175
184
  </template>
176
185
  </nut-dialog>
177
186
 
187
+ <!-- 修改昵称弹框 -->
188
+ <nut-dialog
189
+ title="输入新的昵称"
190
+ :border="false"
191
+ pop-class="change-username-popup"
192
+ v-model:visible="nickNameState.visible"
193
+ @cancel="onNickNameCancel"
194
+ >
195
+ <input
196
+ v-model="nickNameState.value"
197
+ style="
198
+ background: #f5f5f5;
199
+ border-radius: 6px;
200
+ line-height: 40px;
201
+ padding: 10px 25px;
202
+ font-size: 16px;
203
+ "
204
+ :max-length="20"
205
+ placeholder="请输入新的昵称"
206
+ type="nickname"
207
+ />
208
+
209
+ <template #footer>
210
+ <nut-button
211
+ class="change-username-popup-cancel"
212
+ type="default"
213
+ @click="onNickNameCancel"
214
+ >
215
+ 取消
216
+ </nut-button>
217
+ <nut-button
218
+ class="change-username-popup-ok"
219
+ type="primary"
220
+ @click="onNickNameOk"
221
+ >
222
+ 确定
223
+ </nut-button>
224
+ </template>
225
+ </nut-dialog>
226
+
178
227
  <!-- 修改头像弹框 -->
179
228
  <nut-popup
180
229
  pop-class="upload-avatar-popup"
@@ -328,6 +377,10 @@ function toShowRole(item: any) {
328
377
  item.showRole = !item.showRole;
329
378
  }
330
379
 
380
+ const nickNameState = reactive({
381
+ visible: false,
382
+ value: "",
383
+ });
331
384
  // 更换用户名
332
385
  const userState = reactive({
333
386
  visible: false,
@@ -346,6 +399,15 @@ function onUserNameCancel() {
346
399
  userState.oldName = "";
347
400
  userState.tenantId = "";
348
401
  }
402
+
403
+ function onNickNameCancel() {
404
+ nickNameState.visible = false;
405
+ nickNameState.value = "";
406
+ }
407
+ function onNickNameChange() {
408
+ nickNameState.visible = true;
409
+ nickNameState.value = "";
410
+ }
349
411
  function onUserNameOk() {
350
412
  if (!userState.value) {
351
413
  return Taro.showToast({
@@ -376,6 +438,33 @@ function onUserNameOk() {
376
438
  });
377
439
  }
378
440
 
441
+ function onNickNameOk() {
442
+ if (!nickNameState.value) {
443
+ return Taro.showToast({
444
+ title: "请输入昵称",
445
+ icon: "none",
446
+ });
447
+ }
448
+ // if (userState.value === userState.oldName) {
449
+ // return Taro.showToast({
450
+ // title: "用户名不能与原用户名相同",
451
+ // icon: "none",
452
+ // });
453
+ // }
454
+
455
+ const $http = useHttp();
456
+
457
+ $http
458
+ .post("/cas/sysAccount/updateAccountInfo", {
459
+ nickName: nickNameState.value,
460
+ })
461
+ .then(() => {
462
+ Taro.showToast({ title: "昵称修改成功", icon: "none" });
463
+ getUserInfoByUserId();
464
+ onNickNameCancel();
465
+ // emits("username-success");
466
+ });
467
+ }
379
468
  // 退出登录
380
469
  function toLogout() {
381
470
  Taro.showModal({
@@ -397,7 +486,12 @@ function toBinding() {
397
486
 
398
487
  // 去认证页
399
488
  function toAuth() {
400
- emits("auth", props.userId);
489
+ emits(
490
+ "auth",
491
+ props.userId,
492
+ userInfo.value?.verifyResult,
493
+ userInfo.value?.mobile
494
+ );
401
495
  }
402
496
 
403
497
  // 父组件事件