Zlpt_Portal/src/views/AppMain.vue

277 lines
7.9 KiB
Vue
Raw Normal View History

2023-12-04 09:12:38 +08:00
<script setup lang="ts">
2023-12-05 17:25:00 +08:00
import FooterInfo from '../components/FooterInfo/index.vue'
import {useRouter} from "vue-router";
import $bus from "@/utils/bus"
2023-12-07 17:49:10 +08:00
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
const locale = zhCn
2023-12-05 17:25:00 +08:00
const route = useRoute()
2023-12-04 17:42:11 +08:00
const router = useRouter()
2023-12-04 09:12:38 +08:00
// 判断是否是个人中心页面 如果是则隐藏页脚
const isMyInfoPage = () => {
if (route.path.indexOf('myuser') === -1) {
return true
} else {
return false
}
}
// 搜索查询绑定值
const keywordIptValue = ref('')
// 输入框下方历史搜索记录
const searchHistoryList = ref([
{ name: '220E履带挖掘机' },
{ name: '3443挖掘机' },
{ name: '塔式起重机' },
{ name: '轮式牵引铲运机' }
])
// 搜索按钮
2023-12-05 17:25:00 +08:00
const searchKeywordBtn = (e) => {
if(route.path == '/equipList'){
$bus.emit('search',keywordIptValue.value)
}else {
router.push({
name:'equipList',
state:{keyWord: keywordIptValue.value}
})
}
2023-12-04 09:12:38 +08:00
}
// 点击下方搜索记录时
const handleHistory = (hisValue: any) => {
keywordIptValue.value = hisValue
2023-12-05 17:25:00 +08:00
}
//页面刷新回显模糊搜索词
$bus.on('callBackText',(val) => {
2023-12-04 17:42:11 +08:00
nextTick(() => {
2023-12-05 17:25:00 +08:00
keywordIptValue.value = val
2023-12-04 17:42:11 +08:00
})
2023-12-05 17:25:00 +08:00
})
onMounted(() => {
2023-12-04 09:12:38 +08:00
2023-12-05 17:25:00 +08:00
})
2023-12-04 09:12:38 +08:00
</script>
<template>
<div class="shop-header">
<div class="header-box">
<ul class="header-wapper">
<li>
<span>
2023-12-04 13:10:38 +08:00
<a @click="$router.push('/login')">登录</a>
2023-12-04 09:12:38 +08:00
/
2023-12-04 13:10:38 +08:00
<a style="color: #6d6d6d">注册</a>
2023-12-04 09:12:38 +08:00
</span>
</li>
<li>
<span @click="$router.push({ name: 'myuser' })">个人中心</span>
</li>
<li @click="$router.push('/collect')">
2023-12-05 17:25:00 +08:00
<img src="./assets/img/home/2023_12_01_beijing2/shoucang.png" alt="" />
2023-12-04 09:12:38 +08:00
<span>收藏夹</span>
</li>
<li>
2023-12-05 17:25:00 +08:00
<img src="./assets/img/home/2023_12_01_beijing2/shouji.png" alt="" />
2023-12-04 09:12:38 +08:00
<span class="last-span">手机版</span>
</li>
</ul>
</div>
<!-- 菜单 -->
<div class="shop-menu-box">
<div class="shop-menu">
<div class="left-logo" @click="$router.push('/home')">
<!-- 首页Logo -->
<img
src="@/assets/img/home/2023_12_01_beijing2/logo.png"
alt="首页"
title="首页" />
</div>
<input
placeholder="输入设备关键词"
type="text"
v-model="keywordIptValue"
2023-12-05 17:25:00 +08:00
@keydown.enter="searchKeywordBtn" />
2023-12-04 09:12:38 +08:00
<button class="search-btn" @click="searchKeywordBtn">搜索</button>
<div class="erweima">
<div class="tilte">手机扫码登录</div>
<img src="" alt="" />
</div>
<div class="ipt-down">
<a
@click="handleHistory(item.name)"
v-for="item in searchHistoryList"
:key="item.name">
{{ item.name }}
</a>
</div>
</div>
</div>
</div>
<div class="container">
2023-12-07 17:49:10 +08:00
<el-config-provider :locale="locale">
<RouterView />
</el-config-provider>
2023-12-04 09:12:38 +08:00
</div>
<FooterInfo v-if="isMyInfoPage()" />
2023-12-05 17:25:00 +08:00
<!-- <FooterInfo /> -->
2023-12-04 09:12:38 +08:00
</template>
<style scoped lang="scss">
.container {
width: 1200px;
margin: 0 auto;
overflow: hidden;
background: #ffffff;
border-radius: 30px;
padding: 20px 30px;
box-sizing: border-box;
}
.shop-header {
// height: 157px;
width: 100%;
position: sticky;
top: 0;
left: 0;
z-index: 999;
.header-box {
background-color: #f5f5f5;
width: 100%;
.header-wapper {
width: 1200px;
height: 37px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: flex-end;
li {
display: flex;
align-items: center;
justify-content: center;
height: 37px;
cursor: pointer;
margin-left: 20px;
span {
color: #6d6d6d;
font-size: 14px;
padding: 0 20px 0 3px;
border-right: 1px solid #666655;
&:hover {
color: #2282ff;
}
a {
text-decoration: none;
color: #2282ff;
}
}
.last-span {
border: none;
padding: 0;
}
}
}
}
.shop-menu-box {
background-color: #edeef6;
.shop-menu {
position: relative;
width: 1200px;
height: 140px;
margin: 0 auto;
display: flex;
align-items: center;
.left-logo {
color: #999999;
font-weight: bold;
font-size: 20px;
img {
width: 176px;
height: 58px;
cursor: pointer;
}
}
input {
width: 700px;
height: 45px;
border: 1px solid #5ca4ff;
border-radius: 45px;
margin-left: 70px;
line-height: 45px;
color: transparent;
text-shadow: 0 0 0 #333;
padding-left: 30px;
}
input:focus {
outline: 1px solid #5ca4ff;
}
input::-webkit-input-placeholder {
color: #949494;
}
.search-btn {
width: 100px;
height: 39px;
transform: translateX(-110px);
border-radius: 39px;
background: linear-gradient(132deg, #6de7ff 0%, #348cff 100%);
box-shadow: 0px 2px 4px 0px rgba(20, 175, 255, 0.5);
border: none;
color: #fff;
cursor: pointer;
font-size: 18px;
}
.erweima {
2023-12-05 17:05:54 +08:00
display: none;
2023-12-04 09:12:38 +08:00
width: 100px;
height: 80px;
margin-left: -20px;
padding: 10px;
background-color: #fff;
.tilte {
font-size: 14px;
color: #1f88ff;
text-align: center;
}
}
.ipt-down {
position: absolute;
bottom: 20px;
left: 22%;
overflow: hidden;
a {
padding: 0 10px;
color: #727272;
font-size: 14px;
cursor: pointer;
}
}
}
}
}
</style>