index.vue 10 KB

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