pageNavigation.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <div class="navigate">
  3. <div class="partOne">
  4. <div class="inner">
  5. <div class="navLeft">
  6. <div class="navIndex">
  7. <NuxtLink to="/" target="_blank" title="首页">
  8. 首页
  9. </NuxtLink>
  10. </div>
  11. <div class="navClass">
  12. <div>
  13. <a href="#ztzx" title="主题资讯">主题资讯</a>
  14. </div>
  15. <div>
  16. <a href="#hdzx" title="互动资讯">互动资讯</a>
  17. </div>
  18. </div>
  19. </div>
  20. <ul class="navigationOne">
  21. <li v-for="(item, index) in navigation1" :key="index">
  22. <NuxtLink :to="{ path: `/primaryNavigation/${item.category_id}`}"
  23. target="_blank" v-if="item.children_count != 0">
  24. <span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
  25. <span v-else>{{ item.name }}</span>
  26. </NuxtLink>
  27. <NuxtLink :to="{ path: `/newsList/${item.category_id}` }"
  28. target="_blank" v-if="item.children_count == 0 && item.is_url != 1">
  29. <span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
  30. <span v-else>{{ item.name }}</span>
  31. </NuxtLink>
  32. <NuxtLink :to="item.web_url"
  33. target="_blank" v-if="item.children_count == 0 && item.is_url == 1">
  34. <span class="active" v-if="item.category_id == routeId">{{ item.name }}</span>
  35. <span v-else>{{ item.name }}</span>
  36. </NuxtLink>
  37. </li>
  38. </ul>
  39. </div>
  40. </div>
  41. <!-- 展示地区 -->
  42. <div class="cityBox">
  43. <div class="cityMain">
  44. <div class="cityTitle">
  45. 地方频道
  46. </div>
  47. <ul class="cityList">
  48. <li v-for="(item, index) in provinceList" :key="index" @click="goToSearch(item.id)">
  49. {{item.abbreviation}}
  50. </li>
  51. </ul>
  52. </div>
  53. </div>
  54. <!-- 行政查询 -->
  55. <div class="select">
  56. <div class="inner">
  57. <div class="role left">
  58. <div class="title">行政职能查询</div>
  59. <div class="searchRole">
  60. <el-select v-model="depValue" placeholder="职能部门" size="large" style="width: 80px">
  61. <el-option v-for="(item, index) in department" :key="index" :label="item.name"
  62. :value="item.id" />
  63. </el-select>
  64. <i></i>
  65. <input type="text" v-model="typeValue" placeholder="输入关键词" class="ipt">
  66. <em @click="searchDepartment"></em>
  67. </div>
  68. </div>
  69. <div class="region left">
  70. <div class="title">行政区划查询</div>
  71. <div class="searchRole">
  72. <el-select v-model="province" placeholder="请选择省" size="large" style="width: 80px">
  73. <el-option v-for="item in provinceList" :key="item.id" :label="item.name"
  74. @click="change(item.id)" :value="item.id" />
  75. </el-select>
  76. <i></i>
  77. <el-select v-model="city" placeholder="请选择市" no-data-text="请先选择省份" size="large"
  78. style="width: 80px">
  79. <el-option v-for="(item, index) in cityList" :key="item.id" :label="item.name"
  80. @click="change1(item.id)" :value="item.id" />
  81. </el-select>
  82. <i></i>
  83. <el-select v-model="region" placeholder="请选择区/县" no-data-text="请先选择市" size="large"
  84. style="width: 100px">
  85. <el-option v-for="item in regionList" :key="item.id" :label="item.name" :value="item.id" />
  86. </el-select>
  87. <em @click="goToPrimary"></em>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <script setup>
  95. //1.加载依赖 start ---------------------------------------->
  96. import { ElMessage } from 'element-plus'
  97. import { ref, onMounted } from 'vue';
  98. import { ElSelect, ElOption } from 'element-plus'
  99. const nuxtApp = useNuxtApp();
  100. const axios = nuxtApp.$axios;
  101. const route = useRoute();
  102. const routeId = route.params.id; //获得该页面的id
  103. //1.加载依赖 end ---------------------------------------->
  104. //2.加载模块数据 start ---------------------------------------->
  105. const navigation1 = ref("");
  106. async function getPageData2() {
  107. const { data: mkdata, error: mkdataError } = requestData('/web/getWebsiteModelCategory', {
  108. method: 'GET',
  109. query: {
  110. 'placeid': 1,
  111. 'pid': 0,
  112. 'num': 35
  113. },
  114. });
  115. if (mkdataError.value) {
  116. //console.log()
  117. } else {
  118. if (mkdata.value) {
  119. navigation1.value = mkdata.value.data;
  120. }
  121. }
  122. }
  123. getPageData2();
  124. //2.加载模块数据 end ---------------------------------------->
  125. //3.职能部门 start ---------------------------------------->
  126. let department = ref("安全")
  127. const depValue = ref("")
  128. const typeValue = ref("")
  129. let departmentList = async () => {
  130. const { data: mkdata, error: mkdataError } = requestData('/web/selectWebsiteDepartment', {
  131. method: 'GET',
  132. query: {
  133. 'keyword': department.value,
  134. },
  135. });
  136. if (mkdataError.value) {
  137. //console.log()
  138. } else {
  139. console.log(department.value)
  140. if (mkdata.value) {
  141. console.log(mkdata.value.data.department)
  142. department.value = mkdata.value.data.department;
  143. }
  144. }
  145. }
  146. //获得所有部门
  147. departmentList();
  148. //3.职能部门 end ---------------------------------------->
  149. //4.展示行政区划 start ---------------------------------------->
  150. let areaList = ref("")
  151. //4.1 省
  152. let province = ref("")
  153. let provinceid = ref("")
  154. let provinceList = ref("")
  155. //4.2 市
  156. let city = ref("")
  157. let cityid = ref("")
  158. let cityList = ref("")
  159. //4.3 县
  160. let region = ref("")
  161. let regionid = ref("")
  162. let regionList = ref("")
  163. //选择省
  164. let areaArrList = async () => {
  165. const { data: mkdata, error: mkdataError } = requestData('/web/selectWebsiteArea', {
  166. method: 'GET',
  167. query: {},
  168. });
  169. if (mkdataError.value) {
  170. //console.log()
  171. } else {
  172. console.log(department.value)
  173. if (mkdata.value) {
  174. console.log(mkdata.value)
  175. areaList.value = mkdata.value.data;
  176. provinceList.value = mkdata.value.data;
  177. }
  178. }
  179. }
  180. //一开始只需要获取一下省
  181. areaArrList();
  182. //选择市
  183. let change = async (id) => {
  184. provinceid.value = id;
  185. const shengData = await requestDataPromise('/web/selectWebsiteArea', {
  186. method: 'GET',
  187. query: {
  188. 'province': id,
  189. 'city': 0
  190. },
  191. });
  192. cityList.value = shengData.data.city;
  193. }
  194. //选择县
  195. let change1 = async (id) => {
  196. cityid.value = id;
  197. const xianData = await requestDataPromise('/web/selectWebsiteArea', {
  198. method: 'GET',
  199. query: {
  200. 'province': provinceid.value,
  201. 'city': cityid.value
  202. },
  203. });
  204. regionList.value = xianData.data.region;
  205. }
  206. //4.展示行政区划 end ---------------------------------------->
  207. //5.执行搜索 start ---------------------------------------->
  208. const getcityid = ref("")
  209. //跳转到搜索页面
  210. let goToSearch = (id) => {
  211. console.log(id)
  212. const route = `/search/search?catids=${id}`;
  213. window.open(route, '_blank');
  214. }
  215. //获得cityid和
  216. let goToPrimary = async () => {
  217. if (province.value != "") { getcityid.value = province.value }
  218. if (city.value != "") { getcityid.value = city.value }
  219. if (region.value != "") { getcityid.value = region.value }
  220. if (province.value == ""&&city.value == ""&&region.value == ""&&depValue.value=="") {
  221. ElMessage.error('请选择行政区划或者职能部门!')
  222. }else{
  223. const responseStatus = await requestDataPromise('/web/selectWebsiteCategory', {
  224. method: 'GET',
  225. query: {
  226. 'cityid': getcityid.value,
  227. 'department_id': depValue.value
  228. },
  229. });
  230. if (responseStatus.data.catid && responseStatus.data.catid.length > 0) {
  231. const catids = responseStatus.data.catid.join(',');
  232. const route = `/search/search?catids=${catids}`;
  233. window.open(route, '_blank');
  234. } else {
  235. // 可以在这里处理数组为空的情况
  236. console.log('没有可用的分类ID');
  237. const route = `/search/search`;
  238. window.open(route, '_blank');
  239. }
  240. }
  241. }
  242. let searchDepartment = () => {
  243. //搜索职能部门
  244. let status = false;
  245. for (let item of department.value) {
  246. if (item.name == typeValue.value) {
  247. //如果有就赋值过去
  248. depValue.value = item.id
  249. status = true; //说明有可用的结果
  250. }
  251. }
  252. if (status == true) {
  253. //弹出提示告诉用户不存在
  254. }
  255. }
  256. //5.执行搜索 end ---------------------------------------->
  257. </script>
  258. <style lang="less" scoped>
  259. // 导航部分
  260. .partOne .navigationOne,
  261. .partOne .navigationOne>li,
  262. .partTwo .navigationTwo,
  263. .partTwo .navigationTwo>li {
  264. float: left;
  265. }
  266. .partOne {
  267. width: 100%;
  268. height: 110px;
  269. margin-bottom: 10px;
  270. background-color: #fff;
  271. font-size: 20px;
  272. font-family: PingFang SC-Semibold;
  273. background: url("../../static/head/menubg.png") no-repeat center;
  274. .inner {
  275. display: flex;
  276. justify-content: space-between;
  277. .navLeft {
  278. width:160px;
  279. font-size: 16px;
  280. display: flex;
  281. }
  282. .navIndex {
  283. height: 100px;
  284. line-height: 120px;
  285. a {
  286. font-size: 16px;
  287. color: #fff;
  288. font-weight: bold;
  289. &:hover {
  290. color: #ABE874;
  291. }
  292. }
  293. }
  294. .navClass {
  295. padding-top: 29px;
  296. padding-left: 30px;
  297. font-weight: bold;
  298. color: #fff;
  299. a {
  300. color: #fff;
  301. &:hover {
  302. color: #ABE874;
  303. }
  304. }
  305. div:nth-child(2){
  306. padding-top:20px;
  307. }
  308. }
  309. }
  310. .navigationOne {
  311. width: 1200px;
  312. color: #333;
  313. display: flex;
  314. flex-wrap: wrap;
  315. padding-top: 20px;
  316. li {
  317. width: 68px;
  318. font-family: PingFang SC;
  319. height: 40px;
  320. line-height: 40px;
  321. //font-weight: 600;
  322. font-size: 16px;
  323. text-align: left;
  324. font-style: normal;
  325. text-transform: none;
  326. margin: 0 10px;
  327. text-align: center;
  328. a {
  329. color: #fff;
  330. display: block;
  331. }
  332. }
  333. >li:hover a {
  334. color: #ABE874;
  335. }
  336. .active{
  337. color: #ABE874;
  338. }
  339. }
  340. }
  341. .partThree {
  342. width: 100%;
  343. height: 105px;
  344. .inner {
  345. margin-bottom: 5px;
  346. display: flex;
  347. }
  348. .channel,
  349. .areaChannel {
  350. float: left;
  351. margin-top: 17px;
  352. }
  353. .channel {
  354. width: 56px;
  355. height: 20px;
  356. font-family: PingFang SC, PingFang SC;
  357. font-weight: 600;
  358. font-size: 14px;
  359. color: #666666;
  360. line-height: 20px;
  361. text-align: left;
  362. font-style: normal;
  363. text-transform: none;
  364. }
  365. .areaChannel {
  366. width: 1122px;
  367. margin-left: 14px;
  368. >span {
  369. display: inline-block;
  370. height: 16px;
  371. line-height: 16px;
  372. margin-bottom: 10px;
  373. padding: 0 8px;
  374. text-align: center;
  375. font-family: PingFang SC, PingFang SC;
  376. font-weight: 400;
  377. font-size: 14px;
  378. text-align: center;
  379. font-style: normal;
  380. text-transform: none;
  381. border-right: 1px solid #e6e6e6;
  382. a {
  383. display: inline-block;
  384. height: 16px;
  385. color: #868686;
  386. }
  387. a:hover {
  388. color: #868686;
  389. }
  390. }
  391. >span:last-child,
  392. >span:nth-child(18),
  393. >span:nth-child(32) {
  394. border-right: none;
  395. }
  396. >span:hover a {
  397. color: #139602;
  398. }
  399. }
  400. }
  401. .logo {
  402. margin-top: 5px;
  403. height: 90px;
  404. img {
  405. width: 1200px;
  406. height: 90px;
  407. }
  408. }
  409. // 行政查询
  410. .select {
  411. width: 100%;
  412. height: 62px;
  413. line-height: 62px;
  414. margin-top: 10px;
  415. .inner {
  416. width: 1200px;
  417. height: 62px;
  418. margin-top: 10px;
  419. background-color: #fafafa;
  420. }
  421. .role,
  422. .region {
  423. float: left;
  424. height: 62px;
  425. .el-select--large::v-deep .el-select__wrapper {
  426. font-size: 14px;
  427. gap: 6px;
  428. line-height: 24px;
  429. min-height: 35px;
  430. padding: 0;
  431. border: none;
  432. box-shadow: none;
  433. }
  434. .el-select__placeholder::v-deep.is-transparent {
  435. color: #999999;
  436. font-weight: 600;
  437. }
  438. >.title {
  439. float: left;
  440. width: 120px;
  441. font-family: PingFang SC, PingFang SC;
  442. font-weight: 600;
  443. font-size: 20px;
  444. color: #666666;
  445. text-align: left;
  446. font-style: normal;
  447. text-transform: none;
  448. }
  449. .searchRole {
  450. float: left;
  451. padding-left: 20px;
  452. box-sizing: border-box;
  453. i {
  454. display: inline-block;
  455. width: 1px;
  456. height: 12px;
  457. background-color: #d9d9d9;
  458. margin: 0 10px;
  459. vertical-align: middle;
  460. }
  461. }
  462. }
  463. .role {
  464. padding-left: 16px;
  465. .searchRole {
  466. width: 440px;
  467. height: 40px;
  468. line-height: 35px;
  469. background-color: #fff;
  470. border: 1px solid #ededed;
  471. margin: 10px 20px 12px 22px;
  472. border-radius: 25px;
  473. em {
  474. display: inline-block;
  475. width: 29px;
  476. height: 29px;
  477. margin: 4px;
  478. margin-right: 25px;
  479. vertical-align: -13px;
  480. background: url('../../static/image/Iconly/Broken/Search.png');
  481. cursor: pointer;
  482. }
  483. >.ipt {
  484. width: 245px;
  485. font-family: PingFang SC, PingFang SC;
  486. font-weight: 600;
  487. font-size: 14px;
  488. color: #666;
  489. line-height: 16px;
  490. padding-left: 22px;
  491. box-sizing: border-box;
  492. text-align: left;
  493. font-style: normal;
  494. text-transform: none;
  495. border: none;
  496. outline: none;
  497. }
  498. >.ipt::placeholder {
  499. color: #cccccc;
  500. }
  501. span {
  502. color: #999999;
  503. }
  504. }
  505. }
  506. .region {
  507. .searchRole {
  508. width: 440px;
  509. height: 40px;
  510. line-height: 35px;
  511. background-color: #fff;
  512. border: 1px solid #ededed;
  513. margin: 10px 0px 12px 16px;
  514. border-radius: 25px;
  515. }
  516. em {
  517. display: inline-block;
  518. width: 29px;
  519. height: 29px;
  520. margin-left: 48px;
  521. vertical-align: middle;
  522. background: url('../../static/image/Iconly/Broken/Search.png');
  523. cursor: pointer;
  524. }
  525. i {
  526. display: inline-block;
  527. width: 24px;
  528. height: 24px;
  529. margin-right: 11px;
  530. vertical-align: middle;
  531. background: url("../../static/image/Iconly/Two-tone/Arrow - Down 3.png");
  532. }
  533. span {
  534. color: #999999;
  535. margin-right: 22px;
  536. }
  537. }
  538. }
  539. .cityBox {
  540. height: 60px;
  541. background: #9CD26B;
  542. display: flex;
  543. margin: 0 auto;
  544. .cityMain {
  545. width: 1200px;
  546. height: 60px;
  547. line-height: 60px;
  548. margin: 0 auto;
  549. display: flex;
  550. justify-content: flex-start;
  551. .cityTitle {
  552. font-size: 16px;
  553. color: #fff;
  554. font-weight: bold;
  555. padding-left: 60px;
  556. margin-right: 30px;
  557. width: 76px;
  558. }
  559. .cityList {
  560. li {
  561. font-size: 16px;
  562. float: left;
  563. color: #fff;
  564. margin-right: 14px;
  565. cursor: pointer;
  566. &:hover {
  567. color: #ABE874;
  568. }
  569. }
  570. }
  571. }
  572. }
  573. </style>