Ver Fonte

Merge branch 'master' of C:\Users\uas\uascode\SSR\mall-web-ssr with conflicts.

wangdy há 8 anos atrás
pai
commit
a245d3e21f
2 ficheiros alterados com 72 adições e 15 exclusões
  1. 70 13
      components/default/RightBar.vue
  2. 2 2
      nuxt.config.js

+ 70 - 13
components/default/RightBar.vue

@@ -26,13 +26,14 @@
             <p>周一至周五 9:00-18:00</p>
           </div>
         </li>
-        <!--<li class="right-bar-item contact-menu">
-          <a href="javascript:void(0)" class="title" @click="goWebChat" @mouseenter="getChatCount">
+        <li class="right-bar-item contact-menu">
+          <a href="javascript:void(0)" class="title" @click="goWebChat">
             <i class="fa fa-comments-o" aria-hidden="true" style="color: #FFFFFF;">
             </i>
+            <i class="remind-point" v-if="user.logged && chatCount>0"></i>
           </a>
           <div class="sidebar-menu" title="优软互联"><a @click="goWebChat">优软互联<span v-if="user.logged">({{chatCount}})</span></a></div>
-        </li>-->
+        </li>
       </ul>
       <ul class="right-bar-bottom">
         <li class="right-bar-item" @mouseenter="loadHistorys()">
@@ -103,11 +104,24 @@
       enterprise () {
         let ens = this.user.data.enterprises
         if (ens && ens.length) {
-          return ens.find(item => item.current) || ens[0]
+          return ens.find(item => item.current) || {enName: this.user.data.userName + '(个人账户)'}
+        } else {
+          return {enName: this.user.data.userName + '(个人账户)'}
         }
-        return {}
+      },
+      tab () {
+        return this.$store.state.chat.tab.tab.data
       }
     },
+    mounted () {
+      this.$nextTick(() => {
+        this.getChatCount()
+        // 刷新统计信息
+        setInterval(() => {
+          this.getChatCount()
+        }, 10000)
+      })
+    },
     methods: {
       listenPage: function (p) {
         this.page = p
@@ -171,28 +185,61 @@
           this.goLogin()
         } else {
           // 获得窗口的垂直位置
-          let iTop = (window.screen.availHeight - 30 - 600) / 2
+          let iTop = (window.screen.availHeight - 30 - 780) / 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')
+          if (this.tab.close) {
+            this.tab.close()
+          }
+          let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+          newTab.close()
+          newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+          this.$store.dispatch('chat/setChatTab', {tab: newTab})
           this.$http.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
-              this.$http.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
-                  }
+              if (!(/^1\d{10}$/).test(this.user.data.userTel)) {
+                this.$http.get('/basic/enterprise/' + obj.enUU + '/admin').then(response => {
+                  obj.userPhone = response.userTel
+                  this.openWebChat(newTab, obj)
+                }, err => {
+                  console.log(err)
+                  this.$message.error('暂无卖家管理员手机号!')
                 })
+              } else {
+                obj.userPhone = this.user.data.userTel
+                this.openWebChat(newTab, obj)
+              }
             }, err => {
               console.log(err)
+              let obj = {}
+              obj.type = 'LIST'
+              if (!(/^1\d{10}$/).test(this.user.data.userTel)) {
+                this.$http.get('/basic/enterprise/' + obj.enUU + '/admin').then(response => {
+                  obj.userPhone = response.userTel
+                  this.openWebChat(newTab, obj)
+                }, err => {
+                  console.log(err)
+                  this.$message.error('暂无卖家管理员手机号!')
+                })
+              } else {
+                obj.userPhone = this.user.data.userTel
+                this.openWebChat(newTab, obj)
+              }
             })
         }
       },
+      openWebChat: function (newTab, obj) {
+        this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+          .then(response => {
+            if (response.data.success) {
+              newTab.location.href = 'http://192.168.253.121:20220/chat/visit?gid=' + response.data.content
+            }
+          })
+      },
       getChatCount: function () {
         if (this.user.logged) {
           this.$http.get('http://im.ubtob.com/api/chat/message', {params: {enUU: this.enterprise.uu, operate: 'count_unread', phone: this.user.data.userTel}})
@@ -319,6 +366,16 @@
   .right-bar ul li a i{
     font-size: 20px;
   }
+  .right-bar .remind-point {
+    width: 8px;
+    height: 8px;
+    display: block;
+    border-radius: 100%;
+    background: red;
+    position: relative;
+    top: -31px;
+    right: -21px;
+  }
   .right-bar ul li li a:hover div.foot-record{
     display: inline-block !important;
   }

+ 2 - 2
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.60:9090/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://10.10.100.107:8081/platform-b2c/' : 'http://192.168.253.132:8888/b2c-auth/')
 
 module.exports = {
   router: {
@@ -107,5 +107,5 @@ module.exports = {
     ssr: false
   }],
   /* TODO 暂时代理到商城测试版,之后再做出调整 */
-  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**', '/keyword/**']
+  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**']
 }