comment.vue 5.1 KB

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