y-DiaryItem.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="cu-card dynamic no-card">
  3. <view class="cu-item shadow">
  4. <view class="cu-list menu-avatar">
  5. <view class="cu-item">
  6. <image :src="item.user.avatar" mode="widthFix" class="cu-avatar round lg"></image>
  7. <view class="content flex-sub">
  8. <view>{{ item.user.username }}</view>
  9. <view class="text-gray text-sm flex justify-between">
  10. {{ item.cdate_string }}
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="text-content">
  16. {{ item.content }}
  17. </view>
  18. <view v-if="item.pic.length > 0">
  19. <view class="grid flex-sub padding-lr col-1" v-if="item.pic.length == 1">
  20. <view @tap.stop @tap="Dever.viewPic(item.pic, child)" class="bg-img only-img" :style="{backgroundImage: 'url('+child+')'}"
  21. v-for="(child, idx) in item.pic" :key="idx">
  22. </view>
  23. </view>
  24. <view class="grid flex-sub padding-lr col-3 grid-square" v-if="item.pic.length > 1">
  25. <view @tap.stop @tap="Dever.viewPic(item.pic, child)" class="bg-img" :style="{backgroundImage: 'url('+child+')'}"
  26. v-for="(child, idx) in item.pic" :key="idx">
  27. </view>
  28. </view>
  29. </view>
  30. <view class="text-gray text-sm text-right padding">
  31. <view class="icon-display" @click="updateOppose">
  32. <text class="cuIcon-flashbuyfill margin-lr-xs" :class="item.is_oppose ? 'text-red' : ''"></text> {{item.num_oppose}}
  33. </view>
  34. <view class="icon-display" @click="updateUp">
  35. <text class="cuIcon-appreciatefill margin-lr-xs" :class="item.is_up ? 'text-red' : ''"></text> {{item.num_up}}
  36. </view>
  37. <view class="icon-display" @click="updateComment(20, item.id)">
  38. <text class="cuIcon-messagefill margin-lr-xs"></text> {{item.num_comment}}
  39. </view>
  40. </view>
  41. <view class="cu-list menu-avatar comment solids-top" v-if="fetch.info.length">
  42. <view class="cu-item" v-for="(v, k) in fetch.info" :key="k">
  43. <image :src="v.user.avatar" mode="widthFix" class="cu-avatar round"></image>
  44. <view class="content">
  45. <view class="text-grey">{{v.user.username}}</view>
  46. <view class="text-grays text-content text-df">
  47. {{v.content}}
  48. </view>
  49. <view class="bg-greys padding-sm radius margin-top-sm text-sm">
  50. <view class="flex">
  51. <view>凯尔:</view>
  52. <view class="flex-sub">妹妹,你在帮他们给黑暗找借口吗?</view>
  53. </view>
  54. </view>
  55. <view class="margin-top-sm flex justify-between">
  56. <view class="text-gray text-df">{{v.cdate_string}}</view>
  57. <view>
  58. <text class="cuIcon-appreciatefill text-red"></text>
  59. <text class="cuIcon-messagefill text-gray margin-left-sm"></text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view v-if="show">
  67. <communityPush :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :cate_id="cate_id" :type="type" :type_id="type_id"></communityPush>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import communityPush from "@/pages/dream/view/communityPush";
  73. export default {
  74. props: {
  75. item: {
  76. type: Object
  77. },
  78. radius:{
  79. type: Boolean,
  80. default: false
  81. },
  82. cate_id : null,
  83. },
  84. components:{
  85. communityPush
  86. },
  87. mounted() {
  88. this.getData(1, 20, this.item.id);
  89. },
  90. data() {
  91. return {
  92. title : '回复话题',
  93. show : false,
  94. showPop: false,
  95. type : 20,
  96. type_id : 0,
  97. fetch: {
  98. info : [],
  99. },
  100. };
  101. },
  102. methods: {
  103. getRefresh : function(cate_id, type, type_id) {
  104. this.getData(1, type, type_id);
  105. },
  106. getData : function(page, type, type_id) {
  107. var self = this;
  108. this.Dever.get(this, 'app/community/?l=api.info', {cate_id:self.cate_id, type:type, type_id:type_id}, function(t) {
  109. self.hideModal();
  110. });
  111. },
  112. updateUp : function() {
  113. let that = this;
  114. if (that.item.is_oppose) {
  115. return;
  116. }
  117. if (that.item.is_up) {
  118. that.item.num_up--;
  119. that.item.is_up = false;
  120. } else {
  121. that.item.num_up++;
  122. that.item.is_up = true;
  123. }
  124. },
  125. updateOppose : function() {
  126. let that = this;
  127. if (that.item.is_up) {
  128. return;
  129. }
  130. if (that.item.is_oppose) {
  131. that.item.num_oppose--;
  132. that.item.is_oppose = false;
  133. } else {
  134. that.item.num_oppose++;
  135. that.item.is_oppose = true;
  136. }
  137. },
  138. updateComment : function (type, type_id) {
  139. this.type = type;
  140. this.type_id = type_id;
  141. this.show = true;
  142. },
  143. hideModal : function () {
  144. this.show = false;
  145. }
  146. }
  147. };
  148. </script>
  149. <style lang="less" scoped>
  150. .cu-card {
  151. }
  152. .cu-list.menu-avatar>.cu-item:after, .cu-list.menu>.cu-item:after {
  153. border: 0px;
  154. }
  155. .icon-display {
  156. display: inline;
  157. margin-left: 20rpx;
  158. }
  159. </style>