123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- <template>
- <div class="navigate">
- <div class="partOne">
- <div class="inner">
- <div class="navLeft">
- <div class="navIndex">
- <NuxtLink to="/" target="_blank" title="首页">
- 首页
- </NuxtLink>
- </div>
- <div class="navClass">
- <div>
- <a href="#ztzx" title="主题资讯">主题资讯</a>
- </div>
- <div>
- <a href="#hdzx" title="互动资讯">互动资讯</a>
- </div>
- </div>
- </div>
- <ul class="navigationOne">
- <li v-for="(item, index) in navigation1" :key="index">
- <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}` }"
- target="_blank" v-if="item.children_count == 0 && item.is_url != 1">
- <span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
- <span v-else>{{ item.name }}</span>
- </NuxtLink>
- <NuxtLink :to="item.web_url"
- target="_blank" v-if="item.children_count == 0 && item.is_url == 1">
- <span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
- <span v-else>{{ item.name }}</span>
- </NuxtLink>
- </li>
- </ul>
- </div>
- </div>
- <!-- 展示地区 -->
- <div class="cityBox">
- <div class="cityMain">
- <div class="cityTitle">
- 地方频道
- </div>
- <ul class="cityList">
- <li v-for="(item, index) in provinceList" :key="index" @click="goToSearch(item.id)">
- {{item.abbreviation}}
- </li>
- </ul>
- </div>
- </div>
- <!-- 行政查询 -->
- <div class="select">
- <div class="inner">
- <div class="role left">
- <div class="title">行政职能查询</div>
- <div class="searchRole">
- <el-select v-model="depValue" placeholder="职能部门" size="large" style="width: 80px">
- <el-option v-for="(item, index) in department" :key="index" :label="item.name"
- :value="item.id" />
- </el-select>
- <i></i>
- <input type="text" v-model="typeValue" placeholder="输入关键词" class="ipt">
- <em @click="searchDepartment"></em>
- </div>
- </div>
- <div class="region left">
- <div class="title">行政区划查询</div>
- <div class="searchRole">
- <el-select v-model="province" placeholder="请选择省" size="large" style="width: 80px">
- <el-option v-for="item in provinceList" :key="item.id" :label="item.name"
- @click="change(item.id)" :value="item.id" />
- </el-select>
- <i></i>
- <el-select v-model="city" placeholder="请选择市" no-data-text="请先选择省份" size="large"
- style="width: 80px">
- <el-option v-for="(item, index) in cityList" :key="item.id" :label="item.name"
- @click="change1(item.id)" :value="item.id" />
- </el-select>
- <i></i>
- <el-select v-model="region" placeholder="请选择区/县" no-data-text="请先选择市" size="large"
- style="width: 100px">
- <el-option v-for="item in regionList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <em @click="goToPrimary"></em>
- </div>
- </div>
- </div>
- </div>
- </div>
- </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;
- const route = useRoute();
- const routeId = route.params.id; //获得该页面的id
- //1.加载依赖 end ---------------------------------------->
- //2.加载模块数据 start ---------------------------------------->
- const navigation1 = ref("");
- 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 () => {
- 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("")
- //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 () => {
- 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;
- }
- }
- }
- //一开始只需要获取一下省
- 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 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 ---------------------------------------->
- //5.执行搜索 start ---------------------------------------->
- const getcityid = ref("")
- //跳转到搜索页面
- let goToSearch = (id) => {
- console.log(id)
- const route = `/search/search?catids=${id}`;
- window.open(route, '_blank');
- }
- //获得cityid和
- let goToPrimary = async () => {
- if (province.value != "") { getcityid.value = province.value }
- if (city.value != "") { getcityid.value = city.value }
- if (region.value != "") { getcityid.value = region.value }
- if (province.value == ""&&city.value == ""&®ion.value == ""&&depValue.value=="") {
- ElMessage.error('请选择行政区划或者职能部门!')
- }else{
- 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 = () => {
- //搜索职能部门
- let status = false;
- for (let item of department.value) {
- if (item.name == typeValue.value) {
- //如果有就赋值过去
- depValue.value = item.id
- status = true; //说明有可用的结果
- }
- }
- if (status == true) {
- //弹出提示告诉用户不存在
- }
- }
- //5.执行搜索 end ---------------------------------------->
- </script>
- <style lang="less" scoped>
- // 导航部分
- .partOne .navigationOne,
- .partOne .navigationOne>li,
- .partTwo .navigationTwo,
- .partTwo .navigationTwo>li {
- float: left;
- }
- .partOne {
- width: 100%;
- height: 110px;
- margin-bottom: 10px;
- background-color: #fff;
- font-size: 20px;
- font-family: PingFang SC-Semibold;
- background: url("../../static/head/menubg.png") no-repeat center;
-
- .inner {
- display: flex;
- justify-content: space-between;
- .navLeft {
- width:160px;
- font-size: 16px;
- display: flex;
-
- }
- .navIndex {
- height: 100px;
- line-height: 120px;
- a {
- font-size: 16px;
- color: #fff;
- font-weight: bold;
- &:hover {
- color: #ABE874;
- }
- }
- }
- .navClass {
- padding-top: 29px;
- padding-left: 30px;
- font-weight: bold;
- color: #fff;
- a {
- color: #fff;
- &:hover {
- color: #ABE874;
- }
- }
- div:nth-child(2){
- padding-top:20px;
- }
- }
- }
- .navigationOne {
- width: 1200px;
- color: #333;
- display: flex;
- flex-wrap: wrap;
- padding-top: 20px;
-
- li {
- width: 68px;
- font-family: PingFang SC;
- height: 40px;
- line-height: 40px;
- //font-weight: 600;
- font-size: 16px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- margin: 0 10px;
- text-align: center;
- a {
- color: #fff;
- display: block;
- }
- }
- >li:hover a {
- color: #ABE874;
- }
- .active{
- color: #ABE874;
- }
- }
- }
- .partThree {
- width: 100%;
- height: 105px;
- .inner {
- margin-bottom: 5px;
- display: flex;
- }
- .channel,
- .areaChannel {
- float: left;
- margin-top: 17px;
- }
- .channel {
- width: 56px;
- height: 20px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 14px;
- color: #666666;
- line-height: 20px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- .areaChannel {
- width: 1122px;
- margin-left: 14px;
- >span {
- display: inline-block;
- height: 16px;
- line-height: 16px;
- margin-bottom: 10px;
- padding: 0 8px;
- text-align: center;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- text-align: center;
- font-style: normal;
- text-transform: none;
- border-right: 1px solid #e6e6e6;
- a {
- display: inline-block;
- height: 16px;
- color: #868686;
- }
- a:hover {
- color: #868686;
- }
- }
- >span:last-child,
- >span:nth-child(18),
- >span:nth-child(32) {
- border-right: none;
- }
- >span:hover a {
- color: #139602;
- }
- }
- }
- .logo {
- margin-top: 5px;
- height: 90px;
- img {
- width: 1200px;
- height: 90px;
- }
- }
- // 行政查询
- .select {
- width: 100%;
- height: 62px;
- line-height: 62px;
- margin-top: 10px;
- .inner {
- width: 1200px;
- height: 62px;
- margin-top: 10px;
- background-color: #fafafa;
- }
- .role,
- .region {
- float: left;
- height: 62px;
- .el-select--large::v-deep .el-select__wrapper {
- font-size: 14px;
- gap: 6px;
- line-height: 24px;
- min-height: 35px;
- padding: 0;
- border: none;
- box-shadow: none;
- }
- .el-select__placeholder::v-deep.is-transparent {
- color: #999999;
- font-weight: 600;
- }
- >.title {
- float: left;
- width: 120px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 20px;
- color: #666666;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- .searchRole {
- float: left;
- padding-left: 20px;
- box-sizing: border-box;
- i {
- display: inline-block;
- width: 1px;
- height: 12px;
- background-color: #d9d9d9;
- margin: 0 10px;
- vertical-align: middle;
- }
- }
- }
- .role {
- padding-left: 16px;
- .searchRole {
- width: 440px;
- height: 40px;
- line-height: 35px;
- background-color: #fff;
- border: 1px solid #ededed;
- margin: 10px 20px 12px 22px;
- border-radius: 25px;
- em {
- display: inline-block;
- width: 29px;
- height: 29px;
- margin: 4px;
- margin-right: 25px;
- vertical-align: -13px;
- background: url('../../static/image/Iconly/Broken/Search.png');
- cursor: pointer;
- }
- >.ipt {
- width: 245px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 14px;
- color: #666;
- line-height: 16px;
- padding-left: 22px;
- box-sizing: border-box;
- text-align: left;
- font-style: normal;
- text-transform: none;
- border: none;
- outline: none;
- }
- >.ipt::placeholder {
- color: #cccccc;
- }
- span {
- color: #999999;
- }
- }
- }
- .region {
- .searchRole {
- width: 440px;
- height: 40px;
- line-height: 35px;
- background-color: #fff;
- border: 1px solid #ededed;
- margin: 10px 0px 12px 16px;
- border-radius: 25px;
- }
- em {
- display: inline-block;
- width: 29px;
- height: 29px;
- margin-left: 48px;
- vertical-align: middle;
- background: url('../../static/image/Iconly/Broken/Search.png');
- cursor: pointer;
- }
- i {
- display: inline-block;
- width: 24px;
- height: 24px;
- margin-right: 11px;
- vertical-align: middle;
- background: url("../../static/image/Iconly/Two-tone/Arrow - Down 3.png");
- }
- span {
- color: #999999;
- margin-right: 22px;
- }
- }
- }
- .cityBox {
- height: 60px;
- background: #9CD26B;
- display: flex;
- margin: 0 auto;
- .cityMain {
- width: 1200px;
- height: 60px;
- line-height: 60px;
- margin: 0 auto;
- display: flex;
- justify-content: flex-start;
- .cityTitle {
- font-size: 16px;
- color: #fff;
- font-weight: bold;
- padding-left: 60px;
- margin-right: 30px;
- width: 76px;
- }
- .cityList {
-
- li {
- font-size: 16px;
- float: left;
- color: #fff;
- margin-right: 14px;
- cursor: pointer;
- &:hover {
- color: #ABE874;
- }
- }
- }
- }
- }
- </style>
|