Sfoglia il codice sorgente

修改bug

修改bug
dangyunlong 1 mese fa
parent
commit
5fd959b352

+ 1 - 1
.nuxt/manifest/latest.json

@@ -1 +1 @@
-{"id":"dev","timestamp":1742522048041}
+{"id":"dev","timestamp":1742533187456}

+ 1 - 1
.nuxt/manifest/meta/dev.json

@@ -1 +1 @@
-{"id":"dev","timestamp":1742522048041,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
+{"id":"dev","timestamp":1742533187456,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 1 - 0
.nuxt/manifest/meta/e90dfd23-aa8f-44b9-926d-52dd3a68fa99.json

@@ -0,0 +1 @@
+{"id":"e90dfd23-aa8f-44b9-926d-52dd3a68fa99","timestamp":1742522326213,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 3 - 3
.nuxt/nitro.json

@@ -1,5 +1,5 @@
 {
-  "date": "2025-03-21T01:54:11.409Z",
+  "date": "2025-03-21T04:59:55.673Z",
   "preset": "nitro-dev",
   "framework": {
     "name": "nuxt",
@@ -9,9 +9,9 @@
     "nitro": "2.10.4"
   },
   "dev": {
-    "pid": 22476,
+    "pid": 6180,
     "workerAddress": {
-      "socketPath": "\\\\.\\pipe\\nitro\\worker-22476-1.sock"
+      "socketPath": "\\\\.\\pipe\\nitro\\worker-6180-1.sock"
     }
   }
 }

+ 9 - 0
.nuxt/nuxt.json

@@ -0,0 +1,9 @@
+{
+  "_hash": "1rNbmyQyEO",
+  "project": {
+    "rootDir": "D:/MyProject/gogs/sannongzixunwang_web_ssr/sannongzixunwang_web"
+  },
+  "versions": {
+    "nuxt": "3.15.2"
+  }
+}

+ 1 - 1
.nuxt/tsconfig.json

@@ -102,7 +102,7 @@
         "./imports"
       ],
       "#app-manifest": [
-        "./manifest/meta/dev.json"
+        "./manifest/meta/dev"
       ],
       "#components": [
         "./components"

+ 33 - 17
components/home/pageHead.vue

@@ -261,24 +261,25 @@ getLogo();
 //3.跳转菜单逻辑 end ---------------------------------------->
 
 //4.获取广告 start ---------------------------------------->
-//let adList = ref([]);
 let adImg = ref({})
-async function getAdData(){
-    const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'INDEDX'}});
-    if(adData.code == 200){
-        for(let item of adData.data){
-            if(item.ad_tag == 'INDEDX_0001'){
-                adImg.value = item;
-            }
-        }
-    }else{
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-        console.log("错误位置:设置logo旁广告")
-        console.log("后端错误反馈:",adData.message)
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-    }
-}
-getAdData();
+//let adList = ref([]);
+// let adImg = ref({})
+// async function getAdData(){
+//     const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'INDEDX'}});
+//     if(adData.code == 200){
+//         for(let item of adData.data){
+//             if(item.ad_tag == 'INDEDX_0001'){
+//                 adImg.value = item;
+//             }
+//         }
+//     }else{
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//         console.log("错误位置:设置logo旁广告")
+//         console.log("后端错误反馈:",adData.message)
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//     }
+// }
+// getAdData();
 //4.获取广告 end ---------------------------------------->
 
 
@@ -324,6 +325,21 @@ onMounted(async () => {
         }
     }
     setInterval(getLoginStatus, 5000);
+
+    //获取广告
+    //从客户端获取行政职能部门 加快打开速度
+    const { $webUrl, $CwebUrl } = useNuxtApp();
+    //广告1
+    let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_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];
 })
 //5.获取登录状态 end ---------------------------------------->
 </script>

+ 1 - 1
components/home/pageNavigation1.vue

@@ -55,7 +55,7 @@
 <script setup>
 //1.加载依赖 start ---------------------------------------->
 import { ElMessage } from 'element-plus'
-import { ref, onMounted } from 'vue';
+import { ref } from 'vue';
 import { ElSelect, ElOption } from 'element-plus'
 
 const nuxtApp = useNuxtApp();

+ 5 - 6
pages/index.vue

@@ -86,11 +86,11 @@
                 </div>
                 <div class="scienceRight" v-if="pageData.length>=4">
                     <div class="adBox1" v-if="adImg3">
-                        <a href="http://nzgxw.org.cn/" v-if="adImg3.image_url==null" target="_blank">
-                            <img :src="adImg3.thumb" >
+                        <a href="http://nzgxw.org.cn/" v-if="adImg2.image_url==null" target="_blank">
+                            <img :src="adImg2.thumb" >
                         </a>
-                        <a :href="adImg3.image_url" v-else>
-                            <img :src="adImg3.image_src">
+                        <a :href="adImg2.image_url" v-else>
+                            <img :src="adImg2.image_src">
                         </a>
                     </div>
                     <h3 v-if="pageData[3].cid">
@@ -124,7 +124,7 @@
                 </div>
             </div>
         </div>
-        <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
+        <HomeTopTen :imgurl="adImg3" v-if="adImg3"></HomeTopTen>
         <div class="layoutCopy">
             <div class="layoutCopyLeft">
                 <div class="layoutCopyLeftTop">
@@ -655,7 +655,6 @@
                         </div>
                         <div class="btn">
                             <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled" v-if="!isDisabled">投票</button>
-                            <button class="info" disabled v-else>投票</button>
                         </div>
                     </div>
                 </div>

+ 32 - 16
pages/newsDetail/[id].vue

@@ -108,7 +108,7 @@
                             </div>
                             </div>
                             <div class="btn">
-                                <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled">投票</button>
+                                <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled" v-if="!isDisabled">投票</button>
                             </div>
                         </div>
                     </div>
@@ -195,22 +195,38 @@ getPageData();
 //2.5 获得广告
 //广告列表
 let adImg1 = ref([]);
-async function getAdData(){
-    const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
-    if(adData.code==200){
-        for(let item of adData.data){
-            if(item.ad_tag == 'DETAIL_0001'){
-                adImg1.value = item;
-            }
+// async function getAdData(){
+//     const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
+//     if(adData.code==200){
+//         for(let item of adData.data){
+//             if(item.ad_tag == 'DETAIL_0001'){
+//                 adImg1.value = item;
+//             }
+//         }
+//     }else{
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//         console.log("错误位置:获取详情页广告列表")
+//         console.log("后端错误反馈:",adData.message)
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//     }
+// }
+// getAdData();
+
+onMounted(async ()  => {
+    const { $webUrl, $CwebUrl } = useNuxtApp();
+    //广告1
+    let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
+    const responseAd1 = await fetch(url, {
+        headers: {
+            'Content-Type': 'application/json',
+            'Userurl': $CwebUrl,
+            'Origin': $CwebUrl
         }
-    }else{
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-        console.log("错误位置:获取详情页广告列表")
-        console.log("后端错误反馈:",adData.message)
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-    }
-}
-getAdData();
+    });
+    const resultAd1 = await responseAd1.json();
+    adImg1.value = resultAd1.data[0];
+})
+
 //2.页面数据 end ---------------------------------------->
 
 //3.设置seo信息 start---------------------------------------->

+ 50 - 21
pages/search/[id].vue

@@ -61,6 +61,8 @@
 //1.页面依赖 start ---------------------------------------->
 import { ElBreadcrumb, ElBreadcrumbItem, ElPagination } from 'element-plus'
 import { ArrowRight } from '@element-plus/icons-vue'
+import { ref, onMounted } from 'vue';
+
 const route = useRoute();
 const pageCatids = route.query.catids;
 const pageDepartment_id = route.query.department_id;
@@ -79,30 +81,57 @@ let pageSize = useState("pageSize", () => 20)
 //2.1 广告
 let adImg1 = ref([]);
 let adImg2 = ref([]);
-async function getAdData(){
-    const mkdata = await requestDataPromise('/web/getWebsiteAdvertisement',{
-        method:'GET',
-        query:{
-            'ad_tag':'SEARCH'
+// async function getAdData(){
+//     const mkdata = await requestDataPromise('/web/getWebsiteAdvertisement',{
+//         method:'GET',
+//         query:{
+//             'ad_tag':'SEARCH'
+//         }
+//     });
+//     if(adData.code==200){
+//         for(let item of adData.data){
+//             if(item.ad_tag == 'SEARCH_0001'){
+//                 adImg1.value = item;
+//             }
+//             if(item.ad_tag == 'SEARCH_0002'){
+//                 adImg2.value = item;
+//             }
+//         }
+//     }else{
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//         console.log("错误位置:获取搜索页广告列表")
+//         console.log("后端错误反馈:",adData.message)
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//     }
+// }
+// getAdData();
+onMounted(async ()  => {
+    //从客户端获取行政职能部门 加快打开速度
+    const { $webUrl, $CwebUrl } = useNuxtApp();
+    //广告1
+    let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0001`
+    const responseAd1 = await fetch(url, {
+        headers: {
+            'Content-Type': 'application/json',
+            'Userurl': $CwebUrl,
+            'Origin': $CwebUrl
         }
     });
-    if(adData.code==200){
-        for(let item of adData.data){
-            if(item.ad_tag == 'SEARCH_0001'){
-                adImg1.value = item;
-            }
-            if(item.ad_tag == 'SEARCH_0002'){
-                adImg2.value = item;
-            }
+    const resultAd1 = await responseAd1.json();
+    adImg1.value = resultAd1.data[0];
+    
+    //广告2
+    let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0002`
+    const responseAd2 = await fetch(url2, {
+        headers: {
+            'Content-Type': 'application/json',
+            'Userurl': $CwebUrl,
+            'Origin': $CwebUrl
         }
-    }else{
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-        console.log("错误位置:获取搜索页广告列表")
-        console.log("后端错误反馈:",adData.message)
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-    }
-}
-getAdData();
+    });
+    const resultAd2 = await responseAd2.json();
+    adImg2.value = resultAd2.data[0];
+})
 
 
 // 新闻列表

+ 47 - 18
pages/specialList/[id].vue

@@ -69,6 +69,7 @@
 //1.页面依赖 start ---------------------------------------->
 import { ElBreadcrumb, ElBreadcrumbItem, ElPagination } from 'element-plus'
 import { ArrowRight } from '@element-plus/icons-vue'
+import { ref, onMounted } from 'vue';
 //获得跳转过来的id
 const route = useRoute();
 const pageId = route.params.id;
@@ -76,27 +77,55 @@ const routeHref = route.href;
 //1.页面依赖 end ---------------------------------------->
 
 //2.页面数据 start ---------------------------------------->
+//广告
 let adImg1 = ref([]);
 let adImg2 = ref([]);
-async function getAdData(){
-    const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'PAGE'}});
-    if(adData.code==200){
-        for(let item of adData.data){
-            if(item.ad_tag == 'PAGE_0001'){
-                adImg1.value = item;
-            }
-            if(item.ad_tag == 'PAGE_0002'){
-                adImg2.value = item;
-            }
+// async function getAdData(){
+//     const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'PAGE'}});
+//     if(adData.code==200){
+//         for(let item of adData.data){
+//             if(item.ad_tag == 'PAGE_0001'){
+//                 adImg1.value = item;
+//             }
+//             if(item.ad_tag == 'PAGE_0002'){
+//                 adImg2.value = item;
+//             }
+//         }
+//     }else{
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//         console.log("错误位置:获取详情页广告列表")
+//         console.log("后端错误反馈:",adData.message)
+//         console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
+//     }
+// }
+// getAdData();
+onMounted(async ()  => {
+    //从客户端获取行政职能部门 加快打开速度
+    const { $webUrl, $CwebUrl } = useNuxtApp();
+    //广告1
+    let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0001`
+    const responseAd1 = await fetch(url, {
+        headers: {
+            'Content-Type': 'application/json',
+            'Userurl': $CwebUrl,
+            'Origin': $CwebUrl
         }
-    }else{
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-        console.log("错误位置:获取详情页广告列表")
-        console.log("后端错误反馈:",adData.message)
-        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
-    }
-}
-getAdData();
+    });
+    const resultAd1 = await responseAd1.json();
+    adImg1.value = resultAd1.data[0];
+    
+    //广告2
+    let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_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];
+})
 
 //左侧导航
 const bottomMenu = ref([]);