소스 검색

product/component/:id页面跳转空对象判断;优软互联登录状态判断

yangc 8 년 전
부모
커밋
e6f5d9974c
2개의 변경된 파일38개의 추가작업 그리고 28개의 파일을 삭제
  1. 28 20
      components/default/RightBar.vue
  2. 10 8
      components/product/component/ComponentDetail.vue

+ 28 - 20
components/default/RightBar.vue

@@ -153,27 +153,35 @@
         this.loadHistorys()
       },
       goWebChat: function () {
-        // 获得窗口的垂直位置
-        let iTop = (window.screen.availHeight - 30 - 600) / 2
-        // 获得窗口的水平位置
-        let iLeft = (window.screen.availWidth - 10 - 1030) / 2
-        let newTab = window.open('', '即时对话框', 'height=600, width=1030, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
-        axios.get('/basic/enterprise/' + this.enterprise.uu + '/info')
-          .then(response => {
-            let obj = {}
-            obj.enUU = response.data.uu
-            obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
-            obj.type = 'LIST'
-            obj.userPhone = this.user.data.userTel
-            axios.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
-              .then(response => {
-                if (response.data.success) {
-                  newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
-                }
-              })
-          }, err => {
-            console.log(err)
+        if (!this.$store.state.option.user.logged) {
+          this.$http.get('/login/page').then(response => {
+            if (response.data) {
+              this.$router.push('/auth/login')
+            }
           })
+        } else {
+          // 获得窗口的垂直位置
+          let iTop = (window.screen.availHeight - 30 - 600) / 2
+          // 获得窗口的水平位置
+          let iLeft = (window.screen.availWidth - 10 - 1030) / 2
+          let newTab = window.open('', '即时对话框', 'height=600, width=1030, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+          axios.get('/basic/enterprise/' + this.enterprise.uu + '/info')
+            .then(response => {
+              let obj = {}
+              obj.enUU = response.data.uu
+              obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
+              obj.type = 'LIST'
+              obj.userPhone = this.user.data.userTel
+              axios.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+                .then(response => {
+                  if (response.data.success) {
+                    newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
+                  }
+                })
+            }, err => {
+              console.log(err)
+            })
+        }
       }
     }
   }

+ 10 - 8
components/product/component/ComponentDetail.vue

@@ -85,14 +85,16 @@
         return this.$store.state.option.user
       },
       collectList () {
-        let id = this.lists.data.properties[0].componentId
-       // console.log(this.lists.data)
-        let store = this.$store.state.product.common.collectList.data
-        var _this = this
-        if (store) {
-          for (var i = 0; i < store.length; i++) {
-            if (store[i].componentid === id) {
-              _this.isShow = true
+        if (this.lists.data.properties && this.lists.data.properties > 0) {
+          let id = this.lists.data.properties[0].componentId
+          // console.log(this.lists.data)
+          let store = this.$store.state.product.common.collectList.data
+          let _this = this
+          if (store) {
+            for (let i = 0; i < store.length; i++) {
+              if (store[i].componentid === id) {
+                _this.isShow = true
+              }
             }
           }
         }