index-BFGcWMSD.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import { defineComponent, ref, reactive, resolveComponent, resolveDirective, mergeProps, useSSRContext } from "vue";
  2. import { useStore } from "vuex";
  3. import { useRouter, useRoute } from "vue-router";
  4. import { _ as _sfc_main$1 } from "./banner-Bjm1R_JU.js";
  5. import { _ as _sfc_main$2 } from "./pagination-CaTX_3XH.js";
  6. import { ssrRenderAttrs, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderClass, ssrInterpolate, ssrGetDirectiveProps } 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 router = useRouter();
  15. useRoute();
  16. const requestParams = ref({});
  17. let paramsData = reactive({
  18. params: {
  19. categoryid: 0,
  20. pageNum: 1,
  21. pageSize: 100,
  22. order: "sortindex",
  23. active: true
  24. },
  25. index: "",
  26. sub: 0
  27. });
  28. let oldCategoryId = ref();
  29. function facilityClick(item) {
  30. if (item.id != oldCategoryId.value) {
  31. requestParams.value = item;
  32. paramsData = {
  33. params: {
  34. categoryid: item.id,
  35. pageNum: 1,
  36. pageSize: 10,
  37. order: "sortindex",
  38. active: true
  39. },
  40. index: store.state.currentPagePath,
  41. sub: store.state.sub
  42. };
  43. oldCategoryId.value = item.id;
  44. store.dispatch("getPageData", paramsData);
  45. }
  46. }
  47. function details(item) {
  48. let params = {
  49. path: `/services_Read`,
  50. query: {
  51. categoryid: item.categoryid,
  52. id: item.id,
  53. isUrlId: 1
  54. }
  55. };
  56. store.commit("setRoute", params);
  57. router.push(params);
  58. }
  59. function handleCurrentChange(val) {
  60. paramsData.params.pageNum = val;
  61. store.dispatch("getPageData", paramsData).then(() => {
  62. });
  63. }
  64. return { store, facilityClick, handleCurrentChange, details };
  65. },
  66. components: {
  67. banner: _sfc_main$1,
  68. pagination: _sfc_main$2
  69. },
  70. asyncData({ store, route }) {
  71. let params = reactive(route.value);
  72. return store.dispatch("getMenuList").then(() => {
  73. var _a;
  74. const data = store.state.menuList;
  75. let paramsData = reactive({
  76. params: {
  77. categoryid: 0,
  78. pageNum: 1,
  79. pageSize: 100,
  80. order: "sortindex"
  81. },
  82. index: "",
  83. sub: 0
  84. });
  85. let str = ref("");
  86. if (params.path.indexOf("_") > -1) {
  87. str.value = params.path.split("_")[0];
  88. }
  89. for (let i = 0; i < data.length; i++) {
  90. if (!data[i].sname && params.path == data[i].path || data[i].path == str.value) {
  91. paramsData = {
  92. params: {
  93. categoryid: data[i].id,
  94. pageNum: 1,
  95. pageSize: 100,
  96. order: "sortindex"
  97. },
  98. index: params.path,
  99. sub: i
  100. };
  101. if (!((_a = params.query) == null ? void 0 : _a.categoryid)) {
  102. paramsData.params.categoryid = data[i].children[0].id;
  103. } else {
  104. paramsData.params.categoryid = params.query.categoryid;
  105. }
  106. return store.dispatch("getPageData", paramsData).then(() => {
  107. store.commit("setColumnTypes", store.state.menuList[store.state.sub].children);
  108. });
  109. }
  110. }
  111. });
  112. }
  113. });
  114. function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  115. const _component_banner = resolveComponent("banner");
  116. const _component_pagination = resolveComponent("pagination");
  117. const _directive_lazy = resolveDirective("lazy");
  118. _push(`<div${ssrRenderAttrs(mergeProps({ class: "pageContain" }, _attrs))}><section class="common-bradcrumb-section">`);
  119. _push(ssrRenderComponent(_component_banner, null, null, _parent));
  120. _push(`<section class="product-grid-section" style="${ssrRenderStyle([{ "text-align": "center", "position": "absolute", "bottom": "0" }, { "width": "100%" }])}"><ul class="cannot_selected tabs_selected"><!--[-->`);
  121. ssrRenderList(_ctx.store.state.columnTypes, (item, index2) => {
  122. _push(`<a class="${ssrRenderClass(item.id == _ctx.store.state.acitveId ? "active" : "")}" style="${ssrRenderStyle({ "width": 1 / _ctx.store.state.columnTypes.length * 100 + "%" })}">${ssrInterpolate(item.categoryName)}</a>`);
  123. });
  124. _push(`<!--]--></ul></section></section><section class="product-grid-section container pt-20 pb-60 lazyContainer"><div class="row pt-80 content"><!--[-->`);
  125. ssrRenderList(_ctx.store.state.pageContent, (item) => {
  126. _push(`<div class="col-md-4 newItemOne"><div class="oneInnerBox"><div class="img"><img${ssrRenderAttrs(mergeProps({
  127. alt: "",
  128. "data-src": item.image
  129. }, ssrGetDirectiveProps(_ctx, _directive_lazy, item.image)))}></div><a class="line-two">${ssrInterpolate(item.title)}</a><span class="line-two">${ssrInterpolate(item.zhaiyao)}</span></div></div>`);
  130. });
  131. _push(`<!--]--></div>`);
  132. _push(ssrRenderComponent(_component_pagination, {
  133. data: _ctx.store.state.pagination,
  134. onPagination: _ctx.handleCurrentChange
  135. }, null, _parent));
  136. _push(`</section></div>`);
  137. }
  138. const _sfc_setup = _sfc_main.setup;
  139. _sfc_main.setup = (props, ctx) => {
  140. const ssrContext = useSSRContext();
  141. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/services/index.vue");
  142. return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
  143. };
  144. const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
  145. export {
  146. index as default
  147. };