fix:更新ai页面

This commit is contained in:
Your Name 2026-04-10 16:10:01 +08:00
parent 88ad0d2a2b
commit aef8c8b909
3 changed files with 26 additions and 13 deletions

View File

@ -154,7 +154,7 @@
</view> </view>
</view> </view>
</view> </view>
<hs-empty v-if="!messages?.length" height="20vh" />
<view v-if="loading" class="message-item ai-message"> <view v-if="loading" class="message-item ai-message">
<view class="message-avatar"> <view class="message-avatar">
<image <image
@ -344,12 +344,18 @@ const scrollToBottom = () => {
// //
const getHistoryMessages = async (page: number = 1) => { const getHistoryMessages = async (page: number = 1) => {
const userPhone = auth.data?.user?.phone const userPhone = auth.data?.user?.phone
const projectId = auth.data?.selected_house?.asset_projects_id
if (!userPhone) { if (!userPhone) {
console.log('用户未登录,无法获取历史记录') console.log('用户未登录,无法获取历史记录')
return return
} }
if (!projectId) {
console.log('请绑定房屋')
return
}
if (isLoadingHistory.value) { if (isLoadingHistory.value) {
return return
} }
@ -365,7 +371,8 @@ const getHistoryMessages = async (page: number = 1) => {
platform: 'property', platform: 'property',
platform_user_id: userPhone, //userPhone platform_user_id: userPhone, //userPhone
limit: pageSize.value, limit: pageSize.value,
offset: offset offset: offset,
tenant_project_id: projectId
}) })
if (response.statusCode === 200) { if (response.statusCode === 200) {

View File

@ -152,7 +152,7 @@
</view> </view>
</view> </view>
</view> </view>
<hs-empty v-if="!messages?.length" height="20vh" />
<view v-if="loading" class="message-item ai-message"> <view v-if="loading" class="message-item ai-message">
<view class="message-avatar"> <view class="message-avatar">
<image <image
@ -353,11 +353,16 @@ const scrollToBottom = () => {
// //
const getHistoryMessages = async (page: number = 1) => { const getHistoryMessages = async (page: number = 1) => {
const userPhone = auth.data?.user?.phone const userPhone = auth.data?.user?.phone
const projectId = auth.data?.selected_house?.asset_projects_id
if (!userPhone) { if (!userPhone) {
console.log('用户未登录,无法获取历史记录') console.log('用户未登录,无法获取历史记录')
return return
} }
if (!projectId) {
console.log('请绑定房屋')
return
}
if (isLoadingHistory.value) { if (isLoadingHistory.value) {
return return
@ -374,7 +379,8 @@ const getHistoryMessages = async (page: number = 1) => {
platform: 'property', platform: 'property',
platform_user_id: userPhone, //userPhone platform_user_id: userPhone, //userPhone
limit: pageSize.value, limit: pageSize.value,
offset: offset offset: offset,
tenant_project_id: projectId
}) })
if (response.statusCode === 200) { if (response.statusCode === 200) {

View File

@ -18,7 +18,7 @@
v-for="(i, index) in quickActions" v-for="(i, index) in quickActions"
:key="`item_${index}`" :key="`item_${index}`"
class="items" class="items"
@click="handleAiPage(i)" @click="handleInputChange(i)"
> >
<view class="items_center"> <view class="items_center">
<image :src="`/static/svg/${i.icon}`" mode="heightFix" /> <image :src="`/static/svg/${i.icon}`" mode="heightFix" />
@ -54,20 +54,20 @@ import { showToast } from '@/common/libraries/naviHelper'
import { getStyleColorInfo, getStyleColorValueInfo } from '@/common/libraries/getPageConfig' import { getStyleColorInfo, getStyleColorValueInfo } from '@/common/libraries/getPageConfig'
import { quickActions, QuickAction } from '@/common/libraries/public' import { quickActions, QuickAction } from '@/common/libraries/public'
import userLoginStatus from '@/common/libraries/userUserLogin' import userLoginStatus from '@/common/libraries/userUserLogin'
import { useWeAppAuthStore } from '@/common'
const auth = useWeAppAuthStore()
const handleAiPage = (i: QuickAction) => { const handleInputChange = (i?: QuickAction) => {
uni.navigateTo({
url: `/pages/ai/chat?message=${i?.message}`
})
}
const handleInputChange = () => {
if (!userLoginStatus?.onBindPhone()) { if (!userLoginStatus?.onBindPhone()) {
return false return false
} }
if (!auth.data?.selected_house?.asset_projects_id) {
showToast('请绑定房屋')
return false
}
uni.navigateTo({ uni.navigateTo({
url: '/pages/ai/chat' url: `/pages/ai/chat?message=${i?.message || ""}`
}) })
// showToast('')
} }
</script> </script>