FamilyTianpanCard.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. <template>
  2. <!-- 家庭天盘卡片 — 心维度专属 (#FF6B9D 火) -->
  3. <view class="tianpan-card" v-if="visible" :style="themeStyle">
  4. <!-- 卡片头部 -->
  5. <view class="tp-header">
  6. <view class="tp-header-left">
  7. <view class="tp-icon-badge">
  8. <text class="tp-icon-text">&#x2637;</text>
  9. </view>
  10. <view class="tp-header-info">
  11. <text class="tp-title">家庭天盘</text>
  12. <text class="tp-subtitle">五行能量 · 每日更新</text>
  13. </view>
  14. </view>
  15. <view class="tp-header-action" @click="goDetail">
  16. <text class="tp-action-text">&#x2192;</text>
  17. </view>
  18. </view>
  19. <!-- 三栏展示 -->
  20. <view class="tp-body">
  21. <!-- 今日运势 -->
  22. <view class="tp-col tp-col-fortune">
  23. <text class="tp-col-icon">&#x2B50;</text>
  24. <text class="tp-col-label">今日运势</text>
  25. <view class="tp-fortune-badge" :class="'fortune-level-' + fortuneLevel">
  26. <text class="tp-fortune-text">{{ fortuneText }}</text>
  27. </view>
  28. <text class="tp-fortune-desc">{{ fortuneDesc }}</text>
  29. </view>
  30. <!-- 今日心情 -->
  31. <view class="tp-col tp-col-mood">
  32. <text class="tp-col-icon">{{ moodEmoji }}</text>
  33. <text class="tp-col-label">今日心情</text>
  34. <text class="tp-mood-value">{{ moodText }}</text>
  35. <view class="tp-mood-bar-track">
  36. <view class="tp-mood-bar-fill" :style="{ width: moodPercent + '%' }"></view>
  37. </view>
  38. </view>
  39. <!-- 吉位 -->
  40. <view class="tp-col tp-col-direction">
  41. <text class="tp-col-icon">&#x1F9ED;</text>
  42. <text class="tp-col-label">今日吉位</text>
  43. <view class="tp-compass-wrap">
  44. <canvas
  45. canvas-id="tianpanCompass"
  46. id="tianpanCompass"
  47. type="2d"
  48. class="tp-compass-canvas"
  49. @touchstart="handleTouchStart"
  50. ></canvas>
  51. </view>
  52. <text class="tp-direction-value">{{ luckyDirection }}</text>
  53. </view>
  54. </view>
  55. <!-- 传统文化信息(八字/五行/星座/灵数) -->
  56. <view class="tp-traditional" v-if="traditionalData">
  57. <!-- 八字四柱 -->
  58. <view class="tp-trad-row" v-if="traditionalData.eightCharacters">
  59. <view class="tp-trad-item" v-for="(val, key) in traditionalData.eightCharacters" :key="getBaziKey(key)">
  60. <text class="tp-trad-label">{{ pillarLabels[key] || key }}</text>
  61. <text class="tp-trad-value">{{ val }}</text>
  62. </view>
  63. </view>
  64. <!-- 五行能量 -->
  65. <view class="tp-trad-row" v-if="traditionalData.wuxingElements">
  66. <view class="tp-trad-item" v-for="wx in wuxingData" :key="getWuxingKey(wx)">
  67. <text class="tp-trad-label">{{ wx.label }}</text>
  68. <view class="tp-trad-bar-track">
  69. <view class="tp-trad-bar-fill" :style="{ width: wx.value + '%', background: wx.color }"></view>
  70. </view>
  71. <text class="tp-trad-val">{{ wx.value }}%</text>
  72. </view>
  73. </view>
  74. <!-- 星座 + 灵数 -->
  75. <view class="tp-trad-row tp-trad-row-split">
  76. <view class="tp-trad-tag" v-if="traditionalData.zodiac">
  77. <text class="tp-trad-tag-icon">&#x2600;</text>
  78. <text class="tp-trad-tag-text">{{ traditionalData.zodiac }}</text>
  79. </view>
  80. <view class="tp-trad-tag" v-if="traditionalData.lifeNumber">
  81. <text class="tp-trad-tag-icon">&#x1F52E;</text>
  82. <text class="tp-trad-tag-text">灵数 {{ traditionalData.lifeNumber }}</text>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 底部周报提示 -->
  87. <view class="tp-footer" v-if="weeklyTip">
  88. <text class="tp-footer-icon">&#x1F4A1;</text>
  89. <text class="tp-footer-text">{{ weeklyTip }}</text>
  90. </view>
  91. <!-- 今日宜忌提示 -->
  92. <view class="tp-advice-section">
  93. <view class="tp-advice-item">
  94. <text class="tp-advice-icon">♦</text>
  95. <text class="tp-advice-label">宜:</text>
  96. <text class="tp-advice-text">{{ getAdvice(true) }}</text>
  97. </view>
  98. <view class="tp-advice-item">
  99. <text class="tp-advice-icon">✖</text>
  100. <text class="tp-advice-label">忌:</text>
  101. <text class="tp-advice-text">{{ getAdvice(false) }}</text>
  102. </view>
  103. </view>
  104. <!-- 查看详情入口 -->
  105. <view class="tp-detail-btn" @click="goDetail">
  106. <text class="tp-detail-text">查看家庭天盘详情 &#x2192;</text>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. /**
  112. * FamilyTianpanCard — 家庭天盘概览卡片(嵌入心维度页面)
  113. *
  114. * Props:
  115. * fortune — { level: 0-4, text, description }
  116. * mood — { emoji, text, score: 0-100 }
  117. * dominantElement — 'wood'|'fire'|'earth'|'metal'|'water'
  118. * weeklyTip — string 本周提示
  119. * visible — boolean 是否显示
  120. *
  121. * 吉位 Canvas 绘制五元素罗盘,高亮吉位方向。
  122. */
  123. export default {
  124. name: 'FamilyTianpanCard',
  125. props: {
  126. fortune: {
  127. type: Object,
  128. default: function() { return null }
  129. },
  130. mood: {
  131. type: Object,
  132. default: function() { return null }
  133. },
  134. dominantElement: {
  135. type: String,
  136. default: ''
  137. },
  138. weeklyTip: {
  139. type: String,
  140. default: ''
  141. },
  142. visible: {
  143. type: Boolean,
  144. default: true
  145. },
  146. traditionalData: {
  147. type: Object,
  148. default: function() { return null }
  149. }
  150. },
  151. data: function() {
  152. return {
  153. canvasCtx: null,
  154. canvasReady: false,
  155. _compassW: 0,
  156. _compassH: 0,
  157. themeColor: '#FF6B9D', // 默认火维度颜色
  158. _animFrameId: null,
  159. _clickableAreas: [],
  160. // 五行 → 方位映射
  161. elementDirMap: {
  162. wood: '东',
  163. fire: '南',
  164. earth: '中',
  165. metal: '西',
  166. water: '北'
  167. },
  168. // 方位 → 颜色映射
  169. dirColorMap: {
  170. '东': '#10B981',
  171. '南': '#FF6B9D',
  172. '中': '#FF8C42',
  173. '西': '#6366F1',
  174. '北': '#3B82F6'
  175. },
  176. // 方位 → 角度(从北顺时针,Canvas 默认从右/东开始)
  177. dirAngleMap: {
  178. '东': Math.PI / 2,
  179. '南': Math.PI,
  180. '中': 0,
  181. '西': -Math.PI / 2,
  182. '北': 0
  183. }
  184. }
  185. },
  186. computed: {
  187. fortuneLevel: function() {
  188. if (!this.fortune) return 2
  189. return this.fortune.level !== undefined ? this.fortune.level : 2
  190. },
  191. fortuneText: function() {
  192. if (!this.fortune || !this.fortune.text) return '平'
  193. return this.fortune.text
  194. },
  195. fortuneDesc: function() {
  196. if (!this.fortune || !this.fortune.description) return '今日宜静心养性'
  197. return this.fortune.description
  198. },
  199. moodEmoji: function() {
  200. if (this.mood && this.mood.emoji) return this.mood.emoji
  201. return '\u{1F60A}' // 默认笑脸
  202. },
  203. moodText: function() {
  204. if (this.mood && this.mood.text) return this.mood.text
  205. return '平静'
  206. },
  207. moodPercent: function() {
  208. if (this.mood && this.mood.score !== undefined) return this.mood.score
  209. return 60
  210. },
  211. luckyDirection: function() {
  212. if (this.dominantElement && this.elementDirMap[this.dominantElement]) {
  213. return this.elementDirMap[this.dominantElement] + '方'
  214. }
  215. return '东方'
  216. },
  217. luckyElementColor: function() {
  218. var dir = this.luckyDirection
  219. return this.dirColorMap[dir] || '#FF6B9D'
  220. },
  221. themeStyle: function() {
  222. var color = this.themeColor || '#FF6B9D'
  223. var lighter = color + '15'
  224. var borderColor = color + '20'
  225. var shadowColor = color + '25'
  226. return {
  227. '--theme-color': color,
  228. '--theme-lighter': lighter,
  229. '--theme-border': borderColor,
  230. '--theme-shadow': shadowColor,
  231. '--theme-gradient': 'linear-gradient(135deg, ' + color + ', ' + color + 'CC)'
  232. }
  233. },
  234. isChild: function() {
  235. try {
  236. return this.$store && this.$store.state && this.$store.state.role === 'child'
  237. } catch (e) {
  238. return false
  239. }
  240. },
  241. pillarLabels: function() {
  242. return { year: '年柱', month: '月柱', day: '日柱', hour: '时柱' }
  243. },
  244. wuxingData: function() {
  245. if (!this.traditionalData || !this.traditionalData.wuxingElements) return []
  246. var colorMap = { wood: '#10B981', fire: '#FF6B9D', earth: '#FF8C42', metal: '#6366F1', water: '#3B82F6' }
  247. var labelMap = { wood: '木', fire: '火', earth: '土', metal: '金', water: '水' }
  248. var elements = this.traditionalData.wuxingElements
  249. var result = []
  250. for (var key in elements) {
  251. if (elements.hasOwnProperty(key)) {
  252. result.push({
  253. key: key,
  254. label: labelMap[key] || key,
  255. value: elements[key] || 0,
  256. color: colorMap[key] || '#94A3B8'
  257. })
  258. }
  259. }
  260. return result
  261. }
  262. },
  263. watch: {
  264. visible: function(val) {
  265. if (val) {
  266. var self = this
  267. setTimeout(function() {
  268. self.initCanvas()
  269. }, 300)
  270. }
  271. },
  272. dominantElement: function() {
  273. if (this.canvasReady) {
  274. this.drawCompass()
  275. }
  276. }
  277. },
  278. mounted: function() {
  279. if (this.visible) {
  280. var self = this
  281. setTimeout(function() {
  282. self.initCanvas()
  283. }, 500)
  284. }
  285. },
  286. methods: {
  287. getBaziKey: function(key) { return 'bazi-' + key },
  288. getWuxingKey: function(wx) { return 'wx-' + wx.key },
  289. goDetail: function() {
  290. uni.navigateTo({
  291. url: '/pages/mind-detail/family-dashboard'
  292. })
  293. },
  294. /**
  295. * 获取当日宜忌建议
  296. * @param {boolean} isGood - 是否获取宜(true)或忌(false)
  297. */
  298. getAdvice: function(isGood) {
  299. const advice = {
  300. 木: {
  301. good: '植树种花、亲近自然,交友聚会增进感情,制定计划规划未来',
  302. bad: '冲动消费、盲目扩张,长期熬夜、透支健康,与人争执失和气'
  303. },
  304. 火: {
  305. good: '社交活动、表达感想,旅行出游、放松心情,运动健身、增强活力',
  306. bad: '过度劳累、身体透支,情绪激动、失去理智,暴饮暴食、饮酒无度'
  307. },
  308. 土: {
  309. good: '规律作息、健康管理,家务整理、创造舒适,学习充电、稳固提升',
  310. bad: '情绪压抑、独自忍耐,忽视身体、健康警讯,盲目保守、错失机会'
  311. },
  312. 金: {
  313. good: '整理环境、创造秩序,专注工作、提升效率,投资理财、稳健收益',
  314. bad: '过度拘谨、缺乏变通,忽略情感、人情冷漠,欲望过多、贪求不满'
  315. },
  316. 水: {
  317. good: '阅读思考、拓展思维,社交活动、增进人脉,创意思考、寻找机遇',
  318. bad: '犹豫不决、错过良机,过度幻想、缺乏行动,沉迷游戏、浪费时光'
  319. }
  320. }
  321. // 默认值(如果五行未知或未提供)
  322. if (!this.fortune || !this.fortune.dominantElement) {
  323. return isGood ? '保持心情愉悦,积极面对每一天' : '避免负面情绪,不过度劳累'
  324. }
  325. const element = this.fortune.dominantElement
  326. return advice[element][isGood ? 'good' : 'bad']
  327. },
  328. initCanvas: function() {
  329. var self = this
  330. var query = uni.createSelectorQuery().in(self)
  331. query.select('#tianpanCompass')
  332. .fields({ node: true, size: true })
  333. .exec(function(res) {
  334. if (!res || !res[0] || !res[0].node) return
  335. var ctx = res[0].node.getContext('2d')
  336. var dpr = uni.getWindowInfo().pixelRatio || 2
  337. var w = res[0].width
  338. var h = res[0].height
  339. // 高分辨率适配
  340. res[0].node.width = w * dpr
  341. res[0].node.height = h * dpr
  342. ctx.scale(dpr, dpr)
  343. self.canvasCtx = ctx
  344. self.canvasReady = true
  345. self._compassW = w
  346. self._compassH = h
  347. // 设置初始主题色(火维度)
  348. self.themeColor = '#FF6B9D'
  349. if (self.fortune && self.fortune.dominantElement) {
  350. var elementColors = {
  351. 木: '#10B981', 火: '#FF6B9D', 土: '#FF8C42', 金: '#6366F1', 水: '#3B82F6'
  352. }
  353. self.themeColor = elementColors[self.fortune.dominantElement]
  354. }
  355. // 启动动画
  356. self.startAnimation()
  357. })
  358. },
  359. handleTouchStart: function(e) {
  360. // 儿童模式交互
  361. if (this.$store.state.role === 'child') {
  362. this.handleCompassClick(e)
  363. }
  364. },
  365. clearCanvas: function() {
  366. if (!this.canvasReady || !this.canvasCtx) return
  367. var ctx = this.canvasCtx
  368. var width = this._compassW
  369. var height = this._compassH
  370. ctx.clearRect(0, 0, width, height)
  371. },
  372. startAnimation: function() {
  373. var self = this
  374. if (this._animFrameId) {
  375. clearTimeout(this._animFrameId)
  376. this._animFrameId = null
  377. }
  378. var lastTime = 0
  379. var fps = 30 // 小程序 Canvas 30fps 即可保证流畅
  380. var interval = 1000 / fps
  381. function animationLoop() {
  382. if (!self.canvasCtx || !self.canvasReady) {
  383. self._animFrameId = null
  384. return
  385. }
  386. var now = Date.now()
  387. if (now - lastTime < interval) {
  388. self._animFrameId = setTimeout(animationLoop, 16)
  389. return
  390. }
  391. lastTime = now
  392. self.clearCanvas()
  393. self.drawCompassWithAnimation(now)
  394. self._animFrameId = setTimeout(animationLoop, 16)
  395. }
  396. animationLoop()
  397. },
  398. drawCompass: function() {
  399. // 兼容旧调用
  400. this.drawCompassWithAnimation(0)
  401. },
  402. drawCompassWithAnimation: function(timestamp) {
  403. var ctx = this.canvasCtx
  404. if (!ctx) return
  405. var w = this._compassW || 100
  406. var h = this._compassH || 100
  407. var cx = w / 2
  408. var cy = h / 2
  409. var outerR = Math.min(cx, cy) - 4
  410. // 清空
  411. ctx.clearRect(0, 0, w, h)
  412. // 五个方位: 北(上), 东(右), 南(下), 西(左), 中(中心)
  413. var directions = [
  414. { label: '北', element: 'water', angle: -Math.PI / 2 },
  415. { label: '东', element: 'wood', angle: 0 },
  416. { label: '南', element: 'fire', angle: Math.PI / 2 },
  417. { label: '西', element: 'metal', angle: Math.PI },
  418. { label: '中', element: 'earth', angle: null }
  419. ]
  420. var elementColors = {
  421. wood: '#10B981',
  422. fire: '#FF6B9D',
  423. earth: '#FF8C42',
  424. metal: '#6366F1',
  425. water: '#3B82F6'
  426. }
  427. var luckyDir = this.luckyDirection.replace('方', '')
  428. var luckyColor = this.luckyElementColor
  429. // hex转rgba辅助
  430. function hexToRgba(hex, alpha) {
  431. var r = parseInt(hex.slice(1, 3), 16)
  432. var g = parseInt(hex.slice(3, 5), 16)
  433. var b = parseInt(hex.slice(5, 7), 16)
  434. return 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'
  435. }
  436. // 外圈背景
  437. ctx.beginPath()
  438. ctx.arc(cx, cy, outerR, 0, Math.PI * 2)
  439. ctx.fillStyle = '#FFF5F7'
  440. ctx.fill()
  441. ctx.strokeStyle = hexToRgba(luckyColor, 0.25)
  442. ctx.lineWidth = 1.5
  443. ctx.stroke()
  444. // 绘制四个方位的扇区
  445. for (var i = 0; i < 4; i++) {
  446. var d = directions[i]
  447. var color = elementColors[d.element]
  448. // 扇区线
  449. ctx.beginPath()
  450. ctx.moveTo(cx, cy)
  451. var ex = cx + outerR * Math.cos(d.angle)
  452. var ey = cy + outerR * Math.sin(d.angle)
  453. ctx.lineTo(ex, ey)
  454. ctx.strokeStyle = hexToRgba(color, 0.19)
  455. ctx.lineWidth = 1
  456. ctx.stroke()
  457. // 方位标签
  458. var labelR = outerR * 0.7
  459. var lx = cx + labelR * Math.cos(d.angle)
  460. var ly = cy + labelR * Math.sin(d.angle)
  461. var isLucky = d.label === luckyDir
  462. if (isLucky) {
  463. // 吉位高亮圆
  464. ctx.beginPath()
  465. ctx.arc(lx, ly, 12, 0, Math.PI * 2)
  466. ctx.fillStyle = hexToRgba(luckyColor, 0.13)
  467. ctx.fill()
  468. ctx.strokeStyle = luckyColor
  469. ctx.lineWidth = 1.5
  470. ctx.stroke()
  471. }
  472. ctx.fillStyle = isLucky ? luckyColor : '#9CA3AF'
  473. ctx.font = (isLucky ? 'bold ' : '') + '10px sans-serif'
  474. ctx.textAlign = 'center'
  475. ctx.textBaseline = 'middle'
  476. ctx.fillText(d.label, lx, ly)
  477. }
  478. // 中心点
  479. ctx.beginPath()
  480. ctx.arc(cx, cy, 5, 0, Math.PI * 2)
  481. ctx.fillStyle = luckyColor
  482. ctx.fill()
  483. ctx.strokeStyle = '#FFFFFF'
  484. ctx.lineWidth = 1.5
  485. ctx.stroke()
  486. },
  487. handleCompassClick: function(e) {
  488. if (!this.isChild || !this.fortune) return
  489. var touch = e.touches && e.touches[0]
  490. if (!touch) return
  491. var self = this
  492. uni.createSelectorQuery().in(this).select('#tianpanCompass').boundingClientRect(function(rect) {
  493. if (!rect) return
  494. var touchX = touch.clientX - rect.left
  495. var touchY = touch.clientY - rect.top
  496. var cx = self._compassW / 2
  497. var cy = self._compassH / 2
  498. var radius = Math.min(cx, cy) - 4
  499. // 判断点击区域
  500. var elements = [
  501. { label: '东', description: '家庭成长力', name: '木' },
  502. { label: '南', description: '温馨家庭情', name: '火' },
  503. { label: '西', description: '和谐人际关系', name: '金' },
  504. { label: '北', description: '智慧与理性', name: '水' },
  505. { label: '中', description: '稳固与安定', name: '土' }
  506. ]
  507. for (var i = 0; i < elements.length; i++) {
  508. var elem = elements[i]
  509. var angle = elem.label === '东' ? 0 : elem.label === '南' ? Math.PI / 2 : elem.label === '西' ? Math.PI : elem.label === '北' ? -Math.PI / 2 : null
  510. if (angle === null) continue
  511. var labelR = radius * 0.7
  512. var lx = cx + labelR * Math.cos(angle)
  513. var ly = cy + labelR * Math.sin(angle)
  514. var dist = Math.sqrt(Math.pow(touchX - lx, 2) + Math.pow(touchY - ly, 2))
  515. if (dist <= 20) {
  516. uni.showModal({
  517. title: elem.name + '·' + elem.label + '方',
  518. content: '这里是家里' + elem.name + '能量最旺的方向!\n' + elem.description + ',记得多在这个方向活动哦~',
  519. confirmText: '知道啦',
  520. showCancel: false,
  521. confirmColor: self.themeColor || '#FF6B9D'
  522. })
  523. break
  524. }
  525. }
  526. }).exec()
  527. }
  528. },
  529. }
  530. </script>
  531. <style scoped>
  532. .tianpan-card {
  533. margin: 20rpx 30rpx;
  534. background: #FFFFFF;
  535. border-radius: 24rpx;
  536. padding: 28rpx 24rpx;
  537. /* 动态主题阴影 */
  538. box-shadow: 0 4rpx 16rpx var(--theme-shadow, rgba(255, 107, 157, 0.12)),
  539. 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
  540. border: 1rpx solid var(--theme-border, rgba(255, 107, 157, 0.08));
  541. overflow: hidden;
  542. }
  543. /* ===== 头部 ===== */
  544. .tp-header {
  545. display: flex;
  546. flex-direction: row;
  547. align-items: center;
  548. justify-content: space-between;
  549. margin-bottom: 24rpx;
  550. padding-bottom: 20rpx;
  551. border-bottom: 1rpx solid var(--theme-border, rgba(255, 107, 157, 0.10));
  552. }
  553. .tp-header-left {
  554. display: flex;
  555. flex-direction: row;
  556. align-items: center;
  557. }
  558. .tp-icon-badge {
  559. width: 64rpx;
  560. height: 64rpx;
  561. border-radius: 20rpx;
  562. background: var(--theme-gradient, linear-gradient(135deg, #FF6B9D, #FF8FB1));
  563. display: flex;
  564. align-items: center;
  565. justify-content: center;
  566. margin-right: 16rpx;
  567. box-shadow: 0 4rpx 12rpx var(--theme-shadow, rgba(255, 107, 157, 0.30));
  568. }
  569. .tp-icon-text {
  570. font-size: 32rpx;
  571. color: #FFFFFF;
  572. }
  573. .tp-header-info {
  574. display: flex;
  575. flex-direction: column;
  576. }
  577. .tp-title {
  578. font-size: 30rpx;
  579. font-weight: 700;
  580. color: #1E293B;
  581. }
  582. .tp-subtitle {
  583. font-size: 22rpx;
  584. color: #94A3B8;
  585. margin-top: 2rpx;
  586. }
  587. .tp-header-action {
  588. width: 56rpx;
  589. height: 56rpx;
  590. border-radius: 28rpx;
  591. background: var(--theme-lighter, #FFF0F3);
  592. display: flex;
  593. align-items: center;
  594. justify-content: center;
  595. }
  596. .tp-action-text {
  597. font-size: 28rpx;
  598. color: var(--theme-color, #FF6B9D);
  599. font-weight: 600;
  600. }
  601. .tp-header-action:active {
  602. opacity: 0.7;
  603. }
  604. /* ===== 三栏 body ===== */
  605. .tp-body {
  606. display: flex;
  607. flex-direction: row;
  608. justify-content: space-between;
  609. }
  610. .tp-col {
  611. flex: 1;
  612. display: flex;
  613. flex-direction: column;
  614. align-items: center;
  615. padding: 16rpx 8rpx;
  616. border-radius: 20rpx;
  617. background: #FAFBFC;
  618. }
  619. .tp-col-fortune {
  620. margin-right: 12rpx;
  621. }
  622. .tp-col-mood {
  623. margin-left: 6rpx;
  624. margin-right: 6rpx;
  625. }
  626. .tp-col-direction {
  627. margin-left: 12rpx;
  628. }
  629. /* 列通用 */
  630. .tp-col-icon {
  631. font-size: 36rpx;
  632. margin-bottom: 8rpx;
  633. }
  634. .tp-col-label {
  635. font-size: 22rpx;
  636. color: #94A3B8;
  637. margin-bottom: 12rpx;
  638. font-weight: 500;
  639. }
  640. /* 运势 */
  641. .tp-fortune-badge {
  642. padding: 6rpx 20rpx;
  643. border-radius: 20rpx;
  644. margin-bottom: 8rpx;
  645. }
  646. .fortune-level-0 {
  647. background: #FFEBEE;
  648. }
  649. .fortune-level-0 .tp-fortune-text {
  650. color: #D32F2F;
  651. }
  652. .fortune-level-1 {
  653. background: #FFF3E0;
  654. }
  655. .fortune-level-1 .tp-fortune-text {
  656. color: #E65100;
  657. }
  658. .fortune-level-2 {
  659. background: #FFFDE7;
  660. }
  661. .fortune-level-2 .tp-fortune-text {
  662. color: #F9A825;
  663. }
  664. .fortune-level-3 {
  665. background: #F3E5F5;
  666. }
  667. .fortune-level-3 .tp-fortune-text {
  668. color: #7B1FA2;
  669. }
  670. .fortune-level-4 {
  671. background: #FFCDD2;
  672. }
  673. .fortune-level-4 .tp-fortune-text {
  674. color: #B71C1C;
  675. }
  676. .tp-fortune-text {
  677. font-size: 26rpx;
  678. font-weight: 700;
  679. }
  680. .tp-fortune-desc {
  681. font-size: 20rpx;
  682. color: #94A3B8;
  683. text-align: center;
  684. line-height: 1.4;
  685. }
  686. /* 心情 */
  687. .tp-mood-value {
  688. font-size: 26rpx;
  689. font-weight: 600;
  690. color: #1E293B;
  691. margin-bottom: 10rpx;
  692. }
  693. .tp-mood-bar-track {
  694. width: 100%;
  695. height: 10rpx;
  696. background: #E2E8F0;
  697. border-radius: 5rpx;
  698. overflow: hidden;
  699. }
  700. .tp-mood-bar-fill {
  701. height: 100%;
  702. background: var(--theme-gradient, linear-gradient(90deg, #FF6B9D, #FF8FB1));
  703. border-radius: 5rpx;
  704. transition: width 0.5s;
  705. }
  706. /* 吉位罗盘 */
  707. .tp-compass-wrap {
  708. width: 120rpx;
  709. height: 120rpx;
  710. margin-bottom: 8rpx;
  711. }
  712. .tp-compass-canvas {
  713. width: 120rpx;
  714. height: 120rpx;
  715. }
  716. .tp-direction-value {
  717. font-size: 24rpx;
  718. font-weight: 700;
  719. color: var(--theme-color, #FF6B9D);
  720. }
  721. /* ===== 底部提示 ===== */
  722. .tp-footer {
  723. display: flex;
  724. flex-direction: row;
  725. align-items: flex-start;
  726. margin-top: 20rpx;
  727. padding: 16rpx;
  728. background: var(--theme-lighter, #FFF5F0);
  729. border-radius: 14rpx;
  730. }
  731. .tp-footer-icon {
  732. font-size: 24rpx;
  733. margin-right: 8rpx;
  734. flex-shrink: 0;
  735. }
  736. .tp-footer-text {
  737. font-size: 22rpx;
  738. color: #8B6914;
  739. line-height: 1.5;
  740. flex: 1;
  741. }
  742. /* ===== 今日宜忌 ===== */
  743. .tp-advice-section {
  744. margin: 20rpx 0;
  745. padding: 16rpx;
  746. background-color: rgba(255, 255, 255, 0.7);
  747. border-radius: 16rpx;
  748. }
  749. .tp-advice-item {
  750. display: flex;
  751. flex-direction: row;
  752. align-items: center;
  753. margin-bottom: 10rpx;
  754. }
  755. .tp-advice-item:last-child {
  756. margin-bottom: 0;
  757. }
  758. .tp-advice-icon {
  759. font-size: 24rpx;
  760. color: var(--theme-color, #FF6B9D);
  761. margin-right: 12rpx;
  762. }
  763. .tp-advice-label {
  764. font-size: 22rpx;
  765. font-weight: 600;
  766. color: var(--theme-color, #FF6B9D);
  767. margin-right: 12rpx;
  768. min-width: 60rpx;
  769. }
  770. .tp-advice-text {
  771. font-size: 22rpx;
  772. color: #374151;
  773. flex: 1;
  774. line-height: 1.4;
  775. }
  776. /* ===== 查看详情按钮 ===== */
  777. .tp-detail-btn {
  778. margin-top: 16rpx;
  779. text-align: center;
  780. padding: 14rpx;
  781. background: var(--theme-lighter, linear-gradient(135deg, #FFF0F3, #FFE0E8));
  782. border-radius: 14rpx;
  783. }
  784. .tp-detail-btn:active {
  785. opacity: 0.7;
  786. }
  787. .tp-detail-text {
  788. font-size: 24rpx;
  789. color: var(--theme-color, #FF6B9D);
  790. font-weight: 600;
  791. }
  792. /* ===== 传统文化信息 ===== */
  793. .tp-traditional {
  794. margin-top: 20rpx;
  795. padding-top: 20rpx;
  796. border-top: 1rpx solid var(--theme-border, rgba(255, 107, 157, 0.10));
  797. }
  798. .tp-trad-row {
  799. display: flex;
  800. flex-direction: row;
  801. flex-wrap: wrap;
  802. margin-bottom: 16rpx;
  803. }
  804. .tp-trad-item {
  805. display: flex;
  806. flex-direction: column;
  807. align-items: center;
  808. flex: 1;
  809. min-width: 120rpx;
  810. margin-bottom: 8rpx;
  811. }
  812. .tp-trad-label {
  813. font-size: 20rpx;
  814. color: #94A3B8;
  815. margin-bottom: 6rpx;
  816. }
  817. .tp-trad-value {
  818. font-size: 26rpx;
  819. font-weight: 600;
  820. color: var(--theme-color, #FF6B9D);
  821. }
  822. .tp-trad-bar-track {
  823. width: 80%;
  824. height: 8rpx;
  825. background: #E2E8F0;
  826. border-radius: 4rpx;
  827. overflow: hidden;
  828. margin-bottom: 4rpx;
  829. }
  830. .tp-trad-bar-fill {
  831. height: 100%;
  832. border-radius: 4rpx;
  833. }
  834. .tp-trad-val {
  835. font-size: 20rpx;
  836. color: #64748B;
  837. }
  838. .tp-trad-row-split {
  839. justify-content: space-around;
  840. }
  841. .tp-trad-tag {
  842. display: flex;
  843. flex-direction: row;
  844. align-items: center;
  845. background: var(--theme-lighter, #FFF0F3);
  846. padding: 8rpx 20rpx;
  847. border-radius: 20rpx;
  848. }
  849. .tp-trad-tag-icon {
  850. font-size: 24rpx;
  851. margin-right: 8rpx;
  852. }
  853. .tp-trad-tag-text {
  854. font-size: 24rpx;
  855. font-weight: 600;
  856. color: var(--theme-color, #FF6B9D);
  857. }
  858. </style>