index.html.vue 39 KB

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