|
@@ -61,13 +61,18 @@
|
|
<p class="people">
|
|
<p class="people">
|
|
园区打卡人数:{{ dakaNum }}人({{ new Date().Format("yyyy-MM-dd") }})
|
|
园区打卡人数:{{ dakaNum }}人({{ new Date().Format("yyyy-MM-dd") }})
|
|
</p>
|
|
</p>
|
|
|
|
+
|
|
|
|
+ <Weathers class="weather" :data="weatherData"></Weathers>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
-import { menuList, dakaPeople } from "@/api/canteen/basic.js";
|
|
|
|
|
|
+import { menuList, dakaPeople, WEATHER } from "@/api/canteen/basic.js";
|
|
export default {
|
|
export default {
|
|
|
|
+ components: {
|
|
|
|
+ Weathers: () => import("./weather/index.vue"),
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
tableData: [],
|
|
tableData: [],
|
|
@@ -99,12 +104,14 @@ export default {
|
|
timeFrame: "2",
|
|
timeFrame: "2",
|
|
},
|
|
},
|
|
],
|
|
],
|
|
|
|
+ weatherData: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getList();
|
|
this.getList();
|
|
this.dataRefreh();
|
|
this.dataRefreh();
|
|
this.getPeoples();
|
|
this.getPeoples();
|
|
|
|
+ this.getWeather();
|
|
},
|
|
},
|
|
destroyed() {
|
|
destroyed() {
|
|
// 在页面销毁后,清除计时器
|
|
// 在页面销毁后,清除计时器
|
|
@@ -122,6 +129,20 @@ export default {
|
|
}
|
|
}
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
},
|
|
},
|
|
|
|
+ async getWeather() {
|
|
|
|
+ try {
|
|
|
|
+ let params = {
|
|
|
|
+ city: "长沙",
|
|
|
|
+ date: new Date().Format("yyyy-MM-dd"),
|
|
|
|
+ };
|
|
|
|
+ let { code, data } = await WEATHER(params);
|
|
|
|
+ if (code === 200) {
|
|
|
|
+ this.weatherData = data;
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ } finally {
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 定时刷新数据函数
|
|
// 定时刷新数据函数
|
|
dataRefreh() {
|
|
dataRefreh() {
|
|
// 计时器正在进行中,退出函数
|
|
// 计时器正在进行中,退出函数
|
|
@@ -252,6 +273,15 @@ export default {
|
|
color: #fff;
|
|
color: #fff;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+.weather {
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 1%;
|
|
|
|
+ font-size: 4vh;
|
|
|
|
+ font-weight: 600;
|
|
|
|
+ color: #fff;
|
|
|
|
+}
|
|
|
|
+
|
|
.el-table::before {
|
|
.el-table::before {
|
|
height: 0;
|
|
height: 0;
|
|
}
|
|
}
|