detail.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. var vm = new Vue({
  2. el: '#detailed',
  3. delimiters: ['{', '}'],
  4. data () {
  5. return {
  6. tit: '',
  7. imgSrcs: [
  8. {title: '活动优惠', url:'huodong'},
  9. {title: '服务通知', url:'fuwu'},{title: '订阅消息', url:'dingyue'},
  10. {title: '项目动态', url:'xiangmu'},{title: '企业动态', url:'qiye'},
  11. {title: '分析报告', url:'fenxi'},{title: '系统通知', url:'xitong'}
  12. ],
  13. lists: [],
  14. tabsList: {
  15. offset: 1,
  16. pageSize: 20,
  17. totals: 0,
  18. loading: true,
  19. finished: false
  20. }
  21. }
  22. },
  23. created() {
  24. let indx = getQueryString('type')
  25. let nums = getQueryString('num')
  26. if (nums != 0) {
  27. this.setRead(indx)
  28. }
  29. setTimeout(() => {
  30. let wxType = getType()
  31. if (!wxType) {
  32. checkMsgCount(true, 0)
  33. }
  34. }, 300)
  35. this.tit = this.imgSrcs[indx - 1].title
  36. document.title = this.imgSrcs[indx - 1].title
  37. },
  38. mounted () {
  39. iosBackRefresh()
  40. },
  41. updated() {
  42. let el = document.getElementById('descri')
  43. el.scrollTop = el.scrollHeight
  44. },
  45. methods: {
  46. platType() {
  47. let wxType = getType()
  48. if (wxType) {
  49. return 3
  50. } else {
  51. return 2
  52. }
  53. },
  54. // 点击分类修改分类下的消息为已读
  55. setRead(val) {
  56. const _this = this
  57. $.ajax({
  58. type:'POST',
  59. url:'/jymessageCenter/setReadStatus',
  60. data: {
  61. msgType: val
  62. },
  63. success:function () {}
  64. })
  65. },
  66. appMesg(type) {
  67. const _this = this
  68. $.ajax({
  69. type: 'GET',
  70. url: '/jymessageCenter/appClickMessage',
  71. data: {
  72. msgType: type,
  73. platform: _this.platType(),
  74. offset: this.tabsList.offset,
  75. pageSize: this.tabsList.pageSize
  76. },
  77. success:function () {}
  78. })
  79. },
  80. // 消息详情
  81. msgData() {
  82. const _this = this
  83. this.appMesg(getQueryString('type'))
  84. $.ajax({
  85. type: 'POST',
  86. url: '/jymessageCenter/messageList',
  87. data: {
  88. needFilter: 0,
  89. msgType: getQueryString('type'),
  90. isRead: '-1',
  91. offset: this.tabsList.offset,
  92. pageSize: this.tabsList.pageSize
  93. },
  94. success: function (r) {
  95. if (r && r.status == 1) {
  96. _this.tabsList.offset++
  97. if (_this.tabsList.offset === 1) {
  98. if (r.data.total || r.data.total === 0) {
  99. _this.tabsList.total = r.data.total
  100. } else {
  101. _this.tabsList.finished = true
  102. }
  103. }
  104. if (Array.isArray(r.data.list) && r.data.list.length !== 0) {
  105. setTimeout(() => {
  106. r.data.list.map(function (v) {
  107. _this.lists.unshift({
  108. id: v.id,
  109. msg_type: v.msg_type,
  110. title: v.title,
  111. content: v.content,
  112. createtime: v.createtime,
  113. link: v.link,
  114. url: v.url
  115. })
  116. })
  117. }, 200)
  118. } else {
  119. _this.tabsList.finished = true
  120. }
  121. // _this.tabsList.loading = false
  122. if (_this.tabsList.total !== -1 && _this.tabsList.total <= _this.lists.length) {
  123. _this.tabsList.finished = true
  124. }
  125. }
  126. }
  127. })
  128. },
  129. msgClick(url) {
  130. let wxType = getType()
  131. let appType = androidOrIOS()
  132. if (wxType) {
  133. if (url.weChatUrl) {
  134. location.href = url.weChatUrl
  135. } else {
  136. return
  137. }
  138. } else {
  139. if (appType == 'android') {
  140. if (url.androidUrl) {
  141. location.href = url.androidUrl
  142. } else {
  143. return
  144. }
  145. } else {
  146. if (url.iosUrl) {
  147. location.href = url.iosUrl
  148. } else {
  149. return
  150. }
  151. }
  152. }
  153. }
  154. }
  155. })