2.5.3beta版本提升 (#1116)

* element-ui升级至2.2.2 部分标签存在重大变化,请重新安装依赖

* popover变更

* 增加真实的天气信息获取

* 天气功能抽离方便二开清理

* 侧边栏css优化

* 版本提升为2.5.3beta

Co-authored-by: task <121913992@qq.com>
This commit is contained in:
奇淼(piexlmax
2022-06-03 21:42:45 +08:00
committed by GitHub
co-authored by task
parent 99156155b3
commit a8d746e831
26 changed files with 135 additions and 87 deletions
+4 -2
View File
@@ -4,7 +4,7 @@
<div class="gva-card gva-top-card">
<div class="gva-top-card-left">
<div class="gva-top-card-left-title">早安,管理员,请开始一天的工作吧</div>
<div class="gva-top-card-left-dot">今日晴,0℃ - 10℃,天气寒冷,注意添加衣物。</div>
<div class="gva-top-card-left-dot">{{ weatherInfo }}</div>
<div class="gva-top-card-left-rows">
<el-row v-auth="888">
<el-col :span="8" :xs="24" :sm="8">
@@ -109,6 +109,8 @@ import echartsLine from '@/view/dashboard/dashboardCharts/echartsLine.vue'
import dashboardTable from '@/view/dashboard/dashboardTable/dashboardTable.vue'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useWeatherInfo } from '@/view/dashboard/weather.js'
const weatherInfo = useWeatherInfo()
const toolCards = ref([
{
@@ -205,7 +207,7 @@ export default {
color: #343844;
}
&-dot {
font-size: 14px;
font-size: 16px;
color: #6B7687;
margin-top: 24px;
}
+31
View File
@@ -0,0 +1,31 @@
import axios from 'axios'
import { ref } from 'vue'
const weatherInfo = ref('今日晴,0℃ - 10℃,天气寒冷,注意添加衣物。')
const amapKey = '8e8baa8a7317586c29ec694895de6e0a'
export const useWeatherInfo = () => {
ip()
return weatherInfo
}
export const ip = async() => {
// key换成你自己的 https://console.amap.com/dev/index
if (amapKey === '') {
return false
}
const res = await axios.get('https://restapi.amap.com/v3/ip?key=' + amapKey)
if (res.data.adcode) {
getWeather(res.data.adcode)
}
}
const getWeather = async(code) => {
const response = await axios.get('https://restapi.amap.com/v3/weather/weatherInfo?key=' + amapKey + '&extensions=base&city=' + code)
if (response.data.status === '1') {
const s = response.data.lives[0]
weatherInfo.value = s.city + ' 天气:' + s.weather + ' 温度:' + s.temperature + '摄氏度 风向:' + s.winddirection + ' 风力:' + s.windpower + '级 空气湿度:' + s.humidity
}
}