Browse Source

feat:分流

wangxiaogang 3 years ago
parent
commit
33ebe5737b

+ 13 - 0
src/web/staticres/frontRouter/pc/mesgCenter/js/index-pc.js

@@ -7,6 +7,7 @@ var vm = new Vue({
       loading: false,
       activeName: '0',
       counts: [],
+      kfCount: 0,
       isTabs: '',
       imgSrcs: [
         { type: '0', title: '全部', url: '/images/pc/quanbu@2x.png' }, { type: '1', title: '活动优惠', url: '/images/pc/huodong@2x.png' },
@@ -27,8 +28,20 @@ var vm = new Vue({
   created() {
     this.tabsCount()
     this.tabsData('0')
+    this.kfData()
   },
   methods: {
+    // 私信数量
+    kfData() {
+      $.ajax({
+        type: 'POST',
+        url: '/message/messageCount',
+        data: {},
+        success: function (res) {
+          _this.kfCount = res.data
+        }
+      })
+    },
     kfHref() {
       var shunt = JSON.parse(localStorage.getItem('kf-shunt-data'))
       if (shunt.url && shunt.url == 'zcpc') {

+ 11 - 31
src/web/staticres/public-pc/js/pc-bottom.js

@@ -74,33 +74,6 @@ function getKfDate(res) {
 
 }
 var kfType = {}
-function shunted () {
-  $.post({
-    url: '/message/obtainShunt',
-    type: 'POST',
-    // async: false,
-    data: JSON.stringify({type: 'PC'}),
-    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)
-      if (!getDates) {
-        localStorage.setItem('kf-shunt-data', kfDatas)
-      } else {
-        if (res.data.isShunt && currents !== JSON.parse(getDates).currentDate) {
-          localStorage.setItem('kf-shunt-data', kfDatas)
-        }
-      }
-      console.info(localStorage.getItem('kf-shunt-data'))
-    }
-  })
-}
 function kfContact() {
   /* 客服咨询 */
   $.post({
@@ -116,7 +89,7 @@ function kfContact() {
       })
       var getDates = localStorage.getItem('kf-shunt-data')
       var currents = new Date(new Date()).toLocaleDateString()
-      console.info(!getDates, currents)
+      console.info(getDates, currents)
       if (getDates) {
         if (currents !== JSON.parse(getDates).currentDate) {
           localStorage.setItem('kf-shunt-data', kfDatas)
@@ -126,7 +99,7 @@ function kfContact() {
       }
       kfType = localStorage.getItem('kf-shunt-data')
       console.info(JSON.parse(kfType).url)
-      if (JSON.parse(kfType).url == 'zcpc') {
+      if (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');
@@ -194,10 +167,10 @@ $(function () {
   kfContact()
 })
 $('.help-slide-bottom .open-customer').on('click', function (e) {
-  e.stopPropagation()
+  // e.stopPropagation()
   var shunt = JSON.parse(localStorage.getItem('kf-shunt-data'))
   if (shunt.url && shunt.url == 'zcpc') {
-    return
+    // return
   } else {
     location.href = shunt.url + '&mini=0'
   }
@@ -223,6 +196,13 @@ $(window).on('click', function (e) {
   var openDom = $(e.target).hasClass('open-customer') || $(e.target).parents().hasClass('open-customer')
   if (openDom) {
     openCustomDig = true
+    // var shunt = JSON.parse(localStorage.getItem('kf-shunt-data'))
+    // console.info(shunt)
+    // if (shunt.url && shunt.url == 'zcpc') {
+    //   // return
+    // } else {
+    //   location.href = shunt.url + '&mini=0'
+    // }
     $(".icon-badge-number").removeAttr('data-badge-number');
     var href = window.location.href;
     var sourceStr =""

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

@@ -79,7 +79,7 @@
               <el-tab-pane>
                 <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="item.count">{item.count > 99 ? '99+' : item.count}</i> -->
+                  <i class="b-item" v-show="kfCount">{kfCount > 99 ? '99+' : kfCount}</i>
                   <p class="words">私信</p>
                 </div>
               </el-tab-pane>