feat: 紫微斗数模块优化

- 标题改为'紫微斗数'
- 按钮文字改为'开始测算'
- 添加姓名、日期、时间输入框校验
- 结果页公历时间只显示到分钟
This commit is contained in:
H1d3rOne committed 2026-03-07 18:34:27 +08:00
1 parent e15199af45
commit 5345fd1399
2 files changed
+52 -4

No files matched your search

+22 -1
View File
@@ -4,7 +4,7 @@
<view class="date-row">
<view class="date-item">
<text class="date-label">公历</text>
<text class="date-value">{{ result.solar || '-' }}</text>
<text class="date-value">{{ formatSolarTime }}</text>
</view>
</view>
<view class="date-row">
@@ -144,6 +144,27 @@ export default {
markdownHtml() {
if (!this.result.aiAnalysis) return ''
return markdownToHtml(this.result.aiAnalysis)
},
formatSolarTime() {
if (this.result.solar) {
let time = this.result.solar
if (time.includes(':')) {
const parts = time.split(' ')
if (parts.length === 2) {
const datePart = parts[0]
const timePart = parts[1]
const timeComponents = timePart.split(':')
if (timeComponents.length >= 2) {
return `${datePart} ${timeComponents[0]}:${timeComponents[1]}`
}
}
}
if (time.includes('秒')) {
return time.replace(/\d{2}秒$/, '')
}
return time.replace(/:\d{2}$/, '')
}
return '-'
}
},
onLoad() {
+30 -3
View File
@@ -4,7 +4,7 @@
<view class="header-icon">
<text class="icon-text">紫</text>
</view>
<text class="header-title">紫微斗数排盘</text>
<text class="header-title">紫微斗数</text>
<text class="header-subtitle">帝王之学 · 推演命理</text>
</view>
@@ -83,7 +83,7 @@
<view class="btn-wrapper">
<button class="submit-btn" @click="calculate" :disabled="loading">
<text class="btn-text">{{ loading ? '排盘中...' : '开始排盘' }}</text>
<text class="btn-text">{{ loading ? '测算中...' : '开始测算' }}</text>
</button>
</view>
</view>
@@ -113,10 +113,37 @@ export default {
async calculate() {
if (this.loading) return
if (!this.name || this.name.trim() === '') {
uni.showToast({
title: '请输入姓名',
icon: 'none',
duration: 2000
})
return
}
if (!this.solarDate) {
uni.showToast({
title: '请选择出生日期',
icon: 'none',
duration: 2000
})
return
}
if (!this.birthTime) {
uni.showToast({
title: '请选择出生时间',
icon: 'none',
duration: 2000
})
return
}
this.loading = true
uni.showLoading({
title: '排盘中...',
title: '测算中...',
mask: true
})