n20-common-lib 1.3.186 → 1.3.187

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": "n20-common-lib",
3
- "version": "1.3.186",
3
+ "version": "1.3.187",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -104,14 +104,13 @@ export default {
104
104
  value: {
105
105
  handler(val) {
106
106
  if (val && typeof val === 'string') {
107
- val = Number(val.replace(/,/g, ''))
107
+ val = NumberP(val)
108
108
 
109
109
  this.$emit('input', isNaN(val) ? undefined : val)
110
110
  this.valueStr = this.num2str(val)
111
111
  return
112
112
  }
113
113
  this.valueStr = this.num2str(val)
114
- this.preValue = this.valueStr
115
114
  },
116
115
  immediate: true
117
116
  }
@@ -133,28 +132,29 @@ export default {
133
132
  this.isFocus = true
134
133
  if (!this.disabled && this.valueStr) {
135
134
  this.valueStr = this.valueStr.replace(/,/g, '')
135
+ this.preValue = this.valueStr
136
136
  }
137
137
  },
138
138
  blurFn() {
139
139
  this.isFocus = false
140
- let val = Number(this.valueStr.replace(/,/g, ''))
141
- if (isNaN(val)) {
142
- this.valueStr = ''
143
- } else {
144
- this.valueStr = this.num2str(val)
145
- }
146
140
 
141
+ this.changeFn(this.valueStr)
147
142
  this.$emit('blur')
148
143
  },
149
144
  stepFn(ev) {
150
- if (ev.code === 'ArrowUp' || ev.code === 'ArrowDown') {
151
- let val = Number(this.valueStr.replace(/,/g, ''))
145
+ if ((ev.code === 'ArrowUp' || ev.code === 'ArrowDown') && !this.disabled) {
146
+ let val = NumberP(this.valueStr)
152
147
  if (!isNaN(val)) {
153
148
  ev.preventDefault()
154
149
  val = ev.code === 'ArrowUp' ? val + this.step : val - this.step
150
+ if (val < this.min) {
151
+ val = this.min
152
+ } else if (val > this.max) {
153
+ val = this.max
154
+ }
155
+
155
156
  let valueStr = Number(val.toFixed(9)).toString()
156
157
  this.valueStr = valueStr
157
- this.changeFn(valueStr)
158
158
  }
159
159
  }
160
160
  },
@@ -166,16 +166,22 @@ export default {
166
166
  }
167
167
  },
168
168
  changeFn(valStr) {
169
- valStr = valStr.replace(/,/g, '')
169
+ if (this.changeIng) return
170
+ this.changeIng = true
171
+ setTimeout(() => {
172
+ this.changeIng = false
173
+ })
174
+
175
+ valStr = valStr.trim()
176
+ let val = NumberP(valStr)
170
177
 
171
- if (!valStr.trim() || isNaN(valStr)) {
178
+ if (isNaN(val)) {
172
179
  this.valueStr = ''
173
180
  this.$emit('input', undefined)
174
181
  this.$emit('change', undefined)
175
182
  return
176
183
  }
177
184
 
178
- let val = Number(valStr)
179
185
  if (val < this.min) {
180
186
  val = this.min
181
187
  } else if (val > this.max) {
@@ -218,4 +224,15 @@ export default {
218
224
  }
219
225
  }
220
226
  }
227
+
228
+ function NumberP(val) {
229
+ if (typeof val === 'string') {
230
+ val = val.replace(/,/g, '').trim()
231
+ }
232
+ if (val === undefined || val === null || val === '') {
233
+ return NaN
234
+ } else {
235
+ return Number(val)
236
+ }
237
+ }
221
238
  </script>
@@ -374,6 +374,9 @@ export default {
374
374
  } else if (supplier === 'netca') {
375
375
  // 网证通
376
376
  window.sessionStorage.setItem('signType', 'netcaSign')
377
+ } else if (supplier === 'NetSM3') {
378
+ // 网证通
379
+ window.sessionStorage.setItem('signType', 'NetSM3')
377
380
  } else {
378
381
  // 信安CA
379
382
  window.sessionStorage.setItem('signType', 'inetSign')