index.vue 11 KB

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