index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="content main-bg">
  3. <view class="list" v-if="list.length > 0">
  4. <view class="item" v-for="item in list">
  5. <view class="time font-color3 font-twenty-four">{{ item.reviewerTime }}</view>
  6. <view class="text font-color3 font-thirty-two">{{ item.msgInfo ? item.msgInfo : '' }}</view>
  7. <view class="reason font-color3 font-twenty">{{ item.remark ? item.remark : '' }}</view>
  8. </view>
  9. </view>
  10. <view class="empty" v-else>
  11. <u-empty text="暂无消息" mode="list"></u-empty>
  12. </view>
  13. <u-tabbar :list="tabBarList" :active-color="activeColor" :inactive-color="inactiveColor"
  14. :border-top="borderTop"></u-tabbar>
  15. </view>
  16. </template>
  17. <script>
  18. import { mapGetters } from 'vuex'
  19. import server from "@/api/index";
  20. export default {
  21. data() {
  22. return {
  23. borderTop: false,
  24. inactiveColor: '#ccc',
  25. activeColor: '#2E4F1C',
  26. list: [],
  27. userInfo:{}
  28. }
  29. },
  30. computed: {
  31. ...mapGetters([
  32. 'tabBarList',
  33. 'role'
  34. ])
  35. },
  36. onLoad() {
  37. setTimeout(function () {
  38. console.log('start pulldown');
  39. }, 1000);
  40. uni.startPullDownRefresh();
  41. },
  42. onPullDownRefresh() {
  43. this.userInfo = uni.getStorageSync('userInfo');
  44. this.getListFn();
  45. setTimeout(function () {
  46. uni.stopPullDownRefresh();
  47. }, 1000);
  48. },
  49. methods:{
  50. show(){
  51. this.userInfo = uni.getStorageSync('userInfo');
  52. this.getListFn();
  53. },
  54. getListFn(){
  55. if(this.userInfo.type === '2'){
  56. server.getNews({veteransId: this.userInfo.userId, msgType: this.userInfo.type}).then(res =>{
  57. this.list = [];
  58. if(res){
  59. this.list = res
  60. }
  61. })
  62. }else if(this.userInfo.type === '1'){
  63. server.getNews({veteransId: this.userInfo.nickName, msgType: this.userInfo.type}).then(res =>{
  64. this.list = [];
  65. if(res){
  66. this.list = res
  67. }
  68. })
  69. }
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .content {
  76. width: 100%;
  77. height: auto;
  78. min-height: 100vh;
  79. padding: 30rpx;
  80. .empty{
  81. padding-top: 200rpx;
  82. }
  83. .list{
  84. width: 100%;
  85. .item{
  86. width: 100%;
  87. min-height: 165rpx;
  88. height: auto;
  89. background: #FFFFFF;
  90. border-radius: 24rpx;
  91. padding: 30rpx;
  92. margin-bottom: 30rpx;
  93. .text{
  94. padding-top: 30rpx;
  95. font-weight: 600;
  96. letter-spacing: 2rpx;
  97. }
  98. .reason{
  99. padding-top: 22rpx;
  100. line-height: 40rpx;
  101. }
  102. }
  103. }
  104. }
  105. </style>