|
@@ -5,18 +5,17 @@ var vm = new Vue({
|
|
|
data: function () {
|
|
|
return {
|
|
|
loading: false,
|
|
|
- activeName: '0',
|
|
|
+ activeName: '-1',
|
|
|
counts: [],
|
|
|
kfCount: 0,
|
|
|
- isTabs: '',
|
|
|
shuntData: {},
|
|
|
shunted: true,
|
|
|
imgSrcs: [
|
|
|
- { type: '0', title: '全部', url: '/images/pc/quanbu@2x.png' }, { type: '1', title: '活动通知', url: '/images/pc/huodong@2x.png' },
|
|
|
+ { type: '-1', 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' },
|
|
|
- { type: '8', title: '私信', url: '/images/pc/sixin@2x.png' }, { type: '9', title: '剑鱼学堂', url: '/images/pc/xuetang@2x.png' }
|
|
|
+ { type: '8', title: '剑鱼学堂', url: '/images/pc/xuetang@2x.png' }, { type: '9', title: '私信', url: '/images/pc/sixin@2x.png' }
|
|
|
],
|
|
|
tabsList: {
|
|
|
lasts: [],
|
|
@@ -24,16 +23,52 @@ var vm = new Vue({
|
|
|
offset: 1,
|
|
|
pageSize: 20,
|
|
|
totals: 0,
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 全部的时候未读消息条数
|
|
|
+ unread: 0
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.tabsCount()
|
|
|
- this.tabsData('0')
|
|
|
+ this.getList()
|
|
|
this.kfContacts()
|
|
|
this.kfData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getList (msgType) {
|
|
|
+ var _this = this
|
|
|
+ var type = msgType !== null && msgType !== undefined ? Number(msgType) : -1
|
|
|
+ var params = {
|
|
|
+ isColumn: true,
|
|
|
+ isColumnNewMsg: false,
|
|
|
+ isMsgList: true,
|
|
|
+ msgType: type,
|
|
|
+ isRead: -1,
|
|
|
+ offset: this.tabsList.offset,
|
|
|
+ size: this.tabsList.pageSize
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ $.ajax({
|
|
|
+ url: '/messageCenter/MessageList',
|
|
|
+ type: 'POST',
|
|
|
+ data: JSON.stringify(params),
|
|
|
+ dataType: 'json',
|
|
|
+ headers: {'Content-Type': 'application/json'},
|
|
|
+ success:function (res) {
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.loading = false
|
|
|
+ }, 300)
|
|
|
+ if(res.code === 0) {
|
|
|
+ _this.counts = res.column || []
|
|
|
+ _this.tabsList.lists = []
|
|
|
+ _this.tabsList.lasts = $.isEmptyObject(res.last) ? false : res.last
|
|
|
+ _this.tabsList.lists = $.isEmptyObject(res.data) ? false : res.data
|
|
|
+ _this.tabsList.totals = res.total
|
|
|
+ if(type === -1 ) _this.unread = res.unread
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function () {}
|
|
|
+ })
|
|
|
+ },
|
|
|
// 私信显示、隐藏
|
|
|
kfContacts() {
|
|
|
const _this = this
|
|
@@ -69,75 +104,35 @@ var vm = new Vue({
|
|
|
goCustomerUrl({ openNewWindow: true })
|
|
|
},
|
|
|
tabClick(val) {
|
|
|
- console.log(val)
|
|
|
- this.isTabs = val.name
|
|
|
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
|
|
|
- this.loading = true
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: '/jymessageCenter/messageList',
|
|
|
- data: {
|
|
|
- needFilter: 0,
|
|
|
- msgType: num,
|
|
|
- isRead: '-1',
|
|
|
- offset: this.tabsList.offset,
|
|
|
- pageSize: this.tabsList.pageSize
|
|
|
- },
|
|
|
- success: function (res) {
|
|
|
- setTimeout(() => {
|
|
|
- _this.loading = false
|
|
|
- }, 300)
|
|
|
- if (res && res.status == 1) {
|
|
|
- _this.tabsList.lists = []
|
|
|
- _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
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ this.getList(val.name)
|
|
|
},
|
|
|
onPageChange(page) {
|
|
|
this.tabsList.offset = page
|
|
|
- this.tabsData(this.isTabs)
|
|
|
+ this.getList(this.activeName)
|
|
|
},
|
|
|
- readed(ids, type, url) {
|
|
|
+ readed(id, url) {
|
|
|
const _this = this
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
- url: '/jymessageCenter/markRead',
|
|
|
- data: {
|
|
|
- msgId: ids,
|
|
|
- msgType: type
|
|
|
- },
|
|
|
+ url: '/messageCenter/markRead',
|
|
|
+ data: JSON.stringify({
|
|
|
+ msgId: id ? Number(id) : null
|
|
|
+ }),
|
|
|
+ headers: {'Content-Type': 'application/json'},
|
|
|
success: function () {
|
|
|
- _this.tabsData(_this.isTabs)
|
|
|
- _this.tabsCount()
|
|
|
- message.checkOpened()
|
|
|
- message.checkMessage()
|
|
|
+ window.__canNextReadMessageStatus = false
|
|
|
+ _this.getList(_this.activeName)
|
|
|
+ if(message){
|
|
|
+ message.getMessageList()
|
|
|
+ }
|
|
|
if (url) {
|
|
|
location.href = url
|
|
|
- window.__canNextReadMessageStatus = false
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 消息统计
|
|
|
clickMesg(logid) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
@@ -149,24 +144,35 @@ var vm = new Vue({
|
|
|
success: function () { }
|
|
|
})
|
|
|
},
|
|
|
- linked(id, url, str, num, type, msgLogid) {
|
|
|
+ linked(item) {
|
|
|
if (window.__canNextReadMessageStatus) {
|
|
|
return
|
|
|
}
|
|
|
window.__canNextReadMessageStatus = true
|
|
|
- this.clickMesg(msgLogid)
|
|
|
- if (str == 0) {
|
|
|
- this.readed(id, type, url)
|
|
|
+ // this.clickMesg(item.msgLogid)
|
|
|
+ if (item.isRead == 0) {
|
|
|
+ this.readed(item.id, item.link)
|
|
|
} else {
|
|
|
- if (url) {
|
|
|
- location.href = url
|
|
|
- window.__canNextReadMessageStatus = false
|
|
|
+ window.__canNextReadMessageStatus = false
|
|
|
+ if (item.link) {
|
|
|
+ location.href = item.link
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 清楚未读
|
|
|
cleanNoRead() {
|
|
|
- console.dir('清除未读')
|
|
|
+ var _this = this
|
|
|
+ $.ajax({
|
|
|
+ url: '/messageCenter/ClearUnreadMsg',
|
|
|
+ type: 'POST',
|
|
|
+ success:function (res) {
|
|
|
+ _this.getList()
|
|
|
+ if(message){
|
|
|
+ message.getMessageList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function () {}
|
|
|
+ })
|
|
|
},
|
|
|
jumpPushPage () {
|
|
|
location.href = '/big/push_setting'
|