pageNavigation1.vue 15 KB

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