index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <template>
  2. <view class="container">
  3. <!-- #ifdef MP -->
  4. <view v-if="dataList.length > 0">
  5. <view class="live-wrapper-b">
  6. <navigator class="live-item-b" v-for="(item,index) in dataList" :key="index"
  7. :url="'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.room_id+'&custom_params='+custom_params"
  8. hover-class="none" :style="[{'background':bg},{'box-shadow':`0px 1px 20px ${boxShadow}`}]">
  9. <view class="img-box">
  10. <view class="label bgblue" v-if="item.live_status == 102">
  11. <view class="txt">预告</view>
  12. <view class="msg">{{item.show_time}}</view>
  13. </view>
  14. <view class="label bggary" v-if="item.live_status==103">
  15. <image src="/static/images/live-02.png" mode="" style="width: 20rpx; height: 20rpx;"></image>
  16. <text>回放</text>
  17. </view>
  18. <view class="label bgred" v-if="item.live_status==101">
  19. <image src="/static/images/live-01.png" mode="" style="width: 21rpx; height: 22rpx;"></image>
  20. <text>进行中</text>
  21. </view>
  22. <image :src="item.share_img"></image>
  23. </view>
  24. <view class="info">
  25. <view class="title line1">{{item.name}}</view>
  26. <view class="people">
  27. <image :src="item.anchor_img" alt="">
  28. <text>{{item.anchor_name}}</text>
  29. </view>
  30. </view>
  31. </navigator>
  32. </view>
  33. </view>
  34. <!-- #endif -->
  35. <tui-tabbar :current="current" backgroundColor="#FFFFFF" color="#666" selectedColor="#EB0909">
  36. </tui-tabbar>
  37. </view>
  38. </template>
  39. <script>
  40. var app = getApp();
  41. export default {
  42. data() {
  43. return {
  44. current: '',
  45. storecateList: [],
  46. dataList: [],
  47. cityName: '',
  48. navH: "",
  49. is_switch: false,
  50. where: {
  51. cid: 0,
  52. keyword: '',
  53. priceOrder: '',
  54. salesOrder: '',
  55. news: 0,
  56. page: 1,
  57. limit: 10,
  58. latitude: "",
  59. longitude: ""
  60. },
  61. price: 0,
  62. stock: 0,
  63. nows: false,
  64. loadend: false,
  65. loading: false,
  66. bottommenulist: [],
  67. host_product: "",
  68. title: "",
  69. position: "",
  70. latitude: "",
  71. longitude: "",
  72. cid: ""
  73. };
  74. },
  75. components: {},
  76. props: {},
  77. /**
  78. * 生命周期函数--监听页面加载
  79. */
  80. onLoad: function(options) {
  81. const _this = this;
  82. // #ifdef MP-WEIXIN
  83. this.current = "/" + this.__route__;
  84. // #endif
  85. //#ifdef H5
  86. this.current = this.$route.path;
  87. //#endif
  88. _this.$request.post('Config.audit', {
  89. samkey: (new Date()).valueOf()
  90. }).then(res => {
  91. if (res.data.is_submitaudit != 1) {
  92. uni.setNavigationBarTitle({
  93. title: "直播"
  94. });
  95. }
  96. });
  97. _this.get_data_list();
  98. },
  99. /**
  100. * 生命周期函数--监听页面显示
  101. */
  102. onShow: function() {},
  103. /**
  104. * 页面相关事件处理函数--监听用户下拉动作
  105. */
  106. onPullDownRefresh: function() {
  107. this.where.page = 1;
  108. this.loadend = false;
  109. this.dataList = [];
  110. this.get_data_list();
  111. uni.stopPullDownRefresh();
  112. },
  113. /**
  114. * 页面上拉触底事件的处理函数
  115. */
  116. onReachBottom: function() {
  117. this.get_data_list();
  118. },
  119. methods: {
  120. onChangePosition: function(e) {
  121. const _this = this;
  122. uni.chooseLocation({
  123. success(res) {
  124. _this.cityName = res.name;
  125. uni.setStorageSync('cityName', _this.cityName);
  126. _this.position = res.address;
  127. _this.where.latitude = res.latitude;
  128. _this.where.longitude = res.longitude;
  129. _this.loadend = false;
  130. _this.latitude = res.latitude;
  131. _this.longitude = res.longitude;
  132. _this.get_data_list(true);
  133. }
  134. });
  135. },
  136. Changswitch: function() {
  137. var that = this;
  138. that.is_switch = !this.is_switch;
  139. },
  140. searchSubmit: function(e) {
  141. var that = this;
  142. that.where.keyword = e.detail.value;
  143. that.where.page = 1;
  144. that.loadend = false;
  145. this.get_data_list(true);
  146. },
  147. //点击事件处理
  148. set_where: function(e) {
  149. this.cid = e.currentTarget.dataset.cid;
  150. this.loadend = false;
  151. this.where.page = 1;
  152. this.get_data_list(true);
  153. },
  154. //设置where条件
  155. setWhere: function() {
  156. this.where.salesOrder = 'asc';
  157. if (this.cid) {
  158. this.where.cid = this.cid;
  159. }
  160. },
  161. get_data_list: function(isPage) {
  162. var that = this;
  163. this.setWhere();
  164. if (that.loadend) return;
  165. if (that.loading) return;
  166. if (isPage === true)
  167. {
  168. that.dataList = [];
  169. that.where.page =1;
  170. }
  171. //console.log(that.where);
  172. that.$request.post('Liveroom.index', that.where).then(res => {
  173. var dataList = res.data;
  174. console.log(dataList);
  175. var loadend = dataList.length < that.where.limit;
  176. that.where.page = that.where.page + 1;
  177. that.loadend = loadend;
  178. that.loading = false;
  179. that.dataList = that.dataList.concat(res.data.data);
  180. });
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. .live-wrapper {
  187. position: relative;
  188. width: 100%;
  189. overflow: hidden;
  190. border-radius: 16rpx;
  191. image {
  192. width: 100%;
  193. height: 400rpx;
  194. }
  195. .live-top {
  196. z-index: 20;
  197. position: absolute;
  198. left: 0;
  199. top: 0;
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. color: #fff;
  204. width: 180rpx;
  205. height: 54rpx;
  206. border-radius: 0rpx 0px 18rpx 0px;
  207. image {
  208. width: 30rpx;
  209. height: 30rpx;
  210. margin-right: 10rpx;
  211. /* #ifdef H5 */
  212. display: block;
  213. /* #endif */
  214. }
  215. }
  216. .live-title {
  217. position: absolute;
  218. left: 0;
  219. bottom: 6rpx;
  220. width: 100%;
  221. height: 70rpx;
  222. line-height: 70rpx;
  223. text-align: center;
  224. font-size: 30rpx;
  225. color: #fff;
  226. background: rgba(0, 0, 0, 0.35);
  227. }
  228. &.mores {
  229. width: 100%;
  230. .item {
  231. position: relative;
  232. width: 320rpx;
  233. display: inline-block;
  234. border-radius: 16rpx;
  235. overflow: hidden;
  236. margin-right: 20rpx;
  237. image {
  238. width: 320rpx;
  239. height: 180rpx;
  240. border-radius: 16rpx;
  241. object-fit: cover;
  242. }
  243. .live-title {
  244. height: 40rpx;
  245. line-height: 40rpx;
  246. text-align: center;
  247. font-size: 22rpx;
  248. }
  249. .live-top {
  250. width: 120rpx;
  251. height: 36rpx;
  252. font-size: 22rpx;
  253. image {
  254. width: 20rpx;
  255. height: 20rpx;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. .live-wrapper-a {
  262. padding: 0rpx 20rpx 0;
  263. .live-item-a {
  264. display: flex;
  265. background: #fff;
  266. margin-bottom: 20rpx;
  267. border-radius: 16rpx;
  268. overflow: hidden;
  269. &:last-child {
  270. margin-bottom: 0;
  271. }
  272. .img-box {
  273. position: relative;
  274. width: 340rpx;
  275. height: 270rpx;
  276. image {
  277. width: 100%;
  278. height: 100%;
  279. }
  280. }
  281. .info {
  282. flex: 1;
  283. display: flex;
  284. flex-direction: column;
  285. justify-content: space-between;
  286. padding: 15rpx 20rpx;
  287. .title {
  288. font-size: 30rpx;
  289. color: #333;
  290. }
  291. .people {
  292. display: flex;
  293. align-items: center;
  294. color: #999;
  295. font-size: 24rpx;
  296. margin-top: 10rpx;
  297. image {
  298. width: 32rpx;
  299. height: 32rpx;
  300. border-radius: 50%;
  301. margin-right: 10rpx;
  302. }
  303. }
  304. .goods-wrapper {
  305. display: flex;
  306. .goods-item {
  307. position: relative;
  308. width: 96rpx;
  309. height: 96rpx;
  310. margin-right: 20rpx;
  311. overflow: hidden;
  312. border-radius: 16rpx;
  313. &:last-child {
  314. margin-right: 0;
  315. }
  316. image {
  317. width: 100%;
  318. height: 100%;
  319. border-radius: 16rpx;
  320. }
  321. .bg {
  322. position: absolute;
  323. left: 0;
  324. top: 0;
  325. width: 100%;
  326. height: 100%;
  327. border-radius: 16rpx;
  328. background: rgba(0, 0, 0, 0.3);
  329. }
  330. text {
  331. position: absolute;
  332. left: 0;
  333. bottom: 0;
  334. width: 100%;
  335. height: 60rpx;
  336. line-height: 70rpx;
  337. color: #fff;
  338. background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%);
  339. }
  340. .num {
  341. display: flex;
  342. align-items: center;
  343. justify-content: center;
  344. position: absolute;
  345. left: 0;
  346. top: 0;
  347. width: 100%;
  348. height: 100%;
  349. background: rgba(0, 0, 0, 0.3);
  350. color: #fff;
  351. font-size: 28rpx;
  352. }
  353. }
  354. }
  355. .empty-goods {
  356. width: 96rpx;
  357. height: 96rpx;
  358. border-radius: 6rpx;
  359. background-color: #B2B2B2;
  360. color: #fff;
  361. font-size: 20rpx;
  362. text-align: center;
  363. line-height: 96rpx;
  364. }
  365. }
  366. }
  367. &.live-wrapper-c {
  368. .live-item-a {
  369. display: flex;
  370. flex-direction: column;
  371. .img-box {
  372. width: 100%;
  373. border-radius: 8px 8px 0 0;
  374. }
  375. .info {
  376. display: flex;
  377. justify-content: space-between;
  378. align-items: center;
  379. flex-direction: initial;
  380. .left {
  381. width: 69%;
  382. }
  383. .goods-wrapper {
  384. flex: 1;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. .live-wrapper-b {
  391. padding: 20rpx 20rpx 0;
  392. display: flex;
  393. justify-content: space-between;
  394. flex-wrap: wrap;
  395. .live-item-b {
  396. width: 345rpx;
  397. background-color: #fff;
  398. border-radius: 16rpx;
  399. overflow: hidden;
  400. margin-bottom: 20rpx;
  401. overflow: hidden;
  402. .img-box {
  403. position: relative;
  404. image {
  405. width: 100%;
  406. height: 190rpx;
  407. }
  408. }
  409. .info {
  410. display: flex;
  411. flex-direction: column;
  412. padding: 20rpx;
  413. .title {
  414. font-size: 30rpx;
  415. color: #333;
  416. }
  417. .people {
  418. display: flex;
  419. margin-top: 10rpx;
  420. color: #999;
  421. image {
  422. width: 36rpx;
  423. height: 36rpx;
  424. border-radius: 50%;
  425. margin-right: 10rpx;
  426. }
  427. }
  428. }
  429. }
  430. }
  431. .label {
  432. display: flex;
  433. align-items: center;
  434. justify-content: center;
  435. position: absolute;
  436. left: 20rpx;
  437. top: 20rpx;
  438. border-radius: 22rpx 0px 22rpx 22rpx;
  439. font-size: 24rpx;
  440. color: #fff;
  441. image {
  442. margin-right: 10rpx;
  443. }
  444. text {
  445. font-size: 22rpx;
  446. }
  447. }
  448. .bgred {
  449. width: 132rpx;
  450. height: 38rpx;
  451. background: linear-gradient(270deg, #F5742F 0%, #FF1717 100%)
  452. }
  453. .bggary {
  454. width: 108rpx;
  455. height: 38rpx;
  456. background: linear-gradient(270deg, #999999 0%, #666666 100%)
  457. }
  458. .bgblue {
  459. width: 220rpx;
  460. height: 38rpx;
  461. // background: rgba(0,0,0,0.36);
  462. background: linear-gradient(80deg, #2FA1F5 0%, #0076FF 5%, rgba(0, 0, 0, 0.36) 100%);
  463. overflow: hidden;
  464. .txt {
  465. position: relative;
  466. left: -5rpx;
  467. display: flex;
  468. align-items: center;
  469. justify-content: center;
  470. width: 38px;
  471. height: 100%;
  472. text-align: center;
  473. // background: linear-gradient(270deg, #2FA1F5 0%, #0076FF 100%);
  474. }
  475. }
  476. .title-box {
  477. display: flex;
  478. justify-content: space-between;
  479. align-items: center;
  480. padding: 20rpx;
  481. font-size: 32rpx;
  482. .more {
  483. display: flex;
  484. align-items: center;
  485. justify-content: center;
  486. font-size: 26rpx;
  487. color: #666;
  488. .iconfont {
  489. font-size: 26rpx;
  490. margin-top: 8rpx;
  491. }
  492. }
  493. }
  494. .empty-txt {
  495. height: 60rpx;
  496. line-height: 60rpx;
  497. text-align: center;
  498. font-size: 24rpx;
  499. color: #999;
  500. }
  501. </style>