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

增加导航外链的判断

增加导航外链的判断
dangyunlong 4 өдөр өмнө
parent
commit
c55375a913

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 979
.nuxt/dev/index.mjs


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
.nuxt/dev/index.mjs.map


+ 0 - 1
.nuxt/imports.d.ts

@@ -31,5 +31,4 @@ export { injectHead, useHead, useSeoMeta, useHeadSafe, useServerHead, useServerS
 export { requestData, requestDataPromise, requestDataWebUrl, requestHome } from '../composables/getData';
 export { getTime, getTitleLength, getLinkPath, getLinkPathDetail, getRoutePath } from '../composables/publicFunction';
 export { seoSetup } from '../composables/useSeo';
-export { useNuxtDevTools } from '../node_modules/@nuxt/devtools/dist/runtime/use-nuxt-devtools';
 export { definePageMeta } from '../node_modules/nuxt/dist/pages/runtime/composables';

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

@@ -1 +1 @@
-{"id":"dev","timestamp":1745483218375}
+{"id":"ecadd406-112f-4261-b781-58f0ff14009c","timestamp":1745568279917}

+ 0 - 1
.nuxt/manifest/meta/3ffdccc0-dceb-435e-87b4-0bd8d3aeac6a.json

@@ -1 +0,0 @@
-{"id":"3ffdccc0-dceb-435e-87b4-0bd8d3aeac6a","timestamp":1745481382997,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

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

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

+ 1 - 0
.nuxt/manifest/meta/ecadd406-112f-4261-b781-58f0ff14009c.json

@@ -0,0 +1 @@
+{"id":"ecadd406-112f-4261-b781-58f0ff14009c","timestamp":1745568279917,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 0 - 17
.nuxt/nitro.json

@@ -1,17 +0,0 @@
-{
-  "date": "2025-04-24T08:27:01.208Z",
-  "preset": "nitro-dev",
-  "framework": {
-    "name": "nuxt",
-    "version": "3.15.2"
-  },
-  "versions": {
-    "nitro": "2.10.4"
-  },
-  "dev": {
-    "pid": 5288,
-    "workerAddress": {
-      "socketPath": "\\\\.\\pipe\\nitro\\worker-5288-1.sock"
-    }
-  }
-}

+ 0 - 9
.nuxt/nuxt.json

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

+ 1 - 1
.nuxt/tsconfig.json

@@ -102,7 +102,7 @@
         "./imports"
       ],
       "#app-manifest": [
-        "./manifest/meta/dev.json"
+        "./manifest/meta/ecadd406-112f-4261-b781-58f0ff14009c.json"
       ],
       "#components": [
         "./components"

+ 0 - 1
.nuxt/types/build.d.ts

@@ -11,7 +11,6 @@ declare module "#build/paths.mjs";
 declare module "#build/root-component.mjs";
 declare module "#build/plugins.server.mjs";
 declare module "#build/test-component-wrapper.mjs";
-declare module "#build/devtools/settings.mjs";
 declare module "#build/routes.mjs";
 declare module "#build/pages.mjs";
 declare module "#build/router.options.mjs";

+ 0 - 2
.nuxt/types/imports.d.ts

@@ -122,7 +122,6 @@ declare global {
   const useModel: typeof import('vue')['useModel']
   const useNuxtApp: typeof import('../../node_modules/nuxt/dist/app/nuxt')['useNuxtApp']
   const useNuxtData: typeof import('../../node_modules/nuxt/dist/app/composables/asyncData')['useNuxtData']
-  const useNuxtDevTools: typeof import('../../node_modules/@nuxt/devtools/dist/runtime/use-nuxt-devtools')['useNuxtDevTools']
   const usePreviewMode: typeof import('../../node_modules/nuxt/dist/app/composables/preview')['usePreviewMode']
   const useRequestEvent: typeof import('../../node_modules/nuxt/dist/app/composables/ssr')['useRequestEvent']
   const useRequestFetch: typeof import('../../node_modules/nuxt/dist/app/composables/ssr')['useRequestFetch']
@@ -310,7 +309,6 @@ declare module 'vue' {
     readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
     readonly useNuxtApp: UnwrapRef<typeof import('../../node_modules/nuxt/dist/app/nuxt')['useNuxtApp']>
     readonly useNuxtData: UnwrapRef<typeof import('../../node_modules/nuxt/dist/app/composables/asyncData')['useNuxtData']>
-    readonly useNuxtDevTools: UnwrapRef<typeof import('../../node_modules/@nuxt/devtools/dist/runtime/use-nuxt-devtools')['useNuxtDevTools']>
     readonly usePreviewMode: UnwrapRef<typeof import('../../node_modules/nuxt/dist/app/composables/preview')['usePreviewMode']>
     readonly useRequestEvent: UnwrapRef<typeof import('../../node_modules/nuxt/dist/app/composables/ssr')['useRequestEvent']>
     readonly useRequestFetch: UnwrapRef<typeof import('../../node_modules/nuxt/dist/app/composables/ssr')['useRequestFetch']>

+ 2 - 7
.nuxt/types/plugins.d.ts

@@ -9,17 +9,12 @@ type NuxtAppInjections =
   InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/revive-payload.client.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/head/runtime/plugins/unhead.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/router.js")> &
-  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/browser-devtools-timing.client.js")> &
+  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/payload.client.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/navigation-repaint.client.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/check-outdated-build.client.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/revive-payload.server.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/chunk-reload.client.js")> &
   InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/prefetch.client.js")> &
-  InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/check-if-page-unused.js")> &
-  InjectionType<typeof import("../../node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.server.js")> &
-  InjectionType<typeof import("../../node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.client.js")> &
-  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/dev-server-logs.js")> &
-  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/check-if-layout-used.js")> &
   InjectionType<typeof import("../../plugins/element-plus")> &
   InjectionType<typeof import("../../plugins/request")> &
   InjectionType<typeof import("../../plugins/category")> &
@@ -30,7 +25,7 @@ declare module '#app' {
   interface NuxtApp extends NuxtAppInjections { }
 
   interface NuxtAppLiterals {
-    pluginName: 'nuxt:revive-payload:client' | 'nuxt:head' | 'nuxt:router' | 'nuxt:browser-devtools-timing' | 'nuxt:revive-payload:server' | 'nuxt:chunk-reload' | 'nuxt:global-components' | 'nuxt:prefetch' | 'nuxt:checkIfPageUnused' | 'nuxt:checkIfLayoutUsed'
+    pluginName: 'nuxt:revive-payload:client' | 'nuxt:head' | 'nuxt:router' | 'nuxt:payload' | 'nuxt:revive-payload:server' | 'nuxt:chunk-reload' | 'nuxt:global-components' | 'nuxt:prefetch'
   }
 }
 

+ 46 - 30
components/home/pageHead.vue

@@ -162,6 +162,7 @@ let userCenter = () => {
 //3.跳转菜单逻辑 start ---------------------------------------->
 let gotosystem = () => {
     let url = $BwebUrl + '/#/login?userurl=' + $CwebUrl;
+    isShow.value = false;
     //window.location.href = url; 
     window.open(url, '_blank');
 }
@@ -169,7 +170,7 @@ let gotosystem = () => {
 //点击退出按钮
 let exit = () => {
     window.location.href = $CwebUrl;
-
+    isShow.value = false;
     isDel.value = 1
     token1.value = getToken()
 
@@ -249,43 +250,58 @@ onMounted(async () => {
     //从客户端获取登录状态
     //从客户端阶段开始 持续查询登录状态
     let getLoginStatus = async () => {
+        //获得token
+        const token = getToken();
         const { $webUrl, $CwebUrl } = useNuxtApp();
-        const queryParams = new URLSearchParams({
-            token: getToken()
-        });
-        let url = `${$webUrl}/api/loginStatus?${queryParams.toString()}`
-
-        const responseStatus = await fetch(url, {
-            method: 'GET',
-            headers: {
-                'Content-Type': 'application/json',
-                'Userurl': $CwebUrl,
-                //'token': getToken(),
-                'Origin': $CwebUrl
-            }
-        });
-        const result = await responseStatus.json();
-        console.log(result)
-        if (result.code == 200) {
-            if (result.data.isLogin == true) {
-                console.log("用户已经登录!");
-                showToken.value = true;
 
+        if(token == undefined){
+            //如果没有获取到token 不访问后端获取在线状态
+            console.log("没有获取到token!无需查询登录状态!")
+            showToken.value = false;
+
+        }else{
+            //如果获取到了token 访问后端查询状态
+            console.log("已获取到用户token,开始查询登录状态!")
+            const queryParams = new URLSearchParams({
+                token: getToken()
+            });
+            let url = `${$webUrl}/api/loginStatus?${queryParams.toString()}`
+            const responseStatus = await fetch(url, {
+                method: 'GET',
+                headers: {
+                    'Content-Type': 'application/json',
+                    'Userurl': $CwebUrl,
+                    //'token': getToken(),
+                    'Origin': $CwebUrl
+                }
+            });
+            const result = await responseStatus.json();
+            console.log(result)
+            if (result.code == 200) {
+                if (result.data.isLogin == true) {
+                    console.log("用户已经登录!");
+                    showToken.value = true;
+
+                } else {
+                    console.log("用户已退出登录!");
+                    showToken.value = false;
+                    //退出登录
+                    isShow.value = false;
+                    removeToken();
+                    removeTicket();
+                    ElMessage.error('您已退出登录!')
+                }
             } else {
-                console.log("用户未登录!");
-                showToken.value = false;
+                console.log("用户已退出登录!");
                 //退出登录
                 isShow.value = false;
+                showToken.value = false;
                 removeToken();
                 removeTicket();
+                ElMessage.error('您没有权限登录该网站!')
+                //跳转到首页
+                //window.location.href = $CwebUrl;
             }
-        } else {
-            console.log("用户已退出登录!");
-            //退出登录
-            isShow.value = false;
-            showToken.value = false;
-            removeToken();
-            removeTicket();
         }
     }
     getLoginStatus();

+ 1 - 1
components/home/pageNavigation.vue

@@ -40,7 +40,7 @@
             </div>
         </div>
         <!-- 第一部分导航 end -->
-
+         
         <!-- 第二部分导航 start -->
         <div class="partTwo">
             <div class="inner">

+ 9 - 5
composables/publicFunction.ts

@@ -48,11 +48,15 @@ const getTitleLength = function(title:string,length:number){
 //3.格式化跳转路径 start ---------------------------------------->
 //3.1跳转到频道页面或者一级列表页
 const getLinkPath = (item:any) => {
-  if (item.children_count == 0) {
-      return `/${item.aLIas_pinyin}/list-1.html`;
-  } else {
-      return `/${item.aLIas_pinyin}/index.html`;
-  }
+    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`;
+    }
 }
 //3.2跳转到详情页
 const getLinkPathDetail = (item:any) => {

+ 2 - 2
plugins/category.ts

@@ -30,7 +30,7 @@ const navPre: number[] = [
 
 export default defineNuxtPlugin((nuxtApp) => {
     //master 环境
-    nuxtApp.provide('pageNav', navMaster)
+    //nuxtApp.provide('pageNav', navMaster)
     //pre 环境
-    //nuxtApp.provide('pageNav', navPre)
+    nuxtApp.provide('pageNav', navPre)
 })

+ 10 - 10
plugins/globals.ts

@@ -1,16 +1,16 @@
 export default defineNuxtPlugin((nuxtApp) => {
   //农副产品供销网pre环境
-//   nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
-//   nuxtApp.provide('CwebUrl', 'http://pre.nfcpgx.org.cn')
-//   nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
-//   nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
-//   nuxtApp.provide('userUrl', 'http://localhost:3005')
+  nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
+  nuxtApp.provide('CwebUrl', 'http://pre.nfcpgx.org.cn')
+  nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
+  nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
+  nuxtApp.provide('userUrl', 'http://localhost:3005')
 
   // 农副产品供销网正式环境
-  nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')
-  nuxtApp.provide('CwebUrl', 'http://nw.nfcpgx.org.cn')
-  nuxtApp.provide('BwebUrl', 'https://admin.bjzxtw.org.cn')
-  nuxtApp.provide('LoginWebUrl', 'http://admin.bjzxtw.org.cn/adminapi')
-  nuxtApp.provide('userUrl', 'http://localhost:3005')
+//   nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')
+//   nuxtApp.provide('CwebUrl', 'http://nw.nfcpgx.org.cn')
+//   nuxtApp.provide('BwebUrl', 'https://admin.bjzxtw.org.cn')
+//   nuxtApp.provide('LoginWebUrl', 'http://admin.bjzxtw.org.cn/adminapi')
+//   nuxtApp.provide('userUrl', 'http://localhost:3005')
 
 })

+ 4 - 4
plugins/request.ts

@@ -6,11 +6,11 @@ export default defineNuxtPlugin(() => {
 
     let Url = {
         //正式环境
-        webUrl: 'https://flzxw.bjzxtw.org.cn', //接口地址
-        CwebUrl: 'nw.bjzxtw.org.cn' //页面地址
+        // webUrl: 'https://flzxw.bjzxtw.org.cn', //接口地址
+        // CwebUrl: 'nw.bjzxtw.org.cn' //页面地址
         //pre环境
-        // webUrl: 'http://apipre1.bjzxtw.org.cn:29501', //pre接口地址
-        // CwebUrl: 'pre.nfcpgx.org.cn' //页面地址
+        webUrl: 'http://apipre1.bjzxtw.org.cn:29501', //pre接口地址
+        CwebUrl: 'pre.nfcpgx.org.cn' //页面地址
     }
 
     const service = axios.create({

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно