|
@@ -0,0 +1,628 @@
|
|
|
+<template>
|
|
|
+ <HomePageHead></HomePageHead>
|
|
|
+ <HomePageNavigation></HomePageNavigation>
|
|
|
+ <!-- 三农市场网-商城 -->
|
|
|
+ <main class="index_main">
|
|
|
+ <div class="shop_head_1 clearfix back100">
|
|
|
+ <span class="shop_head_1_a" href="" title="">{{ categoryName }}</span>
|
|
|
+ </div>
|
|
|
+ <!-- 导航 -->
|
|
|
+ <section class="shop_2 clearfix">
|
|
|
+ <div class="shop_2_in clearfix">
|
|
|
+ <div class="shop_2_in_box clearfix shop_2_in_box_even">
|
|
|
+ <div class="shop_2_box clearfix">
|
|
|
+ <NuxtLink class="shop_2_name" :href="`/${pageData[0].aLIas_pinyin}/index.html`"
|
|
|
+ :title="pageData[0].title">
|
|
|
+ {{ pageData[0].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <div class="shop_2_right clearfix">
|
|
|
+ <a class="shop_2_a" href="" title="" v-for="(item, index) in pageData[0].children"
|
|
|
+ :key="index">{{ item.alias }}</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_2_box clearfix">
|
|
|
+ <NuxtLink class="shop_2_name" :href="`/${pageData[1].aLIas_pinyin}/index.html`"
|
|
|
+ :title="pageData[1].title">
|
|
|
+ {{ pageData[1].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <div class="shop_2_right clearfix">
|
|
|
+ <a class="shop_2_a" href="" title="" v-for="(item, index) in pageData[1].children"
|
|
|
+ :key="index">{{ item.alias }}</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_2_in_box clearfix">
|
|
|
+ <div class="shop_2_box clearfix">
|
|
|
+ <NuxtLink class="shop_2_name" :href="`/${pageData[2].aLIas_pinyin}/index.html`"
|
|
|
+ :title="pageData[2].title">
|
|
|
+ {{ pageData[2].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <div class="shop_2_right clearfix">
|
|
|
+ <a class="shop_2_a" href="" title="" v-for="(item, index) in pageData[2].children"
|
|
|
+ :key="index">{{ item.alias }}</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_2_box clearfix">
|
|
|
+ <NuxtLink class="shop_2_name" href="" title="" :href="`/${pageData[3].aLIas_pinyin}/index.html`"
|
|
|
+ :title="pageData[3].title">
|
|
|
+ {{ pageData[3].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <div class="shop_2_right clearfix">
|
|
|
+ <a class="shop_2_a" href="" title="" v-for="(item, index) in pageData[3].children"
|
|
|
+ :key="index">{{ item.alias }}</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_2_in_2 clearfix">
|
|
|
+ <NuxtLink class="shop_2_name_2" :href="`/${pageData[4].aLIas_pinyin}/index.html`"
|
|
|
+ :title="pageData[4].title">
|
|
|
+ {{ pageData[4].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <div class="shop_2_right_2 clearfix">
|
|
|
+ <a class="shop_2_a_2" href="" title="" v-for="(item, index) in pageData[4].children" :key="index">
|
|
|
+ {{ item.alias }}</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ <section class="shop_3 clearfix" v-if="goodsData.length > 0">
|
|
|
+ <!-- 农产批发1 -->
|
|
|
+ <div class="shop_3_in clearfix">
|
|
|
+ <div class="shop_head_2 clearfix">
|
|
|
+ <div class="shop_head_2_name">{{ goodsData[0].alias }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_ul_1 clearfix" v-if="goodsData[0].data">
|
|
|
+ <div class="shop_img_li_1 clearfix" v-for="(item, index) in goodsData[0].data" :key="index">
|
|
|
+ <a class="shop_img_li_1_a" href="" title="">
|
|
|
+ <div class="shop_img_li_1_img_box clearfix">
|
|
|
+ <img class="shop_img_li_1_img" :src="item.imgurl" title="" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_li_1_right clearfix">
|
|
|
+ <h4 class="shop_img_li_1_h4 dot2">{{ item.name }}</h4>
|
|
|
+ <div class="shop_img_li_1_tag">
|
|
|
+ {{ item.type_id == 1 ? '求购' : '供应' }}
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_li_1_btn">查看详情</div>
|
|
|
+ </div>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_3_in clearfix">
|
|
|
+ <div class="shop_head_3 clearfix">
|
|
|
+ <a class="shop_head_3_more" href="" title="">栏目简介</a>
|
|
|
+ </div>
|
|
|
+ <div class="shop_ul_1 clearfix" v-if="goodsData[0].data1.length > 0">
|
|
|
+ <div class="shop_li_1 clearfix" v-for="(item, index) in goodsData[0].data1" :key="index">
|
|
|
+ <a class="shop_li_1_a" href="" title="">
|
|
|
+ <div class="shop_li_1_left">
|
|
|
+ <h4 class="shop_li_1_h4 dot1">{{ item.name }}</h4>
|
|
|
+ <div class="shop_li_1_text dot1">{{ item.description }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_li_1_btn">查看详情</div>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 集贸市场2 -->
|
|
|
+ </section>
|
|
|
+ <section class="shop_4 clearfix">
|
|
|
+ <!-- 名品之窗1 -->
|
|
|
+ <div class="shop_3_in clearfix" v-if="goodsData.length > 1">
|
|
|
+ <div class="shop_head_4 clearfix">
|
|
|
+ <div class="shop_head_4_name">{{ goodsData[1].alias }}</div>
|
|
|
+ <a class="shop_head_4_more" href="" title="">栏目简介</a>
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_ul_2 clearfix">
|
|
|
+ <div class="shop_img_li_2 clearfix" v-for="(item, index) in goodsData[1].data" :key="index">
|
|
|
+ <a class="shop_img_li_2_a" href="" title="">
|
|
|
+ <div class="shop_img_li_2_img_box clearfix">
|
|
|
+ <img class="shop_img_li_2_img" :src="item.imgurl" title="" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_li_2_right clearfix">
|
|
|
+ <h4 class="shop_img_li_2_h4 dot2">{{ item.name }}</h4>
|
|
|
+ <div class="shop_img_li_2_tag">
|
|
|
+ {{ item.type_id == 1 ? '求购' : '供应' }}
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_li_2_btn">查看详情</div>
|
|
|
+ </div>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 名品之窗2 -->
|
|
|
+ <!-- 供求信息1 -->
|
|
|
+ <div class="shop_3_in clearfix" v-if="goodsData.length > 2">
|
|
|
+ <div class="shop_head_5 clearfix">
|
|
|
+ <div class="shop_head_5_name">{{ goodsData[2].alias }}</div>
|
|
|
+ <a class="shop_head_5_more" href="" title="">栏目简介</a>
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_ul_3 clearfix">
|
|
|
+ <div class="shop_img_li_3 clearfix" v-for="(item, index) in goodsData[2].data" :key="index">
|
|
|
+ <a class="shop_img_li_3_a" href="" title="">
|
|
|
+ <div class="shop_img_li_3_img_box clearfix">
|
|
|
+ <img class="shop_img_li_3_img" :src="item.imgurl" title="" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_li_3_right clearfix">
|
|
|
+ <h4 class="shop_img_li_3_h4 dot2">{{ item.name }}</h4>
|
|
|
+ <div class="shop_img_li_3_tag">
|
|
|
+ {{ item.type_id == 1 ? '求购' : '供应' }}
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_li_3_btn">查看详情</div>
|
|
|
+ </div>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 供求信息2 -->
|
|
|
+ </section>
|
|
|
+ <div class="banner_1 clearfix">
|
|
|
+ <a class="banner_1_a" href="" title="">
|
|
|
+ <img class="banner_1_img" src="@/public/img/6.png" title="" alt="">
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ <section class="shop_5 clearfix">
|
|
|
+ <!-- 农产动态 1-->
|
|
|
+ <div class="shop_5_left clearfix">
|
|
|
+ <div class="shop_head_7 clearfix">
|
|
|
+ <NuxtLink :href="`/${newsData[0].aLIas_pinyin}/index.html`" class="shop_head_7_name">
|
|
|
+ {{ newsData[0].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <NuxtLink :href="`/${newsData[0].aLIas_pinyin}/index.html`" class="shop_head_7_more"
|
|
|
+ :title="newsData[0].title">
|
|
|
+ 栏目简介
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ <div class="shop_box_1 clearfix">
|
|
|
+ <div class="shop_img_ul_4 clearfix">
|
|
|
+ <div class="shop_img_li_4 clearfix">
|
|
|
+ <NuxtLink class="shop_img_li_4_a"
|
|
|
+ :href="`/${newsData[0].data.pinyin}/${newsData[0].data.id}.html`"
|
|
|
+ :title="newsData[0].data.title">
|
|
|
+ <img class="shop_img_li_4_img" :src="newsData[0].data.imgurl"
|
|
|
+ :title="newsData[0].data.title" alt="">
|
|
|
+ <div class="shop_img_li_4_rgba clearfix dot1">
|
|
|
+ {{ newsData[0].data.alias }}
|
|
|
+ </div>
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_ul_5 clearfix">
|
|
|
+ <div class="shop_img_li_5 clearfix" v-for="(item, index) in newsData[0].data1" :key="index">
|
|
|
+ <NuxtLink class="shop_img_li_5_a" :href="`/${item.pinyin}/${item.id}.html`"
|
|
|
+ :title="item.title">
|
|
|
+ <img class="shop_img_li_5_img" :src="item.imgurl" :title="item.title" alt="">
|
|
|
+ <div class="shop_img_li_5_rgba clearfix dot1">
|
|
|
+ {{ item.alias }}
|
|
|
+ </div>
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_box_2 clearfix">
|
|
|
+ <div class="shop_ul_2 clearfix">
|
|
|
+ <NuxtLink class="shop_li_2 clearfix dot1" :href="`/${item.pinyin}/${item.id}.html`"
|
|
|
+ :title="item.title" v-for="(item, index) in newsData[0].data2" :key="index">
|
|
|
+ {{ item.alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 农产动态 2-->
|
|
|
+ <!-- 农产知识 1-->
|
|
|
+ <div class="shop_5_right clearfix">
|
|
|
+ <div class="shop_head_8 clearfix">
|
|
|
+ <NuxtLink :href="`/${newsData[1].aLIas_pinyin}/index.html`" class="shop_head_8_name">
|
|
|
+ {{ newsData[1].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <NuxtLink :href="`/${newsData[1].aLIas_pinyin}/index.html`" class="shop_head_8_more"
|
|
|
+ :title="newsData[1].title">
|
|
|
+ 栏目简介
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ <div class="shop_img_ul_6 clearfix">
|
|
|
+ <div class="shop_img_li_6 clearfix">
|
|
|
+ <NuxtLink class="shop_img_li_6_a"
|
|
|
+ :href="`/${newsData[1].data.pinyin}/${newsData[1].data.id}.html`"
|
|
|
+ :title="newsData[1].data.title">
|
|
|
+ <img class="shop_img_li_6_img" :src="newsData[1].data.imgurl" title="" alt="">
|
|
|
+ <div class="shop_img_li_6_rgba clearfix dot1">
|
|
|
+ {{ newsData[1].data.alias }}
|
|
|
+ </div>
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_ul_3 clearfix">
|
|
|
+ <NuxtLink class="shop_li_3 dot1" :href="`/${item.pinyin}/${item.id}.html`" :title="item.title"
|
|
|
+ v-for="(item, index) in newsData[1].data2" :key="index">
|
|
|
+ {{ item.alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 农产知识 2-->
|
|
|
+ </section>
|
|
|
+ <section class="shop_6 clearfix">
|
|
|
+ <!-- 农产会展1 -->
|
|
|
+ <div class="shop_6_left clearfix">
|
|
|
+ <div class="shop_head_9 clearfix">
|
|
|
+ <NuxtLink :href="`/${newsData[2].aLIas_pinyin}/index.html`" class="shop_head_9_name">
|
|
|
+ {{ newsData[2].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <NuxtLink :href="`/${newsData[2].aLIas_pinyin}/index.html`" class="shop_head_9_more"
|
|
|
+ :title="newsData[2].title">
|
|
|
+ 栏目简介
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ <div class="shop_box_3 clearfix">
|
|
|
+ <div class="shop_img_ul_7 clearfix">
|
|
|
+ <div class="shop_img_li_7 clearfix">
|
|
|
+ <NuxtLink class="shop_img_li_7_a"
|
|
|
+ :href="`/${newsData[2].data.pinyin}/${newsData[2].data.id}.html`"
|
|
|
+ :title="newsData[2].data.title">
|
|
|
+ <img class="shop_img_li_7_img" :src="newsData[2].data.imgurl"
|
|
|
+ :title="newsData[2].data.title" alt="">
|
|
|
+ <div class="shop_img_li_7_rgba clearfix dot1">
|
|
|
+ {{ newsData[2].data.alias }}
|
|
|
+ </div>
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_box_4 clearfix">
|
|
|
+ <div class="shop_ul_4 clearfix">
|
|
|
+ <NuxtLink :href="`/${item.pinyin}/${item.id}.html`" :title="item.title"
|
|
|
+ class="shop_li_4 clearfix dot1" v-for="(item, index) in newsData[2].data2" :key="index">
|
|
|
+ {{ item.alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 农产会展2 -->
|
|
|
+ <!-- 农产商机1 -->
|
|
|
+ <div class="shop_6_right clearfix">
|
|
|
+ <div class="shop_head_10 clearfix">
|
|
|
+ <NuxtLink :href="`/${newsData[3].aLIas_pinyin}/index.html`" class="shop_head_10_name">
|
|
|
+ {{ newsData[3].alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ <NuxtLink :href="`/${newsData[3].aLIas_pinyin}/index.html`" class="shop_head_10_more"
|
|
|
+ :title="newsData[3].title">
|
|
|
+ 栏目简介
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ <div class="shop_box_5 clearfix" v-if="newsData[3].data">
|
|
|
+ <div class="shop_img_ul_8 clearfix">
|
|
|
+ <div class="shop_img_li_8 clearfix" v-for="(item, index) in newsData[3].data" :key="index">
|
|
|
+ <NuxtLink class="shop_img_li_8_a" :href="`/${item.pinyin}/${item.id}.html`"
|
|
|
+ :title="item.title">
|
|
|
+ <img class="shop_img_li_8_img" :src="item.imgurl" title="" alt="">
|
|
|
+ <div class="shop_img_li_8_rgba clearfix dot1">
|
|
|
+ {{ item.alias }}
|
|
|
+ </div>
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="shop_box_6 clearfix" v-if="newsData[3].data2">
|
|
|
+ <div class="shop_ul_5 clearfix">
|
|
|
+ <div class="shop_li_5 clearfix" v-for="(item, index) in newsData[3].data2" :key="index">
|
|
|
+ <div class="shop_li_5_in clearfix">
|
|
|
+ <NuxtLink class="shop_li_5_a dot2" :href="`/${item.pinyin}/${item.id}.html`"
|
|
|
+ :title="item.title">
|
|
|
+ {{ item.alias }}
|
|
|
+ </NuxtLink>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 农产商机2 -->
|
|
|
+ </section>
|
|
|
+ <div class="banner_2 clearfix">
|
|
|
+ <a class="banner_2_a" href="" title=""><img class="banner_2_img" src="@/public/img/15.png" title=""
|
|
|
+ alt=""></a>
|
|
|
+ </div>
|
|
|
+ </main>
|
|
|
+ <HomeFoot></HomeFoot>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { NuxtLink } from '#components';
|
|
|
+import { ref } from 'vue'
|
|
|
+// import { ElRadio, ElRadioGroup } from 'element-plus'
|
|
|
+//1.获得路由id start ---------------------------------------->
|
|
|
+const targetSegment = getRoutePath(1);
|
|
|
+//1.1 获得当前的路由id
|
|
|
+let routeId;
|
|
|
+let categoryName;
|
|
|
+//通过导航路径反向查询导航id
|
|
|
+const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'pinyin': targetSegment,
|
|
|
+ },
|
|
|
+});
|
|
|
+if (getRouteId.code == 200) {
|
|
|
+ routeId = getRouteId.data.category_id
|
|
|
+ categoryName = getRouteId.data.alias
|
|
|
+} else {
|
|
|
+ console.log("获得路由id出错!", getRouteId.message)
|
|
|
+}
|
|
|
+//1.获得路由id end ---------------------------------------->
|
|
|
+
|
|
|
+//3.广告 start ---------------------------------------->
|
|
|
+let adImg1 = ref({})
|
|
|
+let adImg2 = ref({})
|
|
|
+let adImg3 = ref({})
|
|
|
+let adImg4 = ref({})
|
|
|
+onMounted(async () => {
|
|
|
+ //从客户端获取行政职能部门 加快打开速度
|
|
|
+ const { $webUrl, $CwebUrl } = useNuxtApp();
|
|
|
+ //广告1
|
|
|
+ let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_category_0001`
|
|
|
+ const responseAd1 = await fetch(url, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ 'Userurl': $CwebUrl,
|
|
|
+ 'Origin': $CwebUrl
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const resultAd1 = await responseAd1.json();
|
|
|
+ adImg1.value = resultAd1.data[0];
|
|
|
+
|
|
|
+ //广告2
|
|
|
+ let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_category_0002`
|
|
|
+ const responseAd2 = await fetch(url2, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ 'Userurl': $CwebUrl,
|
|
|
+ 'Origin': $CwebUrl
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const resultAd2 = await responseAd2.json();
|
|
|
+ adImg2.value = resultAd2.data[0];
|
|
|
+
|
|
|
+ //广告3
|
|
|
+ let url3 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_category_0003`
|
|
|
+ const responseAd3 = await fetch(url3, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ 'Userurl': $CwebUrl,
|
|
|
+ 'Origin': $CwebUrl
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const resultAd3 = await responseAd3.json();
|
|
|
+ adImg3.value = resultAd3.data[0];
|
|
|
+
|
|
|
+ //广告4
|
|
|
+ let url4 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_category_0004`
|
|
|
+ const responseAd4 = await fetch(url4, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ 'Userurl': $CwebUrl,
|
|
|
+ 'Origin': $CwebUrl
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const resultAd4 = await responseAd4.json();
|
|
|
+ adImg4.value = resultAd4.data[0];
|
|
|
+})
|
|
|
+//3.广告 end ---------------------------------------->
|
|
|
+
|
|
|
+//4.页面数据 start ---------------------------------------->
|
|
|
+const pageData = ref([
|
|
|
+ //示例:
|
|
|
+ // {
|
|
|
+ // id: 1,
|
|
|
+ // title: "", //该导航的标题
|
|
|
+ // data: [], //数据1
|
|
|
+ // data1: [], //数据2
|
|
|
+ // data2: [], //数据3
|
|
|
+ // data3: [], //数据4
|
|
|
+ // data4: [], //数据5
|
|
|
+ // category_id1: "", //子导航id1
|
|
|
+ // category_id2: "",
|
|
|
+ // category_id3: "",
|
|
|
+ // category_id4: "",
|
|
|
+ // title1: "", //子导航标题1
|
|
|
+ // title2: "",
|
|
|
+ // title3: "",
|
|
|
+ // title4: "",
|
|
|
+ // cid: "" //该导航的id
|
|
|
+ // },
|
|
|
+])
|
|
|
+const goodsData = ref([])
|
|
|
+const newsData = ref([])
|
|
|
+
|
|
|
+
|
|
|
+//4.1 获取所有导航
|
|
|
+try {
|
|
|
+ const navigateData = await requestDataPromise('/web/getWebsiteModelCategory', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'placeid': 1,
|
|
|
+ 'pid': routeId,
|
|
|
+ 'num': 8,
|
|
|
+ 'type': 1
|
|
|
+ },
|
|
|
+ });
|
|
|
+ console.log("导航池11111", navigateData);
|
|
|
+
|
|
|
+ if (navigateData.code == 200) {
|
|
|
+ // 遍历可用的导航池放到页面中
|
|
|
+ for (let index in navigateData.data) {
|
|
|
+ let data = {
|
|
|
+ title: navigateData.data[index].name,
|
|
|
+ cid: navigateData.data[index].category_id,
|
|
|
+ children_count: navigateData.data[index].children_count,
|
|
|
+ alias: navigateData.data[index].alias,
|
|
|
+ aLIas_pinyin: targetSegment + "/" + navigateData.data[index].aLIas_pinyin,
|
|
|
+ children: navigateData.data[index].children,
|
|
|
+ type: navigateData.data[index].type,
|
|
|
+ data: [],
|
|
|
+ data1: [],
|
|
|
+ data2: [],
|
|
|
+ data3: [],
|
|
|
+ data4: [],
|
|
|
+ category_id1: "",
|
|
|
+ category_id2: "",
|
|
|
+ category_id3: "",
|
|
|
+ category_id4: "",
|
|
|
+ title1: "",
|
|
|
+ title2: "",
|
|
|
+ title3: "",
|
|
|
+ title4: ""
|
|
|
+ };
|
|
|
+ if (navigateData.data[index].is_url == 1) {
|
|
|
+ // 处理 URL 的逻辑
|
|
|
+ } else {
|
|
|
+ if (navigateData.data[index].type == 2) {
|
|
|
+ goodsData.value.push(data);
|
|
|
+ } else if (navigateData.data[index].type == 1) {
|
|
|
+ newsData.value.push(data);
|
|
|
+ }
|
|
|
+ //每个页面最多8个模块
|
|
|
+ pageData.value.push(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("导航池11111122222", pageData.value);
|
|
|
+ console.log("导航池11111133333", goodsData.value);
|
|
|
+ console.log("导航池11111144444", newsData.value);
|
|
|
+
|
|
|
+ //导航池加载完毕,开始申请模块数据
|
|
|
+ let getJson = [
|
|
|
+ // { "parent": routeId + ",0,0", "child": newsData.value[0].cid + ",5,9" },//模块1
|
|
|
+ // { "parent": routeId + ",0,0", "child": newsData.value[1].cid + ",1,6" },//模块2
|
|
|
+ // { "parent": routeId + ",0,0", "child": newsData.value[2].cid + ",1,6" },//模块3
|
|
|
+ // { "parent": routeId + ",0,0", "child": newsData.value[3].cid + ",1,6" },//模块4
|
|
|
+ ]
|
|
|
+ for (let i = 0; i < newsData.value.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ getJson.push({ "parent": routeId + ",0,0", "child": newsData.value[0].cid + ",3,9" })
|
|
|
+ } else if (i == 1) {
|
|
|
+ getJson.push({ "parent": routeId + ",0,0", "child": newsData.value[1].cid + ",1,2" })
|
|
|
+ } else if (i == 2) {
|
|
|
+ getJson.push({ "parent": routeId + ",0,0", "child": newsData.value[2].cid + ",1,6" })
|
|
|
+ } else if (i == 3) {
|
|
|
+ getJson.push({ "parent": routeId + ",0,0", "child": newsData.value[3].cid + ",2,4" })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let jsonString = JSON.stringify(getJson);
|
|
|
+ getPageAllData(jsonString);
|
|
|
+
|
|
|
+ let goodsJson = [
|
|
|
+ // { "catid": goodsData.value[0].cid + ",0,12" },//模块1
|
|
|
+ // { "catid": goodsData.value[1].cid + ",0,4" },//模块2
|
|
|
+ // { "catid": goodsData.value[2].cid + ",0,4" },//模块3
|
|
|
+ ]
|
|
|
+ for (let i = 0; i < goodsData.value.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ goodsJson.push({ "catid": goodsData.value[0].cid + ",0,12" });
|
|
|
+ } else if (i == 1) {
|
|
|
+ goodsJson.push({ "catid": goodsData.value[1].cid + ",0,4" });
|
|
|
+ } else if (i == 2) {
|
|
|
+ goodsJson.push({ "catid": goodsData.value[2].cid + ",0,4" });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let goodsJsonString = JSON.stringify(goodsJson);
|
|
|
+ getPageGoodsAllData(goodsJsonString);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ console.log("错误:渲染8个模块环节出错,请检查是否存在没有数据的模块!")
|
|
|
+ }
|
|
|
+} catch (error) {
|
|
|
+ console.log("错误:导航池渲染执行接口出错!请检查频道页渲染的模块数据是否完整!")
|
|
|
+}
|
|
|
+// 获取商品数据 start--------------------------------------->
|
|
|
+async function getPageGoodsAllData(goodsJsonString) {
|
|
|
+ const mkdata = await requestDataPromise('/web/getWebsiteCatidshop', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'catid': goodsJsonString
|
|
|
+ },
|
|
|
+ });
|
|
|
+ console.log("获取商品数据", mkdata);
|
|
|
+
|
|
|
+ if (mkdata.code == 200) {
|
|
|
+ //模块1
|
|
|
+ for (let index in mkdata.data[0]) {
|
|
|
+ console.log("获取商品数据", index, mkdata.data[0][index]);
|
|
|
+ if (index < 4) {
|
|
|
+ goodsData.value[0].data.push(mkdata.data[0][index]);
|
|
|
+ } else {
|
|
|
+ goodsData.value[0].data1.push(mkdata.data[0][index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //模块2
|
|
|
+ goodsData.value[1].data = mkdata.data[1];
|
|
|
+ goodsData.value[2].data = mkdata.data[2];
|
|
|
+ console.log("获取商品数据111111", goodsData.value);
|
|
|
+ }
|
|
|
+}
|
|
|
+// 获取商品数据 end----------------------------------------->
|
|
|
+// 获取资讯数据 start----------------------------------------->
|
|
|
+async function getPageAllData(jsonString) {
|
|
|
+ const mkdata = await requestDataPromise('/web/getWebsiteAllArticle', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'id': jsonString
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // console.log("获取资讯数据11111111111", mkdata.data);
|
|
|
+
|
|
|
+ if (mkdata.code == 200) {
|
|
|
+ //模块1 顶部大图和列表
|
|
|
+ for (let index in mkdata.data[0].child.imgnum) {
|
|
|
+ if (index < 1) {
|
|
|
+ newsData.value[0].data.push(mkdata.data[0].child.imgnum[index]);
|
|
|
+ } else {
|
|
|
+ newsData.value[0].data1.push(mkdata.data[0].child.imgnum[index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newsData.value[0].data2 = mkdata.data[0].child.textnum;
|
|
|
+ //模块2
|
|
|
+ newsData.value[1].data = mkdata.data[1].child.imgnum;
|
|
|
+ newsData.value[1].data2 = mkdata.data[1].child.textnum;
|
|
|
+ //模块3
|
|
|
+ newsData.value[2].data = mkdata.data[2].child.imgnum;
|
|
|
+ newsData.value[2].data2 = mkdata.data[2].child.textnum;
|
|
|
+ //模块4
|
|
|
+ newsData.value[3].data = mkdata.data[3].child.imgnum;
|
|
|
+ newsData.value[3].data2 = mkdata.data[3].child.textnum;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ ElMessage.error(mkdata.message)
|
|
|
+ }
|
|
|
+}
|
|
|
+// 获取资讯数据 end----------------------------------------->
|
|
|
+//4.页面数据 end ---------------------------------------->
|
|
|
+
|
|
|
+//5.设置seo信息 start---------------------------------------->
|
|
|
+const setData = await requestDataPromise('/web/getWebsiteCategoryHead', {
|
|
|
+ method: 'GET',
|
|
|
+ query: {
|
|
|
+ 'catid': routeId
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+if (setData.code == 200) {
|
|
|
+ let seoTitle = setData.data.seo_title;
|
|
|
+ let seoDescription = setData.data.seo_description;
|
|
|
+ let seoKeywords = setData.data.seo_keywords;
|
|
|
+ let seoSuffix = setData.data.suffix;
|
|
|
+ let seoName = setData.data.website_name;
|
|
|
+
|
|
|
+ useSeoMeta({
|
|
|
+ title: seoTitle + "_" + seoSuffix,
|
|
|
+ meta: [
|
|
|
+ { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
|
|
|
+ { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+} else {
|
|
|
+ console.log("设置频道页SEO出错!", setData.message)
|
|
|
+}
|
|
|
+//5.设置seo信息 end---------------------------------------->
|
|
|
+
|
|
|
+
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+@import url("@/assets/css/shop/shopClass.less");
|
|
|
+</style>
|