瀏覽代碼

增加登录状态展示

增加登录状态展示
dangyunlong 1 月之前
父節點
當前提交
7a46c6c408

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

@@ -1 +1 @@
-{"id":"ecadd406-112f-4261-b781-58f0ff14009c","timestamp":1745568279917}
+{"id":"f4e6294e-798f-4ab1-a865-3c9fc548f63f","timestamp":1745724570701}

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

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

+ 1 - 0
.nuxt/manifest/meta/f4e6294e-798f-4ab1-a865-3c9fc548f63f.json

@@ -0,0 +1 @@
+{"id":"f4e6294e-798f-4ab1-a865-3c9fc548f63f","timestamp":1745724570701,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 1 - 1
.nuxt/tsconfig.json

@@ -102,7 +102,7 @@
         "./imports"
         "./imports"
       ],
       ],
       "#app-manifest": [
       "#app-manifest": [
-        "./manifest/meta/ecadd406-112f-4261-b781-58f0ff14009c.json"
+        "./manifest/meta/f4e6294e-798f-4ab1-a865-3c9fc548f63f.json"
       ],
       ],
       "#components": [
       "#components": [
         "./components"
         "./components"

+ 13 - 19
components/home/pageHead.vue

@@ -71,7 +71,7 @@
 <script setup>
 <script setup>
 //1.加载基本依赖 start ---------------------------------------->
 //1.加载基本依赖 start ---------------------------------------->
 import { ref, watch, onMounted } from 'vue'
 import { ref, watch, onMounted } from 'vue'
-import { ElDialog } from 'element-plus'
+import { ElDialog,ElMessage } from 'element-plus'
 import { getToken, setToken, removeToken } from '@/store/useCookieStore'
 import { getToken, setToken, removeToken } from '@/store/useCookieStore'
 import { setTicket, removeTicket } from '@/store/useticketStore'
 import { setTicket, removeTicket } from '@/store/useticketStore'
 //网站地址
 //网站地址
@@ -277,30 +277,24 @@ onMounted(async () => {
             });
             });
             const result = await responseStatus.json();
             const result = await responseStatus.json();
             console.log(result)
             console.log(result)
+            
             if (result.code == 200) {
             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("用户已退出登录!");
-                //退出登录
+                console.log("用户已经登录!");
+                showToken.value = true;
+            }
+            if (result.code == -1) {
                 isShow.value = false;
                 isShow.value = false;
                 showToken.value = false;
                 showToken.value = false;
                 removeToken();
                 removeToken();
                 removeTicket();
                 removeTicket();
                 ElMessage.error('您没有权限登录该网站!')
                 ElMessage.error('您没有权限登录该网站!')
-                //跳转到首页
-                //window.location.href = $CwebUrl;
+            }
+            if (result.code == -2) {
+                isShow.value = false;
+                showToken.value = false;
+                removeToken();
+                removeTicket();
+                ElMessage.error('您已退出登录!')
             }
             }
         }
         }
     }
     }

+ 2 - 2
plugins/category.ts

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

+ 10 - 10
plugins/globals.ts

@@ -1,16 +1,16 @@
 export default defineNuxtPlugin((nuxtApp) => {
 export default defineNuxtPlugin((nuxtApp) => {
   //农副产品供销网pre环境
   //农副产品供销网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 = {
     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环境
         //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({
     const service = axios.create({