pageNavigation.vue 14 KB

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