瀏覽代碼

修改bug

修改bug
dangyunlong 1 月之前
父節點
當前提交
cd7e2b173b
共有 1 個文件被更改,包括 47 次插入43 次删除
  1. 47 43
      components/home/pageHead.vue

+ 47 - 43
components/home/pageHead.vue

@@ -15,21 +15,21 @@
                 <div class="right">
                     <div class="menu">
                         <button class="reg" @click="goTopic">
-                            <img src="../../public/head/topicon1.png" alt="商圈">
+                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon1.png" alt="商圈">
                             商圈
                         </button>
                         <button class="reg" @click="goAdvertising">
-                            <img src="../../public/head/topicon2.png" alt="广告服务">
+                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon2.png" alt="广告服务">
                             广告服务
                         </button>
                     </div>
                     <div class="right-top-menu">
                         <button class="reg" @click="goLogin" v-show="!showToken">
-                            <img src="../../public/head/topicon3.png" alt="登录">
+                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon3.png" alt="登录">
                             登录
                         </button>
                         <button class="reg" @click="goRegister" v-show="!showToken">
-                            <img src="../../public/head/topicon4.png" alt="注册">
+                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/topicon4.png" alt="注册">
                             注册
                         </button>
                         <el-popover placement="top-start" :width="100" trigger="click" algin="center">
@@ -43,7 +43,7 @@
                             <p class="exit" @click="exit">退出</p>
                         </el-popover>
                         <button class="reg" @click="goSearch">
-                            <img src="../../public/head/searchicon.png" alt="搜索">
+                            <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/searchicon.png" alt="搜索">
                             搜索
                         </button>
                     </div>
@@ -54,20 +54,13 @@
         <div class="headerLogo">
             <div class="inner">
                 <img src="../../public/index/headLogo.png" alt="乡村网" class="left" @click="backHome">
-                <!-- <div class="titlead">
-                    <a href="http://www.baidu.com">
-                        <img src="../../public/index/ad1.png" alt="">
-                    </a>                 
-                </div> -->
-                <div class="titlead" v-if="adImg.thumb||adImg.image_src">
-                    <a :href="adImg.image_url" title="乡村网_广告位" v-if="adImg.image_url">
-                        <img :src="adImg.thumb" alt="乡村网_广告位" v-if="!adImg.image_src">
-                        <img :src="adImg.image_src" alt="乡村网_广告位" v-if="adImg.image_src">
+                <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>     
-                    <a href="http://sannongdy.org.cn/" title="乡村网_广告位" v-else>
-                        <img :src="adImg.thumb" alt="乡村网_广告位" v-if="!adImg.image_src">
-                        <img :src="adImg.image_src" alt="乡村网_广告位" v-if="adImg.image_src">
-                    </a>              
+                    <a :href="adImg.image_url" title="三农资讯网_广告位1" v-else>
+                        <img :src="adImg.image_src" alt="三农资讯网_广告位1">
+                    </a>
                 </div>
             </div>
         </div>
@@ -94,7 +87,8 @@ import { ref, onMounted, watch } from 'vue'
 import { ElPopover, ElDialog } from 'element-plus'
 import { getToken, setToken, removeToken } from '@/store/useCookieStore'
 import { setTicket, removeTicket } from '@/store/useticketStore'
-const { $webUrl, $CwebUrl, $BwebUrl } = useNuxtApp()
+
+const { $webUrl, $CwebUrl, $BwebUrl} = useNuxtApp()
 //1.加载基本依赖 end ---------------------------------------->
 
 //1.登录逻辑 start ---------------------------------------->
@@ -117,7 +111,7 @@ definePageMeta({
 //搜索框
 let keyword = useState('keyword', () => '')
 //用户名
-let username = useState('username', () => '')
+let username = useState('username', () => '用户中心')
 //是否删除
 let isDel = useState('isDel', () => 1)
 //是否显示用户中心
@@ -136,10 +130,11 @@ console.log(tokenStatus.value);
 let goLogin = () => {
     isDel.value = 0
     token1.value = getToken()
-    window.location.href = $BwebUrl + "/auth/login.php?backurl=" + $CwebUrl;
+    window.open($BwebUrl + "/auth/login.php?backurl=" + $CwebUrl, '_blank');
+    
+    // window.location.href = $BwebUrl + "/auth/login.php?backurl=" + $CwebUrl;
     //"http://adminpre.bjzxtw.org.cn/auth/login.php?backurl=http://nwpre.bjzxtw.org.cn";
-
-    token1.value = getToken()
+    //token1.value = getToken()
     // navigateTo.back()
 }
 let dialogTableVisible = ref(false)
@@ -168,7 +163,7 @@ let getUserInfo = async () => {
     });
     console.log('用户信息:', responseStatus);
     //如果能拿到信息,就赋值给username
-    if(responseStatus.data){
+    if(responseStatus.code==200){
         username.value = responseStatus.data.nickname
     }
 }
@@ -176,7 +171,8 @@ getUserInfo();
 
 //获取登录状态
 let getLoginStatus = async () => {
-    let url = $BwebUrl + '/auth/loginstatus.php'
+    //let url = $BwebUrl + '/auth/loginstatus.php' //王鹏
+    let url = $webUrl + '/api/loginStatus' //刘佳伟
     const responseStatus =  await requestDataWebUrl( url, {
         method: 'GET',
         query: {
@@ -196,41 +192,55 @@ let getLoginStatus = async () => {
         exit();
     }
 }
-getLoginStatus();
+//getLoginStatus();
+
 //2.登录逻辑 end ---------------------------------------->
 
+
+
 //3.跳转菜单逻辑 start ---------------------------------------->
 let gotosystem = () => {
     let url = $BwebUrl + '/#/login?userurl=' + $CwebUrl;
-    window.location.href = url;
+    //window.location.href = url; 
+    window.open(url, '_blank');
 }
+
 //点击退出按钮
 let exit = () => {
     window.location.href = $CwebUrl;
+
     isDel.value = 1
     token1.value = getToken()
+
     let url = $BwebUrl + '/auth/logout.php?backurl=' + $CwebUrl + '&admintoken=' + token1;
     window.location.href = url;
     removeToken()
     removeTicket()
 }
+
 //点击返回首页
 let backHome = () => {
     window.location.href = $CwebUrl;
 }
+
 //点击搜索按钮
 let goSearch = () => {
     const route = `/search/search?keyword=${keyword.value}`;
-    window.open(route, '_blank');
+    window.location.href = route;
 }
+
 // 点击广告服务
 let goAdvertising = () => {
+    //本地启动广告服务
+    //window.open('/advertising?activeName=1', '_blank');
+    //线上启动
     if (getToken()) {
-        window.open($CwebUrl + '/advertising?activeName=${1}', '_blank');
+        window.open($CwebUrl + '/advertising?activeName=1', '_blank');
     } else {
         goLogin()
     }
 }
+
 //点击商圈
 let goTopic = () => {
     if (getToken()) {
@@ -240,6 +250,7 @@ let goTopic = () => {
         goLogin()
     }
 }
+
 //监听token状态
 watch(token1, (newval, oldval) => {
     console.log(newval, oldval);
@@ -250,26 +261,19 @@ watch(token1, (newval, oldval) => {
 })
 //3.跳转菜单逻辑 end ---------------------------------------->
 
+
 //4.获取广告 start ---------------------------------------->
 //let adList = ref([]);
 let adImg = ref({})
-const {data:adData,error:adError} = requestData('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'INDEDX'}});
-if (adError.value) {
-    console.error('广告列表请求失败:', adError.value);
-} else {
-    console.log(9999)
-    console.log(adData)
-    if (adData.value && adData.value.data) {
-        //根据tag查询指定的广告位
-        for(let item of adData.value.data){
-            if(item.ad_tag == 'SNZXWT_INDEDX_0001'){
-                adImg.value = item;
-                console.log(adImg.value.thumb)
-                console.log(101010)
-            }
+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;
         }
     }
 }
+getAdData();
 //4.获取广告 end ---------------------------------------->
 </script>