|
@@ -1,216 +1,229 @@
|
|
|
<template>
|
|
|
- <div class="header">
|
|
|
- <div class="title">
|
|
|
- <img class="logo" src="@/assets/images/common/logo.png" alt="" />
|
|
|
- <span>飞鸟智慧巡园平台</span>
|
|
|
- <img class="logo-icon" src="@/assets/images/common/logo-icon.png" alt="" />
|
|
|
+ <div class="header">
|
|
|
+ <div class="title">
|
|
|
+ <img class="logo" src="@/assets/images/common/logo.png" alt="" />
|
|
|
+ <span>飞鸟智慧巡园平台</span>
|
|
|
+ <img class="logo-icon" src="@/assets/images/common/logo-icon.png" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="focus-farm" v-show="!hideSwitch">
|
|
|
+ <el-select
|
|
|
+ v-model="farmVal"
|
|
|
+ placeholder="我的关注农场"
|
|
|
+ style="width: 189px"
|
|
|
+ popper-class="focus-farm-select"
|
|
|
+ @change="toggleFarm"
|
|
|
+ >
|
|
|
+ <el-option v-for="item in options" :key="item.organId" :label="item.name" :value="item.organId" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="date" v-show="showDate">
|
|
|
+ <el-icon size="25"><MoreFilled /></el-icon>
|
|
|
+ <div class="time">
|
|
|
+ <div>{{ time }}</div>
|
|
|
+ <span>{{ getCurrentFormattedTime("date") }} {{ getCurrentDayOfWeek() }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="focus-farm" v-show="!hideSwitch">
|
|
|
- <el-select
|
|
|
- v-model="farmVal"
|
|
|
- placeholder="我的关注农场"
|
|
|
- style="width: 189px"
|
|
|
- popper-class="focus-farm-select"
|
|
|
- @change="toggleFarm"
|
|
|
- >
|
|
|
- <!-- <el-option label="我的关注农场" :value="0" /> -->
|
|
|
- <el-option label="荔博园" :value="1" />
|
|
|
- <el-option label="井冈红糯基地" :value="2" />
|
|
|
- </el-select>
|
|
|
+ <!-- 四个方向的阴影 -->
|
|
|
+ <div class="page-shadow" v-show="!hideShadow">
|
|
|
+ <div class="page-bg bg-top"></div>
|
|
|
+ <div class="page-bg bg-right"></div>
|
|
|
+ <div class="page-bg bg-bottom"></div>
|
|
|
+ <div class="page-bg bg-left"></div>
|
|
|
</div>
|
|
|
- <div class="date" v-show="showDate">
|
|
|
- <el-icon size="25"><MoreFilled /></el-icon>
|
|
|
- <div class="time">
|
|
|
- <div>{{time}}</div>
|
|
|
- <span>{{getCurrentFormattedTime('date')}} {{getCurrentDayOfWeek()}}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- 四个方向的阴影 -->
|
|
|
- <div class="page-shadow" v-show="!hideShadow">
|
|
|
- <div class="page-bg bg-top"></div>
|
|
|
- <div class="page-bg bg-right"></div>
|
|
|
- <div class="page-bg bg-bottom"></div>
|
|
|
- <div class="page-bg bg-left"></div>
|
|
|
- </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { onMounted, onUnmounted, ref } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
|
+import { convertPointToString } from "@/utils/index";
|
|
|
|
|
|
const router = useRouter();
|
|
|
const props = defineProps({
|
|
|
- showDate:{
|
|
|
- type:Boolean,
|
|
|
- defalut:false
|
|
|
- },
|
|
|
- hideSwitch:{
|
|
|
- type:Boolean,
|
|
|
- defalut:false
|
|
|
- },
|
|
|
- hideShadow: {
|
|
|
- type:Boolean,
|
|
|
- defalut:false
|
|
|
- }
|
|
|
-})
|
|
|
+ showDate: {
|
|
|
+ type: Boolean,
|
|
|
+ defalut: false,
|
|
|
+ },
|
|
|
+ hideSwitch: {
|
|
|
+ type: Boolean,
|
|
|
+ defalut: false,
|
|
|
+ },
|
|
|
+ hideShadow: {
|
|
|
+ type: Boolean,
|
|
|
+ defalut: false,
|
|
|
+ },
|
|
|
+});
|
|
|
|
|
|
-const farmVal = ref(sessionStorage.getItem('farmId')*1 || '')
|
|
|
+const farmVal = ref(sessionStorage.getItem("farmId") * 1 || "");
|
|
|
const toggleFarm = (val) => {
|
|
|
- sessionStorage.setItem('farmId',farmVal.value)
|
|
|
+ sessionStorage.setItem("farmId", farmVal.value);
|
|
|
router.push({ name: "Home" });
|
|
|
};
|
|
|
|
|
|
function getCurrentFormattedTime(type) {
|
|
|
const now = new Date();
|
|
|
-
|
|
|
+
|
|
|
const year = now.getFullYear();
|
|
|
- const month = String(now.getMonth() + 1).padStart(2, '0'); // Months are zero based
|
|
|
- const day = String(now.getDate()).padStart(2, '0');
|
|
|
- const hours = String(now.getHours()).padStart(2, '0');
|
|
|
- const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
- const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
- if(type==='date'){
|
|
|
- return `${year}.${month}.${day}`;
|
|
|
- }else{
|
|
|
- return `${hours}:${minutes}:${seconds}`;
|
|
|
+ const month = String(now.getMonth() + 1).padStart(2, "0"); // Months are zero based
|
|
|
+ const day = String(now.getDate()).padStart(2, "0");
|
|
|
+ const hours = String(now.getHours()).padStart(2, "0");
|
|
|
+ const minutes = String(now.getMinutes()).padStart(2, "0");
|
|
|
+ const seconds = String(now.getSeconds()).padStart(2, "0");
|
|
|
+ if (type === "date") {
|
|
|
+ return `${year}.${month}.${day}`;
|
|
|
+ } else {
|
|
|
+ return `${hours}:${minutes}:${seconds}`;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getCurrentDayOfWeek() {
|
|
|
const now = new Date();
|
|
|
const dayOfWeek = now.getDay();
|
|
|
- const daysOfWeek = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
|
|
|
-
|
|
|
+ const daysOfWeek = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
|
|
+
|
|
|
return daysOfWeek[dayOfWeek];
|
|
|
}
|
|
|
|
|
|
function formatTimeToHHmmss(date) {
|
|
|
- const hours = String(date.getHours()).padStart(2, '0');
|
|
|
- const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
- const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
-
|
|
|
- return `${hours}.${minutes}.${seconds}`;
|
|
|
+ const hours = String(date.getHours()).padStart(2, "0");
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
|
+ const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
|
+
|
|
|
+ return `${hours}.${minutes}.${seconds}`;
|
|
|
}
|
|
|
|
|
|
-const time = ref("21:05:46")
|
|
|
-const timer = ref(null)
|
|
|
-onMounted(()=>{
|
|
|
- timer.value = setInterval(()=>{
|
|
|
- time.value = getCurrentFormattedTime(new Date())
|
|
|
- },1000)
|
|
|
-})
|
|
|
+const options = ref([]);
|
|
|
+const userInfo = JSON.parse(sessionStorage.getItem("userinfo"));
|
|
|
+const getGardenList = () => {
|
|
|
+ const location = convertPointToString(userInfo.location);
|
|
|
+ const params = {
|
|
|
+ userId: userInfo.userId,
|
|
|
+ show3dFarm: true,
|
|
|
+ location: "113.746646,22.970229",
|
|
|
+ };
|
|
|
+ VE_API.home.userGarden(params).then((res) => {
|
|
|
+ options.value = res.data;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const time = ref("");
|
|
|
+const timer = ref(null);
|
|
|
+onMounted(() => {
|
|
|
+ getGardenList();
|
|
|
+ timer.value = setInterval(() => {
|
|
|
+ time.value = getCurrentFormattedTime(new Date());
|
|
|
+ }, 1000);
|
|
|
+});
|
|
|
|
|
|
-onUnmounted(()=>{
|
|
|
- timer.value = null
|
|
|
-})
|
|
|
+onUnmounted(() => {
|
|
|
+ timer.value = null;
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.header {
|
|
|
- width: 100%;
|
|
|
- height: 74px;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- box-sizing: border-box;
|
|
|
- pointer-events: all;
|
|
|
- position: relative;
|
|
|
-
|
|
|
- .title {
|
|
|
width: 100%;
|
|
|
- height: 100%;
|
|
|
- font-size: 24px;
|
|
|
- letter-spacing: 2px;
|
|
|
- padding-left: 20px;
|
|
|
+ height: 74px;
|
|
|
display: flex;
|
|
|
- align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
box-sizing: border-box;
|
|
|
- background: url("@/assets/images/common/header-bg.png") no-repeat center
|
|
|
- center / 100% 100%;
|
|
|
- .logo{
|
|
|
- width: 23px;
|
|
|
- height: 26px;
|
|
|
- }
|
|
|
- .logo-icon{
|
|
|
- width: 33px;
|
|
|
- height: 12px;
|
|
|
- }
|
|
|
- span {
|
|
|
- margin: 0 5px;
|
|
|
- font-family: "PangMenZhengDao";
|
|
|
- }
|
|
|
- }
|
|
|
- .focus-farm {
|
|
|
- position: absolute;
|
|
|
- right: 192px;
|
|
|
- top: 23px;
|
|
|
- ::v-deep {
|
|
|
- .el-select__wrapper {
|
|
|
- background: rgba(255, 212, 137, 0.2);
|
|
|
- box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
|
|
|
- height: 50px;
|
|
|
- line-height: 50px;
|
|
|
- .el-select__caret {
|
|
|
- color: #ffd489;
|
|
|
- }
|
|
|
+ pointer-events: all;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ font-size: 24px;
|
|
|
+ letter-spacing: 2px;
|
|
|
+ padding-left: 20px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: url("@/assets/images/common/header-bg.png") no-repeat center center / 100% 100%;
|
|
|
+ .logo {
|
|
|
+ width: 23px;
|
|
|
+ height: 26px;
|
|
|
+ }
|
|
|
+ .logo-icon {
|
|
|
+ width: 33px;
|
|
|
+ height: 12px;
|
|
|
}
|
|
|
- .el-select__placeholder {
|
|
|
- color: #f7be5a;
|
|
|
- font-size: 20px;
|
|
|
+ span {
|
|
|
+ margin: 0 5px;
|
|
|
font-family: "PangMenZhengDao";
|
|
|
- text-align: center;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- .date {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- position: absolute;
|
|
|
- right: 30px;
|
|
|
- top: 24px;
|
|
|
- .time{
|
|
|
- margin-left: 14px;
|
|
|
- line-height: 18px;
|
|
|
- div{
|
|
|
- font-family: "PangMenZhengDao";
|
|
|
- letter-spacing: 1px;
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
- span{
|
|
|
- font-size: 11px;
|
|
|
- font-family: 'SOURCEHANTIFINE';
|
|
|
- }
|
|
|
+ .focus-farm {
|
|
|
+ position: absolute;
|
|
|
+ right: 192px;
|
|
|
+ top: 23px;
|
|
|
+ ::v-deep {
|
|
|
+ .el-select__wrapper {
|
|
|
+ background: rgba(255, 212, 137, 0.2);
|
|
|
+ box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ .el-select__caret {
|
|
|
+ color: #ffd489;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-select__placeholder {
|
|
|
+ color: #f7be5a;
|
|
|
+ font-size: 20px;
|
|
|
+ font-family: "PangMenZhengDao";
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .date {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ position: absolute;
|
|
|
+ right: 30px;
|
|
|
+ top: 24px;
|
|
|
+ .time {
|
|
|
+ margin-left: 14px;
|
|
|
+ line-height: 18px;
|
|
|
+ div {
|
|
|
+ font-family: "PangMenZhengDao";
|
|
|
+ letter-spacing: 1px;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ font-size: 11px;
|
|
|
+ font-family: "SOURCEHANTIFINE";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
// 阴影样式
|
|
|
-.page-bg{
|
|
|
- position: fixed;
|
|
|
- z-index: -1;
|
|
|
+.page-bg {
|
|
|
+ position: fixed;
|
|
|
+ z-index: -1;
|
|
|
}
|
|
|
-.bg-top{
|
|
|
- top: 0;
|
|
|
- width: 100%;
|
|
|
- height: 200px;
|
|
|
- background: linear-gradient( 0deg, rgba(0, 21, 31,0), #00151f);
|
|
|
+.bg-top {
|
|
|
+ top: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 200px;
|
|
|
+ background: linear-gradient(0deg, rgba(0, 21, 31, 0), #00151f);
|
|
|
}
|
|
|
-.bg-right{
|
|
|
- right: 0;
|
|
|
- width: 600px;
|
|
|
- height: 100%;
|
|
|
- background: linear-gradient( 90deg, rgba(0, 21, 31,0), rgb(0, 21, 31,0.7));
|
|
|
+.bg-right {
|
|
|
+ right: 0;
|
|
|
+ width: 600px;
|
|
|
+ height: 100%;
|
|
|
+ background: linear-gradient(90deg, rgba(0, 21, 31, 0), rgb(0, 21, 31, 0.7));
|
|
|
}
|
|
|
-.bg-bottom{
|
|
|
- bottom: 0;
|
|
|
- width: 100%;
|
|
|
- height: 200px;
|
|
|
- background: linear-gradient( 180deg, rgba(0, 21, 31,0), rgb(0, 21, 31,0.7));
|
|
|
+.bg-bottom {
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 200px;
|
|
|
+ background: linear-gradient(180deg, rgba(0, 21, 31, 0), rgb(0, 21, 31, 0.7));
|
|
|
}
|
|
|
-.bg-left{
|
|
|
- left: 0;
|
|
|
- width: 600px;
|
|
|
- height: 100%;
|
|
|
- background: linear-gradient( 270deg, rgba(0, 21, 31,0), rgb(0, 21, 31,0.7));
|
|
|
+.bg-left {
|
|
|
+ left: 0;
|
|
|
+ width: 600px;
|
|
|
+ height: 100%;
|
|
|
+ background: linear-gradient(270deg, rgba(0, 21, 31, 0), rgb(0, 21, 31, 0.7));
|
|
|
}
|
|
|
</style>
|
|
|
|
|
@@ -234,4 +247,4 @@ onUnmounted(()=>{
|
|
|
border-color: rgba(255, 212, 137, 0.3);
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|