comment.vue 4.9 KB

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