Procházet zdrojové kódy

自助建站首页完成

自助建站首页完成
dangyunlong před 20 hodinami
rodič
revize
11fa47adc1

+ 21 - 19
components/template/sector/body/about/1200x1150/1.vue

@@ -41,37 +41,33 @@
 //0.页面依赖 start ---------------------------------------->
 import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
 import { ArrowRight } from '@element-plus/icons-vue'
+import type { INewsDetail, IBottomMenu } from '@/utils/dataInterface'
 //菜单
 import menu1Style from '@/components/template/component/menu/144x365/1.vue'
 import menu2Style from '@/components/template/component/menu/144x365/2.vue'
-//详情样式 详情只需要传入skinId
+//详情
 import mainStyle from '@/components/template/component/main/1200x1120/1.vue'
-
 interface Props {
-    templateData:any,//模板数据
-    skinId: number,//皮肤id
+    templateData:any,
+    skinId: number,
 }
-
 const props = defineProps<Props>();
 //0.页面依赖 end ---------------------------------------->
 
 //1.页面数据 start ---------------------------------------->
-//获得跳转过来的id
+//必备参数
 const route = useRoute();
-//获得当前的完整路径
-const fullPath = route.path;
-//拆分,取出来中间这一段,然后提取数字部分
-const segments = fullPath.split('/'); 
-const targetSegment = segments[2]; 
-//判断处于什么位置
-const routeLevel = ref(0);
+const fullPath:string = route.path;
+const segments:string[] = fullPath.split('/'); 
+const targetSegment:string = segments[2]; 
+//判断路由深度
+const routeLevel = ref<number>(0);
 if(route.name == 'about-dir-dir-id'){
     routeLevel.value = 1;
 }
-
 let articleId:number;
 let pageId:number;
-//通过导航路径反向查询导航id
+//反向查询导航id
 const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
     method: 'GET',
     query: {
@@ -82,10 +78,14 @@ if(getRouteId.code == 200){
     articleId = getRouteId.data.id;
     pageId = getRouteId.data.id;
 }
-const newsDetail = ref<any>({})
-const bottomMenu = ref([]);
+//中央招聘详情
+const newsDetail = ref<INewsDetail>({
+    con_title:"",
+    content:"",
+    type_id:0
+})
 async function getPageData() {
-    const mkdata =  await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
+    const mkdata:any = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
         method: 'GET',
         query: {
             'fcat_id': articleId,
@@ -95,8 +95,10 @@ async function getPageData() {
     newsDetail.value = mkdata.data;
 }
 getPageData();
+//左侧悬浮菜单
+const bottomMenu = ref<IBottomMenu[]>([]);
 async function getPageMenu() {
-    const mkdata =  await requestDataPromise('/web/getWebsiteFooterCategory', {
+    const mkdata:any = await requestDataPromise('/web/getWebsiteFooterCategory', {
         method: 'GET',
         query: {},
     });

+ 5 - 11
components/template/sector/body/index/banner/1200x410/1.vue

@@ -2,29 +2,23 @@
     <div class="bannerBigBox">
         <div class="bannerLayerBox">
             <swiperStyle1 
-                v-if="templateData.componentList[0].data.img.length > 0" 
                 :skinId="skinId" 
-                :templateData="templateData.componentList[0].data.img" 
+                :templateData="templateData[0].componentData.data.imgnum" 
             />
-            <nodata v-else :dataStyle="1" :dataWidth="720" :dataHeight="405" />
         </div>
         <!--新闻列表-->
         <div class="NewsListBox">
-            <div v-if="templateData.componentList[0].component_style.toString()=='1'">
+            <div v-if="templateData[0].component_style.toString()=='1'">
                 <listStyle1
-                    v-if="templateData.componentList[0].data.text.length > 0" 
                     :skinId="skinId" 
-                    :templateData="templateData.componentList[0].data.text" 
+                    :templateData="templateData[0].componentData.data.textnum" 
                 />
-                <nodata v-else :dataStyle="1" :dataWidth="720" :dataHeight="405" />
             </div>
-            <div v-if="templateData.componentList[0].component_style.toString()=='2'">
+            <div v-if="templateData[0].component_style.toString()=='2'">
                 <listStyle2
-                    v-if="templateData.componentList[0].data.text.length > 0" 
                     :skinId="skinId" 
-                    :templateData="templateData.componentList[0].data.text" 
+                    :templateData="templateData[0].componentData.data.textnum" 
                 />
-                <nodata v-else :dataStyle="1" :dataWidth="720" :dataHeight="405" />
             </div>
         </div>
     </div>

+ 4 - 8
components/template/sector/body/index/headLine/1200x140/1.vue

@@ -1,22 +1,18 @@
 <template>
     <div class="headLineBigBox">
         <!--板式1-->
-        <div v-if="templateData.componentList[0].component_style.toString()=='1'">
+        <div v-if="templateData[0].component_style.toString()=='1'">
             <style1 
-                v-if="templateData.componentList[0].data.text.length > 0" 
-                :templateData="templateData.componentList[0].data.text" 
+                :templateData="templateData[0].componentData.data.textnum" 
                 :skinId="skinId"
             />
-            <nodata v-else :dataStyle="2" :dataWidth="1200" :dataHeight="140" />
         </div>
         <!--板式2-->
-        <div v-if="templateData.componentList[0].component_style.toString()=='2'">
+        <div v-if="templateData[0].component_style.toString()=='2'">
             <style2
-                v-if="templateData.componentList[0].data.text.length > 0" 
-                :templateData="templateData.componentList[0].data.text" 
+                :templateData="templateData[0].componentData.data.textnum" 
                 :skinId="skinId"
             />
-            <nodata v-else :dataStyle="2" :dataWidth="1200" :dataHeight="140" />
         </div>
     </div>
 </template>

+ 2 - 2
components/template/sector/body/index/list/1200x470/1.vue

@@ -2,14 +2,14 @@
     <div class="manyPictureSectorBox">
         <div class="manyPictureSector">
             <div class="manyPictureSectorLeft">
-                <div v-if="templateData[0].component_style.toString()=='2'">
+                <div v-if="templateData[0].component_style.toString()=='1'">
                     <left1Style 
                         :titleLink="componentTitle1" 
                         :templateData="templateData[0].componentData.data"
                         :skinId="skinId"
                     />
                 </div>
-                <div v-if="templateData[0].component_style.toString()=='1'">
+                <div v-if="templateData[0].component_style.toString()=='2'">
                     <left2Style 
                         :titleLink="componentTitle1" 
                         :templateData="templateData[0].componentData.data" 

+ 6 - 5
pages/index.vue

@@ -20,13 +20,13 @@
             <templateAd :skinId="skinId" :adData="adData" :adTag="item.ad.ad_tag"></templateAd>
         </div>
         <!--2.头条通栏 data返回值错误 没有依照level字段返回 而是返回了政策法规-->
-        <!-- <div v-if="item.sectorName=='headLineSector'">
+        <div v-if="item.sectorName=='headLineSector'">
             <templateHeadline :skinId="skinId" :templateData="item.componentList"></templateHeadline>
-        </div> -->
+        </div>
         <!--3.轮播图通栏 data返回值错误 没有依照level字段返回 而是返回了政策法规-->
-        <!-- <div v-if="item.sectorName=='bannerSector'">
-            <templateHeadline :skinId="skinId" :templateData="item.componentList"></templateHeadline>
-        </div> -->
+        <div v-if="item.sectorName=='bannerSector'">
+            <templateBanner :skinId="skinId" :templateData="item.componentList"></templateBanner>
+        </div>
         <!--4.静态外链通栏-->
         <div v-if="item.sectorName=='linkSector'">
             <templateStaticLink :skinId="skinId"></templateStaticLink>
@@ -156,6 +156,7 @@ const response = await requestDataPromise('/client/indexData', {
         'getpage':'index'
     },
 });
+console.log(response)
 const templateData = response.data.template.index;
 console.log(templateData)
 //2.页面数据 end---------------------------------------->

+ 3 - 3
plugins/globals.sever.js

@@ -5,10 +5,10 @@ export default defineNuxtPlugin((nuxtApp) => {
     //console.log("当前运行的域名:" + currentDomain)
     
     //农民网Pre环境
-    nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
+    nuxtApp.provide('webUrl', 'https://apipre1.bjzxtw.org.cn')
     nuxtApp.provide('CwebUrl', currentDomain)
-    nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
-    nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
+    nuxtApp.provide('BwebUrl', 'https://adminpre.bjzxtw.org.cn')
+    nuxtApp.provide('LoginWebUrl', 'https://adminpre.bjzxtw.org.cn/adminapi')
     nuxtApp.provide('userUrl', 'http://localhost:3002')
 
     //农民网正式环境

+ 22 - 76
utils/dataInterface.ts

@@ -1,81 +1,27 @@
 //自助建站接口契约
 
-//文字新闻
-export interface textnum {
-    id: number;
-    catid: number;
-    title: string;
-    introduce: string;
-    tag: string;
-    keyword: string;
-    author: string;
-    copyfrom: string;
-    fromurl: string;
-    hits: number;
-    ip: string;
-    status: number;
-    islink: number;
-    linkurl: string;
-    imgurl: string;
-    admin_user_id: number;
-    cat_arr_id: string;
-    created_at: string;
-    updated_at: string;
-    is_original: number;
-    survey_id: string;
-    survey_name: string;
-    is_survey: number;
-    survey_type: number;
-    web_site_id: string;
-    ignore_ids: number | null;
-    reason: string | null;
-    department_arr_id: string;
-    department_id: number;
-    city_arr_id: string;
-    city_id: number;
-    level: string;
-    commend_id: string;
-    level_text: string;
-    pinyin: string;
+//单页-详情
+export interface INewsDetail {
+    id?:number;
+    list_title?:string;
+    con_title:string;
+    content:string;
+    fcat_id?:number;
+    created_at?:string;
+    updated_at?:string;
+    type_id:number;
 }
 
-//图片新闻
-export interface imgnum {
-    id: number;
-    catid: number;
-    title: string;
-    introduce: string;
-    tag: string;
-    keyword: string;
-    author: string;
-    copyfrom: string;
-    fromurl: string;
-    hits: number;
-    ip: string;
-    status: number;
-    islink: number;
-    linkurl: string;
-    imgurl: string;
-    admin_user_id: number;
-    cat_arr_id: string;
-    created_at: string;
-    updated_at: string;
-    is_original: number;
-    survey_id: string;
-    survey_name: string;
-    is_survey: number;
-    survey_type: number;
-    web_site_id: string;
-    ignore_ids: number | null;
-    reason: string | null;
-    department_arr_id: string;
-    department_id: number;
-    city_arr_id: string;
-    city_id: number;
-    level: string;
-    commend_id: string;
-    level_text: string;
-    article_id: number | null;
-    website_id: number | null;
-    pinyin: string;
+//左侧悬浮菜单
+export interface IBottomMenu {
+    id:number;
+    name:string;
+    website_id:number;
+    type:number;
+    created_at:string;
+    updated_at:string;
+    name_pinyin:string;
+    pid:number;
 }
+
+