index.vue 12 KB

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