drama.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view class="drama-page">
  3. <!-- 状态栏占位 -->
  4. <view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
  5. <!-- 顶部导航栏 -->
  6. <view class="nav-bar">
  7. <view class="nav-back" @click="handleBack">
  8. <image class="w64 h64" src="@/static/images/enter/back_white_icon24.png"></image>
  9. </view>
  10. <view class="nav-title">短剧</view>
  11. <view class="nav-refresh">
  12. <image class="w48 h48" src="@/static/images/enter/share_icom24.png"></image>
  13. </view>
  14. </view>
  15. <!-- 页面内容 -->
  16. <scroll-view class="page-content" scroll-y>
  17. <!-- 热门短剧 -->
  18. <view class="section">
  19. <view class="section-header">
  20. <view class="section-title">热门短剧</view>
  21. <view class="clear-history" @click="handleRefresh">
  22. <image class="w32 h32" src="@/static/images/enter/refresh_icon16.png"></image>
  23. <text class="clear-text">换一换</text>
  24. </view>
  25. </view>
  26. <scroll-view class="drama-scroll" scroll-x>
  27. <view class="drama-list">
  28. <view
  29. class="drama-card large"
  30. v-for="(drama, index) in popularList"
  31. :key="index"
  32. @click="handleDramaClick(drama)"
  33. >
  34. <view class="card-image-wrapper">
  35. <image class="card-image" :src="drama.image" mode="aspectFill"></image>
  36. <view class="card-badge" :class="drama.badgeType">
  37. {{ drama.badge }}
  38. </view>
  39. <view class="card-overlay">
  40. <view class="overlay-title">{{ drama.title }}</view>
  41. <view class="overlay-followers" v-if="drama.followers">
  42. {{ drama.followers }}人在追
  43. </view>
  44. </view>
  45. </view>
  46. <view class="card-info">
  47. <view class="info-title">{{ drama.title }}</view>
  48. <view class="info-episode">{{ drama.episode }}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </scroll-view>
  53. </view>
  54. <!-- 历史观看 -->
  55. <view class="section">
  56. <view class="section-header">
  57. <view class="section-title">历史观看</view>
  58. <view class="clear-history" @click="handleClearHistory">
  59. <image class="w32 h32" src="@/static/images/enter/delete_icon16.png"></image>
  60. <text class="clear-text">清空历史</text>
  61. </view>
  62. </view>
  63. <scroll-view class="drama-scroll" scroll-x>
  64. <view class="drama-list">
  65. <view
  66. class="drama-card small"
  67. v-for="(item, index) in historyList"
  68. :key="index"
  69. @click="handleHistoryClick(item)"
  70. >
  71. <view class="card-image-wrapper">
  72. <image class="card-image" :src="item.image" mode="aspectFill"></image>
  73. </view>
  74. <view class="card-info">
  75. <view class="info-title">{{ item.title }}</view>
  76. <view class="info-episode">{{ item.episode }}</view>
  77. <view class="info-progress">
  78. <u-icon name="phone" size="24" color="#999999"></u-icon>
  79. <text class="progress-text">观看至{{ item.progress }}%</text>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </scroll-view>
  85. </view>
  86. <!-- 精选 -->
  87. <view class="section">
  88. <view class="section-header">
  89. <view class="section-title">精选</view>
  90. </view>
  91. <scroll-view class="drama-scroll" scroll-x>
  92. <view class="drama-list">
  93. <view
  94. class="drama-card large"
  95. v-for="(drama, index) in featuredList"
  96. :key="index"
  97. @click="handleDramaClick(drama)"
  98. >
  99. <view class="card-image-wrapper">
  100. <image class="card-image" :src="drama.image" mode="aspectFill"></image>
  101. <view class="card-cast" v-if="drama.cast">
  102. {{ drama.cast }}
  103. </view>
  104. <view class="card-overlay">
  105. <view class="overlay-title">{{ drama.title }}</view>
  106. <view class="overlay-followers" v-if="drama.followers">
  107. {{ drama.followers }}人在追
  108. </view>
  109. </view>
  110. </view>
  111. <view class="card-info">
  112. <view class="info-title">{{ drama.title }}</view>
  113. <view class="info-episode">{{ drama.episode }}</view>
  114. </view>
  115. </view>
  116. </view>
  117. </scroll-view>
  118. </view>
  119. <!-- 底部安全区域 -->
  120. <view class="safe-area-bottom" :style="{ height: safeAreaBottom + 'px' }"></view>
  121. </scroll-view>
  122. </view>
  123. </template>
  124. <script>
  125. export default {
  126. data() {
  127. return {
  128. statusBarHeight: 0,
  129. safeAreaBottom: 0,
  130. popularList: [
  131. {
  132. id: 1,
  133. title: '如果海葵会恋爱',
  134. episode: '完结·全50集',
  135. image: '/static/image/default/drama1.jpg',
  136. badge: '新剧',
  137. badgeType: 'badge-new',
  138. followers: '41.9万'
  139. },
  140. {
  141. id: 2,
  142. title: '穿成恶婆婆后 我成了全家顶梁柱',
  143. episode: '完结·全50集',
  144. image: '/static/image/default/drama2.jpg',
  145. badge: '爆剧',
  146. badgeType: 'badge-hot',
  147. followers: '41.9万'
  148. },
  149. {
  150. id: 3,
  151. title: '朕的喵妃是戏精',
  152. episode: '完结·全50集',
  153. image: '/static/image/default/drama3.jpg',
  154. badge: '新剧',
  155. badgeType: 'badge-new',
  156. followers: '41.9万'
  157. }
  158. ],
  159. historyList: [
  160. {
  161. id: 1,
  162. title: '海棠瘦尽春未晚',
  163. episode: '第2集',
  164. image: '/static/image/default/drama1.jpg',
  165. progress: 3
  166. },
  167. {
  168. id: 2,
  169. title: '穿成恶婆婆',
  170. episode: '第2集',
  171. image: '/static/image/default/drama2.jpg',
  172. progress: 3
  173. }
  174. ],
  175. featuredList: [
  176. {
  177. id: 1,
  178. title: '海棠瘦尽春未晚',
  179. episode: '完结·全50集',
  180. image: '/static/image/default/drama4.jpg',
  181. cast: '宋宇欣 * 苏洛卿, 洪乔 * 苏洛卿, 可谦 饰 装时宴'
  182. },
  183. {
  184. id: 2,
  185. title: '如果海葵会恋爱',
  186. episode: '完结·全50集',
  187. image: '/static/image/default/drama1.jpg',
  188. followers: '41.9万'
  189. }
  190. ]
  191. }
  192. },
  193. onLoad() {
  194. this.getSystemInfo();
  195. },
  196. methods: {
  197. getSystemInfo() {
  198. const systemInfo = uni.getSystemInfoSync();
  199. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  200. if (systemInfo.safeArea) {
  201. this.safeAreaBottom = systemInfo.screenHeight - systemInfo.safeArea.bottom;
  202. }
  203. },
  204. handleBack() {
  205. uni.navigateBack();
  206. },
  207. handleRefresh() {
  208. uni.showToast({
  209. title: '换一换',
  210. icon: 'none'
  211. });
  212. },
  213. handleDramaClick(drama) {
  214. uni.showToast({
  215. title: `打开${drama.title}`,
  216. icon: 'none'
  217. });
  218. },
  219. handleHistoryClick(item) {
  220. uni.showToast({
  221. title: `继续观看${item.title}`,
  222. icon: 'none'
  223. });
  224. },
  225. handleClearHistory() {
  226. uni.showModal({
  227. title: '提示',
  228. content: '确定要清空历史记录吗?',
  229. success: (res) => {
  230. if (res.confirm) {
  231. this.historyList = [];
  232. uni.showToast({
  233. title: '已清空',
  234. icon: 'success'
  235. });
  236. }
  237. }
  238. });
  239. }
  240. }
  241. }
  242. </script>
  243. <style lang="scss" scoped>
  244. .drama-page {
  245. width: 100%;
  246. min-height: 100vh;
  247. background-color: #ffffff;
  248. display: flex;
  249. flex-direction: column;
  250. }
  251. .status-bar {
  252. width: 100%;
  253. background-color: #ffffff;
  254. }
  255. .nav-bar {
  256. width: 100%;
  257. height: 88rpx;
  258. background-color: #ffffff;
  259. display: flex;
  260. align-items: center;
  261. justify-content: space-between;
  262. padding: 0 30rpx;
  263. .nav-back {
  264. width: 60rpx;
  265. height: 60rpx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. }
  270. .nav-title {
  271. font-size: 36rpx;
  272. font-weight: 500;
  273. color: #333333;
  274. position: absolute;
  275. left: 50%;
  276. transform: translateX(-50%);
  277. }
  278. .nav-refresh {
  279. display: flex;
  280. align-items: center;
  281. gap: 8rpx;
  282. .refresh-text {
  283. font-size: 28rpx;
  284. color: #333333;
  285. }
  286. }
  287. }
  288. .page-content {
  289. flex: 1;
  290. width: 100%;
  291. }
  292. .section {
  293. width: 100%;
  294. margin-bottom: 40rpx;
  295. }
  296. .section-header {
  297. display: flex;
  298. align-items: center;
  299. justify-content: space-between;
  300. padding: 0 30rpx;
  301. margin-bottom: 20rpx;
  302. }
  303. .section-title {
  304. font-size: 36rpx;
  305. font-weight: 500;
  306. color: #333333;
  307. //padding: 0 30rpx;
  308. margin-bottom: 20rpx;
  309. }
  310. .clear-history {
  311. display: flex;
  312. align-items: center;
  313. gap: 8rpx;
  314. .clear-text {
  315. font-size: 28rpx;
  316. color: #999999;
  317. }
  318. }
  319. .drama-scroll {
  320. width: 100%;
  321. white-space: nowrap;
  322. }
  323. .drama-list {
  324. display: flex;
  325. padding: 0 30rpx;
  326. gap: 20rpx;
  327. }
  328. .drama-card {
  329. flex-shrink: 0;
  330. background-color: #ffffff;
  331. border-radius: 12rpx;
  332. overflow: hidden;
  333. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  334. &.large {
  335. width: 480rpx;
  336. }
  337. &.small {
  338. width: 320rpx;
  339. }
  340. }
  341. .card-image-wrapper {
  342. width: 100%;
  343. position: relative;
  344. .drama-card.large & {
  345. height: 640rpx;
  346. }
  347. .drama-card.small & {
  348. height: 400rpx;
  349. }
  350. }
  351. .card-image {
  352. width: 100%;
  353. height: 100%;
  354. background-color: #f0f0f0;
  355. }
  356. .card-badge {
  357. position: absolute;
  358. top: 16rpx;
  359. right: 16rpx;
  360. padding: 6rpx 16rpx;
  361. border-radius: 20rpx;
  362. font-size: 22rpx;
  363. font-weight: 500;
  364. color: #ffffff;
  365. z-index: 2;
  366. &.badge-new {
  367. background-color: #27AE60;
  368. }
  369. &.badge-hot {
  370. background-color: #FF4757;
  371. }
  372. }
  373. .card-cast {
  374. position: absolute;
  375. top: 16rpx;
  376. left: 16rpx;
  377. background-color: rgba(0, 0, 0, 0.5);
  378. color: #ffffff;
  379. padding: 8rpx 12rpx;
  380. border-radius: 8rpx;
  381. font-size: 20rpx;
  382. z-index: 2;
  383. max-width: 60%;
  384. overflow: hidden;
  385. text-overflow: ellipsis;
  386. white-space: nowrap;
  387. }
  388. .card-overlay {
  389. position: absolute;
  390. bottom: 0;
  391. left: 0;
  392. right: 0;
  393. padding: 24rpx;
  394. background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  395. }
  396. .overlay-title {
  397. font-size: 38rpx;
  398. font-weight: bold;
  399. color: #ffffff;
  400. margin-bottom: 8rpx;
  401. text-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.5);
  402. overflow: hidden;
  403. text-overflow: ellipsis;
  404. white-space: nowrap;
  405. line-height: 1.3;
  406. }
  407. .overlay-followers {
  408. font-size: 24rpx;
  409. color: #ffffff;
  410. text-shadow: 1rpx 1rpx 2rpx rgba(0, 0, 0, 0.5);
  411. }
  412. .card-info {
  413. padding: 20rpx;
  414. }
  415. .info-title {
  416. font-size: 28rpx;
  417. font-weight: 600;
  418. color: #333333;
  419. margin-bottom: 8rpx;
  420. overflow: hidden;
  421. text-overflow: ellipsis;
  422. white-space: nowrap;
  423. }
  424. .info-episode {
  425. font-size: 24rpx;
  426. color: #999999;
  427. margin-bottom: 8rpx;
  428. }
  429. .info-progress {
  430. display: flex;
  431. align-items: center;
  432. gap: 8rpx;
  433. .progress-text {
  434. font-size: 22rpx;
  435. color: #999999;
  436. }
  437. }
  438. .safe-area-bottom {
  439. width: 100%;
  440. height: 40rpx;
  441. }
  442. </style>