vue2-client 1.16.34 → 1.16.35

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": "vue2-client",
3
- "version": "1.16.34",
3
+ "version": "1.16.35",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -95,6 +95,14 @@ export default {
95
95
  initialValue (val) {
96
96
  const num = parseFloat(val)
97
97
  this.progressValue = isNaN(num) ? 0 : Math.max(0, Math.min(100, num))
98
+
99
+ // 如果新值 >= 100,断开现有连接
100
+ if (this.progressValue >= 100) {
101
+ this.cleanup()
102
+ this.connectionState.isConnected = false
103
+ this.connectionState.reconnectAttempts = 0
104
+ this.$emit('websocket-skipped', { reason: 'initial-value-complete' })
105
+ }
98
106
  },
99
107
  // 标识变更时,断开旧连接并按新标识重连
100
108
  websocketId (newId, oldId) {
@@ -118,6 +126,14 @@ export default {
118
126
  return
119
127
  }
120
128
 
129
+ // 如果初始值 >= 100,不建立连接
130
+ if (this.progressValue >= 100) {
131
+ this.connectionState.isConnected = false
132
+ this.connectionState.reconnectAttempts = 0
133
+ this.$emit('websocket-skipped', { reason: 'initial-value-complete' })
134
+ return
135
+ }
136
+
121
137
  this.websocketUrl = `ws:${window.location.host}/socket/af-system/sendMessage?userId=${this.websocketId}`
122
138
 
123
139
  const wsOptions = {
@@ -224,6 +240,15 @@ export default {
224
240
  value: this.progressValue,
225
241
  originalValue: value
226
242
  })
243
+
244
+ // 当进度 >= 100 时,关闭连接
245
+ if (this.progressValue >= 100) {
246
+ this.$emit('progress-completed', {
247
+ value: this.progressValue,
248
+ originalValue: value
249
+ })
250
+ this.cleanup()
251
+ }
227
252
  }
228
253
  },
229
254