dishizhongxin.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb-box">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item>
  12. <NuxtLink to="/">首页</NuxtLink>
  13. </el-breadcrumb-item>
  14. <el-breadcrumb-item class="phone_breadcrumb_text">地市中心</el-breadcrumb-item>
  15. </el-breadcrumb>
  16. </div>
  17. </div>
  18. <!--查询结果-->
  19. <div class="search-result-box">
  20. <div class="search-result-box-title">
  21. 本地区暂未开通调研中心,欢迎有意从事法制公益性工作的公民或法人单位申请代理。
  22. <br/>
  23. 详情咨询电话:010-56212745、010-53382908、010-56212741。
  24. </div>
  25. <div class="search-result-box-qq">
  26. <div>QQ咨询:</div>
  27. <div>
  28. <img src="@/public/search/qq.gif" alt="">
  29. <img src="@/public/search/qq.gif" alt="">
  30. </div>
  31. </div>
  32. <div class="search-result-box-back">
  33. <NuxtLink to="/">返回首页>></NuxtLink>
  34. </div>
  35. </div>
  36. <!--查询-->
  37. <div class="search-box">
  38. <div class="search-left-box">
  39. <div>
  40. <span class="search-left-box-text">地区:</span>
  41. <el-select v-model="province" placeholder="--" size="large" style="width: 180px" popper-class="custom-select-dropdown">
  42. <el-option v-for="item in provinceList" :key="item.id" :label="item.name"
  43. @click="change(item.id)" :value="item.id" />
  44. </el-select>
  45. <el-select v-model="city" placeholder="--" no-data-text="请先选择省份" size="large"
  46. style="width: 180px" popper-class="custom-select-dropdown">
  47. <el-option v-for="(item, index) in cityList" :key="item.id" :label="item.name"
  48. @click="change1(item.id)" :value="item.id" />
  49. </el-select>
  50. <el-select v-model="region" placeholder="--" no-data-text="请先选择市" size="large"
  51. style="width: 180px" popper-class="custom-select-dropdown">
  52. <el-option v-for="item in regionList" :key="item.id" :label="item.name" :value="item.id" />
  53. </el-select>
  54. </div>
  55. <button>搜索</button>
  56. </div>
  57. <div class="search-right-box">
  58. <img src="@/public/search/dszx.png" alt="">
  59. <div>手机扫描查询</div>
  60. </div>
  61. </div>
  62. <div class="search-list-box">
  63. <div class="search-list-box-title">中心列表</div>
  64. <div class="search-list-box-main">
  65. <NuxtLink to="/">京</NuxtLink>
  66. <NuxtLink to="/">津</NuxtLink>
  67. <NuxtLink to="/">沪</NuxtLink>
  68. <NuxtLink to="/">渝</NuxtLink>
  69. <NuxtLink to="/">冀</NuxtLink>
  70. <NuxtLink to="/">豫</NuxtLink>
  71. <NuxtLink to="/">云</NuxtLink>
  72. <NuxtLink to="/">辽</NuxtLink>
  73. <NuxtLink to="/">黑</NuxtLink>
  74. <NuxtLink to="/">湘</NuxtLink>
  75. <NuxtLink to="/">皖</NuxtLink>
  76. <NuxtLink to="/">鲁</NuxtLink>
  77. <NuxtLink to="/">新</NuxtLink>
  78. <NuxtLink to="/">苏</NuxtLink>
  79. <NuxtLink to="/">浙</NuxtLink>
  80. <NuxtLink to="/">赣</NuxtLink>
  81. <NuxtLink to="/">鄂</NuxtLink>
  82. <NuxtLink to="/">桂</NuxtLink>
  83. <NuxtLink to="/">甘</NuxtLink>
  84. <NuxtLink to="/">晋</NuxtLink>
  85. <NuxtLink to="/">蒙</NuxtLink>
  86. <NuxtLink to="/">陕</NuxtLink>
  87. <NuxtLink to="/">吉</NuxtLink>
  88. <NuxtLink to="/">闽</NuxtLink>
  89. <NuxtLink to="/">贵</NuxtLink>
  90. <NuxtLink to="/">粤</NuxtLink>
  91. <NuxtLink to="/">青</NuxtLink>
  92. <NuxtLink to="/">藏</NuxtLink>
  93. <NuxtLink to="/">川</NuxtLink>
  94. <NuxtLink to="/">宁</NuxtLink>
  95. <NuxtLink to="/">琼</NuxtLink>
  96. <NuxtLink to="/">港</NuxtLink>
  97. <NuxtLink to="/">澳</NuxtLink>
  98. <NuxtLink to="/">台</NuxtLink>
  99. </div>
  100. <div class="search-list-box-content">
  101. <div class="cityname">
  102. <div class="sheng">
  103. <NuxtLink to="/">北京</NuxtLink>
  104. </div>
  105. <div class="shi">
  106. <NuxtLink to="/">东城区</NuxtLink>
  107. <NuxtLink to="/">延庆县</NuxtLink>
  108. <NuxtLink to="/">西城区</NuxtLink>
  109. <NuxtLink to="/">朝阳区</NuxtLink>
  110. <NuxtLink to="/">丰台区</NuxtLink>
  111. <NuxtLink to="/">石景山区</NuxtLink>
  112. <NuxtLink to="/">海淀区</NuxtLink>
  113. <NuxtLink to="/">门头沟区</NuxtLink>
  114. <NuxtLink to="/">房山区</NuxtLink>
  115. <NuxtLink to="/">通州区</NuxtLink>
  116. <NuxtLink to="/">顺义区</NuxtLink>
  117. <NuxtLink to="/">昌平区</NuxtLink>
  118. <NuxtLink to="/">大兴区</NuxtLink>
  119. <NuxtLink to="/">怀柔区</NuxtLink>
  120. <NuxtLink to="/">平谷区</NuxtLink>
  121. <NuxtLink to="/">密云县</NuxtLink>
  122. </div>
  123. </div>
  124. <div class="cityname">
  125. <div class="sheng">
  126. <NuxtLink to="/">四川</NuxtLink>
  127. </div>
  128. <div class="shi">
  129. <NuxtLink to="/">成都市</NuxtLink>
  130. <NuxtLink to="/">自贡市</NuxtLink>
  131. <NuxtLink to="/">攀枝花市</NuxtLink>
  132. <NuxtLink to="/">泸州市</NuxtLink>
  133. <NuxtLink to="/">德阳市</NuxtLink>
  134. <NuxtLink to="/">绵阳市</NuxtLink>
  135. <NuxtLink to="/">广元市</NuxtLink>
  136. <NuxtLink to="/">遂宁市</NuxtLink>
  137. <NuxtLink to="/">内江市</NuxtLink>
  138. <NuxtLink to="/">乐山市</NuxtLink>
  139. <NuxtLink to="/">南充市</NuxtLink>
  140. <NuxtLink to="/">眉山市</NuxtLink>
  141. <NuxtLink to="/">宜宾市</NuxtLink>
  142. <NuxtLink to="/">广安市</NuxtLink>
  143. <NuxtLink to="/">达州市</NuxtLink>
  144. <NuxtLink to="/">雅安市</NuxtLink>
  145. <NuxtLink to="/">巴中市</NuxtLink>
  146. <NuxtLink to="/">资阳市</NuxtLink>
  147. <NuxtLink to="/">阿坝藏族羌族自治州</NuxtLink>
  148. <NuxtLink to="/">甘孜藏族自治州</NuxtLink>
  149. <NuxtLink to="/">凉山彝族自治州</NuxtLink>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. <!-- 页面底部 -->
  155. <HomeFoot></HomeFoot>
  156. </template>
  157. <script setup>
  158. //1.页面依赖 start ---------------------------------------->
  159. import { onMounted } from 'vue'
  160. import { ElBreadcrumb, ElBreadcrumbItem,ElMessage,ElInput,ElSelect,ElOption } from 'element-plus'
  161. import { ArrowRight } from '@element-plus/icons-vue'
  162. const nuxtApp = useNuxtApp();
  163. const axios = nuxtApp.$axios;
  164. //1.1 获得跳转过来的id
  165. const route = useRoute();
  166. //获得详情id
  167. const articleId = parseInt(route.params.id); //获得该页面的id
  168. //获得当前的完整路径
  169. const fullPath = route.path;
  170. //拆分,取出来中间这一段,然后提取数字部分
  171. const segments = fullPath.split('/');
  172. const targetSegment = segments[1];
  173. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  174. // let routeId = 20 //排除路径错误可以打开这个
  175. // const routeId = numberPart;
  176. let routeId;
  177. //通过导航路径反向查询导航id
  178. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  179. method: 'GET',
  180. query: {
  181. 'pinyin': targetSegment,
  182. },
  183. });
  184. if(getRouteId.code == 200){
  185. routeId = getRouteId.data.category_id
  186. }else{
  187. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  188. console.log("错误位置:通过url路径查询导航池id")
  189. console.log("后端错误反馈:",getRouteId.message)
  190. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  191. }
  192. //1.2 获得父级栏目的名称、id
  193. const parent_name = ref([]);
  194. const parent_id = ref([]);
  195. const parent_pinyin = ref("");
  196. const parent_children_count = ref(0)
  197. let getParentNav = async () => {
  198. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  199. method: 'GET',
  200. query: {
  201. 'catid': routeId
  202. },
  203. });
  204. console.log("获取父级栏目数据")
  205. console.log(listData)
  206. if (listData.code == 200) {
  207. console.log(listData.data);
  208. parent_name.value = listData.data.alias;
  209. parent_id.value = listData.data.parent_id;
  210. parent_pinyin.value = listData.data.aLIas_pinyin;
  211. parent_children_count.value = listData.data.children_count;
  212. } else {
  213. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  214. console.log("错误位置:获取面包屑导航")
  215. console.log("后端错误反馈:", listData.message)
  216. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  217. }
  218. }
  219. //获得父级栏目详情
  220. getParentNav();
  221. //1.页面依赖 end ---------------------------------------->
  222. //2.页面数据 start ---------------------------------------->
  223. //2.1 资讯详情
  224. const newsDetail = ref({})
  225. const routeNewsTtitle = ref("");
  226. //2.2 发布日期
  227. const time = ref("");
  228. //2.3 路径
  229. const routLevelTitle = ref("");
  230. const routLevelId = ref("");
  231. //是否展示投票
  232. const articleChoice = ref(false);
  233. //2.4获取详情
  234. async function getPageData() {
  235. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  236. method: 'GET',
  237. query: {
  238. 'articleid': articleId
  239. },
  240. });
  241. if(mkdata.code==200){
  242. //判断是否显示投票
  243. if(mkdata.data.is_survey==1){
  244. console.log("本篇文章含有投票!")
  245. articleChoice.value = true;
  246. getVoteList();
  247. }
  248. //获取内容
  249. newsDetail.value = mkdata.data;
  250. //获取路径
  251. routLevelTitle.value = newsDetail.value.cat_name;
  252. routLevelId.value = newsDetail.value.category_id;
  253. //获取发布时间
  254. time.value = newsDetail.value.updated_at.split(' ')[0];
  255. //修正标题长度
  256. if (newsDetail.value.title.length >= 30) {
  257. routeNewsTtitle.value = newsDetail.value.title.substr(0, 30) + "...";
  258. } else {
  259. routeNewsTtitle.value = newsDetail.value.title
  260. }
  261. }else{
  262. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  263. console.log("错误位置:获取详情内容")
  264. console.log("后端错误反馈:",mkdata.message)
  265. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  266. }
  267. }
  268. getPageData();
  269. //2.5 获得广告
  270. //广告列表
  271. let adImg1 = ref([]);
  272. onMounted(async () => {
  273. const { $webUrl, $CwebUrl } = useNuxtApp();
  274. //广告1
  275. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  276. const responseAd1 = await fetch(url, {
  277. headers: {
  278. 'Content-Type': 'application/json',
  279. 'Userurl': $CwebUrl,
  280. 'Origin': $CwebUrl
  281. }
  282. });
  283. const resultAd1 = await responseAd1.json();
  284. adImg1.value = resultAd1.data[0];
  285. })
  286. //2.页面数据 end ---------------------------------------->
  287. //3.设置seo信息 start---------------------------------------->
  288. //3.1 设置seo信息
  289. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  290. method: 'GET',
  291. query: {
  292. 'articleid': articleId
  293. },
  294. });
  295. if(setData.code==200){
  296. let seoTitle = setData.data.title;
  297. let seoDescription = setData.data.introduce;
  298. let seoKeywords = setData.data.keyword;
  299. let seoSuffix = setData.data.suffix;
  300. let seoName = setData.data.website_name;
  301. useSeoMeta({
  302. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  303. meta: [
  304. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  305. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  306. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  307. ]
  308. });
  309. }else{
  310. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  311. console.log("错误位置:设置详情页面SEO数据")
  312. console.log("后端错误反馈:",setData.message)
  313. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  314. }
  315. //3.设置seo信息 end---------------------------------------->
  316. //4.展示行政区划 start ---------------------------------------->
  317. //let areaList = ref("")
  318. //4.1 省
  319. let province = ref("")
  320. let provinceid = ref("")
  321. let provinceList = ref("")
  322. //4.2 市
  323. let city = ref("")
  324. let cityid = ref("")
  325. let cityList = ref("")
  326. //4.3 县
  327. let region = ref("")
  328. let regionid = ref("")
  329. let regionList = ref("")
  330. //选择市
  331. let change = async (id) => {
  332. provinceid.value = id;
  333. const shengData = await requestDataPromise('/web/selectWebsiteArea', {
  334. method: 'GET',
  335. query: {
  336. 'pid': id,
  337. },
  338. });
  339. cityList.value = shengData.data;
  340. regionList.value = [];// 清空县
  341. }
  342. //选择县
  343. let change1 = async (id) => {
  344. cityid.value = id;
  345. const xianData = await requestDataPromise('/web/selectWebsiteArea', {
  346. method: 'GET',
  347. query: {
  348. 'pid': id,
  349. },
  350. });
  351. regionList.value = xianData.data;
  352. }
  353. let change2 = async (id) => {
  354. regionid.value = id;
  355. }
  356. onMounted(async () => {
  357. //从客户端获取行政区划
  358. try {
  359. const { $webUrl, $CwebUrl } = useNuxtApp();
  360. const response2 = await fetch($webUrl + '/web/selectWebsiteArea', {
  361. headers: {
  362. 'Content-Type': 'application/json',
  363. 'Userurl': $CwebUrl,
  364. 'Origin': $CwebUrl
  365. }
  366. });
  367. const result2 = await response2.json();
  368. provinceList.value = result2.data;
  369. } catch (error) {
  370. console.error('获取行政区划数据失败:', error);
  371. }
  372. const targetElement = document.querySelector('.pc_none li .router-link-exact-active');
  373. const parentElement = document.querySelector('.nav_in');
  374. if (targetElement && parentElement) {
  375. const targetRect = targetElement.getBoundingClientRect();
  376. const parentRect = parentElement.getBoundingClientRect();
  377. const distanceToParentLeft = targetRect.left - parentRect.left;
  378. const navigationElement = document.querySelector('.partOne .navigationOne');
  379. if (navigationElement) {
  380. navigationElement.scrollLeft = distanceToParentLeft - 66;
  381. }
  382. }
  383. })
  384. //4.展示行政区划 end ---------------------------------------->
  385. //5.表单 start---------------------------------------->
  386. let input = ref("");
  387. let value = ref("1");
  388. const submitForm = () => {
  389. console.log(input.value)
  390. console.log(value.value)
  391. }
  392. //5.表单 end---------------------------------------->
  393. </script>
  394. <style lang="less" scoped>
  395. //@import url('@/assets/css/article/pc.less');
  396. //@import url('@/assets/css/article/yd.less');
  397. //面包屑
  398. .breadcrumb-box {
  399. width: 1400px;
  400. margin: 0 auto;
  401. .inner {
  402. width: 100%;
  403. height: 22px;
  404. margin-top: 20px;
  405. margin-bottom: 20px;
  406. font-family: Microsoft YaHei, Microsoft YaHei;
  407. font-weight: 400;
  408. font-size: 20px;
  409. color: #666666;
  410. line-height: 23px;
  411. text-align: left;
  412. font-style: normal;
  413. text-transform: none;
  414. display: flex;
  415. align-items: center;
  416. border-bottom: 1px dashed #ccc;
  417. margin-bottom: 10px;
  418. padding: 20px 20px 20px 0;
  419. box-sizing: border-box;
  420. a {
  421. font-size: 16px;
  422. line-height: 20px;
  423. font-weight: normal!important;
  424. &:hover {
  425. color:#333
  426. }
  427. }
  428. span {
  429. font-size: 16px;
  430. color: #000;
  431. line-height: 20px;
  432. &.location {
  433. line-height: 20px;
  434. }
  435. }
  436. }
  437. }
  438. //搜索
  439. .search-box {
  440. width: 1400px;
  441. margin: 0 auto;
  442. display: flex;
  443. align-items: flex-start;
  444. justify-content: space-between;
  445. .search-left-box {
  446. width: 70%;
  447. display: flex;
  448. align-items: flex-start;
  449. justify-content: space-between;
  450. >div {
  451. width: 80%;
  452. display: flex;
  453. align-items: center;
  454. justify-content: flex-start;
  455. .search-left-box-text {
  456. width: 15%;
  457. text-align: center;
  458. font-size: 16px;
  459. font-weight: bold;
  460. display: block;
  461. }
  462. :deep(.el-select__wrapper) {
  463. margin-left: 10px;
  464. }
  465. :deep(.el-select__placeholder) {
  466. color:#000;
  467. }
  468. }
  469. >button {
  470. width: 10%;
  471. display: block;
  472. color: #fff;
  473. background-color: #337ab7;
  474. border-color: #2e6da4;
  475. font-size: 14px;
  476. font-weight: 400;
  477. text-align: center;
  478. white-space: nowrap;
  479. user-select: none;
  480. background-image: none;
  481. border: 1px solid transparent;
  482. border-radius: 4px;
  483. height: 35px;
  484. line-height: 35px;
  485. }
  486. }
  487. .search-right-box {
  488. margin-right: 50px;
  489. width: 20%;
  490. img {
  491. width: 100%;
  492. height: auto;
  493. display: block;
  494. }
  495. >div {
  496. display: block;
  497. width: 100%;
  498. height: 30px;
  499. line-height: 30px;
  500. font-size: 16px;
  501. color: #333;
  502. text-align: center
  503. }
  504. }
  505. }
  506. .search-list-box {
  507. width: 1400px;
  508. margin: 0 auto;
  509. border: 1px solid #ccc;
  510. margin: 30px auto;
  511. position: relative;
  512. .search-list-box-title {
  513. width: 150px;
  514. height: 50px;
  515. line-height: 50px;
  516. font-size: 30px;
  517. color: #000;
  518. font-weight: bold;
  519. text-align: center;
  520. position: absolute;
  521. top: -25px;
  522. left: 20px;
  523. background: #fff;
  524. }
  525. .search-list-box-main {
  526. width: 100%;
  527. padding: 30px;
  528. border-bottom: 1px solid #ccc;
  529. box-sizing: border-box;
  530. a {
  531. font-size: 16px;
  532. padding: 0 10px;
  533. color: #000;
  534. }
  535. }
  536. .search-list-box-content {
  537. .cityname {
  538. display: flex;
  539. align-items: flex-start;
  540. justify-content: flex-start;
  541. border-bottom: 1px solid #ccc;
  542. &:last-child {
  543. border-bottom: 0;
  544. }
  545. }
  546. .sheng {
  547. width: 20%;
  548. text-align: center;
  549. font-size: 20px;
  550. line-height: 200%;
  551. a {
  552. color: #337ab7;
  553. }
  554. }
  555. .shi {
  556. width: 80%;
  557. height: 100%;
  558. font-size: 16px;
  559. color: #000;
  560. padding: 0 5px;
  561. display: block;
  562. border-left: 1px solid #ccc;
  563. line-height: 40px;
  564. a {
  565. font-size: 16px;
  566. color: #000;
  567. padding: 0 5px;
  568. display: block;
  569. width: auto;
  570. float: left;
  571. }
  572. }
  573. }
  574. }
  575. //返回查询结果
  576. .search-result-box {
  577. width: 500px;
  578. margin: 80px auto;
  579. height: auto;
  580. overflow: hidden;
  581. border: 1px solid #ccc;
  582. .search-result-box-title {
  583. line-height: 30px;
  584. width: 488px;
  585. height: auto;
  586. overflow: hidden;
  587. padding: 6px 6px 0 6px;
  588. font-size: 15px;
  589. font-family: serif;
  590. }
  591. .search-result-box-qq {
  592. display: flex;
  593. align-items: center;
  594. justify-content: flex-start;
  595. line-height: 30px;
  596. width: 488px;
  597. height: auto;
  598. overflow: hidden;
  599. padding: 0 6px 0 6px;
  600. font-size: 15px;
  601. font-family: serif;
  602. div:nth-child(2) {
  603. display: flex;
  604. margin-left: 80px;
  605. img {
  606. margin-right: 20px;
  607. }
  608. }
  609. }
  610. .search-result-box-back {
  611. text-align: right;
  612. width: 488px;
  613. height: 40px;
  614. overflow: hidden;
  615. line-height: 48px;
  616. margin: 0;
  617. a {
  618. color: red;
  619. font-weight: bold;
  620. font-size:10px;
  621. }
  622. }
  623. }
  624. </style>