|
|
@@ -244,7 +244,7 @@ import { ref, computed, onMounted } from 'vue'
|
|
|
import { useChartStore } from '@/stores/chart'
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
import TriangleChart from '@/components/TriangleChart.vue'
|
|
|
-import { chatApi, consultationApi, profileApi, annotationApi, exportApi, interventionApi, planApi, proposalApi, deliveryApi } from '@/utils/api'
|
|
|
+import { chatApi, consultationApi, profileApi, annotationApi, exportApi, interventionApi, planApi, proposalApi, deliveryApi, chartApi } from '@/utils/api'
|
|
|
|
|
|
const store = useChartStore()
|
|
|
const userStore = useUserStore()
|
|
|
@@ -644,6 +644,14 @@ async function sendQuestion(q) {
|
|
|
// US-3.3: Regenerate interpretation via action sheet menu
|
|
|
function showMenu() {
|
|
|
const items = ['🔄 重新开始']
|
|
|
+ // US-9.1: Academic orientation AI (paid users only)
|
|
|
+ if (userStore.isVipActive) {
|
|
|
+ items.push('🎓 学业方向AI')
|
|
|
+ }
|
|
|
+ // US-9.2: Apply for manual plan (only when no active plan request)
|
|
|
+ if (!planRequest.value) {
|
|
|
+ items.push('📝 申请人工方案')
|
|
|
+ }
|
|
|
// US-2.2: PDF export for paid users only
|
|
|
if (userStore.isVipActive) {
|
|
|
items.push('📄 导出 PDF')
|
|
|
@@ -657,13 +665,13 @@ function showMenu() {
|
|
|
success: async (res) => {
|
|
|
if (res.tapIndex === 0) {
|
|
|
await confirmRegenerate()
|
|
|
- } else if (res.tapIndex === 1) {
|
|
|
- if (items[1] === '📄 导出 PDF') {
|
|
|
- await exportPdf()
|
|
|
- } else if (items[1] === '📤 分享给好友') {
|
|
|
- await triggerShare()
|
|
|
- }
|
|
|
- } else if (res.tapIndex === 2 && items[2] === '📤 分享给好友') {
|
|
|
+ } else if (items[res.tapIndex] === '🎓 学业方向AI') {
|
|
|
+ await handleAcademicOrientation()
|
|
|
+ } else if (items[res.tapIndex] === '📝 申请人工方案') {
|
|
|
+ await handlePlanApply()
|
|
|
+ } else if (items[res.tapIndex] === '📄 导出 PDF') {
|
|
|
+ await exportPdf()
|
|
|
+ } else if (items[res.tapIndex] === '📤 分享给好友') {
|
|
|
await triggerShare()
|
|
|
}
|
|
|
}
|
|
|
@@ -700,6 +708,47 @@ async function confirmRegenerate() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+// US-9.1: Academic orientation AI interpretation
|
|
|
+async function handleAcademicOrientation() {
|
|
|
+ if (!store.currentRecordId) {
|
|
|
+ uni.showToast({ title: '暂无命盘数据', icon: 'none' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ uni.showLoading({ title: 'AI 分析中...' })
|
|
|
+ const result = await chartApi.academicOrientation(store.currentRecordId)
|
|
|
+ uni.hideLoading()
|
|
|
+ if (result && result.content) {
|
|
|
+ // Append academic orientation as a system message in the chat
|
|
|
+ messages.value.push({
|
|
|
+ senderType: 'system',
|
|
|
+ content: '🎓 学业方向AI分析',
|
|
|
+ id: Date.now()
|
|
|
+ })
|
|
|
+ messages.value.push({
|
|
|
+ senderType: 'ai',
|
|
|
+ content: result.content,
|
|
|
+ id: Date.now() + 1
|
|
|
+ })
|
|
|
+ scrollTop.value = 99999
|
|
|
+ } else {
|
|
|
+ uni.showToast({ title: '暂无学业方向分析结果', icon: 'none' })
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({ title: e.message || '学业方向分析失败', icon: 'none' })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// US-9.2: Navigate to plan application page
|
|
|
+function handlePlanApply() {
|
|
|
+ if (!store.currentRecordId) {
|
|
|
+ uni.showToast({ title: '暂无命盘数据', icon: 'none' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.navigateTo({ url: `/pages/plan/apply?chartRecordId=${store.currentRecordId}` })
|
|
|
+}
|
|
|
+
|
|
|
// US-2.1: Track share and update quota
|
|
|
async function triggerShare() {
|
|
|
uni.showShareMenu({
|