comment.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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', {code:this.Dever.config.code,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. start : function() {
  92. //this.$refs.barrage.stop();
  93. },
  94. stop : function() {
  95. //this.$refs.barrage.stop();
  96. },
  97. time : function() {
  98. },
  99. showModal : function() {
  100. this.show = true;
  101. },
  102. hideModal : function() {
  103. this.show = false;
  104. },
  105. getRefresh : function(cate_id, type, type_id, content) {
  106. var item = {};
  107. item.content = content;
  108. this.info.push(item);
  109. this.$refs.barrage.add(item);
  110. this.hideModal();
  111. }
  112. },
  113. components:{
  114. publish,deverContent
  115. }
  116. }
  117. </script>
  118. <style>
  119. .rich-wrapper .p{
  120. padding: 0;
  121. }
  122. .rich-wrapper image{
  123. width: 100% !important;
  124. }
  125. .rich-wrapper .wxParse-p{
  126. font-size: 30rpx;
  127. }
  128. .msgs-tabs{
  129. line-height: 88rpx;
  130. display: flex;
  131. height: 88rpx;
  132. justify-content: space-between;
  133. box-sizing: border-box;
  134. padding: 0 30rpx;
  135. border-bottom: 1rpx solid #ccc;
  136. }
  137. .msgs-tabs .tit{
  138. font-size: 30rpx;
  139. color: #000;
  140. display: flex;
  141. align-items: center;
  142. overflow: hidden;
  143. }
  144. .msgs-tabs .tit:before{
  145. content: '';
  146. display: inline-block;
  147. width: 6rpx;
  148. height: 30rpx;
  149. margin-right: 10rpx;
  150. background-color: #000;
  151. }
  152. .msgs-tabs .num{
  153. font-size: 22rpx;
  154. color: #999;
  155. overflow: hidden;
  156. }
  157. .living{
  158. margin-bottom:50rpx;
  159. }
  160. .living-tabs{
  161. display: flex;
  162. justify-content: center;
  163. margin-bottom: 36rpx;
  164. }
  165. .living-tabs>view{
  166. font-size: 30rpx;
  167. line-height: 52rpx;
  168. margin: 0 26rpx;
  169. }
  170. .living-tabs>view.cur{
  171. border-bottom: 6rpx solid #000;
  172. }
  173. .living .message{
  174. height:320rpx;
  175. padding:15rpx 0 110rpx;
  176. border-bottom: solid 2rpx #f0f0f0;
  177. }
  178. .living .message .item{
  179. padding:20rpx 35rpx 0;
  180. display: flex;
  181. }
  182. .living .message .user{
  183. float:left;
  184. }
  185. .living .message .user image{
  186. display: block;
  187. width:51rpx;
  188. height:51rpx;
  189. border-radius: 50%;
  190. }
  191. .living .message .info{
  192. position: relative;
  193. margin-left:70rpx;
  194. overflow: visible;
  195. }
  196. .living .message .username{
  197. font-size: 28rpx;
  198. margin-bottom: 13rpx;
  199. }
  200. .living .message .txt{
  201. position: relative;
  202. float:left;
  203. background: #eeeeee;
  204. max-width:400rpx;
  205. border-radius: 15rpx;
  206. padding: 9rpx 18rpx;
  207. font-size: 26rpx;
  208. line-height: 1.8;
  209. color: #666666;
  210. overflow: visible;
  211. }
  212. .living .message .txt:before{
  213. display: block;
  214. position: absolute;
  215. top:0;
  216. left:-14rpx;
  217. width:0;
  218. height:0;
  219. border: solid 14rpx transparent;
  220. border-top: solid 12rpx #eee;
  221. content:'';
  222. }
  223. .living{
  224. margin-bottom: 0;
  225. }
  226. .living .message{
  227. padding:0;
  228. border-bottom: 0;
  229. }
  230. .living .message{
  231. position: absolute;
  232. bottom: 120rpx;
  233. top: 544rpx;
  234. left: 0;
  235. width: 100%;
  236. height: auto;
  237. }
  238. .mask .layer{
  239. padding:40rpx 30rpx;
  240. }
  241. .mask textarea{
  242. margin-bottom: 25rpx;
  243. box-sizing: border-box;
  244. padding:10rpx;
  245. border:solid 2rpx #999999;
  246. border-radius: 10rpx;
  247. width:500rpx;
  248. font-size: 24rpx;
  249. }
  250. .mask .button{
  251. width:300rpx;
  252. }
  253. .share{
  254. position: fixed;
  255. bottom:20rpx;
  256. left:225rpx;
  257. }
  258. </style>