index.vue 12 KB

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