|
@@ -4,16 +4,6 @@
|
|
<!-- 菜单 -->
|
|
<!-- 菜单 -->
|
|
<templateMenu></templateMenu>
|
|
<templateMenu></templateMenu>
|
|
<!-- 内容 -->
|
|
<!-- 内容 -->
|
|
- <!-- <div>
|
|
|
|
- <templateHeadline :skinId="skinId" :templateData="testTemplateData"></templateHeadline>
|
|
|
|
- <templateBanner :skinId="skinId" :templateData="testTemplateData"></templateBanner>
|
|
|
|
- <templateAd :adTag="'bbzxw_index_1'" :skinId="skinId" :adData="adData"></templateAd>
|
|
|
|
- <templateStaticLink :skinId="skinId" :templateData="testTemplateData2"></templateStaticLink>
|
|
|
|
- <templateNewSector1 :skinId="skinId" :templateData="testTemplateData"></templateNewSector1>
|
|
|
|
- <templateNewSector2 :skinId="skinId" :templateData="testTemplateData"></templateNewSector2>
|
|
|
|
- <templateNewSector3 :skinId="skinId" :templateData="testTemplateData"></templateNewSector3>
|
|
|
|
- <templateNewAndAd :skinId="skinId" :templateData="testTemplateData" :adData="adData" :adTag="'bbzxw_index_9'"></templateNewAndAd>
|
|
|
|
- </div> -->
|
|
|
|
<div v-for="(item,index) in templateData" :key="index">
|
|
<div v-for="(item,index) in templateData" :key="index">
|
|
<!--1.广告通栏-->
|
|
<!--1.广告通栏-->
|
|
<div v-if="item.sectorName=='adSector'">
|
|
<div v-if="item.sectorName=='adSector'">
|
|
@@ -52,7 +42,8 @@
|
|
<templateFoot></templateFoot>
|
|
<templateFoot></templateFoot>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
|
|
|
+<script setup lang="ts">
|
|
|
|
+import type { IWebSiteBase } from '@/utils/dataInterface'
|
|
//0.加载全局模板组件 start---------------------------------------->
|
|
//0.加载全局模板组件 start---------------------------------------->
|
|
//0.1 全局通栏
|
|
//0.1 全局通栏
|
|
import templateHead from '@/components/template/sector/head/1200x200/1.vue'
|
|
import templateHead from '@/components/template/sector/head/1200x200/1.vue'
|
|
@@ -75,67 +66,85 @@ import templateNewSector2 from '@/components/template/sector/body/index/list/120
|
|
import templateNewSector3 from '@/components/template/sector/body/index/list/1200x980/1.vue'
|
|
import templateNewSector3 from '@/components/template/sector/body/index/list/1200x980/1.vue'
|
|
//0.2.8 图文与广告组合
|
|
//0.2.8 图文与广告组合
|
|
import templateNewAndAd from '@/components/template/sector/body/index/list/1200x480/1.vue'
|
|
import templateNewAndAd from '@/components/template/sector/body/index/list/1200x480/1.vue'
|
|
-//0.加载全局模板组件 end---------------------------------------->
|
|
|
|
|
|
+// //0.加载全局模板组件 end---------------------------------------->
|
|
|
|
|
|
//1.获得基本信息单元 start---------------------------------------->
|
|
//1.获得基本信息单元 start---------------------------------------->
|
|
//1.1获得页面依赖
|
|
//1.1获得页面依赖
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
//1.2获得pinia源
|
|
//1.2获得pinia源
|
|
import { useTemplateBaseStore } from '@/stores/templateBase'
|
|
import { useTemplateBaseStore } from '@/stores/templateBase'
|
|
-const templateBaseStore = useTemplateBaseStore()
|
|
|
|
|
|
+const templateBaseStore:any = useTemplateBaseStore()
|
|
//1.3获得该页的皮肤id - 在每个组件中也是同样的获得方法
|
|
//1.3获得该页的皮肤id - 在每个组件中也是同样的获得方法
|
|
-const skinId = ref("")
|
|
|
|
-const websiteId = ref("")
|
|
|
|
|
|
+const skinId = ref<number>(0)
|
|
|
|
+const websiteId = ref<number>(0)
|
|
//1.4获得站点基本信息
|
|
//1.4获得站点基本信息
|
|
-const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
|
|
|
|
- method: 'GET',
|
|
|
|
- query: {
|
|
|
|
- 'link_textnum':24,
|
|
|
|
- 'link_imgnum':18,
|
|
|
|
- 'link_footnum':4
|
|
|
|
- },
|
|
|
|
-});
|
|
|
|
-if (responseStatus.code == 200) {
|
|
|
|
- //0.3.1设置站点基本信息
|
|
|
|
- templateBaseStore.setWebSiteInfo(responseStatus.data)
|
|
|
|
- websiteId.value = responseStatus.data.website_head.id;//获得网站id
|
|
|
|
- //0.3.2设置皮肤id
|
|
|
|
- skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
|
|
|
|
- console.log("当前的网站id:"+responseStatus.data.website_head.id)
|
|
|
|
- //0.3.3设置seo信息
|
|
|
|
- let seoTitle = templateBaseStore.webSiteInfo.website_head.title;
|
|
|
|
- let seoDescription = templateBaseStore.webSiteInfo.website_head.description;
|
|
|
|
- let seoKeywords = templateBaseStore.webSiteInfo.website_head.keywords;
|
|
|
|
- let seoSuffix = templateBaseStore.webSiteInfo.website_head.suffix;
|
|
|
|
- let seoName = templateBaseStore.webSiteInfo.website_head.website_name;
|
|
|
|
- useSeoMeta({
|
|
|
|
- title: seoTitle + "_" + seoSuffix,
|
|
|
|
- meta: [
|
|
|
|
- { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
|
|
|
|
- { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
|
|
|
|
- ]
|
|
|
|
|
|
+try {
|
|
|
|
+ const responseStatus:any = await requestDataPromise('/web/getWebsiteAllinfo', {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ query: {
|
|
|
|
+ 'link_textnum':24,
|
|
|
|
+ 'link_imgnum':18,
|
|
|
|
+ 'link_footnum':4
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
+ if (responseStatus.code == 200) {
|
|
|
|
+ //0.3.1设置站点基本信息
|
|
|
|
+ templateBaseStore.setWebSiteInfo(responseStatus.data as IWebSiteBase)
|
|
|
|
+ websiteId.value = responseStatus.data.website_head.id;//获得网站id
|
|
|
|
+ //0.3.2设置皮肤id
|
|
|
|
+ skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
|
|
|
|
+ console.log("当前的网站id:"+responseStatus.data.website_head.id)
|
|
|
|
+ //0.3.3设置seo信息
|
|
|
|
+ let seoTitle = templateBaseStore.webSiteInfo.website_head.title;
|
|
|
|
+ let seoDescription = templateBaseStore.webSiteInfo.website_head.description;
|
|
|
|
+ let seoKeywords = templateBaseStore.webSiteInfo.website_head.keywords;
|
|
|
|
+ let seoSuffix = templateBaseStore.webSiteInfo.website_head.suffix;
|
|
|
|
+ let seoName = templateBaseStore.webSiteInfo.website_head.website_name;
|
|
|
|
+ useHead({
|
|
|
|
+ title: seoTitle + "_" + seoSuffix,
|
|
|
|
+ meta: [
|
|
|
|
+ { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
|
|
|
|
+ { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
|
|
|
|
+ ]
|
|
|
|
+ });
|
|
|
|
+ }else if(responseStatus.code == 0){
|
|
|
|
+ navigateTo('/404?findPage=index')
|
|
|
|
+ }
|
|
|
|
+} catch (error) {
|
|
|
|
+ navigateTo('/404?findPage=index')
|
|
}
|
|
}
|
|
//1.获得基本信息单元 end---------------------------------------->
|
|
//1.获得基本信息单元 end---------------------------------------->
|
|
|
|
|
|
//2.页面数据 start---------------------------------------->
|
|
//2.页面数据 start---------------------------------------->
|
|
//2.1获得页面数据
|
|
//2.1获得页面数据
|
|
-const response = await requestDataPromise('/client/indexData', {
|
|
|
|
- method: 'POST',
|
|
|
|
- body: {
|
|
|
|
- 'website_id':websiteId.value,
|
|
|
|
- 'getpage':'index'
|
|
|
|
- },
|
|
|
|
-});
|
|
|
|
-//页面数据
|
|
|
|
-const templateData = response.data.template.index;
|
|
|
|
-//广告数据
|
|
|
|
-const adData = ref([]);
|
|
|
|
-adData.value.push(response.data.ad.top)
|
|
|
|
-for(let item of response.data.ad.index){
|
|
|
|
- adData.value.push(item)
|
|
|
|
|
|
+const templateData = ref<any[]>([])
|
|
|
|
+const adData = ref<any[]>([]);
|
|
|
|
+try {
|
|
|
|
+ const response = await requestDataPromise('/client/indexData', {
|
|
|
|
+ method: 'POST',
|
|
|
|
+ body: {
|
|
|
|
+ 'website_id':websiteId.value,
|
|
|
|
+ 'getpage':'index'
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ console.log(response)
|
|
|
|
+ if(response.code == 200){
|
|
|
|
+ //页面数据
|
|
|
|
+ templateData.value = response.data.template.index;
|
|
|
|
+ //广告数据
|
|
|
|
+ adData.value.push(response.data.ad.top)
|
|
|
|
+ for(let item of response.data.ad.index){
|
|
|
|
+ adData.value.push(item)
|
|
|
|
+ }
|
|
|
|
+ templateBaseStore.setAdList(adData.value)
|
|
|
|
+ }else if(response.code == 0){
|
|
|
|
+ //第一种情况,code为0 跳转到404
|
|
|
|
+ navigateTo('/404?findPage=index')
|
|
|
|
+ }
|
|
|
|
+}catch (error) {
|
|
|
|
+ //第二种情况,服务器无响应 跳转到404
|
|
|
|
+ navigateTo('/404?findPage=index')
|
|
}
|
|
}
|
|
-templateBaseStore.setAdList(adData.value)
|
|
|
|
//2.页面数据 end---------------------------------------->
|
|
//2.页面数据 end---------------------------------------->
|
|
</script>
|
|
</script>
|
|
|
|
|