|
@@ -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
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|