355 lines
9.2 KiB
Vue
Raw Normal View History

2025-01-25 02:48:00 +00:00
<template>
<div class="layout-header-warp">
<div class="layout-header">
<div class="layout-header-top">
<div class="layout-header-top-left">
2025-05-29 18:02:16 +08:00
<span class="welcome-msg">您好欢迎来到农业产业运营平台</span>
<div class="left-link">
<div class="iconfont icon-bigScreen"></div>
<span>数据大屏</span>
</div>
<div class="left-link">
<div class="iconfont icon-operation" style="font-size: 12px"></div>
<span>产业运营管理</span>
</div>
</div>
<div class="layout-header-top-right">
<el-badge :hidden="goodNum < 1" :value="goodNum" :max="99" class="item" :offset="[-3, 10]">
2025-06-11 14:38:40 +08:00
<div style="display: flex" @click="toCart">
<div class="iconfont icon-shopcar" style="font-size: 14px; margin: 0 5px; color: #25bf82; font-weight: bold"></div>
<div>购物车</div>
</div>
</el-badge>
<el-badge :hidden="true" :value="0" :max="99" class="item" :offset="[-3, 10]">
<span>商家中心</span>
</el-badge>
2025-04-11 17:32:55 +08:00
<span @click="toUserCenter">个人中心</span>
2025-07-01 14:18:38 +08:00
<span class="block-icon" style="line-height: 28px" @click="toHome">
<el-tooltip effect="dark" content="退出" placement="bottom">
<img src="@/assets/images/quit.svg" style="width: 20px" alt="" />
</el-tooltip>
<!-- <div class="iconfont icon-home" style="font-size: 12px"></div>
<span>返回首页</span> -->
</span>
</div>
2025-01-25 02:48:00 +00:00
</div>
<div class="layout-header-bottom">
<div class="layout-header-bottom-left">
<div class="layout-header-bottom-search">
<div class="title">
<img :src="getAssetsFile('images/logo2.png')" />
</div>
<div class="search-warp">
<el-input v-model="keyword" placeholder="请输入关键词进行搜索"></el-input>
<el-button type="primary" @click="Search">搜索</el-button>
</div>
</div>
2025-01-25 02:48:00 +00:00
</div>
<div class="layout-header-bottom-right">
<div class="layout-header-bottom-right-qr">
<div class="layout-header-bottom-right-qr-img">
<img :src="getAssetsFile('images/basic/QRCodeZWY.png')" alt="" />
<p>政务云App</p>
</div>
<div class="layout-header-bottom-right-qr-img">
<img :src="getAssetsFile('images/basic/QRCodeYYY.png')" alt="" />
<p>运营云APP</p>
</div>
</div>
</div>
</div>
<div class="layout-header-menu">
2025-01-25 02:48:00 +00:00
<el-menu ellipsis class="layout-header-bottom-menu" mode="horizontal">
<app-link v-for="(item, index) in meuns" :key="index" :to="item.path">
<el-menu-item active-text-color="#25BF82">{{ item.label }}</el-menu-item>
2025-01-25 02:48:00 +00:00
</app-link>
</el-menu>
</div>
</div>
</div>
</template>
<script setup name="layout-header">
import { ref, onMounted, onBeforeUnmount } from 'vue';
2025-01-25 02:48:00 +00:00
import { qrImg } from './base64img';
import AppLink from '../Menu/Link.vue';
2025-04-14 02:39:31 +01:00
import { useRouter } from 'vue-router';
import { getAssetsFile } from '@/utils';
import { getGoodNum } from '@/apis/agricultural.js';
import { useMethodsStore } from '@/store/modules/methods';
2025-01-25 02:48:00 +00:00
const router = useRouter();
2025-01-25 02:48:00 +00:00
const keyword = ref('');
const meuns = ref([
{
label: '综合看板',
path: '/sub-operation-service/dashboard',
},
2025-01-25 02:48:00 +00:00
{
label: '智慧种植',
path: '/sub-operation-service/smartFarm',
2025-01-25 02:48:00 +00:00
},
{
2025-04-30 14:45:52 +08:00
label: '电商交易',
2025-04-09 10:21:21 +01:00
path: '/sub-operation-service/ecommerce',
2025-01-25 02:48:00 +00:00
},
{
label: '涉农金融',
2025-06-12 14:53:41 +08:00
path: '/sub-operation-service/finance',
2025-01-25 02:48:00 +00:00
},
{
label: '分拣包装',
path: '/sub-operation-service/packaging',
2025-01-25 02:48:00 +00:00
},
{
label: '仓储物流',
path: '/sub-operation-service/warehouseLogistics',
2025-01-25 02:48:00 +00:00
},
{
label: '农事服务',
path: '/sub-operation-service/farmService',
},
2025-01-25 02:48:00 +00:00
{
label: '公共品牌',
path: '/sub-operation-service/brand',
2025-01-25 02:48:00 +00:00
},
]);
const goodNum = ref(0);
const methodsStore = useMethodsStore();
const getGoods = () => {
getGoodNum().then((res) => {
goodNum.value = res.data ? res.data : 0;
});
};
onMounted(() => {
getGoods();
methodsStore.registerOuterMethod(getGoods);
});
// 组件卸载时清除方法
onBeforeUnmount(() => {
methodsStore.registerOuterMethod(null);
});
2025-01-25 02:48:00 +00:00
function Search() {
console.log(keyword.value, 'search');
}
const toHome = () => {
console.info('toHome', router);
window.location.href = '/';
};
2025-04-11 17:32:55 +08:00
const toUserCenter = () => {
2025-05-20 13:05:37 +08:00
console.info('toUserCenter', router);
2025-06-12 14:53:41 +08:00
router.push('/sub-operation-service/userCenter?from=userCenter');
2025-04-11 17:32:55 +08:00
};
2025-04-14 15:33:58 +08:00
const toCart = () => {
2025-06-12 15:46:55 +08:00
router.push('/sub-operation-service/shoppingCarts');
2025-04-14 15:33:58 +08:00
};
2025-01-25 02:48:00 +00:00
</script>
<style lang="scss" scoped>
.layout-header-warp {
width: 100%;
text-align: center;
2025-04-14 09:33:57 +08:00
background: $color-fff;
.layout-header-menu {
width: 100%;
::v-deep() {
.el-menu {
justify-content: space-around;
border: none !important;
}
.el-menu-item {
font-size: 20px;
}
.el-menu-item:hover {
color: $color-main;
2025-05-20 13:05:37 +08:00
background: none !important;
}
.el-menu-item:active {
color: $color-main;
2025-05-20 13:05:37 +08:00
background: none !important;
}
}
}
}
2025-01-25 02:48:00 +00:00
.layout {
// width: 100%;
// height: 100%;
// box-sizing: border-box;
&-header {
overflow: hidden;
margin: auto;
2025-05-20 13:05:37 +08:00
width: 1200px;
height: 206px;
2025-01-25 02:48:00 +00:00
&-top {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 32px;
2025-05-20 13:05:37 +08:00
height: 44px;
2025-01-25 02:48:00 +00:00
&-left {
line-height: 36px;
.welcome-msg {
font-size: 12px;
color: $color-5a;
}
.left-link {
2025-05-20 13:05:37 +08:00
display: inline-block;
margin: 0 10px;
font-size: 12px;
2025-05-20 13:05:37 +08:00
color: $color-main;
2025-01-25 02:48:00 +00:00
cursor: pointer;
.iconfont {
display: inline-block;
margin-right: 2px;
2025-05-20 13:05:37 +08:00
color: $color-main;
}
.iconfont,
span {
vertical-align: middle;
}
2025-01-25 02:48:00 +00:00
}
}
&-right {
span {
margin-left: 25px;
font-size: 12px;
2025-01-25 02:48:00 +00:00
text-align: center;
2025-05-20 13:05:37 +08:00
color: $color-000;
line-height: 36px;
2025-01-25 02:48:00 +00:00
cursor: pointer;
&:nth-child(1) {
margin-left: 0;
}
2025-04-14 15:33:58 +08:00
&.block-icon {
.iconfont {
display: inline-block;
vertical-align: middle;
color: $color-main;
2025-04-14 15:33:58 +08:00
&.icon-shopcar {
font-size: 16px !important;
font-weight: bold;
}
}
span {
display: inline-block;
2025-05-20 13:05:37 +08:00
margin-left: 6px;
vertical-align: middle;
}
2025-05-20 13:05:37 +08:00
color: $color-main;
2025-01-25 02:48:00 +00:00
}
}
}
}
&-bottom {
display: flex;
padding: 20px 32px 0;
&-left {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
width: calc(100% - 300px);
.layout-header-bottom-search {
display: flex;
align-items: center;
.title {
font-size: 45px;
white-space: nowrap;
img {
height: 70px;
}
2025-01-25 02:48:00 +00:00
}
.search-warp {
position: relative;
2025-05-20 13:05:37 +08:00
padding-left: 36px;
2025-06-09 10:59:28 +08:00
width: 80%;
.el-input {
width: 76%;
height: 50px;
font-size: 18px;
2025-05-20 13:05:37 +08:00
flex-grow: 1;
border-radius: 14px;
2025-04-14 02:39:31 +01:00
:deep(.el-input__wrapper) {
padding-right: 100px;
border-radius: 14px;
border: 1px solid rgb(49, 202, 141);
box-shadow: none !important; /* 移除默认的阴影边框 */
}
}
.el-button {
position: absolute;
top: 50%;
right: 11.8%;
border-radius: 12px;
padding: 0 24px;
height: 43px;
2025-05-20 13:05:37 +08:00
font-size: 18px;
transform: translateY(-50%);
}
2025-01-25 02:48:00 +00:00
}
}
.layout-header-bottom-menu {
justify-content: space-around;
border: none;
.el-menu-item {
font-size: 20px;
2025-01-25 02:48:00 +00:00
}
}
}
&-right {
margin-top: -10px;
padding-left: 20px;
2025-05-20 13:05:37 +08:00
width: 240px;
2025-01-25 02:48:00 +00:00
p {
text-align: center;
}
&-qr {
display: flex;
justify-content: space-between;
&-img {
img {
width: 48px;
height: 48px;
2025-01-25 02:48:00 +00:00
}
p {
text-align: center;
}
}
}
}
}
}
&-main {
width: 100%;
height: calc(100% - 206px);
background-color: #f8f8f8;
}
}
.layout-header-bottom-right {
margin-top: 0;
}
2025-06-11 14:38:40 +08:00
.layout-header-top-right {
display: flex;
.item {
margin-left: 25px;
font-size: 12px;
text-align: center;
color: $color-000;
line-height: 36px;
cursor: pointer;
}
}
2025-01-25 02:48:00 +00:00
</style>