import { defineComponent, ref, reactive, resolveComponent, resolveDirective, mergeProps, useSSRContext } from "vue";
import { useStore } from "vuex";
import { useRouter, useRoute } from "vue-router";
import { _ as _sfc_main$1 } from "./banner-Bjm1R_JU.js";
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderClass, ssrRenderAttr, ssrInterpolate, ssrGetDirectiveProps } 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 router = useRouter();
    useRoute();
    const requestParams = ref({});
    let paramsData = reactive({});
    let oldCategoryId = ref();
    function facilityClick(item) {
      if (item.id != oldCategoryId.value) {
        requestParams.value = item;
        paramsData = {
          params: {
            categoryid: item.id,
            pageNum: 1,
            pageSize: 100,
            order: "sortindex"
          },
          index: store.state.currentPagePath,
          sub: store.state.sub
        };
        oldCategoryId.value = item.id;
        store.dispatch("getPageData", paramsData);
      }
    }
    function details(item) {
      let params = {
        path: `/cases_Read`,
        query: {
          categoryid: item.categoryid,
          id: item.id,
          isUrlId: 1
        }
      };
      store.commit("setRoute", params);
      router.push(params);
    }
    return { store, facilityClick, details };
  },
  components: {
    banner: _sfc_main$1
  },
  asyncData({ store, route }) {
    let params = reactive(route.value);
    return store.dispatch("getMenuList").then(() => {
      var _a;
      const data = reactive(store.state.menuList);
      let paramsData = reactive({
        params: {
          categoryid: 0,
          pageNum: 1,
          pageSize: 100,
          order: "sortindex"
        },
        index: "",
        sub: 0
      });
      for (let i = 0; i < data.length; i++) {
        if (!data[i].sname && params.path == data[i].path) {
          paramsData = {
            params: {
              categoryid: data[i].id,
              pageNum: 1,
              pageSize: 100,
              order: "sortindex"
            },
            index: params.path,
            sub: i
          };
          if (!((_a = params.query) == null ? void 0 : _a.categoryid)) {
            paramsData.params.categoryid = data[i].children[0].id;
          } else {
            paramsData.params.categoryid = params.query.categoryid;
          }
          return store.dispatch("getPageData", paramsData).then(() => {
            store.commit("setColumnTypes", store.state.menuList[store.state.sub].children);
          });
        }
      }
    });
  }
});
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_banner = resolveComponent("banner");
  const _directive_lazy = resolveDirective("lazy");
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "pageContain" }, _attrs))}><section class="common-bradcrumb-section">`);
  _push(ssrRenderComponent(_component_banner, null, null, _parent));
  _push(`</section><section style="${ssrRenderStyle({ "background": "#F4F8FD" })}" class="solutionType"><div class="container pc" style="${ssrRenderStyle({ "text-align": "center" })}"><!--[-->`);
  ssrRenderList(_ctx.store.state.columnTypes, (item, index2) => {
    _push(`<div class="${ssrRenderClass([item.id == _ctx.store.state.acitveId ? "active" : "", "solutionTypeOne"])}" style="${ssrRenderStyle({ "width": 1 / _ctx.store.state.columnTypes.length * 100 + "%" })}"><div style="${ssrRenderStyle({ "width": "40px", "height": "40px", "overflow": "hidden", "margin": "0 auto" })}"><img class="img"${ssrRenderAttr("src", item.imagePath)} alt=""></div><p>${ssrInterpolate(item.categoryName)}</p></div>`);
  });
  _push(`<!--]--></div><div class="container mobile" style="${ssrRenderStyle({ "text-align": "center" })}"><!--[-->`);
  ssrRenderList(_ctx.store.state.columnTypes, (item, index2) => {
    _push(`<div class="${ssrRenderClass([item.id == _ctx.store.state.acitveId ? "active" : "", "solutionTypeOne"])}" style="${ssrRenderStyle({ "width": 1.5 / _ctx.store.state.columnTypes.length * 100 + "%" })}"><div style="${ssrRenderStyle({ "width": "40px", "height": "40px", "overflow": "hidden", "margin": "0 auto" })}"><img${ssrRenderAttrs(mergeProps({
      class: "img",
      alt: ""
    }, ssrGetDirectiveProps(_ctx, _directive_lazy, item.imagePath)))}></div><p>${ssrInterpolate(item.categoryName)}</p></div>`);
  });
  _push(`<!--]--></div></section><section class="solution-section lazyContainer"><!--[-->`);
  ssrRenderList(_ctx.store.state.pageContent, (item, index2) => {
    _push(`<div style="${ssrRenderStyle([{ background: index2 % 2 == 1 ? "#F4F8FD" : "#fff" }, { "padding": "40px 0" }])}"><div class="container"><div class="solutionItem"><div class="solutionTitle text-left">${ssrInterpolate(item.title)}</div><div class="row solutionInner"><div class="col-md-7"><p class="text-left">${item.lmtitle}</p><div class="pt-40 mb-20 text-left">${ssrInterpolate(item.zhaiyao)}</div></div><div class="col-md-5 text-center"><img${ssrRenderAttrs(mergeProps({
      alt: "",
      "data-src": item.image
    }, ssrGetDirectiveProps(_ctx, _directive_lazy, item.image)))}></div></div></div></div></div>`);
  });
  _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/cases/index.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
export {
  index as default
};
