From 982fe87cc1a287fb67ce9567ef89714f0a087b53 Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Thu, 22 May 2025 10:23:49 +0800 Subject: [PATCH] =?UTF-8?q?Feat(AI):=E5=A4=A9=E6=B0=94=E5=92=8C=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aiChat/views/index.vue | 117 ++++++++++++++++++++++++++--------------- assets/css/aiChat.less | 29 ++++++++-- 2 files changed, 100 insertions(+), 46 deletions(-) diff --git a/aiChat/views/index.vue b/aiChat/views/index.vue index dac4d84..a18dc8c 100644 --- a/aiChat/views/index.vue +++ b/aiChat/views/index.vue @@ -51,38 +51,53 @@ - - - - - {{ weatherData.tem }} - + + + + + + + {{ weatherData.tem }} + + + + + + + {{ weatherData.city }} + + + {{ weatherData.wea }}  {{ weatherData.tem2 }}℃~{{ weatherData.tem1 }}℃ + + + 今日风向:{{ weatherData.win }} - - - + - {{ weatherData.city }} + 无法获取天气信息 - - {{ weatherData.wea }}  {{ weatherData.tem2 }}℃~{{ weatherData.tem1 }}℃ - - - 今日风向:{{ weatherData.win }} + + + 加载中... + - + - 农历{{ holidayData.lunarCalendar }} + {{ holidayData.lunarCalendar }} {{ holidayData.date.substr(5).replace('-', '/') }} {{ weekDayArr[holidayData.weekDay] }} {{ holidayData.yearTips }}年/{{ holidayData.chineseZodiac }} @@ -363,7 +378,11 @@ - + { - const { success, data } = res - if (success) { - this.topicList = data || [] - } - }) - if (this.cityName) { - getWeatherData({ - cityName: '桂林' - }).then(res => { - const { success, data } = res - if (success) { - this.weatherData = data - } - }) + this.loadData() + }) + }, + loadData() { + getAiSystemInfoTopic().then(res => { + const { success, data } = res + if (success) { + this.topicList = data || [] } - getHolidayData().then(res => { + }) + if (this.cityName) { + this.weatherDataLoading = true + getWeatherData({ + cityName: this.cityName + }).then(res => { const { success, data } = res if (success) { - this.holidayData = data + this.weatherData = data } + this.weatherIsLoad = true + this.weatherDataLoading = false + }).catch(() => { + this.weatherDataLoading = false + this.weatherIsLoad = false }) + } + getHolidayData().then(res => { + const { success, data } = res + if (success) { + this.holidayData = data + } }) }, // 创建新会话 @@ -499,6 +529,7 @@ export default { this.loading = false this.getConfigLoading = false this.chatMessageList = [] + this.loadData() }, clickBackHandle() { if (!this.chatNumber) { diff --git a/assets/css/aiChat.less b/assets/css/aiChat.less index aaa8a78..735bd23 100644 --- a/assets/css/aiChat.less +++ b/assets/css/aiChat.less @@ -1039,12 +1039,12 @@ page { } .weather-holiday-wrap { display: flex; - align-items: center; + align-items: stretch; justify-content: space-between; + gap: 12px; padding: 0 24rpx 48rpx 24rpx; .data-wrap { - width: calc(50% - 12rpx); - height: 288rpx; + flex: 1; padding: 20rpx; border-radius: 20rpx; box-sizing: border-box; @@ -1101,6 +1101,29 @@ page { font-size: 26rpx; line-height: 36rpx; } + .txt-loading { + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + min-height: 200rpx; + } + .no-weather { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + font-size: 26rpx; + color: #999; + line-height: 38rpx; + .img { + display: block; + width: 226rpx; + height: 130rpx; + margin: 0 0 12rpx 0; + } + } } .holiday-data { .title {