hy-app 0.1.5 → 0.2.0

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 (166) hide show
  1. package/components/hy-address-picker/hy-address-picker.vue +11 -0
  2. package/components/hy-address-picker/index.scss +1 -1
  3. package/components/hy-avatar/hy-avatar.vue +11 -0
  4. package/components/hy-avatar/index.scss +8 -8
  5. package/components/hy-back-top/hy-back-top.vue +13 -2
  6. package/components/hy-back-top/index.scss +11 -1
  7. package/components/hy-badge/hy-badge.vue +11 -0
  8. package/components/hy-badge/index.scss +18 -40
  9. package/components/hy-button/hy-button.vue +15 -5
  10. package/components/hy-button/index.scss +25 -45
  11. package/components/hy-calendar/header.vue +12 -12
  12. package/components/hy-calendar/hy-calendar.vue +11 -2
  13. package/components/hy-calendar/index.scss +140 -131
  14. package/components/hy-calendar/month.vue +18 -18
  15. package/components/hy-card/hy-card.vue +11 -0
  16. package/components/hy-card/index.scss +12 -12
  17. package/components/hy-card/props.ts +2 -2
  18. package/components/hy-cell/hy-cell.vue +22 -13
  19. package/components/hy-cell/index.scss +55 -28
  20. package/components/hy-cell/props.ts +2 -3
  21. package/components/hy-cell/typing.d.ts +3 -10
  22. package/components/hy-check-button/hy-check-button.vue +13 -2
  23. package/components/hy-check-button/index.scss +0 -5
  24. package/components/hy-checkbox/hy-checkbox.vue +31 -8
  25. package/components/hy-checkbox/index.scss +15 -5
  26. package/components/hy-checkbox/props.ts +1 -2
  27. package/components/hy-checkbox/typing.d.ts +1 -1
  28. package/components/hy-config-provider/hy-config-provider.vue +52 -0
  29. package/components/hy-config-provider/index.scss +21 -0
  30. package/components/hy-config-provider/props.ts +13 -0
  31. package/components/hy-config-provider/typing.d.ts +28 -0
  32. package/components/hy-count-down/hy-count-down.vue +11 -0
  33. package/components/hy-count-down/index.scss +13 -1
  34. package/components/hy-count-to/hy-count-to.vue +12 -1
  35. package/components/hy-count-to/index.scss +14 -1
  36. package/components/hy-count-to/props.ts +1 -1
  37. package/components/hy-datetime-picker/hy-datetime-picker.vue +11 -0
  38. package/components/hy-datetime-picker/index.scss +1 -1
  39. package/components/hy-divider/hy-divider.vue +11 -0
  40. package/components/hy-divider/index.scss +1 -1
  41. package/components/hy-dropdown/hy-dropdown.vue +13 -1
  42. package/components/hy-dropdown/index.scss +4 -1
  43. package/components/hy-dropdown/props.ts +2 -2
  44. package/components/hy-dropdown-item/hy-dropdown-item.vue +21 -3
  45. package/components/hy-dropdown-item/index.scss +35 -2
  46. package/components/hy-empty/hy-empty.vue +22 -10
  47. package/components/hy-empty/index.scss +17 -3
  48. package/components/hy-empty/props.ts +1 -5
  49. package/components/hy-empty/typing.d.ts +3 -18
  50. package/components/hy-float-button/hy-float-button.vue +11 -0
  51. package/components/hy-float-button/index.scss +13 -2
  52. package/components/hy-float-button/props.ts +3 -3
  53. package/components/hy-folding-panel/hy-folding-panel.vue +11 -0
  54. package/components/hy-folding-panel/index.scss +4 -1
  55. package/components/hy-form/hy-form.vue +25 -9
  56. package/components/hy-form/index.scss +12 -2
  57. package/components/hy-grid/hy-grid.vue +11 -0
  58. package/components/hy-grid/index.scss +1 -1
  59. package/components/hy-icon/hy-icon.vue +12 -1
  60. package/components/hy-icon/index.scss +16 -7
  61. package/components/hy-icon/props.ts +2 -2
  62. package/components/hy-image/hy-image.vue +11 -0
  63. package/components/hy-image/index.scss +4 -3
  64. package/components/hy-input/hy-input.vue +31 -3
  65. package/components/hy-input/index.scss +12 -2
  66. package/components/hy-input/props.ts +1 -1
  67. package/components/hy-input/typing.d.ts +8 -0
  68. package/components/hy-line/hy-line.vue +11 -0
  69. package/components/hy-line/index.scss +4 -1
  70. package/components/hy-line-progress/hy-line-progress.vue +17 -2
  71. package/components/hy-line-progress/index.scss +20 -8
  72. package/components/hy-line-progress/props.ts +4 -4
  73. package/components/hy-line-progress/typing.d.ts +4 -0
  74. package/components/hy-list/hy-list.vue +23 -8
  75. package/components/hy-list/index.scss +1 -4
  76. package/components/hy-loading/hy-loading.vue +11 -0
  77. package/components/hy-loading/index.scss +2 -2
  78. package/components/hy-login/TheUserLogin.vue +63 -106
  79. package/components/hy-login/hy-login.vue +269 -266
  80. package/components/hy-login/props.ts +1 -1
  81. package/components/hy-login/typing.d.ts +5 -0
  82. package/components/hy-modal/hy-modal.vue +15 -7
  83. package/components/hy-modal/index.scss +19 -3
  84. package/components/hy-navbar/hy-navbar.vue +11 -0
  85. package/components/hy-navbar/index.scss +14 -3
  86. package/components/hy-navbar/props.ts +1 -1
  87. package/components/hy-notice-bar/hy-notice-bar.vue +11 -0
  88. package/components/hy-notice-bar/index.scss +35 -35
  89. package/components/hy-number-step/hy-number-step.vue +15 -8
  90. package/components/hy-number-step/index.scss +34 -25
  91. package/components/hy-number-step/props.ts +4 -4
  92. package/components/hy-overlay/index.scss +3 -1
  93. package/components/hy-picker/hy-picker.vue +12 -0
  94. package/components/hy-picker/index.scss +7 -3
  95. package/components/hy-picker/props.ts +1 -1
  96. package/components/hy-popup/hy-popup.vue +11 -0
  97. package/components/hy-popup/index.scss +10 -1
  98. package/components/hy-price/hy-price.vue +11 -0
  99. package/components/hy-price/index.scss +4 -1
  100. package/components/hy-qrcode/hy-qrcode.vue +11 -0
  101. package/components/hy-qrcode/index.scss +4 -1
  102. package/components/hy-radio/hy-radio.vue +19 -3
  103. package/components/hy-radio/index.scss +17 -5
  104. package/components/hy-radio/props.ts +1 -2
  105. package/components/hy-rate/hy-rate.vue +11 -0
  106. package/components/hy-rate/index.scss +6 -6
  107. package/components/hy-read-more/hy-read-more.vue +23 -2
  108. package/components/hy-read-more/index.scss +29 -2
  109. package/components/hy-read-more/props.ts +2 -7
  110. package/components/hy-scroll-list/hy-scroll-list.vue +31 -9
  111. package/components/hy-scroll-list/index.scss +10 -1
  112. package/components/hy-scroll-list/props.ts +2 -2
  113. package/components/hy-search/hy-search.vue +11 -0
  114. package/components/hy-search/index.scss +25 -4
  115. package/components/hy-search/props.ts +2 -2
  116. package/components/hy-slider/hy-slider.vue +11 -0
  117. package/components/hy-slider/index.scss +3 -2
  118. package/components/hy-slider/props.ts +1 -1
  119. package/components/hy-steps/hy-steps.vue +38 -20
  120. package/components/hy-steps/index.scss +57 -17
  121. package/components/hy-steps/props.ts +2 -2
  122. package/components/{hy-submitBar/hy-submitBar.vue → hy-submit-bar/hy-submit-bar.vue} +13 -34
  123. package/components/hy-submit-bar/index.scss +45 -0
  124. package/components/hy-subsection/hy-subsection.vue +12 -0
  125. package/components/hy-subsection/index.scss +28 -8
  126. package/components/hy-subsection/props.ts +3 -3
  127. package/components/hy-swiper/hy-swiper.vue +11 -0
  128. package/components/hy-swiper/index.scss +13 -2
  129. package/components/hy-switch/hy-switch.vue +17 -3
  130. package/components/hy-switch/index.scss +25 -7
  131. package/components/hy-switch/props.ts +1 -2
  132. package/components/hy-switch/typing.d.ts +3 -3
  133. package/components/hy-tabs/hy-tabs.vue +27 -15
  134. package/components/hy-tabs/index.scss +25 -4
  135. package/components/hy-tabs/props.ts +4 -10
  136. package/components/hy-tag/hy-tag.vue +13 -7
  137. package/components/hy-tag/index.scss +27 -115
  138. package/components/hy-text/hy-text.vue +12 -1
  139. package/components/hy-text/index.scss +20 -37
  140. package/components/hy-textarea/hy-textarea.vue +16 -5
  141. package/components/hy-textarea/index.scss +16 -5
  142. package/components/hy-toast/hy-toast.vue +12 -1
  143. package/components/hy-toast/index.scss +26 -26
  144. package/components/hy-tooltip/hy-tooltip.vue +11 -0
  145. package/components/hy-tooltip/index.scss +3 -3
  146. package/components/hy-tooltip/props.ts +1 -1
  147. package/components/hy-upload/hy-upload.vue +11 -0
  148. package/components/hy-upload/index.scss +12 -1
  149. package/components/hy-warn/hy-warn.vue +22 -11
  150. package/components/hy-warn/index.scss +46 -1
  151. package/components/hy-waterfall/hy-waterfall.vue +11 -0
  152. package/components/hy-waterfall/index.scss +1 -1
  153. package/config/icon.ts +4 -0
  154. package/libs/css/common.scss +9 -0
  155. package/libs/css/mixin.scss +78 -0
  156. package/package.json +2 -2
  157. package/public/font/iconfont.css +3 -3
  158. package/store/userInfo.ts +26 -25
  159. package/theme.scss +76 -60
  160. package/typing/modules/common.d.ts +4 -0
  161. package/utils/colorGradient.ts +1 -1
  162. package/utils/inside.ts +3 -0
  163. package/components/hy-submitBar/Index.vue +0 -17
  164. package/components/hy-submitBar/index.scss +0 -9
  165. /package/components/{hy-submitBar → hy-submit-bar}/props.ts +0 -0
  166. /package/components/{hy-submitBar → hy-submit-bar}/typing.d.ts +0 -0
@@ -1,11 +1,22 @@
1
1
  @use "../../libs/css/mixin.scss" as *;
2
2
  @use "../../theme.scss" as *;
3
3
 
4
- .hy-input {
4
+ /* 暗色主题 */
5
+ @include b(theme){
6
+ @include m(dark) {
7
+ @include b(input) {
8
+ color: $hy-dark-color;
9
+ }
10
+ }
11
+ }
12
+
13
+ @include b(input) {
5
14
  @include flex(row);
6
15
  align-items: center;
7
16
  justify-content: space-between;
8
17
  flex: 1;
18
+ color:
19
+ $hy-light-color;
9
20
 
10
21
  &--radius,
11
22
  &--square {
@@ -35,7 +46,6 @@
35
46
  &__field {
36
47
  line-height: 26px;
37
48
  text-align: left;
38
- color: $hy-text-color;
39
49
  height: 24px;
40
50
  font-size: 15px;
41
51
  flex: 1;
@@ -26,7 +26,7 @@ const defaultProps: IProps = {
26
26
  adjustPosition: true,
27
27
  inputAlign: "left",
28
28
  fontSize: "15px",
29
- color: "#303133",
29
+ color: "",
30
30
  prefixIcon: {},
31
31
  suffixIcon: {},
32
32
  border: "surround",
@@ -134,6 +134,14 @@ export default interface HyInputProps {
134
134
  * @description 定义需要用到的外部样式
135
135
  * */
136
136
  customStyle?: CSSProperties;
137
+ /**
138
+ * @description 值变化事件
139
+ * */
140
+ onChange?: Function;
141
+ /**
142
+ * @description 失去焦点事件
143
+ * */
144
+ onBlur?: Function;
137
145
  /**
138
146
  * @description 是否忽略组件内对文本合成系统事件的处理。
139
147
  * */
@@ -2,6 +2,17 @@
2
2
  <view class="hy-line" :style="lineStyle"> </view>
3
3
  </template>
4
4
 
5
+ <script lang="ts">
6
+ export default {
7
+ name: 'hy-line',
8
+ options: {
9
+ addGlobalClass: true,
10
+ virtualHost: true,
11
+ styleIsolation: 'shared'
12
+ }
13
+ }
14
+ </script>
15
+
5
16
  <script setup lang="ts">
6
17
  import { computed, type CSSProperties, toRefs } from "vue";
7
18
  import defaultProps from "./props";
@@ -1,4 +1,7 @@
1
- .hy-line {
1
+ @use "../../libs/css/mixin.scss" as *;
2
+ @use "../../theme.scss" as *;
3
+
4
+ @include b(line) {
2
5
  /* #ifndef APP-NVUE */
3
6
  vertical-align: middle;
4
7
  /* #endif */
@@ -14,6 +14,9 @@
14
14
  <text
15
15
  v-if="showText && percentage >= 10"
16
16
  class="hy-line-progress__text"
17
+ :style="{
18
+ fontSize: fontSize ? addUnit(fontSize) : addUnit(getPx(height)),
19
+ }"
17
20
  >{{ innserPercentage + "%" }}</text
18
21
  >
19
22
  </slot>
@@ -21,10 +24,22 @@
21
24
  </view>
22
25
  </template>
23
26
 
27
+ <script lang="ts">
28
+ export default {
29
+ name: 'hy-line-progress',
30
+ options: {
31
+ addGlobalClass: true,
32
+ virtualHost: true,
33
+ styleIsolation: 'shared'
34
+ }
35
+ }
36
+ </script>
37
+
24
38
  <script setup lang="ts">
25
39
  import {
26
40
  computed,
27
- type CSSProperties, getCurrentInstance,
41
+ type CSSProperties,
42
+ getCurrentInstance,
28
43
  onMounted,
29
44
  ref,
30
45
  toRefs,
@@ -32,7 +47,7 @@ import {
32
47
  } from "vue";
33
48
  import defaultProps from "./props";
34
49
  import type IProps from "./typing";
35
- import { addUnit, getRect, range, sleep } from "../../utils";
50
+ import { addUnit, getPx, getRect, range, sleep } from "../../utils";
36
51
 
37
52
  const props = withDefaults(defineProps<IProps>(), defaultProps);
38
53
  const { percentage, activeColor, height } = toRefs(props);
@@ -1,16 +1,28 @@
1
1
  @use "../../libs/css/mixin.scss" as *;
2
+ @use "../../theme.scss" as *;
2
3
 
3
- .hy-line-progress {
4
+ /* 暗色主题 */
5
+ @include b(theme){
6
+ @include m(dark) {
7
+ @include b(line-progress) {
8
+ &__background {
9
+ background-color: $hy-dark-background--track;
10
+ }
11
+ }
12
+ }
13
+ }
14
+
15
+ @include b(line-progress) {
4
16
  align-items: stretch;
5
17
  position: relative;
6
18
  @include flex(row);
7
19
  flex: 1;
8
20
  overflow: hidden;
9
- border-radius: 100px;
21
+ border-radius: $hy-border-radius-semicircle;
10
22
 
11
23
  &__background {
12
- background-color: #ececec;
13
- border-radius: 100px;
24
+ background-color: $hy-info-light;
25
+ border-radius: $hy-border-radius-semicircle;
14
26
  flex: 1;
15
27
  }
16
28
 
@@ -22,17 +34,17 @@
22
34
  align-items: center;
23
35
  @include flex(row);
24
36
  color: #ffffff;
25
- border-radius: 100px;
37
+ border-radius: $hy-border-radius-semicircle;
26
38
  transition: width 0.5s ease;
27
39
  justify-content: flex-end;
40
+ background-color: $hy-primary;
28
41
  }
29
42
 
30
43
  &__text {
31
44
  font-size: 10px;
32
- align-items: center;
33
- text-align: right;
34
45
  color: #ffffff;
46
+ margin-bottom: 1px;
35
47
  margin-right: 5px;
36
- transform: scale(0.9);
48
+ transform: scale(0.8);
37
49
  }
38
50
  }
@@ -1,12 +1,12 @@
1
1
  import type IProps from "./typing";
2
- import { ColorConfig } from "../../config";
3
2
 
4
3
  const defaultProps: IProps = {
5
- activeColor: ColorConfig.primary,
6
- inactiveColor: "#ececec",
4
+ activeColor: "",
5
+ inactiveColor: "",
7
6
  percentage: 0,
8
7
  showText: true,
9
- height: 12,
8
+ height: 8,
9
+ fontSize: "",
10
10
  };
11
11
 
12
12
  export default defaultProps;
@@ -21,6 +21,10 @@ export default interface HyLineProgressProps {
21
21
  * @description 进度条的高度,单位px ( 默认 12 )
22
22
  * */
23
23
  height?: string | number;
24
+ /**
25
+ * @description 字体大小,单位px ( 默认 10 )
26
+ * */
27
+ fontSize?: string | number;
24
28
  /**
25
29
  * @description 自定义样式
26
30
  * */
@@ -66,16 +66,20 @@
66
66
 
67
67
  <script lang="ts">
68
68
  export default {
69
+ name: 'hy-list',
69
70
  options: {
71
+ addGlobalClass: true,
70
72
  virtualHost: true,
71
- },
72
- };
73
+ styleIsolation: 'shared'
74
+ }
75
+ }
73
76
  </script>
74
77
 
75
78
  <script lang="ts" setup>
76
79
  import {
77
80
  computed,
78
81
  type CSSProperties,
82
+ getCurrentInstance,
79
83
  nextTick,
80
84
  onMounted,
81
85
  reactive,
@@ -84,8 +88,7 @@ import {
84
88
  useSlots,
85
89
  watch,
86
90
  } from "vue";
87
- import { addUnit, debounce, getPx, getRect } from "../../utils";
88
- import HyDivider from "../hy-divider/hy-divider.vue";
91
+ import { addUnit, getPx, getRect } from "../../utils";
89
92
  import type IProps from "./typing";
90
93
  import defaultProps from "./props";
91
94
 
@@ -109,7 +112,10 @@ const slots = useSlots();
109
112
  const scrollTop = ref(0);
110
113
  // 可视区域的高度
111
114
  const viewHeight = ref(0);
112
- const waterfall: { left: AnyObject[]; right: AnyObject[] } = reactive({
115
+ const waterfall: {
116
+ left: AnyObject[];
117
+ right: AnyObject[];
118
+ } = reactive({
113
119
  left: [],
114
120
  right: [],
115
121
  });
@@ -117,10 +123,11 @@ const waterfall: { left: AnyObject[]; right: AnyObject[] } = reactive({
117
123
  const arrange = computed(() => (line.value === 1 ? "column" : "row"));
118
124
  const boxHeight = getPx(itemHeight.value) + getPx(marginBottom.value);
119
125
  const listHeight = addUnit(containerHeight.value);
126
+ const instance = getCurrentInstance();
120
127
 
121
128
  onMounted(() => {
122
129
  nextTick(async () => {
123
- const res = await getRect(".hy-virtual-container");
130
+ const res = await getRect(".hy-virtual-container", false, instance);
124
131
  viewHeight.value = (res as UniApp.NodeInfo).height ?? 0;
125
132
  });
126
133
  });
@@ -178,9 +185,9 @@ watch(
178
185
  if (line.value === 2 && newVal.every((item) => typeof item !== "string")) {
179
186
  newVal.forEach((item, i) => {
180
187
  if (i % 2 === 0) {
181
- waterfall.left.push(item);
188
+ waterfall.left.push(item as AnyObject);
182
189
  } else {
183
- waterfall.right.push(item);
190
+ waterfall.right.push(item as AnyObject);
184
191
  }
185
192
  });
186
193
  }
@@ -217,4 +224,12 @@ const slotDefault = useSlots().default;
217
224
 
218
225
  <style lang="scss" scoped>
219
226
  @import "./index.scss";
227
+ .hy-virtual-container {
228
+ height: v-bind(listHeight);
229
+ &__list {
230
+ padding: v-bind(paddingAttr);
231
+ display: flex;
232
+ flex-direction: v-bind(arrange);
233
+ }
234
+ }
220
235
  </style>
@@ -1,14 +1,11 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- .hy-virtual-container {
5
- height: v-bind(listHeight);
4
+ @include b(virtual-container) {
6
5
  padding: 0 $hy-border-margin-padding-base;
7
6
  box-sizing: border-box;
8
7
 
9
8
  &__list {
10
- padding: v-bind(paddingAttr);
11
- @include flex(v-bind(arrange));
12
9
  overflow-anchor: none;
13
10
  &--item {
14
11
  box-sizing: border-box;
@@ -46,6 +46,17 @@
46
46
  </view>
47
47
  </template>
48
48
 
49
+ <script lang="ts">
50
+ export default {
51
+ name: 'hy-loading',
52
+ options: {
53
+ addGlobalClass: true,
54
+ virtualHost: true,
55
+ styleIsolation: 'shared'
56
+ }
57
+ }
58
+ </script>
59
+
49
60
  <script setup lang="ts">
50
61
  import defaultProps from "./props";
51
62
  import type IProps from "./typing";
@@ -2,7 +2,7 @@
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
4
 
5
- .hy-loading-icon {
5
+ @include b(loading-icon) {
6
6
  @include flex(row);
7
7
  align-items: center;
8
8
  justify-content: center;
@@ -48,7 +48,7 @@
48
48
  line-height: 1px;
49
49
  }
50
50
 
51
- .hy-loading-icon {
51
+ @include b(loading-icon) {
52
52
  &__spinner--spinner {
53
53
  animation-timing-function: steps(12);
54
54
  }
@@ -1,71 +1,11 @@
1
1
  <template>
2
2
  <view class="user-login">
3
- <HyForm ref="form_1Ref" :columns="userColumns" :formData="userForm">
4
- <template #user="{ record, errorStyle }">
5
- <HyInput
6
- v-model="userForm.name"
7
- :placeholder="userPlaceholder"
8
- :clearable="true"
9
- border="bottom"
10
- :customStyle="errorStyle"
11
- @change="handleChange($event, record)"
12
- @blur="handleBlur($event, record)"
13
- >
14
- <!-- #ifndef APP-PLUS-NVUE -->
15
- <template #prefix>
16
- <HyIcon :name="IconConfig.MINE" :color="themeColor"></HyIcon>
17
- </template>
18
- <template #suffix>
19
- <HyIcon
20
- :name="
21
- !showChoice
22
- ? IconConfig.ARROW_DOWN_FILL
23
- : IconConfig.ARROW_UP_FILL
24
- "
25
- @tap="showChoice = !showChoice"
26
- :color="themeColor"
27
- ></HyIcon>
28
- <view class="dialog-view" v-if="showChoice && choiceList.length">
29
- <view
30
- class="dialog-title"
31
- v-for="(item, index) in choiceList"
32
- :key="index"
33
- @click="btnChoiceClick(index)"
34
- >
35
- {{ item.user }}
36
- </view>
37
- </view>
38
- </template>
39
- <!-- #endif -->
40
- </HyInput>
41
- </template>
42
- <template #pwd="{ record }">
43
- <HyInput
44
- :type="showPwd ? 'text' : 'password'"
45
- v-model="userForm.pwd"
46
- :placeholder="pwdPlaceholder"
47
- :clearable="true"
48
- border="bottom"
49
- :password-icon="false"
50
- @change="handleChange($event, record)"
51
- @blur="handleBlur($event, record)"
52
- >
53
- <!-- #ifndef APP-PLUS-NVUE -->
54
- <template #prefix>
55
- <HyIcon :name="IconConfig.LOCK" :color="themeColor"></HyIcon>
56
- </template>
57
- <template v-if="isShowPwd" #suffix>
58
- <HyIcon
59
- size="16"
60
- @click="showPasswordFn"
61
- color="#c8c9cc"
62
- :name="showPwd ? 'eye-fill' : 'eye-off'"
63
- ></HyIcon>
64
- </template>
65
- <!-- #endif -->
66
- </HyInput>
67
- </template>
68
- </HyForm>
3
+ <HyForm
4
+ ref="form_1Ref"
5
+ :columns="userColumns"
6
+ :formData="userForm"
7
+ :input="{ border: 'bottom' }"
8
+ ></HyForm>
69
9
 
70
10
  <!-- 记住密码 -->
71
11
  <view class="mui-input-row mui-checkbox">
@@ -73,7 +13,7 @@
73
13
  :columns="rememberList"
74
14
  shape="square"
75
15
  :active-color="themeColor"
76
- v-model="rememberPassword"
16
+ v-model="rememberPsw"
77
17
  @change="checkboxChange"
78
18
  ></HyCheckbox>
79
19
  </view>
@@ -81,20 +21,18 @@
81
21
  </template>
82
22
 
83
23
  <script setup lang="ts">
84
- import { ref, reactive, onMounted } from "vue";
24
+ import { ref, reactive, onMounted, computed } from "vue";
85
25
  import { onHide } from "@dcloudio/uni-app";
86
26
  import { storeToRefs } from "pinia";
87
27
  import { useUserInfo } from "../../store";
88
28
  import { decryptData, encryptData } from "../../utils";
89
- import type { FormColumnsType } from "../../typing";
90
29
  import { FormTypeEnum } from "../../typing";
91
30
  import { IconConfig } from "../../config";
31
+ import type { UserLoginInfoVo } from "./typing";
92
32
 
93
33
  // 组件
94
34
  import HyCheckbox from "../hy-checkbox/hy-checkbox.vue";
95
35
  import HyForm from "../hy-form/hy-form.vue";
96
- import HyInput from "../hy-input/hy-input.vue";
97
- import HyIcon from "../hy-icon/hy-icon.vue";
98
36
 
99
37
  interface IProps {
100
38
  themeColor: string;
@@ -110,7 +48,7 @@ interface IProps {
110
48
 
111
49
  const props = withDefaults(defineProps<IProps>(), {
112
50
  themeColor: "",
113
- prefix: "gxh",
51
+ prefix: "hy",
114
52
  isShowPwd: false,
115
53
  userPlaceholder: "",
116
54
  pwdPlaceholder: "",
@@ -123,27 +61,60 @@ const emit = defineEmits(["handleHistory", "handleCheckbox"]);
123
61
  const userInfoStore = useUserInfo();
124
62
  const { userForm, choiceList, rememberPsw } = storeToRefs(userInfoStore);
125
63
 
126
- const userColumns = reactive([
64
+ const showChoice = ref<boolean>(false);
65
+ const showPwd = ref<boolean>(false);
66
+ const userColumns = computed(() => [
127
67
  {
128
- field: "user",
68
+ field: "userName",
129
69
  label: "",
130
- type: FormTypeEnum.CUSTOM,
70
+ type: FormTypeEnum.TEXT,
71
+ input: {
72
+ clearable: true,
73
+ placeholder: props.userPlaceholder,
74
+ prefixIcon: {
75
+ name: IconConfig.MINE,
76
+ color: props.themeColor,
77
+ },
78
+ suffixIcon: {
79
+ name: showChoice.value
80
+ ? IconConfig.ARROW_UP_FILL
81
+ : IconConfig.ARROW_DOWN_FILL,
82
+ color: props.themeColor,
83
+ },
84
+ onSuffix: () => {
85
+ showChoice.value = !showChoice.value;
86
+ },
87
+ },
131
88
  rules: [props.customUserValidator, props.userNumValidator],
132
89
  },
133
90
  {
134
- field: "pwd",
91
+ field: "password",
135
92
  label: "",
136
- type: FormTypeEnum.CUSTOM,
93
+ type: showPwd.value ? FormTypeEnum.TEXT : FormTypeEnum.PASSWORD,
94
+ input: {
95
+ clearable: true,
96
+ placeholder: props.pwdPlaceholder,
97
+ prefixIcon: {
98
+ name: IconConfig.LOCK,
99
+ color: props.themeColor,
100
+ },
101
+ suffixIcon: {
102
+ name: showPwd.value ? IconConfig.EYE : IconConfig.EYE_CLOSE,
103
+ color: props.themeColor,
104
+ },
105
+ onSuffix: () => {
106
+ showPwd.value = !showPwd.value;
107
+ console.log(showChoice.value);
108
+ },
109
+ },
137
110
  rules: [props.customUserValidator, props.pwdNumValidator],
138
111
  },
139
112
  ]);
140
113
  const rememberList = reactive([{ label: "记住密码", value: 1 }]);
141
- const showPwd = ref<boolean>(false);
142
- const showChoice = ref<boolean>(false);
143
114
  const form_1Ref = ref<InstanceType<typeof HyForm>>();
144
115
  // 效验用户名和密码
145
116
  const userRules = reactive({
146
- name: [
117
+ userName: [
147
118
  {
148
119
  required: true,
149
120
  message: "请先输入账号",
@@ -153,7 +124,7 @@ const userRules = reactive({
153
124
  props.customUserValidator,
154
125
  props.userNumValidator,
155
126
  ],
156
- pwd: [
127
+ password: [
157
128
  {
158
129
  required: true,
159
130
  message: "请输入密码",
@@ -164,30 +135,27 @@ const userRules = reactive({
164
135
  props.customPwdValidator,
165
136
  ],
166
137
  });
167
- const rememberPassword = ref([0]);
138
+ const rememberPassword = ref(false);
168
139
  const account = uni.getStorageSync(`${props.prefix}_account`);
169
140
  const accountList = uni.getStorageSync(`${props.prefix}_choiceList`);
170
141
 
171
142
  onMounted(() => {
172
143
  if (!account) return;
173
144
  const result = decryptData(account);
145
+ console.log(result);
174
146
  //有缓存就赋值给文本没有就清空
175
- rememberPsw.value = result.rememberPsw;
176
- if (account) {
177
- //获取缓存的账号和密码
178
- userForm.value.name = result.userName;
179
- userForm.value.pwd = result.password;
180
- } else {
181
- userForm.value.name = "";
182
- userForm.value.pwd = "";
183
- }
147
+ rememberPsw.value = result?.rememberPsw;
148
+ //获取缓存的账号和密码
149
+ userForm.value.userName = result?.userName;
150
+ userForm.value.password = result?.password;
151
+
184
152
  if (accountList) {
185
- choiceList.value = decryptData(accountList);
153
+ choiceList.value = decryptData(accountList) as UserLoginInfoVo[];
186
154
  }
187
155
  });
188
156
 
189
157
  onHide(() => {
190
- if (!account) return;
158
+ // if (!account) return;
191
159
  //获取缓存的账号和密码
192
160
  const { userName, password } = decryptData(account);
193
161
  if (choiceList.value.length) {
@@ -222,7 +190,7 @@ onHide(() => {
222
190
  const loginFn = () => {
223
191
  return new Promise((resolve, reject) => {
224
192
  form_1Ref.value
225
- .handleSubmit()
193
+ ?.handleSubmit()
226
194
  .then((res) => {
227
195
  resolve("success" + res);
228
196
  })
@@ -236,7 +204,7 @@ const loginFn = () => {
236
204
  * 勾选是否记住密码
237
205
  * */
238
206
  const checkboxChange = () => {
239
- emit("handleCheckbox", rememberPsw.value);
207
+ emit("handleCheckbox", rememberPassword.value);
240
208
  };
241
209
 
242
210
  /**
@@ -269,17 +237,6 @@ const extensionFun = (index: number, username: string) => {
269
237
  }
270
238
  };
271
239
 
272
- const showPasswordFn = () => {
273
- showPwd.value = !showPwd.value;
274
- };
275
-
276
- const handleChange = (event: string, temp: FormColumnsType) => {
277
- form_1Ref.value?.validateField(temp.rules, event, temp.field, "change");
278
- };
279
- const handleBlur = (event: string, temp: FormColumnsType) => {
280
- form_1Ref.value?.validateField(temp.rules, event, temp.field, "blur");
281
- };
282
-
283
240
  defineExpose({
284
241
  loginFn,
285
242
  });