constellation.vue 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  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: '',
  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. console.log('选择生日:', this.birthday, '星座:', constellationName)
  232. },
  233. // 格式化生日显示
  234. formatBirthday(birthday) {
  235. if (!birthday) return '请选择生日'
  236. const date = new Date(birthday)
  237. const month = date.getMonth() + 1
  238. const day = date.getDate()
  239. return `${month}月${day}日`
  240. },
  241. // 提交查看运势
  242. async handleSubmit() {
  243. if (!this.birthday) {
  244. uni.showToast({
  245. title: '请选择生日',
  246. icon: 'none'
  247. })
  248. return
  249. }
  250. // 显示加载中
  251. uni.showLoading({
  252. title: '运势分析中...',
  253. mask: true
  254. })
  255. try {
  256. console.log('🔍 开始星座运势分析')
  257. console.log('生日:', this.birthday, '星座:', this.currentConstellation.name)
  258. // 生成运势数据
  259. await this.generateFortuneData()
  260. this.hasResult = true
  261. console.log('✅ 运势分析完成')
  262. // 保存到本地存储
  263. uni.setStorageSync('constellationFortune', {
  264. birthday: this.birthday,
  265. constellation: this.currentConstellation,
  266. fortune: this.todayFortune,
  267. lastUpdate: new Date().getTime()
  268. })
  269. } catch (error) {
  270. console.error('❌ 运势分析过程异常:', error)
  271. uni.showToast({
  272. title: '分析异常,请重试',
  273. icon: 'none',
  274. duration: 2000
  275. })
  276. } finally {
  277. uni.hideLoading()
  278. }
  279. },
  280. // 生成运势数据
  281. async generateFortuneData() {
  282. try {
  283. // 获取星座运势(优先API,失败时使用本地数据)
  284. const fortuneData = await constellationUtil.getConstellationFortune(this.currentConstellation.name)
  285. // 转换数据格式为页面需要的格式
  286. this.todayFortune = {
  287. overallScore: fortuneData.overall || 80,
  288. level: fortuneData.level || '良好',
  289. levelColor: fortuneData.levelColor || 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)',
  290. details: [
  291. {
  292. label: '爱情运',
  293. icon: '💕',
  294. score: fortuneData.love || 75,
  295. color: 'linear-gradient(135deg, #E91E63 0%, #FF6B9D 100%)'
  296. },
  297. {
  298. label: '事业运',
  299. icon: '💼',
  300. score: fortuneData.career || 78,
  301. color: 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  302. },
  303. {
  304. label: '财运',
  305. icon: '💰',
  306. score: fortuneData.wealth || 72,
  307. color: 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  308. },
  309. {
  310. label: '健康运',
  311. icon: '🌿',
  312. score: fortuneData.health || 80,
  313. color: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  314. }
  315. ],
  316. advice: fortuneData.advice || '今天是美好的一天,保持积极心态!',
  317. source: fortuneData.source || 'local'
  318. }
  319. // 生成星座匹配
  320. this.constellationMatch = constellationUtil.generateConstellationMatch(this.currentConstellation.name)
  321. // 生成幸运元素
  322. this.luckyElements = constellationUtil.generateLuckyElements(this.currentConstellation.name)
  323. // 生成星座特质
  324. this.constellationTraits = constellationUtil.generateConstellationTraits(this.currentConstellation.name)
  325. } catch (error) {
  326. console.error('生成运势数据异常:', error)
  327. // 异常时使用默认数据
  328. this.todayFortune = this.generateDefaultFortune()
  329. this.constellationMatch = { best: [], good: [] }
  330. this.luckyElements = []
  331. this.constellationTraits = []
  332. }
  333. },
  334. // 生成默认运势数据(异常情况下使用)
  335. generateDefaultFortune() {
  336. const scores = {
  337. overall: Math.floor(Math.random() * 30) + 70,
  338. love: Math.floor(Math.random() * 40) + 60,
  339. career: Math.floor(Math.random() * 40) + 60,
  340. wealth: Math.floor(Math.random() * 40) + 60,
  341. health: Math.floor(Math.random() * 40) + 60
  342. }
  343. const levels = ['一般', '良好', '极佳', '超棒']
  344. const levelColors = [
  345. 'linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%)',
  346. 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)',
  347. 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)',
  348. 'linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%)'
  349. ]
  350. const levelIndex = Math.floor(scores.overall / 25)
  351. const level = levels[Math.min(levelIndex, levels.length - 1)]
  352. const levelColor = levelColors[Math.min(levelIndex, levelColors.length - 1)]
  353. const advices = [
  354. '今天是展现个人魅力的好时机,保持积极心态!',
  355. '适合与他人合作,团队协作能带来意想不到的收获。',
  356. '财运不错,但要理性消费,避免冲动购买。',
  357. '健康运势平稳,适量运动有助提升整体状态。',
  358. '感情方面有新的进展,单身者有机会遇到心仪对象。'
  359. ]
  360. return {
  361. overallScore: scores.overall,
  362. level: level,
  363. levelColor: levelColor,
  364. details: [
  365. {
  366. label: '爱情运',
  367. icon: '💕',
  368. score: scores.love,
  369. color: 'linear-gradient(135deg, #E91E63 0%, #FF6B9D 100%)'
  370. },
  371. {
  372. label: '事业运',
  373. icon: '💼',
  374. score: scores.career,
  375. color: 'linear-gradient(135deg, #2196F3 0%, #64B5F6 100%)'
  376. },
  377. {
  378. label: '财运',
  379. icon: '💰',
  380. score: scores.wealth,
  381. color: 'linear-gradient(135deg, #FF9800 0%, #FFB74D 100%)'
  382. },
  383. {
  384. label: '健康运',
  385. icon: '🌿',
  386. score: scores.health,
  387. color: 'linear-gradient(135deg, #4CAF50 0%, #81C784 100%)'
  388. }
  389. ],
  390. advice: advices[Math.floor(Math.random() * advices.length)],
  391. source: 'local'
  392. }
  393. },
  394. // 重新测算
  395. handleRetest() {
  396. this.hasResult = false
  397. this.birthday = ''
  398. this.birthdayDisplay = '请选择生日'
  399. this.currentConstellation = null
  400. this.todayFortune = null
  401. this.constellationMatch = null
  402. this.luckyElements = []
  403. this.constellationTraits = []
  404. },
  405. // 返回
  406. goBack() {
  407. uni.navigateBack({
  408. delta: 1
  409. })
  410. }
  411. }
  412. }
  413. </script>
  414. <style lang="scss" scoped>
  415. .constellation-page {
  416. min-height: 100vh;
  417. background: linear-gradient(180deg, #FFF9F9 0%, #FFFFFF 50%);
  418. padding-bottom: 40rpx;
  419. }
  420. /* 自定义导航栏 */
  421. .custom-nav {
  422. position: relative;
  423. display: flex;
  424. align-items: center;
  425. justify-content: space-between;
  426. height: 88rpx;
  427. padding: 0 30rpx;
  428. background-color: #FFFFFF;
  429. border-bottom: 1rpx solid #F0F0F0;
  430. .nav-left {
  431. width: 80rpx;
  432. .back-icon {
  433. font-size: 40rpx;
  434. color: #333333;
  435. }
  436. }
  437. .nav-title {
  438. position: absolute;
  439. left: 50%;
  440. transform: translateX(-50%);
  441. font-size: 34rpx;
  442. font-weight: 600;
  443. color: #333333;
  444. }
  445. .nav-right {
  446. width: 80rpx;
  447. }
  448. }
  449. /* 生日选择区域 */
  450. .birthday-selection-section {
  451. padding: 60rpx 30rpx;
  452. display: flex;
  453. flex-direction: column;
  454. align-items: center;
  455. .selection-card {
  456. width: 100%;
  457. background-color: #FFFFFF;
  458. border-radius: 30rpx;
  459. padding: 60rpx 40rpx;
  460. box-shadow: 0 8rpx 30rpx rgba(156, 39, 176, 0.1);
  461. text-align: center;
  462. .card-title {
  463. font-size: 40rpx;
  464. font-weight: bold;
  465. color: #333333;
  466. margin-bottom: 15rpx;
  467. }
  468. .card-subtitle {
  469. font-size: 26rpx;
  470. color: #999999;
  471. margin-bottom: 50rpx;
  472. }
  473. .birthday-picker-wrapper {
  474. margin-bottom: 30rpx;
  475. text-align: left;
  476. .picker-label {
  477. font-size: 28rpx;
  478. color: #666666;
  479. margin-bottom: 15rpx;
  480. }
  481. .birthday-display {
  482. display: flex;
  483. align-items: center;
  484. justify-content: center;
  485. background-color: #F8F8F8;
  486. border-radius: 20rpx;
  487. padding: 25rpx 30rpx;
  488. border: 2rpx solid #9C27B0;
  489. transition: all 0.3s;
  490. .birthday-icon {
  491. font-size: 40rpx;
  492. margin-right: 15rpx;
  493. }
  494. .birthday-text {
  495. font-size: 32rpx;
  496. color: #333333;
  497. font-weight: 500;
  498. }
  499. }
  500. &:active .birthday-display {
  501. background-color: #F3E5F5;
  502. transform: scale(0.98);
  503. }
  504. }
  505. .constellation-preview {
  506. background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
  507. border-radius: 20rpx;
  508. padding: 30rpx;
  509. margin-bottom: 30rpx;
  510. text-align: center;
  511. .constellation-info {
  512. display: flex;
  513. align-items: center;
  514. justify-content: center;
  515. margin-bottom: 15rpx;
  516. .constellation-emoji {
  517. font-size: 60rpx;
  518. margin-right: 15rpx;
  519. }
  520. .constellation-name {
  521. font-size: 36rpx;
  522. color: #9C27B0;
  523. font-weight: 600;
  524. }
  525. }
  526. .constellation-desc {
  527. font-size: 24rpx;
  528. color: #666666;
  529. }
  530. }
  531. .submit-btn {
  532. width: 100%;
  533. height: 90rpx;
  534. background: linear-gradient(135deg, #9C27B0 0%, #E1BEE7 100%);
  535. color: #FFFFFF;
  536. font-size: 32rpx;
  537. font-weight: 600;
  538. border-radius: 45rpx;
  539. border: none;
  540. box-shadow: 0 8rpx 20rpx rgba(156, 39, 176, 0.3);
  541. &:disabled {
  542. opacity: 0.5;
  543. }
  544. &:active:not(:disabled) {
  545. opacity: 0.9;
  546. }
  547. }
  548. }
  549. .constellation-icons {
  550. display: flex;
  551. flex-wrap: wrap;
  552. justify-content: center;
  553. gap: 20rpx;
  554. margin-top: 50rpx;
  555. opacity: 0.3;
  556. .constellation-icon {
  557. font-size: 48rpx;
  558. animation: float 3s ease-in-out infinite;
  559. &:nth-child(2n) {
  560. animation-delay: 0.5s;
  561. }
  562. &:nth-child(3n) {
  563. animation-delay: 1s;
  564. }
  565. }
  566. }
  567. }
  568. @keyframes float {
  569. 0%, 100% {
  570. transform: translateY(0);
  571. }
  572. 50% {
  573. transform: translateY(-10rpx);
  574. }
  575. }
  576. /* 结果区域 */
  577. .result-section {
  578. padding: 30rpx 25rpx 40rpx 25rpx;
  579. }
  580. /* 星座标题卡片 */
  581. .constellation-title-card {
  582. background: linear-gradient(135deg, #9C27B0 0%, #E1BEE7 100%);
  583. border-radius: 32rpx;
  584. padding: 50rpx 40rpx;
  585. text-align: center;
  586. box-shadow: 0 12rpx 40rpx rgba(156, 39, 176, 0.25);
  587. margin-bottom: 40rpx;
  588. .constellation-header {
  589. .constellation-main {
  590. display: flex;
  591. align-items: center;
  592. justify-content: center;
  593. margin-bottom: 30rpx;
  594. .constellation-emoji-large {
  595. font-size: 120rpx;
  596. margin-right: 30rpx;
  597. }
  598. .constellation-info-main {
  599. display: flex;
  600. flex-direction: column;
  601. align-items: flex-start;
  602. .constellation-name-large {
  603. font-size: 42rpx;
  604. font-weight: bold;
  605. color: #FFFFFF;
  606. margin-bottom: 10rpx;
  607. }
  608. .constellation-period {
  609. font-size: 24rpx;
  610. color: rgba(255, 255, 255, 0.8);
  611. }
  612. }
  613. }
  614. .constellation-traits {
  615. display: flex;
  616. justify-content: center;
  617. gap: 15rpx;
  618. flex-wrap: wrap;
  619. .trait-tag {
  620. background-color: rgba(255, 255, 255, 0.2);
  621. color: #FFFFFF;
  622. font-size: 24rpx;
  623. padding: 8rpx 16rpx;
  624. border-radius: 20rpx;
  625. backdrop-filter: blur(10rpx);
  626. }
  627. }
  628. }
  629. }
  630. /* 通用标题 */
  631. .section-title {
  632. font-size: 36rpx;
  633. font-weight: 600;
  634. color: #333333;
  635. margin-bottom: 25rpx;
  636. padding: 0 10rpx;
  637. display: flex;
  638. align-items: center;
  639. justify-content: flex-start;
  640. }
  641. /* 今日运势 */
  642. .fortune-section {
  643. margin-bottom: 40rpx;
  644. .fortune-card {
  645. background-color: #FFFFFF;
  646. border-radius: 24rpx;
  647. padding: 40rpx 30rpx;
  648. box-shadow: 0 6rpx 24rpx rgba(0, 0, 0, 0.08);
  649. .fortune-summary {
  650. display: flex;
  651. justify-content: space-between;
  652. align-items: center;
  653. margin-bottom: 30rpx;
  654. padding-bottom: 25rpx;
  655. border-bottom: 1rpx solid #F0F0F0;
  656. .fortune-score-wrapper {
  657. display: flex;
  658. align-items: baseline;
  659. .fortune-score {
  660. font-size: 72rpx;
  661. font-weight: bold;
  662. color: #9C27B0;
  663. line-height: 1;
  664. }
  665. .fortune-unit {
  666. font-size: 28rpx;
  667. color: #666666;
  668. margin-left: 8rpx;
  669. }
  670. }
  671. .fortune-level {
  672. padding: 12rpx 30rpx;
  673. border-radius: 30rpx;
  674. font-size: 28rpx;
  675. color: #FFFFFF;
  676. font-weight: 600;
  677. }
  678. }
  679. .fortune-details {
  680. margin-bottom: 30rpx;
  681. .fortune-item {
  682. margin-bottom: 25rpx;
  683. &:last-child {
  684. margin-bottom: 0;
  685. }
  686. .fortune-item-header {
  687. display: flex;
  688. align-items: center;
  689. margin-bottom: 12rpx;
  690. .fortune-item-icon {
  691. font-size: 28rpx;
  692. margin-right: 12rpx;
  693. }
  694. .fortune-item-label {
  695. font-size: 28rpx;
  696. color: #333333;
  697. font-weight: 500;
  698. }
  699. }
  700. .fortune-score-bar {
  701. display: flex;
  702. align-items: center;
  703. .score-bar {
  704. flex: 1;
  705. height: 12rpx;
  706. background-color: #F0F0F0;
  707. border-radius: 6rpx;
  708. overflow: hidden;
  709. margin-right: 15rpx;
  710. .score-fill {
  711. height: 100%;
  712. border-radius: 6rpx;
  713. transition: width 0.6s ease;
  714. }
  715. }
  716. .score-text {
  717. font-size: 24rpx;
  718. color: #9C27B0;
  719. font-weight: 600;
  720. min-width: 50rpx;
  721. text-align: right;
  722. }
  723. }
  724. }
  725. }
  726. .fortune-advice {
  727. background: linear-gradient(135deg, #F3E5F5 0%, #FFEEF5 100%);
  728. border-radius: 15rpx;
  729. padding: 25rpx;
  730. .advice-label {
  731. font-size: 26rpx;
  732. color: #9C27B0;
  733. font-weight: 600;
  734. display: block;
  735. margin-bottom: 12rpx;
  736. }
  737. .advice-content {
  738. font-size: 28rpx;
  739. color: #333333;
  740. line-height: 1.6;
  741. }
  742. }
  743. }
  744. }
  745. /* 星座匹配 */
  746. .match-section {
  747. margin-bottom: 40rpx;
  748. .match-card {
  749. background-color: #FFFFFF;
  750. border-radius: 24rpx;
  751. padding: 30rpx;
  752. box-shadow: 0 6rpx 24rpx rgba(0, 0, 0, 0.08);
  753. .match-best, .match-good {
  754. margin-bottom: 30rpx;
  755. &:last-child {
  756. margin-bottom: 0;
  757. }
  758. .match-category-title {
  759. font-size: 30rpx;
  760. color: #333333;
  761. font-weight: 600;
  762. margin-bottom: 20rpx;
  763. display: block;
  764. }
  765. .match-constellation-list {
  766. display: flex;
  767. gap: 15rpx;
  768. flex-wrap: wrap;
  769. .match-constellation-item {
  770. display: flex;
  771. flex-direction: column;
  772. align-items: center;
  773. padding: 20rpx 15rpx;
  774. border-radius: 15rpx;
  775. min-width: 120rpx;
  776. &.best {
  777. background: linear-gradient(135deg, #FFE5EE 0%, #FFF0F5 100%);
  778. border: 2rpx solid #E91E63;
  779. }
  780. &.good {
  781. background: linear-gradient(135deg, #E3F2FD 0%, #F0F8FF 100%);
  782. border: 2rpx solid #2196F3;
  783. }
  784. .match-emoji {
  785. font-size: 36rpx;
  786. margin-bottom: 8rpx;
  787. }
  788. .match-name {
  789. font-size: 24rpx;
  790. color: #333333;
  791. margin-bottom: 5rpx;
  792. }
  793. .match-score {
  794. font-size: 22rpx;
  795. font-weight: 600;
  796. }
  797. &.best .match-score {
  798. color: #E91E63;
  799. }
  800. &.good .match-score {
  801. color: #2196F3;
  802. }
  803. }
  804. }
  805. }
  806. }
  807. }
  808. /* 幸运元素 */
  809. .lucky-section {
  810. margin-bottom: 40rpx;
  811. .lucky-grid {
  812. display: grid;
  813. grid-template-columns: repeat(2, 1fr);
  814. gap: 20rpx;
  815. .lucky-item {
  816. display: flex;
  817. flex-direction: column;
  818. align-items: center;
  819. background-color: #FFFFFF;
  820. border-radius: 15rpx;
  821. padding: 30rpx 20rpx;
  822. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
  823. .lucky-icon-wrapper {
  824. width: 80rpx;
  825. height: 80rpx;
  826. border-radius: 50%;
  827. display: flex;
  828. align-items: center;
  829. justify-content: center;
  830. margin-bottom: 15rpx;
  831. .lucky-icon {
  832. font-size: 40rpx;
  833. }
  834. }
  835. .lucky-label {
  836. font-size: 24rpx;
  837. color: #999999;
  838. margin-bottom: 8rpx;
  839. }
  840. .lucky-value {
  841. font-size: 28rpx;
  842. color: #333333;
  843. font-weight: 600;
  844. }
  845. }
  846. }
  847. }
  848. /* 星座特质详解 */
  849. .traits-section {
  850. margin-bottom: 40rpx;
  851. .traits-card {
  852. background-color: #FFFFFF;
  853. border-radius: 24rpx;
  854. padding: 0;
  855. box-shadow: 0 6rpx 24rpx rgba(0, 0, 0, 0.08);
  856. overflow: hidden;
  857. .trait-detail {
  858. padding: 30rpx;
  859. border-bottom: 1rpx solid #F5F5F5;
  860. &:last-child {
  861. border-bottom: none;
  862. }
  863. .trait-header {
  864. display: flex;
  865. align-items: center;
  866. margin-bottom: 15rpx;
  867. .trait-icon {
  868. font-size: 32rpx;
  869. margin-right: 15rpx;
  870. }
  871. .trait-title {
  872. font-size: 30rpx;
  873. color: #9C27B0;
  874. font-weight: 600;
  875. }
  876. }
  877. .trait-content {
  878. font-size: 28rpx;
  879. color: #333333;
  880. line-height: 1.8;
  881. text-align: justify;
  882. }
  883. }
  884. }
  885. }
  886. /* 重新测算 */
  887. .retest-btn {
  888. text-align: center;
  889. padding: 30rpx 40rpx;
  890. font-size: 30rpx;
  891. color: #666666;
  892. background-color: #F8F8F8;
  893. border-radius: 25rpx;
  894. margin: 20rpx 20rpx 30rpx 20rpx;
  895. border: 2rpx solid #E0E0E0;
  896. &:active {
  897. color: #9C27B0;
  898. background-color: #F3E5F5;
  899. border-color: #9C27B0;
  900. }
  901. }
  902. /* 数据来源说明 */
  903. .data-source {
  904. display: flex;
  905. align-items: center;
  906. background-color: #E3F2FD;
  907. border-radius: 20rpx;
  908. padding: 25rpx 30rpx;
  909. margin-bottom: 30rpx;
  910. transition: all 0.3s;
  911. .source-icon {
  912. font-size: 32rpx;
  913. margin-right: 15rpx;
  914. }
  915. .source-content {
  916. flex: 1;
  917. display: flex;
  918. flex-direction: column;
  919. gap: 8rpx;
  920. .source-text {
  921. font-size: 28rpx;
  922. color: #1976D2;
  923. font-weight: 500;
  924. }
  925. .source-time {
  926. font-size: 24rpx;
  927. color: #64B5F6;
  928. }
  929. }
  930. // API数据特殊样式
  931. &.api-source {
  932. background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
  933. border-left: 6rpx solid #4CAF50;
  934. .source-icon {
  935. color: #4CAF50;
  936. }
  937. .source-text {
  938. color: #2E7D32;
  939. }
  940. .source-time {
  941. color: #66BB6A;
  942. }
  943. }
  944. }
  945. /* 免责声明 */
  946. .disclaimer {
  947. background-color: #FFF3E0;
  948. border-radius: 20rpx;
  949. padding: 30rpx;
  950. border-left: 6rpx solid #FF9800;
  951. margin: 0 10rpx;
  952. .disclaimer-title {
  953. font-size: 30rpx;
  954. font-weight: 600;
  955. color: #F57C00;
  956. margin-bottom: 20rpx;
  957. }
  958. .disclaimer-text {
  959. font-size: 26rpx;
  960. color: #666666;
  961. line-height: 2.0;
  962. text-align: justify;
  963. }
  964. }
  965. /* 底部占位 */
  966. .bottom-placeholder {
  967. height: 60rpx;
  968. }
  969. </style>