NotificationMessage.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="page">
  3. <view class="head-bg" style="height: 20rpx;">
  4. </view>
  5. <view class="mainHeader">
  6. <view class="borderHeader"></view>
  7. </view>
  8. <view class="bodyMain">
  9. <view class="nodata" v-if="have_nodata">
  10. <image class="img" mode="widthFix" src="../../static/icon/listen_no_history.png"></image>
  11. 暂无消息
  12. </view>
  13. <view class="inform-list">
  14. <view class="list" v-for="(item,index) in list" :key="index">
  15. <view class="item" @click="onShowNotify(item)">
  16. <view class="title">
  17. <text class="one-omit">
  18. <text class="one-omit" v-if="type == 'prize'">[{{item.name}}]</text>
  19. {{item.title}}
  20. </text>
  21. </view>
  22. <view class="describe">
  23. <text class="two-omit">{{item.intro}}</text>
  24. </view>
  25. <view class="tdate">
  26. <text>{{item.tdate}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="rule-win" v-if="isRule">
  33. <view class="cu-modal" :class="{'show':isRule}">
  34. <view class="cu-dialog">
  35. <view class="cu-bar bg-white justify-end">
  36. <view class="content">详细</view>
  37. <view class="action">
  38. <text class="cuIcon-close text-red" @click="isRule = false"></text>
  39. </view>
  40. </view>
  41. <view class="rule-content" style="padding:40rpx;text-align:left;box-sizing: content-box;">
  42. <text style="">
  43. {{item_content}}
  44. </text>
  45. <text></text>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. type:'msg',
  57. isRule: false,
  58. item_content:'',
  59. have_nodata:true,
  60. list:[]
  61. };
  62. },
  63. onLoad(params) {
  64. this.skey = params.skey||'1234567xef';
  65. this.type = params.type||'msg';
  66. var that = this;
  67. this.getInfo();
  68. },
  69. methods:{
  70. goBack() {
  71. uni.navigateBack({delta: 1});
  72. },
  73. onShowNotify(item) {
  74. if(this.type == 'msg') {
  75. if(item.isDo == undefined || item.isDo == null) {
  76. item.content = item.content.replace(/[\n]/g, "\n  ");
  77. item.isDo = 'yes';
  78. }
  79. this.item_content = '' + item.content;
  80. this.isRule = true;
  81. }
  82. },
  83. getInfo() {
  84. var that = this;
  85. uni.request({
  86. url: this.$apiHost + '/Notify/getlist', //仅为示例,并非真实接口地址。
  87. data: {
  88. id: this.id,
  89. type: this.type,
  90. skey:this.skey
  91. },
  92. header: {
  93. 'content-type': 'application/json' //自定义请求头信息
  94. },
  95. success: (res) => {
  96. this.list = res.data.list;
  97. }
  98. });
  99. // setTimeout(function() {
  100. // that.getAdNum();
  101. // },9000)
  102. }
  103. }
  104. }
  105. </script>
  106. <style scoped lang="scss">
  107. @import 'NotificationMessage.scss';
  108. </style>