index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="jz_message uni-flex uni-column">
  3. <view class="messageItem uni-flex align-items space-between uni-navigate-right" @click="goMessageItem(0)">
  4. <view class="ItemLf uni-flex">
  5. <view class="itemimg uni-flex justify-align-center">
  6. <image src="../../../static/message/01.png"></image>
  7. </view>
  8. <view class="itemcontent uni-flex uni-column">
  9. <view class="message01">通知消息</view>
  10. <view class="message02">{{messages[0].message}}条未读消息</view>
  11. </view>
  12. </view>
  13. <view class="itemRt uni-flex justify-align-center">
  14. <uni-icon type="arrowright" size="20"></uni-icon>
  15. </view>
  16. </view>
  17. <!-- <view class="messageItem uni-flex align-items space-between" @click="goMessageItem">
  18. <view class="ItemLf uni-flex">
  19. <view class="itemimg uni-flex justify-align-center">
  20. <image src="../../static/message/03.png"></image>
  21. </view>
  22. <view class="itemcontent uni-flex uni-column">
  23. <view class="message01">我的私信</view>
  24. <view class="message02">暂无私信消息</view>
  25. </view>
  26. </view>
  27. <view class="itemRt uni-flex justify-align-center">
  28. <image src="../../static/message/02.png"></image>
  29. </view>
  30. </view> -->
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. mapState,
  36. mapMutations
  37. } from 'vuex'
  38. import uniIcon from '../../../components/uni-icon.vue'
  39. export default {
  40. data() {
  41. return {
  42. user: {},
  43. messages: [{
  44. "message": 0
  45. }]
  46. }
  47. },
  48. components:{
  49. uniIcon
  50. },
  51. computed: {
  52. ...mapState(['hasLogin', 'jyyUser'])
  53. },
  54. onLoad() {
  55. if (!this.hasLogin) {
  56. uni.navigateTo({
  57. url: '../login/login',
  58. });
  59. } else {
  60. this.user = JSON.parse(this.jyyUser);
  61. this.getData();
  62. }
  63. },
  64. onShow() {
  65. if (!this.hasLogin) {
  66. uni.navigateTo({
  67. url: '../login/login',
  68. });
  69. } else {
  70. this.user = JSON.parse(this.jyyUser);
  71. this.getData();
  72. }
  73. },
  74. methods: {
  75. goMessageItem(e) {
  76. uni.navigateTo({
  77. url: 'messageList?module=' + e
  78. })
  79. },
  80. getData() {
  81. uni.request({
  82. url: this.webUrl + 'GetNoReadMessageCount',
  83. data: "userid=" + this.user.id,
  84. method: 'POST',
  85. header: {
  86. 'content-type': 'application/x-www-form-urlencoded'
  87. },
  88. success: res => {
  89. this.messages = res.data.data;
  90. },
  91. fail: () => {},
  92. complete: () => {}
  93. });
  94. }
  95. }
  96. }
  97. </script>
  98. <style>
  99. </style>