comment.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template name="comment">
  2. <view>
  3. <view class="msgs-tabs">
  4. <view class="tit">{{item.name}}</view>
  5. <view class="num" style="display: none;">全部({{fetch.total}})</view>
  6. </view>
  7. <view class="living grace-body">
  8. <view class="rich-wrapper">
  9. <dever-content :item="item.content_array" :pics="item.content_pic"></dever-content>
  10. </view>
  11. <view class="message" @touchstart="stop">
  12. <y-Barrage ref="barrage" @end="reload" :minTime="minTime" :maxTime="maxTime"></y-Barrage>
  13. </view>
  14. </view>
  15. <y-Fab :bottom="20" :right="140" @click="showModal" bgColor="#0fa5e5" text="发布"></y-Fab>
  16. <view v-if="show">
  17. <publish :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :type="type" :type_id="type_id" :api="api"></publish>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import publish from '@/lib/dever/components/publish.vue';
  23. import deverContent from '@/lib/dever/components/content.vue';
  24. export default {
  25. name: "comment",
  26. props: {
  27. type : {
  28. type : String,
  29. value : null
  30. },
  31. type_id : {
  32. type : String,
  33. value : null
  34. },
  35. item : {
  36. type : Object,
  37. value : null
  38. },
  39. index : 0
  40. },
  41. data() {
  42. return {
  43. api : 'app/community/?l=api.addComment',
  44. title : '发表新评论',
  45. minTime : 5,
  46. maxTime : 10,
  47. show : false,
  48. fetch : {
  49. info : [],
  50. },
  51. page : 1,
  52. load : true,
  53. info : [],
  54. seconds : 0,
  55. }
  56. },
  57. mounted() {
  58. this.page = 1;
  59. this.getData();
  60. },
  61. methods:{
  62. getData : function() {
  63. var self = this;
  64. if (!self.load) {
  65. self.$refs.barrage.start(self.info);
  66. return;
  67. }
  68. this.Dever.get(this, 'app/community/?l=api.comment', {noloading:1,page:this.page,type:this.type,type_id:this.type_id,noconcat:1}, function(t) {
  69. if (t && t.info && t.info.length > 0) {
  70. self.info = self.info.concat(t.info);
  71. if (self.page == 1) {
  72. self.$refs.barrage.start(t.info);
  73. } else {
  74. for (var i in t.info) {
  75. self.$refs.barrage.add(t.info[i]);
  76. }
  77. }
  78. self.page++;
  79. } else {
  80. self.load = false;
  81. self.reload();
  82. }
  83. }, function(e) {
  84. self.load = false;
  85. self.reload();
  86. });
  87. },
  88. reload : function() {
  89. this.getData();
  90. },
  91. stop : function() {
  92. //this.$refs.barrage.stop();
  93. },
  94. showModal : function() {
  95. this.show = true;
  96. },
  97. hideModal : function() {
  98. this.show = false;
  99. },
  100. getRefresh : function(cate_id, type, type_id, content) {
  101. var item = {};
  102. item.content = content;
  103. this.info.push(item);
  104. this.$refs.barrage.add(item);
  105. this.hideModal();
  106. }
  107. },
  108. components:{
  109. publish,deverContent
  110. }
  111. }
  112. </script>
  113. <style>
  114. .rich-wrapper .p{
  115. padding: 0;
  116. }
  117. .rich-wrapper image{
  118. width: 100% !important;
  119. }
  120. .rich-wrapper .wxParse-p{
  121. font-size: 30rpx;
  122. }
  123. .msgs-tabs{
  124. line-height: 88rpx;
  125. display: flex;
  126. height: 88rpx;
  127. justify-content: space-between;
  128. box-sizing: border-box;
  129. padding: 0 30rpx;
  130. border-bottom: 1rpx solid #ccc;
  131. }
  132. .msgs-tabs .tit{
  133. font-size: 30rpx;
  134. color: #000;
  135. display: flex;
  136. align-items: center;
  137. overflow: hidden;
  138. }
  139. .msgs-tabs .tit:before{
  140. content: '';
  141. display: inline-block;
  142. width: 6rpx;
  143. height: 30rpx;
  144. margin-right: 10rpx;
  145. background-color: #000;
  146. }
  147. .msgs-tabs .num{
  148. font-size: 22rpx;
  149. color: #999;
  150. overflow: hidden;
  151. }
  152. .living{
  153. margin-bottom:50rpx;
  154. }
  155. .living-tabs{
  156. display: flex;
  157. justify-content: center;
  158. margin-bottom: 36rpx;
  159. }
  160. .living-tabs>view{
  161. font-size: 30rpx;
  162. line-height: 52rpx;
  163. margin: 0 26rpx;
  164. }
  165. .living-tabs>view.cur{
  166. border-bottom: 6rpx solid #000;
  167. }
  168. .living .message{
  169. height:320rpx;
  170. padding:15rpx 0 110rpx;
  171. border-bottom: solid 2rpx #f0f0f0;
  172. }
  173. .living .message .item{
  174. padding:20rpx 35rpx 0;
  175. display: flex;
  176. }
  177. .living .message .user{
  178. float:left;
  179. }
  180. .living .message .user image{
  181. display: block;
  182. width:51rpx;
  183. height:51rpx;
  184. border-radius: 50%;
  185. }
  186. .living .message .info{
  187. position: relative;
  188. margin-left:70rpx;
  189. overflow: visible;
  190. }
  191. .living .message .username{
  192. font-size: 28rpx;
  193. margin-bottom: 13rpx;
  194. }
  195. .living .message .txt{
  196. position: relative;
  197. float:left;
  198. background: #eeeeee;
  199. max-width:400rpx;
  200. border-radius: 15rpx;
  201. padding: 9rpx 18rpx;
  202. font-size: 26rpx;
  203. line-height: 1.8;
  204. color: #666666;
  205. overflow: visible;
  206. }
  207. .living .message .txt:before{
  208. display: block;
  209. position: absolute;
  210. top:0;
  211. left:-14rpx;
  212. width:0;
  213. height:0;
  214. border: solid 14rpx transparent;
  215. border-top: solid 12rpx #eee;
  216. content:'';
  217. }
  218. .living{
  219. margin-bottom: 0;
  220. }
  221. .living .message{
  222. padding:0;
  223. border-bottom: 0;
  224. }
  225. .living .message{
  226. position: absolute;
  227. bottom: 120rpx;
  228. top: 544rpx;
  229. left: 0;
  230. width: 100%;
  231. height: auto;
  232. }
  233. .mask .layer{
  234. padding:40rpx 30rpx;
  235. }
  236. .mask textarea{
  237. margin-bottom: 25rpx;
  238. box-sizing: border-box;
  239. padding:10rpx;
  240. border:solid 2rpx #999999;
  241. border-radius: 10rpx;
  242. width:500rpx;
  243. font-size: 24rpx;
  244. }
  245. .mask .button{
  246. width:300rpx;
  247. }
  248. .share{
  249. position: fixed;
  250. bottom:20rpx;
  251. left:225rpx;
  252. }
  253. </style>