From 72dbfec77a747b9a08bc71b630464d4383877082 Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期一, 25 八月 2025 01:15:02 +0800
Subject: [PATCH] 按钮判断

---
 src/views/home/index.vue |  141 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 104 insertions(+), 37 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 3bd821d..4112f60 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -1,17 +1,13 @@
 <template>
   <div class="homePage">
-    <el-carousel :height="screenheight + 'px'">
-      <el-carousel-item v-for="(item, index) in banner" :key="index">
-        <div class="bannerBox imgBox">
-          <img id="autoHeight" class="bannerImg" :src="item.icon" @click="bannerLink(item)" />
-        </div>
-      </el-carousel-item>
-    </el-carousel>
-    <div class="contentBox" style="margin-top: 50px">
+    <div class="bannerBox imgBox">
+      <img class="bannerImg" :src="banner[0]?.icon" @click="bannerLink(item)" />
+    </div>
+    <div v-if="informationList.length > 0" class="contentBox" style="margin-top: 50px">
       <div class="informationBox">
         <div class="bookListTitle">
           <div class="title">鏂伴椈璧勮</div>
-          <div class="more">鏇村></div>
+          <div class="more" @click="toMore">鏇村></div>
         </div>
         <div class="informationList">
           <div class="informationItem" v-for="(item, index) in informationList" :key="index">
@@ -29,7 +25,7 @@
       <div class="contentBox">
         <div class="bookListTitle">
           <div class="title">鎺ㄨ崘鏁欐潗</div>
-          <div class="more">鏇村></div>
+          <div class="more" @click="toMore">鏇村></div>
         </div>
         <div class="recommendList">
           <div
@@ -43,16 +39,12 @@
             </div>
             <div class="infoBox">
               <div class="bookName">{{ item.name }}</div>
-              <div class="author">
-                浣滆�咃細{{ item.authorcaupress_author ? item.caupress_author : '-' }}
-              </div>
+              <div class="author">浣滆�咃細{{ item.author ? item.author : '-' }}</div>
               <div class="priceBox">
-                <span class="oldPrice" v-if="item.oldPrice">鍘熶环锛毬{ item.oldPrice }}</span>
                 <span class="price" v-if="item.price && item.price > 0">
-                  瀹氫环锛毬�
-                  <span>{{ item.price }}</span>
+                  <span> 楼{{ item.price }}</span>
                 </span>
-                <span class="price" v-else> 瀹氫环锛�<span class="freePrice">鍏嶈垂</span> </span>
+                <span class="oldPrice" v-if="item.oldPrice"> 楼{{ item.oldPrice }}</span>
               </div>
             </div>
           </div>
@@ -90,9 +82,10 @@
               />
             </el-tabs>
           </div>
+          <div class="more" style="margin-left: 30px; font-weight: normal" @click="toMore">
+            鏇村>
+          </div>
         </div>
-
-        <div class="more">鏇村></div>
       </div>
       <div class="recommendList">
         <div
@@ -106,16 +99,12 @@
           </div>
           <div class="infoBox">
             <div class="bookName">{{ item.name }}</div>
-            <div class="author">
-              浣滆�咃細{{ item.authorcaupress_author ? item.caupress_author : '-' }}
-            </div>
+            <div class="author">浣滆�咃細{{ item.author ? item.author : '-' }}</div>
             <div class="priceBox">
-              <span class="oldPrice" v-if="item.oldPrice">鍘熶环锛毬{ item.oldPrice }}</span>
               <span class="price" v-if="item.price && item.price > 0">
-                瀹氫环锛毬�
-                <span>{{ item.price }}</span>
+                <span>楼{{ item.price }}</span>
               </span>
-              <span class="price" v-else> 瀹氫环锛�<span class="freePrice">鍏嶈垂</span> </span>
+              <span class="oldPrice" v-if="item.oldPrice">楼{{ item.oldPrice }}</span>
             </div>
           </div>
         </div>
@@ -129,19 +118,22 @@
 import moment from 'moment'
 import { ElMessage } from 'element-plus'
 import teacherCertification from '@/views/personalCenter/teacherCertification.vue'
-import { ref, onBeforeMount, inject, reactive, onMounted } from 'vue'
+import { ref, onBeforeMount, inject, reactive, onMounted, watch } from 'vue'
 let screenheight = ref(document.documentElement.clientHeight / 2)
 import { useRouter, useRoute } from 'vue-router'
 const router = useRouter()
+const route = useRoute()
 
 const MG = inject('MG')
 const config = inject('config')
+const logIn = inject('logIn')
 const tool = inject('tool')
 const toolClass = inject('toolClass')
 const banner = reactive([])
 const informationList = reactive([])
 let classfeild = ref([])
 let activeName = ref('A1')
+let callbackLink = ref(null)
 
 let bookListData = ref([])
 let navBookList = ref([])
@@ -157,13 +149,46 @@
   }
 })
 
+// 鑾峰彇url鍙傛暟
+const getUrlParams = () => {
+  let url = window.location.href
+  let params = url.split('?')[1]
+  let paramsObj = {}
+  if (params) {
+    paramsObj = params.split('&').reduce((pre, cur) => {
+      pre[cur.split('=')[0]] = cur.split('=')[1]
+      return pre
+    }, {})
+  }
+  return paramsObj
+}
+
 onMounted(() => {
+  // 鐩戝惉鏄惁鏉ヨ嚜鏁板瓧闃呰
+  const params = getUrlParams()
+  if (params.login) {
+    localStorage.setItem('loginBack', decodeURIComponent(params.callBackUrl))
+    logIn()
+  }
   getBanner()
   classifList()
   getInformationList()
   getBookList()
   getNavBookList()
 })
+
+watch(
+  () => route, // 鐩戝惉 path 鍙樺寲
+  (newPath, oldPath) => {
+    console.log('璺敱璺緞浠�', oldPath, '鍙樹负', newPath)
+  },
+)
+
+const toMore = () => {
+  router.push({
+    path: '/bookStore',
+  })
+}
 
 const toDetail = (item) => {
   router.push({
@@ -216,6 +241,7 @@
       },
       fields: {
         'teachingLevel=': activeName.value,
+        author: [],
       },
     })
     .then((res) => {
@@ -265,7 +291,11 @@
 
 const toAuthentication = (type) => {
   if (type) {
-    teacherDialog.value = true
+    if (localStorage.getItem(config.tokenKey)) {
+      teacherDialog.value = true
+    } else {
+      logIn()
+    }
   } else {
     ElMessage({
       message: '寤鸿涓�...',
@@ -325,6 +355,27 @@
   min-height: calc(100vh - 61.8%);
   background-color: #fff;
   padding-bottom: 100px;
+
+  .bannerBox {
+    height: 615px;
+    position: relative;
+    .bannerText {
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      transform: translate(-50%, -50%);
+      font-size: 36px;
+      font-weight: 700;
+      color: #fff;
+      text-shadow: 0px 0px 10px #000000;
+      text-align: center;
+    }
+    .enText {
+      font-size: 28px;
+      opacity: 0.45;
+      margin-top: 10px;
+    }
+  }
 }
 .el-carousel__item h3 {
   color: #475669;
@@ -396,7 +447,6 @@
 .bookListBox {
   width: 100%;
   padding: 80px 0;
-  margin-top: 30px;
   background-repeat: no-repeat;
   background-size: 100% 100%;
   background-image: url('@/assets/images/tuijian-bg.png');
@@ -422,6 +472,9 @@
       margin-right: 0;
     }
   }
+  .recommendItem:hover {
+    background-image: url(@/assets/images/Mouse_fill.png);
+  }
 }
 
 .recommendItemImg {
@@ -435,21 +488,26 @@
   text-align: center;
   margin-top: 10px;
 }
+.bookName {
+  font-weight: 700;
+}
 .author {
   margin-top: 10px;
+  color: #333333;
 }
 .priceBox {
   margin-top: 10px;
   .oldPrice {
     font-size: 16px;
-    color: #444444;
+    color: #999999;
     text-decoration: line-through;
-    margin-right: 20px;
+    margin-left: 20px;
   }
   .price {
     span {
       font-weight: bold;
       font-size: 14px;
+      color: #d91523;
     }
   }
 }
@@ -461,24 +519,24 @@
   margin-top: 60px;
   margin-bottom: 60px;
   .authentication {
-    width: 40%;
-    height: 100px;
+    width: 48%;
+    height: 123px;
     background-repeat: no-repeat;
     background-size: 100% 100%;
     background-image: url('@/assets/images/xiehe/home/jiaoshirenzheng.png');
   }
   .manual {
-    width: 40%;
-    height: 100px;
+    width: 48%;
+    height: 123px;
     background-repeat: no-repeat;
     background-size: 100% 100%;
-    background-image: url('@/assets/images/xiehe/home/jiaoshirenzheng.png');
+    background-image: url('@/assets/images/xiehe/home/caozuoshouce.png');
   }
 }
 
 .titleTabs {
   margin-left: 50px;
-  width: 70%;
+  width: 85%;
 }
 .bookListTitle {
   display: flex;
@@ -512,6 +570,15 @@
     font-size: 14px;
     color: #ccc;
     margin-top: 10px;
+    line-height: 20px;
   }
 }
+
+::v-deep(.el-tabs__item) {
+  align-items: stretch;
+  height: 60px !important;
+  line-height: 20px;
+  text-align: center;
+  white-space: pre-wrap !important;
+}
 </style>

--
Gitblit v1.9.1