import { defineComponent, reactive, ref, resolveComponent, mergeProps, useSSRContext } from "vue";
import { useStore } from "vuex";
import { useRoute } from "vue-router";
import { _ as _sfc_main$1 } from "./banner-Bjm1R_JU.js";
import { _ as _sfc_main$2, a as _imports_0 } from "./close-qpOHEUbb.js";
import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate, ssrRenderAttr } from "vue/server-renderer";
import { _ as _export_sfc } from "../entry-server.js";
import "element-plus";
import "axios";
import "vue3-lazy";
const _sfc_main = defineComponent({
  setup() {
    const store = useStore();
    const route = useRoute();
    const recomMendationList = reactive(recomMendationFilter(store.state.recomMendation));
    function recomMendationFilter(data) {
      var _a;
      let array = [];
      for (let i = 0; i < data.length; i++) {
        if (data[i].id != ((_a = route.query) == null ? void 0 : _a.id)) {
          array.push(data[i]);
        }
      }
      return array;
    }
    return { store, recomMendationList };
  },
  components: {
    banner: _sfc_main$1,
    recomMendation: _sfc_main$2
  },
  asyncData({ store, route }) {
    var _a;
    let params = reactive({});
    if ((_a = route.value.query) == null ? void 0 : _a.id) {
      params = route.value;
    } else {
      params = store.state.route;
    }
    return store.dispatch("getMenuList").then(() => {
      var _a2, _b, _c, _d, _e;
      const data = reactive(store.state.menuList);
      let str = ref("");
      let sub = ref();
      let paramsData = reactive({});
      if (params.path.indexOf("_")) {
        str.value = params.path.split("_")[0];
      }
      for (let i = 0; i < data.length; i++) {
        if (params.path == data[i].path || str.value == data[i].path) {
          if (((_a2 = params.query) == null ? void 0 : _a2.categoryid) && !data[i].sname) {
            sub.value = i;
            if (((_b = params.query) == null ? void 0 : _b.id) && !params.query.dup) {
              paramsData = {
                params: {
                  categoryid: (_c = params.query) == null ? void 0 : _c.categoryid,
                  pageNum: 1,
                  pageSize: 1,
                  order: "sortindex",
                  articleid: (_d = params.query) == null ? void 0 : _d.id,
                  id: (_e = params.query) == null ? void 0 : _e.id,
                  details: true
                },
                index: params.path,
                sub: sub.value
              };
              return store.dispatch("getPageData", paramsData);
            }
          }
        }
      }
    });
  }
});
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_banner = resolveComponent("banner");
  const _component_recomMendation = resolveComponent("recomMendation");
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "pageContain" }, _attrs))}><section class="common-bradcrumb-section">`);
  _push(ssrRenderComponent(_component_banner, null, null, _parent));
  _push(`</section><section class="product-content-section pt-60">`);
  if (_ctx.store.state.pageContent.length > 0) {
    _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>`);
    if (_ctx.recomMendationList.length > 0) {
      _push(ssrRenderComponent(_component_recomMendation, { data: _ctx.recomMendationList }, null, _parent));
    } else {
      _push(`<!---->`);
    }
    _push(`</div></div></div>`);
  } else {
    _push(`<!---->`);
  }
  _push(`</section></div>`);
}
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/news/read.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const read = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
export {
  read as default
};
