Эх сурвалжийг харах

每日保存

每日保存
dangyunlong 1 сар өмнө
parent
commit
71d3fbed36

+ 117 - 133
components/home/foot.vue

@@ -1,153 +1,139 @@
 <template>
- <footer class="index_foot">
-    <div class="index_foot_name_box">
-        <div class="index_foot_name">YOUQING</div>
-        <div class="index_foot_name">友情链接</div>
-        <div class="index_foot_name">LIANJIE</div>		
-    </div>
-    <div class="foot_img_box"> 
-        <a :href="item.url" v-for="(item, index) in bottomLink" target="_blank" :title="item.title">
-            <img :src="item.logo_url" :alt="item.title">
-        </a>
-    </div>
-    <div class="foot_frind_box">
-        <span>友情链接</span>	 		
-        <div>
-            <a :href="item.url" v-for="(item, index) in bottomText" :key="index" target="_blank" :title="item.title">{{ item.title }}</a>	
+    <footer class="index_foot">
+        <!-- <div class="index_foot_name_box">
+            <div class="index_foot_name">YOUQING</div>
+            <div class="index_foot_name">友情链接</div>
+            <div class="index_foot_name">LIANJIE</div>		
+        </div> -->
+        <div class="foot_img_box">
+            <a :href="item.url" v-for="(item, index) in bottomLink" target="_blank">
+                <img :src="item.logo_url" alt="">
+            </a>
         </div>
-    </div>
+        <div class="foot_frind_box">
+            <span>友情链接</span>
+            <div>
+                <a :href="item.url" v-for="(item, index) in bottomText" :key="index" target="_blank">{{ item.title
+                }}</a>
+            </div>
+        </div>
+    </footer>
+
     <div class="call_us_box">
-        <span v-for="(item, index) in bottomMenu" :key="index">
-            <NuxtLink :to="{ path: `/specialList/${item.id}` }" target="_blank" v-if="item.type == 1" :title="item.name">
-                {{ item.name }}
-            </NuxtLink>
-            <NuxtLink :to="{ path: `/speciaArticle/${item.id}` }" target="_blank" v-if="item.type == 0" :title="item.name">
-                {{ item.name }}
-            </NuxtLink>
-        </span>
-    </div>
-    <div class="foot_text_box">
-        <!-- <p>{{ bottomBase.statistics_onetext }} <a :href="'http://' + bottomBase.statistics_twourl">中农兴业</a> {{ bottomBase.statistics_twotext }}</p> -->
-        <p>{{ bottomBase.statistics_onetext }} <a :href="bottomBase.record_number_url" target="_blank" :title="中农兴业">中农兴业</a> {{ bottomBase.statistics_twotext }}</p>
-        <p>{{ bottomBase.organizer }} <a :href="currentDomain" target="_blank" :title="三农资讯网">三农资讯网</a> {{ currentDomainUrl }} 版权所有。</p>
-        <!-- <p><img :src="bottomBase.icp_number_img"><a :href="'http://' + bottomBase.statistics_twourl">{{ bottomBase.record_number }}</a> <a :href="'http://' + bottomBase.icp_number_url">{{ bottomBase.icp_number }}</a> </p> -->
-        <p><a :href="bottomBase.record_number_url" target="_blank" title="ICP备案号">{{ bottomBase.record_number }}</a> &nbsp;&nbsp; <img :src="bottomBase.icp_number_img"><a :href="bottomBase.icp_number_url" target="_blank" title="京公网安备案号">{{ bottomBase.icp_number }}</a> </p>
-        <p>{{ bottomBase.email }}</p>
-        <p>{{ bottomBase.company_address }}</p>
-        <p>{{ bottomBase.contact_number }}</p>
-    </div>
-    <div class="foot_logo_out" >
-        <a :href="'http://' + bottomBase.company_url" :title="bottomBase.company_name" target="_blank">
-            <img :src="bottomBase.project_logo" class="floatLogoLeft" :alt="bottomBase.company_name">
-        </a>
-        <a :href="'http://' + bottomBase.project_url" :title="bottomBase.project_name" target="_blank">
-            <img :src="bottomBase.company_logo" class="floatLogoRight" :alt="bottomBase.project_name">
-        </a>
-    </div>
-    <div class="foot_last_img_box">
-        <a :href="item.url" v-for="(item, index) in bottomphoto"  target="_blank" :title="item.title">
-            <img :src="item.logo_url" :alt="item.title">
-        </a>
+        <div class="inner">
+            <span v-for="(item, index) in bottomMenu" :key="index">
+                <NuxtLink :to="{ path: `/specialList/${item.id}` }" target="_blank" v-if="item.type == 1">
+                    {{ item.name }}
+                </NuxtLink>
+                <NuxtLink :to="{ path: `/speciaArticle/${item.id}` }" target="_blank" v-if="item.type == 0">
+                    {{ item.name }}
+                </NuxtLink>
+            </span>
+        </div>
+
     </div>
-</footer>
+    <footer class="index_foot">
+        <div class="foot_text_box">
+            <p class="top_content">
+                {{ bottomBase.statement }}
+                <a :href="bottomBase.record_number_url" target="_blank">乡村网</a>
+                {{ bottomBase.statement_two }}
+            </p>
+            <!-- <p>{{ bottomBase.statistics_onetext }} <a :href="'http://' + bottomBase.statistics_twourl">中农兴业</a> {{ bottomBase.statistics_twotext }}</p> -->
+            <p class="webSitecolor">
+                {{ bottomBase.statistics_onetext }}
+                <a :href="bottomBase.record_number_url" target="_blank" class="webSitecolor">中农兴业</a>
+                {{ bottomBase.statistics_twotext }}
+            </p>
+            <p>
+                {{ bottomBase.organizer }}
+                <a :href="bottomBase.record_number_url" target="_blank">{{ bottomBase.record_number }}</a> &nbsp;&nbsp;
+                <img :src="bottomBase.icp_number_img">
+                <a :href="bottomBase.icp_number_url" target="_blank">
+                    {{ bottomBase.icp_number }}
+                </a>
+            </p>
+            <p>{{ bottomBase.company_address }}</p>
+            <p class="top_content">
+                {{ bottomBase.email }}
+                {{ bottomBase.contact_number }}
+            </p>
+        </div>
+        <div class="foot_logo_out">
+            <a :href="'http://' + bottomBase.company_url" :title="bottomBase.company_name" target="_blank">
+                <img :src="bottomBase.project_logo" class="floatLogoLeft" :alt="bottomBase.company_name">
+            </a>
+        </div>
+        <div class="foot_last_img_box">
+            <a :href="item.url" v-for="(item, index) in bottomphoto" target="_blank">
+                <img :src="item.logo_url" alt="">
+            </a>
+        </div>
+    </footer>
 </template>
 
 <script setup>
-//获得底部基本信息 start---------------------------------------->
+import { onMounted } from 'vue';
+const nuxtApp = useNuxtApp();
+const axios = nuxtApp.$axios;
+
+// const props = defineProps({
+//     bottomLink: Array,
+//     bottomMenu: Array,
+//     bottomBase: Object
+// });
 
-//1.获得友情链接图片
+//获得友情链接 图片
 const bottomLink = ref([])
-async function getModelData1() {
-    const { data: mkdata, error: mkdataError } =  requestData('/web/selectWebsiteLinks', {
-        method: 'GET',
-        query: {
-            'type':1,
-            'num':12,
-        },
-    });
-    if (mkdataError.value) {
-        //console.error('模块1数据上部分请求失败!', mkdataError.value);
-    } else {
-        if (mkdata.value) {
-            bottomLink.value = mkdata.value.data;
-        }
-    }
+const getBottomLink = async () => {
+    const response = await axios.get(`/web/selectWebsiteLinks?&type=${1}&num=${7}`);
+    bottomLink.value = response.data;
+    console.log(bottomLink.value)
 }
-getModelData1();
-//2.获得友情链接文字
+//文字
 const bottomText = ref([])
-async function getModelData2() {
-    const { data: mkdata, error: mkdataError } =  requestData('/web/selectWebsiteLinks', {
-        method: 'GET',
-        query: {
-            'type':2,
-            'num':8,
-        },
-    });
-    if (mkdataError.value) {
-        //console.error('模块1数据上部分请求失败!', mkdataError.value);
-    } else {
-        if (mkdata.value) {
-            bottomText.value = mkdata.value.data;
-        }
-    }
+const getBottomLink2 = async () => {
+    const response = await axios.get(`/web/selectWebsiteLinks?&type=${2}&num=${8}`);
+    bottomText.value = response.data;
+    console.log(bottomLink.value)
 }
-getModelData2();
-//3.获得底部图片
+//底部
 const bottomphoto = ref([])
-async function getModelData3() {
-    const { data: mkdata, error: mkdataError } =  requestData('/web/selectWebsiteLinks', {
-        method: 'GET',
-        query: {
-            'type':3,
-            'num':4,
-        },
-    });
-    if (mkdataError.value) {
-        //console.error('模块1数据上部分请求失败!', mkdataError.value);
-    } else {
-        if (mkdata.value) {
-            bottomphoto.value = mkdata.value.data;
-        }
-    }
+const getBottomLink1 = async () => {
+    const response = await axios.get(`/web/selectWebsiteLinks?&type=${3}&num=${4}`);
+    bottomphoto.value = response.data;
+    console.log(bottomphoto.value)
 }
-getModelData3();
-//4.获得底部导航
+
+//获得底部导航
 const bottomMenu = ref([])
-async function getModelData4() {
-    const { data: mkdata, error: mkdataError } =  requestData('/web/getWebsiteFooterCategory', {
-        method: 'GET',
-        query: {
-        },
-    });
-    if (mkdataError.value) {
-        //console.error('模块1数据上部分请求失败!', mkdataError.value);
-    } else {
-        if (mkdata.value) {
-            bottomMenu.value = mkdata.value.data;
-        }
-    }
+const getBottomMenu = async () => {
+    const response = await axios.get(`/web/getWebsiteFooterCategory`);
+    bottomMenu.value = response.data;
+    console.log(bottomMenu.value)
 }
-getModelData4();
-//5.获得底部基本信息
+
+//获得底部基本信息
 const bottomBase = ref({})
-async function getModelData5() {
-    const { data: mkdata, error: mkdataError } =  requestData('/web/getWebsiteFootInfo', {
-        method: 'GET',
-        query: {
-        },
-    });
-    if (mkdataError.value) {
-        //console.error('模块1数据上部分请求失败!', mkdataError.value);
-    } else {
-        if (mkdata.value) {
-            bottomBase.value = mkdata.value.data.website_foot;
-        }
-    }
+const getBottomBase = async () => {
+    const response = await axios.get(`/web/getWebsiteFootInfo`);
+    bottomBase.value = response.data.website_foot;
+    console.log(7777777)
+    console.log('bottomBase', bottomBase.value)
 }
-getModelData5();
 
-//6.获取当前域名
+
+onMounted(() => {
+    getBottomLink();
+    getBottomLink1();
+    getBottomLink2();
+    getBottomMenu();
+    getBottomBase();
+    //获取域名
+    getDomain()
+})
+
+//获取当前域名
 const currentDomain = ref('')
 const currentDomainUrl = ref('')
 
@@ -158,8 +144,6 @@ const getDomain = () => {
         currentDomain.value = url.origin //协议和域名
     }
 }
-getDomain();
-//获得底部基本信息 end---------------------------------------->
 </script>
 
 <style lang="less" scoped>

+ 32 - 12
components/home/pageHead.vue

@@ -53,13 +53,13 @@
         <!-- 头部logo -->
         <div class="headerLogo">
             <div class="inner">
-                <img src="../../public/index/headLogo.png" alt="乡村网" class="left" @click="backHome">
+                <img :src="logo" :alt="webSiteName" class="left" @click="backHome">
                 <div class="titlead" v-if="adImg">
-                    <a href="http://www.baidu.com" title="三农资讯网_广告位1" v-if="adImg.image_url==null" target="_blank">
-                        <img :src="adImg.thumb" alt="三农资讯网_广告位1">
+                    <a href="http://sannongdy.org.cn/" v-if="adImg.image_url==null" target="_blank">
+                        <img :src="adImg.thumb" >
                     </a>     
-                    <a :href="adImg.image_url" title="三农资讯网_广告位1" v-else>
-                        <img :src="adImg.image_src" alt="三农资讯网_广告位1">
+                    <a :href="adImg.image_url" v-else>
+                        <img :src="adImg.image_src">
                     </a>
                 </div>
             </div>
@@ -83,11 +83,11 @@
 
 <script setup>
 //1.加载基本依赖 start ---------------------------------------->
-import { ref, onMounted, watch } from 'vue'
-import { ElPopover, ElDialog } from 'element-plus'
+import { ref, watch } from 'vue'
+import { ElDialog } from 'element-plus'
 import { getToken, setToken, removeToken } from '@/store/useCookieStore'
 import { setTicket, removeTicket } from '@/store/useticketStore'
-
+//网站地址
 const { $webUrl, $CwebUrl, $BwebUrl} = useNuxtApp()
 //1.加载基本依赖 end ---------------------------------------->
 
@@ -192,7 +192,7 @@ let getLoginStatus = async () => {
         exit();
     }
 }
-//getLoginStatus();
+getLoginStatus();
 
 //2.登录逻辑 end ---------------------------------------->
 
@@ -259,6 +259,19 @@ watch(token1, (newval, oldval) => {
     deep: true,
     immediate: true,
 })
+
+//获得网站logo
+const logo = ref("")
+const webSiteName = ref("")
+let getLogo = async () => {
+    const responseStatus =  await requestDataPromise('/web/getWebsiteFootInfo', {
+        method: 'GET',
+        query: {},
+    });
+    logo.value = responseStatus.data.website_head.logo;
+    webSiteName.value = responseStatus.data.website_head.website_name;
+}
+getLogo();
 //3.跳转菜单逻辑 end ---------------------------------------->
 
 
@@ -267,10 +280,17 @@ watch(token1, (newval, oldval) => {
 let adImg = ref({})
 async function getAdData(){
     const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'INDEDX'}});
-    for(let item of adData.data){
-        if(item.ad_tag == 'SNZXWT_INDEDX_0001'){
-            adImg.value = item;
+    if(adData.code == 200){
+        for(let item of adData.data){
+            if(item.ad_tag == 'SNZXWT_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();

+ 29 - 44
components/home/pageNavigation.vue

@@ -17,23 +17,15 @@
                 </div>
                 <ul class="navigationOne">
                     <li v-for="(item, index) in navigation1" :key="index">
-                        <NuxtLink 
-                            :to="getLinkPath(item)" 
-                            target="_blank">
-                            <span :class="{ active: item.category_id == routeId }">
-                                {{ item.alias }}
-                            </span>
+                        <NuxtLink :to="getLinkPath(item)">
+                            <span>{{ item.alias }}</span>
                         </NuxtLink>
                     </li>
                 </ul>
                 <div class="navRight">
                     <div class="nav111" v-for="(item, index) in navigation2">
-                        <NuxtLink 
-                            :to="getLinkPath(item)" 
-                            target="_blank">
-                            <span :class="{ active: item.category_id == routeId }">
-                                {{ item.alias }}
-                            </span>
+                        <NuxtLink :to="getLinkPath(item)">
+                            <span>{{ item.alias }}</span>
                         </NuxtLink>
                     </div>
                 </div>
@@ -46,18 +38,14 @@
                 </h3>
                 <ul class="partTwoTitle">
                     <li class="titleList" v-for="(item, index) in navigation3">
-                        <NuxtLink 
-                            :to="getLinkPath(item)" 
-                            target="_blank">
-                            <span :class="{ active: item.category_id == routeId }">
-                                {{ item.alias }}
-                            </span>
+                        <NuxtLink :to="getLinkPath(item)">
+                            <span>{{ item.alias }}</span>
                         </NuxtLink>
                     </li>
                 </ul>
                 <div class="searchBox">
                     <input v-model="keywords" type="text" placeholder="请输入关键词" @keydown.enter="goToSearch">
-                    <img src="../../public/image/search.png" alt="">
+                    <img src="../../public/image/search.png" @keydown.enter="goToSearch">
                 </div>
             </div>
         </div>
@@ -66,23 +54,15 @@
                 <img src="../../public/index/hdpt.png" alt="">
                 <ul class="leftPart">
                     <li class="navList" v-for="item in navigation4">
-                        <NuxtLink 
-                            :to="getLinkPath(item)" 
-                            target="_blank">
-                            <span :class="{ active: item.category_id == routeId }">
-                                {{ item.alias }}
-                            </span>
+                        <NuxtLink :to="getLinkPath(item)">
+                            <span>{{ item.alias }}</span>
                         </NuxtLink>
                     </li>
                 </ul>
                 <ul class="rightPart">
                     <li class="navList" v-for="item in navigation4data2">
-                        <NuxtLink 
-                            :to="getLinkPath(item)" 
-                            target="_blank">
-                            <span :class="{ active: item.category_id == routeId }">
-                                {{ item.alias }}
-                            </span>
+                        <NuxtLink :to="getLinkPath(item)" >
+                            <span>{{ item.alias }}</span>
                         </NuxtLink>
                     </li>
                 </ul>
@@ -93,19 +73,23 @@
 
 <script setup>
 //1.加载依赖 start ---------------------------------------->
-const route = useRoute();
-const routeId = route.params.id; //获得该页面的id
+
 //1.加载依赖 end ---------------------------------------->
 
 //2.页面公用方法 start ---------------------------------------->
 const getLinkPath = (item) => {
-  if (item.children_count != 0) {
-      return { path: `/primaryNavigation/${item.category_id}` }
-  }
-  if (item.is_url == 1) {
-      return item.web_url
-  }
-  return { path: `/newsList/${item.category_id}` }
+    if (item.is_url == 1) {
+        return {
+            url: item.web_url,
+            target: '_blank'
+        }
+    }else{
+        if (item.children_count != 0) {
+            return { path: `/primaryNavigation/${item.category_id}` }
+        }else{
+            return { path: `/newsList/${item.category_id}` }
+        }
+    }
 }
 //2.页面公用方法 end ---------------------------------------->
 
@@ -114,7 +98,7 @@ const navigation1 = ref([]);
 //2是那个独立的2个
 const navigation2 = ref([]); 
 const navigation3 = ref([]);
- //下面一行是2边分开的 一边5个
+//下面一行是2边分开的 一边5个
 const navigation4 = ref([]);
 const navigation4data2 = ref([]);
 
@@ -247,15 +231,15 @@ let goToSearch = () => {
         color: #333;
         display: flex;
         flex-wrap: wrap;
-        padding-top: 20px;
+        padding-top: 24px;
 
         //justify-content: space-around;
 
         li {
             width: 74px;
             font-family: PingFang SC;
-            height: 45px;
-            line-height: 45px;
+            height: 42px;
+            line-height: 42px;
             //font-weight: 600;
             font-size: 16px;
             text-align: left;
@@ -384,6 +368,7 @@ let goToSearch = () => {
                 width: 32px;
                 height: 32px;
                 vertical-align: middle;
+                cursor: pointer;
             }
 
         }

+ 64 - 49
composables/getData.ts → composables/getData.js

@@ -1,60 +1,25 @@
 import { getToken } from '@/store/useCookieStore';
-//获得nuxt.config中配置的域名
-
-//const servUrl = 'http://apipre1.bjzxtw.org.cn:29501'; //pre
-//const servUrl = 'http://apidev.bjzxtw.org.cn'; //dev
-//const UserUrl = 'http://localhost:3000'; //用户来源
-
-// requestData方法 如果只是单一请求,可以直接调用这个方法
-function requestData(url, options = {}) {
-    //获得全局变量中的webUrl和userUrl
-    const { $webUrl, $userUrl } = useNuxtApp()
-    let fullUrl = $webUrl + url;
-   
-    // 生成唯一的 key
-    const key = `${url}-${JSON.stringify(options.query || options.body)}`;
-
-    // 设置默认的请求头
-    const headers = {
-        'Content-Type': 'application/json',
-        'Userurl': 'nwpre.bjzxtw.org.cn',
-        'token': getToken(),
-        //'Origin': 'http://nwpre.bjzxtw.org.cn',//pre
-        'Origin':$userUrl,
-    };
-
-    // 确定请求方法
-    const method = options.method || 'GET';
-
-    // 使用 useAsyncData 进行数据获取
-    const { data, error } = useAsyncData(key, () => {
-        return $fetch(fullUrl, {
-            method,
-            headers,
-            body: method === 'POST' ? options.body : undefined, // 仅在 POST 请求时设置 body
-            query: method === 'GET' ? options.query : undefined, // 仅在 GET 请求时设置 query
-        });
-    }, { lazy: true }); // 禁用缓存
-
-    return { data, error };
-}
 
 // requestDataPromise 如果你的请求中的参数依赖上一个请求,使用这个方法
 function requestDataPromise(url, options = {}) {
     return new Promise(async (resolve, reject) => {
         //获得全局变量中的webUrl和userUrl
-        const { $webUrl, $userUrl } = useNuxtApp()
+        const { $webUrl, $userUrl , $CwebUrl } = useNuxtApp()
         let fullUrl = $webUrl + url;
 
-        // 生成唯一的 key
-        const key = `${url}-${JSON.stringify(options.query || options.body)}`;
+        let key = `${url}-${JSON.stringify(options.query)}`;
+
+        // console.log(555555555)
+        // console.log(key)
+        //let key =  "abc" 不能为固定值
+        //let key = Math.random().toString(36).substring(2, 15); 不能为固定方法 都会留下缓存
 
         // 设置默认的请求头
         const headers = {
             'Content-Type': 'application/json',
-            'Userurl': 'nwpre.bjzxtw.org.cn',
+            'Userurl': $CwebUrl,
             'token': getToken(),
-            'Origin': $userUrl,
+            'Origin': $CwebUrl,
         };
 
         // 确定请求方法
@@ -69,7 +34,9 @@ function requestDataPromise(url, options = {}) {
                     body: method === 'POST' ? options.body : undefined, // 仅在 POST 请求时设置 body
                     query: method === 'GET' ? options.query : undefined, // 仅在 GET 请求时设置 query
                 });
-            }, { lazy: true }); // 禁用缓存
+            }, { 
+                lazy: false,
+            }); 
 
             if (error.value) {
                 reject(error.value); // 如果有错误,拒绝 Promise
@@ -86,7 +53,7 @@ function requestDataPromise(url, options = {}) {
 function requestDataWebUrl(url, options = {}) {
     return new Promise(async (resolve, reject) => {
         //获得全局变量中的webUrl和userUrl
-        const { $webUrl, $userUrl } = useNuxtApp()
+        const { $webUrl, $userUrl, $CwebUrl } = useNuxtApp()
         let fullUrl = `${url}`;
 
         // 生成唯一的 key
@@ -95,9 +62,9 @@ function requestDataWebUrl(url, options = {}) {
         // 设置默认的请求头
         const headers = {
             'Content-Type': 'application/json',
-            'Userurl': 'nwpre.bjzxtw.org.cn',
+            'Userurl': $CwebUrl,
             'token': getToken(),
-            'Origin': $userUrl,
+            'Origin': $CwebUrl,
         };
 
         // 确定请求方法
@@ -125,4 +92,52 @@ function requestDataWebUrl(url, options = {}) {
     });
 }
 
-export { requestData, requestDataPromise ,requestDataWebUrl };
+
+// 在首页执行缓存
+function requestHome(url, options = {}) {
+    return new Promise(async (resolve, reject) => {
+        //获得全局变量中的webUrl和userUrl
+        const { $webUrl, $userUrl,$CwebUrl } = useNuxtApp()
+        let fullUrl = $webUrl + url;
+
+        let key = `${url}-${JSON.stringify(options.query)}`;
+
+        //let key =  "abc" 不能为固定值
+        //let key = Math.random().toString(36).substring(2, 15); 不能为固定方法 都会留下缓存
+
+        // 设置默认的请求头
+        const headers = {
+            'Content-Type': 'application/json',
+            'Userurl': $CwebUrl,
+            'token': getToken(),
+            'Origin': $CwebUrl,
+        };
+
+        // 确定请求方法
+        const method = options.method || 'GET';
+
+        try {
+            // 使用 useAsyncData 进行数据获取
+            const { data, error } = await useAsyncData(key, () => {
+                return $fetch(fullUrl, {
+                    method,
+                    headers,
+                    body: method === 'POST' ? options.body : undefined, // 仅在 POST 请求时设置 body
+                    query: method === 'GET' ? options.query : undefined, // 仅在 GET 请求时设置 query
+                });
+            }, { 
+                lazy: true, //使用缓存
+            }); 
+
+            if (error.value) {
+                reject(error.value); // 如果有错误,拒绝 Promise
+            } else {
+                resolve(data.value); // 如果成功,返回数据
+            }
+        } catch (err) {
+            reject(err); // 捕获异常并拒绝 Promise
+        }
+    });
+}
+
+export { requestDataPromise ,requestDataWebUrl, requestHome };

+ 1 - 1
pages/index.vue

@@ -791,7 +791,7 @@ try {
         method: 'GET',
         query: {
             'placeid': 1,
-            'pid': routeId,
+            'pid': 0,
             'num': 14
         },
     });

+ 5 - 0
plugins/globals.js

@@ -4,6 +4,11 @@ export default defineNuxtPlugin((nuxtApp) => {
   nuxtApp.provide('CwebUrl', 'http://nwpre.bjzxtw.org.cn')
   nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
   nuxtApp.provide('userUrl', 'http://localhost:3000')
+  //乡村网
+  // nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
+  // nuxtApp.provide('CwebUrl', 'http://pre.china-village.com.cn')
+  // nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
+  // nuxtApp.provide('userUrl', 'http://localhost:3000')
   //Dev环境
   // nuxtApp.provide('webUrl', 'http://apidev.bjzxtw.org.cn')
   // nuxtApp.provide('CwebUrl', 'http://nwdev.bjzxtw.org.cn')