var vm = new Vue({ el: '.mesg-container', delimiters: ['{', '}'], data: function () { return { activeName: '0', counts: [], isTabs: '', imgSrcs: [ {type: '0', title: '全部', url:'/images/pc/quanbu@2x.png'},{type: '1', title: '活动优惠', url:'/images/pc/huodong@2x.png'}, {type: '2', title: '服务通知', url:'/images/pc/fuwu@2x.png'},{type: '3', title: '订阅消息', url:'/images/pc/dingyue@2x.png'}, {type: '4', title: '项目动态', url:'/images/pc/xiangmu@2x.png'},{type: '5', title: '企业动态', url:'/images/pc/qiye@2x.png'}, {type: '6', title: '分析报告', url:'/images/pc/fenxi@2x.png'},{type: '7', title: '系统通知', url:'/images/pc/xitong@2x.png'} ], tabsList: { lasts: [], lists: [], offset: 1, pageSize: 20, totals: 0, } } }, created() { this.tabsCount() this.tabsData('0') }, methods: { tabClick(val) { this.isTabs = val.name this.tabsList.lists = [] this.tabsList.offset = 1 this.tabsData(val.name) }, tabsCount() { const _this = this $.ajax({ type:'GET', url:'/jymessageCenter/ClassCount', data: {}, success:function (res) { if (res && res.status == 1) { _this.counts = res.data } } }) }, tabsData(num) { const _this = this $.ajax({ type:'POST', url:'/jymessageCenter/messageList', data: { needFilter: 0, msgType: num, isRead: '-1', offset: this.tabsList.offset, pageSize: this.tabsList.pageSize }, success:function (res) { if (res && res.status == 1) { _this.tabsList.lasts = $.isEmptyObject(res.data.last) ? false : res.data.last _this.tabsList.lists = $.isEmptyObject(res.data.list) ? false : res.data.list _this.tabsList.totals = res.data.total } } }) }, onPageChange(page) { this.tabsList.offset = page this.tabsList.lists = [] this.tabsData(this.isTabs) }, readed(ids) { const _this = this $.ajax({ type:'GET', url:'/jymessageCenter/markRead', data: { msgId: ids }, success:function () { _this.tabsData(_this.isTabs) _this.tabsCount() message.checkOpened() } }) }, linked(id, url, str, num) { if (url) { location.href = url } if (num == 1) { if (url) { this.readed(id) } } if (num == 2) { if (!str) { this.readed(id) } } } } })