@@ -222,14 +222,14 @@ export default {
222222 },
223223 initWebSocket () { // 初始化 weosocket
224224 if (' WebSocket' in window ) {
225- // const url = 'wss://www.guke1.com/ws?action=api_excel&token=' + getToken()
226- const url = ' ws://localhost:5200?action=api_excel&token=' + getToken ()
225+ const url = process .env .WEBSOCKET + ' ?action=api_excel&token=' + getToken ()
227226 this .websock = new WebSocket (url)
228227 this .websock .onmessage = this .onmessage
229228 this .websock .onopen = this .onopen
230229 this .websock .onerror = this .onerror
231230 this .websock .onclose = this .close
232231 } else {
232+ this .fetchData ()
233233 // 浏览器不支持 WebSocket,使用 ajax 轮询
234234 console .log (' Your browser does not support WebSocket!' )
235235 }
@@ -249,7 +249,7 @@ export default {
249249 const data = JSON .parse (e .data )
250250 // this.list[2].rate = parseInt(data.data.rate)
251251 // console.log(this.list[2].rate)
252- console .log (data)
252+ // console.log(data)
253253 // websocket 返回的数据
254254 this .list = data .data .data
255255 this .listLoading = false
@@ -265,14 +265,14 @@ export default {
265265 this .websock .send (Data)
266266 },
267267 close () { // 关闭
268- console .log (' 断开连接' )
268+ // console.log('断开连接')
269269 },
270270 download (index , row ) {
271271 window .location .href = this .url + row .finish_url
272272 },
273273 download_log (index , row ) {
274274 download_log ({ id: row .id }).then (res => {
275- console .log (res)
275+ // console.log(res)
276276 if (res .code === 200 ) {
277277 window .location .href = this .url + res .data .failed_done_file
278278 }
0 commit comments