circle-item.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <!-- <mescroll-uni :ref="'mescrollRef' + i" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick" @scroll="scroll"> -->
  3. <view class="u-demo-block">
  4. <view class="u-demo-block__content" v-for="(item, index) in list" :key="index" @touchstart="click">
  5. <view class="album" style="padding: 30upx;">
  6. <image :src="item.head" mode="" style="width: 80upx;height: 80upx;border-radius: 10rpx;"></image>
  7. <view class="album__content">
  8. <view class="album__info">
  9. <text class="info-name" @click="toDetail(item)">{{ item.nickname }}</text>
  10. <text class="info-content" @click="toDetail(item)">{{ item.content }}</text>
  11. <template v-if="item.mediaType == 1">
  12. <u-album v-if="item.urlList && item.urlList.length > 1" :urls="item.urlList" multipleSize="90" space='10'></u-album>
  13. <u-album v-else :urls="item.urlList" singleSize='150'></u-album>
  14. </template>
  15. <view v-else class="video">
  16. <video v-show="isShowVideo"
  17. class="video-info"
  18. :show-center-play-btn="false"
  19. :src="item.image"
  20. id="myVideo"
  21. :autoplay="true"
  22. :loop="true"
  23. :controls= "true"
  24. ></video>
  25. <view v-if="item.direction==1&&!isShowVideo" class="relative">
  26. <image :src="item.image + '?x-oss-process=video/snapshot,t_1000,f_jpg,w_800,h_600,m_fast,ar_auto'" mode="aspectFill" style="width: 424rpx;height:320rpx"></image>
  27. <image class="cover" src="/static/play.png" @click="playVideo"></image>
  28. </view>
  29. <view v-if="item.direction==2&&!isShowVideo" class="relative">
  30. <image :src="item.image + '?x-oss-process=video/snapshot,t_1000,f_jpg,w_800,h_600,m_fast,ar_auto'" mode="aspectFill" style="width: 320rpx;height:424rpx"></image>
  31. <image class="cover1" src="/static/play.png" @click="playVideo"></image>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="location" v-if="item.location">
  36. <view class="location-left">
  37. <text class="location-left-name">{{ item.location }}</text>
  38. </view>
  39. </view>
  40. <view class="time">
  41. <text class="time-text">{{$u.timeFrom(new Date(item.gmtCreate).getTime(),'yyyy年mm月dd日')}}</text>
  42. </view>
  43. <view class="comment">
  44. <text class="time-text">{{ item.dateTime }}</text>
  45. <view class="comment-right">
  46. <view class="comment-item" @click="doThumb(item, index)">
  47. <image class="image-love" :src="item.helpFlag==1 ? '../../static/love-fill.png' : '../../static/love.png'"></image>
  48. <text class="number">{{ item.count }}</text>
  49. </view>
  50. <view class="comment-item" @click="doComment(item, null, index)">
  51. <image class="image-comment" src="../../static/comment.png"></image>
  52. <text class="number">{{ item.count1 }}</text>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="thumb-comment" v-if="(item.circleFriendsDetailList&&item.circleFriendsDetailList.length > 0)||(item.circleFriendsDetailList1&&item.circleFriendsDetailList1.length > 0)">
  59. <view class="thumbs" v-if="item.circleFriendsDetailList&&item.circleFriendsDetailList.length > 0">
  60. <image class="image-love thumbs-icon" src="../../static/love.png"></image>
  61. <view class="thumbs-headers">
  62. <view class="thumbs-headers-img" v-for="(item2, index2) in item.circleFriendsDetailList" :key="index2">
  63. <view class="thumbs-item">
  64. <text class="thumbs-name">{{ item2.nickname }}</text>
  65. <text class="thumbs-name" v-if="index2 != item.circleFriendsDetailList.length - 1">,</text>
  66. </view>
  67. </view>
  68. <text class="thumbs-headers-img thumbs-headers-more" v-if="item.circleFriendsDetailList.length > 20">等</text>
  69. </view>
  70. </view>
  71. <view class="comments" v-if="item.circleFriendsDetailList1&&item.circleFriendsDetailList1.length > 0">
  72. <image class="image-comment comments-icon" src="../../static/comment.png"></image>
  73. <view class="comments-headers">
  74. <view class="comments-headers-item" v-for="(item3, index3) in item.circleFriendsDetailList1" :key="index3">
  75. <view class="item-left">
  76. <u-avatar :src="item3.head" shape="square" size="32"></u-avatar>
  77. </view>
  78. <view class="item-right">
  79. <view class="item-right-name">
  80. <text class="item-right-name-top">{{ item3.nickname }}</text>
  81. <text class="item-right-name-bottom">{{$u.timeFrom(new Date(item3.gmtCreate).getTime(),'yyyy年mm月dd日')}}</text>
  82. </view>
  83. <view class="comment-content">
  84. <view class="comment-response" v-if="item3.commentName">
  85. <text class="comment-response-txt">回复</text>
  86. <text class="comment-response-name">{{ item3.commentName }}</text>
  87. <text class="comment-response-txt">:</text>
  88. </view>
  89. <text class="item-right-info" @click="doComment(item, item3, index)">{{ item3.commentContent }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <u-line></u-line>
  97. </view>
  98. </view>
  99. <!-- </mescroll-uni> -->
  100. </template>
  101. <script>
  102. import { mapState, mapMutations } from 'vuex';
  103. import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
  104. import MescrollMoreItemMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js';
  105. // import { apiGoods } from '@/api/mock.js';
  106. export default {
  107. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  108. data() {
  109. return {
  110. isShowVideo:false,
  111. videoContext:'',
  112. downOption: {
  113. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  114. },
  115. upOption: {
  116. onScroll: true,
  117. auto: false, // 不自动加载
  118. // page: {
  119. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  120. // size: 10 // 每页数据的数量
  121. // },
  122. noMoreSize: 5, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  123. empty: {
  124. tip: '空空如也', // 提示
  125. icon: 'http://cdn.uviewui.com/uview/empty/data.png'
  126. }
  127. },
  128. showInput: false
  129. };
  130. },
  131. props: {
  132. list: {
  133. type: Array,
  134. default: function(e) {
  135. return [];
  136. }
  137. }
  138. },
  139. watch:{
  140. list:{
  141. handler:async function (newVal,oldVal){
  142. this.list = newVal;
  143. }
  144. },
  145. },
  146. computed: {
  147. ...mapState(['locateInformation'])
  148. },
  149. created() {},
  150. filters: {
  151. formatDistance(distance) {
  152. var strDistance = '';
  153. if (distance < 1) {
  154. //一公里以内的
  155. strDistance = distance * 1000 + 'm';
  156. } else {
  157. distance = distance.toFixed(1);
  158. strDistance = distance + 'km';
  159. }
  160. return strDistance;
  161. }
  162. },
  163. methods: {
  164. playVideo(val) {
  165. this.isShowVideo = true
  166. console.log('--play--');
  167. // 点击显示全屏
  168. this.videoContext = uni.createVideoContext('myVideo')
  169. this.videoContext.requestFullScreen();
  170. },
  171. onJump(url) {
  172. uni.navigateTo({
  173. url: url
  174. });
  175. },
  176. toDetail(item) {
  177. uni.navigateTo({
  178. url: '/pageA/circle/circleDetail?item=' + JSON.stringify(item)
  179. });
  180. },
  181. click() {
  182. this.$emit('click');
  183. },
  184. doThumb(item, index) {
  185. item.index = index;
  186. this.$emit('doThumb', item);
  187. },
  188. doComment(item, comment, index) {
  189. item.index = index;
  190. this.$emit('doComment', item, comment);
  191. },
  192. doComment2Com(item, comment) {
  193. this.$emit('doComment2Com', item, comment);
  194. }
  195. }
  196. };
  197. </script>
  198. <style lang="scss">
  199. .view {
  200. flex-direction: column;
  201. }
  202. .album {
  203. display: flex;
  204. flex-direction: row;
  205. align-items: flex-start;
  206. }
  207. .album__avatar {
  208. background-color: #fff;
  209. padding: 5px;
  210. border-radius: 3px;
  211. }
  212. .album__content {
  213. margin-left: 10px;
  214. flex: 1;
  215. }
  216. .album__info {
  217. margin-bottom: 15upx;
  218. display: flex;
  219. flex-direction: column;
  220. }
  221. .info-name {
  222. color: #5786cc;
  223. font-size: 30upx;
  224. font-weight: bold;
  225. }
  226. .info-content {
  227. color: #333;
  228. font-size: 30upx;
  229. padding: 5px 0 8px 0;
  230. }
  231. .video {
  232. position: relative;
  233. image {
  234. width: 100%;
  235. height: 180px;
  236. }
  237. .cover {
  238. width: 50px;
  239. height: 50px;
  240. position: absolute;
  241. z-index: 5;
  242. left: -180rpx;
  243. right: 0;
  244. bottom: 0;
  245. top: 0;
  246. margin: auto;
  247. }
  248. .cover1 {
  249. width: 50px;
  250. height: 50px;
  251. position: absolute;
  252. z-index: 5;
  253. left: -270rpx;
  254. right: 0;
  255. bottom: 0;
  256. top: 0;
  257. margin: auto;
  258. }
  259. }
  260. .video-info {
  261. width: 280px;
  262. height: 200px;
  263. }
  264. .video-cover {
  265. position: absolute;
  266. top: 0;
  267. left: 0;
  268. width: 270px;
  269. height: 200px;
  270. }
  271. .location {
  272. }
  273. .location-left {
  274. display: flex;
  275. flex-direction: row;
  276. }
  277. .location-left-name {
  278. font-size: 24upx;
  279. color: #5786cc;
  280. }
  281. .location-left-distance {
  282. margin-left: 30upx;
  283. font-size: 24upx;
  284. color: #5786cc;
  285. }
  286. .location-right {
  287. color: #999;
  288. font-size: 24upx;
  289. }
  290. .time-text {
  291. color: #666;
  292. font-size: 24upx;
  293. }
  294. .comment {
  295. display: flex;
  296. flex-direction: row;
  297. align-items: center;
  298. justify-content: space-between;
  299. margin-top: 15upx;
  300. }
  301. .comment-right {
  302. display: flex;
  303. flex-direction: row;
  304. align-items: center;
  305. justify-content: center;
  306. }
  307. .comment-item {
  308. display: flex;
  309. flex-direction: row;
  310. align-items: center;
  311. margin-left: 40upx;
  312. color: #666;
  313. }
  314. .image-love {
  315. width: 32upx;
  316. height: 32upx;
  317. margin-right: 6upx;
  318. }
  319. .image-comment {
  320. width: 30upx;
  321. height: 30upx;
  322. margin-right: 8upx;
  323. }
  324. .number {
  325. color: #666;
  326. padding-left: 5upx;
  327. font-size: 26upx;
  328. }
  329. .yzb {
  330. margin-right: 8upx;
  331. }
  332. .yzb-pinglun1 {
  333. }
  334. .thumb-on {
  335. font-size: 32upx;
  336. color: red;
  337. }
  338. .thumb-off {
  339. font-size: 32upx;
  340. }
  341. .thumb-comment {
  342. padding: 20upx;
  343. }
  344. .thumbs {
  345. padding: 20upx;
  346. border-radius: 10upx;
  347. background-color: #f8f8f8;
  348. display: flex;
  349. flex-direction: row;
  350. align-items: center;
  351. }
  352. .thumbs-icon {
  353. margin-right: 10upx;
  354. color: #666;
  355. /* margin-top: 5upx; */
  356. }
  357. .thumbs-headers {
  358. display: flex;
  359. flex-direction: row;
  360. align-items: center;
  361. overflow: hidden;
  362. white-space: nowrap;
  363. flex-wrap: wrap;
  364. flex: 1;
  365. }
  366. .thumbs-headers-img {
  367. margin-left: 10upx;
  368. margin-bottom: 10upx;
  369. }
  370. .thumbs-headers-more {
  371. font-size: 30upx;
  372. color: #999;
  373. }
  374. .thumbs-item {
  375. display: flex;
  376. flex-direction: row;
  377. align-items: center;
  378. }
  379. .thumbs-name {
  380. font-size: 28upx;
  381. color: #5786cc;
  382. }
  383. .comments {
  384. margin-top: 1upx;
  385. padding: 20upx;
  386. border-radius: 10upx;
  387. background-color: #f8f8f8;
  388. display: flex;
  389. flex-direction: row;
  390. }
  391. .comments-icon {
  392. margin-right: 10upx;
  393. color: #666;
  394. margin-top: 15upx;
  395. font-size: 24upx;
  396. }
  397. .comments-headers {
  398. flex: 1;
  399. display: flex;
  400. flex-direction: column;
  401. }
  402. .comments-headers-item {
  403. flex: 1;
  404. display: flex;
  405. flex-direction: row;
  406. /* align-items: center; */
  407. margin-bottom: 20upx;
  408. }
  409. .item-left {
  410. margin: 0 10upx;
  411. margin-top: 10upx;
  412. }
  413. .item-right {
  414. margin-left: 5upx;
  415. display: flex;
  416. flex: 1;
  417. flex-direction: column;
  418. }
  419. .item-right-name {
  420. display: flex;
  421. flex: 1;
  422. flex-direction: row;
  423. justify-content: space-between;
  424. align-items: center;
  425. }
  426. .item-right-name-top {
  427. color: #5786cc;
  428. font-size: 26upx;
  429. }
  430. .item-right-name-bottom {
  431. font-size: 24upx;
  432. color: #999;
  433. margin-top: 10upx;
  434. }
  435. .item-right-info {
  436. font-size: 28upx;
  437. color: #333;
  438. flex: 1;
  439. }
  440. .comment-content {
  441. display: flex;
  442. flex-direction: row;
  443. align-items: flex-start;
  444. margin-top: 3upx;
  445. flex: 1;
  446. }
  447. .comment-response {
  448. display: flex;
  449. flex-direction: row;
  450. align-items: center;
  451. margin-right: 10upx;
  452. }
  453. .comment-response-txt {
  454. font-size: 28upx;
  455. }
  456. .comment-response-name {
  457. font-size: 28upx;
  458. color: #5786cc;
  459. padding: 0 8upx;
  460. }
  461. .bottom {
  462. bottom: 0;
  463. position: fixed;
  464. height: 120rpx;
  465. width: 100%;
  466. padding: 0 20rpx;
  467. box-sizing: border-box;
  468. background-color: #f8f8f8;
  469. align-items: center;
  470. justify-content: center;
  471. display: flex;
  472. .bottom-bt {
  473. display: flex;
  474. flex-direction: row;
  475. align-items: center;
  476. input {
  477. width: 550rpx;
  478. height: 70rpx;
  479. padding: 0 15rpx;
  480. border-radius: 10rpx;
  481. background-color: #fff;
  482. margin-right: 20rpx;
  483. }
  484. button {
  485. padding: 0 20rpx;
  486. height: 60rpx;
  487. line-height: 60rpx;
  488. background-color: #12ae85;
  489. color: #fff;
  490. font-size: 28rpx;
  491. }
  492. }
  493. }
  494. </style>