comment.vue 5.0 KB

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