pageNavigation1.vue 15 KB

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