pageNavigation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <!-- 导航 -->
  3. <div class="navigate">
  4. <div class="partOne">
  5. <div class="inner">
  6. <!-- 导航一 -->
  7. <ul class="navigationOne">
  8. <li v-for="(item, index) in navigation1" :key="index">
  9. <NuxtLink :to="`/primaryNavigation/${item.name}`" target="_blank">{{ item.name }}</NuxtLink>
  10. </li>
  11. </ul>
  12. </div>
  13. </div>
  14. <!-- <div class="partTwo">
  15. <div class="inner">
  16. <ul class="navigationTwo">
  17. <li v-for="(item,index) in navigation2" :key="index">{{ item.name }}</li>
  18. </ul>
  19. </div>
  20. </div> -->
  21. <div class="partThree">
  22. <!-- 地方频道 -->
  23. <div class="inner">
  24. <!-- channel 频道 -->
  25. <h5 class="channel">地方频道</h5>
  26. <p class="areaChannel">
  27. <span v-for="(item, index) in areaList" :key="index">
  28. <a href="#">{{ item.name }}</a>
  29. </span>
  30. </p>
  31. </div>
  32. </div>
  33. <!-- 导航栏下的大图 -->
  34. <div class="logo">
  35. <div class="inner">
  36. <img src="../../static/images/banner 1.png" alt="">
  37. </div>
  38. </div>
  39. <!-- 行政查询 -->
  40. <div class="select">
  41. <div class="inner">
  42. <div class="role left">
  43. <div class="title">行政职能查询</div>
  44. <div class="searchRole">
  45. <el-select v-model="depValue" placeholder="职能部门" size="large" style="width: 80px">
  46. <el-option v-for="(item, index) in department" :key="index" :label="item.label"
  47. :value="item.name" />
  48. </el-select>
  49. <i></i>
  50. <input type="text" v-model="typeValue" placeholder="输入关键词" class="ipt">
  51. <em></em>
  52. </div>
  53. </div>
  54. <div class="region left">
  55. <div class="title">行政区划查询</div>
  56. <div class="searchRole">
  57. <el-select v-model="province" placeholder="请选择省" size="large" style="width: 80px">
  58. <el-option v-for="item in provinceList" :key="item.id" :label="item.name"
  59. @click="change(item.id)" :value="item.name" />
  60. </el-select>
  61. <i></i>
  62. <el-select v-model="city" placeholder="请选择市" no-data-text="请先选择省份" size="large"
  63. style="width: 80px">
  64. <el-option v-for="(item, index) in cityList" :key="item.id" :label="item.name"
  65. @click="change1(item.id)" :value="item.name" />
  66. </el-select>
  67. <i></i>
  68. <el-select v-model="region" placeholder="请选择区/县" no-data-text="请先选择市" size="large"
  69. style="width: 100px">
  70. <el-option v-for="item in regionList" :key="item.id" :label="item.name"
  71. :value="item.name" />
  72. </el-select>
  73. <em></em>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </template>
  80. <script setup>
  81. import { ref, onMounted } from 'vue';
  82. import { ElSelect, ElOption } from 'element-plus'
  83. const nuxtApp = useNuxtApp();
  84. const axios = nuxtApp.$axios;
  85. //获取导航一的栏目
  86. const navigation1 = ref("");
  87. const navigateList = async () => {
  88. try {
  89. const response = await axios.get(`/web/getWebsiteModelCategory?placeid=${1}&pid=${0}&num=${24}`);
  90. // console.log(response.data);
  91. navigation1.value = response.data;
  92. } catch (error) {
  93. console.error(error);
  94. }
  95. }
  96. //获取导航二的栏目
  97. const navigation2 = ref("");
  98. const navigate2List = async () => {
  99. try {
  100. const response = await axios.get(`/web/getWebsiteModelCategory?placeid=${2}&pid=${1}&num=${13}`);
  101. // console.log(response.data);
  102. navigation2.value = response.data;
  103. } catch (error) {
  104. console.error(error);
  105. }
  106. }
  107. //职能部门 搜索
  108. let department = ref("安全")
  109. const depValue = ref("")
  110. const typeValue = ref("")
  111. let departmentList = async () => {
  112. try {
  113. const response = await axios.get(`/web/selectWebsiteDepartment?keyword=${department.value}`);
  114. // console.log(response.data.department);
  115. department.value = response.data.department
  116. // console.log(department.value);
  117. } catch (error) {
  118. console.error(error);
  119. }
  120. }
  121. //获取地区各省名称
  122. let areaList = ref("")
  123. //获取省名称
  124. let province = useState("province", () => "")
  125. let provinceid = useState("provinceid", () => null)
  126. let provinceList = useState("provinceList", () => "")
  127. let areaArrList = async () => {
  128. try {
  129. const response = await axios.get('/web/getWebsiteDistrit');
  130. // console.log(response.data);
  131. areaList.value = response.data;
  132. provinceList.value = response.data
  133. } catch (error) {
  134. console.error(error);
  135. }
  136. }
  137. // 获取城市名称
  138. let city = useState("city", () => "")
  139. let cityid = useState("cityid", () => "")
  140. let cityList = useState("cityList", () => "")
  141. //选择省份后省份的id
  142. let change = (id) => {
  143. console.log(id);
  144. provinceid.value = id
  145. console.log(provinceid.value);
  146. //根据省id获取对应的市名称
  147. axios.get(`web/selectWebsiteArea?province=${provinceid.value}&city=0`).then(response => {
  148. // console.log("response", response.data.city);
  149. cityList.value = response.data.city;
  150. // console.log("cityList", cityList.value);
  151. }).catch(error => {
  152. console.error(error);
  153. })
  154. }
  155. // 获取区/县名称
  156. let region = useState("region", () => "")
  157. let regionid = useState("regionid", () => "")
  158. let regionList = useState("regionList", () => "")
  159. //选择市后市的id
  160. let change1 = (id) => {
  161. console.log(id);
  162. cityid.value = id
  163. console.log(cityid.value);
  164. //根据市id获取对应的区/县名称
  165. axios.get(`web/selectWebsiteArea?province=${provinceid.value}&city=${cityid.value}`).then(response => {
  166. // console.log("response", response.data);
  167. regionList.value = response.data.region;
  168. // console.log("regionList", regionList.value);
  169. }).catch(error => {
  170. console.error(error);
  171. })
  172. }
  173. //挂载成功钩子函数
  174. onMounted(() => {
  175. //导航一栏目
  176. navigateList()
  177. //导航二栏目
  178. navigate2List()
  179. //获取地区各省名称
  180. areaArrList()
  181. //获取职能部门
  182. departmentList()
  183. //
  184. //
  185. })
  186. </script>
  187. <style lang="less" scoped>
  188. // 导航部分
  189. .partOne .navigationOne,
  190. .partOne .navigationOne>li,
  191. .partTwo .navigationTwo,
  192. .partTwo .navigationTwo>li {
  193. float: left;
  194. }
  195. .partOne {
  196. width: 100%;
  197. height: 130px;
  198. line-height: 65px;
  199. background-color: #fff;
  200. font-size: 20px;
  201. font-family: PingFang SC-Semibold;
  202. border-bottom: 1px solid #e3e3e3;
  203. .navigationOne {
  204. width: 1200px;
  205. height: 130px;
  206. color: #333;
  207. display: flex;
  208. flex-wrap: wrap;
  209. justify-content: space-around;
  210. li {
  211. font-family: PingFang SC;
  212. font-weight: 600;
  213. font-size: 20px;
  214. text-align: left;
  215. font-style: normal;
  216. text-transform: none;
  217. margin: 0 10px;
  218. // &:nth-last-child(1) {
  219. // margin-right: 0px;
  220. // }
  221. a {
  222. color: #333;
  223. }
  224. }
  225. >li:hover a {
  226. color: #139602;
  227. }
  228. }
  229. }
  230. // .partTwo {
  231. // width: 100%;
  232. // height: 57px;
  233. // line-height: 57px;
  234. // border-bottom: 1px solid #e3e3e3;
  235. // .navigationTwo {
  236. // width: 1207px;
  237. // height: 57px;
  238. // color: #333333;
  239. // border-bottom: 1px solid #e3e3e3;
  240. // li {
  241. // font-weight: 600;
  242. // font-size: 20px;
  243. // height: 56px;
  244. // margin-right: 21px;
  245. // &:nth-last-child(1) {
  246. // margin-right: 0px;
  247. // }
  248. // }
  249. // li:hover {
  250. // color: #139602;
  251. // border-bottom: 2px solid #139602;
  252. // }
  253. // }
  254. // }
  255. .partThree {
  256. width: 100%;
  257. height: 105px;
  258. .inner {
  259. margin-bottom: 5px;
  260. }
  261. .channel,
  262. .areaChannel {
  263. float: left;
  264. margin-top: 17px;
  265. }
  266. .channel {
  267. width: 56px;
  268. height: 20px;
  269. font-family: PingFang SC, PingFang SC;
  270. font-weight: 600;
  271. font-size: 14px;
  272. color: #666666;
  273. line-height: 20px;
  274. text-align: left;
  275. font-style: normal;
  276. text-transform: none;
  277. }
  278. .areaChannel {
  279. width: 1122px;
  280. margin-left: 14px;
  281. >span {
  282. display: inline-block;
  283. height: 16px;
  284. line-height: 16px;
  285. margin-bottom: 10px;
  286. padding: 0 8px;
  287. text-align: center;
  288. font-family: PingFang SC, PingFang SC;
  289. font-weight: 400;
  290. font-size: 14px;
  291. text-align: center;
  292. font-style: normal;
  293. text-transform: none;
  294. border-right: 1px solid #e6e6e6;
  295. a {
  296. display: inline-block;
  297. height: 16px;
  298. color: #868686;
  299. }
  300. a:hover {
  301. color: #868686;
  302. }
  303. }
  304. >span:last-child,
  305. >span:nth-child(17),
  306. >span:nth-child(32) {
  307. border-right: none;
  308. }
  309. >span:hover a {
  310. color: #139602;
  311. }
  312. }
  313. }
  314. .logo {
  315. margin-top: 5px;
  316. height: 90px;
  317. img {
  318. width: 1200px;
  319. height: 90px;
  320. }
  321. }
  322. // 行政查询
  323. .select {
  324. width: 100%;
  325. height: 62px;
  326. line-height: 62px;
  327. margin-top: 20px;
  328. .inner {
  329. width: 1200px;
  330. height: 62px;
  331. margin-top: 10px;
  332. background-color: #fafafa;
  333. }
  334. .role,
  335. .region {
  336. float: left;
  337. height: 62px;
  338. .el-select--large::v-deep .el-select__wrapper {
  339. font-size: 14px;
  340. gap: 6px;
  341. line-height: 24px;
  342. min-height: 35px;
  343. padding: 0;
  344. border: none;
  345. box-shadow: none;
  346. }
  347. .el-select__placeholder::v-deep.is-transparent {
  348. color: #999999;
  349. font-weight: 600;
  350. }
  351. >.title {
  352. float: left;
  353. width: 120px;
  354. font-family: PingFang SC, PingFang SC;
  355. font-weight: 600;
  356. font-size: 20px;
  357. color: #666666;
  358. text-align: left;
  359. font-style: normal;
  360. text-transform: none;
  361. }
  362. .searchRole {
  363. float: left;
  364. padding-left: 20px;
  365. box-sizing: border-box;
  366. i {
  367. display: inline-block;
  368. width: 1px;
  369. height: 12px;
  370. background-color: #d9d9d9;
  371. margin: 0 10px;
  372. vertical-align: middle;
  373. }
  374. }
  375. }
  376. .role {
  377. padding-left: 16px;
  378. .searchRole {
  379. width: 440px;
  380. height: 40px;
  381. line-height: 35px;
  382. background-color: #fff;
  383. border: 1px solid #ededed;
  384. margin: 10px 20px 12px 22px;
  385. border-radius: 25px;
  386. em {
  387. display: inline-block;
  388. width: 29px;
  389. height: 29px;
  390. margin: 4px;
  391. margin-right: 25px;
  392. vertical-align: -13px;
  393. background: url('../../static/images/Iconly/Broken/Search.png');
  394. }
  395. >.ipt {
  396. width: 245px;
  397. font-family: PingFang SC, PingFang SC;
  398. font-weight: 600;
  399. font-size: 14px;
  400. color: #666;
  401. line-height: 16px;
  402. padding-left: 22px;
  403. box-sizing: border-box;
  404. text-align: left;
  405. font-style: normal;
  406. text-transform: none;
  407. border: none;
  408. outline: none;
  409. }
  410. >.ipt::placeholder {
  411. color: #cccccc;
  412. }
  413. span {
  414. color: #999999;
  415. }
  416. }
  417. }
  418. .region {
  419. .searchRole {
  420. width: 440px;
  421. height: 40px;
  422. line-height: 35px;
  423. background-color: #fff;
  424. border: 1px solid #ededed;
  425. margin: 10px 0px 12px 16px;
  426. border-radius: 25px;
  427. }
  428. em {
  429. display: inline-block;
  430. width: 29px;
  431. height: 29px;
  432. margin-left: 48px;
  433. vertical-align: middle;
  434. background: url('../../static/images/Iconly/Broken/Search.png');
  435. }
  436. i {
  437. display: inline-block;
  438. width: 24px;
  439. height: 24px;
  440. margin-right: 11px;
  441. vertical-align: middle;
  442. background: url("../../static/images/Iconly/Two-tone/Arrow - Down 3.png");
  443. }
  444. span {
  445. color: #999999;
  446. margin-right: 22px;
  447. }
  448. }
  449. }
  450. </style>