瀏覽代碼

解决一致性问题

解决一致性问题
dangyunlong 3 天之前
父節點
當前提交
90453ba941

+ 2 - 2
assets/css/public/footer.less

@@ -98,7 +98,7 @@
     overflow: hidden;
     text-align: center;
     font-size: 0px;
-    background: #dd7d18;
+    background: #1C5468;
 
     a {
         color: #fff;
@@ -119,7 +119,7 @@
     box-sizing: border-box;
     padding: 0 19px;
     font-weight: bold;
-    border-left: solid 1px #CB7113;
+    border-left: solid 1px #193D4A;
     margin: 18px 0;
 }
 

+ 0 - 1
components/home/pageHead.vue

@@ -42,7 +42,6 @@
 
 <script setup>
 
-
 //1.加载基本依赖 start ---------------------------------------->
 import { ref, watch, onMounted } from 'vue'
 import { ElDialog } from 'element-plus'

+ 2 - 1
composables/publicFunction.ts

@@ -108,5 +108,6 @@ const requestAd = (adList:Array<any>,adTag: string) => {
     }
     return null;
 }
+
 //5.从广告池获得对应标识的广告 end ---------------------------------------->
-export { getTime, getTitleLength, getLinkPath, getLinkPathDetail,getLinkPathDetail1, getRoutePath, getLinkPath1,requestAd};
+export { getTime, getTitleLength, getLinkPath, getLinkPathDetail,getLinkPathDetail1, getRoutePath, getLinkPath1,requestAd,Test};

+ 0 - 26
composables/useSeo.ts

@@ -1,26 +0,0 @@
-// import { useSeoMeta } from '#imports'; // Nuxt 3 提供的 composables
-
-// const seoSetup = function(title: string, description: string, keywords: string){
-//   // 使用 useSeoMeta 设置 SEO 相关的 meta 标签
-//   useSeoMeta({
-//     title,
-//     description,
-//     keywords,
-//   });
-// };
-
-// export {seoSetup};
-
-import { useHead } from '#imports'; // Nuxt 3 提供的 composables
-
-const seoSetup = (title: string, description: string, keywords: string) => {
-  useHead({
-    title: title,
-    meta: [
-      { name: 'description', content: description },
-      { name: 'keywords', content: keywords }
-    ]
-  });
-};
-
-export {seoSetup};

+ 2 - 2
middleware/setup.global.js

@@ -87,7 +87,7 @@ function parseRoute(url) {
 //获得路由白名单列表
 function getRouteWhiteList(path){
     if(path=='/'){
-        console.log('白名单路由!允许访问!')
+        console.log('该路由允许访问!')
         //如果用户进入的是首页,直接返回true
         return true
     }else{
@@ -104,7 +104,7 @@ function getRouteWhiteList(path){
         ]
 
         if(whiteList.includes(parts[0])){
-            console.log('白名单路由!允许访问!')
+            console.log('该路由允许访问!!')
             return true
         }else{
             return false

+ 24 - 32
pages/[dir]/index.html.vue

@@ -15,47 +15,39 @@
 </template>
 
 <script setup>
-//0.pinia单基本信息 start---------------------------------------->
+//0.获得基本信息单元 start---------------------------------------->
 //0.1获得pinia源
 import { useTemplateBaseStore } from '@/stores/templateBase'
 const templateBaseStore = useTemplateBaseStore()
 //0.2获得该页的皮肤id - 在每个组件中也是同样的获得方法
 const skinId = ref("")
 //0.3获得站点基本信息
-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)
-        skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
-    }
+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)
+    //0.3.2设置皮肤id
+    skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
 }
-getTemplateBaseInfo();
 //0.4获得广告池
-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)
-        //获取广告
-        //adImg.value = requestAd(templateBaseStore.webAdList,templateBaseStore.webSiteInfo.website_head.ad_key + "_" + "top")
-    }
+const adResponseStatus = await requestDataPromise('/web/getWebsiteAdvertisement', {
+    method: 'GET',
+    query: {},
+});
+if (adResponseStatus.code == 200) {
+    //console.log(responseStatus.data)
+    templateBaseStore.setAdList(adResponseStatus.data)
+    //获取广告
+    //adImg.value = requestAd(templateBaseStore.webAdList,templateBaseStore.webSiteInfo.website_head.ad_key + "_" + "top")
 }
-getAdList();
-//0.5设置seo信息
-
-//0.pinia单基本信息 end---------------------------------------->
+//0.获得基本信息单元 end---------------------------------------->
 
 //1.加载页面依赖 start ---------------------------------------->
 import { ref, onMounted } from 'vue';

+ 36 - 57
pages/index.vue

@@ -433,48 +433,52 @@
 </template>
 
 <script setup>
-//0.pinia单基本信息 start---------------------------------------->
+//0.获得基本信息单元 start---------------------------------------->
 //0.1获得pinia源
 import { useTemplateBaseStore } from '@/stores/templateBase'
 const templateBaseStore = useTemplateBaseStore()
 //0.2获得该页的皮肤id - 在每个组件中也是同样的获得方法
 const skinId = ref("")
 //0.3获得站点基本信息
-let getTemplateBaseInfo = async () => {
-    const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
-        method: 'GET',
-        query: {
-            'link_textnum':24,
-            'link_imgnum':18,
-            'link_footnum':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)
+    //0.3.2设置皮肤id
+    skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_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 }
+        ]
     });
-    if (responseStatus.code == 200) {
-        templateBaseStore.setWebSiteInfo(responseStatus.data)
-        skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
-    }
 }
-getTemplateBaseInfo();
 //0.4获得广告池
-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)
-        //获取广告
-        //adImg.value = requestAd(templateBaseStore.webAdList,templateBaseStore.webSiteInfo.website_head.ad_key + "_" + "top")
-    }
+const adResponseStatus = await requestDataPromise('/web/getWebsiteAdvertisement', {
+    method: 'GET',
+    query: {},
+});
+if (adResponseStatus.code == 200) {
+    //console.log(responseStatus.data)
+    templateBaseStore.setAdList(adResponseStatus.data)
+    //获取广告
+    //adImg.value = requestAd(templateBaseStore.webAdList,templateBaseStore.webSiteInfo.website_head.ad_key + "_" + "top")
 }
-getAdList();
-//0.5设置seo信息
-
-
-//0.pinia单基本信息 end---------------------------------------->
+//0.获得基本信息单元 end---------------------------------------->
 
 //1.加载页面必备组件 start---------------------------------------->
 import { ref, onMounted } from 'vue';
@@ -483,31 +487,6 @@ import { ElMessage } from 'element-plus';
 
 //2.页面数据 start---------------------------------------->
 //2.页面数据 end---------------------------------------->
-
-//5.设置seo数据 start---------------------------------------->
-//获取seo数据
-const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
-    method: 'GET',
-    query: {},
-});
-if (setData.code == 200) {
-    let seoTitle = setData.data.website_head.title;
-    let seoDescription = setData.data.website_head.description;
-    let seoKeywords = setData.data.website_head.keywords;
-    let seoSuffix = setData.data.website_head.suffix;
-    let seoName = setData.data.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 }
-        ]
-    });
-} else {
-    //console.log("设置首页SEO出错!", setData.message)
-}
-//5.设置seo数据 start---------------------------------------->
 </script>
 
 <style lang="less" scoped>

+ 22 - 17
plugins/globals.js

@@ -1,21 +1,26 @@
 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')
+    let currentDomain = '';
+    const url = useRequestURL();
+    currentDomain = url.origin;
+    console.log("当前运行的域名:" + currentDomain)
+    
+    //农民网Pre环境
+    nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
+    nuxtApp.provide('CwebUrl', currentDomain)
+    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')
-  // nuxtApp.provide('CwebUrl', 'http://nwdev.bjzxtw.org.cn')
-  // nuxtApp.provide('BwebUrl', 'http://admindev.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')
+    // nuxtApp.provide('BwebUrl', 'http://admindev.bjzxtw.org.cn')
+    // nuxtApp.provide('userUrl', 'http://localhost:3000')
 })