wangxiaogang 3 سال پیش
والد
کامیت
e123ad7fbf

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

@@ -89,9 +89,6 @@ var vm = new Vue({
       })
     },
     linked(id, url, str, num, type) {
-      if (url) {
-        location.href = url
-      }
       if (num == 1) {
         if (url) {
           this.readed(id, type)
@@ -102,6 +99,9 @@ var vm = new Vue({
           this.readed(id, type)
         }
       }
+      if (url) {
+        location.href = url
+      }
     }
   }
 })

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

@@ -60,7 +60,7 @@
       </div>
     </div>
     <!-- 底部导航 -->
-    {{include "/weixin/tabbar.html"}}
+    {{include "/weixin/tabbar.html" "123"}}
   </div>
   <!--S-当前页面的资源-->
   <script src=https://cdn-common.jianyu360.com/cdn/lib/vue/2.6.11/vue.min.js></script>

+ 83 - 67
src/web/templates/weixin/tabbar.html

@@ -33,6 +33,17 @@
 <script src=//cdn-common.jianyu360.com/cdn/lib/zepto/1.2.0/zepto.min.js></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/messageCenter/js/func.js?v={{Msg "seo" "version"}}'></script>
 <script>
+  function backRefresh () {
+    var isPageHide = false;
+    window.addEventListener('pageshow', function () {
+        if (isPageHide) {
+            location.reload();
+        }
+    });
+    window.addEventListener('pagehide', function () {
+        isPageHide = true;
+    });
+  }
 	var vm = new Vue({
   el: '#tabMesg',
   delimiters: ['{', '}'],
@@ -40,75 +51,80 @@
     return {
 			tabActive: 0,
 			counts: 0,
-            tabList: [
-              {
-                label: '首页',
-                icon: 'home',
-                url: '/jylab/mainSearch',
-                index: 0
-              },
-              {
-                label: '订阅',
-                icon: 'book',
-                url: '/swordfish/newhistorypush',
-                index: 1
-              },
-              {
-                label: '消息',
-                icon: 'mesg',
-                url: '/weixin/frontPage/messageCenter/sess/index',
-                index: 2
-              },
-              {
-                label: '百宝箱',
-                icon: 'box',
-                url: '/page_treasurebox/index.html',
-                index: 3
-              },
-              {
-                label: '我的',
-                icon: 'mine',
-                url: '/front/wxMyOrder/myMenu',
-                index: 4
-              },
-            ]
+      tabList: [
+        {
+          label: '首页',
+          icon: 'home',
+          url: '/jylab/mainSearch',
+          index: 0
+        },
+        {
+          label: '订阅',
+          icon: 'book',
+          url: '/swordfish/newhistorypush',
+          index: 1
+        },
+        {
+          label: '消息',
+          icon: 'mesg',
+          url: '/weixin/frontPage/messageCenter/sess/index',
+          index: 2
+        },
+        {
+          label: '百宝箱',
+          icon: 'box',
+          url: '/page_treasurebox/index.html',
+          index: 3
+        },
+        {
+          label: '我的',
+          icon: 'mine',
+          url: '/front/wxMyOrder/myMenu',
+          index: 4
+        },
+      ]
 		}
 	},
+
 	created() {
+    var uMsg = Number(getQueryString('msg') || this.getURLIndex())
+    this.tabActive = uMsg
 		this.tabsCount()
-        var uMsg = Number(getQueryString('msg') || this.getURLIndex())
-        this.tabActive = uMsg
 	},
-    computed: {
-      getMsgCount: function () {
-        return this.counts ? (this.counts > 99 ? '99+' : this.counts) : ''
+  mounted() {
+    backRefresh()
+  },
+  computed: {
+    getMsgCount: function () {
+      return this.counts ? (this.counts > 99 ? '99+' : this.counts) : ''
+    }
+  },
+	methods: {
+    getURLIndex: function () {
+      try {
+        var tempUrl = this.findMapsForUrl(this.tabList, location.pathname)
+        if (tempUrl.length) {
+          return tempUrl[0].index
+        } else {
+          return ''
+        }
+      } catch (e) {
+        return ''
       }
     },
-	methods: {
-        getURLIndex: function () {
-          try {
-            var tempUrl = this.findMapsForUrl(this.tabList, location.pathname)
-            if (tempUrl.length) {
-              return tempUrl[0].index
-            } else {
-              return ''
-            }
-          } catch (e) {
-            return ''
-          }
-        },
-        findMapsForUrl: function (arr, url) {
-          var tempReuslt = []
-          arr.forEach(function (v) {
-            if (url.indexOf(v.url) !== -1) {
-              tempReuslt.push(v)
-            }
-          })
-          return tempReuslt.sort(function(a,b) {
-            return b.url.length - a.url.length
-          })
-        },
+    findMapsForUrl: function (arr, url) {
+      var tempReuslt = []
+      arr.forEach(function (v) {
+        if (url.indexOf(v.url) !== -1) {
+          tempReuslt.push(v)
+        }
+      })
+      return tempReuslt.sort(function(a,b) {
+        return b.url.length - a.url.length
+      })
+    },
 		tabsCount() {
+      console.log('1212')
       const _this = this
       $.ajax({
         type:'GET',
@@ -122,12 +138,12 @@
       })
     },
 		routeHref(index) {
-          var goHref = this.tabList[index].url + '?msg=' + index
-          if (index === this.tabActive) {
-            location.replace(goHref)
-          } else {
-            location.href = goHref
-          }
+      var goHref = this.tabList[index].url + '?msg=' + index
+      if (index === this.tabActive) {
+        location.replace(goHref)
+      } else {
+        location.href = goHref
+      }
 		}
 	}
 })