diff --git a/src/pages/ai/chat.vue b/src/pages/ai/chat.vue index e1c1237..8299eb2 100644 --- a/src/pages/ai/chat.vue +++ b/src/pages/ai/chat.vue @@ -154,7 +154,7 @@ - + { // 获取历史记录 const getHistoryMessages = async (page: number = 1) => { const userPhone = auth.data?.user?.phone + const projectId = auth.data?.selected_house?.asset_projects_id if (!userPhone) { console.log('用户未登录,无法获取历史记录') return } + if (!projectId) { + console.log('请绑定房屋') + return + } + if (isLoadingHistory.value) { return } @@ -365,7 +371,8 @@ const getHistoryMessages = async (page: number = 1) => { platform: 'property', platform_user_id: userPhone, //userPhone limit: pageSize.value, - offset: offset + offset: offset, + tenant_project_id: projectId }) if (response.statusCode === 200) { diff --git a/src/pages/ai/index.vue b/src/pages/ai/index.vue index c8cd0a6..2417879 100644 --- a/src/pages/ai/index.vue +++ b/src/pages/ai/index.vue @@ -152,7 +152,7 @@ - + { // 获取历史记录 const getHistoryMessages = async (page: number = 1) => { const userPhone = auth.data?.user?.phone + const projectId = auth.data?.selected_house?.asset_projects_id if (!userPhone) { console.log('用户未登录,无法获取历史记录') return } + if (!projectId) { + console.log('请绑定房屋') + return + } if (isLoadingHistory.value) { return @@ -374,7 +379,8 @@ const getHistoryMessages = async (page: number = 1) => { platform: 'property', platform_user_id: userPhone, //userPhone limit: pageSize.value, - offset: offset + offset: offset, + tenant_project_id: projectId }) if (response.statusCode === 200) { diff --git a/src/pages/index/components/AiInput.vue b/src/pages/index/components/AiInput.vue index 5512b4e..b7b4f40 100644 --- a/src/pages/index/components/AiInput.vue +++ b/src/pages/index/components/AiInput.vue @@ -18,7 +18,7 @@ v-for="(i, index) in quickActions" :key="`item_${index}`" class="items" - @click="handleAiPage(i)" + @click="handleInputChange(i)" > @@ -54,20 +54,20 @@ import { showToast } from '@/common/libraries/naviHelper' import { getStyleColorInfo, getStyleColorValueInfo } from '@/common/libraries/getPageConfig' import { quickActions, QuickAction } from '@/common/libraries/public' import userLoginStatus from '@/common/libraries/userUserLogin' +import { useWeAppAuthStore } from '@/common' +const auth = useWeAppAuthStore() -const handleAiPage = (i: QuickAction) => { - uni.navigateTo({ - url: `/pages/ai/chat?message=${i?.message}` - }) -} -const handleInputChange = () => { +const handleInputChange = (i?: QuickAction) => { if (!userLoginStatus?.onBindPhone()) { return false } + if (!auth.data?.selected_house?.asset_projects_id) { + showToast('请绑定房屋') + return false + } uni.navigateTo({ - url: '/pages/ai/chat' + url: `/pages/ai/chat?message=${i?.message || ""}` }) - // showToast('该功能在当前项目暂未开放,敬请期待!') }