index.vue 10.0 KB

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