|
@@ -1,9 +1,7 @@
|
|
|
<template>
|
|
|
- <!-- 导航 -->
|
|
|
<div class="navigate">
|
|
|
<div class="partOne">
|
|
|
<div class="inner">
|
|
|
- <!-- 导航一 -->
|
|
|
<div class="navLeft">
|
|
|
<div class="navIndex">
|
|
|
<NuxtLink to="/" target="_blank" title="首页">
|
|
@@ -21,14 +19,11 @@
|
|
|
</div>
|
|
|
<ul class="navigationOne">
|
|
|
<li v-for="(item, index) in navigation1" :key="index">
|
|
|
- <!-- <NuxtLink :to="`/primaryNavigation/${item.alias}`" target="_blank">{{ item.alias }}</NuxtLink> -->
|
|
|
- <!-- <NuxtLink :to="{ path: `/primaryNavigation/${item.category_id}`, query: { name: item.name } }" -->
|
|
|
<NuxtLink :to="{ path: `/primaryNavigation/${item.category_id}`}"
|
|
|
target="_blank" v-if="item.children_count != 0">
|
|
|
<span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
|
|
|
<span v-else>{{ item.name }}</span>
|
|
|
</NuxtLink>
|
|
|
- <!-- <NuxtLink :to="{ path: `/newsList/${item.category_id}`, query: { name: item.name } }" -->
|
|
|
<NuxtLink :to="{ path: `/newsList/${item.category_id}` }"
|
|
|
target="_blank" v-if="item.children_count == 0 && item.is_url != 1">
|
|
|
<span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
|
|
@@ -43,28 +38,6 @@
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
- <!-- <div class="partThree">
|
|
|
- 地方频道
|
|
|
- <div class="inner">
|
|
|
- channel 频道
|
|
|
- <h5 class="channel">地方频道</h5>
|
|
|
- <p class="areaChannel">
|
|
|
- <span v-for="(item, index) in areaList" :key="index">
|
|
|
- <a href="#">{{ item.name }}</a>
|
|
|
- </span>
|
|
|
- </p>
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
-
|
|
|
- <!-- 导航栏下的大图 -->
|
|
|
- <!-- <div class="logo">
|
|
|
- <div class="inner">
|
|
|
- <img src="../../static/image/banner1.png" alt="">
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
-
|
|
|
<!-- 展示地区 -->
|
|
|
<div class="cityBox">
|
|
|
<div class="cityMain">
|
|
@@ -73,15 +46,11 @@
|
|
|
</div>
|
|
|
<ul class="cityList">
|
|
|
<li v-for="(item, index) in provinceList" :key="index" @click="goToSearch(item.id)">
|
|
|
- <!-- <NuxtLink :to="{path:`/search/search?catids=${item.id}`}" target="_blank">
|
|
|
- {{item.abbreviation}}
|
|
|
- </NuxtLink> -->
|
|
|
{{item.abbreviation}}
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<!-- 行政查询 -->
|
|
|
<div class="select">
|
|
|
<div class="inner">
|
|
@@ -125,136 +94,130 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+//1.加载依赖 start ---------------------------------------->
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
-
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
import { ElSelect, ElOption } from 'element-plus'
|
|
|
+
|
|
|
const nuxtApp = useNuxtApp();
|
|
|
const axios = nuxtApp.$axios;
|
|
|
-//获得route
|
|
|
+
|
|
|
const route = useRoute();
|
|
|
const routeId = route.params.id; //获得该页面的id
|
|
|
-const pageName = route.query.name;//获得页面名称
|
|
|
+//1.加载依赖 end ---------------------------------------->
|
|
|
|
|
|
-//获取导航一的栏目
|
|
|
+//2.加载模块数据 start ---------------------------------------->
|
|
|
const navigation1 = ref("");
|
|
|
-const navigateList = async () => {
|
|
|
- try {
|
|
|
- const response = await axios.get(`/web/getWebsiteModelCategory?placeid=${1}&pid=${0}&num=${35}`);
|
|
|
- console.log(response.data);
|
|
|
- navigation1.value = response.data;
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// const navigateList = async () => {
|
|
|
-// try {
|
|
|
-// const response = await axios.get(`/web/getWebsiteCategory?pageSize=${24}`);
|
|
|
-// console.log(response.data);
|
|
|
-// navigation1.value = response.data;
|
|
|
-// } catch (error) {
|
|
|
-// console.error(error);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-//获取导航二的栏目
|
|
|
-const navigation2 = ref("");
|
|
|
-const navigate2List = async () => {
|
|
|
- try {
|
|
|
- const response = await axios.get(`/web/getWebsiteModelCategory?placeid=${2}&pid=${1}&num=${13}`);
|
|
|
- // console.log(response.data);
|
|
|
- navigation2.value = response.data;
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+async function getPageData2() {
|
|
|
+ const { data: mkdata, error: mkdataError } = requestData('/web/getWebsiteModelCategory', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'placeid': 1,
|
|
|
+ 'pid': 0,
|
|
|
+ 'num': 35
|
|
|
+ },
|
|
|
+ });
|
|
|
+ if (mkdataError.value) {
|
|
|
+ //console.log()
|
|
|
+ } else {
|
|
|
+ if (mkdata.value) {
|
|
|
+ navigation1.value = mkdata.value.data;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+getPageData2();
|
|
|
+//2.加载模块数据 end ---------------------------------------->
|
|
|
|
|
|
-//职能部门 搜索
|
|
|
+//3.职能部门 start ---------------------------------------->
|
|
|
let department = ref("安全")
|
|
|
const depValue = ref("")
|
|
|
const typeValue = ref("")
|
|
|
let departmentList = async () => {
|
|
|
- try {
|
|
|
- const response = await axios.get(`/web/selectWebsiteDepartment?keyword=${department.value}`);
|
|
|
- // console.log(response.data.department);
|
|
|
- department.value = response.data.department
|
|
|
- // console.log(department.value);
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ const { data: mkdata, error: mkdataError } = requestData('/web/selectWebsiteDepartment', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'keyword': department.value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ if (mkdataError.value) {
|
|
|
+ //console.log()
|
|
|
+ } else {
|
|
|
+ console.log(department.value)
|
|
|
+ if (mkdata.value) {
|
|
|
+ console.log(mkdata.value.data.department)
|
|
|
+ department.value = mkdata.value.data.department;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+//获得所有部门
|
|
|
+departmentList();
|
|
|
+//3.职能部门 end ---------------------------------------->
|
|
|
|
|
|
-
|
|
|
-//获取地区各省名称
|
|
|
+//4.展示行政区划 start ---------------------------------------->
|
|
|
let areaList = ref("")
|
|
|
-//获取省名称
|
|
|
-let province = useState("province", () => "")
|
|
|
-let provinceid = useState("provinceid", () => null)
|
|
|
-let provinceList = useState("provinceList", () => "")
|
|
|
+//4.1 省
|
|
|
+let province = ref("")
|
|
|
+let provinceid = ref("")
|
|
|
+let provinceList = ref("")
|
|
|
+//4.2 市
|
|
|
+let city = ref("")
|
|
|
+let cityid = ref("")
|
|
|
+let cityList = ref("")
|
|
|
+//4.3 县
|
|
|
+let region = ref("")
|
|
|
+let regionid = ref("")
|
|
|
+let regionList = ref("")
|
|
|
+
|
|
|
+//选择省
|
|
|
let areaArrList = async () => {
|
|
|
- try {
|
|
|
- const response = await axios.get('/web/getWebsiteDistrit');
|
|
|
- console.log(response.data);
|
|
|
- areaList.value = response.data;
|
|
|
- provinceList.value = response.data
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ const { data: mkdata, error: mkdataError } = requestData('/web/selectWebsiteArea', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {},
|
|
|
+ });
|
|
|
+ if (mkdataError.value) {
|
|
|
+ //console.log()
|
|
|
+ } else {
|
|
|
+ console.log(department.value)
|
|
|
+ if (mkdata.value) {
|
|
|
+ console.log(mkdata.value)
|
|
|
+ areaList.value = mkdata.value.data;
|
|
|
+ provinceList.value = mkdata.value.data;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// 获取城市名称
|
|
|
-let city = useState("city", () => "")
|
|
|
-let cityid = useState("cityid", () => "")
|
|
|
-let cityList = useState("cityList", () => "")
|
|
|
-
|
|
|
-//选择省份后省份的id
|
|
|
-let change = (id) => {
|
|
|
- console.log(id);
|
|
|
- provinceid.value = id
|
|
|
- console.log(provinceid.value);
|
|
|
-
|
|
|
- //根据省id获取对应的市名称
|
|
|
- axios.get(`web/selectWebsiteArea?province=${provinceid.value}&city=0`).then(response => {
|
|
|
- // console.log("response", response.data.city);
|
|
|
- cityList.value = response.data.city;
|
|
|
- // console.log("cityList", cityList.value);
|
|
|
- }).catch(error => {
|
|
|
- console.error(error);
|
|
|
- })
|
|
|
-
|
|
|
+//一开始只需要获取一下省
|
|
|
+areaArrList();
|
|
|
+
|
|
|
+//选择市
|
|
|
+let change = async (id) => {
|
|
|
+ provinceid.value = id;
|
|
|
+ const shengData = await requestDataPromise('/web/selectWebsiteArea', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'province': id,
|
|
|
+ 'city': 0
|
|
|
+ },
|
|
|
+ });
|
|
|
+ cityList.value = shengData.data.city;
|
|
|
}
|
|
|
|
|
|
-// 获取区/县名称
|
|
|
-let region = useState("region", () => "")
|
|
|
-let regionid = useState("regionid", () => "")
|
|
|
-let regionList = useState("regionList", () => "")
|
|
|
-
|
|
|
-//选择市后市的id
|
|
|
-let change1 = (id) => {
|
|
|
- console.log(id);
|
|
|
- cityid.value = id
|
|
|
- console.log(cityid.value);
|
|
|
-
|
|
|
- //根据市id获取对应的区/县名称
|
|
|
- axios.get(`web/selectWebsiteArea?province=${provinceid.value}&city=${cityid.value}`).then(response => {
|
|
|
- // console.log("response", response.data);
|
|
|
- regionList.value = response.data.region;
|
|
|
- // console.log("regionList", regionList.value);
|
|
|
- }).catch(error => {
|
|
|
- console.error(error);
|
|
|
- })
|
|
|
+//选择县
|
|
|
+let change1 = async (id) => {
|
|
|
+ cityid.value = id;
|
|
|
+ const xianData = await requestDataPromise('/web/selectWebsiteArea', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'province': provinceid.value,
|
|
|
+ 'city': cityid.value
|
|
|
+ },
|
|
|
+ });
|
|
|
+ regionList.value = xianData.data.region;
|
|
|
}
|
|
|
+//4.展示行政区划 end ---------------------------------------->
|
|
|
|
|
|
-//depValue.value 行政区划
|
|
|
-//二级导航id
|
|
|
-//province.value 省id
|
|
|
-//city.value 市id
|
|
|
-//region.value 县id
|
|
|
+//5.执行搜索 start ---------------------------------------->
|
|
|
const getcityid = ref("")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+//跳转到搜索页面
|
|
|
let goToSearch = (id) => {
|
|
|
console.log(id)
|
|
|
const route = `/search/search?catids=${id}`;
|
|
@@ -262,55 +225,41 @@ let goToSearch = (id) => {
|
|
|
}
|
|
|
|
|
|
//获得cityid和
|
|
|
-let goToPrimary = () => {
|
|
|
- // console.log(depValue.value)
|
|
|
- // console.log(routeId)
|
|
|
+let goToPrimary = async () => {
|
|
|
if (province.value != "") { getcityid.value = province.value }
|
|
|
if (city.value != "") { getcityid.value = city.value }
|
|
|
if (region.value != "") { getcityid.value = region.value }
|
|
|
- console.log(getcityid.value)
|
|
|
- //console.log(pageName)
|
|
|
-
|
|
|
- //跳转过去
|
|
|
- // navigateTo({
|
|
|
- // path: `/primaryNavigation/${routeId}`,
|
|
|
- // query: {
|
|
|
- // cityid: getcityid.value,
|
|
|
- // name: pageName,
|
|
|
- // department_id: depValue.value
|
|
|
- // }
|
|
|
- // })
|
|
|
|
|
|
if (province.value == ""&&city.value == ""&®ion.value == ""&&depValue.value=="") {
|
|
|
ElMessage.error('请选择行政区划或者职能部门!')
|
|
|
}else{
|
|
|
- //根据市id获取对应的区/县名称
|
|
|
- axios.get(`/web/selectWebsiteCategory?cityid=${getcityid.value}&department_id=${depValue.value}`).then(response => {
|
|
|
- if (response.data.catid && response.data.catid.length > 0) {
|
|
|
- const catids = response.data.catid.join(',');
|
|
|
- const route = `/search/search?catids=${catids}`;
|
|
|
- window.open(route, '_blank');
|
|
|
- } else {
|
|
|
- // 可以在这里处理数组为空的情况
|
|
|
- console.log('没有可用的分类ID');
|
|
|
- const route = `/search/search`;
|
|
|
- window.open(route, '_blank');
|
|
|
- }
|
|
|
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
+ const responseStatus = await requestDataPromise('/web/selectWebsiteCategory', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'cityid': getcityid.value,
|
|
|
+ 'department_id': depValue.value
|
|
|
+ },
|
|
|
+ });
|
|
|
+ if (responseStatus.data.catid && responseStatus.data.catid.length > 0) {
|
|
|
+ const catids = responseStatus.data.catid.join(',');
|
|
|
+ const route = `/search/search?catids=${catids}`;
|
|
|
+ window.open(route, '_blank');
|
|
|
+ } else {
|
|
|
+ // 可以在这里处理数组为空的情况
|
|
|
+ console.log('没有可用的分类ID');
|
|
|
+ const route = `/search/search`;
|
|
|
+ window.open(route, '_blank');
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
let searchDepartment = () => {
|
|
|
//搜索职能部门
|
|
|
- //console.log(typeValue.value)
|
|
|
- //console.log(department.value)
|
|
|
let status = false;
|
|
|
for (let item of department.value) {
|
|
|
if (item.name == typeValue.value) {
|
|
|
- console.log(item.name)
|
|
|
//如果有就赋值过去
|
|
|
depValue.value = item.id
|
|
|
status = true; //说明有可用的结果
|
|
@@ -320,25 +269,7 @@ let searchDepartment = () => {
|
|
|
//弹出提示告诉用户不存在
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-//挂载成功钩子函数
|
|
|
-onMounted(() => {
|
|
|
- //导航一栏目
|
|
|
- navigateList()
|
|
|
-
|
|
|
- //导航二栏目
|
|
|
- navigate2List()
|
|
|
-
|
|
|
- //获取地区各省名称
|
|
|
- areaArrList()
|
|
|
-
|
|
|
- //获取职能部门
|
|
|
- departmentList()
|
|
|
-
|
|
|
-
|
|
|
-})
|
|
|
-
|
|
|
-
|
|
|
+//5.执行搜索 end ---------------------------------------->
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -404,8 +335,6 @@ onMounted(() => {
|
|
|
flex-wrap: wrap;
|
|
|
padding-top: 20px;
|
|
|
|
|
|
- //justify-content: space-around;
|
|
|
-
|
|
|
li {
|
|
|
width: 68px;
|
|
|
font-family: PingFang SC;
|
|
@@ -419,9 +348,6 @@ onMounted(() => {
|
|
|
margin: 0 10px;
|
|
|
text-align: center;
|
|
|
|
|
|
- // &:nth-last-child(1) {
|
|
|
- // margin-right: 0px;
|
|
|
- // }
|
|
|
|
|
|
a {
|
|
|
color: #fff;
|
|
@@ -435,44 +361,10 @@ onMounted(() => {
|
|
|
|
|
|
.active{
|
|
|
color: #ABE874;
|
|
|
- // display: inline-block;
|
|
|
- // height: 50px;
|
|
|
- // border-bottom: 2px solid #139602
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// .partTwo {
|
|
|
-// width: 100%;
|
|
|
-// height: 57px;
|
|
|
-// line-height: 57px;
|
|
|
-// border-bottom: 1px solid #e3e3e3;
|
|
|
-
|
|
|
-// .navigationTwo {
|
|
|
-// width: 1207px;
|
|
|
-// height: 57px;
|
|
|
-// color: #333333;
|
|
|
-// border-bottom: 1px solid #e3e3e3;
|
|
|
-
|
|
|
-// li {
|
|
|
-// font-weight: 600;
|
|
|
-// font-size: 20px;
|
|
|
-// height: 56px;
|
|
|
-// margin-right: 21px;
|
|
|
-
|
|
|
-// &:nth-last-child(1) {
|
|
|
-// margin-right: 0px;
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// li:hover {
|
|
|
-// color: #139602;
|
|
|
-// border-bottom: 2px solid #139602;
|
|
|
-// }
|
|
|
-
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
.partThree {
|
|
|
width: 100%;
|
|
|
height: 105px;
|
|
@@ -569,9 +461,6 @@ onMounted(() => {
|
|
|
height: 62px;
|
|
|
margin-top: 10px;
|
|
|
background-color: #fafafa;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.role,
|
|
@@ -743,13 +632,6 @@ onMounted(() => {
|
|
|
&:hover {
|
|
|
color: #ABE874;
|
|
|
}
|
|
|
- // a {
|
|
|
- // color: #fff;
|
|
|
- // margin-right: 14px;
|
|
|
- // &:hover {
|
|
|
- // color: #ABE874;
|
|
|
- // }
|
|
|
- // }
|
|
|
}
|
|
|
}
|
|
|
}
|