Feat(AI):天气和日历对接
This commit is contained in:
+79
-1
@@ -49,6 +49,57 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="weatherData.city && holidayData.suit" class="weather-holiday-wrap">
|
||||
<view class="weather-data data-wrap">
|
||||
<!-- 各种天气对应的图标
|
||||
https://yikeapi.com/help/wea
|
||||
https://yikeapi.com/help/tianqiimg -->
|
||||
<view class="title">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/weather/' + weatherData.wea_img +'.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<view class="tem-wrap">
|
||||
<view class="tem">{{ weatherData.tem }}</view>
|
||||
<view class="unit">℃</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="loca">
|
||||
<view class="addr">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/addr.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
{{ weatherData.city }}
|
||||
</view>
|
||||
<view class="tem-range">
|
||||
{{ weatherData.wea }} {{ weatherData.tem2 }}℃~{{ weatherData.tem1 }}℃
|
||||
</view>
|
||||
</view>
|
||||
<view class="content">今日风向:{{ weatherData.win }}</view>
|
||||
</view>
|
||||
<view class="holiday-data data-wrap">
|
||||
<view class="title">
|
||||
<view class="day">农历{{ holidayData.lunarCalendar }}</view>
|
||||
<view>{{ holidayData.date.substr(5).replace('-', '/') }} {{ weekDayArr[holidayData.weekDay] }}</view>
|
||||
</view>
|
||||
<view class="desc">{{ holidayData.yearTips }}年/{{ holidayData.chineseZodiac }}</view>
|
||||
<view class="tip">
|
||||
<view class="label">宜</view>
|
||||
<view class="content">
|
||||
{{ holidayData.suit }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="tip">
|
||||
<view class="label label2">忌</view>
|
||||
<view class="content">
|
||||
{{ holidayData.avoid }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="topic-wrap">
|
||||
<view class="title">
|
||||
<image
|
||||
@@ -363,6 +414,10 @@ import {
|
||||
getAiSystemInfoSetting,
|
||||
getAiSystemInfoTopic
|
||||
} from '@/api/public'
|
||||
import {
|
||||
getWeatherData,
|
||||
getHolidayData
|
||||
} from '@/api/chat/index'
|
||||
import AiHistoryList from '../components/historyList'
|
||||
import BottomSend from '../components/bottomSend.vue'
|
||||
export default {
|
||||
@@ -374,12 +429,19 @@ export default {
|
||||
mixins: [chatMixins],
|
||||
data() {
|
||||
return {
|
||||
cityName: '',
|
||||
weatherData: {},
|
||||
holidayData: {},
|
||||
weekDayArr: Object.freeze(['', '周一', '周二', '周三', '周四', '周五', '周六', '周日']),
|
||||
animationWidth: '150%',
|
||||
animationStr: '',
|
||||
settingInfo: {},
|
||||
topicList: []
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.cityName = options.cityName || ''
|
||||
},
|
||||
onShow() {
|
||||
const addNewChat = uni.getStorageSync('addNewChat') === '1'
|
||||
// 从历史界面点击新增对话
|
||||
@@ -410,6 +472,22 @@ export default {
|
||||
this.topicList = data || []
|
||||
}
|
||||
})
|
||||
if (this.cityName) {
|
||||
getWeatherData({
|
||||
cityName: '桂林'
|
||||
}).then(res => {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user