comment.vue 5.0 KB

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