@kengic/uni 0.6.3-beta.4 → 0.6.3-beta.6

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.
@@ -2,6 +2,7 @@ import { useAppStore } from '../store/app.store';
2
2
  import { Kg } from '../util';
3
3
  import { KG_DYNAMIC_QUERY_OPERATOR, KG_HTTP_HEADERS } from '../const';
4
4
  import { useKgWarehouse } from '../component/KgWarehouse/index.hooks';
5
+ import { useKgStation } from '../component/KgStation';
5
6
 
6
7
  /*
7
8
  * 对请求做统一的拦截.
@@ -13,7 +14,7 @@ uni.addInterceptor('request', {
13
14
  const appStore = useAppStore();
14
15
 
15
16
  args.header['Authorization'] = appStore.getToken;
16
- // TODO 支持其他语言
17
+ // TODO LT 支持其他语言
17
18
  args.header['Accept-Language'] = 'zh_CN'.replace('_', '-');
18
19
  args.header['X-Access-Token'] = appStore.getToken;
19
20
 
@@ -68,9 +69,20 @@ type IRequestOptions = Omit<UniApp.RequestOptions, 'url'> & {
68
69
  */
69
70
  dynamicQueryOperatorModel?: Record<string, KG_DYNAMIC_QUERY_OPERATOR>;
70
71
 
71
- /** 是否不显示错误消息提示. */
72
+ /**
73
+ * 是否不显示错误消息提示.
74
+ *
75
+ * @default false
76
+ */
72
77
  isSuppressError?: boolean;
73
78
 
79
+ /**
80
+ * 是否不显示成功消息提示.
81
+ *
82
+ * @default false
83
+ */
84
+ isSuppressSuccess?: boolean;
85
+
74
86
  /** 是否处理请求结果. */
75
87
  isTransformResponse?: boolean;
76
88
 
@@ -100,6 +112,13 @@ function handleSuccess<T = any>(
100
112
  reject: (reason?: any) => void,
101
113
  options?: IRequestOptions,
102
114
  ) {
115
+ // 显示后端成功消息
116
+ if (!options?.isSuppressSuccess) {
117
+ if ((response.data as any).message) {
118
+ uni.showToast({ icon: 'none', title: (response.data as any).message });
119
+ }
120
+ }
121
+
103
122
  if (options?.isTransformResponse === false) {
104
123
  resolve(response.data as any);
105
124
  } else {
@@ -129,7 +148,7 @@ function handleError<T = any>(
129
148
  if (!isSuppressError) {
130
149
  // @ts-ignore
131
150
  const message = (response.data as any)?.message || response?.errMsg || '请求出错';
132
- uni.showToast({ title: message, icon: 'none', duration: 3000 });
151
+ uni.showToast({ duration: 3000, icon: 'none', title: message });
133
152
  }
134
153
 
135
154
  reject(response);
@@ -229,9 +248,9 @@ const _httpClient: IHttpClient = {
229
248
  header[KG_QUERY_SQL] = encodeURIComponent(decodeURIComponent(String(header[KG_QUERY_SQL])));
230
249
  }
231
250
 
232
- // 仓库编号
233
- const warehouseId = useKgWarehouse().warehouse.value?.whId ?? '';
234
- header[KG_HTTP_HEADERS.KG_WAREHOUSE] = encodeURIComponent(warehouseId);
251
+ header[KG_HTTP_HEADERS.KG_WAREHOUSE] = encodeURIComponent(useKgWarehouse().warehouse.value?.whId ?? '');
252
+ header[KG_HTTP_HEADERS.KG_WORK_STATION] = encodeURIComponent(useKgStation().station.value?.devcod ?? '');
253
+ header[KG_HTTP_HEADERS.KG_WORK_AREA] = encodeURIComponent(useKgStation().station.value?.hmewrkare ?? '');
235
254
 
236
255
  uni.request({
237
256
  ...(options ?? {}),
@@ -7,7 +7,7 @@
7
7
  <view v-if="current" class="uni-select__input-text">{{ textShow }}</view>
8
8
  <view v-else class="uni-select__input-text uni-select__input-placeholder">{{ typePlaceholder }} </view>
9
9
  <view v-if="current && clear && !disabled" @click.stop="clearVal">
10
- <uni-icons type="clear" color="#c0c4cc" size="14" />
10
+ <uni-icons type="clear" color="#c0c4cc" size="16" />
11
11
  </view>
12
12
  <view v-else style="display: flex; align-items: center; justify-content: center">
13
13
  <view :class="showSelector ? 'ant-design--caret-up-filled' : 'ant-design--caret-down-filled'" />
@@ -23,6 +23,7 @@ export const debounce = function (func, wait = 1000, immediate = true) {
23
23
  }
24
24
  };
25
25
  };
26
+
26
27
  /**
27
28
  * @desc 函数节流
28
29
  * @param func 函数
@@ -3,54 +3,6 @@
3
3
  <view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle">
4
4
  <uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc" @click="onClickIcon('prefix')" size="16"></uni-icons>
5
5
  <slot name="left"></slot>
6
- <!-- #ifdef MP-ALIPAY -->
7
- <textarea
8
- :enableNative="enableNative"
9
- v-if="type === 'textarea'"
10
- class="uni-easyinput__content-textarea"
11
- :class="{ 'input-padding': inputBorder }"
12
- :name="name"
13
- :value="val"
14
- :placeholder="placeholder"
15
- :placeholderStyle="placeholderStyle"
16
- :disabled="disabled"
17
- placeholder-class="uni-easyinput__placeholder-class"
18
- :maxlength="inputMaxlength"
19
- :focus="focused"
20
- :autoHeight="autoHeight"
21
- :cursor-spacing="cursorSpacing"
22
- :adjust-position="adjustPosition"
23
- @input="onInput"
24
- @blur="_Blur"
25
- @focus="_Focus"
26
- @confirm="onConfirm"
27
- @keyboardheightchange="onkeyboardheightchange"
28
- ></textarea>
29
- <input
30
- :enableNative="enableNative"
31
- v-else
32
- :type="type === 'password' ? 'text' : type"
33
- class="uni-easyinput__content-input"
34
- :style="inputStyle"
35
- :name="name"
36
- :value="val"
37
- :password="!showPassword && type === 'password'"
38
- :placeholder="placeholder"
39
- :placeholderStyle="placeholderStyle"
40
- placeholder-class="uni-easyinput__placeholder-class"
41
- :disabled="disabled"
42
- :maxlength="inputMaxlength"
43
- :focus="focused"
44
- :confirmType="confirmType"
45
- :cursor-spacing="cursorSpacing"
46
- :adjust-position="adjustPosition"
47
- @focus="_Focus"
48
- @blur="_Blur"
49
- @input="onInput"
50
- @confirm="onConfirm"
51
- @keyboardheightchange="onkeyboardheightchange"
52
- />
53
- <!-- #endif -->
54
6
  <!-- #ifndef MP-ALIPAY -->
55
7
  <textarea
56
8
  v-if="type === 'textarea'"
@@ -60,7 +12,7 @@
60
12
  :value="val"
61
13
  :placeholder="placeholder"
62
14
  :placeholderStyle="placeholderStyle"
63
- :disabled="disabled"
15
+ :disabled="disabled || readonly"
64
16
  placeholder-class="uni-easyinput__placeholder-class"
65
17
  :maxlength="inputMaxlength"
66
18
  :focus="focused"
@@ -84,7 +36,7 @@
84
36
  :placeholder="placeholder"
85
37
  :placeholderStyle="placeholderStyle"
86
38
  placeholder-class="uni-easyinput__placeholder-class"
87
- :disabled="disabled"
39
+ :disabled="disabled || readonly"
88
40
  :maxlength="inputMaxlength"
89
41
  :focus="focused"
90
42
  :confirmType="confirmType"
@@ -98,8 +50,8 @@
98
50
  />
99
51
  <!-- #endif -->
100
52
 
53
+ <!-- 开启密码时显示小眼睛 -->
101
54
  <template v-if="type === 'password' && passwordIcon">
102
- <!-- 开启密码时显示小眼睛 -->
103
55
  <uni-icons
104
56
  v-if="isVal"
105
57
  class="content-clear-icon"
@@ -248,6 +200,14 @@
248
200
  type: Boolean,
249
201
  default: false,
250
202
  },
203
+
204
+ /**
205
+ * <p>是否只读, 跟 disabled 的区别是: 会显示清空图标.</p>
206
+ */
207
+ readonly: {
208
+ type: Boolean,
209
+ default: false,
210
+ },
251
211
  maxlength: {
252
212
  type: [Number, String],
253
213
  default: 140,
@@ -362,7 +322,7 @@
362
322
  'is-input-border': this.inputBorder,
363
323
  'is-input-error-border': this.inputBorder && this.msg,
364
324
  'is-textarea': this.type === 'textarea',
365
- 'is-disabled': this.disabled,
325
+ 'is-disabled': this.disabled || this.readonly,
366
326
  'is-focused': this.focusShow,
367
327
  });
368
328
  },
@@ -371,7 +331,7 @@
371
331
  const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor;
372
332
  return obj2strStyle({
373
333
  'border-color': borderColor || '#e5e5e5',
374
- 'background-color': this.disabled ? this.styles.disableColor : this.styles.backgroundColor,
334
+ 'background-color': this.disabled || this.readonly ? this.styles.disableColor : this.styles.backgroundColor,
375
335
  });
376
336
  },
377
337
  // input右侧样式
@@ -527,9 +487,6 @@
527
487
  */
528
488
  onClear(event) {
529
489
  this.val = '';
530
- // TODO 兼容 vue2
531
- this.$emit('input', '');
532
- // TODO 兼容 vue2
533
490
  // TODO 兼容 vue3
534
491
  this.$emit('update:modelValue', '');
535
492
  // 点击叉号触发
@@ -582,7 +539,7 @@
582
539
  position: relative;
583
540
  text-align: left;
584
541
  color: #333;
585
- font-size: 14px;
542
+ font-size: 13px;
586
543
  }
587
544
 
588
545
  .uni-easyinput__content {
@@ -609,7 +566,7 @@
609
566
  overflow: hidden;
610
567
  flex: 1;
611
568
  line-height: 1;
612
- font-size: 14px;
569
+ font-size: 13px;
613
570
  height: 24px;
614
571
  // min-height: 36px;
615
572
 
@@ -621,17 +578,16 @@
621
578
  & ::-ms-clear {
622
579
  display: none;
623
580
  }
624
-
625
- & ::-o-clear {
626
- display: none;
627
- }
628
-
629
581
  /*endif*/
630
582
  }
631
583
 
584
+ :deep(.uni-easyinput__content-input) .uni-input-input {
585
+ padding-bottom: 1px;
586
+ }
587
+
632
588
  .uni-easyinput__placeholder-class {
633
589
  color: #999;
634
- font-size: 12px;
590
+ font-size: 13px;
635
591
  // font-weight: 200;
636
592
  }
637
593
 
@@ -648,7 +604,7 @@
648
604
  overflow: hidden;
649
605
  flex: 1;
650
606
  line-height: 1.5;
651
- font-size: 14px;
607
+ font-size: 13px;
652
608
  margin: 6px;
653
609
  margin-left: 0;
654
610
  height: 80px;
@@ -737,7 +693,7 @@
737
693
 
738
694
  .uni-easyinput__placeholder-class {
739
695
  color: #d5d5d5;
740
- font-size: 12px;
696
+ font-size: 13px;
741
697
  }
742
698
  }
743
699
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.6.3-beta.4",
3
+ "version": "0.6.3-beta.6",
4
4
  "scripts": {
5
5
  "build": "npm run switch-node-version && rimraf dist && vue-tsc && vite build",
6
6
  "------ -------------------------------------------": "",