index-pc.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. var vm = new Vue({
  2. el: '.mesg-container',
  3. delimiters: ['{', '}'],
  4. data: function () {
  5. return {
  6. loading: false,
  7. activeName: '0',
  8. counts: [],
  9. isTabs: '',
  10. imgSrcs: [
  11. { type: '0', title: '全部', url: '/images/pc/quanbu@2x.png' }, { type: '1', title: '活动优惠', url: '/images/pc/huodong@2x.png' },
  12. { type: '2', title: '服务通知', url: '/images/pc/fuwu@2x.png' }, { type: '3', title: '订阅消息', url: '/images/pc/dingyue@2x.png' },
  13. { type: '4', title: '项目动态', url: '/images/pc/xiangmu@2x.png' }, { type: '5', title: '企业动态', url: '/images/pc/qiye@2x.png' },
  14. { type: '6', title: '分析报告', url: '/images/pc/fenxi@2x.png' }, { type: '7', title: '系统通知', url: '/images/pc/xitong@2x.png' },
  15. { type: '8', title: '私信', url: '/images/pc/sixin@2x.png' }
  16. ],
  17. tabsList: {
  18. lasts: [],
  19. lists: [],
  20. offset: 1,
  21. pageSize: 20,
  22. totals: 0,
  23. }
  24. }
  25. },
  26. created() {
  27. this.tabsCount()
  28. this.tabsData('0')
  29. },
  30. methods: {
  31. kfClick() {
  32. $('.help-slide-zx.open-customer').trigger('click')
  33. },
  34. tabClick(val) {
  35. this.isTabs = val.name
  36. this.tabsList.offset = 1
  37. this.tabsData(val.name)
  38. },
  39. tabsCount() {
  40. const _this = this
  41. $.ajax({
  42. type: 'GET',
  43. url: '/jymessageCenter/ClassCount',
  44. data: {},
  45. success: function (res) {
  46. if (res && res.status == 1) {
  47. _this.counts = res.data
  48. }
  49. }
  50. })
  51. },
  52. tabsData(num) {
  53. const _this = this
  54. this.loading = true
  55. $.ajax({
  56. type: 'POST',
  57. url: '/jymessageCenter/messageList',
  58. data: {
  59. needFilter: 0,
  60. msgType: num,
  61. isRead: '-1',
  62. offset: this.tabsList.offset,
  63. pageSize: this.tabsList.pageSize
  64. },
  65. success: function (res) {
  66. setTimeout(() => {
  67. _this.loading = false
  68. }, 300)
  69. if (res && res.status == 1) {
  70. _this.tabsList.lists = []
  71. _this.tabsList.lasts = $.isEmptyObject(res.data.last) ? false : res.data.last
  72. _this.tabsList.lists = $.isEmptyObject(res.data.list) ? false : res.data.list
  73. _this.tabsList.totals = res.data.total
  74. }
  75. }
  76. })
  77. },
  78. onPageChange(page) {
  79. this.tabsList.offset = page
  80. this.tabsData(this.isTabs)
  81. },
  82. readed(ids, type, url) {
  83. const _this = this
  84. $.ajax({
  85. type: 'POST',
  86. url: '/jymessageCenter/markRead',
  87. data: {
  88. msgId: ids,
  89. msgType: type
  90. },
  91. success: function () {
  92. _this.tabsData(_this.isTabs)
  93. _this.tabsCount()
  94. message.checkOpened()
  95. message.checkMessage()
  96. if (url) {
  97. location.href = url
  98. }
  99. }
  100. })
  101. },
  102. clickMesg(logid) {
  103. $.ajax({
  104. type: 'GET',
  105. url: '/jymessageCenter/clickMessage',
  106. data: {
  107. msgLogId: logid,
  108. platform: '1'
  109. },
  110. success: function () { }
  111. })
  112. },
  113. linked(id, url, str, num, type, msgLogid) {
  114. this.clickMesg(msgLogid)
  115. if (str == 0) {
  116. this.readed(id, type, url)
  117. } else {
  118. if (url) {
  119. location.href = url
  120. }
  121. }
  122. }
  123. }
  124. })