news.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view>
  3. <view class="list" v-if="pageList&&pageList.length>0">
  4. <view class="li" v-for="(item,index) in pageList" :key="index">
  5. <view class="user ddflex" @click="toUserHomePage(item.userDTO)">
  6. <image :src="item.userDTO.avatar ? item.userDTO.avatar : '../../static/images/userImg.png'" mode="aspectFill" class="userimg"></image>
  7. <view class="fflex">
  8. <view class="username">{{item.userDTO.realName}}</view>
  9. <view class="time">{{item.createDate}}</view>
  10. </view>
  11. </view>
  12. <view class="reply" v-if="item.superiorFabulousDTO" @click="jumpUrlDetail(item)">
  13. <view class="reply-c"><text>回复:</text>{{item.content}}</view>
  14. <view class="reply-s">{{item.superiorFabulousDTO.content}}</view>
  15. </view>
  16. <view class="des" @click="jumpUrlDetail(item)" v-else>{{item.content}}</view>
  17. <view class="info ddflex" @click="jumpUrlDetail(item)">
  18. <image :src="item.momentsDto.url" mode="aspectFill" v-if="item.momentsDto.url"></image>
  19. <view class="infos fflex">
  20. <!-- <view class="tit">此处为评论的团妈说标题</view> -->
  21. <view class="bri tovers"><rich-text :nodes="item.momentsDto.content"></rich-text></view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="nodata" v-if="isshow">
  27. <image :src="picUrlss+'empty_sc.png'"></image>
  28. <text>暂无消息</text>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. const req = require("../../utils/request.js");
  34. const app = getApp();
  35. export default {
  36. data() {
  37. return {
  38. picUrlss: req.public.picUrls,
  39. form: {
  40. page: 1,
  41. limit: 10
  42. },
  43. pageList: [],
  44. isLoad: true,
  45. isshow: false
  46. };
  47. },
  48. onLoad: function(options) {
  49. this.getList();
  50. },
  51. onReachBottom() {
  52. this.form.page++;
  53. this.getList();
  54. },
  55. methods: {
  56. getList() {
  57. if (!this.isLoad) return false;
  58. this.isLoad = false;
  59. let form = this.form;
  60. let that = this;
  61. req.getRequest('/api/v3/fabulous/seeFabulousList', form, data => {
  62. if (data && data.length == 10) that.isLoad = true;
  63. if (data && data.length == 0 && that.form.page == 1) that.isshow = true;
  64. if (that.form.page > 1) data = that.pageList.concat(data);
  65. that.pageList = data
  66. });
  67. },
  68. jumpUrl(url){
  69. uni.navigateTo({
  70. url: url
  71. })
  72. },
  73. toUserHomePage(userObj) {
  74. if (userObj.isApiUser != 1) {
  75. //不是后台用户,则可跳转
  76. this.jumpUrl('/topics/home/home?userId=' + userObj.id);
  77. }
  78. },
  79. jumpUrlDetail(item) {
  80. if(item.superiorFabulousDTO){
  81. uni.navigateTo({
  82. url: '/office/comments/comments?commentId=' + item.pid + '&commentIds=' + item.id + '&isSecond=' +true
  83. });
  84. }else{
  85. // uni.navigateTo({
  86. // url: '/office/detail/detail?contentId=' + item.momentsDto.id + '&isNews=' + true + '&commentId=' + item.id
  87. // });
  88. uni.navigateTo({
  89. url: '/office/comments/comments?commentId=' + item.id
  90. });
  91. }
  92. }
  93. }
  94. };
  95. </script>
  96. <style>
  97. @import "./news.css";
  98. </style>