circle-item.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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 > 0" :urls="item.urlList" multipleSize="90" space='10'></u-album>
  13. <u-album v-else :urls="item.urlList"></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.comments.circleFriendsDetailList.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.comments.records.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.comments.records" :key="index3">
  75. <view class="item-left">
  76. <u-avatar :src="item3.userAvatar" shape="square" size="32" @click="onJump('/pages/friends/friendInfo?friendId=' + item3.userId)"></u-avatar>
  77. </view>
  78. <view class="item-right">
  79. <view class="item-right-name">
  80. <text class="item-right-name-top">{{ item3.userName }}</text>
  81. <text class="item-right-name-bottom">{{ item3.createTime }}</text>
  82. </view>
  83. <view class="comment-content">
  84. <view class="comment-response" v-if="item3.comUserName">
  85. <text class="comment-response-txt">回复</text>
  86. <text class="comment-response-name">{{ item3.comUserName }}</text>
  87. <text class="comment-response-txt">:</text>
  88. </view>
  89. <text class="item-right-info" @click="doComment(item, item3, index)">{{ item3.comment }}</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. computed: {
  140. ...mapState(['locateInformation'])
  141. },
  142. created() {},
  143. filters: {
  144. formatDistance(distance) {
  145. var strDistance = '';
  146. if (distance < 1) {
  147. //一公里以内的
  148. strDistance = distance * 1000 + 'm';
  149. } else {
  150. distance = distance.toFixed(1);
  151. strDistance = distance + 'km';
  152. }
  153. return strDistance;
  154. }
  155. },
  156. methods: {
  157. playVideo(val) {
  158. this.isShowVideo = true
  159. console.log('--play--');
  160. // 点击显示全屏
  161. this.videoContext = uni.createVideoContext('myVideo')
  162. this.videoContext.requestFullScreen();
  163. },
  164. onJump(url) {
  165. uni.navigateTo({
  166. url: url
  167. });
  168. },
  169. toDetail(item) {
  170. uni.navigateTo({
  171. url: '/pages/circle/circleDetail?item=' + JSON.stringify(item)
  172. });
  173. },
  174. click() {
  175. this.$emit('click');
  176. },
  177. doThumb(item, index) {
  178. item.index = index;
  179. this.$emit('doThumb', item);
  180. },
  181. doComment(item, comment, index) {
  182. item.index = index;
  183. this.$emit('doComment', item, comment);
  184. },
  185. doComment2Com(item, comment) {
  186. this.$emit('doComment2Com', item, comment);
  187. }
  188. }
  189. };
  190. </script>
  191. <style lang="scss">
  192. .view {
  193. flex-direction: column;
  194. }
  195. .album {
  196. display: flex;
  197. flex-direction: row;
  198. align-items: flex-start;
  199. }
  200. .album__avatar {
  201. background-color: #fff;
  202. padding: 5px;
  203. border-radius: 3px;
  204. }
  205. .album__content {
  206. margin-left: 10px;
  207. flex: 1;
  208. }
  209. .album__info {
  210. margin-bottom: 15upx;
  211. display: flex;
  212. flex-direction: column;
  213. }
  214. .info-name {
  215. color: #5786cc;
  216. font-size: 30upx;
  217. font-weight: bold;
  218. }
  219. .info-content {
  220. color: #333;
  221. font-size: 30upx;
  222. padding: 5px 0 8px 0;
  223. }
  224. .video {
  225. position: relative;
  226. image {
  227. width: 100%;
  228. height: 180px;
  229. }
  230. .cover {
  231. width: 50px;
  232. height: 50px;
  233. position: absolute;
  234. z-index: 5;
  235. left: -180rpx;
  236. right: 0;
  237. bottom: 0;
  238. top: 0;
  239. margin: auto;
  240. }
  241. .cover1 {
  242. width: 50px;
  243. height: 50px;
  244. position: absolute;
  245. z-index: 5;
  246. left: -270rpx;
  247. right: 0;
  248. bottom: 0;
  249. top: 0;
  250. margin: auto;
  251. }
  252. }
  253. .video-info {
  254. width: 280px;
  255. height: 200px;
  256. }
  257. .video-cover {
  258. position: absolute;
  259. top: 0;
  260. left: 0;
  261. width: 270px;
  262. height: 200px;
  263. }
  264. .location {
  265. }
  266. .location-left {
  267. display: flex;
  268. flex-direction: row;
  269. }
  270. .location-left-name {
  271. font-size: 24upx;
  272. color: #5786cc;
  273. }
  274. .location-left-distance {
  275. margin-left: 30upx;
  276. font-size: 24upx;
  277. color: #5786cc;
  278. }
  279. .location-right {
  280. color: #999;
  281. font-size: 24upx;
  282. }
  283. .time-text {
  284. color: #666;
  285. font-size: 24upx;
  286. }
  287. .comment {
  288. display: flex;
  289. flex-direction: row;
  290. align-items: center;
  291. justify-content: space-between;
  292. margin-top: 15upx;
  293. }
  294. .comment-right {
  295. display: flex;
  296. flex-direction: row;
  297. align-items: center;
  298. justify-content: center;
  299. }
  300. .comment-item {
  301. display: flex;
  302. flex-direction: row;
  303. align-items: center;
  304. margin-left: 40upx;
  305. color: #666;
  306. }
  307. .image-love {
  308. width: 32upx;
  309. height: 32upx;
  310. margin-right: 6upx;
  311. }
  312. .image-comment {
  313. width: 30upx;
  314. height: 30upx;
  315. margin-right: 8upx;
  316. }
  317. .number {
  318. color: #666;
  319. padding-left: 5upx;
  320. font-size: 26upx;
  321. }
  322. .yzb {
  323. margin-right: 8upx;
  324. }
  325. .yzb-pinglun1 {
  326. }
  327. .thumb-on {
  328. font-size: 32upx;
  329. color: red;
  330. }
  331. .thumb-off {
  332. font-size: 32upx;
  333. }
  334. .thumb-comment {
  335. padding: 20upx;
  336. }
  337. .thumbs {
  338. padding: 20upx;
  339. border-radius: 10upx;
  340. background-color: #f8f8f8;
  341. display: flex;
  342. flex-direction: row;
  343. align-items: center;
  344. }
  345. .thumbs-icon {
  346. margin-right: 10upx;
  347. color: #666;
  348. /* margin-top: 5upx; */
  349. }
  350. .thumbs-headers {
  351. display: flex;
  352. flex-direction: row;
  353. align-items: center;
  354. overflow: hidden;
  355. white-space: nowrap;
  356. flex-wrap: wrap;
  357. flex: 1;
  358. }
  359. .thumbs-headers-img {
  360. margin-left: 10upx;
  361. margin-bottom: 10upx;
  362. }
  363. .thumbs-headers-more {
  364. font-size: 30upx;
  365. color: #999;
  366. }
  367. .thumbs-item {
  368. display: flex;
  369. flex-direction: row;
  370. align-items: center;
  371. }
  372. .thumbs-name {
  373. font-size: 28upx;
  374. color: #5786cc;
  375. }
  376. .comments {
  377. margin-top: 1upx;
  378. padding: 20upx;
  379. border-radius: 10upx;
  380. background-color: #f8f8f8;
  381. display: flex;
  382. flex-direction: row;
  383. }
  384. .comments-icon {
  385. margin-right: 10upx;
  386. color: #666;
  387. margin-top: 15upx;
  388. font-size: 24upx;
  389. }
  390. .comments-headers {
  391. flex: 1;
  392. display: flex;
  393. flex-direction: column;
  394. }
  395. .comments-headers-item {
  396. flex: 1;
  397. display: flex;
  398. flex-direction: row;
  399. /* align-items: center; */
  400. margin-bottom: 20upx;
  401. }
  402. .item-left {
  403. margin: 0 10upx;
  404. margin-top: 10upx;
  405. }
  406. .item-right {
  407. margin-left: 5upx;
  408. display: flex;
  409. flex: 1;
  410. flex-direction: column;
  411. }
  412. .item-right-name {
  413. display: flex;
  414. flex: 1;
  415. flex-direction: row;
  416. justify-content: space-between;
  417. align-items: center;
  418. }
  419. .item-right-name-top {
  420. color: #5786cc;
  421. font-size: 26upx;
  422. }
  423. .item-right-name-bottom {
  424. font-size: 24upx;
  425. color: #999;
  426. margin-top: 10upx;
  427. }
  428. .item-right-info {
  429. font-size: 28upx;
  430. color: #333;
  431. flex: 1;
  432. }
  433. .comment-content {
  434. display: flex;
  435. flex-direction: row;
  436. align-items: flex-start;
  437. margin-top: 3upx;
  438. flex: 1;
  439. }
  440. .comment-response {
  441. display: flex;
  442. flex-direction: row;
  443. align-items: center;
  444. margin-right: 10upx;
  445. }
  446. .comment-response-txt {
  447. font-size: 28upx;
  448. }
  449. .comment-response-name {
  450. font-size: 28upx;
  451. color: #5786cc;
  452. padding: 0 8upx;
  453. }
  454. .bottom {
  455. bottom: 0;
  456. position: fixed;
  457. height: 120rpx;
  458. width: 100%;
  459. padding: 0 20rpx;
  460. box-sizing: border-box;
  461. background-color: #f8f8f8;
  462. align-items: center;
  463. justify-content: center;
  464. display: flex;
  465. .bottom-bt {
  466. display: flex;
  467. flex-direction: row;
  468. align-items: center;
  469. input {
  470. width: 550rpx;
  471. height: 70rpx;
  472. padding: 0 15rpx;
  473. border-radius: 10rpx;
  474. background-color: #fff;
  475. margin-right: 20rpx;
  476. }
  477. button {
  478. padding: 0 20rpx;
  479. height: 60rpx;
  480. line-height: 60rpx;
  481. background-color: #12ae85;
  482. color: #fff;
  483. font-size: 28rpx;
  484. }
  485. }
  486. }
  487. </style>