123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- <template>
- <div class="monitor-index" :style="{ height: `calc(100vh - ${tabBarHeight}px)` }">
- <!-- 天气遮罩 -->
- <div class="weather-mask" v-show="isExpanded"></div>
- <!-- 天气 -->
- <weather-info class="weather-info" @weatherExpanded="weatherExpanded" :isGarden="true"></weather-info>
- <!-- 操作按钮 -->
- <div class="operation-button">
- <div class="button-group">
- <div class="button-item" @click="toFarmInfo">
- <img class="button-icon" src="@/assets/img/tab_bar/home-active.png" alt="" />
- <span>基本信息</span>
- </div>
- <div class="button-item" @click="toFarmPhoto">
- <img class="button-icon" src="@/assets/img/home/photo-icon.png" alt="" />
- <span>农场相册</span>
- </div>
- </div>
- <badge dot :offset="[-4, 5]">
- <div class="add-farm-button">
- <img class="icon" src="@/assets/img/monitor/notice.png" alt="" />
- <span>农场消息</span>
- </div>
- </badge>
- </div>
- <!-- 功能卡片网格 -->
- <div class="function-cards">
- <div
- v-for="(card, index) in functionCards"
- :key="index"
- class="function-card"
- @click="handleCardClick(card)"
- >
- <img :src="require(`@/assets/img/monitor/grid-${index + 1}.png`)" :alt="card.title" />
- <div class="card-title">{{ card.title }}</div>
- <div class="card-status">
- {{ card.status }}
- </div>
- </div>
- </div>
- <!-- 实时播报 -->
- <div class="realtime-broadcast">
- <div class="broadcast-header">
- <div class="header-left">
- <span class="broadcast-title">实时播报</span>
- <div class="broadcast-action" @click="handleBroadcast">
- <img class="speaker-icon" src="@/assets/img/monitor/speaker.png" alt="播报" />
- <span class="broadcast-text">点击播报</span>
- </div>
- </div>
- <div class="more-link" @click="handleMoreBroadcast">
- <span>更多</span>
- <el-icon size="12"><ArrowRightBold /></el-icon>
- </div>
- </div>
- <div class="broadcast-list">
- <div
- v-for="(item, index) in broadcastList"
- :key="index"
- class="broadcast-item"
- @click="handleBroadcastItem(item)"
- >
- <div class="item-content">
- <div class="content-top">
- <div class="item-icon">
- <img src="@/assets/img/monitor/bell.png" alt="通知" />
- </div>
- <div class="item-title">{{ item.title }}</div>
- </div>
- <div class="item-status">
- 距离执行还差 <span class="countdown">{{ item.daysLeft }}</span> 天
- </div>
- </div>
- <div class="item-zone">
- <div class="point"></div>
- <span>{{ item.zone }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, computed, onMounted } from "vue";
- import { useStore } from "vuex";
- import { Badge } from "vant";
- import weatherInfo from "@/components/weatherInfo.vue";
- import { useRouter } from "vue-router";
- const store = useStore();
- const tabBarHeight = computed(() => store.state.home.tabBarHeight);
- const router = useRouter();
- // 功能卡片数据
- const functionCards = ref([
- {
- title: "农事规划",
- status: "2 待执行",
- route: "/agricultural-planning",
- },
- {
- title: "农场报告",
- status: "最新",
- route: "/farm-report",
- },
- {
- title: "农事方案",
- status: "2 待执行",
- route: "/agricultural-scheme",
- },
- {
- title: "复核成效",
- status: "最新",
- route: "/review-results",
- },
- ]);
- // 实时播报数据
- const broadcastList = ref([
- {
- title: "某莫普农事未执行未执行",
- daysLeft: 3,
- zone: "2区",
- },
- {
- title: "某莫普农事未执行未执行",
- daysLeft: 3,
- zone: "2区",
- },
- {
- title: "某莫普农事未执行未执行",
- daysLeft: 3,
- zone: "2区",
- },
- {
- title: "某莫普农事未执行未执行",
- daysLeft: 3,
- zone: "2区",
- },
- ]);
- // 卡片点击事件
- const handleCardClick = (card) => {
- console.log("卡片点击:", card);
- // router.push(card.route);
- };
- // 播报相关事件
- const handleBroadcast = () => {
- console.log("点击播报");
- // TODO: 实现播报功能
- };
- const handleMoreBroadcast = () => {
- console.log("查看更多播报");
- // TODO: 跳转到播报列表页面
- };
- const handleBroadcastItem = (item) => {
- console.log("播报项点击:", item);
- // TODO: 处理播报项点击事件
- };
- onMounted(() => {});
- const isExpanded = ref(false);
- const weatherExpanded = (isExpandedValue) => {
- isExpanded.value = isExpandedValue;
- };
- function toSubPage() {
- router.push("/create_farm?isFromHome=true");
- }
- function toFarmPhoto() {
- router.push({
- path: "/farm_photo",
- });
- }
- function toFarmInfo() {
- // farmInfoRef.value.handleShow();
- }
- </script>
- <style scoped lang="scss">
- .monitor-index {
- width: 100%;
- height: 100%;
- padding: 13px 10px;
- box-sizing: border-box;
- background-image: linear-gradient(250deg, #CBEBFF 0% ,#dceffd 50%,#e7f3fd 100%);
- .weather-mask {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.52);
- z-index: 2;
- }
- .weather-info {
- width: calc(100% - 20px);
- position: absolute;
- z-index: 3;
- }
- .operation-button {
- position: absolute;
- top: 117px;
- left: 12px;
- width: calc(100% - 24px);
- z-index: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 12px;
- font-weight: 500;
- .button-group {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .button-item {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- color: rgba(0, 0, 0, 0.8);
- background-color: #fff;
- border: 1px solid #f2f2f2;
- .button-icon {
- width: 13px;
- height: 13px;
- }
- }
- .button-item:first-child {
- margin-right: 10px;
- }
- }
- .add-farm-button {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- background: rgba(33, 153, 248, 0.1);
- border: 1px solid #fff;
- .icon {
- width: 14px;
- height: 14px;
- }
- }
- .button-item,
- .add-farm-button {
- border-radius: 25px;
- padding: 8px 12px;
- }
- }
- .function-cards {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 10px;
- margin-top: 155px;
- .function-card {
- background: #fff;
- border-radius: 12px;
- padding: 25px 0;
- box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 10px;
- img {
- width: 30px;
- height: 30px;
- }
- .card-title {
- font-size: 14px;
- font-weight: 500;
- color: #1d2129;
- }
- .card-status {
- position: absolute;
- top: 0;
- right: 0;
- padding: 1px 4px;
- border-radius: 6px 8px 8px 2px;
- font-size: 10px;
- background: #2199f8;
- color: #fff;
- }
- }
- }
- .realtime-broadcast {
- margin-top: 10px;
- background: #fff;
- border-radius: 8px;
- box-sizing: border-box;
- padding: 12px;
- .broadcast-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 4px;
- .header-left {
- display: flex;
- align-items: center;
- gap: 12px;
- .broadcast-title {
- font-size: 16px;
- font-weight: 600;
- color: #1d2129;
- }
- .broadcast-action {
- display: flex;
- align-items: center;
- gap: 4px;
- .speaker-icon {
- width: 16px;
- height: 14px;
- }
- .broadcast-text {
- color: #2199f8;
- }
- }
- }
- .more-link {
- display: flex;
- align-items: center;
- color: #4e5969;
- }
- }
- .broadcast-list {
- overflow: auto;
- .broadcast-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 12px 0;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- &:last-child {
- border-bottom: none;
- }
- .item-content {
- .content-top{
- display: flex;
- align-items: center;
- }
- .item-icon {
- margin-right: 8px;
- background: rgba(255, 0, 0, 0.05);
- width: 26px;
- height: 26px;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- img {
- width: 18px;
- height: 12px;
- }
- }
- .item-title {
- color: #1d2129;
- }
- .item-status {
- margin-top: 3px;
- font-size: 13px;
- color: rgba(29, 33, 41, 0.5);
- .countdown {
- color: #ff7254;
- }
- }
- }
- .item-zone {
- background: rgba(241, 243, 246, 0.5);
- color: #7c7e81;
- font-size: 12px;
- padding: 3px 11px;
- border-radius: 25px;
- display: flex;
- align-items: center;
- gap: 8px;
- .point {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: rgba(124, 126, 129, 0.5);
- }
- }
- }
- }
- }
- }
- </style>
|