index.html.vue 37 KB

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