msgDetail.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="detail">
  3. <u-navbar
  4. back-icon-color="#fff"
  5. :back-text="$t('common.Back')"
  6. :is-back="true"
  7. :background="{background:'#1777FE'}"
  8. :back-text-style="{color:'#fff'}"
  9. :border-bottom="true"
  10. title-color="#fff"
  11. :title="title"
  12. :custom-back="back"
  13. >
  14. </u-navbar>
  15. <view class="bg"></view>
  16. <view class="content">
  17. <view class="title">{{detail.title}}</view>
  18. <view class="date">{{formatDate(detail.createDate)}}</view>
  19. <view class="content">{{detail.content}}</view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. components:{
  26. },
  27. data() {
  28. return {
  29. title:'',
  30. msgType:'',
  31. msgId:'',
  32. detail:{}
  33. }
  34. },
  35. onShow(){
  36. this.title = this.msgType=='0'?this.$t('common.SystemMessage'):this.$t('common.notification');
  37. this.detail= uni.getStorageSync('MsgDetail')?uni.getStorageSync('MsgDetail'):{},
  38. this.readMsg()
  39. },
  40. onLoad(e) {
  41. this.msgType=e.msgType;
  42. this.msgId=e.msgId;
  43. console.log(e,this.msgType)
  44. },
  45. onUnload(){
  46. uni.removeStorageSync('MsgDetail')
  47. },
  48. methods: {
  49. //标记已读信息
  50. async readMsg(){
  51. console.log(this.msgType)
  52. if(this.msgType==0){
  53. if(this.detail.params!='read'){
  54. let res = await this.$myRequest({
  55. url:'/uc/sysPushMessages/updateReadStatus',
  56. data:{arr:this.msgId}
  57. })
  58. }
  59. }else{
  60. if(this.detail.readStatus!='read'){
  61. let res = await this.$myRequest({
  62. url:'/uc/platformNotify/isRead',
  63. data:{ids:this.msgId}
  64. })
  65. }
  66. }
  67. },
  68. //后退一步
  69. back(){
  70. // #ifdef H5
  71. history.back()
  72. // #endif
  73. // #ifndef H5
  74. uni.navigateBack()
  75. // #endif
  76. },
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .detail{
  82. .bg{
  83. position:fixed;
  84. top:0;
  85. left:0;
  86. right:0;
  87. bottom:0;
  88. z-index:-1;
  89. background:#fff;
  90. }
  91. .content{
  92. width:94%;
  93. margin:20upx auto;
  94. .title{
  95. flex:1;
  96. text-align:center;
  97. height:100upx;
  98. line-height:100upx;
  99. font-size:36upx;
  100. }
  101. .date{
  102. color:#aaa;
  103. font-size:24upx;
  104. text-align:center;
  105. margin-bottom:60upx;
  106. }
  107. }
  108. }
  109. </style>