read-BMdAvrqr.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import { defineComponent, reactive, ref, resolveComponent, mergeProps, useSSRContext } from "vue";
  2. import { useStore } from "vuex";
  3. import { useRoute } from "vue-router";
  4. import { _ as _sfc_main$1 } from "./banner-Bjm1R_JU.js";
  5. import { _ as _sfc_main$2, a as _imports_0 } from "./close-qpOHEUbb.js";
  6. import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate, ssrRenderAttr } from "vue/server-renderer";
  7. import { _ as _export_sfc } from "../entry-server.js";
  8. import "element-plus";
  9. import "axios";
  10. import "vue3-lazy";
  11. const _sfc_main = defineComponent({
  12. setup() {
  13. const store = useStore();
  14. const route = useRoute();
  15. const recomMendationList = reactive(recomMendationFilter(store.state.recomMendation));
  16. function recomMendationFilter(data) {
  17. var _a;
  18. let array = [];
  19. for (let i = 0; i < data.length; i++) {
  20. if (data[i].id != ((_a = route.query) == null ? void 0 : _a.id)) {
  21. array.push(data[i]);
  22. }
  23. }
  24. return array;
  25. }
  26. return { store, recomMendationList };
  27. },
  28. components: {
  29. banner: _sfc_main$1,
  30. recomMendation: _sfc_main$2
  31. },
  32. asyncData({ store, route }) {
  33. var _a;
  34. let params = reactive({});
  35. if ((_a = route.value.query) == null ? void 0 : _a.id) {
  36. params = route.value;
  37. } else {
  38. params = store.state.route;
  39. }
  40. return store.dispatch("getMenuList").then(() => {
  41. var _a2, _b, _c, _d, _e;
  42. const data = reactive(store.state.menuList);
  43. let str = ref("");
  44. let sub = ref();
  45. let paramsData = reactive({});
  46. if (params.path.indexOf("_")) {
  47. str.value = params.path.split("_")[0];
  48. }
  49. for (let i = 0; i < data.length; i++) {
  50. if (params.path == data[i].path || str.value == data[i].path) {
  51. if (((_a2 = params.query) == null ? void 0 : _a2.categoryid) && !data[i].sname) {
  52. sub.value = i;
  53. if (((_b = params.query) == null ? void 0 : _b.id) && !params.query.dup) {
  54. paramsData = {
  55. params: {
  56. categoryid: (_c = params.query) == null ? void 0 : _c.categoryid,
  57. pageNum: 1,
  58. pageSize: 1,
  59. order: "sortindex",
  60. articleid: (_d = params.query) == null ? void 0 : _d.id,
  61. id: (_e = params.query) == null ? void 0 : _e.id,
  62. details: true
  63. },
  64. index: params.path,
  65. sub: sub.value
  66. };
  67. return store.dispatch("getPageData", paramsData);
  68. }
  69. }
  70. }
  71. }
  72. });
  73. }
  74. });
  75. function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  76. const _component_banner = resolveComponent("banner");
  77. const _component_recomMendation = resolveComponent("recomMendation");
  78. _push(`<div${ssrRenderAttrs(mergeProps({ class: "pageContain" }, _attrs))}><section class="common-bradcrumb-section">`);
  79. _push(ssrRenderComponent(_component_banner, null, null, _parent));
  80. _push(`</section><section class="product-content-section pt-60">`);
  81. if (_ctx.store.state.pageContent.length > 0) {
  82. _push(`<div class="container"><div class="row"><div class="col-lg-12 col-md-12 content"><div class="read_content mb-60"><div class="section-title text-left both-border mb-60 d-flex justify-content-between"><div><span class="title-tag2">${ssrInterpolate(_ctx.store.state.pageContent[0].title)}</span><div class="new-read-title2"><span>${ssrInterpolate(_ctx.store.state.pageContent[0].createdate)}</span><span>点击量:${ssrInterpolate(_ctx.store.state.pageContent[0].hits)}</span></div></div><a href="javascript:history.back(-1)"><img${ssrRenderAttr("src", _imports_0)} alt=""></a></div><div class="new-read-body">${_ctx.store.state.pageContent[0].content}</div></div>`);
  83. if (_ctx.recomMendationList.length > 0) {
  84. _push(ssrRenderComponent(_component_recomMendation, { data: _ctx.recomMendationList }, null, _parent));
  85. } else {
  86. _push(`<!---->`);
  87. }
  88. _push(`</div></div></div>`);
  89. } else {
  90. _push(`<!---->`);
  91. }
  92. _push(`</section></div>`);
  93. }
  94. const _sfc_setup = _sfc_main.setup;
  95. _sfc_main.setup = (props, ctx) => {
  96. const ssrContext = useSSRContext();
  97. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/news/read.vue");
  98. return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
  99. };
  100. const read = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
  101. export {
  102. read as default
  103. };