index.wxss 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. /* pages/index/index.wxss */
  2. page {
  3. padding: 0;
  4. margin: 0;
  5. }
  6. .container {
  7. min-height: 100vh;
  8. background: linear-gradient(180deg, #f8f9ff 0%, #f5f5f5 100%);
  9. padding-bottom: 20rpx;
  10. padding-top: 0;
  11. margin-top: 0;
  12. }
  13. /* 轮播图区域 */
  14. .swiper-section {
  15. width: 100%;
  16. height: 400rpx;
  17. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  18. position: relative;
  19. overflow: hidden;
  20. padding-top: 0;
  21. transition: margin-top 0.3s ease;
  22. }
  23. .swiper {
  24. width: 100%;
  25. height: 100%;
  26. }
  27. .swiper-item {
  28. width: 100%;
  29. height: 100%;
  30. position: relative;
  31. overflow: hidden;
  32. }
  33. .swiper-image {
  34. width: 100%;
  35. height: 100%;
  36. opacity: 0.7;
  37. }
  38. .swiper-content {
  39. position: absolute;
  40. bottom: 0;
  41. left: 0;
  42. right: 0;
  43. padding: 40rpx 30rpx 30rpx;
  44. background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
  45. color: #fff;
  46. }
  47. .swiper-title {
  48. font-size: 36rpx;
  49. font-weight: 600;
  50. margin-bottom: 12rpx;
  51. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.3);
  52. overflow: hidden;
  53. text-overflow: ellipsis;
  54. white-space: nowrap;
  55. }
  56. .swiper-author {
  57. font-size: 26rpx;
  58. opacity: 0.9;
  59. text-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.3);
  60. overflow: hidden;
  61. text-overflow: ellipsis;
  62. white-space: nowrap;
  63. }
  64. .search-bar {
  65. background: #fff;
  66. padding: 20rpx 30rpx 20rpx;
  67. position: fixed;
  68. top: 0;
  69. left: 0;
  70. right: 0;
  71. z-index: 1000;
  72. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
  73. padding-top: calc(20rpx + env(safe-area-inset-top));
  74. }
  75. .search-box {
  76. display: flex;
  77. align-items: center;
  78. background: linear-gradient(135deg, #f5f5f5 0%, #f0f0f0 100%);
  79. border-radius: 50rpx;
  80. padding: 22rpx 32rpx;
  81. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
  82. transition: all 0.3s ease;
  83. border: 2rpx solid transparent;
  84. }
  85. .search-box:active {
  86. transform: scale(0.98);
  87. box-shadow: 0 2rpx 12rpx rgba(102, 126, 234, 0.2);
  88. border-color: #667eea;
  89. }
  90. .search-placeholder {
  91. margin-left: 12rpx;
  92. font-size: 28rpx;
  93. color: #999;
  94. flex: 1;
  95. }
  96. .search-input-box {
  97. display: flex;
  98. align-items: center;
  99. background: rgba(255, 255, 255, 0.98);
  100. padding: 20rpx 30rpx;
  101. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
  102. position: fixed;
  103. top: calc(100rpx + env(safe-area-inset-top));
  104. left: 0;
  105. right: 0;
  106. z-index: 999;
  107. }
  108. .search-input {
  109. flex: 1;
  110. height: 64rpx;
  111. padding: 0 24rpx;
  112. background: #f5f5f5;
  113. border-radius: 32rpx;
  114. font-size: 28rpx;
  115. border: 2rpx solid transparent;
  116. transition: all 0.3s ease;
  117. }
  118. .search-input:focus {
  119. border-color: #667eea;
  120. background: #fff;
  121. }
  122. .search-cancel {
  123. margin-left: 20rpx;
  124. font-size: 28rpx;
  125. color: #667eea;
  126. font-weight: 500;
  127. padding: 8rpx 16rpx;
  128. }
  129. .type-tabs {
  130. display: flex;
  131. background: #fff;
  132. padding: 24rpx 30rpx;
  133. border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
  134. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  135. }
  136. .type-tab {
  137. margin-right: 48rpx;
  138. font-size: 30rpx;
  139. color: #666;
  140. padding: 12rpx 0;
  141. position: relative;
  142. font-weight: 500;
  143. transition: all 0.3s ease;
  144. }
  145. .type-tab.active {
  146. color: #667eea;
  147. font-weight: 600;
  148. }
  149. .type-tab.active::after {
  150. content: '';
  151. position: absolute;
  152. bottom: 0;
  153. left: 0;
  154. right: 0;
  155. height: 6rpx;
  156. background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  157. border-radius: 3rpx;
  158. animation: slideIn 0.3s ease;
  159. }
  160. @keyframes slideIn {
  161. from {
  162. transform: scaleX(0);
  163. }
  164. to {
  165. transform: scaleX(1);
  166. }
  167. }
  168. .category-scroll {
  169. white-space: nowrap;
  170. background: #fff;
  171. padding: 24rpx 0;
  172. border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
  173. }
  174. .category-list {
  175. display: inline-flex;
  176. padding: 0 30rpx;
  177. gap: 20rpx;
  178. }
  179. .category-item {
  180. display: inline-block;
  181. padding: 12rpx 32rpx;
  182. font-size: 26rpx;
  183. color: #666;
  184. background: linear-gradient(135deg, #f5f5f5 0%, #f0f0f0 100%);
  185. border-radius: 32rpx;
  186. font-weight: 500;
  187. transition: all 0.3s ease;
  188. white-space: nowrap;
  189. border: 2rpx solid transparent;
  190. }
  191. .category-item.active {
  192. color: #fff;
  193. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  194. box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.3);
  195. transform: scale(1.05);
  196. border-color: rgba(255, 255, 255, 0.3);
  197. }
  198. /* 今日推荐区域 */
  199. .recommended-section {
  200. background: #fff;
  201. margin: 24rpx 0;
  202. border-radius: 0;
  203. padding: 30rpx 20rpx;
  204. box-shadow: 0 4rpx 20rpx rgba(102, 126, 234, 0.08);
  205. width: 100%;
  206. box-sizing: border-box;
  207. }
  208. .section-header {
  209. display: flex;
  210. justify-content: space-between;
  211. align-items: center;
  212. margin-bottom: 24rpx;
  213. }
  214. .section-title {
  215. font-size: 32rpx;
  216. font-weight: 600;
  217. color: #1a1a1a;
  218. }
  219. .section-more {
  220. font-size: 26rpx;
  221. color: #999;
  222. }
  223. .recommended-grid {
  224. display: flex;
  225. flex-wrap: wrap;
  226. gap: 20rpx;
  227. }
  228. .recommended-item {
  229. flex: 0 0 calc(50% - 10rpx); /* 每行2个,默认 */
  230. display: flex;
  231. flex-direction: column;
  232. align-items: center;
  233. transition: transform 0.3s ease;
  234. }
  235. .recommended-item:active {
  236. transform: scale(0.95);
  237. }
  238. .recommended-cover-wrapper {
  239. width: 100%;
  240. aspect-ratio: 3/4;
  241. border-radius: 12rpx;
  242. overflow: hidden;
  243. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
  244. margin-bottom: 12rpx;
  245. background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  246. }
  247. .recommended-cover {
  248. width: 100%;
  249. height: 100%;
  250. transition: transform 0.3s ease;
  251. }
  252. .recommended-item:active .recommended-cover {
  253. transform: scale(1.05);
  254. }
  255. .recommended-cover-placeholder {
  256. width: 100%;
  257. height: 100%;
  258. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  259. display: flex;
  260. align-items: center;
  261. justify-content: center;
  262. padding: 12rpx;
  263. box-sizing: border-box;
  264. }
  265. .recommended-cover-text {
  266. color: #fff;
  267. font-size: 20rpx;
  268. font-weight: 500;
  269. text-align: center;
  270. overflow: hidden;
  271. text-overflow: ellipsis;
  272. display: -webkit-box;
  273. -webkit-line-clamp: 2;
  274. -webkit-box-orient: vertical;
  275. line-height: 1.4;
  276. }
  277. .recommended-title {
  278. font-size: 24rpx;
  279. color: #333;
  280. font-weight: 500;
  281. text-align: center;
  282. overflow: hidden;
  283. text-overflow: ellipsis;
  284. white-space: nowrap;
  285. width: 100%;
  286. line-height: 1.4;
  287. }
  288. /* 每行3个的样式 */
  289. .recommended-grid.columns-3 .recommended-item {
  290. flex: 0 0 calc(33.333% - 14rpx);
  291. }
  292. .content-list {
  293. padding: 30rpx 24rpx;
  294. }
  295. .content-item {
  296. display: flex;
  297. background: #fff;
  298. border-radius: 20rpx;
  299. padding: 32rpx;
  300. margin-bottom: 24rpx;
  301. box-shadow: 0 4rpx 20rpx rgba(102, 126, 234, 0.08);
  302. transition: all 0.3s ease;
  303. position: relative;
  304. overflow: hidden;
  305. }
  306. .content-item::before {
  307. content: '';
  308. position: absolute;
  309. top: 0;
  310. left: 0;
  311. width: 6rpx;
  312. height: 100%;
  313. background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  314. opacity: 0;
  315. transition: opacity 0.3s ease;
  316. }
  317. .content-item:active {
  318. transform: translateY(-4rpx);
  319. box-shadow: 0 8rpx 28rpx rgba(102, 126, 234, 0.15);
  320. }
  321. .content-item:active::before {
  322. opacity: 1;
  323. }
  324. .cover-wrapper {
  325. width: 180rpx;
  326. height: 240rpx;
  327. margin-right: 32rpx;
  328. flex-shrink: 0;
  329. border-radius: 12rpx;
  330. overflow: hidden;
  331. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
  332. }
  333. .cover {
  334. width: 100%;
  335. height: 100%;
  336. transition: transform 0.3s ease;
  337. }
  338. .content-item:active .cover {
  339. transform: scale(1.05);
  340. }
  341. .cover-placeholder {
  342. width: 100%;
  343. height: 100%;
  344. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  345. border-radius: 12rpx;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. padding: 12rpx;
  350. box-sizing: border-box;
  351. }
  352. .cover-text {
  353. color: #fff;
  354. font-size: 22rpx;
  355. font-weight: 500;
  356. text-align: center;
  357. overflow: hidden;
  358. text-overflow: ellipsis;
  359. display: -webkit-box;
  360. -webkit-line-clamp: 3;
  361. -webkit-box-orient: vertical;
  362. line-height: 1.4;
  363. }
  364. .content-info {
  365. flex: 1;
  366. display: flex;
  367. flex-direction: column;
  368. justify-content: space-between;
  369. min-width: 0;
  370. }
  371. .title {
  372. font-size: 34rpx;
  373. font-weight: 600;
  374. color: #1a1a1a;
  375. margin-bottom: 12rpx;
  376. overflow: hidden;
  377. text-overflow: ellipsis;
  378. white-space: nowrap;
  379. line-height: 1.4;
  380. }
  381. .author {
  382. font-size: 26rpx;
  383. color: #8a8a8a;
  384. margin-bottom: 14rpx;
  385. font-weight: 500;
  386. }
  387. .meta {
  388. display: flex;
  389. align-items: center;
  390. margin-bottom: 16rpx;
  391. flex-wrap: wrap;
  392. gap: 12rpx;
  393. }
  394. .meta text {
  395. font-size: 22rpx;
  396. color: #667eea;
  397. padding: 6rpx 14rpx;
  398. background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  399. border-radius: 12rpx;
  400. font-weight: 500;
  401. }
  402. .description {
  403. font-size: 26rpx;
  404. color: #666;
  405. line-height: 1.8;
  406. overflow: hidden;
  407. text-overflow: ellipsis;
  408. display: -webkit-box;
  409. -webkit-line-clamp: 2;
  410. -webkit-box-orient: vertical;
  411. }
  412. .loading {
  413. text-align: center;
  414. padding: 60rpx 40rpx;
  415. display: flex;
  416. flex-direction: column;
  417. align-items: center;
  418. }
  419. .loading text {
  420. font-size: 26rpx;
  421. color: #999;
  422. margin-top: 20rpx;
  423. }
  424. .loading::before {
  425. content: '';
  426. width: 40rpx;
  427. height: 40rpx;
  428. border: 4rpx solid #f0f0f0;
  429. border-top-color: #667eea;
  430. border-radius: 50%;
  431. animation: spin 0.8s linear infinite;
  432. }
  433. @keyframes spin {
  434. 0% {
  435. transform: rotate(0deg);
  436. }
  437. 100% {
  438. transform: rotate(360deg);
  439. }
  440. }
  441. .no-more {
  442. text-align: center;
  443. padding: 40rpx;
  444. font-size: 26rpx;
  445. color: #999;
  446. position: relative;
  447. }
  448. .no-more::before,
  449. .no-more::after {
  450. content: '';
  451. position: absolute;
  452. top: 50%;
  453. width: 80rpx;
  454. height: 1rpx;
  455. background: #e0e0e0;
  456. }
  457. .no-more::before {
  458. left: 20%;
  459. }
  460. .no-more::after {
  461. right: 20%;
  462. }
  463. .empty {
  464. text-align: center;
  465. padding: 200rpx 40rpx;
  466. display: flex;
  467. flex-direction: column;
  468. align-items: center;
  469. }
  470. .empty::before {
  471. content: '📖';
  472. font-size: 120rpx;
  473. margin-bottom: 30rpx;
  474. opacity: 0.3;
  475. }
  476. .empty text {
  477. font-size: 28rpx;
  478. color: #999;
  479. line-height: 1.6;
  480. }