Zlpt_Portal/src/views/AppMain.vue

73 lines
1.8 KiB
Vue
Raw Normal View History

2023-12-04 09:12:38 +08:00
<script setup lang="ts">
2023-12-07 17:48:36 +08:00
import HeaderCom from '../layout/header.vue'
2023-12-05 17:25:00 +08:00
import FooterInfo from '../components/FooterInfo/index.vue'
2023-12-07 17:48:36 +08:00
import { useRouter } from 'vue-router'
import $bus from '@/utils/bus'
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) => {
2023-12-07 17:48:36 +08:00
if (route.path == '/equipList') {
$bus.emit('search', keywordIptValue.value)
} else {
2023-12-05 17:25:00 +08:00
router.push({
2023-12-07 17:48:36 +08:00
name: 'equipList',
state: { keyWord: keywordIptValue.value }
2023-12-05 17:25:00 +08:00
})
}
2023-12-04 09:12:38 +08:00
}
// 点击下方搜索记录时
const handleHistory = (hisValue: any) => {
keywordIptValue.value = hisValue
2023-12-05 17:25:00 +08:00
}
//页面刷新回显模糊搜索词
2023-12-07 17:48:36 +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
})
2023-12-04 09:12:38 +08:00
</script>
<template>
2023-12-07 17:48:36 +08:00
<HeaderCom />
2023-12-04 09:12:38 +08:00
<div class="container">
<RouterView />
</div>
<FooterInfo v-if="isMyInfoPage()" />
</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;
}
</style>