index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <home-frame @toPath="toPath">
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1">
  6. <input type="text" placeholder="搜索视频" @tap="toCommon('pagesVideo/search/index','')">
  7. </view>
  8. <view class="one_2">
  9. <button size="mini" @tap="toCommon('pagesVideo/search/index','')">筛选</button>
  10. </view>
  11. </view>
  12. <view class="two">
  13. <scroll-view scroll-y="true" class="scroll-view">
  14. <view class="list-scroll-view">
  15. <view class="two_0 two_1">
  16. <swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000">
  17. <swiper-item class="list" v-for="(item,index) in bannerList" :key="index"
  18. @tap="toWeb(item)">
  19. <image class="image"
  20. :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  21. </image>
  22. </swiper-item>
  23. </swiper>
  24. </view>
  25. <view class="two_0 two_2">
  26. <view class="list textOver" v-for="(item,index) in linkList" :key="index"
  27. @tap="toWeb(item)">
  28. <image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''"
  29. mode="">
  30. </image>
  31. <view class="name">
  32. {{item.title}}
  33. </view>
  34. </view>
  35. </view>
  36. <view class="two_0 two_4">
  37. <view class="top">
  38. <view class="top_1 textOver">
  39. <span>{{one_title}}</span>
  40. </view>
  41. <view class="top_2">
  42. <span
  43. @tap="toCommon('pagesVideo/more/index','head_actor=63f7175721efa85eb49b8ccd')">
  44. 更多
  45. <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
  46. </span>
  47. </view>
  48. </view>
  49. <view class="info">
  50. <view class="list" v-for="(item,index) in oneList" :key="index" @tap="videoView(item)">
  51. <image class="image"
  52. :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  53. </image>
  54. <view class="name textOver">
  55. {{item.title}}
  56. </view>
  57. <view class="other">
  58. <view class="other_1">
  59. <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
  60. {{item.view_num}}
  61. </view>
  62. <view class="other_2">
  63. {{item.time_num}}
  64. </view>
  65. </view>
  66. <view class="vip" v-if="item.is_vip=='1'">
  67. <span>VIP</span>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="btn">
  72. <button
  73. @tap="toCommon('pagesVideo/more/index','head_actor=63f7175721efa85eb49b8ccd')">查看更多</button>
  74. </view>
  75. </view>
  76. <view class="two_0 two_5">
  77. <view class="top">
  78. <view class="top_1 textOver">
  79. <span>{{two_title}}</span>
  80. </view>
  81. <view class="top_2">
  82. <span
  83. @tap="toCommon('pagesVideo/more/index','head_actor=63f7177221efa85eb49b8cdd')">
  84. 更多
  85. <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
  86. </span>
  87. </view>
  88. </view>
  89. <view class="info">
  90. <view class="list" v-for="(item,index) in twoList" :key="index" @tap="videoView(item)">
  91. <image class="image"
  92. :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  93. </image>
  94. <view class="name textOver">
  95. {{item.title}}
  96. </view>
  97. <view class="other">
  98. <view class="other_1">
  99. <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
  100. {{item.view_num}}
  101. </view>
  102. <view class="other_2">
  103. {{item.time_num}}
  104. </view>
  105. </view>
  106. <view class="vip" v-if="item.is_vip=='1'">
  107. <span>VIP</span>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="btn">
  112. <button
  113. @tap="toCommon('pagesVideo/more/index','head_actor=63f7177221efa85eb49b8cdd')">查看更多</button>
  114. </view>
  115. </view>
  116. <view class="two_0 two_5">
  117. <view class="top">
  118. <view class="top_1 textOver">
  119. <span>{{thr_title}}</span>
  120. </view>
  121. <view class="top_2">
  122. <span
  123. @tap="toCommon('pagesVideo/more/index','head_actor=63f7177f21efa85eb49b8ced')">更多
  124. <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
  125. </span>
  126. </view>
  127. </view>
  128. <view class="info">
  129. <view class="list" v-for="(item,index) in thrList" :key="index" @tap="videoView(item)">
  130. <image class="image"
  131. :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  132. </image>
  133. <view class="name textOver">
  134. {{item.title}}
  135. </view>
  136. <view class="other">
  137. <view class="other_1">
  138. <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
  139. {{item.view_num}}
  140. </view>
  141. <view class="other_2">
  142. {{item.time_num}}
  143. </view>
  144. </view>
  145. <view class="vip" v-if="item.is_vip=='1'">
  146. <span>VIP</span>
  147. </view>
  148. </view>
  149. </view>
  150. <view class="btn">
  151. <button
  152. @tap="toCommon('pagesVideo/more/index','head_actor=63f7177f21efa85eb49b8ced')">查看更多</button>
  153. </view>
  154. </view>
  155. <view class="two_0 two_6">
  156. <view class="top">
  157. <view class="top_1 textOver">
  158. <span>{{four_title}}</span>
  159. </view>
  160. <view class="top_2">
  161. <span
  162. @tap="toCommon('pagesVideo/more/index','head_actor=63f729ff3271105df0a88859')">更多
  163. <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
  164. </span>
  165. </view>
  166. </view>
  167. <view class="info">
  168. <view class="list" v-for="(item,index) in fourList" :key="index" @tap="videoView(item)">
  169. <image class="image"
  170. :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  171. </image>
  172. <view class="name textOver">
  173. {{item.title}}
  174. </view>
  175. <view class="other">
  176. <view class="other_1">
  177. <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
  178. {{item.view_num}}
  179. </view>
  180. <view class="other_2">
  181. {{item.time_num}}
  182. </view>
  183. </view>
  184. <view class="vip" v-if="item.is_vip=='1'">
  185. <span>VIP</span>
  186. </view>
  187. </view>
  188. </view>
  189. <view class="btn">
  190. <button
  191. @tap="toCommon('pagesVideo/more/index','head_actor=63f729ff3271105df0a88859')">查看更多</button>
  192. </view>
  193. </view>
  194. </view>
  195. </scroll-view>
  196. </view>
  197. </view>
  198. </home-frame>
  199. </template>
  200. <script>
  201. import homeFrame from "../components/home-frame.vue";
  202. export default {
  203. components: {
  204. homeFrame
  205. },
  206. data() {
  207. return {
  208. bannerList: [],
  209. linkList: [],
  210. one_title: '',
  211. oneList: [],
  212. two_title: '',
  213. twoList: [],
  214. thr_title: '',
  215. thrList: [],
  216. four_title: '',
  217. fourList: [],
  218. };
  219. },
  220. onLoad() {
  221. const that = this;
  222. that.search()
  223. },
  224. onShow() {},
  225. methods: {
  226. async search() {
  227. const that = this;
  228. // 轮播图
  229. let res;
  230. res = await that.$api('appbanner', 'GET', {
  231. place: '1',
  232. is_use: '0'
  233. });
  234. if (res.errcode == '0') {
  235. that.$set(that, `bannerList`, res.data)
  236. }
  237. // 热门链接
  238. res = await that.$api('hotlink', 'GET', {
  239. place: '1',
  240. is_use: '0'
  241. });
  242. if (res.errcode == '0') {
  243. that.$set(that, `linkList`, res.data)
  244. }
  245. // 顾红伟
  246. res = await that.$api('scenedata/63f7175721efa85eb49b8ccd', 'GET', {});
  247. if (res.errcode == '0') {
  248. that.$set(that, `one_title`, res.data.title);
  249. res = await that.$api('videos', 'GET', {
  250. skip: 0,
  251. limit: 6,
  252. is_use: '0',
  253. head_actor: res.data._id
  254. })
  255. if (res.errcode == '0') that.$set(that, `oneList`, res.data)
  256. }
  257. // 成龙
  258. res = await that.$api('scenedata/63f7177221efa85eb49b8cdd', 'GET', {});
  259. if (res.errcode == '0') {
  260. that.$set(that, `two_title`, res.data.title);
  261. res = await that.$api('videos', 'GET', {
  262. skip: 0,
  263. limit: 4,
  264. is_use: '0',
  265. head_actor: res.data._id
  266. })
  267. if (res.errcode == '0') that.$set(that, `twoList`, res.data)
  268. }
  269. // 李连杰
  270. res = await that.$api('scenedata/63f7177f21efa85eb49b8ced', 'GET', {});
  271. if (res.errcode == '0') {
  272. that.$set(that, `thr_title`, res.data.title);
  273. res = await that.$api('videos', 'GET', {
  274. skip: 0,
  275. limit: 6,
  276. is_use: '0',
  277. head_actor: res.data._id
  278. })
  279. if (res.errcode == '0') that.$set(that, `thrList`, res.data)
  280. }
  281. // 李小龙
  282. res = await that.$api('scenedata/63f729ff3271105df0a88859', 'GET', {});
  283. if (res.errcode == '0') {
  284. that.$set(that, `four_title`, res.data.title);
  285. res = await that.$api('videos', 'GET', {
  286. skip: 0,
  287. limit: 4,
  288. is_use: '0',
  289. head_actor: res.data._id
  290. })
  291. if (res.errcode == '0') that.$set(that, `fourList`, res.data)
  292. }
  293. },
  294. toWeb(e) {
  295. const that = this;
  296. let system = that.$config.system
  297. if (system.uniPlatform == 'app') {
  298. plus.runtime.openURL(e.web_url)
  299. } else if (system.uniPlatform == 'mp-weixin') {
  300. uni.showToast({
  301. title: '小程序无法打开链接,请打开app进行跳转',
  302. icon: "none"
  303. })
  304. }
  305. },
  306. toCommon(route, query) {
  307. uni.navigateTo({
  308. url: `/${route}?${query}`
  309. })
  310. },
  311. // 视频查看
  312. videoView(e) {
  313. uni.navigateTo({
  314. url: `/pagesVideo/video/index?id=${e._id}`
  315. })
  316. },
  317. // 跳转页面
  318. toPath(e) {
  319. let url = `/${e.route}`;
  320. if (e.type == '0') uni.navigateTo({
  321. url
  322. })
  323. else if (e.type == '1') uni.redirectTo({
  324. url
  325. })
  326. else if (e.type == '2') uni.reLaunch({
  327. url
  328. })
  329. else if (e.type == '3') uni.switchTab({
  330. url
  331. })
  332. }
  333. },
  334. };
  335. </script>
  336. <style lang="scss">
  337. .main {
  338. background-color: var(--rgb000);
  339. display: flex;
  340. flex-direction: column;
  341. width: 100vw;
  342. height: 92vh;
  343. .one {
  344. background-color: var(--rgb111);
  345. display: flex;
  346. padding: 8px;
  347. .one_1 {
  348. flex-grow: 1;
  349. input {
  350. border: 1px solid var(--rgbf1f);
  351. height: 30px;
  352. border-radius: 2px;
  353. padding: 0 5px;
  354. font-size: 12px;
  355. }
  356. }
  357. .one_2 {
  358. button {
  359. height: 100%;
  360. background-color: var(--rgbfa4);
  361. color: var(--rgbfff);
  362. }
  363. }
  364. }
  365. .two {
  366. position: relative;
  367. flex-grow: 1;
  368. .two_0 {
  369. margin: 0 0 10px 0;
  370. padding: 0 8px;
  371. .top {
  372. margin: 0 0 10px 0;
  373. display: flex;
  374. padding: 5px 0;
  375. .top_1 {
  376. flex-grow: 1;
  377. span {
  378. color: var(--rgbfff);
  379. font-size: 20px;
  380. font-family: monospace;
  381. font-weight: bold;
  382. }
  383. }
  384. .top_2 {
  385. span {
  386. color: var(--rgbfff);
  387. font-size: 14px;
  388. }
  389. }
  390. }
  391. .info {
  392. margin: 0 0 10px 0;
  393. display: flex;
  394. justify-content: space-between;
  395. flex-wrap: wrap;
  396. .list {
  397. position: relative;
  398. width: 48%;
  399. margin: 0 0 10px 0;
  400. .image {
  401. width: 100%;
  402. height: 100px;
  403. overflow: hidden;
  404. border-radius: 5px;
  405. }
  406. .name {
  407. font-size: 14px;
  408. color: var(--rgbfff);
  409. }
  410. .other {
  411. display: flex;
  412. color: var(--rgbfff);
  413. font-size: 12px;
  414. justify-content: space-between;
  415. }
  416. .vip {
  417. position: absolute;
  418. top: 0;
  419. left: 1vw;
  420. span {
  421. font-size: 14px;
  422. font-weight: bold;
  423. color: var(--rgbffd);
  424. }
  425. }
  426. }
  427. }
  428. .btn {
  429. button {
  430. border-radius: 25px;
  431. background-color: var(--rgbfa4);
  432. color: var(--rgbfff);
  433. font-size: 14px;
  434. }
  435. }
  436. }
  437. .two_1 {
  438. .swiper {
  439. height: 200px;
  440. overflow: hidden;
  441. }
  442. .list {
  443. .image {
  444. width: 100%;
  445. height: 100%;
  446. }
  447. }
  448. }
  449. .two_2 {
  450. display: flex;
  451. flex-direction: row;
  452. flex-wrap: wrap;
  453. justify-content: space-between;
  454. .list {
  455. text-align: center;
  456. width: 18%;
  457. margin: 0 0 10px 0;
  458. .image {
  459. width: 100%;
  460. height: 64px;
  461. border-radius: 90%;
  462. margin: 0 0 5px 0;
  463. }
  464. .name {
  465. font-size: 12px;
  466. color: #ffffff;
  467. }
  468. }
  469. }
  470. }
  471. }
  472. .scroll-view {
  473. position: absolute;
  474. top: 0;
  475. left: 0;
  476. right: 0;
  477. bottom: 0;
  478. .list-scroll-view {
  479. display: flex;
  480. flex-direction: column;
  481. }
  482. }
  483. </style>