diff --git a/src/components/Profile/ProfilePopup.vue b/src/components/Profile/ProfilePopup.vue
index 6e03a80..768c4ba 100644
--- a/src/components/Profile/ProfilePopup.vue
+++ b/src/components/Profile/ProfilePopup.vue
@@ -5,38 +5,86 @@
:safe-area-inset-bottom="true"
custom-style="border-radius: 32rpx 32rpx 0 0; padding: 40rpx 32rpx"
>
-
- 编辑个人信息
-
-
-
-
-
-
-
-
- 男
-
-
- 女
-
-
-
-
-
-
- cm
-
-
-
+
+
+ 编辑个人信息
+
+
+
+
+
+
+
+
+ 男
+
+
+ 女
+
+
+
+
+
+
+
+
+
+ cm
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
-
-
- 取消
-
-
- 保存
-
+
+
+ 取消
+
+
+ 保存
+
+
@@ -47,6 +95,26 @@ import { useProfileStore } from '@/store/profile'
const profileStore = useProfileStore()
+const occupationColumns = [
+ { label: '久坐少动', value: '久坐少动' },
+ { label: '体力活动', value: '体力活动' },
+ { label: '作息紊乱', value: '作息紊乱' }
+]
+
+const conditionColumns = [
+ { label: '高血压', value: '高血压' },
+ { label: '糖尿病', value: '糖尿病' },
+ { label: '高血脂', value: '高血脂' },
+ { label: '脂肪肝', value: '脂肪肝' }
+]
+
+const goalColumns = [
+ { label: '控制体重', value: '控制体重' },
+ { label: '均衡饮食', value: '均衡饮食' },
+ { label: '改善睡眠', value: '改善睡眠' },
+ { label: '缓解压力', value: '缓解压力' }
+]
+
function cancelClick() {
profileStore.showProfilePopup = false
}
diff --git a/src/components/Record/AiResultPopup.vue b/src/components/Record/AiResultPopup.vue
new file mode 100644
index 0000000..caad78c
--- /dev/null
+++ b/src/components/Record/AiResultPopup.vue
@@ -0,0 +1,35 @@
+
+
+
+
+ AI 健康分析
+
+
+
+
+ {{ recordStore.aiResult }}
+
+
+
+
+ 取消
+
+
+ 分享
+
+
+
+
+
+
+
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 7aa33d9..161c331 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -80,7 +80,7 @@
🔥 健康资讯
- 🔄 每日更新
+ 每日更新
@@ -111,7 +111,7 @@
🌿 养生食谱
- 🔄 每日更新
+ 每日更新
diff --git a/src/pages/record/index.vue b/src/pages/record/index.vue
index 22d2940..b605f68 100644
--- a/src/pages/record/index.vue
+++ b/src/pages/record/index.vue
@@ -1,6 +1,10 @@
-
+
+
+
+
+
@@ -81,6 +85,16 @@
:max-date="Date.now()"
@confirm="onDateConfirm"
/>
+
+
+
+
+
+ AI 正在分析中...
+
+
+
+
@@ -101,6 +115,9 @@ import type { ICalendarSelect, IGroupHealthRecord, IHealthRecord } from "@/type/
import { useAppStore } from "@/store/app";
import { getTheme, getThemePrimaryColor, getThemeStyle } from "@/utils/themes";
import { share } from '@/utils/share'
+import { useDialog } from '@wot-ui/ui'
+import AiResultPopup from "@/components/Record/AiResultPopup.vue";
+import { useRecordStore } from '@/store/record'
const { onShareAppMessage } = share()
onShareAppMessage()
@@ -115,6 +132,7 @@ const calendarSelect = ref([])
const selectDate = ref(getDateStr(Date.now()))
const appStore = useAppStore()
+const recordStore = useRecordStore()
interface SegmentOption {
value: string
@@ -140,6 +158,7 @@ const displayDate = computed(() => {
})
function loadListRecords() {
+ selectMonth.value = getMonthStr(currentDate.value)
const all = getMonthRecords(getMonthStr(currentDate.value), currentRecordTypeSegment.value)
records.value = all
grouped.value = groupByDate(all)
@@ -226,6 +245,68 @@ function deleteClick(item: IHealthRecord) {
},
})
}
+
+const dialog = useDialog()
+
+const AIClick = () => {
+ dialog
+ .confirm({
+ title: `开始分析${selectMonth.value}记录数据,本次分析将消耗 100 积分,是否继续?`,
+ })
+ .then(async () => {
+ recordStore.isAnalyzing = true
+ recordStore.aiResult = ''
+
+ // 模拟请求延迟
+ await new Promise(r => setTimeout(r, 2000))
+
+ recordStore.isAnalyzing = false
+ // 模拟返回结果
+ recordStore.aiResult = generateMockResult()
+ recordStore.showAIResultPopup = true
+ })
+ .catch(() => {
+ console.log('点击了取消')
+ })
+}
+
+function generateMockResult() {
+ return `📊 ${selectMonth.value}健康分析
+
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+• 本月共记录 23 天,覆盖率 74%
+• 平均睡眠 6.5 小时,低于目标 7.5 小时
+• 血压整体平稳,但有 3 天偏高(周一、周三)
+• 建议:增加周末睡眠时间,注意周一血压波动
+`
+}
diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue
index c55cac3..8500bc6 100644
--- a/src/pages/user/index.vue
+++ b/src/pages/user/index.vue
@@ -11,7 +11,7 @@
{{ profile.name || '未设置姓名' }}
- {{ genderText }} · {{ profile.height ? `${profile.height} cm` : '身高未填' }}
+ {{ genderText }} · {{ ageText }} · {{ heightText }}
@@ -109,6 +109,21 @@ const genderText = computed(() => {
return '性别未填'
})
+const ageText = computed(() => {
+ const year = profile.value.birthYear
+ if (!year) return '年龄未填'
+
+ const age = new Date().getFullYear() - year
+ return `${age}岁`
+})
+
+const heightText = computed(() => {
+ if (profile.value.height)
+ return `${profile.value.height} cm`
+
+ return '身高未填'
+})
+
onShow(() => {
appStore.points = getPoints()
appStore.recordCount = getRecordCount()
@@ -121,7 +136,8 @@ watch(() => profileStore.isRefresh, () => {
function openProfile() {
Object.assign(profileStore.profileForm, profile.value)
-
+ profileStore.profileForm.height = 170
+ profileStore.profileForm.birthYear = 1990
profileStore.showProfilePopup = true
}
diff --git a/src/store/profile.ts b/src/store/profile.ts
index b99ad55..f64bdcb 100644
--- a/src/store/profile.ts
+++ b/src/store/profile.ts
@@ -16,7 +16,11 @@ export const useProfileStore = defineStore('profile', {
showAboutPopup: false,
profileForm: {
gender: '',
- height: 0,
+ height: 170,
+ birthYear: 1990,
+ occupation: '',
+ condition: [],
+ goal: '',
name: '',
} as IProfile,
themeColor: 'purple',
diff --git a/src/store/record.ts b/src/store/record.ts
index c2ccba6..633c0f5 100644
--- a/src/store/record.ts
+++ b/src/store/record.ts
@@ -50,6 +50,9 @@ export const useRecordStore = defineStore('record', {
time: Date.now(),
},
isRecord: false,
+ isAnalyzing: false,
+ showAIResultPopup: false,
+ aiResult: ''
}),
actions: {
openWeight() {
diff --git a/src/type/profile.ts b/src/type/profile.ts
index 5909c17..03c3033 100644
--- a/src/type/profile.ts
+++ b/src/type/profile.ts
@@ -1,7 +1,14 @@
export interface IProfile {
name: string
gender: 'male' | 'female' | ''
+ birthYear: number | null
height: number | null
+ // 职业性质
+ occupation: string
+ // 疾病史
+ condition: string[]
+ // 健康目标
+ goal: string
}
export interface IOverview {
diff --git a/src/utils/profile.ts b/src/utils/profile.ts
index 8bd0a87..19566eb 100644
--- a/src/utils/profile.ts
+++ b/src/utils/profile.ts
@@ -11,6 +11,10 @@ function getEmptyProfile(): IProfile {
return {
gender: '',
height: null,
+ birthYear: null,
+ occupation: '',
+ condition: [],
+ goal: '',
name: '',
}
}