tsz 3 rokov pred
rodič
commit
cb66e0d97c

+ 23 - 2
src/web/staticres/frontRouter/pc/mesgCenter/js/index-pc.js

@@ -27,15 +27,36 @@ var vm = new Vue({
     }
   },
   created() {
-    this.shunted = JSON.parse(localStorage.getItem('kf-shunt-data'))
-    console.log(this.shunted)
     this.tabsCount()
     this.tabsData('0')
+    this.kfContacts()
     this.kfData()
   },
   methods: {
+    // 私信显示、隐藏
+    kfContacts() {
+      const _this = this
+      $.post({
+        url: '/jyapi/social/obtainShunt',// 分流
+        type: 'POST',
+        data: JSON.stringify({type: 'PC', isFind: true}),
+        contentType: 'application/json',
+        success: function (res) {
+          if(res.data.isShunt) {
+            if (res.data.url !== '') {
+              _this.shunted = !res.data.isOld
+            } else {
+              _this.shunted = false
+            }
+          } else {
+            _this.shunted = false
+          }
+        }
+      })
+    },
     // 私信数量
     kfData() {
+      const _this = this
       $.ajax({
         type: 'POST',
         url: '/jyapi/message/messageCount',

+ 139 - 79
src/web/staticres/public-pc/js/pc-bottom.js

@@ -73,101 +73,161 @@ function getKfDate(res) {
   console.info(current)
 
 }
-var kfType = {}
-function kfContact() {
+function kfContact(bool) {
   $.post({
     url: '/jyapi/social/obtainShunt',// 分流
     type: 'POST',
-    data: JSON.stringify({type: 'PC'}),
+    data: JSON.stringify({type: 'PC', isFind: bool}),
     contentType: 'application/json',
     success: function (res) {
-      var kfDatas = JSON.stringify({
-        isShunt: res.data.isShunt,
-        url: res.data.url,
-        currentDate: new Date(new Date()).toLocaleDateString()
-      })
-      var getDates = localStorage.getItem('kf-shunt-data')
-      var currents = new Date(new Date()).toLocaleDateString()
-      console.info(getDates, currents)
-      kfType = localStorage.getItem('kf-shunt-data')
-      if (getDates) {
-        if (currents !== JSON.parse(getDates).currentDate) {
-          localStorage.setItem('kf-shunt-data', kfDatas)
+      var kfDatas = JSON.stringify(res.data)
+      localStorage.setItem('kf-shunt-data', kfDatas)
+      if (res.data.isShunt) {
+        if (!res.data.url) {
+          kfContact(false)
+        } else {
+          if (res.data.isOld) {
+            //智齿
+            /* 客服咨询 */
+            ;(function (w, d, e, x) {
+              w[e] = function () { w.cbk = w.cbk || []; w.cbk.push(arguments); }
+              x = d.createElement('script');
+              x.async = true;
+              x.id = 'zhichiScript';
+              x.className="open-customer";
+              // wxh5、app、pc
+              x.src = 'https://pc-jianyu.sobot.com/chat/frame/v2/entrance.js?sysnum=9d1e3980f91e4b75b8f04e2d206a4c76&t=' + new Date().getTime();
+              d.body.appendChild(x);
+            })(window, document, 'zc');
+  
+            var ajaxUserInfo = {
+              headImage: '',
+              nickName: '默认昵称',
+              userId: '',
+            }
+            function setConfig () {
+              typeof window.getUserInfoCallback === 'function' ? getUserInfoCallback() : null
+              zc("config", {
+                custom:true,
+                auto_expand: false,
+                show_face: 1,
+                partnerid: ajaxUserInfo.userId,
+                face: ajaxUserInfo.headImage,
+                height: '640',
+                async: 0,
+                manual: false
+              })
+              zc("offline_message_count",function(res){
+                // console.log(res, 'offline_message_count')
+                if (res && res.size && res.size > 0) {
+                  var omc = res.size > 99 ? '99+' : res.size
+                  $(".icon-badge-number").attr('data-badge-number', omc)
+                } else {
+                  $(".icon-badge-number").removeAttr('data-badge-number')
+                }
+              })
+              zc("dynamic_ready")
+            }
+            $.post("/jypay/user/getSimpleData?t="+new Date().getTime(),{},function(r) {
+              if (r) {
+                Object.keys(ajaxUserInfo).forEach(function (v) {
+                  if (r[v] && r[v] !== '') {
+                    ajaxUserInfo[v] = r[v]
+                  }
+                })
+                // 存储userId 大会员中标预测历史记录要用到
+                localStorage.setItem('BIGMEMBER_PC', r.userId)
+              }
+              setConfig()
+            }).fail(function () {
+              ajaxUserInfo = {
+                headImage: '',
+                nickName: '默认昵称',
+                userId: '',
+              }
+              setConfig()
+            })
+          } else {
+            //剑鱼
+            window.open(res.data.url)
+          }
         }
       } else {
-        localStorage.setItem('kf-shunt-data', kfDatas)
-      }
-      if (!JSON.parse(kfType).isShunt) {
-        localStorage.setItem('kf-shunt-data', kfDatas)
-      }
-      console.info(JSON.parse(kfType).isShunt,JSON.parse(kfType).url)
-      if (!JSON.parse(kfType).isShunt || JSON.parse(kfType).isShunt && JSON.parse(kfType).url == 'zcpc') {
-        /* 客服咨询 */
-        ;(function (w, d, e, x) {
-          w[e] = function () { w.cbk = w.cbk || []; w.cbk.push(arguments); }
-          x = d.createElement('script');
-          x.async = true;
-          x.id = 'zhichiScript';
-          x.className="open-customer";
-          // wxh5、app、pc
-          x.src = 'https://pc-jianyu.sobot.com/chat/frame/v2/entrance.js?sysnum=9d1e3980f91e4b75b8f04e2d206a4c76&t=' + new Date().getTime();
-          d.body.appendChild(x);
-        })(window, document, 'zc');
-
-        var ajaxUserInfo = {
-          headImage: '',
-          nickName: '默认昵称',
-          userId: '',
-        }
-        function setConfig () {
-          typeof window.getUserInfoCallback === 'function' ? getUserInfoCallback() : null
-          zc("config", {
-            custom:true,
-            auto_expand: false,
-            show_face: 1,
-            partnerid: ajaxUserInfo.userId,
-            face: ajaxUserInfo.headImage,
-            height: '640',
-            async: 0,
-            manual: false
-          })
-          zc("offline_message_count",function(res){
-            // console.log(res, 'offline_message_count')
-            if (res && res.size && res.size > 0) {
-              var omc = res.size > 99 ? '99+' : res.size
-              $(".icon-badge-number").attr('data-badge-number', omc)
-            } else {
-              $(".icon-badge-number").removeAttr('data-badge-number')
+        if(res.data.url) {
+          if (res.data.isOld) {
+            //智齿
+           /* 客服咨询 */
+           ;(function (w, d, e, x) {
+            w[e] = function () { w.cbk = w.cbk || []; w.cbk.push(arguments); }
+            x = d.createElement('script');
+            x.async = true;
+            x.id = 'zhichiScript';
+            x.className="open-customer";
+            // wxh5、app、pc
+            x.src = 'https://pc-jianyu.sobot.com/chat/frame/v2/entrance.js?sysnum=9d1e3980f91e4b75b8f04e2d206a4c76&t=' + new Date().getTime();
+            d.body.appendChild(x);
+          })(window, document, 'zc');
+            var ajaxUserInfo = {
+              headImage: '',
+              nickName: '默认昵称',
+              userId: '',
             }
-          })
-          zc("dynamic_ready")
-        }
-        $.post("/jypay/user/getSimpleData?t="+new Date().getTime(),{},function(r) {
-          if (r) {
-            Object.keys(ajaxUserInfo).forEach(function (v) {
-              if (r[v] && r[v] !== '') {
-                ajaxUserInfo[v] = r[v]
+            function setConfig () {
+              typeof window.getUserInfoCallback === 'function' ? getUserInfoCallback() : null
+              zc("config", {
+                custom:true,
+                auto_expand: false,
+                show_face: 1,
+                partnerid: ajaxUserInfo.userId,
+                face: ajaxUserInfo.headImage,
+                height: '640',
+                async: 0,
+                manual: false
+              })
+              zc("offline_message_count",function(res){
+                // console.log(res, 'offline_message_count')
+                if (res && res.size && res.size > 0) {
+                  var omc = res.size > 99 ? '99+' : res.size
+                  $(".icon-badge-number").attr('data-badge-number', omc)
+                } else {
+                  $(".icon-badge-number").removeAttr('data-badge-number')
+                }
+              })
+              zc("dynamic_ready")
+            }
+            $.post("/jypay/user/getSimpleData?t="+new Date().getTime(),{},function(r) {
+              if (r) {
+                Object.keys(ajaxUserInfo).forEach(function (v) {
+                  if (r[v] && r[v] !== '') {
+                    ajaxUserInfo[v] = r[v]
+                  }
+                })
+                // 存储userId 大会员中标预测历史记录要用到
+                localStorage.setItem('BIGMEMBER_PC', r.userId)
               }
+              setConfig()
+            }).fail(function () {
+              ajaxUserInfo = {
+                headImage: '',
+                nickName: '默认昵称',
+                userId: '',
+              }
+              setConfig()
             })
-            // 存储userId 大会员中标预测历史记录要用到
-            localStorage.setItem('BIGMEMBER_PC', r.userId)
-          }
-          setConfig()
-        }).fail(function () {
-          ajaxUserInfo = {
-            headImage: '',
-            nickName: '默认昵称',
-            userId: '',
+          }else{
+            //剑鱼
+            window.open(res.data.url)
           }
-          setConfig()
-        })
+        }
       }
     }
   })
 }
 $(function () {
   scrollSideIconHide()
-  kfContact()
+  $('.help-slide-zx.open-customer').click(function() {
+    kfContact(true)
+  })
 })
 var openCustomDig = false
 window.onmessage = function(e){
@@ -192,7 +252,7 @@ $(window).on('click', function (e) {
     openCustomDig = true
     var shunt = JSON.parse(localStorage.getItem('kf-shunt-data'))
     console.info(shunt)
-    if (shunt.url && shunt.url !== 'zcpc') {
+    if (shunt.isShunt && shunt.url && !shunt.isOld) {
       // 登录判断
       if (!loginflag) {
         openLoginDig()

+ 1 - 1
src/web/templates/frontRouter/pc/messageCenter/sess/index.html

@@ -76,7 +76,7 @@
                   ></el-pagination>
                 </div>
               </el-tab-pane>
-              <el-tab-pane v-if="shunted.isShunt && shunted.url !== 'zcpc'">
+              <el-tab-pane v-show="shunted">
                 <div class="msg-label" slot="label" @click="kfHref">
                   <img src='{{Msg "seo" "cdn"}}/frontRouter/pc/mesgCenter/image/sixin@2x.png?v={{Msg "seo" "version"}}'>
                   <i class="b-item" v-show="kfCount">{kfCount > 99 ? '99+' : kfCount}</i>