index.vue 11 KB

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