diff --git a/xuan-deduct-uniapp/src/pages/bazi/result.vue b/xuan-deduct-uniapp/src/pages/bazi/result.vue
index 91eb237..f8a4b5a 100644
--- a/xuan-deduct-uniapp/src/pages/bazi/result.vue
+++ b/xuan-deduct-uniapp/src/pages/bazi/result.vue
@@ -32,7 +32,7 @@
$1')
+
+ html = html.replace(/^\s*[-β’]\s(.+)$/gim, '')
+ html = html.replace(/\n/g, '
')
+
+ if (!html.startsWith('<')) {
+ html = '
' + html + '
' + } + + return html + }, + parseMarkdown(text) { + if (!text) return [] + + const nodes = [] + const lines = text.split('\n') + let currentParagraph = [] + let listItems = [] + + lines.forEach((line) => { + line = line.trim() + + if (line === '') { + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + currentParagraph = [] + } + if (listItems.length > 0) { + nodes.push({ + type: 'list', + items: listItems + }) + listItems = [] + } + return + } + + if (line.startsWith('### ')) { + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + currentParagraph = [] + } + if (listItems.length > 0) { + nodes.push({ + type: 'list', + items: listItems + }) + listItems = [] + } + nodes.push({ + type: 'h3', + text: line.substring(4) + }) + } else if (line.startsWith('## ')) { + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + currentParagraph = [] + } + if (listItems.length > 0) { + nodes.push({ + type: 'list', + items: listItems + }) + listItems = [] + } + nodes.push({ + type: 'h2', + text: line.substring(3) + }) + } else if (line.startsWith('# ')) { + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + currentParagraph = [] + } + if (listItems.length > 0) { + nodes.push({ + type: 'list', + items: listItems + }) + listItems = [] + } + nodes.push({ + type: 'h1', + text: line.substring(2) + }) + } else if (line.startsWith('β’ ') || line.startsWith('- ') || line.startsWith('* ')) { + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + currentParagraph = [] + } + listItems.push(line.substring(2)) + } else if (line.match(/^\d+\.\s/)) { + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + currentParagraph = [] + } + const text = line.replace(/^\d+\.\s/, '') + listItems.push(text) + } else { + if (listItems.length > 0) { + nodes.push({ + type: 'list', + items: listItems + }) + listItems = [] + } + currentParagraph.push(line) + } + }) + + if (currentParagraph.length > 0) { + nodes.push({ + type: 'paragraph', + text: currentParagraph.join('\n') + }) + } + + if (listItems.length > 0) { + nodes.push({ + type: 'list', + items: listItems + }) + } + + return nodes + }, getGan(index) { if (this.result.baZi && this.result.baZi[index]) { return this.result.baZi[index].charAt(0) @@ -630,4 +808,90 @@ page { font-size: 24rpx; color: #9CA3AF; } + +.markdown-content { + width: 100%; + font-size: 26rpx; + color: #374151; + line-height: 1.8; +} + +.markdown-content h1 { + font-size: 36rpx; + font-weight: bold; + color: #DC2626; + margin: 32rpx 0 20rpx 0; + padding: 16rpx 24rpx; + background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%); + border-left: 6rpx solid #DC2626; + border-radius: 8rpx; +} + +.markdown-content h2 { + font-size: 32rpx; + font-weight: bold; + color: #B91C1C; + margin: 28rpx 0 16rpx 0; + padding: 12rpx 20rpx; + background: linear-gradient(90deg, #FFF7ED 0%, transparent 100%); + border-left: 4rpx solid #F59E0B; +} + +.markdown-content h3 { + font-size: 28rpx; + font-weight: 600; + color: #92400E; + margin: 24rpx 0 12rpx 0; + padding: 8rpx 16rpx; + border-bottom: 2rpx dashed #F59E0B; + display: inline-block; +} + +.markdown-content p { + margin: 16rpx 0; + text-align: justify; + text-indent: 2em; + color: #4B5563; + line-height: 2; +} + +.markdown-content strong { + font-weight: bold; + color: #DC2626; + background: linear-gradient(135deg, #FEF2F2 0%, transparent 100%); + padding: 2rpx 8rpx; + border-radius: 4rpx; +} + +.markdown-content em { + font-style: normal; + color: #7C3AED; + font-weight: 500; +} + +.markdown-content code { + font-family: "Courier New", monospace; + background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%); + padding: 4rpx 12rpx; + border-radius: 6rpx; + color: #92400E; + font-size: 24rpx; + border: 1rpx solid #F59E0B; + font-weight: 500; +} + +.markdown-content ul { + margin: 16rpx 0; + padding-left: 0; + list-style: none; +} + +.markdown-content li { + margin: 12rpx 0; + padding: 12rpx 16rpx 12rpx 24rpx; + background: linear-gradient(90deg, #F0FDF4 0%, transparent 100%); + border-left: 3rpx solid #10B981; + color: #374151; + line-height: 1.8; +}