index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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. console.log('1');
  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. toPath(e) {
  283. let url = `/${e.route}`;
  284. if (e.type == '0') uni.navigateTo({
  285. url
  286. })
  287. else if (e.type == '1') uni.redirectTo({
  288. url
  289. })
  290. else if (e.type == '2') uni.reLaunch({
  291. url
  292. })
  293. else if (e.type == '3') uni.switchTab({
  294. url
  295. })
  296. }
  297. },
  298. };
  299. </script>
  300. <style lang="scss">
  301. .main {
  302. background-color: var(--rgb000);
  303. display: flex;
  304. flex-direction: column;
  305. width: 100vw;
  306. height: 92vh;
  307. .one {
  308. background-color: var(--rgb111);
  309. display: flex;
  310. padding: 8px;
  311. .one_1 {
  312. flex-grow: 1;
  313. input {
  314. border: 1px solid var(--rgbf1f);
  315. height: 30px;
  316. border-radius: 2px;
  317. padding: 0 5px;
  318. font-size: 12px;
  319. }
  320. }
  321. .one_2 {
  322. button {
  323. height: 100%;
  324. background-color: var(--rgbfa4);
  325. color: var(--rgbfff);
  326. }
  327. }
  328. }
  329. .two {
  330. position: relative;
  331. flex-grow: 1;
  332. .two_0 {
  333. margin: 0 0 10px 0;
  334. padding: 0 8px;
  335. .top {
  336. margin: 0 0 10px 0;
  337. display: flex;
  338. padding: 5px 0;
  339. .top_1 {
  340. flex-grow: 1;
  341. span {
  342. color: var(--rgbfff);
  343. font-size: 20px;
  344. font-family: monospace;
  345. font-weight: bold;
  346. }
  347. }
  348. .top_2 {
  349. span {
  350. color: var(--rgbfff);
  351. font-size: 14px;
  352. }
  353. }
  354. }
  355. .info {
  356. margin: 0 0 10px 0;
  357. display: flex;
  358. justify-content: space-between;
  359. flex-wrap: wrap;
  360. .list {
  361. width: 48%;
  362. margin: 0 0 10px 0;
  363. .image {
  364. width: 100%;
  365. height: 100px;
  366. overflow: hidden;
  367. border-radius: 5px;
  368. }
  369. .name {
  370. font-size: 14px;
  371. color: var(--rgbfff);
  372. }
  373. .other {
  374. display: flex;
  375. color: var(--rgbfff);
  376. font-size: 12px;
  377. justify-content: space-between;
  378. }
  379. }
  380. }
  381. .btn {
  382. button {
  383. border-radius: 25px;
  384. background-color: var(--rgbfa4);
  385. color: var(--rgbfff);
  386. font-size: 14px;
  387. }
  388. }
  389. }
  390. .two_1 {
  391. .swiper {
  392. height: 200px;
  393. overflow: hidden;
  394. }
  395. .list {
  396. .image {
  397. width: 100%;
  398. height: 100%;
  399. }
  400. }
  401. }
  402. .two_2 {
  403. display: flex;
  404. flex-direction: row;
  405. flex-wrap: wrap;
  406. justify-content: space-between;
  407. .list {
  408. text-align: center;
  409. width: 18%;
  410. margin: 0 0 10px 0;
  411. .image {
  412. width: 100%;
  413. height: 64px;
  414. border-radius: 90%;
  415. margin: 0 0 5px 0;
  416. }
  417. .name {
  418. font-size: 12px;
  419. color: #ffffff;
  420. }
  421. }
  422. }
  423. }
  424. }
  425. .scroll-view {
  426. position: absolute;
  427. top: 0;
  428. left: 0;
  429. right: 0;
  430. bottom: 0;
  431. .list-scroll-view {
  432. display: flex;
  433. flex-direction: column;
  434. }
  435. }
  436. </style>