index.html.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  1. <template>
  2. <div class="shukan">
  3. <!-- {{ routeId }} -->
  4. <HomePageHead></HomePageHead>
  5. <HomePageNavigation></HomePageNavigation>
  6. <HomeSecondaryHeading :titleData="pageData" :pinyinid="routeId"></HomeSecondaryHeading>
  7. <!-- 三农资讯网-书刊信息snzx_book -->
  8. <main class="index_main">
  9. <section class="index_2 clearfix ">
  10. <div class="index_2_left">
  11. <div class="book_head_box clearfix">
  12. <div class="book_head_left">
  13. <NuxtLink class="book_head_a" :href="getLinkPath(pageData[0])" v-if="pageData[0]"
  14. :title="pageData[0].alias" @mouseenter="tabsData1 = 1"
  15. :class="{ book_head_only: tabsData1 == 1 }">
  16. {{ pageData[0].alias }}
  17. </NuxtLink>
  18. <NuxtLink class="book_head_a phone_none" :href="getLinkPath(pageData[1])" v-if="pageData[1]"
  19. :title="pageData[1].alias" @mouseenter="tabsData1 = 2"
  20. :class="{ book_head_only: tabsData1 == 2 }">
  21. {{ pageData[1].alias }}
  22. </NuxtLink>
  23. </div>
  24. <!-- <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[0])"
  25. v-if="pageData[0] && tabsData1 == 1" :title="pageData[0].title">
  26. 栏目简介
  27. </NuxtLink>
  28. <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[1])"
  29. v-if="pageData[1] && tabsData1 == 2" :title="pageData[1].title">
  30. 栏目简介
  31. </NuxtLink> -->
  32. </div>
  33. <!-- 模块1 -->
  34. <div class=" clearfix">
  35. <div class="book_1_img_ul clearfix" v-if="tabsData1 == 1">
  36. <div class="book_1_img_li" v-for="(item, index) in pageData[0].data" :key="index">
  37. <NuxtLink class="book_1_img_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  38. <img class="book_1_img_li_img" :src="item.img_url" :alt="item.title">
  39. <div class="book_1_img_li_right clearfix">
  40. <div class="book_1_img_li_dot2 dot2">
  41. {{ item.title }}
  42. </div>
  43. <div class="book_1_img_li_btn clearfix">查看详情</div>
  44. </div>
  45. </NuxtLink>
  46. </div>
  47. </div>
  48. </div>
  49. <!-- 模块1 end -->
  50. <!-- 模块2 -->
  51. <div class=" clearfix">
  52. <div class="book_1_img_ul clearfix" v-if="tabsData1 == 2">
  53. <div class="book_1_img_li" v-for="(item, index) in pageData[1].data" :key="index">
  54. <NuxtLink class="book_1_img_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  55. <img class="book_1_img_li_img" :src="item.img_url" :alt="item.title">
  56. <div class="book_1_img_li_right clearfix">
  57. <div class="book_1_img_li_dot2 dot2">
  58. {{ item.title }}
  59. </div>
  60. <div class="book_1_img_li_btn clearfix">查看详情</div>
  61. </div>
  62. </NuxtLink>
  63. </div>
  64. </div>
  65. </div>
  66. <!-- 模块2 end -->
  67. </div>
  68. <!-- 模块3 -->
  69. <div class="index_2_right">
  70. <div class="book_head_box clearfix">
  71. <div class="book_head_left">
  72. <NuxtLink class="book_head_a book_head_only" :href="getLinkPath(pageData[2])"
  73. v-if="pageData[2]" :title="pageData[2].alias">
  74. {{ pageData[2].alias }}
  75. </NuxtLink>
  76. </div>
  77. <!-- <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[2])" v-if="pageData[2]"
  78. :title="pageData[2].title">
  79. 栏目简介
  80. </NuxtLink> -->
  81. </div>
  82. <div class="book_num_1_ul clearfix">
  83. <div class="book_num_1_li clearfix" v-for="(item, index) in pageData[2].data" :key="index">
  84. <NuxtLink class="book_num_1_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  85. <div class="book_num_1_li_tag" @mouseenter="showTabs = index + 1"
  86. :class="{ num_active: showTabs == index + 1 }">
  87. {{ index + 1 }}</div>
  88. <img class="book_num_1_li_img" @mouseenter="showTabs = index + 1"
  89. :class="{ img_active: showTabs == index + 1 }" :src="item.img_url"
  90. :alt="item.title">
  91. <div class="book_num_1_li_dot1 clearfix" @mouseenter="showTabs = index + 1"
  92. :class="{ text_active: showTabs == index + 1 }">{{ item.title }}</div>
  93. </NuxtLink>
  94. </div>
  95. </div>
  96. </div>
  97. <!-- 模块3 end-->
  98. </section>
  99. <section class="pc_none clearfix" v-if="pageData.length > 0">
  100. <div class="book_head_box clearfix">
  101. <div class="book_head_left">
  102. <NuxtLink class="book_head_a book_head_only"
  103. :href="getLinkPath(pageData[1])" v-if="pageData[1]">
  104. {{ pageData[1].alias }}
  105. </NuxtLink>
  106. </div>
  107. </div>
  108. <div class=" clearfix">
  109. <div class="book_1_img_ul clearfix" >
  110. <div class="book_1_img_li" v-for="(item, index) in pageData[1].data" :key="index">
  111. <NuxtLink class="book_1_img_li_a" :href="getLinkPathDetail(item)" >
  112. <img class="book_1_img_li_img" :src="item.img_url" :alt="item.title">
  113. <div class="book_1_img_li_right clearfix">
  114. <div class="book_1_img_li_dot2 dot2">
  115. {{ item.title }}
  116. </div>
  117. <div class="book_1_img_li_btn clearfix">查看详情</div>
  118. </div>
  119. </NuxtLink>
  120. </div>
  121. </div>
  122. </div>
  123. </section>
  124. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  125. <section class="index_3 clearfix">
  126. <div class="index_3_left clearfix">
  127. <div class="book_head_box clearfix">
  128. <div class="book_head_left">
  129. <NuxtLink class="book_head_a " :href="getLinkPath(pageData[3])" v-if="pageData[3]"
  130. :title="pageData[3].alias" @mouseenter="tabsData2 = 1"
  131. :class="{ book_head_only: tabsData2 == 1 }">
  132. {{ pageData[3].alias }}
  133. </NuxtLink>
  134. <NuxtLink class="book_head_a phone_none" :href="getLinkPath(pageData[4])" v-if="pageData[4]"
  135. :title="pageData[4].alias" @mouseenter="tabsData2 = 2"
  136. :class="{ book_head_only: tabsData2 == 2 }">
  137. {{ pageData[4].alias }}
  138. </NuxtLink>
  139. </div>
  140. <!-- <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[3])"
  141. v-if="pageData[3] && tabsData2 == 1" :title="pageData[3].title">
  142. 栏目简介
  143. </NuxtLink>
  144. <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[4])"
  145. v-if="pageData[4] && tabsData2 == 2" :title="pageData[4].title">
  146. 栏目简介
  147. </NuxtLink> -->
  148. </div>
  149. <div class=" clearfix" v-if="pageData.length > 4">
  150. <!-- 模块4 -->
  151. <div class="book_2_img_ul clearfix" v-if="tabsData2 == 1">
  152. <div class="book_2_img_li clearfix" v-for="(item, index) in pageData[3].data" :key="index">
  153. <NuxtLink class="book_num_1_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  154. <img class="book_2_img_li_img" :src="item.img_url" title="" alt="">
  155. <div class="book_2_img_li_dot1 dot1 clearfix">{{ item.title }}</div>
  156. </NuxtLink>
  157. </div>
  158. </div>
  159. <!-- 模块4 end -->
  160. <!-- 模块5 -->
  161. <div class="book_2_img_ul clearfix" v-if="tabsData2 == 2">
  162. <div class="book_2_img_li clearfix" v-for="(item, index) in pageData[4].data" :key="index">
  163. <NuxtLink class="book_num_1_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  164. <img class="book_2_img_li_img" :src="item.img_url" :title="item.title">
  165. <div class="book_2_img_li_dot1 dot1 clearfix">{{ item.title }}</div>
  166. </NuxtLink>
  167. </div>
  168. </div>
  169. <!-- 模块5 end -->
  170. </div>
  171. </div>
  172. <!-- 文化艺术 -->
  173. <div class="index_3_right clearfix" v-if="pageData.length > 5">
  174. <div class="book_head_box clearfix">
  175. <div class="book_head_left">
  176. <NuxtLink class="book_head_a book_head_only" :href="getLinkPath(pageData[5])"
  177. v-if="pageData[5]" :title="pageData[5].alias">
  178. {{ pageData[5].alias }}
  179. </NuxtLink>
  180. </div>
  181. <!-- <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[5])" v-if="pageData[5]"
  182. :title="pageData[5].title">
  183. 栏目简介
  184. </NuxtLink> -->
  185. </div>
  186. <div class="book_3_img_ul clearfix">
  187. <div class="book_3_img_li clearfix" v-for="(item, index) in pageData[5].data" :key="index">
  188. <NuxtLink class="book_3_img_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  189. <img class="book_3_img_li_img" :src="item.img_url" title="" alt="">
  190. <div class="book_3_img_li_dot1 dot1 clearfix">{{ item.title }}</div>
  191. </NuxtLink>
  192. </div>
  193. </div>
  194. <div class="book_2_ul clearfix">
  195. <div class="book_2_li clearfix" v-for="(item, index) in pageData[5].data2" :key="index">
  196. <NuxtLink class="book_2_li_a dot1" :href="getLinkPathDetail(item)" :title="item.title">
  197. {{ item.title }}
  198. </NuxtLink>
  199. <div class="book_2_li_tag">详</div>
  200. </div>
  201. </div>
  202. </div>
  203. <!-- 文化艺术 -->
  204. </section>
  205. <section class="pc_none clearfix">
  206. <div class="book_head_box clearfix">
  207. <div class="book_head_left">
  208. <NuxtLink class="book_head_a book_head_only"
  209. :href="getLinkPath(pageData[4])" v-if="pageData[4]">
  210. {{ pageData[4].alias }}
  211. </NuxtLink>
  212. </div>
  213. </div>
  214. <div class=" clearfix">
  215. <div class="book_1_img_ul clearfix" >
  216. <div class="book_1_img_li" v-for="(item, index) in pageData[4].data" :key="index">
  217. <NuxtLink class="book_1_img_li_a" :href="getLinkPathDetail(item)" >
  218. <img class="book_1_img_li_img" :src="item.img_url" :alt="item.title">
  219. <div class="book_1_img_li_right clearfix">
  220. <div class="book_1_img_li_dot2 dot2">
  221. {{ item.title }}
  222. </div>
  223. <div class="book_1_img_li_btn clearfix">查看详情</div>
  224. </div>
  225. </NuxtLink>
  226. </div>
  227. </div>
  228. </div>
  229. </section>
  230. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  231. <section class="index_4 clearfix" v-if="pageData.length > 6">
  232. <!-- 模块7 -->
  233. <div class="index_4_left clearfix">
  234. <div class="book_head_box clearfix">
  235. <div class="book_head_left">
  236. <NuxtLink class="book_head_a book_head_only" :href="getLinkPath(pageData[6])"
  237. v-if="pageData[6]" :title="pageData[6].alias">
  238. {{ pageData[6].alias }}
  239. </NuxtLink>
  240. </div>
  241. <!-- <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[6])" v-if="pageData[6]"
  242. :title="pageData[6].title">
  243. 栏目简介
  244. </NuxtLink> -->
  245. </div>
  246. <div class="book_5_img_ul clearfix">
  247. <div class="book_5_img_li clearfix" v-for="(item, index) in pageData[6].data" :key="index">
  248. <NuxtLink class="book_5_img_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  249. <img class="book_5_img_li_img" :src="item.img_url" :title="item.title">
  250. <div class="book_5_img_li_right clearfix">
  251. <div class="book_5_img_li_dot2 dot2">{{ item.title }}</div>
  252. <div class="book_5_img_li_foot clearfix">
  253. <span class="book_5_img_li_foot_red">¥</span>
  254. <span class="book_5_img_li_foot_num">{{ item.market_price }}</span>
  255. <span class="book_5_img_li_foot_text">市场价:</span>
  256. <span class="book_5_img_li_foot_price">¥{{ item.price }}</span>
  257. </div>
  258. </div>
  259. </NuxtLink>
  260. </div>
  261. </div>
  262. </div>
  263. <!-- 模块7 end -->
  264. <!-- 模块8 -->
  265. <div class="index_4_right clearfix" v-if="pageData.length > 7">
  266. <div class="book_head_box clearfix">
  267. <div class="book_head_left">
  268. <NuxtLink class="book_head_a book_head_only" :href="getLinkPath(pageData[7])"
  269. v-if="pageData[7]" :title="pageData[7].alias">
  270. {{ pageData[7].alias }}
  271. </NuxtLink>
  272. </div>
  273. <!-- <NuxtLink class="book_head_a_more" :href="getLinkPath(pageData[7])" v-if="pageData[7]"
  274. :title="pageData[7].title">
  275. 栏目简介
  276. </NuxtLink> -->
  277. </div>
  278. <div class="book_4_img_ul clearfix">
  279. <div class="book_4_img_li clearfix" v-for="(item, index) in pageData[7].data" :key="index">
  280. <NuxtLink class="book_4_img_li_a" :href="getLinkPathDetail(item)" :title="item.title">
  281. <img class="book_4_img_li_img" :src="item.img_url" title="" alt="">
  282. <div class="book_4_img_li_dot1 dot1 clearfix">{{ item.title }}</div>
  283. </NuxtLink>
  284. </div>
  285. </div>
  286. <div class="book_3_ul clearfix">
  287. <div class="book_3_li clearfix" v-for="(item, index) in pageData[7].data2" :key="index">
  288. <NuxtLink class="book_3_li_a dot1" :href="getLinkPathDetail(item)" :title="item.title">
  289. {{ item.title }}
  290. </NuxtLink>
  291. <div class="book_3_li_tag">详</div>
  292. </div>
  293. </div>
  294. </div>
  295. <!-- 模块8 end -->
  296. </section>
  297. </main>
  298. <!-- 页脚部分 -->
  299. <HomeFoot1></HomeFoot1>
  300. </div>
  301. </template>
  302. <script setup>
  303. //0.加载页面依赖 start ---------------------------------------->
  304. import { ref, onMounted } from 'vue';
  305. import { ElMessage } from 'element-plus';
  306. //格式化跳转路径 - 标题
  307. //首页分类栏目标题,不需要考虑外链
  308. const getLinkPath = (item) => {
  309. //return `/${item.url}/1.html`;
  310. //return `/newsList/${item.cid}?page=1`;
  311. return `/${item.aLIas_pinyin}/list-1.html`;
  312. }
  313. //首页跳转到详情,这里需要考虑外链
  314. const getLinkPathDetail = (item) => {
  315. if (item.islink == 1) {
  316. return `${item.linkurl}`;
  317. } else {
  318. //return `/${item.aLIas_pinyin}/${item.id}`;
  319. //return `/newsDetail/${item.id}`
  320. return `/${item.pinyin}/${item.id}.html`;
  321. }
  322. }
  323. //0.加载页面依赖 end ---------------------------------------->
  324. //1.获得路由id start ---------------------------------------->
  325. const route = useRoute();
  326. //获得当前的完整路径
  327. const fullPath = route.path;
  328. //拆分,取出来中间这一段,然后提取数字部分
  329. const segments = fullPath.split('/');
  330. const targetSegment = segments[1];
  331. //let routeId = 11 //排除路径错误可以打开这个
  332. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  333. //let routeId = numberPart;
  334. let routeId;
  335. //通过导航路径反向查询导航id
  336. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  337. method: 'GET',
  338. query: {
  339. 'pinyin': targetSegment,
  340. },
  341. });
  342. if (getRouteId.code == 200) {
  343. routeId = getRouteId.data.category_id
  344. } else {
  345. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  346. console.log("错误位置:通过url路径查询导航池id")
  347. console.log("后端错误反馈:", getRouteId.message)
  348. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  349. }
  350. //1.获得路由id end ---------------------------------------->
  351. //2.页面交互效果 start ---------------------------------------->
  352. //2.1 新闻图片切换
  353. const hoverStatus = ref(0)
  354. const qhPic = function (num) {
  355. console.log(num)
  356. hoverStatus.value = num;
  357. }
  358. //2.2 选项卡切换
  359. let showTabs = ref(1)
  360. // let qhtabs = function (number) {
  361. // console.log(number)
  362. // showTabs.value = number
  363. // }
  364. //2.3 展示广告
  365. let adImg1 = ref({})
  366. let adImg2 = ref({})
  367. let adImg3 = ref({})
  368. let adImg4 = ref({})
  369. onMounted(async () => {
  370. //从客户端获取行政职能部门 加快打开速度
  371. const { $webUrl, $CwebUrl } = useNuxtApp();
  372. //广告1
  373. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_category_0001`
  374. const responseAd1 = await fetch(url, {
  375. headers: {
  376. 'Content-Type': 'application/json',
  377. 'Userurl': $CwebUrl,
  378. 'Origin': $CwebUrl
  379. }
  380. });
  381. const resultAd1 = await responseAd1.json();
  382. adImg1.value = resultAd1.data[0];
  383. //广告2
  384. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_category_0002`
  385. const responseAd2 = await fetch(url2, {
  386. headers: {
  387. 'Content-Type': 'application/json',
  388. 'Userurl': $CwebUrl,
  389. 'Origin': $CwebUrl
  390. }
  391. });
  392. const resultAd2 = await responseAd2.json();
  393. adImg2.value = resultAd2.data[0];
  394. //广告3
  395. let url3 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_category_0003`
  396. const responseAd3 = await fetch(url3, {
  397. headers: {
  398. 'Content-Type': 'application/json',
  399. 'Userurl': $CwebUrl,
  400. 'Origin': $CwebUrl
  401. }
  402. });
  403. const resultAd3 = await responseAd3.json();
  404. adImg3.value = resultAd3.data[0];
  405. //广告4
  406. let url4 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_category_0004`
  407. const responseAd4 = await fetch(url4, {
  408. headers: {
  409. 'Content-Type': 'application/json',
  410. 'Userurl': $CwebUrl,
  411. 'Origin': $CwebUrl
  412. }
  413. });
  414. const resultAd4 = await responseAd4.json();
  415. adImg4.value = resultAd4.data[0];
  416. })
  417. //2.页面交互效果 end ---------------------------------------->
  418. //3.渲染页面数据 start ---------------------------------------->
  419. //3.1 该页面上所有的导航池 转为动态数据
  420. const pageCategory = ref([]);
  421. //3.2 该页面上需要渲染的所有数据
  422. const pageData = ref([
  423. // { id: 0, data: [], data2: [], title: "", cid: "" },
  424. // { id: 1, data: [], title: "", cid: "" },
  425. // { id: 2, data: [], title: "", cid: "" },
  426. // { id: 3, data: [], title: "", cid: "" },
  427. // { id: 4, data: [], title: "", cid: "" },
  428. // { id: 5, data: [], title: "", cid: "" },
  429. // { id: 6, data: [], title: "", cid: "" },
  430. // { id: 7, data: [], title: "", cid: "" },
  431. // { id: 8, data: [], title: "", cid: "" },
  432. // { id: 9, data: [], title: "", cid: "" },
  433. // { id: 10, data: [], title: "", cid: "" },
  434. // { id: 10, data: [], title: "", cid: "" },
  435. // {
  436. // id: 11,
  437. // title: "",
  438. // data: [],
  439. // data1: [],
  440. // data2: [],
  441. // data3: [],
  442. // data4: [],
  443. // category_id1: "",
  444. // category_id2: "",
  445. // category_id3: "",
  446. // category_id4: "",
  447. // title1: "",
  448. // title2: "",
  449. // title3: "",
  450. // title4: "",
  451. // cid: ""
  452. // },
  453. // { id: 12, data1: [], data2: [], data3: [], cid: "" },
  454. ])
  455. const navSize = ref("");
  456. const tabsData1 = ref(1);
  457. const tabsData2 = ref(1);
  458. //3.3 获取所有导航
  459. try {
  460. const navigateData = await requestDataPromise('/web/getWebsiteModelCategory', {
  461. method: 'GET',
  462. query: {
  463. 'placeid': 1,
  464. 'pid': routeId,
  465. 'num': 8
  466. },
  467. });
  468. if (navigateData.code == 200) {
  469. // 遍历可用的导航池放到页面中
  470. for (let index in navigateData.data) {
  471. let data = {
  472. title: navigateData.data[index].name,
  473. cid: navigateData.data[index].category_id,
  474. children_count: navigateData.data[index].children_count,
  475. alias: navigateData.data[index].alias,
  476. aLIas_pinyin: targetSegment + "/" + navigateData.data[index].aLIas_pinyin,
  477. data: [],
  478. data1: [],
  479. data2: [],
  480. data3: [],
  481. data4: [],
  482. category_id1: "",
  483. category_id2: "",
  484. category_id3: "",
  485. category_id4: "",
  486. title1: "",
  487. title2: "",
  488. title3: "",
  489. title4: ""
  490. };
  491. if (navigateData.data[index].is_url == 1) {
  492. // 处理 URL 的逻辑
  493. } else {
  494. //每个页面最多8个模块
  495. pageData.value.push(data);
  496. }
  497. }
  498. //导航池加载完毕,开始申请模块数据
  499. let getJson = [
  500. // { "parent": routeId + ",0,0", "child": pageData.value[0].cid + ",6,0" },//模块1时政书讯
  501. // { "parent": routeId + ",0,0", "child": pageData.value[1].cid + ",6,0" },//模块2读书读报
  502. // { "parent": routeId + ",0,0", "child": pageData.value[2].cid + ",8,0" },//模块3文化艺术
  503. // { "parent": routeId + ",0,0", "child": pageData.value[3].cid + ",8,0" },//模块4生活百科
  504. // { "parent": routeId + ",0,0", "child": pageData.value[4].cid + ",8,0" },//模块5养生保健
  505. // { "parent": routeId + ",0,0", "child": pageData.value[5].cid + ",3,6" },//模块6典集史鉴
  506. // { "parent": routeId + ",0,0", "child": pageData.value[6].cid + ",3,0" },//模块7党政报刊
  507. // { "parent": routeId + ",0,0", "child": pageData.value[7].cid + ",3,6" },//模块8涉农报刊
  508. ]
  509. for (let i = 0; i < pageData.value.length; i++) {
  510. if (i == 0) {
  511. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",6,0" });
  512. } else if (i == 1) {
  513. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",6,0" });
  514. } else if (i == 2) {
  515. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",8,0" });
  516. } else if (i == 3) {
  517. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",8,0" });
  518. } else if (i == 4) {
  519. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",8,0" });
  520. } else if (i == 5) {
  521. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",3,6" });
  522. } else if (i == 6) {
  523. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",3,0" });
  524. } else if (i == 7) {
  525. getJson.push({ "parent": routeId + ",0,0", "child": pageData.value[i].cid + ",3,6" });
  526. }
  527. }
  528. let jsonString = JSON.stringify(getJson);
  529. getPageAllData(jsonString);
  530. } else {
  531. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  532. console.log("错误位置:分类页导航池")
  533. console.log("后端错误反馈:", navigateData.message)
  534. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  535. }
  536. } catch (error) {
  537. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  538. console.log("错误位置:分类页导航渲染阶段")
  539. console.log("错误:导航池渲染执行接口出错!请检查首页的14的模块的具体执行方法!")
  540. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  541. }
  542. async function getPageAllData(jsonString) {
  543. const mkdata = await requestDataPromise('/web/getWebsiteBook', {
  544. method: 'GET',
  545. query: {
  546. 'id': jsonString
  547. },
  548. });
  549. if (mkdata.code == 200) {
  550. console.log(778899)
  551. console.log(mkdata.data)
  552. //模块1时政书讯
  553. pageData.value[0].data = mkdata.data[0].child.imgnum;
  554. //模块2读书读报
  555. pageData.value[1].data = mkdata.data[1].child.imgnum;
  556. //模块3文化艺术
  557. pageData.value[2].data = mkdata.data[2].child.imgnum;
  558. //模块4生活百科
  559. pageData.value[3].data = mkdata.data[3].child.imgnum;
  560. //模块5养生保健
  561. pageData.value[4].data = mkdata.data[4].child.imgnum;
  562. // 模块6
  563. pageData.value[5].data = mkdata.data[5].child.imgnum;
  564. pageData.value[5].data2 = mkdata.data[5].child.textnum;
  565. //模块7党政报刊
  566. pageData.value[6].data = mkdata.data[6].child.imgnum;
  567. //模块8涉农报刊
  568. pageData.value[7].data = mkdata.data[7].child.imgnum;
  569. pageData.value[7].data2 = mkdata.data[7].child.textnum;
  570. } else {
  571. ElMessage.error(mkdata.message)
  572. }
  573. }
  574. //3.渲染页面数据 end ---------------------------------------->
  575. //4.设置seo信息 start---------------------------------------->
  576. //4.1 设置seo信息
  577. const setData = await requestDataPromise('/web/getWebsiteCategoryHead', {
  578. method: 'GET',
  579. query: {
  580. 'catid': routeId
  581. },
  582. });
  583. if (setData.code == 200) {
  584. let seoTitle = setData.data.seo_title;
  585. let seoDescription = setData.data.seo_description;
  586. let seoKeywords = setData.data.seo_keywords;
  587. let seoSuffix = setData.data.suffix;
  588. let seoName = setData.data.website_name;
  589. useSeoMeta({
  590. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  591. meta: [
  592. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  593. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  594. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  595. ]
  596. });
  597. } else {
  598. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  599. // console.log("错误位置:设置分类页面SEO数据")
  600. // console.log("后端错误反馈:", setData.message)
  601. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  602. }
  603. //4.设置seo信息 end---------------------------------------->
  604. </script>
  605. <style lang="less" scoped>
  606. @import '@/assets/css/shukan.less';
  607. </style>
  608. <style lang="less" scoped>
  609. @media screen and (min-width:801px){/*pc*/
  610. .pc_none{display:none;}
  611. }
  612. @media screen and (max-width:800px){/*ipad_phone*/
  613. .index_main{overflow:hidden;width:100%;margin:0px auto;}
  614. .index_main:nth-last-of-type(1){margin:0px auto 11px;}
  615. .book_1_img_ul{margin-top:15px;}
  616. .book_1_img_ul .book_1_img_li_a{width:100%;}
  617. .book_1_img_ul .book_1_img_li_img{width:100px;height:123px;margin-right:15px;}
  618. .book_1_img_ul .book_1_img_li_right{width:auto;float:none;display:block;}
  619. .book_1_img_ul .book_1_img_li_dot2{margin-top:5px;font-size:16px;width:100%;}
  620. .book_1_img_ul .book_1_img_li_btn{margin-top:34px;font-size:12px;height:30px;line-height:30px;padding:0px 8px;}
  621. .book_head_box .book_head_a{font-size:18px;line-height:42px;height:42px;}
  622. .book_1_img_li{ float:none!important;width:100%!important;margin:0px 0px 15px 0px!important;}
  623. .book_1_img_ul{height:auto; min-height:325px;}
  624. .book_1_img_ul .book_1_img_li:nth-of-type(n+7){display:none;}
  625. .book_1_img_ul .book_1_img_li:nth-of-type(n+2){
  626. height:22px;line-height:22px;
  627. .book_1_img_li_img{display:none;}
  628. .book_1_img_li_btn{display:none;}
  629. .book_1_img_li_a{height:22px;line-height:22px;width:100%;}
  630. .book_1_img_li_right{height:22px;line-height:22px;}
  631. .book_1_img_li_dot2{height:22px;line-height:22px;-webkit-line-clamp: 1;
  632. margin-top:0px;text-indent:12px;position:relative;
  633. }
  634. .book_1_img_li_dot2::after {
  635. content: '';
  636. display: block;
  637. background: #d9d9d9;
  638. position: absolute;
  639. left: 0px;
  640. top: 8px;
  641. width: 6px;
  642. height: 6px;
  643. }
  644. }
  645. .index_2_left{float:none;width:100%;}
  646. .index_2_right{float:none;width:100%;}
  647. .book_num_1_ul{margin-top:15px;
  648. min-height:323px;
  649. }
  650. .book_num_1_ul .book_num_1_li{margin-bottom:15px; }
  651. .book_num_1_ul .book_num_1_li:nth-of-type(n+7){ display:none;}
  652. .book_num_1_ul .book_num_1_li_a{overflow:hidden;position:relative;}
  653. .book_num_1_ul .book_num_1_li_img{display:block;width:100px;height:123px;margin:0px 15px 0px 0px;}
  654. .book_num_1_ul .book_num_1_li_tag{display:none;}
  655. .book_num_1_ul .book_num_1_li_dot1{float:none;width:auto; border:0;
  656. height:44px;line-height:22px;margin-top:5px;
  657. }
  658. .book_num_1_ul .text_active{font-weight:normal;}
  659. .book_num_1_ul .text_active::after{
  660. display:none;
  661. }
  662. .book_num_1_li{
  663. .book_1_img_li_btn{
  664. margin-top: 34px;
  665. font-size: 12px;
  666. height: 30px;
  667. line-height: 30px;
  668. padding: 0px 8px;
  669. float: left;
  670. border: solid 1px #49A769;
  671. color: #49A769;
  672. text-align: center;
  673. box-sizing: border-box;
  674. }
  675. }
  676. .book_num_1_ul .book_num_1_li:nth-of-type(n+2){
  677. height:22px;line-height:22px;
  678. .book_num_1_li_img{display:none;}
  679. .book_1_img_li_btn{display:none;}
  680. .book_num_1_li_a{height:22px;line-height:22px;}
  681. .book_num_1_li_dot1{height:22px;line-height:22px;-webkit-line-clamp: 1;
  682. margin-top:0px;text-indent:12px;position:relative;
  683. }
  684. .book_num_1_li_dot1::after {
  685. content: '';
  686. display: block;
  687. background: #d9d9d9;
  688. position: absolute;
  689. left: 0px;
  690. top: 8px;
  691. width: 6px;
  692. height: 6px;
  693. }
  694. }
  695. .index_3_left{float:none;width:100%;overflow:hidden;}
  696. .book_2_img_ul{height:auto;margin-top:15px;height:323px; }
  697. .book_2_img_li{overflow:hidden;width:100%;margin:0px 0px 15px 0px;
  698. .book_2_img_li_img{float:left;width:100px;height:123px;border-radius:4px;margin-right:15px;}
  699. .book_2_img_li_dot1{height:44px;line-height:22px;width:auto;font-size:16px;
  700. margin:5px 0px 0px 0px;text-align:left;
  701. display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  702. word-break: normal;
  703. white-space: normal;
  704. text-overflow: normal;
  705. }
  706. .book_1_img_li_btn{
  707. margin-top: 34px;
  708. font-size: 12px;
  709. height: 30px;
  710. line-height: 30px;
  711. padding: 0px 8px;
  712. float: left;
  713. border: solid 1px #49A769;
  714. color: #49A769;
  715. text-align: center;
  716. box-sizing: border-box;
  717. }
  718. }
  719. .book_2_img_ul .book_2_img_li:nth-of-type(n+7){display:none;}
  720. .book_2_img_ul .book_2_img_li:nth-of-type(n+2){
  721. height:22px;line-height:22px;
  722. .book_2_img_li_img{display:none;}
  723. .book_1_img_li_btn{display:none;}
  724. .book_num_1_li_a{height:22px;line-height:22px;display:block;}
  725. .book_2_img_li_right{height:22px;line-height:22px;}
  726. .book_2_img_li_dot1{height:22px;line-height:22px;-webkit-line-clamp: 1;
  727. margin-top:0px;text-indent:12px;position:relative;
  728. }
  729. .book_2_img_li_dot1::after {
  730. content: '';
  731. display: block;
  732. background: #d9d9d9;
  733. position: absolute;
  734. left: 0px;
  735. top: 8px;
  736. width: 6px;
  737. height: 6px;
  738. }
  739. }
  740. .index_3_right{width:100%;float:none; height:410px;}
  741. .book_3_img_ul{height:auto;margin-top:15px;
  742. .book_3_img_li{width:100%;overflow:hidden;margin:0px 0px 15px 0px;}
  743. .book_3_img_li_a{width:100%;overflow:hidden;}
  744. .book_3_img_li_img{float:left;width:100px;height:123px;margin:0px 15px 0px 0px;}
  745. .book_3_img_li_dot1{height:44px;line-height:22px;width:auto;font-size:16px;
  746. margin:5px 0px 0px 0px;text-align:left;
  747. display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  748. word-break: normal;
  749. white-space: normal;
  750. text-overflow: normal;}
  751. .book_1_img_li_btn{
  752. margin-top: 34px;
  753. font-size: 12px;
  754. height: 30px;
  755. line-height: 30px;
  756. padding: 0px 8px;
  757. float: left;
  758. border: solid 1px #49A769;
  759. color: #49A769;
  760. text-align: center;
  761. box-sizing: border-box;
  762. }
  763. .book_3_img_li:nth-of-type(n+2){display:none;}
  764. }
  765. .index_4_left{float:none;width:100%;overflow:hidden;}
  766. .book_5_img_ul{height:auto;margin-top:15px;
  767. min-height:414px;
  768. .book_5_img_li{background:#fff;padding:0px;margin:0px 0px 15px 0px;}
  769. .book_5_img_li_a{display:block;height:auto;overflow:hidden;}
  770. .book_5_img_li_img{height:123px;margin-right:15px;}
  771. .book_5_img_li_right{ float:none;width:auto;}
  772. .book_5_img_li_dot2{font-size:16px;font-weight:normal;margin-top:5px;}
  773. .book_5_img_li_foot_num{font-size:20px;margin-top:3px;}
  774. .book_5_img_li_foot{margin-top:25px;}
  775. }
  776. .index_4_right{float:none;width:100%;min-height:379px;}
  777. .book_4_img_ul{margin-top:15px;height:auto;
  778. .book_4_img_li{width:100%;overflow:hidden;margin:0px 0px 15px 0px;}
  779. .book_4_img_li_a{width:100%;overflow:hidden;}
  780. .book_4_img_li_img{float:left;width:100px;height:123px;margin:0px 15px 0px 0px;}
  781. .book_4_img_li_dot1{height:44px;line-height:22px;width:auto;font-size:16px;
  782. margin:5px 0px 0px 0px;text-align:left;
  783. display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  784. word-break: normal;
  785. white-space: normal;
  786. text-overflow: unset;
  787. }
  788. .book_1_img_li_btn{
  789. margin-top: 34px;
  790. font-size: 12px;
  791. height: 30px;
  792. line-height: 30px;
  793. padding: 0px 8px;
  794. float: left;
  795. border: solid 1px #49A769;
  796. color: #49A769;
  797. text-align: center;
  798. box-sizing: border-box;
  799. }
  800. .book_4_img_li:nth-of-type(n+2){display:none;}
  801. }
  802. .book_2_ul{margin-top:6px;}
  803. .book_2_li{
  804. line-height:22px;height:22px!important;overflow:hidden;border:none!important;
  805. margin-bottom:19px;position:relative;
  806. .book_2_li_tag{display:none;}
  807. .book_2_li_a{line-height:22px;height:22px;
  808. width:100%;text-indent:12px;
  809. }
  810. }
  811. .book_2_li:nth-last-of-type(1){margin-bottom:0px;}
  812. .book_2_li::after{
  813. content: '';
  814. display: block;
  815. background: #d9d9d9;
  816. position: absolute;
  817. left: 0px;
  818. top: 8px;
  819. width: 6px;
  820. height: 6px;
  821. }
  822. .book_2_li:nth-of-type(5){margin-bottom:0px;}
  823. .book_2_li:nth-of-type(n+6){display:none;}
  824. .book_3_ul{margin-top:6px;}
  825. .book_3_li{
  826. line-height:22px;height:22px!important;overflow:hidden;border:none!important;
  827. margin-bottom:19px;position:relative;
  828. .book_3_li_tag{display:none;}
  829. .book_3_li_a{line-height:22px;height:22px;
  830. width:100%;text-indent:12px;
  831. }
  832. }
  833. .book_3_li:nth-of-type(n+6){display:none;}
  834. .book_3_li:nth-of-type(5){margin-bottom:0px;}
  835. .book_3_li::after{
  836. content: '';
  837. display: block;
  838. background: #d9d9d9;
  839. position: absolute;
  840. left: 0px;
  841. top: 8px;
  842. width: 6px;
  843. height: 6px;
  844. }
  845. .sannongzhichuang{margin:0px 0px 0px;}
  846. .index_main>section,.index_main>div{width:92%;margin:0px auto;float:none;display:block;overflow:hidden;}
  847. .index_main> .adversing{ display:none;}
  848. .index_2_left{margin-top:7px;}
  849. .index_3_left{margin-top:11px;}
  850. .index_4_left{margin-top:11px;}
  851. .part_3{
  852. height: 11px;
  853. }
  854. .phone_show{display:block!important;}
  855. .phone_none{display:none;}
  856. }
  857. </style>