瀏覽代碼

xiuagi信息

tangning 3 年之前
父節點
當前提交
03b2d72d2c
共有 4 個文件被更改,包括 11 次插入6 次删除
  1. 3 3
      src/request/config.js
  2. 1 0
      src/request/setupAxios.js
  3. 1 1
      src/view/scene/Initiator.vue
  4. 6 2
      src/view/scene/visitor.vue

+ 3 - 3
src/request/config.js

@@ -217,9 +217,9 @@ export const uploadAttachImage = '/web/fireProject/uploadImage'
   // 下载
   export const downloadScene = '/web/scene/downloadScene/'
   // 带看相关接口
-  export const offLine = '/web/fireProject/offLine/'//{roomId}
-  export const onLine = '/web/fireProject/onLine/'//{roomId}
-  export const onLineCheck = '/web/fireProject/onLineCheck/'
+  export const offLine = '/web/fireProject/offLine'//{roomId}
+  export const onLine = '/web/fireProject/onLine'//{roomId}
+  export const onLineCheck = '/web/fireProject/onLineCheck'
 
 // 不需要登录就能请求的接口
 export const notLoginUrls = [userLogin, getCode, sendUserMsg, userReg, updatePsw, getCompanyList, fireDetailByPsw, getAttachListByPsw,onLineCheck]

+ 1 - 0
src/request/setupAxios.js

@@ -14,6 +14,7 @@ axios.interceptors.request.use(async config => {
   const app = getApp()
 
   if (!user.value.token && !~notLoginUrls.indexOf(config.url)) {
+    console.log('用户未登录',config.url)
     app.$router.replace({name: 'login'})
     throw '用户未登录'
   }

+ 1 - 1
src/view/scene/Initiator.vue

@@ -101,7 +101,7 @@ export default {
     },
     async setStateLine(type){
       let apiUrl = type?onLine:offLine
-      await axios.get(apiUrl+this.roomId, {})
+      await axios.get(apiUrl, {params:{roomId:this.roomId}})
     },
     async handleMessage(event){
         let that = this

+ 6 - 2
src/view/scene/visitor.vue

@@ -124,7 +124,7 @@ export default {
                   if(that.token){
                     that.$router.push({name: 'home'})
                   }else{
-                    that.lineCheck()
+                    window.location.href = 'noAccess.html'
                   }
                 }
             }
@@ -133,7 +133,11 @@ export default {
     },
     async lineCheck(){
       let { roomId } = getQueryString(this.url)
-      let {data} = await axios.get(onLineCheck+roomId, {})
+      if(!this.token){
+        window.location.href = 'noAccess.html'
+        return 
+      }
+      let {data} = await axios.get(onLineCheck, {params:{roomId}})
       console.log('房间号不存在===>',data)
       if(data.error){
           window.location.href = 'noAccess.html'