diff --git a/xuan-deduct-uniapp/src/pages/ziwei/result.vue b/xuan-deduct-uniapp/src/pages/ziwei/result.vue index 5ddca3b..3cfdc50 100644 --- a/xuan-deduct-uniapp/src/pages/ziwei/result.vue +++ b/xuan-deduct-uniapp/src/pages/ziwei/result.vue @@ -4,7 +4,7 @@ 公历 - {{ result.solar || '-' }} + {{ formatSolarTime }} @@ -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() { diff --git a/xuan-deduct-uniapp/src/pages/ziwei/ziwei.vue b/xuan-deduct-uniapp/src/pages/ziwei/ziwei.vue index 85bb308..5fb9c4e 100644 --- a/xuan-deduct-uniapp/src/pages/ziwei/ziwei.vue +++ b/xuan-deduct-uniapp/src/pages/ziwei/ziwei.vue @@ -4,7 +4,7 @@ 紫 - 紫微斗数排盘 + 紫微斗数 帝王之学 · 推演命理 @@ -83,7 +83,7 @@ @@ -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 })