|
@@ -0,0 +1,122 @@
|
|
|
+/**首页中间滚动--未读消息--***/
|
|
|
+var vmMesg = new Vue({
|
|
|
+ el: '#vue-message-index-pc',
|
|
|
+ delimiters: ['${', '}'],
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ imgArrs: ['quanbu', 'huodong', 'fuwu', 'dingyue', 'xiangmu', 'qiye', 'fenxi', 'xitong'],
|
|
|
+ lists: [],
|
|
|
+ timer: null,
|
|
|
+ totalNum: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList: function() {
|
|
|
+ var _this = this
|
|
|
+ // /messageCenter/unreadMessages
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/jymessageCenter/messageList',
|
|
|
+ data: {
|
|
|
+ needFilter: 1,
|
|
|
+ msgType: '0',
|
|
|
+ isRead: '-1',
|
|
|
+ offset: 1,
|
|
|
+ pageSize: 20
|
|
|
+ },
|
|
|
+ success:function (res) {
|
|
|
+ if (res.data) {
|
|
|
+ var resList = res.data.list || []
|
|
|
+ _this.totalNum = res.data.total || 0
|
|
|
+ resList.forEach(function(v) {
|
|
|
+ v.msg_type_text = _this.msgType(v.msg_type)
|
|
|
+ v.createtime = dateMatter(v.createtime)
|
|
|
+ });
|
|
|
+ // 封装成二维数组(用于轮播两条为单位)
|
|
|
+ var arr = []
|
|
|
+ for(var i=0; i< Math.ceil(resList.length / 2); i++) {
|
|
|
+ var temp = resList.slice(i*2, (i*2+2))
|
|
|
+ arr.push(temp)
|
|
|
+ }
|
|
|
+ _this.lists = arr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function () {}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ readed: function(ids, type, url) {
|
|
|
+ var _this = this
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url:'/jymessageCenter/markRead',
|
|
|
+ data: {
|
|
|
+ msgId: ids,
|
|
|
+ msgType: type
|
|
|
+ },
|
|
|
+ success:function () {
|
|
|
+ if (url) {
|
|
|
+ location.href = url
|
|
|
+ } else {
|
|
|
+ location.href = '/swordfish/frontPage/messageCenter/sess/index'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ titleGoto: function(item) {
|
|
|
+ // 消息统计
|
|
|
+ this.clickMessage(item.msgLogid)
|
|
|
+ if (item.isRead == 0) {
|
|
|
+ this.readed(item.id, item.msg_type, item.link)
|
|
|
+ } else {
|
|
|
+ if(item.link) {
|
|
|
+ // 跳转链接
|
|
|
+ window.location.href = item.link
|
|
|
+ } else {
|
|
|
+ // 消息中心
|
|
|
+ location.href = '/swordfish/frontPage/messageCenter/sess/index'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ msgType: function(val) {
|
|
|
+ var obj = {
|
|
|
+ '1': '活动优惠',
|
|
|
+ '2': '服务通知',
|
|
|
+ '3': '订阅消息',
|
|
|
+ '4': '项目动态 ',
|
|
|
+ '5': '企业动态',
|
|
|
+ '6': '分析报告 ',
|
|
|
+ '7': '系统通知',
|
|
|
+ }
|
|
|
+ return obj[val]
|
|
|
+ },
|
|
|
+ // 消息统计
|
|
|
+ clickMessage(msgLogid) {
|
|
|
+ $.ajax({
|
|
|
+ type:'POST',
|
|
|
+ url:'/jymessageCenter/clickMessage',
|
|
|
+ data: {
|
|
|
+ msgLogId: msgLogid,
|
|
|
+ platform: '1'
|
|
|
+ },
|
|
|
+ success:function () {}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+function initIndexMsgList () {
|
|
|
+ try {
|
|
|
+ var el = vmMesg._data.el
|
|
|
+ var $el = $(el)
|
|
|
+ if ($el.length > 0) {
|
|
|
+ vmMesg.$mount(el)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+}
|