index.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418
  1. <template>
  2. <view class="page-chart">
  3. <!-- Top operation bar -->
  4. <view class="top-bar">
  5. <view class="spacer"></view>
  6. <view v-if="userStore.isVip" class="export-btn" @click="exportPdf">
  7. 导出PDF
  8. </view>
  9. </view>
  10. <!-- Triangle chart -->
  11. <view class="chart-section">
  12. <TriangleChart
  13. :chartData="store.currentChart"
  14. :birthYear="store.currentBirthYear"
  15. :birthMonth="store.currentBirthMonth"
  16. :birthDay="store.currentBirthDay"
  17. :recordId="store.currentRecordId"
  18. :annotations="annotations"
  19. :tags="allTags"
  20. @annotation-add="onAnnotationAdd"
  21. @annotation-delete="onAnnotationDelete"
  22. @tag-create="onTagCreate"
  23. />
  24. </view>
  25. <!-- Menu button (regenerate + share info) -->
  26. <view class="menu-bar">
  27. <text class="menu-btn" @click="showMenu">···</text>
  28. </view>
  29. <!-- US-3.1: AI Interpretation section -->
  30. <view class="interpret-bar">
  31. <button class="interpret-btn" :disabled="interpreting" @click="fetchInterpret">
  32. {{ interpreting ? '解读生成中...' : '🔮 查看AI解读' }}
  33. </button>
  34. </view>
  35. <!-- US-3.1: Interpretation panel -->
  36. <view v-if="interpretData" id="interpret-section" class="interpret-panel">
  37. <view
  38. v-for="(section, key) in interpretData"
  39. :key="key"
  40. class="interpret-card"
  41. :class="{ expanded: interpretExpanded[key] }"
  42. @click="toggleInterpretSection(key)"
  43. >
  44. <view class="interpret-card-header">
  45. <text class="interpret-num-badge">{{ section.number }}</text>
  46. <text class="interpret-card-title">{{ section.title }}</text>
  47. <text class="interpret-toggle">{{ interpretExpanded[key] ? '▾' : '▸' }}</text>
  48. </view>
  49. <view v-show="interpretExpanded[key]" class="interpret-card-body">
  50. <text class="interpret-content">{{ section.content }}</text>
  51. </view>
  52. </view>
  53. <!-- Disclaimer -->
  54. <view class="interpret-disclaimer">
  55. <text class="disclaimer-text">本解读由AI生成,仅供参考</text>
  56. </view>
  57. </view>
  58. <!-- Loading skeleton -->
  59. <view v-if="interpreting" class="interpret-skeleton">
  60. <view v-for="n in 4" :key="n" class="skeleton-card">
  61. <view class="skeleton-header"></view>
  62. <view v-if="n === 1" class="skeleton-body">
  63. <view class="skeleton-line"></view>
  64. <view class="skeleton-line short"></view>
  65. <view class="skeleton-line"></view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- US-9.1: Academic orientation button -->
  70. <view class="academic-bar">
  71. <button class="academic-btn" :disabled="academicLoading" @click="fetchAcademicOrientation">
  72. {{ academicLoading ? '分析生成中...' : '🎓 学业方向分析' }}
  73. </button>
  74. <text v-if="!userStore.isVipActive && maxAcademic > 0" class="academic-quota">
  75. 今日 {{ usedAcademic }}/{{ maxAcademic }} 次
  76. </text>
  77. </view>
  78. <!-- US-2.1: Share bar -->
  79. <view class="share-bar">
  80. <button class="share-btn" :disabled="shareGenerating" @click="onShareTap">
  81. {{ shareGenerating ? '生成中...' : '📸 分享命盘' }}
  82. </button>
  83. <text v-if="!userStore.isVipActive" class="share-quota">
  84. 今日剩余 {{ shareRemaining }} 次
  85. </text>
  86. </view>
  87. <!-- US-9.1: Academic orientation panel -->
  88. <view v-if="academicData" id="academic-section" class="academic-panel">
  89. <view class="academic-section-title">🎯 学业方向深度分析</view>
  90. <view
  91. v-for="(section, key) in academicData"
  92. :key="key"
  93. class="academic-card"
  94. :class="{ expanded: academicExpanded[key], talent: key==='talentTendency', direction: key==='suitableDirection', learning: key==='learningStyle', parenting: key==='parentingAdvice', periods: key==='keyPeriods' }"
  95. @click="toggleAcademicSection(key)"
  96. >
  97. <view class="academic-card-header">
  98. <text class="academic-card-title">{{ section.title }}</text>
  99. <text class="academic-toggle">{{ academicExpanded[key] ? '▾' : '▸' }}</text>
  100. </view>
  101. <view v-show="academicExpanded[key]" class="academic-card-body">
  102. <text class="academic-content">{{ section.content }}</text>
  103. <view v-if="section.matchPercentages" class="match-bars">
  104. <view v-for="(pct, dir) in section.matchPercentages" :key="dir" class="match-row">
  105. <text class="match-label">{{ dir }}</text>
  106. <view class="match-track">
  107. <view class="match-fill" :style="{ width: pct + '%' }" :class="'pct-' + pct"></view>
  108. </view>
  109. <text class="match-value">{{ pct }}%</text>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="academic-disclaimer">
  115. <text class="disclaimer-text">💡 以上分析由AI生成,如需人工深度方案,可申请能量师出方案</text>
  116. </view>
  117. </view>
  118. <!-- US-9.1: Loading skeleton -->
  119. <view v-if="academicLoading" class="academic-skeleton">
  120. <view v-for="n in 3" :key="n" class="skeleton-card">
  121. <view class="skeleton-header"></view>
  122. <view v-if="n === 1" class="skeleton-body">
  123. <view class="skeleton-line"></view><view class="skeleton-line short"></view><view class="skeleton-line"></view>
  124. </view>
  125. </view>
  126. </view>
  127. <!-- US-9.1: Academic quota exceeded upgrade card -->
  128. <view v-if="quotaAcademicExceeded && !academicData && !academicLoading" class="academic-upgrade-card">
  129. <text class="academic-upgrade-title">🎓 学业方向分析</text>
  130. <text class="academic-upgrade-desc">今日学业分析次数已用完,开通会员享无限次</text>
  131. <button class="academic-upgrade-btn" @click="goSubscribeC">开通会员 ¥131/年</button>
  132. </view>
  133. <!-- AI Chat -->
  134. <view class="chat-section">
  135. <view class="section-title">
  136. <text class="title-icon">◈</text>
  137. AI 解读
  138. <text v-if="!userStore.isVipActive && maxChats > 0" class="quota-badge">
  139. 今日 {{ usedChats }}/{{ maxChats }} 轮
  140. </text>
  141. <text v-if="userStore.isVipActive" class="quota-badge vip">无限次</text>
  142. </view>
  143. <scroll-view class="chat-box" scroll-y :scroll-top="scrollTop">
  144. <view v-for="(msg, idx) in messages" :key="idx" class="msg-row" :class="msg.role">
  145. <view class="msg-bubble">
  146. <text>{{ msg.content }}</text>
  147. </view>
  148. </view>
  149. </scroll-view>
  150. <!-- Quota exceeded prompt for non-VIP -->
  151. <view v-if="quotaExceeded" class="upgrade-prompt">
  152. <text class="upgrade-text">今日 AI 解读次数已用完</text>
  153. <text class="upgrade-desc">选择适合的会员方案,解锁无限次解读</text>
  154. <view class="upgrade-actions">
  155. <button class="upgrade-btn secondary" @click="goSubscribeC">C端会员 ¥131/年</button>
  156. <button class="upgrade-btn" @click="goSubscribe">能量师 ¥1,314/年</button>
  157. </view>
  158. </view>
  159. <!-- Share hint (non-intrusive) -->
  160. <view v-if="shareRemaining > 0 && !userStore.isVipActive" class="share-hint">
  161. <text class="share-hint-text">分享好友可解锁更多次数 · 今日剩余 {{ shareRemaining }} 次</text>
  162. </view>
  163. <!-- Input area — always visible, shows upgrade prompt on 4th click -->
  164. <view class="input-bar">
  165. <input
  166. class="chat-input"
  167. v-model="chatInput"
  168. :placeholder="quotaExceeded ? '今日次数已用完,点击发送开通会员' : '输入您的问题...'"
  169. @confirm="sendQuestion(chatInput)"
  170. :disabled="loading"
  171. />
  172. <button class="send-btn" @click="sendQuestion(chatInput)" :disabled="loading">
  173. {{ loading ? '···' : '发送' }}
  174. </button>
  175. </view>
  176. <!-- US-6.6: Subscription card for free users / 已开通 badge for paid -->
  177. <view v-if="userStore.isLoggedIn" class="subscribe-section">
  178. <!-- Annual paid user — always show badge -->
  179. <view v-if="userStore.vipType === 'annual'" class="vip-badge-bar">
  180. <text class="vip-badge-text">✅ 已开通AI解读</text>
  181. <text class="vip-badge-expiry" v-if="userStore.vipEndTime">有效期至 {{ userStore.vipEndTime.slice(0, 10) }}</text>
  182. <text class="vip-poster-link" @click="goPoster">📱 生成推广海报</text>
  183. </view>
  184. <!-- Practitioner paid user — always show badge -->
  185. <view v-else-if="userStore.vipType === 'practitioner'" class="vip-badge-bar pro">
  186. <text class="vip-badge-text">✅ 已开通能量师</text>
  187. <text class="vip-badge-expiry" v-if="userStore.vipEndTime">有效期至 {{ userStore.vipEndTime.slice(0, 10) }}</text>
  188. </view>
  189. <!-- Free user — subscription card only when quota exceeded -->
  190. <view v-else-if="quotaExceeded" class="subscribe-card">
  191. <text class="subscribe-title">🔮 AI解读会员</text>
  192. <text class="subscribe-desc">¥131/年 · 无限AI解读 · 个性化报告 · 推广赚佣金</text>
  193. <view class="subscribe-actions">
  194. <button class="subscribe-btn" @click="goSubscribeC">立即开通 ¥131</button>
  195. <text class="subscribe-link" @click="goSubscribe">了解能量师专业版</text>
  196. </view>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. <!-- Share canvas (hidden off-screen) -->
  202. <ChartShareCanvas
  203. ref="shareCanvas"
  204. :chart="store.currentChart || {}"
  205. :name="store.currentName"
  206. :birthday="store.currentBirthYear && store.currentBirthMonth && store.currentBirthDay ?
  207. `${store.currentBirthYear}-${String(store.currentBirthMonth).padStart(2,'0')}-${String(store.currentBirthDay).padStart(2,'0')}` : ''"
  208. @ready="onCanvasReady"
  209. />
  210. </template>
  211. <script>
  212. // Page lifecycle hooks (needed for WeChat share)
  213. export default {
  214. onShareAppMessage() {
  215. const pages = getCurrentPages()
  216. const page = pages[pages.length - 1]
  217. const recordId = page?.options?.recordId || ''
  218. const store = this.$scope?.store
  219. const title = store?.currentChart?.O
  220. ? `我的命盘主性格数字是${store.currentChart.O},快来测测你的!`
  221. : '数字能量命盘分析'
  222. return {
  223. title,
  224. path: `/pages/chart/index?recordId=${recordId}`,
  225. imageUrl: '/static/share-card.png'
  226. }
  227. },
  228. onShareTimeline() {
  229. const pages = getCurrentPages()
  230. const page = pages[pages.length - 1]
  231. const recordId = page?.options?.recordId || ''
  232. return {
  233. title: '数字能量命盘分析',
  234. query: `recordId=${recordId}`,
  235. imageUrl: '/static/share-card.png'
  236. }
  237. }
  238. }
  239. </script>
  240. <script setup>
  241. import { ref, computed, onMounted, onUnmounted } from 'vue'
  242. import { useChartStore } from '@/stores/chart'
  243. import { useUserStore } from '@/stores/user'
  244. import TriangleChart from '@/components/TriangleChart.vue'
  245. import ChartShareCanvas from '@/components/ChartShareCanvas.vue'
  246. import { chartApi, chatApi, consultationApi, profileApi, annotationApi, exportApi } from '@/utils/api'
  247. const store = useChartStore()
  248. const userStore = useUserStore()
  249. const chatInput = ref('')
  250. const scrollTop = ref(0)
  251. const messages = ref([])
  252. const loading = ref(false)
  253. const usedChats = ref(0)
  254. const maxChats = ref(0)
  255. const usedAcademic = ref(0)
  256. const maxAcademic = ref(0)
  257. // Share canvas ref
  258. const shareCanvas = ref(null)
  259. const shareGenerating = ref(false)
  260. // Annotation / Tag state (US-7.1 / US-7.2)
  261. const annotations = ref([])
  262. const allTags = ref([])
  263. // US-3.1: AI interpretation state
  264. const interpretData = ref(null)
  265. const interpreting = ref(false)
  266. const interpretExpanded = ref({})
  267. // US-9.1: Academic orientation state
  268. const academicData = ref(null)
  269. const academicLoading = ref(false)
  270. const academicExpanded = ref({})
  271. // US-2.1: Share state
  272. const shareGenerating = ref(false)
  273. const showShareActions = ref(false)
  274. const quotaExceeded = computed(() => {
  275. if (userStore.isVipActive) return false
  276. return maxChats.value > 0 && usedChats.value >= maxChats.value
  277. })
  278. const shareRemaining = computed(() => {
  279. if (userStore.isVipActive) return -1
  280. const limit = userStore.shareLimit || 1
  281. const count = userStore.shareCount || 0
  282. return limit > 0 ? Math.max(0, limit - count) : 0
  283. })
  284. const quotaAcademicExceeded = computed(() => {
  285. if (userStore.isVipActive) return false
  286. return maxAcademic.value > 0 && usedAcademic.value >= maxAcademic.value
  287. })
  288. onMounted(async () => {
  289. try {
  290. await userStore.fetchQuota()
  291. } catch (e) { /* ignore */ }
  292. // URL shareability — load from recordId if no store state (US-1.1 §14)
  293. const pages = getCurrentPages()
  294. const currentPage = pages[pages.length - 1]
  295. const recordId = currentPage?.options?.recordId
  296. if (!store.currentChart && recordId) {
  297. try {
  298. await store.loadChart(Number(recordId))
  299. } catch (e) {
  300. // fall through to "no data" message
  301. }
  302. }
  303. if (store.currentChart) {
  304. maxChats.value = userStore.maxChats || 3
  305. usedChats.value = userStore.usedChats || 0
  306. usedAcademic.value = userStore.usedAcademic || 0
  307. maxAcademic.value = userStore.maxAcademic || 1
  308. // Load annotations and tags for this record (US-7.1/7.2)
  309. if (store.currentRecordId) {
  310. loadAnnotations()
  311. }
  312. // Use consultationMessages from store (set during startConsultation) if available
  313. if (store.consultationMessages && store.consultationMessages.length > 0) {
  314. messages.value = store.consultationMessages.map(m => ({
  315. role: m.role === 'ai' ? 'ai' : 'user',
  316. content: m.content
  317. }))
  318. } else if (store.currentRecordId) {
  319. try {
  320. const history = await chatApi.history(store.currentRecordId)
  321. messages.value = history.map(m => ({
  322. role: m.role === 'ai' ? 'ai' : 'user',
  323. content: m.content
  324. }))
  325. const userMsgCount = history.filter(m => m.role === 'user').length
  326. usedChats.value = Math.max(usedChats.value, userMsgCount)
  327. } catch (e) {
  328. // fallback to generic greeting
  329. }
  330. }
  331. // Ensure at least a greeting message if still empty
  332. if (messages.value.length === 0) {
  333. messages.value = [{
  334. role: 'ai',
  335. content: `已为您生成命盘。主性格数字为${store.currentChart.O}。请点击下方问题或输入您想了解的内容。`
  336. }]
  337. }
  338. } else {
  339. messages.value = [{
  340. role: 'ai',
  341. content: '暂无命盘数据,请先返回首页输入出生信息。'
  342. }]
  343. }
  344. })
  345. // US-3.1: Fetch AI structured interpretation
  346. async function fetchInterpret() {
  347. if (!store.currentRecordId) {
  348. uni.showToast({ title: '暂无命盘数据', icon: 'none' })
  349. return
  350. }
  351. // If already loaded, just scroll to it
  352. if (interpretData.value) {
  353. scrollToInterpret()
  354. return
  355. }
  356. interpreting.value = true
  357. try {
  358. const data = await chartApi.interpret(store.currentRecordId)
  359. interpretData.value = data
  360. // Auto-expand the main character section
  361. interpretExpanded.value = { mainCharacter: true }
  362. uni.showToast({ title: '解读已生成', icon: 'success' })
  363. scrollToInterpret()
  364. } catch (e) {
  365. uni.showToast({ title: e.message || '解读生成失败', icon: 'none' })
  366. } finally {
  367. interpreting.value = false
  368. }
  369. }
  370. function scrollToInterpret() {
  371. // Scroll to the interpret section after rendering
  372. uni.createSelectorQuery().select('#interpret-section').boundingClientRect(res => {
  373. if (res) {
  374. uni.pageScrollTo({ scrollTop: res.top - 20, duration: 300 })
  375. }
  376. }).exec()
  377. }
  378. function toggleInterpretSection(key) {
  379. interpretExpanded.value[key] = !interpretExpanded.value[key]
  380. }
  381. // US-9.1: Fetch academic orientation
  382. async function fetchAcademicOrientation() {
  383. if (!store.currentRecordId) {
  384. uni.showToast({ title: '暂无命盘数据', icon: 'none' })
  385. return
  386. }
  387. if (academicData.value) {
  388. scrollToAcademic()
  389. return
  390. }
  391. if (quotaAcademicExceeded.value) {
  392. uni.showToast({ title: '今日学业分析次数已用完', icon: 'none' })
  393. return
  394. }
  395. academicLoading.value = true
  396. try {
  397. const data = await chartApi.academicOrientation(store.currentRecordId)
  398. academicData.value = data
  399. academicExpanded.value = { talentTendency: true }
  400. usedAcademic.value++
  401. userStore.usedAcademic = usedAcademic.value
  402. uni.showToast({ title: '分析已生成', icon: 'success' })
  403. scrollToAcademic()
  404. } catch (e) {
  405. if (e.code === 1008) {
  406. usedAcademic.value = maxAcademic.value
  407. userStore.usedAcademic = maxAcademic.value
  408. }
  409. uni.showToast({ title: e.message || '分析生成失败', icon: 'none' })
  410. } finally {
  411. academicLoading.value = false
  412. }
  413. }
  414. function scrollToAcademic() {
  415. uni.createSelectorQuery().select('#academic-section').boundingClientRect(res => {
  416. if (res) uni.pageScrollTo({ scrollTop: res.top - 20, duration: 300 })
  417. }).exec()
  418. }
  419. function toggleAcademicSection(key) {
  420. academicExpanded.value[key] = !academicExpanded.value[key]
  421. }
  422. async function sendQuestion(q) {
  423. if (!q.trim() || loading.value) return
  424. if (quotaExceeded.value) {
  425. // Show upgrade prompt instead of sending
  426. uni.showModal({
  427. title: '今日解读次数已用完',
  428. content: '开通 VIP 会员享无限次 AI 解读,或分享好友获取额外次数',
  429. confirmText: '开通会员',
  430. cancelText: '分享好友',
  431. success: (res) => {
  432. if (res.confirm) {
  433. goSubscribeC()
  434. } else {
  435. triggerShare()
  436. }
  437. }
  438. })
  439. return
  440. }
  441. messages.value.push({ role: 'user', content: q })
  442. chatInput.value = ''
  443. loading.value = true
  444. try {
  445. if (store.currentRecordId) {
  446. const res = await chatApi.send({ chartRecordId: store.currentRecordId, query: q })
  447. messages.value.push({ role: 'ai', content: res.reply })
  448. usedChats.value++
  449. } else {
  450. messages.value.push({
  451. role: 'ai',
  452. content: `数字能量分析显示,${q}方面您的能量组合表明有良好的发展潜力,请结合自身情况理性决策。`
  453. })
  454. }
  455. } catch (e) {
  456. if (e.code === 1008) {
  457. usedChats.value = maxChats.value
  458. messages.value.push({
  459. role: 'ai',
  460. content: '今日解读次数已用完,开通会员可享无限次解读。'
  461. })
  462. } else {
  463. messages.value.push({
  464. role: 'ai',
  465. content: e.message || '解读服务暂时不可用,请稍后再试。'
  466. })
  467. }
  468. }
  469. loading.value = false
  470. scrollTop.value = 99999
  471. }
  472. // US-3.3: Regenerate interpretation via action sheet menu
  473. function showMenu() {
  474. const items = ['🔄 重新生成解读']
  475. // US-2.2: PDF export for paid users only
  476. if (userStore.isVipActive) {
  477. items.push('📄 导出 PDF')
  478. }
  479. if (!userStore.isVipActive && shareRemaining.value > 0) {
  480. items.push('📤 分享给好友')
  481. }
  482. items.push('❌ 取消')
  483. uni.showActionSheet({
  484. itemList: items,
  485. success: async (res) => {
  486. if (res.tapIndex === 0) {
  487. await confirmRegenerate()
  488. } else if (res.tapIndex === 1) {
  489. if (items[1] === '📄 导出 PDF') {
  490. await exportPdf()
  491. } else if (items[1] === '📤 分享给好友') {
  492. await triggerShare()
  493. }
  494. } else if (res.tapIndex === 2 && items[2] === '📤 分享给好友') {
  495. await triggerShare()
  496. }
  497. }
  498. })
  499. }
  500. async function confirmRegenerate() {
  501. uni.showModal({
  502. title: '重新生成解读',
  503. content: '将清除当前对话记录并生成全新的AI解读,确定吗?',
  504. success: async (confirm) => {
  505. if (!confirm.confirm) return
  506. if (!store.currentRecordId) {
  507. uni.showToast({ title: '暂无命盘数据', icon: 'none' })
  508. return
  509. }
  510. try {
  511. uni.showLoading({ title: '重新生成中...' })
  512. const newMessages = await consultationApi.regenerate(store.currentRecordId)
  513. messages.value = (newMessages || []).map(m => ({
  514. role: m.role === 'ai' ? 'ai' : 'user',
  515. content: m.content
  516. }))
  517. // Reset chat counters
  518. usedChats.value = 0
  519. uni.hideLoading()
  520. uni.showToast({ title: '解读已重新生成', icon: 'success' })
  521. scrollTop.value = 99999
  522. } catch (e) {
  523. uni.hideLoading()
  524. uni.showToast({ title: '重新生成失败,请重试', icon: 'none' })
  525. }
  526. }
  527. })
  528. }
  529. // US-2.1: Track share and update quota
  530. async function triggerShare() {
  531. uni.showShareMenu({
  532. withShareTicket: true,
  533. menus: ['shareAppMessage', 'shareTimeline'],
  534. success: async () => {
  535. // Call backend to track share
  536. try {
  537. const result = await profileApi.trackShare()
  538. shareCount.value = result.dailyShareCount || shareCount.value + 1
  539. } catch (e) { /* best-effort */ }
  540. }
  541. })
  542. }
  543. // US-2.2: Export PDF report
  544. async function exportPdf() {
  545. if (!store.currentRecordId) {
  546. uni.showToast({ title: '暂无命盘数据', icon: 'none' })
  547. return
  548. }
  549. uni.showLoading({ title: '正在生成 PDF...' })
  550. try {
  551. // The API returns a PDF binary. We use uni.downloadFile to get it as a temp file.
  552. const token = uni.getStorageSync('token')
  553. const url = 'http://127.0.0.1:8186/api/export/pdf'
  554. const downloadRes = await new Promise((resolve, reject) => {
  555. uni.downloadFile({
  556. url,
  557. header: { Authorization: `Bearer ${token}` },
  558. method: 'POST',
  559. data: { recordId: store.currentRecordId },
  560. success: resolve,
  561. fail: reject
  562. })
  563. })
  564. if (downloadRes.statusCode !== 200) {
  565. throw new Error('下载失败')
  566. }
  567. uni.hideLoading()
  568. // Open the PDF file
  569. uni.openDocument({
  570. filePath: downloadRes.tempFilePath,
  571. success: () => {
  572. uni.showToast({ title: 'PDF 已生成', icon: 'success' })
  573. },
  574. fail: () => {
  575. uni.showToast({ title: '打开文件失败', icon: 'none' })
  576. }
  577. })
  578. } catch (e) {
  579. uni.hideLoading()
  580. uni.showToast({ title: e.message || '导出失败', icon: 'none' })
  581. }
  582. }
  583. function goSubscribe() {
  584. uni.navigateTo({ url: '/pages/subscribe/index' })
  585. }
  586. function goSubscribeC() {
  587. uni.navigateTo({ url: '/pages/payment/index?product=annual' })
  588. }
  589. function goPoster() {
  590. uni.navigateTo({ url: '/pages/subscribe/index' })
  591. }
  592. // US-2.1: Share chart image
  593. async function onShareTap() {
  594. if (shareGenerating.value) return
  595. // Check quota for non-VIP
  596. if (!userStore.isVipActive && shareRemaining.value <= 0) {
  597. uni.showToast({ title: '今日分享次数已用完', icon: 'none' })
  598. return
  599. }
  600. // Show action sheet
  601. uni.showActionSheet({
  602. itemList: ['保存到相册', '分享给微信好友', '分享到朋友圈'],
  603. success: async (res) => {
  604. await performShare(res.tapIndex)
  605. },
  606. fail: (err) => {
  607. if (err.errMsg && err.errMsg.includes('cancel')) return
  608. uni.showToast({ title: '操作取消', icon: 'none' })
  609. }
  610. })
  611. }
  612. async function performShare(actionIndex) {
  613. shareGenerating.value = true
  614. try {
  615. // Consume quota if not VIP
  616. if (!userStore.isVipActive) {
  617. try {
  618. await profileApi.trackShare()
  619. // Optimistically update local store
  620. userStore.shareCount++
  621. } catch (e) {
  622. uni.showToast({ title: '分享次数不足', icon: 'none' })
  623. shareGenerating.value = false
  624. return
  625. }
  626. }
  627. // Generate image via canvas
  628. if (!shareCanvas.value) throw new Error('Canvas未就绪')
  629. const filePath = await shareCanvas.value.generate()
  630. if (actionIndex === 0) {
  631. // Save to album
  632. await uni.saveImageToPhotosAlbum({ filePath })
  633. uni.showToast({ title: '已保存到相册', icon: 'success' })
  634. } else {
  635. // Share via WeChat
  636. const scene = actionIndex === 1 ? 'WXSceneSession' : 'WXSceneTimeline'
  637. const title = store.currentChart?.O
  638. ? `我的命盘主性格数字是${store.currentChart.O},快来测测你的!`
  639. : '数字能量命盘分析'
  640. await uni.share({
  641. provider: 'weixin',
  642. scene,
  643. type: 'image',
  644. imageUrl: filePath,
  645. title
  646. })
  647. }
  648. } catch (e) {
  649. uni.showToast({ title: e.message || '分享失败', icon: 'none' })
  650. } finally {
  651. shareGenerating.value = false
  652. }
  653. }
  654. // US-2.2: Export PDF (paid users only)
  655. async function exportPdf() {
  656. if (!store.currentRecordId) {
  657. uni.showToast({ title: '暂无命盘记录', icon: 'none' })
  658. return
  659. }
  660. uni.showLoading({ title: '生成中...' })
  661. try {
  662. const filePath = await exportApi.pdf(store.currentRecordId)
  663. uni.hideLoading()
  664. // Open PDF document
  665. uni.openDocument({
  666. filePath,
  667. success: () => {
  668. uni.showToast({ title: 'PDF 已生成', icon: 'success' })
  669. },
  670. fail: () => {
  671. uni.showToast({ title: '打开文件失败', icon: 'none' })
  672. }
  673. })
  674. } catch (e) {
  675. uni.hideLoading()
  676. uni.showToast({ title: e.message || '导出失败', icon: 'none' })
  677. }
  678. }
  679. }
  680. // Generate image via canvas
  681. if (!shareCanvas.value) throw new Error('Canvas未就绪')
  682. const filePath = await shareCanvas.value.generate()
  683. if (actionIndex === 0) {
  684. // Save to album
  685. await uni.saveImageToPhotosAlbum({ filePath })
  686. uni.showToast({ title: '已保存到相册', icon: 'success' })
  687. } else {
  688. // Share via WeChat
  689. const scene = actionIndex === 1 ? 'WXSceneSession' : 'WXSceneTimeline'
  690. const title = store.currentChart?.O
  691. ? `我的命盘主性格数字是${store.currentChart.O},快来测测你的!`
  692. : '数字能量命盘分析'
  693. await uni.share({
  694. provider: 'weixin',
  695. scene,
  696. type: 'image',
  697. imageUrl: filePath,
  698. title
  699. })
  700. }
  701. } catch (e) {
  702. uni.showToast({ title: e.message || '分享失败', icon: 'none' })
  703. } finally {
  704. shareGenerating.value = false
  705. }
  706. }
  707. // === Annotation / Tag handlers (US-7.1 / US-7.2) ===
  708. async function loadAnnotations() {
  709. if (!store.currentRecordId) return
  710. try {
  711. const [annoList, tagList] = await Promise.all([
  712. annotationApi.list(store.currentRecordId),
  713. annotationApi.listTags(store.currentRecordId)
  714. ])
  715. annotations.value = annoList || []
  716. allTags.value = tagList || []
  717. } catch (e) { /* best-effort */ }
  718. }
  719. async function onAnnotationAdd(data) {
  720. try {
  721. const saved = await annotationApi.add(data)
  722. // Reload annotations to include the new one with server-generated ID
  723. if (store.currentRecordId) {
  724. const annoList = await annotationApi.list(store.currentRecordId)
  725. annotations.value = annoList || []
  726. }
  727. uni.showToast({ title: '批注已保存', icon: 'success' })
  728. } catch (e) {
  729. uni.showToast({ title: '保存失败', icon: 'none' })
  730. }
  731. }
  732. async function onAnnotationDelete(annoId) {
  733. try {
  734. await annotationApi.delete(annoId)
  735. annotations.value = annotations.value.filter(a => a.id !== annoId)
  736. uni.showToast({ title: '批注已删除', icon: 'success' })
  737. } catch (e) {
  738. uni.showToast({ title: '删除失败', icon: 'none' })
  739. }
  740. }
  741. async function onTagCreate(tagData) {
  742. try {
  743. const saved = await annotationApi.addTag({ ...tagData, recordId: store.currentRecordId })
  744. if (store.currentRecordId) {
  745. const tagList = await annotationApi.listTags(store.currentRecordId)
  746. allTags.value = tagList || []
  747. }
  748. uni.showToast({ title: '标签已创建', icon: 'success' })
  749. } catch (e) {
  750. uni.showToast({ title: '创建失败', icon: 'none' })
  751. }
  752. }
  753. </script>
  754. <style scoped lang="scss">
  755. .page-chart {
  756. height: 100vh;
  757. display: flex;
  758. flex-direction: column;
  759. overflow: hidden;
  760. background: linear-gradient(180deg, #0c0a1a 0%, #120d28 50%, #0f0c1e 100%);
  761. }
  762. /* Top operation bar */
  763. .top-bar {
  764. display: flex;
  765. justify-content: flex-end;
  766. align-items: center;
  767. padding: 8px 12px;
  768. background: rgba(0,0,0,0.15);
  769. }
  770. .spacer {
  771. flex: 1;
  772. }
  773. .export-btn {
  774. font-size: 13px;
  775. color: #fbbf24;
  776. padding: 6px 12px;
  777. border: 1px solid rgba(251,191,36,0.3);
  778. border-radius: 8px;
  779. }
  780. .chart-section {
  781. flex-shrink: 0;
  782. margin: 0 14px;
  783. }
  784. /* Menu bar — three-dot button */
  785. .menu-bar {
  786. display: flex;
  787. justify-content: flex-end;
  788. padding: 0 14px;
  789. margin: -8px 0 0;
  790. }
  791. .menu-btn {
  792. width: 32px;
  793. height: 28px;
  794. display: flex;
  795. align-items: center;
  796. justify-content: center;
  797. font-size: 20px;
  798. font-weight: 700;
  799. color: rgba(255, 255, 255, 0.4);
  800. letter-spacing: 2px;
  801. border-radius: 6px;
  802. background: rgba(255, 255, 255, 0.04);
  803. }
  804. .menu-btn:active {
  805. background: rgba(255, 255, 255, 0.08);
  806. }
  807. /* US-3.1: Interpret button bar */
  808. .interpret-bar {
  809. flex-shrink: 0;
  810. margin: 0 14px 10px;
  811. }
  812. .interpret-btn {
  813. width: 100%;
  814. height: 44px;
  815. background: linear-gradient(135deg, #7c3aed, #6366f1);
  816. color: #fff;
  817. border: none;
  818. border-radius: 12px;
  819. line-height: 44px;
  820. font-size: 15px;
  821. font-weight: 600;
  822. letter-spacing: 1px;
  823. }
  824. .interpret-btn[disabled] {
  825. opacity: 0.5;
  826. }
  827. /* Interpretation panel */
  828. .interpret-panel {
  829. flex-shrink: 0;
  830. margin: 0 14px 16px;
  831. }
  832. .interpret-card {
  833. background: rgba(124, 58, 237, 0.06);
  834. border: 1px solid rgba(124, 58, 237, 0.12);
  835. border-radius: 12px;
  836. margin-bottom: 10px;
  837. overflow: hidden;
  838. transition: border-color 0.2s;
  839. }
  840. .interpret-card.expanded {
  841. border-color: rgba(124, 58, 237, 0.25);
  842. background: rgba(124, 58, 237, 0.08);
  843. }
  844. .interpret-card-header {
  845. display: flex;
  846. align-items: center;
  847. padding: 12px 14px;
  848. gap: 10px;
  849. }
  850. .interpret-num-badge {
  851. width: 28px;
  852. height: 28px;
  853. border-radius: 50%;
  854. background: linear-gradient(135deg, #7c3aed, #6366f1);
  855. color: #fff;
  856. font-size: 13px;
  857. font-weight: 700;
  858. line-height: 28px;
  859. text-align: center;
  860. flex-shrink: 0;
  861. }
  862. .interpret-card-title {
  863. flex: 1;
  864. font-size: 14px;
  865. font-weight: 600;
  866. color: rgba(255, 255, 255, 0.85);
  867. }
  868. .interpret-toggle {
  869. font-size: 12px;
  870. color: rgba(255, 255, 255, 0.35);
  871. }
  872. .interpret-card-body {
  873. padding: 0 14px 14px 52px;
  874. }
  875. .interpret-content {
  876. display: block;
  877. font-size: 13px;
  878. line-height: 1.7;
  879. color: rgba(255, 255, 255, 0.65);
  880. white-space: pre-wrap;
  881. }
  882. /* Disclaimer */
  883. .interpret-disclaimer {
  884. text-align: center;
  885. padding: 6px 0 2px;
  886. }
  887. .disclaimer-text {
  888. font-size: 11px;
  889. color: rgba(255, 255, 255, 0.2);
  890. }
  891. /* Loading skeleton */
  892. .interpret-skeleton {
  893. flex-shrink: 0;
  894. margin: 0 14px 16px;
  895. }
  896. .skeleton-card {
  897. background: rgba(255, 255, 255, 0.03);
  898. border: 1px solid rgba(255, 255, 255, 0.05);
  899. border-radius: 12px;
  900. margin-bottom: 10px;
  901. overflow: hidden;
  902. }
  903. .skeleton-header {
  904. height: 24px;
  905. margin: 12px 14px;
  906. background: rgba(255, 255, 255, 0.06);
  907. border-radius: 6px;
  908. width: 60%;
  909. }
  910. .skeleton-body {
  911. padding: 0 14px 14px;
  912. }
  913. .skeleton-line {
  914. height: 12px;
  915. background: rgba(255, 255, 255, 0.04);
  916. border-radius: 4px;
  917. margin-bottom: 8px;
  918. }
  919. .skeleton-line.short {
  920. width: 70%;
  921. }
  922. /* US-9.1: Academic bar */
  923. .academic-bar {
  924. flex-shrink: 0;
  925. margin: 0 14px 10px;
  926. display: flex;
  927. gap: 8px;
  928. align-items: center;
  929. }
  930. .academic-btn {
  931. flex: 1;
  932. height: 44px;
  933. background: linear-gradient(135deg, #0891b2, #06b6d4);
  934. color: #fff;
  935. border: none;
  936. border-radius: 12px;
  937. line-height: 44px;
  938. font-size: 15px;
  939. font-weight: 600;
  940. letter-spacing: 1px;
  941. }
  942. .academic-btn[disabled] { opacity: 0.5; }
  943. .academic-quota {
  944. font-size: 11px;
  945. color: #22d3ee;
  946. background: rgba(34, 211, 238, 0.1);
  947. padding: 3px 10px;
  948. border-radius: 10px;
  949. border: 1px solid rgba(34, 211, 238, 0.15);
  950. white-space: nowrap;
  951. }
  952. /* US-9.1: Academic panel */
  953. .academic-panel {
  954. flex-shrink: 0;
  955. margin: 0 14px 16px;
  956. }
  957. .academic-section-title {
  958. font-size: 16px;
  959. font-weight: 700;
  960. color: #22d3ee;
  961. margin-bottom: 12px;
  962. padding-left: 2px;
  963. }
  964. .academic-card {
  965. border-radius: 12px;
  966. margin-bottom: 10px;
  967. overflow: hidden;
  968. transition: border-color 0.2s;
  969. }
  970. .academic-card.talent { background: rgba(8, 145, 178, 0.06); border: 1px solid rgba(8, 145, 178, 0.12); }
  971. .academic-card.talent.expanded { border-color: rgba(8, 145, 178, 0.25); background: rgba(8, 145, 178, 0.08); }
  972. .academic-card.direction { background: rgba(251, 191, 36, 0.06); border: 1px solid rgba(251, 191, 36, 0.12); }
  973. .academic-card.direction.expanded { border-color: rgba(251, 191, 36, 0.25); background: rgba(251, 191, 36, 0.08); }
  974. .academic-card.learning { background: rgba(52, 211, 153, 0.06); border: 1px solid rgba(52, 211, 153, 0.12); }
  975. .academic-card.learning.expanded { border-color: rgba(52, 211, 153, 0.25); background: rgba(52, 211, 153, 0.08); }
  976. .academic-card.parenting { background: rgba(244, 114, 182, 0.06); border: 1px solid rgba(244, 114, 182, 0.12); }
  977. .academic-card.parenting.expanded { border-color: rgba(244, 114, 182, 0.25); background: rgba(244, 114, 182, 0.08); }
  978. .academic-card.periods { background: rgba(167, 139, 250, 0.06); border: 1px solid rgba(167, 139, 250, 0.12); }
  979. .academic-card.periods.expanded { border-color: rgba(167, 139, 250, 0.25); background: rgba(167, 139, 250, 0.08); }
  980. .academic-card-header {
  981. display: flex;
  982. align-items: center;
  983. padding: 12px 14px;
  984. gap: 10px;
  985. }
  986. .academic-card-title {
  987. flex: 1;
  988. font-size: 14px;
  989. font-weight: 600;
  990. color: rgba(255,255,255,0.85);
  991. }
  992. .academic-toggle {
  993. font-size: 12px;
  994. color: rgba(255,255,255,0.35);
  995. }
  996. .academic-card-body {
  997. padding: 0 14px 14px;
  998. }
  999. .academic-content {
  1000. display: block;
  1001. font-size: 13px;
  1002. line-height: 1.7;
  1003. color: rgba(255,255,255,0.65);
  1004. white-space: pre-wrap;
  1005. }
  1006. /* Match percentage bars */
  1007. .match-bars {
  1008. margin-top: 10px;
  1009. }
  1010. .match-row {
  1011. display: flex;
  1012. align-items: center;
  1013. gap: 8px;
  1014. margin-bottom: 8px;
  1015. }
  1016. .match-label {
  1017. width: 32px;
  1018. font-size: 12px;
  1019. color: rgba(255,255,255,0.55);
  1020. text-align: right;
  1021. }
  1022. .match-track {
  1023. flex: 1;
  1024. height: 8px;
  1025. background: rgba(255,255,255,0.06);
  1026. border-radius: 4px;
  1027. overflow: hidden;
  1028. }
  1029. .match-fill {
  1030. height: 100%;
  1031. border-radius: 4px;
  1032. transition: width 0.4s ease;
  1033. }
  1034. .match-fill.pct-80, .match-fill.pct-85, .match-fill.pct-90, .match-fill.pct-95 { background: linear-gradient(90deg, #22d3ee, #06b6d4); }
  1035. .match-fill.pct-60, .match-fill.pct-65, .match-fill.pct-70, .match-fill.pct-75 { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
  1036. .match-fill.pct-40, .match-fill.pct-45, .match-fill.pct-50, .match-fill.pct-55 { background: linear-gradient(90deg, #f87171, #ef4444); }
  1037. .match-value {
  1038. width: 36px;
  1039. font-size: 12px;
  1040. font-weight: 600;
  1041. color: rgba(255,255,255,0.6);
  1042. text-align: right;
  1043. }
  1044. /* Academic disclaimer */
  1045. .academic-disclaimer {
  1046. text-align: center;
  1047. padding: 6px 0 2px;
  1048. }
  1049. .academic-disclaimer .disclaimer-text {
  1050. font-size: 11px;
  1051. color: rgba(255,255,255,0.2);
  1052. }
  1053. /* Academic loading skeleton */
  1054. .academic-skeleton {
  1055. flex-shrink: 0;
  1056. margin: 0 14px 16px;
  1057. }
  1058. /* Academic quota exceeded upgrade card */
  1059. .academic-upgrade-card {
  1060. flex-shrink: 0;
  1061. margin: 0 14px 16px;
  1062. background: linear-gradient(135deg, rgba(8, 145, 178, 0.08), rgba(6, 182, 212, 0.05));
  1063. border: 1px solid rgba(8, 145, 178, 0.15);
  1064. border-radius: 12px;
  1065. padding: 20px;
  1066. text-align: center;
  1067. }
  1068. .academic-upgrade-title {
  1069. display: block;
  1070. font-size: 15px;
  1071. font-weight: 600;
  1072. color: #22d3ee;
  1073. margin-bottom: 6px;
  1074. }
  1075. .academic-upgrade-desc {
  1076. display: block;
  1077. font-size: 12px;
  1078. color: rgba(255,255,255,0.45);
  1079. margin-bottom: 14px;
  1080. }
  1081. .academic-upgrade-btn {
  1082. background: linear-gradient(135deg, #0891b2, #06b6d4);
  1083. color: #fff;
  1084. border: none;
  1085. border-radius: 10px;
  1086. padding: 12px 40px;
  1087. font-size: 15px;
  1088. font-weight: 600;
  1089. }
  1090. .chat-section {
  1091. flex: 1;
  1092. display: flex;
  1093. flex-direction: column;
  1094. overflow: hidden;
  1095. min-height: 0;
  1096. margin: 0 14px;
  1097. }
  1098. .section-title {
  1099. font-size: 17px;
  1100. font-weight: 600;
  1101. color: rgba(255, 255, 255, 0.9);
  1102. margin: 12px 0 14px;
  1103. display: flex;
  1104. align-items: center;
  1105. gap: 8px;
  1106. }
  1107. .title-icon {
  1108. font-size: 14px;
  1109. color: #fbbf24;
  1110. opacity: 0.7;
  1111. }
  1112. .quota-badge {
  1113. font-size: 11px;
  1114. font-weight: 400;
  1115. color: #fbbf24;
  1116. background: rgba(251, 191, 36, 0.12);
  1117. padding: 2px 10px;
  1118. border-radius: 10px;
  1119. border: 1px solid rgba(251, 191, 36, 0.15);
  1120. }
  1121. .quota-badge.vip {
  1122. color: #34d399;
  1123. background: rgba(52, 211, 153, 0.1);
  1124. border-color: rgba(52, 211, 153, 0.15);
  1125. }
  1126. .chat-box {
  1127. flex: 1;
  1128. height: auto;
  1129. overflow-y: auto;
  1130. background: rgba(255, 255, 255, 0.04);
  1131. border: 1px solid rgba(255, 255, 255, 0.06);
  1132. border-radius: 14px;
  1133. padding: 14px;
  1134. margin-bottom: 10px;
  1135. }
  1136. .msg-row {
  1137. margin-bottom: 14px;
  1138. display: flex;
  1139. }
  1140. .msg-row.user {
  1141. justify-content: flex-end;
  1142. }
  1143. .msg-bubble {
  1144. max-width: 80%;
  1145. padding: 10px 16px;
  1146. border-radius: 14px;
  1147. font-size: 14px;
  1148. line-height: 1.5;
  1149. color: rgba(255, 255, 255, 0.85);
  1150. background: rgba(255, 255, 255, 0.06);
  1151. border: 1px solid rgba(255, 255, 255, 0.06);
  1152. }
  1153. .msg-row.user .msg-bubble {
  1154. background: rgba(251, 191, 36, 0.12);
  1155. border-color: rgba(251, 191, 36, 0.15);
  1156. color: #fbbf24;
  1157. }
  1158. .input-bar {
  1159. display: flex;
  1160. gap: 8px;
  1161. }
  1162. .chat-input {
  1163. flex: 1;
  1164. height: 42px;
  1165. border: 1px solid rgba(255, 255, 255, 0.1);
  1166. border-radius: 10px;
  1167. padding: 0 14px;
  1168. font-size: 14px;
  1169. color: rgba(255, 255, 255, 0.85);
  1170. background: rgba(255, 255, 255, 0.04);
  1171. }
  1172. .send-btn {
  1173. height: 42px;
  1174. padding: 0 24px;
  1175. background: linear-gradient(135deg, #f59e0b, #d97706);
  1176. color: #fff;
  1177. border: none;
  1178. border-radius: 10px;
  1179. line-height: 42px;
  1180. font-size: 14px;
  1181. font-weight: 500;
  1182. }
  1183. .send-btn[disabled] {
  1184. opacity: 0.4;
  1185. }
  1186. /* Share hint */
  1187. .share-hint {
  1188. padding: 8px 0;
  1189. text-align: center;
  1190. }
  1191. .share-hint-text {
  1192. font-size: 11px;
  1193. color: rgba(255, 255, 255, 0.3);
  1194. }
  1195. /* Upgrade prompt */
  1196. .upgrade-prompt {
  1197. background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(217, 119, 6, 0.06));
  1198. border: 1px solid rgba(251, 191, 36, 0.12);
  1199. border-radius: 14px;
  1200. padding: 22px;
  1201. text-align: center;
  1202. margin-bottom: 12px;
  1203. }
  1204. .upgrade-text {
  1205. display: block;
  1206. font-size: 16px;
  1207. font-weight: 600;
  1208. color: #fbbf24;
  1209. }
  1210. .upgrade-desc {
  1211. display: block;
  1212. font-size: 13px;
  1213. color: rgba(255, 255, 255, 0.45);
  1214. margin: 8px 0 16px;
  1215. }
  1216. .upgrade-actions {
  1217. display: flex;
  1218. gap: 10px;
  1219. justify-content: center;
  1220. }
  1221. .upgrade-btn {
  1222. flex: 1;
  1223. background: linear-gradient(135deg, #f59e0b, #d97706);
  1224. color: #fff;
  1225. border: none;
  1226. border-radius: 10px;
  1227. padding: 10px 0;
  1228. font-size: 14px;
  1229. font-weight: 500;
  1230. line-height: 1.4;
  1231. }
  1232. .upgrade-btn.secondary {
  1233. background: rgba(255, 255, 255, 0.06);
  1234. border: 1px solid rgba(251, 191, 36, 0.2);
  1235. color: #fbbf24;
  1236. }
  1237. /* US-6.6: Subscribe section */
  1238. .subscribe-section {
  1239. margin-top: 10px;
  1240. }
  1241. .vip-badge-bar {
  1242. background: rgba(52, 211, 153, 0.06);
  1243. border: 1px solid rgba(52, 211, 153, 0.15);
  1244. border-radius: 10px;
  1245. padding: 12px 14px;
  1246. display: flex;
  1247. flex-wrap: wrap;
  1248. align-items: center;
  1249. gap: 6px;
  1250. }
  1251. .vip-badge-bar.pro {
  1252. background: rgba(167, 139, 250, 0.06);
  1253. border-color: rgba(167, 139, 250, 0.15);
  1254. }
  1255. .vip-badge-text {
  1256. font-size: 13px;
  1257. font-weight: 600;
  1258. color: #34d399;
  1259. }
  1260. .vip-badge-bar.pro .vip-badge-text {
  1261. color: #a78bfa;
  1262. }
  1263. .vip-badge-expiry {
  1264. font-size: 11px;
  1265. color: rgba(255,255,255,0.4);
  1266. }
  1267. .vip-poster-link {
  1268. font-size: 12px;
  1269. color: #fbbf24;
  1270. margin-left: auto;
  1271. }
  1272. .subscribe-card {
  1273. background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(217, 119, 6, 0.05));
  1274. border: 1px solid rgba(251, 191, 36, 0.15);
  1275. border-radius: 12px;
  1276. padding: 16px;
  1277. text-align: center;
  1278. }
  1279. .subscribe-title {
  1280. display: block;
  1281. font-size: 15px;
  1282. font-weight: 600;
  1283. color: #fbbf24;
  1284. margin-bottom: 6px;
  1285. }
  1286. .subscribe-desc {
  1287. display: block;
  1288. font-size: 12px;
  1289. color: rgba(255,255,255,0.45);
  1290. margin-bottom: 14px;
  1291. line-height: 1.5;
  1292. }
  1293. .subscribe-actions {
  1294. display: flex;
  1295. flex-direction: column;
  1296. gap: 8px;
  1297. align-items: center;
  1298. }
  1299. .subscribe-btn {
  1300. width: 100%;
  1301. background: linear-gradient(135deg, #f59e0b, #d97706);
  1302. color: #fff;
  1303. border: none;
  1304. border-radius: 10px;
  1305. padding: 12px 0;
  1306. font-size: 15px;
  1307. font-weight: 600;
  1308. }
  1309. .subscribe-btn:active {
  1310. opacity: 0.85;
  1311. }
  1312. .subscribe-link {
  1313. font-size: 12px;
  1314. color: rgba(255,255,255,0.35);
  1315. }
  1316. </style>