Bladeren bron

完成pinia的接入

完成pinia的接入
dangyunlong 1 dag geleden
bovenliggende
commit
079652286e

+ 0 - 3
assets/css/index.less

@@ -1,6 +1,3 @@
-
-
-
 //第一部分
 .part1 {
     width: 100%;

+ 11 - 11
assets/css/public/head.less

@@ -53,7 +53,7 @@
 /* 页面头部 */
 header {
     width: 100%;
-    height: 180px;
+    height: 200px;
     font-size: 12px;
     font-family: PingFang SC-Regular;
     color: #666666;
@@ -62,8 +62,8 @@ header {
 
 .headerNav {
     width: 100%;
-    height: 33px;
-    line-height: 33px;
+    height: 30px;
+    line-height: 30px;
 }
 
 .headerNav .left>span {
@@ -106,7 +106,7 @@ header {
         display: flex;
         align-items: center;
         justify-content: center;
-        height: 33px;
+        height: 30px;
 
         img {
             margin-right: 5px;
@@ -149,16 +149,13 @@ header {
 
 /* // 头部logo */
 .headerLogo {
-    height: 145px;
+    height: 170px;
     position: relative;
+    box-sizing: border-box;
     //background: url("../../public/head/topBg.png") no-repeat center;
     .titlead {
-        position: absolute;
-        bottom: 14px;
-        right: 26px;
         width: 830px;
         height: 110px;
-        overflow: hidden;
         a {
             display: block;
             width: 830px;
@@ -172,12 +169,15 @@ header {
     }
     .inner {
         position: relative;
-        height: 145px;
+        height: 170px;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        box-sizing: border-box;        
     }
     .inner>img {
         width: 297px;
         height: 110px;
-        margin-top: 20px;
         cursor: pointer;
     }
 

+ 137 - 199
assets/css/public/nav.less

@@ -1,230 +1,168 @@
-// 导航部分
-.partOne {
+/*导航风格1*/
+.menuStyle1 {
     width: 100%;
-    height: 60px;
-    line-height: 60px;
-    background-color: #dd7d18;
-    font-size: 20px;
-    font-family: PingFang SC-Semibold;
-
-    .inner {
+    height: 130px;
+    background: #1C5468;
+    .componentBorder {
+        border-left: 2px dashed #999;
+        border-right: 2px dashed #999;
+    }
+    .menuBoxBg {
         width: 1200px;
-        height: 60px;
+        height: 130px;
+        background: #1C5468;
         margin: 0 auto;
-        position: relative;
-
-        .home {
-            width: 120px;
-            height: 68px;
-            line-height: 68px;
-            font-family: Microsoft YaHei, Microsoft YaHei;
-            font-weight: bold;
-            font-size: 20px;
-            letter-spacing: 2px;
-            text-align: center;
-            color: #fff;
-            background-color: #d2600f;
-            position: absolute;
-            top: -8px;
-            left: 0;
-            z-index: 100;
-
-            em {
-                display: inline-block;
-                width: 0;
-                height: 0;
-                border-top: 4px solid transparent;
-                border-left: 8px solid transparent;
-                border-bottom: 4px solid #803804;
-                border-right: 8px solid #803804;
-                position: absolute;
-                top: 0px;
-                left: -16px;
-
-            }
-
-            a {
-                color: #fff;
-            }
-
-        }
-
-        .partOneTitle {
-            width: 1050px;
-            height: 60px;
-            position: absolute;
-            top: 0;
-            left: 150px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        .menuBox {
+            box-sizing: border-box;
             display: flex;
-            justify-content: space-between;
-
-            .titleList1 {
-                font-family: Microsoft YaHei, Microsoft YaHei;
-                font-weight: bold;
-                font-size: 16px;
-                color: #FFFFFF;
-
-                a {
-                    color: #fff;
+            flex-wrap: wrap;
+            justify-content: flex-start;
+            width: 100%;
+            div {
+                width: 12.5%;
+                cursor: pointer;
+                box-sizing: border-box;
+                font-size: 14px;
+                height: 22px;
+                line-height: 22px;
+                text-align: center;
+                overflow: hidden;
+                white-space: nowrap;
+                text-overflow: ellipsis;
+                text-align: center;
+                color: #fff;
+                background: #1C5468;
+                border-right: #002D41 1px solid;
+                border-left: #29799D 1px solid;
+                margin-bottom: 15px;
+                /* 当是第17个及以后的div时去掉margin-bottom */
+                &:nth-child(n+17) {
+                    margin-bottom: 0;
+                }
+                /* 每行的第一个(第1、9、17...个)去掉左边框 */
+                &:nth-child(8n+1) {
+                    border-left: none;
+                }
+                /* 每行的最后一个(第8、16、24...个)去掉右边框 */
+                &:nth-child(8n) {
+                    border-right: none;
+                }
+                /* 最后一行的最后一个(如果总数不是8的倍数)去掉右边框 */
+                &:last-child {
+                    border-right: none;
                 }
-            }
-
-            .titleList111 {
-                font-family: Microsoft YaHei, Microsoft YaHei;
-                font-weight: 400;
-                font-size: 16px;
-                color: #FFFFFF;
-
                 a {
                     color: #fff;
                 }
             }
-
-            .titleList111:hover {
-                font-weight: 600;
+        }
+    }
+    .menuSectorInputBox {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        font-size: 14px;
+        width: 80%;
+        margin: 0 auto;
+        border-top: none;
+        height: 50px;
+        .menuSectorInputBoxItem {
+            padding: 0 10px;
+            input {
+                margin-right: 10px;
+            }
+            .el-select {
+                margin-right: 10px;
             }
         }
     }
-
-
-
+    .componentMenuBorder {
+        border: 2px dashed #999;
+    }
 }
 
-.partTwo {
+/*导航风格2*/
+.menuStyle2 {
     width: 100%;
-    height: 133px;
-    box-shadow: 0px 7px 14px 0px rgba(0, 0, 0, 0.1);
-    // margin-bottom: 50px;
-
-    .inner {
+    height: 130px;
+    background: #A91B33;
+    .componentBorder {
+        border-left: 2px dashed #999;
+        border-right: 2px dashed #999;
+    }
+    .menuBoxBg {
         width: 1200px;
-        height: 133px;
-        line-height: 60px;
-        padding-top: 5px;
+        height: 130px;
+        background: #A91B33;
+        margin: 0 auto;
         display: flex;
-        justify-content: space-between;
-
-        .navleft {
-            width: 100px;
-            text-align: center;
-            font-family: Microsoft YaHei, Microsoft YaHei;
-            font-weight: bold;
-            font-size: 16px;
-            color: #333333;
-        }
-
-        .navlist {
-            width: 1000px;
-            height: 65px;
-            font-family: Microsoft YaHei, Microsoft YaHei;
-            font-weight: 400;
-            font-size: 16px;
-            color: #333333;
-            /*display: flex;
-            justify-content: space-between;
-            flex-wrap: wrap;*/
-
-            .navListItem {
-                float: left;
-                width: 97px;
+        align-items: center;
+        justify-content: center;
+        .menuBox {
+            box-sizing: border-box;
+            display: flex;
+            flex-wrap: wrap;
+            justify-content: flex-start;
+            width: 100%;
+            div {
+                width: 12.5%;
+                cursor: pointer;
+                box-sizing: border-box;
+                font-size: 14px;
+                height: 22px;
+                line-height: 22px;
                 text-align: center;
-                font-family: Microsoft YaHei, Microsoft YaHei;
-                font-weight: 400;
-                font-size: 16px;
-                color: #333333;
-
-                a {
-                    color: #333333;
+                overflow: hidden;
+                white-space: nowrap;
+                text-overflow: ellipsis;
+                text-align: center;
+                color: #fff;
+                background: #A91B33;
+                border-right: #88172A 1px solid;
+                border-left: #DE3350 1px solid;
+                margin-bottom: 15px;
+                /* 当是第17个及以后的div时去掉margin-bottom */
+                &:nth-child(n+17) {
+                    margin-bottom: 0;
                 }
-            }
-
-            .navListItem:hover {
-                a {
-                    color: #e39543;
+                /* 每行的第一个(第1、9、17...个)去掉左边框 */
+                &:nth-child(8n+1) {
+                    border-left: none;
                 }
-            }
-        }
-
-        .navright {
-            margin-left: 20px;
-            width: 115px;
-            height: 75px;
-            font-size: 16px;
-            margin-top: 25px;
-            background: url(https://img.bjzxtw.org.cn/master/www/nmw/img/nav_bg.png) no-repeat;
-
-            .nav111 {
-                width: 98px;
-                height: 30px;
-                line-height: 44px;
-                text-align: center;
-                font-family: Microsoft YaHei, Microsoft YaHei;
-                font-weight: bold;
-                font-size: 16px;
-
-                a {
-                    font-weight: bold;
-                    background: linear-gradient(to bottom, #FFF6B1 0%, #F5BC38 100%);
-                    -webkit-background-clip: text;
-                    color: transparent;
+                /* 每行的最后一个(第8、16、24...个)去掉右边框 */
+                &:nth-child(8n) {
+                    border-right: none;
+                }
+                /* 最后一行的最后一个(如果总数不是8的倍数)去掉右边框 */
+                &:last-child {
+                    border-right: none;
                 }
-
             }
         }
     }
-}
-
-//小导航
-.littleNav {
-    width: 100%;
-    height: 88px;
-    margin-top: 30px;
-
-    .inner {
-        width: 1200px;
-        height: 88px;
-        line-height: 88px;
-        margin: 0 auto;
+    .menuSectorInputBox {
         display: flex;
-        border: 1px solid #D3D5D8;
-        background-color: #fafafa;
-
-        img {
-            width: 138px;
-            height: 38px;
-            margin-top: 22px;
-            margin-left: 25px;
-        }
-
-        .leftPart {
-            margin-left: 40px;
-            margin-right: 10px;
-        }
-
-        .leftPart,
-        .rightPart {
-            width: 470px;
-            height: 78px;
-            margin-top: 5px;
-            display: flex;
-            align-items: center;
-            justify-content: space-between;
+        align-items: center;
+        justify-content: space-between;
+        font-size: 14px;
+        width: 80%;
+        margin: 0 auto;
+        border-top: none;
+        height: 50px;
+        .menuSectorInputBoxItem {
             padding: 0 10px;
-            border-bottom: 3px solid #A01C0E;
-
-            .navList {
-                a {
-                    font-family: Microsoft YaHei, Microsoft YaHei;
-                    font-weight: bold;
-                    font-size: 16px;
-                    color: #333333;
-                    line-height: 19px;
-                }
+            input {
+                margin-right: 10px;
             }
-
-            .navList:hover a {
-                color: #A01C0E;
+            .el-select {
+                margin-right: 10px;
             }
         }
     }
+    .componentMenuBorder {
+        border: 2px dashed #999;
+    }
 }

+ 8 - 29
components/home/foot.vue

@@ -12,7 +12,6 @@
             </div>
         </div>
     </footer>
-
     <div class="call_us_box">
         <div class="inner">
             <span v-for="(item, index) in bottomMenu" :key="index">
@@ -54,13 +53,14 @@
                 <img :src="item.logo_url" :alt="item.title">
             </a>
         </div>
-
         <!--在线客服-->
         <HomeKefu :bottomBase="bottomBase" />
     </footer>
 </template>
  
 <script setup>
+import { useTemplateBaseStore } from '@/stores/templateBase'
+const templateBaseStore = useTemplateBaseStore()
 //获得底部基本信息 start---------------------------------------->
 //1.获得全部友情链接与底部图片
 const bottomLink = ref([])
@@ -68,35 +68,14 @@ const bottomText = ref([])
 const bottomphoto = ref([])
 const bottomMenu = ref([])
 const bottomBase = ref({})
-
-async function getModelDataAll() {
-    const mkdata =  await requestDataPromise('/web/getWebsiteFootAll', {
-        method: 'GET',
-        query: {
-            'link_textnum':24,
-            'link_imgnum':18,
-            'link_footnum':4
-        },
-    });
-    if(mkdata.code == 200){
-        bottomLink.value = mkdata.data.link_img;
-        bottomText.value = mkdata.data.link_text;
-        bottomphoto.value = mkdata.data.link_foot;
-        bottomMenu.value = mkdata.data.foot_cate;
-        bottomBase.value = mkdata.data.foot_info;
-        
-
-    }else{
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-        console.log("错误位置:获取友情链接图片")
-        console.log("后端错误反馈:",mkdata.message)
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-    }
+if(templateBaseStore.webSiteInfo.website_foot){
+    bottomLink.value = templateBaseStore.webSiteInfo.website_foot.link_img;
+    bottomText.value = templateBaseStore.webSiteInfo.website_foot.link_text;
+    bottomphoto.value = templateBaseStore.webSiteInfo.website_foot.link_foot;
+    bottomMenu.value = templateBaseStore.webSiteInfo.website_foot.foot_cate;
+    bottomBase.value = templateBaseStore.webSiteInfo.website_foot.foot_info;
 }
-getModelDataAll();
-//获得底部基本信息 end---------------------------------------->
 </script>
-
 <style lang="less" scoped>
     @import '@/assets/css/public/footer.less';
     @import '@/assets/css/public/kefu.less';

+ 45 - 71
components/home/pageHead.vue

@@ -2,35 +2,17 @@
     <header>
         <nav class="headerNav">
             <div class="inner">
-                <div class="left">
-                    <span class="znxy">
-                        <a href="http://znxyw.org.cn/" target="_blank">中农兴业网团 {{ templateBaseStore.webSiteName }}</a>
-                    </span>
-                    <span>旗下网站 · 农业百强网站(科教文化类十强)</span>
-                </div>
+                <div class="left">你好,欢迎来到{{webSiteName}}!</div>
                 <div class="right">
                     <div class="menu">
-                        <button class="reg" @click="goTopic">
-                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon1.png" alt="商圈">商圈
-                        </button>
-                        <button class="reg" @click="goAdvertising">
-                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon2.png" alt="广告服务">广告服务
-                        </button>
+                        <button class="reg" @click="goTopic"><img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon1.png">商圈</button>
+                        <button class="reg" @click="goAdvertising"><img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon2.png">广告服务</button>
                     </div>
                     <div class="right-top-menu">
-                        <button class="reg" @click="goLogin" v-show="!showToken">
-                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon3.png" alt="登录">登录
-                        </button>
-                        <button class="reg" @click="goRegister" v-show="!showToken">
-                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon4.png" alt="注册">注册
-                        </button>
-                        <button class="reg" @click="userCenter" v-show="showToken">
-                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon3.png" alt="用户信息">{{
-                                username }}
-                        </button>
-                        <button class="reg" @click="goSearch">
-                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/searchicon.png" alt="搜索">搜索
-                        </button>
+                        <button class="reg" @click="goLogin" v-show="!showToken"><img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon3.png">登录</button>
+                        <button class="reg" @click="goRegister" v-show="!showToken"><img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon4.png">注册</button>
+                        <button class="reg" @click="userCenter" v-show="showToken"><img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon3.png">{{username}}</button>
+                        <button class="reg" @click="goSearch"><img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/searchicon.png">搜索</button>
                     </div>
                     <ul class="userInfo11" v-if="isShow">
                         <li @click="gotosystem">个人中心</li>
@@ -43,21 +25,14 @@
             <div class="inner">
                 <img :src="logo" :alt="webSiteName" class="left" @click="backHome">
                 <div class="titlead" v-if="adImg">
-                    <a href="http://sannongdy.org.cn/" v-if="adImg.image_url == null" target="_blank"
-                        :title="adImg.introduce">
-                        <img :src="adImg.thumb" :alt="adImg.introduce" data-tag="imgurl.ad_tag" :id="adImg.ad_tag">
-                    </a>
-                    <a :href="adImg.image_url" v-else :title="adImg.introduce">
-                        <img :src="adImg.image_src" :alt="adImg.introduce" data-tag="imgurl.ad_tag" :id="adImg.ad_tag">
-                    </a>
+                    <a href="http://sannongdy.org.cn/" v-if="adImg.image_url == null" target="_blank" :title="adImg.introduce"><img :src="adImg.thumb" :alt="adImg.introduce" data-tag="imgurl.ad_tag" :id="adImg.ad_tag"></a>
+                    <a :href="adImg.image_url" v-else :title="adImg.introduce"><img :src="adImg.image_src" :alt="adImg.introduce" data-tag="imgurl.ad_tag" :id="adImg.ad_tag"></a>
                 </div>
             </div>
         </div>
         <el-dialog v-model="dialogTableVisible" width="800">
             <div class="tips">
-                <p>
-                    <img src="@/public/topic/tips.png"> 提示:注册请联系管理员操作!
-                </p>
+                <p><img src="@/public/topic/tips.png"> 提示:注册请联系管理员操作!</p>
                 <p>联系电话:010-56019387</p>
                 <p>QQ : 2909421493 、213552413</p>
             </div>
@@ -66,16 +41,15 @@
 </template>
 
 <script setup>
-import { useTemplateBaseStore } from '@/stores/templateBase'
-const templateBaseStore = useTemplateBaseStore()
-console.log(123456)
-console.log(templateBaseStore.webSiteName)
+
 
 //1.加载基本依赖 start ---------------------------------------->
 import { ref, watch, onMounted } from 'vue'
 import { ElDialog } from 'element-plus'
 import { getToken, setToken, removeToken } from '@/store/useCookieStore'
 import { setTicket, removeTicket } from '@/store/useticketStore'
+import { useTemplateBaseStore } from '@/stores/templateBase'
+const templateBaseStore = useTemplateBaseStore()
 //网站地址
 const { $webUrl, $CwebUrl, $BwebUrl, $LoginWebUrl } = useNuxtApp()
 //1.加载基本依赖 end ---------------------------------------->
@@ -115,9 +89,9 @@ token1.value = getToken()
 let tokenStatus = ref('');
 tokenStatus.value = getToken()
 if (tokenStatus.value == undefined) {
-    console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-    console.log('错误:未获取到用户token,如果在本地测试请忽略!');
-    console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+    // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+    // console.log('错误:未获取到用户token,如果在本地测试请忽略!');
+    // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
 } else {
     console.log(tokenStatus.value);
 }
@@ -240,24 +214,6 @@ watch(token1, (newval, oldval) => {
     deep: true,
     immediate: true,
 })
-
-//获得网站logo
-const logo = ref("")
-const webSiteName = ref("")
-let getLogo = async () => {
-    const responseStatus = await requestDataPromise('/web/getWebsiteHead', {
-        method: 'GET',
-        query: {},
-    });
-    if (responseStatus.code == 200) {
-        logo.value = responseStatus.data.logo;
-        webSiteName.value = responseStatus.data.website_name;
-        templateBaseStore.setWebSiteName(responseStatus.data.website_name)
-    } else if (responseStatus.code == 0) {
-        window.location.href = $CwebUrl + '/404';
-    }
-}
-getLogo();
 //3.跳转菜单逻辑 end ---------------------------------------->
 
 //4.获取广告 start ---------------------------------------->
@@ -283,7 +239,7 @@ onMounted(async () => {
 
         if (token == undefined) {
             //如果没有获取到token 不访问后端获取在线状态
-            console.log("没有获取到token!无需查询登录状态!")
+            //console.log("没有获取到token!无需查询登录状态!")
             showToken.value = false;
 
         } else {
@@ -331,17 +287,18 @@ onMounted(async () => {
     //从客户端获取广告
     //从客户端获取行政职能部门 加快打开速度
     const { $webUrl, $CwebUrl } = useNuxtApp();
+
     //广告1
-    let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_top`
-    const responseAd1 = await fetch(url, {
-        headers: {
-            'Content-Type': 'application/json',
-            'Userurl': $CwebUrl,
-            'Origin': $CwebUrl
-        }
-    });
-    const resultAd1 = await responseAd1.json();
-    adImg.value = resultAd1.data[0];
+    // let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_top`
+    // const responseAd1 = await fetch(url, {
+    //     headers: {
+    //         'Content-Type': 'application/json',
+    //         'Userurl': $CwebUrl,
+    //         'Origin': $CwebUrl
+    //     }
+    // });
+    // const resultAd1 = await responseAd1.json();
+    // adImg.value = resultAd1.data[0];
 
     //从客户端获取用户名
     let userInfoUrl = `${$webUrl}/user/getUserInfo`
@@ -358,6 +315,23 @@ onMounted(async () => {
     }
 })
 //5.获取登录状态 end ---------------------------------------->
+
+
+//6.获得网站基本信息与广告池 start ---------------------------------------->
+//获得网站logo
+const logo = ref("")
+const webSiteName = ref("")
+if(templateBaseStore.webSiteInfo.website_head){
+    logo.value = templateBaseStore.webSiteInfo.website_head.logo;
+    webSiteName.value = templateBaseStore.webSiteInfo.website_head.title;
+}
+//adImg.value
+//获得广告
+if(templateBaseStore.webAdList){
+    //console.log(templateBaseStore.webAdList)
+    adImg.value = requestAd(templateBaseStore.webAdList,templateBaseStore.webSiteInfo.website_head.ad_key + "_" + "top")
+}
+//6.获得网站基本信息与广告池 end ---------------------------------------->
 </script>
 
 <style lang="less" scoped>

+ 16 - 90
components/home/pageNavigation.vue

@@ -1,46 +1,15 @@
 <template>
-    <!-- 导航 -->
-    <div class="navigate">
-        <div class="partOne">
-            <div class="inner">
-                <div class="home">
-                    <em></em>
-                    <NuxtLink :to="'/'">首页</NuxtLink>
-                </div>
-                <ul class="partOneTitle">
-                    <li class="titleList1">
-                        深度服务
-                    </li>
-                    <li class="titleList111" v-for="(item, index) in navigation1" :key="index">
-                        <NuxtLink :href="getLinkPath(item)" :title="item.alias"
-                            :target="item.is_url == 1 ? '_blank' : '_self'">
-                            {{ item.alias }}
-                        </NuxtLink>
-                    </li>
-                </ul>
-            </div>
-        </div>
-        <div class="partTwo">
-            <div class="inner">
-                <div class="navleft">
-                    <div> 互动版块 </div>
-                    <div> 推荐版块 </div>
-                </div>
-                <ul class="navlist">
-                    <li class="navListItem" v-for="(item, index) in navigation2" :key="index">
-                        <NuxtLink :href="getLinkPath(item)" :title="item.alias"
-                            :target="item.is_url == 1 ? '_blank' : '_self'">
-                            {{ item.alias }}
-                        </NuxtLink>
-                    </li>
-                </ul>
-                <div class="navright">
-                    <div class="nav111" v-for="(item, index) in navigation3" :key="index">
-                        <NuxtLink :href="getLinkPath(item)" :title="item.alias"
-                            :target="item.is_url == 1 ? '_blank' : '_self'">
-                            {{ item.alias }}
-                        </NuxtLink>
-                    </div>
+    <div class="menuStyle1">
+        <div class="menuBoxBg">
+            <div class="menuBox" ref="menuBox">
+                <div v-for="(item, index) in navigation" :key="index">
+                    <NuxtLink 
+                        :href="getLinkPath(item)" 
+                        :title="item.alias"
+                        :target="item.is_url == 1 ? '_blank' : '_self'"
+                    >
+                        {{ item.alias }}
+                    </NuxtLink>
                 </div>
             </div>
         </div>
@@ -50,64 +19,21 @@
 <script setup>
 //1.获取导航菜单 start ---------------------------------------->
 //第一行导航菜单 10个
-const navigation1 = ref([]);
-//两行的导航菜单 20个 
-const navigation2 = ref([]);
-//边边上的导航菜单 2个
-const navigation3 = ref([]);
+const navigation = ref([]);
 //获取导航菜单1 
-async function getNavigation1() {
+async function getNavigation() {
     const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
         method: 'GET',
         query: {
             'pid': 0,
-            'num': 10,
+            'num': 24,
             'placeid': 1
         },
     });
-    navigation1.value = mkdata.data;
-}
-getNavigation1();
-//获取导航菜单2
-async function getNavigation2() {
-    const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
-        method: 'GET',
-        query: {
-            'pid': 0,
-            'num': 20,
-            'placeid': 11
-        },
-    });
-    navigation2.value = mkdata.data;
-}
-getNavigation2();
-//获取导航菜单3
-async function getNavigation3() {
-    const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
-        method: 'GET',
-        query: {
-            'pid': 0,
-            'num': 2,
-            'placeid': 31
-        },
-    });
-    navigation3.value = mkdata.data;
+    navigation.value = mkdata.data;
 }
-getNavigation3();
+getNavigation();
 //1.获取导航菜单 end ---------------------------------------->
-
-//格式化跳转路径
-const getLinkPath = (item) => {
-    if (item.is_url == 1) {
-        return `${item.web_url}`;
-    } else if (item.children_count == 0) {
-        //return `/newsList/${item.category_id}?page=1`;
-        return `/${item.aLIas_pinyin}/list-1.html`;
-    } else {
-        //return `/primaryNavigation/${item.aLIas_pinyin}/`;
-        return `/${item.aLIas_pinyin}/index.html`;
-    }
-}
 </script>
 
 <style lang="less" scoped>

+ 12 - 5
composables/publicFunction.ts

@@ -80,7 +80,6 @@ const getLinkPathDetail1 = (item: any) => {
 }
 //3.格式化跳转路径 end ---------------------------------------->
 
-
 //4.获得路由路径 start ---------------------------------------->
 const getRoutePath = (type: Number) => {
   const route = useRoute();
@@ -98,8 +97,16 @@ const getRoutePath = (type: Number) => {
     return targetSegmentTwo;
   }
 }
-
-
-
 //4.获得路由路径 end ---------------------------------------->
-export { getTime, getTitleLength, getLinkPath, getLinkPathDetail,getLinkPathDetail1, getRoutePath, getLinkPath1 };
+
+//5.从广告池获得对应标识的广告 start ---------------------------------------->
+const requestAd = (adList:Array<any>,adTag: string) => {
+    for(let item of adList){
+        if(item.ad_tag == adTag){
+            return item;
+        }
+    }
+    return null;
+}
+//5.从广告池获得对应标识的广告 end ---------------------------------------->
+export { getTime, getTitleLength, getLinkPath, getLinkPathDetail,getLinkPathDetail1, getRoutePath, getLinkPath1,requestAd};

+ 59 - 17
pages/index.vue

@@ -4,9 +4,9 @@
         <HomePageNavigation></HomePageNavigation>
         <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
         <!--头条-->
-        <HomePageMessage></HomePageMessage>
+        <!-- <HomePageMessage></HomePageMessage> -->
         <!-- 第一部分 -->
-        <div class="part1">
+        <!-- <div class="part1">
             <div class="inner">
                 <div class="part1_left">
                     <div class="hengxian">
@@ -117,13 +117,13 @@
                     </div>
                 </div>
             </div>
-        </div>
+        </div> -->
 
         <!-- 广告位 2 -->
-        <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
+        <!-- <HomeAdvertising :imgurl="adImg2"></HomeAdvertising> -->
 
         <!-- 第二部分 -->
-        <div class="part2">
+        <!-- <div class="part2">
             <div class="inner">
                 <div class="part2_left">
                     <div class="part2_hengxian">
@@ -196,10 +196,10 @@
                     </ul>
                 </div>
             </div>
-        </div>
+        </div> -->
 
         <!-- 第三部分 -->
-        <div class="part3">
+        <!-- <div class="part3">
             <div class="inner">
                 <div class="part3_left">
                     <div class="part3_hengxian">
@@ -316,10 +316,10 @@
                     </div>
                 </div>
             </div>
-        </div>
-        <HomeAdvertising :imgurl="adImg4"></HomeAdvertising>
+        </div> -->
+        <!-- <HomeAdvertising :imgurl="adImg4"></HomeAdvertising> -->
         <!-- 第四部分 -->
-        <div class="part4">
+        <!-- <div class="part4">
             <div class="inner">
                 <div class="part4_one">
                     <div class="part4_title">
@@ -425,7 +425,7 @@
                     </ul>
                 </div>
             </div>
-        </div>
+        </div> -->
 
         <HomeFoot></HomeFoot>
     </div>
@@ -433,6 +433,46 @@
 
 <script setup>
 //1.加载页面必备组件 start---------------------------------------->
+//1.1 pinia
+import { useTemplateBaseStore } from '@/stores/templateBase'
+const templateBaseStore = useTemplateBaseStore()
+
+const adKey = ref('')
+//6.获得站点基本信息 start---------------------------------------->
+let getTemplateBaseInfo = async () => {
+    const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
+        method: 'GET',
+        query: {
+            'link_textnum':24,
+            'link_imgnum':18,
+            'link_footnum':4
+        },
+    });
+    if (responseStatus.code == 200) {
+        templateBaseStore.setWebSiteInfo(responseStatus.data)
+        console.log()
+    }
+}
+getTemplateBaseInfo();
+
+//获得广告网站广告池
+let getAdList = async (adKey) => {
+    const responseStatus = await requestDataPromise('/web/getWebsiteAdvertisement', {
+        method: 'GET',
+        query: {
+            
+        },
+    });
+    if (responseStatus.code == 200) {
+        //console.log(responseStatus.data)
+        templateBaseStore.setAdList(responseStatus.data)
+    }
+}
+getAdList();
+
+//6.获得站点基本信息 end---------------------------------------->
+
+//1.2 vue
 import { ref, onMounted } from 'vue';
 import { ElMessage } from 'element-plus';
 //1.加载页面必备组件 end---------------------------------------->
@@ -491,7 +531,7 @@ onMounted(async () => {
     });
     const resultAd3 = await responseAd3.json();
     adImg3.value = resultAd3.data[0];
-    console.log('ad3', adImg3.value);
+    //console.log('ad3', adImg3.value);
 
 
     //广告4
@@ -596,10 +636,10 @@ try {
             if (navigateData.data[index].category_id == $pageNav[9]) { pageData.value[9] = data }
         }
     } else {
-        console.log("获取导航池出错!", navigateData.message)
+        //console.log("获取导航池出错!", navigateData.message)
     }
 } catch (error) {
-    console.log("错误:导航池渲染执行接口出错!请检查首页的14的模块的具体执行方法!")
+    //console.log("错误:导航池渲染执行接口出错!请检查首页的14的模块的具体执行方法!")
 }
 
 let getJson = [
@@ -624,7 +664,7 @@ async function getPageAllData() {
             'id': jsonString
         },
     });
-    console.log('mkdata', mkdata)
+    //console.log('mkdata', mkdata)
 
     if (mkdata.code == 200) {
         //模块1
@@ -709,7 +749,7 @@ async function getPageData() {
             'id': jsonString1
         },
     });
-    console.log("成功获取模块数据2222!", mkdata);
+    //console.log("成功获取模块数据2222!", mkdata);
     if (mkdata.code == 200) {
         // console.log("成功获取模块数据2222!", mkdata);
 
@@ -754,9 +794,11 @@ if (setData.code == 200) {
         ]
     });
 } else {
-    console.log("设置首页SEO出错!", setData.message)
+    //console.log("设置首页SEO出错!", setData.message)
 }
 //5.设置seo数据 start---------------------------------------->
+
+
 </script>
 
 <style lang="less" scoped>

+ 10 - 10
plugins/globals.js

@@ -1,17 +1,17 @@
 export default defineNuxtPlugin((nuxtApp) => {
   //农民网Pre环境
-  // nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
-  // nuxtApp.provide('CwebUrl', 'http://pre.nmwwt.org')
-  // nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
-  // nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
-  // nuxtApp.provide('userUrl', 'http://localhost:3002')
+  nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
+  nuxtApp.provide('CwebUrl', 'http://pre.nmwwt.org')
+  nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
+  nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
+  nuxtApp.provide('userUrl', 'http://localhost:3002')
 
   //农民网正式环境
-  nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')
-  nuxtApp.provide('CwebUrl', 'http://nw.nmwwt.org')
-  nuxtApp.provide('BwebUrl', 'https://admin.bjzxtw.org.cn')
-  nuxtApp.provide('LoginWebUrl', 'http://admin.bjzxtw.org.cn/adminapi')
-  nuxtApp.provide('userUrl', 'http://localhost:3002')
+//   nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')
+//   nuxtApp.provide('CwebUrl', 'http://nw.nmwwt.org')
+//   nuxtApp.provide('BwebUrl', 'https://admin.bjzxtw.org.cn')
+//   nuxtApp.provide('LoginWebUrl', 'http://admin.bjzxtw.org.cn/adminapi')
+//   nuxtApp.provide('userUrl', 'http://localhost:3002')
 
   //Dev环境
   // nuxtApp.provide('webUrl', 'http://apidev.bjzxtw.org.cn')

+ 9 - 3
stores/templateBase.js

@@ -1,11 +1,17 @@
 import { defineStore } from "pinia";
 export const useTemplateBaseStore = defineStore("templateBase", {
     state: () => ({
-        webSiteName: "测试测试测试",
+        webSiteInfo: {},
+        webAdList:[]
     }),
     actions: {
-        setWebSiteName(webSiteName) {
-            this.webSiteName = webSiteName
+        //网站基本信息
+        setWebSiteInfo(webSiteInfo) {
+            this.webSiteInfo = webSiteInfo
+        },
+        //广告列表
+        setAdList(webAdList){
+            this.webAdList = webAdList
         }
     }
 })