constellation.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  1. <template>
  2. <view class="constellation-page">
  3. <!-- 自定义导航栏 -->
  4. <view class="custom-nav">
  5. <view class="nav-left" @click="goBack">
  6. <text class="back-icon">←</text>
  7. </view>
  8. <view class="nav-title">星座卡片</view>
  9. <view class="nav-right"></view>
  10. </view>
  11. <!-- 生日选择区域 -->
  12. <view class="birthday-selection-section" v-if="!hasResult">
  13. <view class="selection-card">
  14. <view class="card-title">✨ 星座运势测算</view>
  15. <view class="card-subtitle">选择你的生日,查看专属星座运势</view>
  16. <!-- 生日选择器 -->
  17. <view class="birthday-picker-wrapper">
  18. <view class="picker-label">选择生日</view>
  19. <picker mode="date" :value="birthday" @change="onBirthdayChange" :start="startDate" :end="endDate">
  20. <view class="birthday-display">
  21. <text class="birthday-icon">📅</text>
  22. <text class="birthday-text">{{ birthdayDisplay }}</text>
  23. </view>
  24. </picker>
  25. </view>
  26. <!-- 星座显示 -->
  27. <view class="constellation-preview" v-if="currentConstellation">
  28. <view class="constellation-info">
  29. <text class="constellation-emoji">{{ currentConstellation.emoji }}</text>
  30. <text class="constellation-name">{{ currentConstellation.name }}</text>
  31. </view>
  32. <text class="constellation-desc">{{ currentConstellation.description }}</text>
  33. </view>
  34. <button class="submit-btn" @click="handleSubmit" :disabled="!birthday">
  35. 查看运势
  36. </button>
  37. </view>
  38. <!-- 装饰性星座图标 -->
  39. <view class="constellation-icons">
  40. <text class="constellation-icon" v-for="(constellation, index) in allConstellations" :key="index">
  41. {{ constellation.emoji }}
  42. </text>
  43. </view>
  44. </view>
  45. <!-- 运势结果 -->
  46. <view class="result-section" v-if="hasResult">
  47. <!-- 星座标题卡片 -->
  48. <view class="constellation-title-card">
  49. <view class="constellation-header">
  50. <view class="constellation-main">
  51. <text class="constellation-emoji-large">{{ currentConstellation.emoji }}</text>
  52. <view class="constellation-info-main">
  53. <text class="constellation-name-large">{{ currentConstellation.name }}</text>
  54. <text class="constellation-period">{{ currentConstellation.period }}</text>
  55. </view>
  56. </view>
  57. <view class="constellation-traits">
  58. <view class="trait-tag" v-for="(trait, index) in currentConstellation.traits" :key="index">
  59. {{ trait }}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 今日运势 -->
  65. <view class="fortune-section">
  66. <view class="section-title">🔮 今日运势</view>
  67. <view class="fortune-card">
  68. <view class="fortune-summary">
  69. <view class="fortune-score-wrapper">
  70. <text class="fortune-score">{{ todayFortune.overallScore }}</text>
  71. <text class="fortune-unit">分</text>
  72. </view>
  73. <view class="fortune-level" :style="{background: todayFortune.levelColor}">
  74. {{ todayFortune.level }}
  75. </view>
  76. </view>
  77. <view class="fortune-details">
  78. <view class="fortune-item" v-for="(item, index) in todayFortune.details" :key="index">
  79. <view class="fortune-item-header">
  80. <text class="fortune-item-icon">{{ item.icon }}</text>
  81. <text class="fortune-item-label">{{ item.label }}</text>
  82. </view>
  83. <view class="fortune-score-bar">
  84. <view class="score-bar">
  85. <view class="score-fill" :style="{width: item.score + '%', background: item.color}"></view>
  86. </view>
  87. <text class="score-text">{{ item.score }}%</text>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="fortune-advice">
  92. <text class="advice-label">💡 今日建议</text>
  93. <text class="advice-content">{{ todayFortune.advice }}</text>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 星座匹配 -->
  98. <view class="match-section">
  99. <view class="section-title">💕 星座匹配</view>
  100. <view class="match-card">
  101. <view class="match-best">
  102. <text class="match-category-title">最佳匹配</text>
  103. <view class="match-constellation-list">
  104. <view class="match-constellation-item best" v-for="(match, index) in constellationMatch.best" :key="index">
  105. <text class="match-emoji">{{ match.emoji }}</text>
  106. <text class="match-name">{{ match.name }}</text>
  107. <text class="match-score">{{ match.score }}%</text>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="match-good">
  112. <text class="match-category-title">不错匹配</text>
  113. <view class="match-constellation-list">
  114. <view class="match-constellation-item good" v-for="(match, index) in constellationMatch.good" :key="index">
  115. <text class="match-emoji">{{ match.emoji }}</text>
  116. <text class="match-name">{{ match.name }}</text>
  117. <text class="match-score">{{ match.score }}%</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 幸运元素 -->
  124. <view class="lucky-section">
  125. <view class="section-title">🍀 今日幸运</view>
  126. <view class="lucky-grid">
  127. <view class="lucky-item" v-for="(item, index) in luckyElements" :key="index">
  128. <view class="lucky-icon-wrapper" :style="{background: item.bgColor}">
  129. <text class="lucky-icon">{{ item.icon }}</text>
  130. </view>
  131. <text class="lucky-label">{{ item.label }}</text>
  132. <text class="lucky-value">{{ item.value }}</text>
  133. </view>
  134. </view>
  135. </view>
  136. <!-- 星座特质详解 -->
  137. <view class="traits-section">
  138. <view class="section-title">🌟 星座特质</view>
  139. <view class="traits-card">
  140. <view class="trait-detail" v-for="(trait, index) in constellationTraits" :key="index">
  141. <view class="trait-header">
  142. <text class="trait-icon">{{ trait.icon }}</text>
  143. <text class="trait-title">{{ trait.title }}</text>
  144. </view>
  145. <text class="trait-content">{{ trait.content }}</text>
  146. </view>
  147. </view>
  148. </view>
  149. <!-- 重新测算 -->
  150. <view class="retest-btn" @click="handleRetest">
  151. 重新测算
  152. </view>
  153. <!-- 数据来源说明 -->
  154. <view class="data-source" :class="{'api-source': isAPIData}">
  155. <text class="source-icon">{{ isAPIData ? '✓' : 'ℹ️' }}</text>
  156. <view class="source-content">
  157. <text class="source-text">数据来源:{{ dataSourceText }}</text>
  158. <text class="source-time">更新时间:{{ updateTime }}</text>
  159. </view>
  160. </view>
  161. <!-- 免责声明 -->
  162. <view class="disclaimer">
  163. <view class="disclaimer-title">⚠️ 免责声明</view>
  164. <view class="disclaimer-text">
  165. 本星座运势基于占星学理论和统计数据分析,仅供娱乐参考,不作为人生决策依据。
  166. 个人运势受多种因素影响,建议理性对待星座内容。
  167. 真正的幸福需要自己努力争取和创造。
  168. </view>
  169. </view>
  170. </view>
  171. <!-- 底部占位 -->
  172. <view class="bottom-placeholder"></view>
  173. </view>
  174. </template>
  175. <script>
  176. import { getConstellation } from '@/utils/util.js'
  177. import constellationUtil from '@/utils/constellation.js'
  178. export default {
  179. data() {
  180. return {
  181. // 生日相关
  182. birthday: uni.getStorageSync("userInfo").birthDate,
  183. birthdayDisplay: '请选择生日',
  184. startDate: '1950-01-01',
  185. endDate: '2010-12-31',
  186. // 星座相关
  187. currentConstellation: null,
  188. hasResult: false,
  189. updateTime: '',
  190. // 运势数据
  191. todayFortune: null,
  192. constellationMatch: null,
  193. luckyElements: [],
  194. constellationTraits: [],
  195. // 所有星座数据
  196. allConstellations: constellationUtil.getAllConstellations()
  197. }
  198. },
  199. computed: {
  200. // 是否使用API数据
  201. isAPIData() {
  202. return this.todayFortune?.source === 'tianapi'
  203. },
  204. // 数据来源文本
  205. dataSourceText() {
  206. if (this.isAPIData) {
  207. return '天行数据专业API'
  208. }
  209. return '星座占星学理论'
  210. }
  211. },
  212. onLoad() {
  213. this.initData()
  214. },
  215. methods: {
  216. initData() {
  217. // 设置更新时间
  218. const date = new Date()
  219. const year = date.getFullYear()
  220. const month = parseInt(date.getMonth() + 1)
  221. const day = parseInt(date.getDate())
  222. this.updateTime = `${year}年${month}月${day}日`
  223. },
  224. // 生日选择
  225. onBirthdayChange(e) {
  226. this.birthday = e.detail.value
  227. this.birthdayDisplay = this.formatBirthday(this.birthday)
  228. // 实时计算星座
  229. const constellationName = getConstellation(this.birthday)
  230. this.currentConstellation = this.allConstellations.find(c => c.name === constellationName)
  231. },
  232. // 格式化生日显示
  233. formatBirthday(birthday) {
  234. if (!birthday) return '请选择生日'
  235. const date = new Date(birthday)
  236. const month = date.getMonth() + 1
  237. const day = date.getDate()
  238. return `${month}月${day}日`
  239. },
  240. // 提交查看运势
  241. async handleSubmit() {
  242. if (!this.birthday) {
  243. uni.showToast({
  244. title: '请选择生日',
  245. icon: 'none'
  246. })
  247. return
  248. }
  249. // 显示加载中
  250. uni.showLoading({
  251. title: '运势分析中...',
  252. mask: true
  253. })
  254. try {
  255. // 生成运势数据
  256. await this.generateFortuneData()
  257. this.hasResult = true
  258. // 保存到本地存储
  259. uni.setStorageSync('constellationFortune', {
  260. birthday: this.birthday,
  261. constellation: this.currentConstellation,
  262. fortune: this.todayFortune,
  263. lastUpdate: new Date().getTime()
  264. })
  265. } catch (error) {
  266. uni.showToast({
  267. title: '分析异常,请重试',
  268. icon: 'none',
  269. duration: 2000
  270. })
  271. } finally {
  272. uni.hideLoading()
  273. }
  274. },
  275. // 生成运势数据
  276. async generateFortuneData() {
  277. try {
  278. // 获取星座运势(优先API,失败时使用本地数据)
  279. const fortuneData = await constellationUtil.getConstellationFortune(this.currentConstellation.name)
  280. // 转换数据格式为页面需要的格式
  281. this.todayFortune = {
  282. overallScore: fortuneData.overall || 80,
  283. level: fortuneData.level || '良好',
  284. levelColor: fortuneData.levelColor || 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)',
  285. details: [
  286. {
  287. label: '爱情运',
  288. icon: '💕',
  289. score: fortuneData.love || 75,
  290. color: 'linear-gradient(135deg, #E91E63 0%, #FF6B9D 100%)'
  291. },
  292. {
  293. label: '事业运',
  294. icon: '💼',
  295. score: fortuneData.career || 78,
  296. color: 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  297. },
  298. {
  299. label: '财运',
  300. icon: '💰',
  301. score: fortuneData.wealth || 72,
  302. color: 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  303. },
  304. {
  305. label: '健康运',
  306. icon: '🌿',
  307. score: fortuneData.health || 80,
  308. color: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  309. }
  310. ],
  311. advice: fortuneData.advice || '今天是美好的一天,保持积极心态!',
  312. source: fortuneData.source || 'local'
  313. }
  314. // 生成星座匹配
  315. this.constellationMatch = constellationUtil.generateConstellationMatch(this.currentConstellation.name)
  316. // 生成幸运元素
  317. this.luckyElements = constellationUtil.generateLuckyElements(this.currentConstellation.name)
  318. // 生成星座特质
  319. this.constellationTraits = constellationUtil.generateConstellationTraits(this.currentConstellation.name)
  320. } catch (error) {
  321. this.todayFortune = this.generateDefaultFortune()
  322. this.constellationMatch = { best: [], good: [] }
  323. this.luckyElements = []
  324. this.constellationTraits = []
  325. }
  326. },
  327. // 生成默认运势数据(异常情况下使用)
  328. generateDefaultFortune() {
  329. const scores = {
  330. overall: Math.floor(Math.random() * 30) + 70,
  331. love: Math.floor(Math.random() * 40) + 60,
  332. career: Math.floor(Math.random() * 40) + 60,
  333. wealth: Math.floor(Math.random() * 40) + 60,
  334. health: Math.floor(Math.random() * 40) + 60
  335. }
  336. const levels = ['一般', '良好', '极佳', '超棒']
  337. const levelColors = [
  338. 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)',
  339. 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)',
  340. 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)',
  341. 'linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%)'
  342. ]
  343. const levelIndex = Math.floor(scores.overall / 25)
  344. const level = levels[Math.min(levelIndex, levels.length - 1)]
  345. const levelColor = levelColors[Math.min(levelIndex, levelColors.length - 1)]
  346. const advices = [
  347. '今天是展现个人魅力的好时机,保持积极心态!',
  348. '适合与他人合作,团队协作能带来意想不到的收获。',
  349. '财运不错,但要理性消费,避免冲动购买。',
  350. '健康运势平稳,适量运动有助提升整体状态。',
  351. '感情方面有新的进展,单身者有机会遇到心仪对象。'
  352. ]
  353. return {
  354. overallScore: scores.overall,
  355. level: level,
  356. levelColor: levelColor,
  357. details: [
  358. {
  359. label: '爱情运',
  360. icon: '💕',
  361. score: scores.love,
  362. color: 'linear-gradient(135deg, #E91E63 0%, #FF6B9D 100%)'
  363. },
  364. {
  365. label: '事业运',
  366. icon: '💼',
  367. score: scores.career,
  368. color: 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  369. },
  370. {
  371. label: '财运',
  372. icon: '💰',
  373. score: scores.wealth,
  374. color: 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  375. },
  376. {
  377. label: '健康运',
  378. icon: '🌿',
  379. score: scores.health,
  380. color: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  381. }
  382. ],
  383. advice: advices[Math.floor(Math.random() * advices.length)],
  384. source: 'local'
  385. }
  386. },
  387. // 重新测算
  388. handleRetest() {
  389. this.hasResult = false
  390. this.birthday = ''
  391. this.birthdayDisplay = '请选择生日'
  392. this.currentConstellation = null
  393. this.todayFortune = null
  394. this.constellationMatch = null
  395. this.luckyElements = []
  396. this.constellationTraits = []
  397. },
  398. // 返回
  399. goBack() {
  400. uni.navigateBack({
  401. delta: 1
  402. })
  403. }
  404. }
  405. }
  406. </script>
  407. <style lang="scss" scoped>
  408. .constellation-page {
  409. min-height: 100vh;
  410. background: linear-gradient(180deg, #FFF9F9 0%, #FFFFFF 50%);
  411. padding-bottom: 40rpx;
  412. }
  413. /* 自定义导航栏 */
  414. .custom-nav {
  415. position: relative;
  416. display: flex;
  417. align-items: center;
  418. justify-content: space-between;
  419. height: 88rpx;
  420. padding: 0 30rpx;
  421. background-color: #FFFFFF;
  422. border-bottom: 1rpx solid #F0F0F0;
  423. .nav-left {
  424. width: 80rpx;
  425. .back-icon {
  426. font-size: 40rpx;
  427. color: #333333;
  428. }
  429. }
  430. .nav-title {
  431. position: absolute;
  432. left: 50%;
  433. transform: translateX(-50%);
  434. font-size: 34rpx;
  435. font-weight: 600;
  436. color: #333333;
  437. }
  438. .nav-right {
  439. width: 80rpx;
  440. }
  441. }
  442. /* 生日选择区域 */
  443. .birthday-selection-section {
  444. padding: 60rpx 30rpx;
  445. display: flex;
  446. flex-direction: column;
  447. align-items: center;
  448. .selection-card {
  449. width: 100%;
  450. background-color: #FFFFFF;
  451. border-radius: 30rpx;
  452. padding: 60rpx 40rpx;
  453. box-shadow: 0 8rpx 30rpx rgba(156, 39, 176, 0.1);
  454. text-align: center;
  455. .card-title {
  456. font-size: 40rpx;
  457. font-weight: bold;
  458. color: #333333;
  459. margin-bottom: 15rpx;
  460. }
  461. .card-subtitle {
  462. font-size: 26rpx;
  463. color: #999999;
  464. margin-bottom: 50rpx;
  465. }
  466. .birthday-picker-wrapper {
  467. margin-bottom: 30rpx;
  468. text-align: left;
  469. .picker-label {
  470. font-size: 28rpx;
  471. color: #666666;
  472. margin-bottom: 15rpx;
  473. }
  474. .birthday-display {
  475. display: flex;
  476. align-items: center;
  477. justify-content: center;
  478. background-color: #F8F8F8;
  479. border-radius: 20rpx;
  480. padding: 25rpx 30rpx;
  481. border: 2rpx solid #9C27B0;
  482. transition: all 0.3s;
  483. .birthday-icon {
  484. font-size: 40rpx;
  485. margin-right: 15rpx;
  486. }
  487. .birthday-text {
  488. font-size: 32rpx;
  489. color: #333333;
  490. font-weight: 500;
  491. }
  492. }
  493. &:active .birthday-display {
  494. background-color: #F3E5F5;
  495. transform: scale(0.98);
  496. }
  497. }
  498. .constellation-preview {
  499. background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
  500. border-radius: 20rpx;
  501. padding: 30rpx;
  502. margin-bottom: 30rpx;
  503. text-align: center;
  504. .constellation-info {
  505. display: flex;
  506. align-items: center;
  507. justify-content: center;
  508. margin-bottom: 15rpx;
  509. .constellation-emoji {
  510. font-size: 60rpx;
  511. margin-right: 15rpx;
  512. }
  513. .constellation-name {
  514. font-size: 36rpx;
  515. color: #9C27B0;
  516. font-weight: 600;
  517. }
  518. }
  519. .constellation-desc {
  520. font-size: 24rpx;
  521. color: #666666;
  522. }
  523. }
  524. .submit-btn {
  525. width: 100%;
  526. height: 90rpx;
  527. background: linear-gradient(135deg, #9C27B0 0%, #E1BEE7 100%);
  528. color: #FFFFFF;
  529. font-size: 32rpx;
  530. font-weight: 600;
  531. border-radius: 45rpx;
  532. border: none;
  533. box-shadow: 0 8rpx 20rpx rgba(156, 39, 176, 0.3);
  534. &:disabled {
  535. opacity: 0.5;
  536. }
  537. &:active:not(:disabled) {
  538. opacity: 0.9;
  539. }
  540. }
  541. }
  542. .constellation-icons {
  543. display: flex;
  544. flex-wrap: wrap;
  545. justify-content: center;
  546. gap: 20rpx;
  547. margin-top: 50rpx;
  548. opacity: 0.3;
  549. .constellation-icon {
  550. font-size: 48rpx;
  551. animation: float 3s ease-in-out infinite;
  552. &:nth-child(2n) {
  553. animation-delay: 0.5s;
  554. }
  555. &:nth-child(3n) {
  556. animation-delay: 1s;
  557. }
  558. }
  559. }
  560. }
  561. @keyframes float {
  562. 0%, 100% {
  563. transform: translateY(0);
  564. }
  565. 50% {
  566. transform: translateY(-10rpx);
  567. }
  568. }
  569. /* 结果区域 */
  570. .result-section {
  571. padding: 30rpx 25rpx 40rpx 25rpx;
  572. }
  573. /* 星座标题卡片 */
  574. .constellation-title-card {
  575. background: linear-gradient(135deg, #9C27B0 0%, #E1BEE7 100%);
  576. border-radius: 32rpx;
  577. padding: 50rpx 40rpx;
  578. text-align: center;
  579. box-shadow: 0 12rpx 40rpx rgba(156, 39, 176, 0.25);
  580. margin-bottom: 40rpx;
  581. .constellation-header {
  582. .constellation-main {
  583. display: flex;
  584. align-items: center;
  585. justify-content: center;
  586. margin-bottom: 30rpx;
  587. .constellation-emoji-large {
  588. font-size: 120rpx;
  589. margin-right: 30rpx;
  590. }
  591. .constellation-info-main {
  592. display: flex;
  593. flex-direction: column;
  594. align-items: flex-start;
  595. .constellation-name-large {
  596. font-size: 42rpx;
  597. font-weight: bold;
  598. color: #FFFFFF;
  599. margin-bottom: 10rpx;
  600. }
  601. .constellation-period {
  602. font-size: 24rpx;
  603. color: rgba(255, 255, 255, 0.8);
  604. }
  605. }
  606. }
  607. .constellation-traits {
  608. display: flex;
  609. justify-content: center;
  610. gap: 15rpx;
  611. flex-wrap: wrap;
  612. .trait-tag {
  613. background-color: rgba(255, 255, 255, 0.2);
  614. color: #FFFFFF;
  615. font-size: 24rpx;
  616. padding: 8rpx 16rpx;
  617. border-radius: 20rpx;
  618. backdrop-filter: blur(10rpx);
  619. }
  620. }
  621. }
  622. }
  623. /* 通用标题 */
  624. .section-title {
  625. font-size: 36rpx;
  626. font-weight: 600;
  627. color: #333333;
  628. margin-bottom: 25rpx;
  629. padding: 0 10rpx;
  630. display: flex;
  631. align-items: center;
  632. justify-content: flex-start;
  633. }
  634. /* 今日运势 */
  635. .fortune-section {
  636. margin-bottom: 40rpx;
  637. .fortune-card {
  638. background-color: #FFFFFF;
  639. border-radius: 24rpx;
  640. padding: 40rpx 30rpx;
  641. box-shadow: 0 6rpx 24rpx rgba(0, 0, 0, 0.08);
  642. .fortune-summary {
  643. display: flex;
  644. justify-content: space-between;
  645. align-items: center;
  646. margin-bottom: 30rpx;
  647. padding-bottom: 25rpx;
  648. border-bottom: 1rpx solid #F0F0F0;
  649. .fortune-score-wrapper {
  650. display: flex;
  651. align-items: baseline;
  652. .fortune-score {
  653. font-size: 72rpx;
  654. font-weight: bold;
  655. color: #9C27B0;
  656. line-height: 1;
  657. }
  658. .fortune-unit {
  659. font-size: 28rpx;
  660. color: #666666;
  661. margin-left: 8rpx;
  662. }
  663. }
  664. .fortune-level {
  665. padding: 12rpx 30rpx;
  666. border-radius: 30rpx;
  667. font-size: 28rpx;
  668. color: #FFFFFF;
  669. font-weight: 600;
  670. }
  671. }
  672. .fortune-details {
  673. margin-bottom: 30rpx;
  674. .fortune-item {
  675. margin-bottom: 25rpx;
  676. &:last-child {
  677. margin-bottom: 0;
  678. }
  679. .fortune-item-header {
  680. display: flex;
  681. align-items: center;
  682. margin-bottom: 12rpx;
  683. .fortune-item-icon {
  684. font-size: 28rpx;
  685. margin-right: 12rpx;
  686. }
  687. .fortune-item-label {
  688. font-size: 28rpx;
  689. color: #333333;
  690. font-weight: 500;
  691. }
  692. }
  693. .fortune-score-bar {
  694. display: flex;
  695. align-items: center;
  696. .score-bar {
  697. flex: 1;
  698. height: 12rpx;
  699. background-color: #F0F0F0;
  700. border-radius: 6rpx;
  701. overflow: hidden;
  702. margin-right: 15rpx;
  703. .score-fill {
  704. height: 100%;
  705. border-radius: 6rpx;
  706. transition: width 0.6s ease;
  707. }
  708. }
  709. .score-text {
  710. font-size: 24rpx;
  711. color: #9C27B0;
  712. font-weight: 600;
  713. min-width: 50rpx;
  714. text-align: right;
  715. }
  716. }
  717. }
  718. }
  719. .fortune-advice {
  720. background: linear-gradient(135deg, #F3E5F5 0%, #FFEEF5 100%);
  721. border-radius: 15rpx;
  722. padding: 25rpx;
  723. .advice-label {
  724. font-size: 26rpx;
  725. color: #9C27B0;
  726. font-weight: 600;
  727. display: block;
  728. margin-bottom: 12rpx;
  729. }
  730. .advice-content {
  731. font-size: 28rpx;
  732. color: #333333;
  733. line-height: 1.6;
  734. }
  735. }
  736. }
  737. }
  738. /* 星座匹配 */
  739. .match-section {
  740. margin-bottom: 40rpx;
  741. .match-card {
  742. background-color: #FFFFFF;
  743. border-radius: 24rpx;
  744. padding: 30rpx;
  745. box-shadow: 0 6rpx 24rpx rgba(0, 0, 0, 0.08);
  746. .match-best, .match-good {
  747. margin-bottom: 30rpx;
  748. &:last-child {
  749. margin-bottom: 0;
  750. }
  751. .match-category-title {
  752. font-size: 30rpx;
  753. color: #333333;
  754. font-weight: 600;
  755. margin-bottom: 20rpx;
  756. display: block;
  757. }
  758. .match-constellation-list {
  759. display: flex;
  760. gap: 15rpx;
  761. flex-wrap: wrap;
  762. .match-constellation-item {
  763. display: flex;
  764. flex-direction: column;
  765. align-items: center;
  766. padding: 20rpx 15rpx;
  767. border-radius: 15rpx;
  768. min-width: 120rpx;
  769. &.best {
  770. background: linear-gradient(135deg, #FFE5EE 0%, #FFF0F5 100%);
  771. border: 2rpx solid #E91E63;
  772. }
  773. &.good {
  774. background: linear-gradient(135deg, #E3F2FD 0%, #F0F8FF 100%);
  775. border: 2rpx solid #2196F3;
  776. }
  777. .match-emoji {
  778. font-size: 36rpx;
  779. margin-bottom: 8rpx;
  780. }
  781. .match-name {
  782. font-size: 24rpx;
  783. color: #333333;
  784. margin-bottom: 5rpx;
  785. }
  786. .match-score {
  787. font-size: 22rpx;
  788. font-weight: 600;
  789. }
  790. &.best .match-score {
  791. color: #E91E63;
  792. }
  793. &.good .match-score {
  794. color: #2196F3;
  795. }
  796. }
  797. }
  798. }
  799. }
  800. }
  801. /* 幸运元素 */
  802. .lucky-section {
  803. margin-bottom: 40rpx;
  804. .lucky-grid {
  805. display: grid;
  806. grid-template-columns: repeat(2, 1fr);
  807. gap: 20rpx;
  808. .lucky-item {
  809. display: flex;
  810. flex-direction: column;
  811. align-items: center;
  812. background-color: #FFFFFF;
  813. border-radius: 15rpx;
  814. padding: 30rpx 20rpx;
  815. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
  816. .lucky-icon-wrapper {
  817. width: 80rpx;
  818. height: 80rpx;
  819. border-radius: 50%;
  820. display: flex;
  821. align-items: center;
  822. justify-content: center;
  823. margin-bottom: 15rpx;
  824. .lucky-icon {
  825. font-size: 40rpx;
  826. }
  827. }
  828. .lucky-label {
  829. font-size: 24rpx;
  830. color: #999999;
  831. margin-bottom: 8rpx;
  832. }
  833. .lucky-value {
  834. font-size: 28rpx;
  835. color: #333333;
  836. font-weight: 600;
  837. }
  838. }
  839. }
  840. }
  841. /* 星座特质详解 */
  842. .traits-section {
  843. margin-bottom: 40rpx;
  844. .traits-card {
  845. background-color: #FFFFFF;
  846. border-radius: 24rpx;
  847. padding: 0;
  848. box-shadow: 0 6rpx 24rpx rgba(0, 0, 0, 0.08);
  849. overflow: hidden;
  850. .trait-detail {
  851. padding: 30rpx;
  852. border-bottom: 1rpx solid #F5F5F5;
  853. &:last-child {
  854. border-bottom: none;
  855. }
  856. .trait-header {
  857. display: flex;
  858. align-items: center;
  859. margin-bottom: 15rpx;
  860. .trait-icon {
  861. font-size: 32rpx;
  862. margin-right: 15rpx;
  863. }
  864. .trait-title {
  865. font-size: 30rpx;
  866. color: #9C27B0;
  867. font-weight: 600;
  868. }
  869. }
  870. .trait-content {
  871. font-size: 28rpx;
  872. color: #333333;
  873. line-height: 1.8;
  874. text-align: justify;
  875. }
  876. }
  877. }
  878. }
  879. /* 重新测算 */
  880. .retest-btn {
  881. text-align: center;
  882. padding: 30rpx 40rpx;
  883. font-size: 30rpx;
  884. color: #666666;
  885. background-color: #F8F8F8;
  886. border-radius: 25rpx;
  887. margin: 20rpx 20rpx 30rpx 20rpx;
  888. border: 2rpx solid #E0E0E0;
  889. &:active {
  890. color: #9C27B0;
  891. background-color: #F3E5F5;
  892. border-color: #9C27B0;
  893. }
  894. }
  895. /* 数据来源说明 */
  896. .data-source {
  897. display: flex;
  898. align-items: center;
  899. background-color: #E3F2FD;
  900. border-radius: 20rpx;
  901. padding: 25rpx 30rpx;
  902. margin-bottom: 30rpx;
  903. transition: all 0.3s;
  904. .source-icon {
  905. font-size: 32rpx;
  906. margin-right: 15rpx;
  907. }
  908. .source-content {
  909. flex: 1;
  910. display: flex;
  911. flex-direction: column;
  912. gap: 8rpx;
  913. .source-text {
  914. font-size: 28rpx;
  915. color: #1976D2;
  916. font-weight: 500;
  917. }
  918. .source-time {
  919. font-size: 24rpx;
  920. color: #64B5F6;
  921. }
  922. }
  923. // API数据特殊样式
  924. &.api-source {
  925. background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
  926. border-left: 6rpx solid #4CAF50;
  927. .source-icon {
  928. color: #4CAF50;
  929. }
  930. .source-text {
  931. color: #2E7D32;
  932. }
  933. .source-time {
  934. color: #66BB6A;
  935. }
  936. }
  937. }
  938. /* 免责声明 */
  939. .disclaimer {
  940. background-color: #FFF3E0;
  941. border-radius: 20rpx;
  942. padding: 30rpx;
  943. border-left: 6rpx solid #FF9800;
  944. margin: 0 10rpx;
  945. .disclaimer-title {
  946. font-size: 30rpx;
  947. font-weight: 600;
  948. color: #F57C00;
  949. margin-bottom: 20rpx;
  950. }
  951. .disclaimer-text {
  952. font-size: 26rpx;
  953. color: #666666;
  954. line-height: 2.0;
  955. text-align: justify;
  956. }
  957. }
  958. /* 底部占位 */
  959. .bottom-placeholder {
  960. height: 60rpx;
  961. }
  962. </style>