From 243460eb390c1aa29a8647c14ea97bde42f99bca Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Wed, 21 May 2025 15:39:23 +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 | 80 +++++++++++++++++++++++- api/chat/index.js | 8 +++ assets/css/aiChat.less | 109 +++++++++++++++++++++++++++++++++ components/aiChat/entrance.vue | 8 ++- pages/home/index.vue | 4 +- 5 files changed, 206 insertions(+), 3 deletions(-) diff --git a/aiChat/views/index.vue b/aiChat/views/index.vue index e64871b..dac4d84 100644 --- a/aiChat/views/index.vue +++ b/aiChat/views/index.vue @@ -49,6 +49,57 @@ + + + + + + + {{ weatherData.tem }} + + + + + + + {{ weatherData.city }} + + + {{ weatherData.wea }}  {{ weatherData.tem2 }}℃~{{ weatherData.tem1 }}℃ + + + 今日风向:{{ weatherData.win }} + + + + 农历{{ holidayData.lunarCalendar }} + {{ holidayData.date.substr(5).replace('-', '/') }} {{ weekDayArr[holidayData.weekDay] }} + + {{ holidayData.yearTips }}年/{{ holidayData.chineseZodiac }} + + + + {{ holidayData.suit }} + + + + + + {{ holidayData.avoid }} + + + + { + const { success, data } = res + if (success) { + this.weatherData = data + } + }) + } + getHolidayData().then(res => { + const { success, data } = res + if (success) { + this.holidayData = data + } + }) }) }, // 创建新会话 @@ -489,7 +567,7 @@ export default { display: flex; align-items: center; justify-content: space-between; - padding: 60rpx 40rpx; + padding: 0 40rpx; .guide-left { .avatar { display: block; diff --git a/api/chat/index.js b/api/chat/index.js index 5efb367..e8fc49b 100644 --- a/api/chat/index.js +++ b/api/chat/index.js @@ -37,3 +37,11 @@ export function historyChatMessage(params) { export function deleteChatListByType(type) { return request.delete('/v1/chat/type/' + type, {}, { login: true }) } + +export function getWeatherData(params) { + return request.get('/v1/chat/weatherData', params, { login: true }) +} + +export function getHolidayData(params) { + return request.get('/v1/chat/holidayData', params, { login: true }) +} diff --git a/assets/css/aiChat.less b/assets/css/aiChat.less index 750d94e..aaa8a78 100644 --- a/assets/css/aiChat.less +++ b/assets/css/aiChat.less @@ -1036,4 +1036,113 @@ page { height: 38rpx; } } +} +.weather-holiday-wrap { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 24rpx 48rpx 24rpx; + .data-wrap { + width: calc(50% - 12rpx); + height: 288rpx; + padding: 20rpx; + border-radius: 20rpx; + box-sizing: border-box; + background-color: #fff; + box-shadow: 0rpx 0rpx 20rpx rgba(0,0,0,0.16); + } + .weather-data { + .title { + display: flex; + align-items: center; + color: #3D4CF1; + .icon { + display: block; + width: 100rpx; + height: 100rpx; + margin: 0 12rpx 0 0; + } + .tem-wrap { + display: flex; + align-items: baseline; + } + .tem { + font-size: 70rpx; + line-height: 70rpx; + font-weight: bold; + } + .unit { + font-size: 36rpx; + line-height: 36rpx; + } + } + .loca { + display: flex; + padding: 24rpx 0; + font-size: 26rpx; + line-height: 36rpx; + color: #333; + .addr { + display: flex; + align-items: center; + .icon { + display: block; + width: 24rpx; + height: 24rpx; + margin: 0 4rpx 0 0; + } + } + .tem-range { + padding: 0 0 0 24rpx; + } + } + .content { + color: #3D4CF1; + font-size: 26rpx; + line-height: 36rpx; + } + } + .holiday-data { + .title { + display: flex; + font-size: 24rpx; + color: #333; + line-height: 36rpx; + .day { + margin: 0 8rpx 0 0; + color: #3D4CF1; + font-size: 28rpx; + } + } + .desc { + font-size: 24rpx; + color: #333; + line-height: 36rpx; + } + .tip { + display: flex; + flex-wrap: wrap; + padding: 20rpx 0 0 0; + .label { + display: block; + width: 32rpx; + height: 32rpx; + margin: 0 12rpx 0 0; + border-radius: 8rpx; + text-align: center; + line-height: 32rpx; + font-size: 24rpx; + color: #fff; + background-color: #3D4CF1; + } + .label2 { + background-color: #C52733; + } + .content { + width: calc(100% - 44rpx); + margin: -6rpx 0 0 0; + font-size: 24rpx; + } + } + } } \ No newline at end of file diff --git a/components/aiChat/entrance.vue b/components/aiChat/entrance.vue index 06b82fe..ccbb31d 100644 --- a/components/aiChat/entrance.vue +++ b/components/aiChat/entrance.vue @@ -15,6 +15,12 @@ import { } from '@/api/public' export default { name: 'AiEntrance', + props: { + cityName: { + type: String, + default: '' + } + }, data() { return { showImg: false, @@ -36,7 +42,7 @@ export default { }, enterAiChat() { uni.navigateTo({ - url: '/aiChat/views/index?click=1' + url: '/aiChat/views/index?click=1&cityName=' + this.cityName }) } } diff --git a/pages/home/index.vue b/pages/home/index.vue index e1a15a2..d86130f 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -353,7 +353,9 @@ paddingBottom="200rpx" /> - +