index.vue 11 KB

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