index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <view class="container">
  3. <image class="bg" src="@/static/images/bg.png" mode="aspectFill"></image>
  4. <!-- 顶部搜索栏 -->
  5. <view class="top-bar" :style="{marginTop: statusBarHeight}">
  6. <view class="search-row" @click="onSearch">
  7. <image src="@/static/images/new/search.png" mode=""></image>
  8. <text class="search-placeholder">搜索你感兴趣的内容</text>
  9. </view>
  10. <!-- <view class="top-actions">
  11. <text class="action-icon">⋯</text>
  12. <text class="action-icon scan">⊙</text>
  13. </view> -->
  14. </view>
  15. <!-- 应用标题与副标题 -->
  16. <view class="brand">
  17. <image src="/static/images/new/title.png" mode="widthFix"></image>
  18. <!-- <text class="brand-title">品质韶华·乐享朝夕</text>
  19. <text class="brand-subtitle">全国89%的中老年人都在用的兴趣内容社区</text> -->
  20. </view>
  21. <!-- 主题横幅 Banner -->
  22. <scroll-view scroll-y class="scroll-content" :show-scrollbar="false">
  23. <view class="banner" @click="onBannerClick">
  24. <!-- <image class="banner-bg" src="/static/images/new/banner.png" mode="aspectFill"></image> -->
  25. <view class="inner">
  26. <swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="3000"
  27. :duration="1000" indicator-color="rgba(255, 255, 255, 0.6)" indicator-active-color="#ffffff">
  28. <!-- <swiper-item class="swiper-item" v-for="(item,index) in advList" :key="index"
  29. @click="handleAdvClick(item)">
  30. <image :src="item.imageUrl" mode=""></image>
  31. </swiper-item> -->
  32. <swiper-item class="swiper-item">
  33. <image src="/static/images/new/banner.png" mode=""></image>
  34. </swiper-item>
  35. </swiper>
  36. </view>
  37. </view>
  38. <!-- 央广原乡行 视频推荐区 -->
  39. <view class="section video-section">
  40. <view class="section-head">
  41. <view class="section-title-wrap">
  42. <image class="play-icon" src="/static/images/new/bofang.png" mode=""></image>
  43. <image class="section-title" src="/static/images/new/yyx.png" ></image>
  44. </view>
  45. <view class="section-more" @click="onMoreVideos">查看更多
  46. <image src="/static/images/new/back.png" ></image>
  47. </view>
  48. </view>
  49. <view class="feature-video-card" >
  50. <scroll-view scroll-x class="tag-scroll" :show-scrollbar="false">
  51. <view
  52. v-for="(tag, idx) in videoTags"
  53. :key="idx"
  54. class="tag-item"
  55. :class="{ active: videoTagIndex === idx }"
  56. @click="videoTagIndex = idx"
  57. >
  58. <text>{{ tag }}</text>
  59. </view>
  60. </scroll-view>
  61. <view class="x-bc" @click="onWatchLive">
  62. <view class="fv-thumb">
  63. <image class="fv-img" src="/static/images/new/banner.png" mode="aspectFill"></image>
  64. <view class="live-tag">
  65. <text class="live-dot"></text>
  66. <text>直播中</text>
  67. </view>
  68. </view>
  69. <view class="fv-info">
  70. <text class="fv-title">《长寿恩施》</text>
  71. <text class="fv-desc">邀你一起看恩施美景,寻长寿秘密</text>
  72. <view class="btn-watch" @click.stop="onWatchLive">立即观看</view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 免费精品课 -->
  78. <view class="section course-section">
  79. <view class="section-head">
  80. <view class="section-title-wrap">
  81. <image class="play-icon" src="/static/images/new/bofang.png" mode=""></image>
  82. <image class="section-title" src="/static/images/new/jpk.png" ></image>
  83. </view>
  84. <view class="section-more" @click="onMoreCourses">更多课程
  85. <image src="/static/images/new/back.png" ></image>
  86. </view>
  87. </view>
  88. <view class="course-list">
  89. <view
  90. v-for="(course, idx) in courses"
  91. :key="idx"
  92. class="course-card"
  93. @click="onCourseClick(course)"
  94. >
  95. <view class="course-thumb">
  96. <image class="course-img" :src="course.cover || '/static/logo.jpg'" mode="aspectFill"></image>
  97. <!-- <text class="course-tag">{{ course.tag }}</text> -->
  98. </view>
  99. <view class="course-info">
  100. <text class="course-name">{{ course.name }}</text>
  101. <view class="x-end" style="justify-content: space-between;">
  102. <view class="course-meta">
  103. <image src="@/static/images/new/renshu.png"></image>
  104. <text class="meta-count">{{ course.views }}</text>
  105. </view>
  106. <view class="btn-watch2" @click.stop="onCourseClick(course)">立即观看</view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="bottom-placeholder"></view>
  113. </scroll-view>
  114. </view>
  115. </template>
  116. <script>
  117. export default {
  118. data() {
  119. return {
  120. statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
  121. videoTagIndex: 0,
  122. videoTags: ['恩施', '长白山', '吉林', '武当山', '张家界', '更多'],
  123. courses: [
  124. {
  125. name: '歌唱家刘金的《0基础金曲演唱速练课》',
  126. views: '9239',
  127. tag: '0基础 金曲演唱速练',
  128. cover: ''
  129. },
  130. {
  131. name: '资深编辑邹方斌讲《毛笔书法修心课》',
  132. views: '7.2w',
  133. tag: '毛笔书法修心课',
  134. cover: ''
  135. },
  136. {
  137. name: '张斌《元气八段锦》系列课',
  138. views: '5.9w',
  139. tag: '元气八段锦',
  140. cover: ''
  141. },
  142. {
  143. name: '翔哥精讲摄影课-手机微距拍摄技巧分享',
  144. views: '100w+',
  145. tag: '手机微距 拍摄技巧分享',
  146. cover: ''
  147. }
  148. ]
  149. }
  150. },
  151. onLoad() {},
  152. methods: {
  153. onSearch() {
  154. // 可跳转搜索页
  155. uni.showToast({ title: '搜索', icon: 'none' })
  156. },
  157. onBannerClick() {
  158. uni.navigateTo({ url: '/pages/index/course' })
  159. },
  160. onMoreVideos() {
  161. uni.navigateTo({ url: '/pages/index/video' })
  162. },
  163. onWatchLive() {
  164. uni.showToast({ title: '立即观看', icon: 'none' })
  165. // 可跳转:
  166. },
  167. onMoreCourses() {
  168. uni.navigateTo({ url: '/pages/index/course' })
  169. },
  170. onCourseClick(course) {
  171. uni.showToast({ title: course.name, icon: 'none' })
  172. // 可跳转课程详情: uni.navigateTo({ url: '/pages_course/videovip?id=' + course.id })
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .bg {
  179. width: 100%;
  180. height: 380rpx;
  181. position: absolute;
  182. top: 0;
  183. left: 0;
  184. z-index: 0;
  185. }
  186. .container {
  187. display: flex;
  188. flex-direction: column;
  189. min-height: 100vh;
  190. background: #F4F6F7;
  191. }
  192. /* 顶部搜索 */
  193. .top-bar {
  194. display: flex;
  195. align-items: center;
  196. padding: 24rpx 24rpx 30rpx;
  197. position: relative;
  198. }
  199. .search-row {
  200. flex: 1;
  201. display: flex;
  202. align-items: center;
  203. height: 76rpx;
  204. padding: 0 24rpx;
  205. background: rgba(255,255,255,0.5);
  206. border-radius: 38rpx;
  207. image{
  208. width: 44rpx;
  209. height: 44rpx;
  210. }
  211. }
  212. .search-placeholder {
  213. margin-left: 12rpx;
  214. font-size: 32rpx;
  215. color: rgba(0,0,0,0.25);
  216. }
  217. .top-actions {
  218. display: flex;
  219. align-items: center;
  220. margin-left: 20rpx;
  221. }
  222. .action-icon {
  223. font-size: 36rpx;
  224. color: #333;
  225. margin-right: 16rpx;
  226. }
  227. .action-icon.scan {
  228. font-size: 40rpx;
  229. }
  230. /* 品牌标题 */
  231. .brand {
  232. padding: 0 68rpx 30rpx;
  233. background: #fff;
  234. image{
  235. width: 100%;
  236. }
  237. }
  238. .brand-title {
  239. display: block;
  240. font-size: 40rpx;
  241. font-weight: bold;
  242. color: #333;
  243. margin-bottom: 8rpx;
  244. }
  245. .brand-subtitle {
  246. font-size: 24rpx;
  247. color: #999;
  248. }
  249. /* Banner */
  250. .banner {
  251. position: relative;
  252. height: 210rpx;
  253. margin: 0 24rpx 40rpx;
  254. border-radius: 16rpx;
  255. overflow: hidden;
  256. //background: linear-gradient(135deg, #87CEEB 0%, #E0F4FF 100%);
  257. .inner {
  258. width: 100%;
  259. height: 210rpx;
  260. border-radius: 10rpx;
  261. overflow: hidden;
  262. .swiper,
  263. .swiper-item,
  264. .swiper-item image {
  265. width: 100%;
  266. height: 100%;
  267. }
  268. }
  269. }
  270. .banner-bg {
  271. position: absolute;
  272. left: 0;
  273. top: 0;
  274. width: 100%;
  275. height: 100%;
  276. }
  277. .banner-overlay {
  278. position: absolute;
  279. left: 0;
  280. top: 0;
  281. width: 100%;
  282. height: 100%;
  283. display: flex;
  284. flex-direction: column;
  285. align-items: center;
  286. justify-content: center;
  287. background: rgba(0,0,0,0.15);
  288. }
  289. .banner-title {
  290. font-size: 48rpx;
  291. font-weight: bold;
  292. color: #fff;
  293. text-shadow: 0 2rpx 8rpx rgba(0,0,0,0.2);
  294. margin-bottom: 8rpx;
  295. }
  296. .banner-desc {
  297. font-size: 24rpx;
  298. color: rgba(255,255,255,0.95);
  299. }
  300. /* 滚动内容区 */
  301. .scroll-content {
  302. flex: 1;
  303. height: 0;
  304. }
  305. .section {
  306. padding: 0 24rpx 32rpx;
  307. }
  308. .section-head {
  309. display: flex;
  310. align-items: center;
  311. justify-content: space-between;
  312. margin-bottom: 20rpx;
  313. }
  314. .section-title {
  315. width: 226rpx;
  316. height: 36rpx;
  317. }
  318. .section-title-wrap {
  319. display: flex;
  320. align-items: center;
  321. }
  322. .play-icon {
  323. width: 36rpx;
  324. height: 36rpx;
  325. margin-right: 10rpx;
  326. }
  327. .section-more {
  328. font-size: 26rpx;
  329. color: #999;
  330. image{
  331. width: 16rpx;
  332. height: 20rpx;
  333. }
  334. }
  335. /* 横向标签 */
  336. .tag-scroll {
  337. white-space: nowrap;
  338. margin-bottom: 20rpx;
  339. }
  340. .tag-item {
  341. display: inline-block;
  342. padding: 6rpx 24rpx;
  343. margin-right: 24rpx;
  344. border-radius: 10rpx;
  345. background: rgba(255,255,255,0.5);
  346. }
  347. .tag-item text {
  348. font-family: PingFangSC, PingFang SC;
  349. font-weight: 400;
  350. font-size: 36rpx;
  351. color: #FFFFFF;
  352. }
  353. .tag-item.active {
  354. background: linear-gradient( 135deg, #FF5267 0%, #FF233C 100%);
  355. }
  356. .tag-item.active text {
  357. color: #fff;
  358. }
  359. /* 特色视频卡片 */
  360. .feature-video-card {
  361. display: flex;
  362. //align-items: center;
  363. flex-direction: column;
  364. background: linear-gradient( 135deg, #5F111A 0%, #37050B 100%);
  365. border-radius: 30rpx;
  366. overflow: hidden;
  367. padding: 30rpx 20rpx;
  368. }
  369. .fv-thumb {
  370. position: relative;
  371. width: 360rpx;
  372. height: 240rpx;
  373. border-radius: 20rpx;
  374. overflow: hidden;
  375. margin-right: 20rpx;
  376. }
  377. .fv-img {
  378. width: 100%;
  379. height: 100%;
  380. background: #e0e0e0;
  381. }
  382. .live-tag {
  383. position: absolute;
  384. left:0;
  385. top: 20rpx;
  386. display: flex;
  387. align-items: center;
  388. width: 130rpx;
  389. height: 44rpx;
  390. background: linear-gradient( 135deg, #FF5267 0%, #FF233C 100%);
  391. border-radius: 0rpx 8rpx 8rpx 0rpx;
  392. }
  393. .live-tag text {
  394. font-size: 28rpx;
  395. color: #fff;
  396. margin-left: 6rpx;
  397. }
  398. .live-dot {
  399. width: 12rpx;
  400. height: 12rpx;
  401. background: #fff;
  402. border-radius: 50%;
  403. animation: blink 1s infinite;
  404. }
  405. @keyframes blink {
  406. 50% { opacity: 0.5; }
  407. }
  408. .fv-info {
  409. flex: 1;
  410. //padding: 20rpx 24rpx;
  411. display: flex;
  412. flex-direction: column;
  413. justify-content: space-between;
  414. align-items: center;
  415. min-width: 0;
  416. }
  417. .fv-title {
  418. font-family: PingFangSC, PingFang SC;
  419. font-weight: 600;
  420. font-size: 36rpx;
  421. color: #FFFFFF;
  422. line-height: 50rpx;
  423. text-align:center;
  424. font-style: normal;
  425. margin-bottom: 8rpx;
  426. }
  427. .fv-desc {
  428. font-family: PingFangSC, PingFang SC;
  429. font-weight: 400;
  430. font-size: 32rpx;
  431. color: #FFFFFF;
  432. line-height: 44rpx;
  433. text-align: justify;
  434. overflow: hidden;
  435. text-overflow: ellipsis;
  436. display: -webkit-box;
  437. -webkit-line-clamp: 2;
  438. -webkit-box-orient: vertical;
  439. }
  440. /* 红色按钮 */
  441. .btn-watch {
  442. width: 188rpx;
  443. height: 64rpx;
  444. line-height: 64rpx;
  445. text-align: center;
  446. background: #FFFFFF;
  447. border-radius: 12rpx;
  448. margin-top: 28rpx;
  449. font-family: PingFangSC, PingFang SC;
  450. font-weight: 600;
  451. font-size: 32rpx;
  452. color: #3F040B;
  453. }
  454. .btn-watch2 {
  455. width: 168rpx;
  456. height: 64rpx;
  457. line-height: 64rpx;
  458. text-align: center;
  459. background: linear-gradient( 135deg, #FF5267 0%, #FF233C 100%);
  460. border-radius: 32rpx;
  461. font-family: PingFangSC, PingFang SC;
  462. font-weight: 600;
  463. font-size: 32rpx;
  464. color: #FFFFFF;
  465. }
  466. /* 课程列表 */
  467. .course-list {
  468. display: flex;
  469. flex-direction: column;
  470. gap: 24rpx;
  471. }
  472. .course-card {
  473. display: flex;
  474. background: #fff;
  475. border-radius: 20rpx;
  476. overflow: hidden;
  477. padding: 20rpx;
  478. }
  479. .course-thumb {
  480. position: relative;
  481. width: 296rpx;
  482. height: 222rpx;
  483. border-radius: 20rpx;
  484. overflow: hidden;
  485. flex-shrink: 0;
  486. }
  487. .course-img {
  488. width: 100%;
  489. height: 100%;
  490. background: #BB6D6D;
  491. }
  492. .course-tag {
  493. position: absolute;
  494. left: 0;
  495. bottom: 0;
  496. right: 0;
  497. padding: 8rpx 12rpx;
  498. background: linear-gradient(transparent, rgba(0,0,0,0.6));
  499. font-size: 22rpx;
  500. color: #fff;
  501. }
  502. .course-info {
  503. flex: 1;
  504. padding-left: 24rpx;
  505. // padding: 20rpx 24rpx;
  506. display: flex;
  507. flex-direction: column;
  508. justify-content: space-between;
  509. min-width: 0;
  510. }
  511. .course-name {
  512. font-family: PingFangSC, PingFang SC;
  513. font-weight: 600;
  514. font-size: 36rpx;
  515. color: #222222;
  516. line-height: 50rpx;
  517. text-align: justify;
  518. overflow: hidden;
  519. text-overflow: ellipsis;
  520. display: -webkit-box;
  521. -webkit-line-clamp: 2;
  522. -webkit-box-orient: vertical;
  523. }
  524. .course-meta {
  525. display: flex;
  526. align-items: center;
  527. image{
  528. width: 30rpx;
  529. height: 30rpx;
  530. }
  531. }
  532. .meta-icon {
  533. font-size: 24rpx;
  534. margin-right: 6rpx;
  535. color: #999;
  536. }
  537. .meta-count {
  538. margin-left: 10rpx;
  539. font-family: PingFangSC, PingFang SC;
  540. font-weight: 400;
  541. font-size: 32rpx;
  542. color: #666666;
  543. }
  544. /* 底部占位(为全局 tabBar 留出空间) */
  545. .bottom-placeholder {
  546. height: 120rpx;
  547. }
  548. </style>