pageNavigation1.vue 15 KB

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