Browse Source

修改bug

Jing 1 day ago
parent
commit
079f208aa1

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

@@ -1 +1 @@
-{"id":"673b03ea-089f-4118-ba58-9599fd4eb4ab","timestamp":1745473937321}
+{"id":"a9f62d15-969a-4c2e-92a5-984f5e63c345","timestamp":1745732338402}

+ 0 - 1
.nuxt/manifest/meta/673b03ea-089f-4118-ba58-9599fd4eb4ab.json

@@ -1 +0,0 @@
-{"id":"673b03ea-089f-4118-ba58-9599fd4eb4ab","timestamp":1745473937321,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 1 - 0
.nuxt/manifest/meta/a9f62d15-969a-4c2e-92a5-984f5e63c345.json

@@ -0,0 +1 @@
+{"id":"a9f62d15-969a-4c2e-92a5-984f5e63c345","timestamp":1745732338402,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 1 - 1
.nuxt/tsconfig.json

@@ -102,7 +102,7 @@
         "./imports"
       ],
       "#app-manifest": [
-        "./manifest/meta/673b03ea-089f-4118-ba58-9599fd4eb4ab.json"
+        "./manifest/meta/a9f62d15-969a-4c2e-92a5-984f5e63c345.json"
       ],
       "#components": [
         "./components"

+ 164 - 162
assets/css/about.less

@@ -1,166 +1,167 @@
 //导航条
 .breadcrumb {
-  width: 1200px;
-  margin: 0 auto;
-  height: 22px;
-  padding-bottom: 40px;
-  margin-top: 40px;
-  margin-bottom: 60px;
-  border-bottom: 1px solid #d9d9d9;
-  font-family: Microsoft YaHei, Microsoft YaHei;
-  font-weight: 400;
-  font-size: 20px;
-  color: #666666;
-  line-height: 23px;
-  text-align: left;
-  font-style: normal;
-  text-transform: none;
-
-  .el-breadcrumb::v-deep {
-      display: inline-block;
-      vertical-align: -4px;
-  }
-
-  /deep/.el-breadcrumb__inner a,
-  /deep/.el-breadcrumb__inner.is-link {
-      color: #666666;
-      font-weight: 400;
-      text-decoration: none;
-      transition: var(--el-transition-color);
-  }
-
-  span {
-      font-family: Microsoft YaHei, Microsoft YaHei;
-      font-weight: 400;
-      font-size: 20px;
-      color: #666666;
-      line-height: 23px;
-      text-align: left;
-      font-style: normal;
-      text-transform: none;
-  }
-
-  span:hover {
-      color: #666666;
-  }
-
-  .location {
-      margin-right: 20px;
-      width: 100px;
-      height: 22px;
-      font-family: Microsoft YaHei, Microsoft YaHei;
-      font-weight: 400;
-      font-size: 20px;
-      color: #666666;
-      line-height: 23px;
-      text-align: left;
-      font-style: normal;
-      text-transform: none;
-  }
+    width: 1200px;
+    margin: 0 auto;
+    height: 22px;
+    padding-bottom: 40px;
+    margin-top: 40px;
+    margin-bottom: 60px;
+    border-bottom: 1px solid #d9d9d9;
+    font-family: Microsoft YaHei, Microsoft YaHei;
+    font-weight: 400;
+    font-size: 20px;
+    color: #666666;
+    line-height: 23px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    .el-breadcrumb::v-deep {
+        display: inline-block;
+        vertical-align: -4px;
+    }
+
+    /deep/.el-breadcrumb__inner a,
+    /deep/.el-breadcrumb__inner.is-link {
+        color: #666666;
+        font-weight: 400;
+        text-decoration: none;
+        transition: var(--el-transition-color);
+    }
+
+    span {
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-weight: 400;
+        font-size: 20px;
+        color: #666666;
+        line-height: 23px;
+        text-align: left;
+        font-style: normal;
+        text-transform: none;
+    }
+
+    span:hover {
+        color: #666666;
+    }
+
+    .location {
+        margin-right: 20px;
+        width: 100px;
+        height: 22px;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-weight: 400;
+        font-size: 20px;
+        color: #666666;
+        line-height: 23px;
+        text-align: left;
+        font-style: normal;
+        text-transform: none;
+    }
 }
 
 // 资讯列表
 .newsDetail {
-  width: 100%;
-  // height: 1400px;
-  // margin-bottom: 70px;
-
-  .inner {
-      width: 1200px;
-      font-size: 16px;
-      position: relative;
-
-      .innerDetail {
-          width: 1080px;
-          margin: 0 auto;
-          margin-bottom: 60px;
-          min-height: 600px;
-
-          .headImg {
-              width: 1086px;
-              height: 10px;
-              background: url("@/public/special/head11.png") no-repeat 100% 100%;
-          }
-
-          .footImg {
-              width: 1086px;
-              height: 7px;
-              background: url("@/public/special/foot01.png") no-repeat 100% 100%;
-          }
-
-          .innerDetail1 {
-              width: 1086px;
-              margin: 0 auto;
-              padding: 30px 50px 40px;
-              box-sizing: border-box;
-              border-left: 1px solid #DBBE9E;
-              background: url("@/public/special/mid01.png") repeat-y 100% 100%;
-          }
-
-         .leftBottom::v-deep {
-              font-size: 16px;
-              line-height: 40px;  
-         }
-      }
-
-
-
-      .innerLeft {
-          width: 279px;
-          position: absolute;
-          top: 3px;
-          left: -155px;
-
-          .rightMenuTitle {
-              width: 279px;
-              height: 69px;
-              font-size: 22px;
-              font-weight: bold;
-              line-height: 58px;
-              text-align: center;
-              color: #fff;
-              background: url("@/public/special/projectMoreTitle.png") no-repeat;
-              margin-bottom: 30px;
-          }
-
-          ul {
-              li {
-                  a {
-                      display: inline-block;
-                      width: 144px;
-                      height: 60px;
-                      line-height: 60px;
-                      text-align: center;
-                      background-color: #F4F4F4;
-                      border-top: 1px #fff solid;
-                      font-family: Microsoft YaHei, Microsoft YaHei;
-                      font-weight: 400;
-                      font-size: 16px;
-                      color: #000000;
-                  }
-              }
-
-              li:nth-child(1) {
-                  width: 144px;
-                  height: 60px;
-                  line-height: 60px;
-                  text-align: center;
-                  background-color: #F4F4F4;
-                  border-top: 1px #fff solid;
-                  font-family: Microsoft YaHei, Microsoft YaHei;
-                  font-weight: 400;
-                  font-size: 16px;
-                  color: #dd7d18;
-              }
-
-          }
-
-          .active {
-              background: #dd7d18;
-              color: #fff;
-          }
-      }
-  }
+    width: 100%;
+    // height: 1400px;
+    // margin-bottom: 70px;
+
+    .inner {
+        width: 1200px;
+        font-size: 16px;
+        position: relative;
+
+        .innerDetail {
+            width: 1080px;
+            margin: 0 auto;
+            margin-bottom: 60px;
+            min-height: 600px;
+
+            .headImg {
+                width: 1086px;
+                height: 10px;
+                background: url("@/public/special/head11.png") no-repeat 100% 100%;
+            }
+
+            .footImg {
+                width: 1086px;
+                height: 7px;
+                background: url("@/public/special/foot01.png") no-repeat 100% 100%;
+            }
+
+            .innerDetail1 {
+                width: 1086px;
+                min-height: 600px;
+                margin: 0 auto;
+                padding: 30px 50px 40px;
+                box-sizing: border-box;
+                border-left: 1px solid #DBBE9E;
+                background: url("@/public/special/mid01.png") repeat-y 100% 100%;
+            }
+
+            .leftBottom::v-deep {
+                font-size: 16px;
+                line-height: 40px;
+            }
+        }
+
+
+
+        .innerLeft {
+            width: 279px;
+            position: absolute;
+            top: 3px;
+            left: -155px;
+
+            .rightMenuTitle {
+                width: 279px;
+                height: 69px;
+                font-size: 22px;
+                font-weight: bold;
+                line-height: 58px;
+                text-align: center;
+                color: #fff;
+                background: url("@/public/special/projectMoreTitle.png") no-repeat;
+                margin-bottom: 30px;
+            }
+
+            ul {
+                li {
+                    a {
+                        display: inline-block;
+                        width: 144px;
+                        height: 60px;
+                        line-height: 60px;
+                        text-align: center;
+                        background-color: #F4F4F4;
+                        border-top: 1px #fff solid;
+                        font-family: Microsoft YaHei, Microsoft YaHei;
+                        font-weight: 400;
+                        font-size: 16px;
+                        color: #000000;
+                    }
+                }
+
+                li:nth-child(1) {
+                    width: 144px;
+                    height: 60px;
+                    line-height: 60px;
+                    text-align: center;
+                    background-color: #F4F4F4;
+                    border-top: 1px #fff solid;
+                    font-family: Microsoft YaHei, Microsoft YaHei;
+                    font-weight: 400;
+                    font-size: 16px;
+                    color: #dd7d18;
+                }
+
+            }
+
+            .active {
+                background: #dd7d18;
+                color: #fff;
+            }
+        }
+    }
 }
 
 //本网招聘
@@ -193,11 +194,12 @@
 }
 
 .list {
-        height: 570px;
-        margin-bottom: 70px;
-        padding-bottom: 10px;
-        margin-top: 10px;
-        >li {
+    height: 570px;
+    margin-bottom: 70px;
+    padding-bottom: 10px;
+    margin-top: 10px;
+
+    >li {
         width: 790px;
         height: 60px;
         white-space: nowrap;

+ 53 - 44
components/home/pageHead.vue

@@ -26,7 +26,7 @@
                         </button>
                         <button class="reg" @click="userCenter" v-show="showToken">
                             <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon3.png" alt="用户信息">{{
-                            username }}
+                                username }}
                         </button>
                         <button class="reg" @click="goSearch">
                             <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/searchicon.png" alt="搜索">搜索
@@ -155,17 +155,17 @@ let userCenter = () => {
 
 // 添加点击事件处理函数
 const handleClickOutside = (event) => {
-  // 获取用户信息菜单元素
-  const userInfoMenu = document.querySelector('.userInfo11');
-  // 获取用户按钮元素
-  const userButton = document.querySelector('.reg img[alt="用户信息"]')?.parentElement;
-  
-  // 如果点击的不是菜单本身且不是用户按钮,则隐藏菜单
-  if (userInfoMenu && 
-      !userInfoMenu.contains(event.target) && 
-      !userButton?.contains(event.target)) {
-    isShow.value = false;
-  }
+    // 获取用户信息菜单元素
+    const userInfoMenu = document.querySelector('.userInfo11');
+    // 获取用户按钮元素
+    const userButton = document.querySelector('.reg img[alt="用户信息"]')?.parentElement;
+
+    // 如果点击的不是菜单本身且不是用户按钮,则隐藏菜单
+    if (userInfoMenu &&
+        !userInfoMenu.contains(event.target) &&
+        !userButton?.contains(event.target)) {
+        isShow.value = false;
+    }
 }
 //2.登录逻辑 end ---------------------------------------->
 
@@ -184,7 +184,7 @@ let exit = () => {
     token1.value = getToken()
 
     let tokendata = getToken()
-  
+
     //王鹏
     // let url = $BwebUrl + '/auth/logout.php?backurl=' + $CwebUrl + '&admintoken=' + tokendata;
     //   console.log("用户退出登录======token为:", tokendata,url)
@@ -257,7 +257,7 @@ let adImg = ref({})
 //5.获取登录状态 start ---------------------------------------->
 // 在组件卸载时移除事件监听
 onUnmounted(() => {
-  document.removeEventListener('click', handleClickOutside);
+    document.removeEventListener('click', handleClickOutside);
 })
 
 onMounted(async () => {
@@ -267,43 +267,52 @@ 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) {
+
+        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) {
                 console.log("用户已经登录!");
                 showToken.value = true;
-
-            } else {
-                console.log("用户未登录!");
+            }
+            if (result.code == -1) {
+                isShow.value = false;
                 showToken.value = false;
-                //退出登录
+                removeToken();
+                removeTicket();
+                ElMessage.error('您没有权限登录该网站!')
+            }
+            if (result.code == -2) {
                 isShow.value = false;
+                showToken.value = false;
                 removeToken();
                 removeTicket();
+                ElMessage.error('您已退出登录!')
             }
-        } else {
-            console.log("用户已退出登录!");
-            //退出登录
-            isShow.value = false;
-            showToken.value = false;
-            removeToken();
-            removeTicket();
         }
     }
     getLoginStatus();
@@ -342,5 +351,5 @@ onMounted(async () => {
 </script>
 
 <style lang="less" scoped>
-    @import url('@/assets/css/public/head.less');
+@import url('@/assets/css/public/head.less');
 </style>

+ 25 - 21
composables/publicFunction.ts

@@ -1,34 +1,34 @@
 //1.格式化日期 start ---------------------------------------->
 //time 日期字符串 type 从什么时候开始返回 year = 返回年月日 month = 返回月日..
 //style 样式,比如 年-月-日 年.月.日
-const getTime = function(time:string,type:string,style:Number){
+const getTime = function (time: string, type: string, style: Number) {
   const date = new Date(time);
   const year = date.getFullYear();
   const month = date.getMonth() + 1;
   const day = date.getDate();
 
   //返回 年-月-日
-  if(type == 'year'&& style == 1){
+  if (type == 'year' && style == 1) {
     return `${year}-${month}-${day}`;
   }
   //返回 年-月
-  if(type == 'year'&& style == 2){
+  if (type == 'year' && style == 2) {
     return `${year}-${month}`;
   }
   //返回 年
-  if(type == 'year'&& style == 3){
+  if (type == 'year' && style == 3) {
     return `${year}`;
   }
   //返回 月-日
-  if(type == 'month'&& style == 1){
+  if (type == 'month' && style == 1) {
     return `${month}-${day}`;
   }
   //返回 月.日
-  if(type == 'month'&& style == 2){
+  if (type == 'month' && style == 2) {
     return `${month}.${day}`;
   }
   //返回 日
-  if(type == 'day'&& style == 1){
+  if (type == 'day' && style == 1) {
     return `${day}`;
   }
 }
@@ -36,10 +36,10 @@ const getTime = function(time:string,type:string,style:Number){
 
 //2.格式化标题长度 start ---------------------------------------->
 //title 标题 length 长度
-const getTitleLength = function(title:string,length:number){
-  if(title.length >= length){
+const getTitleLength = function (title: string, length: number) {
+  if (title.length >= length) {
     return title.substring(0, length) + "...";
-  }else{
+  } else {
     return title;
   }
 }
@@ -47,26 +47,30 @@ 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`;
+const getLinkPath = (item: any) => {
+  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 `/${item.aLIas_pinyin}/index.html`;
+    //return `/primaryNavigation/${item.aLIas_pinyin}/`;
+    return `/${item.aLIas_pinyin}/index.html`;
   }
 }
 //3.2跳转到详情页
-const getLinkPathDetail = (item:any) => {
+const getLinkPathDetail = (item: any) => {
   if (item.islink == 1) {
-      return `${item.linkurl}`;
+    return `${item.linkurl}`;
   } else {
-      return `/${item.pinyin}/${item.id}.html`;
+    return `/${item.pinyin}/${item.id}.html`;
   }
 }
 //3.格式化跳转路径 end ---------------------------------------->
 
 
 //4.获得路由路径 start ---------------------------------------->
-const getRoutePath = (type:Number) => {
+const getRoutePath = (type: Number) => {
   const route = useRoute();
   //获得当前的完整路径
   const fullPath = route.path;
@@ -75,10 +79,10 @@ const getRoutePath = (type:Number) => {
   const targetSegmentOne = segments[1];
   const targetSegmentTwo = segments[2];
 
-  if(type == 1){
+  if (type == 1) {
     return targetSegmentOne;
   }
-  if(type == 2){
+  if (type == 2) {
     return targetSegmentTwo;
   }
 }
@@ -86,4 +90,4 @@ const getRoutePath = (type:Number) => {
 
 
 //4.获得路由路径 end ---------------------------------------->
-export { getTime,getTitleLength,getLinkPath,getLinkPathDetail,getRoutePath};
+export { getTime, getTitleLength, getLinkPath, getLinkPathDetail, getRoutePath };