index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  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" @tap="toWeb(item)">
  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" @tap="toWeb(item)">
  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: '1',
  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: '1',
  254. is_use: '0'
  255. });
  256. if (res.errcode == '0') {
  257. that.$set(that, `linkList`, res.data)
  258. }
  259. },
  260. toWeb(e) {
  261. const that = this;
  262. let system = that.$config.system
  263. if (system.uniPlatform == 'app') {
  264. plus.runtime.openURL(e.web_url)
  265. } else if (system.uniPlatform == 'mp-weixin') {
  266. uni.showToast({
  267. title: '小程序无法打开链接,请打开app进行跳转',
  268. icon: "none"
  269. })
  270. }
  271. },
  272. // 跳转页面
  273. toPath(e) {
  274. let url = `/${e.route}`;
  275. if (e.type == '0') uni.navigateTo({
  276. url
  277. })
  278. else if (e.type == '1') uni.redirectTo({
  279. url
  280. })
  281. else if (e.type == '2') uni.reLaunch({
  282. url
  283. })
  284. else if (e.type == '3') uni.switchTab({
  285. url
  286. })
  287. }
  288. },
  289. };
  290. </script>
  291. <style lang="scss">
  292. .main {
  293. background-color: var(--rgb000);
  294. display: flex;
  295. flex-direction: column;
  296. width: 100vw;
  297. height: 92vh;
  298. .one {
  299. background-color: var(--rgb111);
  300. display: flex;
  301. padding: 8px;
  302. .one_1 {
  303. flex-grow: 1;
  304. input {
  305. border: 1px solid var(--rgbf1f);
  306. height: 30px;
  307. border-radius: 2px;
  308. padding: 0 5px;
  309. font-size: 12px;
  310. }
  311. }
  312. .one_2 {
  313. button {
  314. height: 100%;
  315. background-color: var(--rgbfa4);
  316. color: var(--rgbfff);
  317. }
  318. }
  319. }
  320. .two {
  321. position: relative;
  322. flex-grow: 1;
  323. .two_0 {
  324. margin: 0 0 10px 0;
  325. padding: 0 8px;
  326. .top {
  327. margin: 0 0 10px 0;
  328. display: flex;
  329. padding: 5px 0;
  330. .top_1 {
  331. flex-grow: 1;
  332. span {
  333. color: var(--rgbfff);
  334. font-size: 20px;
  335. font-family: monospace;
  336. font-weight: bold;
  337. }
  338. }
  339. .top_2 {
  340. span {
  341. color: var(--rgbfff);
  342. font-size: 14px;
  343. }
  344. }
  345. }
  346. .info {
  347. margin: 0 0 10px 0;
  348. display: flex;
  349. justify-content: space-between;
  350. flex-wrap: wrap;
  351. .list {
  352. width: 48%;
  353. margin: 0 0 10px 0;
  354. .image {
  355. width: 100%;
  356. height: 100px;
  357. overflow: hidden;
  358. border-radius: 5px;
  359. }
  360. .name {
  361. font-size: 14px;
  362. color: var(--rgbfff);
  363. }
  364. .other {
  365. display: flex;
  366. color: var(--rgbfff);
  367. font-size: 12px;
  368. justify-content: space-between;
  369. }
  370. }
  371. }
  372. .btn {
  373. button {
  374. border-radius: 25px;
  375. background-color: var(--rgbfa4);
  376. color: var(--rgbfff);
  377. font-size: 14px;
  378. }
  379. }
  380. }
  381. .two_1 {
  382. .swiper {
  383. height: 200px;
  384. overflow: hidden;
  385. }
  386. .list {
  387. .image {
  388. width: 100%;
  389. height: 100%;
  390. }
  391. }
  392. }
  393. .two_2 {
  394. display: flex;
  395. flex-direction: row;
  396. flex-wrap: wrap;
  397. justify-content: space-between;
  398. .list {
  399. text-align: center;
  400. width: 18%;
  401. margin: 0 0 10px 0;
  402. .image {
  403. width: 100%;
  404. height: 64px;
  405. border-radius: 90%;
  406. margin: 0 0 5px 0;
  407. }
  408. .name {
  409. font-size: 12px;
  410. color: #ffffff;
  411. }
  412. }
  413. }
  414. }
  415. }
  416. .scroll-view {
  417. position: absolute;
  418. top: 0;
  419. left: 0;
  420. right: 0;
  421. bottom: 0;
  422. .list-scroll-view {
  423. display: flex;
  424. flex-direction: column;
  425. }
  426. }
  427. </style>