Browse Source

关闭WebSocket服务。

lighter 4 years ago
parent
commit
1c5eddfab8

+ 4 - 4
src/utils/dev-prod.js

@@ -1,9 +1,9 @@
 // 测试
-// export const apiUrl = 'http://172.16.30.26:8805/wxserver/'
+export const apiUrl = 'http://172.16.30.26:8805/wxserver/'
 // export const url8083 = 'ws://172.16.30.26:8805/wxserver/websocket/'
 // export const url8085 = 'ws://172.16.30.26:8805/wxserver/websocket/'
 
 // 线上
-export const apiUrl = 'http://218.104.151.241:8805/wxserver'
-export const url8083 = 'ws://218.104.151.241:8083/wxserver/websocket/'
-export const url8085 = 'ws://218.104.151.241:8085/wxserver/websocket/'
+// export const apiUrl = 'http://218.104.151.241:8805/wxserver'
+// export const url8083 = 'ws://218.104.151.241:8083/wxserver/websocket/'
+// export const url8085 = 'ws://218.104.151.241:8085/wxserver/websocket/'

+ 55 - 55
src/utils/websocket.js

@@ -1,55 +1,55 @@
-import { Notify } from 'vant'
-import { getLocalOpenId } from './check-patient-id'
-import { url8083, url8085 } from './dev-prod'
-
-let count = 0
-
-let webSocket = null
-
-export function closeWebSocket() {
-  if (webSocket !== null) {
-    webSocket.close()
-    webSocket = null
-  }
-}
-
-export function initWebSocket() {
-  if (webSocket === null) {
-    count += 1
-    const openId = getLocalOpenId()
-    if (count % 2 === 1) {
-      webSocket = new WebSocket(url8083 + openId)
-    } else {
-      webSocket = new WebSocket(url8085 + openId)
-    }
-  }
-
-  webSocket.onopen = function () {
-    count = 0
-    console.log('WebSocket连接成功')
-  }
-
-  webSocket.onmessage = function (e) {
-    Notify({
-      type: 'primary',
-      message: e.data,
-      duration: 3000,
-    })
-  }
-
-  webSocket.onclose = function () {
-    webSocket = null
-    if (count >= 60) {
-      console.log('重连WebSocket超过最大次数,已放弃。')
-      return
-    }
-    setTimeout(() => {
-      initWebSocket()
-    }, 10 * 1000)
-  }
-
-  webSocket.onerror = function () {
-    webSocket = null
-    console.error('WebSocket连接发生错误')
-  }
-}
+// import { Notify } from 'vant'
+// import { getLocalOpenId } from './check-patient-id'
+// import { url8083, url8085 } from './dev-prod'
+
+// let count = 0
+
+// let webSocket = null
+
+// export function closeWebSocket() {
+//   if (webSocket !== null) {
+//     webSocket.close()
+//     webSocket = null
+//   }
+// }
+
+// export function initWebSocket() {
+//   if (webSocket === null) {
+//     count += 1
+//     const openId = getLocalOpenId()
+//     if (count % 2 === 1) {
+//       webSocket = new WebSocket(url8083 + openId)
+//     } else {
+//       webSocket = new WebSocket(url8085 + openId)
+//     }
+//   }
+
+//   webSocket.onopen = function () {
+//     count = 0
+//     console.log('WebSocket连接成功')
+//   }
+
+//   webSocket.onmessage = function (e) {
+//     Notify({
+//       type: 'primary',
+//       message: e.data,
+//       duration: 3000,
+//     })
+//   }
+
+//   webSocket.onclose = function () {
+//     webSocket = null
+//     if (count >= 60) {
+//       console.log('重连WebSocket超过最大次数,已放弃。')
+//       return
+//     }
+//     setTimeout(() => {
+//       initWebSocket()
+//     }, 10 * 1000)
+//   }
+
+//   webSocket.onerror = function () {
+//     webSocket = null
+//     console.error('WebSocket连接发生错误')
+//   }
+// }

+ 2 - 2
src/views/Home.vue

@@ -13,7 +13,7 @@ import { getOpenId, getPatientIdByOpenId } from '../api/patient-id-cards'
 import store from '../store'
 import { useRouter } from 'vue-router'
 import { computed, onMounted } from 'vue'
-import { initWebSocket } from '../utils/websocket'
+// import { initWebSocket } from '../utils/websocket'
 export default {
   name: 'Home',
   setup() {
@@ -22,7 +22,7 @@ export default {
       return store.state.patientCards.length
     })
     const toFirstTab = () => {
-      initWebSocket()
+      // initWebSocket()
       let to = router.currentRoute.value.params.to
       if (!to) {
         to = 'hospitalService'

+ 1 - 1
src/views/hospital-service/HospitalServiceHome.vue

@@ -173,7 +173,7 @@ export default {
     }
 
     const openExternalLink = () => {
-      window.open('http://218.104.151.241:18888', '_self')
+      window.open('http://staticweb.hnthyy.cn:1080', '_self')
     }
 
     const toVaccinateAppointment = () => {

+ 1 - 0
src/views/hospital-service/health-cart/BookableExaminations.vue

@@ -53,6 +53,7 @@ export default {
     }
     onMounted(() => {
       getBookableData(tableName).then((res) => {
+        console.log(res)
         examItems.value = res
       })
     })