pageNavigation.vue 14 KB

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