From 0e1ba4ddfd16602cc73d30b23679fd8772b7ada7 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期一, 25 八月 2025 00:03:10 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/xiehe_website

---
 src/assets/main.css                   |    2 
 src/views/home/index.vue              |   20 ++++
 src/layout/components/login.vue       |   20 -----
 src/views/bookStore/detail.vue        |  148 +++++++++++++++++++++++++++++++++----
 src/views/bookStore/textBookApply.vue |   23 ++++-
 src/layout/components/headerPage.vue  |    2 
 src/layout/components/footerPage.vue  |    3 
 7 files changed, 173 insertions(+), 45 deletions(-)

diff --git a/src/assets/main.css b/src/assets/main.css
index 9419e49..33888fd 100644
--- a/src/assets/main.css
+++ b/src/assets/main.css
@@ -195,6 +195,8 @@
   align-items: stretch !important;
 }
 
+
+
 .el-select__wrapper {
   height: 40px !important;
 }
diff --git a/src/layout/components/footerPage.vue b/src/layout/components/footerPage.vue
index 52d21f8..3e2ebf4 100644
--- a/src/layout/components/footerPage.vue
+++ b/src/layout/components/footerPage.vue
@@ -48,8 +48,7 @@
         >涓浗鍗忓拰鍖荤澶у鍑虹増绀炬湁闄愬叕鍙� 涓� 澶囨搴忓彿锛�<span class="beian" @click="toLink"
           >浜琁CP澶� 05029104鍙�-4浜掕仈缃戝嚭鐗堣鍙瘉 鏂板嚭缃戣瘉 锛堜含 锛�</span
         >
-        涓� 澧炲�肩數淇′笟鍔$粡钀ヨ鍙瘉锛氫含B2-20224426</span
-      >
+      </span>
       <span style="display: block">Copyright漏2013 涓浗鍗忓拰鍖荤澶у鍑虹増绀炬湁闄愬叕鍙� 鐗堟潈鎵�鏈�!</span>
     </div>
     <teacherCertification :isShow="teacherDialog" @dialog-Change="dialogChange" />
diff --git a/src/layout/components/headerPage.vue b/src/layout/components/headerPage.vue
index 35081a3..9a252cf 100644
--- a/src/layout/components/headerPage.vue
+++ b/src/layout/components/headerPage.vue
@@ -149,6 +149,8 @@
   }
   if (item === 'logout') {
     localStorage.clear()
+    userStore.delteUserInfo()
+    userInfo.value = null
     router.push({
       path: '/home',
     })
diff --git a/src/layout/components/login.vue b/src/layout/components/login.vue
index 7250692..8b561e7 100644
--- a/src/layout/components/login.vue
+++ b/src/layout/components/login.vue
@@ -223,11 +223,6 @@
     })
 }
 
-watchEffect(() => {
-  if (dialogFormVisible.value) {
-  }
-})
-
 //鐧诲綍
 
 const loginBtn = () => {
@@ -818,20 +813,5 @@
 
 .selectPhone {
   background: #fff;
-}
-
-::v-deep(.el-select) {
-  width: 100px;
-  height: 30px;
-  color: red;
-  border: none !important;
-
-  ::v-deep(.select-trigger) {
-    height: 100%;
-    .el-input--suffix {
-      height: 100%;
-      background-color: #fff;
-    }
-  }
 }
 </style>
diff --git a/src/views/bookStore/detail.vue b/src/views/bookStore/detail.vue
index 1aa0a9d..6b9906a 100644
--- a/src/views/bookStore/detail.vue
+++ b/src/views/bookStore/detail.vue
@@ -35,6 +35,9 @@
                 {{ bookInfo.seriesName }}
               </div>
               <div class="collectBox">
+                <div class="collectText" @click="collectBook" v-if="bookInfo.isFavourite">
+                  宸叉敹钘�
+                </div>
                 <img
                   @click="collectBook"
                   v-if="bookInfo.isFavourite"
@@ -43,17 +46,15 @@
                   style="margin-right: 10px"
                 />
                 <span v-else class="iconfont icon-shoucang" style="margin-right: 10px"> </span>
-                <div class="collectText" @click="collectBook" v-if="bookInfo.isFavourite">
-                  宸叉敹钘�
-                </div>
 
                 <div class="collectText" @click="collectBook" v-else>
+                  鏀惰棌
+
                   <img
                     class="buyIcon"
                     src="@/assets/images/xiehe/detail/Collection.png"
                     style="margin-right: 10px"
                   />
-                  鏀惰棌
                 </div>
               </div>
             </div>
@@ -89,18 +90,16 @@
             </div>
             <div class="authorBox" style="box-sizing: border-box">
               <div class="titleBox1">
-                <div>涓�绾у垎绫伙細</div>
-                <div>浜岀骇鍒嗙被锛�</div>
+                <div>鍒嗙被锛�</div>
               </div>
               <div class="valueBox">
                 <div>鍏ㄥ浗楂樼瓑鑱屼笟鏁欒偛棰勯槻鍖诲涓撲笟瑙勫垝鏁欐潗</div>
-                <div>楂樼瓑鑱屼笟鏁欒偛</div>
               </div>
             </div>
             <div class="purchaseBox">
               <div class="priceBox">
                 <span v-if="bookInfo.price && bookInfo.price > 0">
-                  <span>瀹氫环锛�</span><span>锟�</span> <span>{{ bookInfo.price || '-' }}</span
+                  <span>鏁板瓧鏁欐潗</span><span>锟�</span> <span>{{ bookInfo.price || '-' }}</span
                   ><span v-if="bookInfo.VirtualPrice">鍘熶环锛氾骏{{ bookInfo.VirtualPrice }}</span>
                 </span>
 
@@ -169,13 +168,27 @@
               <el-button v-if="currentRoute == 'teachingServices'" plain @click="addPaperBook"
                 >绾歌川鏍蜂功</el-button
               >
-              <el-button plain @click="applyTextBook">鐢宠璇曠敤</el-button>
+              <el-button plain @click="applyTextBook" v-if="!bookInfo.alreadyBuy"
+                >鐢宠璇曠敤</el-button
+              >
+              <el-button plain @click="useCode" v-if="!bookInfo.alreadyBuy">浣跨敤璐功鐮�</el-button>
             </div>
           </div>
         </div>
       </div>
     </div>
-
+    <el-dialog v-model="buyBookCodeDialog" title="璐功" width="30%">
+      <div class="buyBookCode">
+        <div style="line-height: 30px">璐功鐮� 锛�</div>
+        <el-input style="width: 70%" v-model="activateCode" clearable />
+      </div>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="buyBookCodeDialog = false">鍙栨秷</el-button>
+          <el-button type="primary" @click="userActiveCodeGet"> 婵�娲� </el-button>
+        </span>
+      </template>
+    </el-dialog>
     <div class="detailContent contentBox">
       <div class="resourceBox">
         <div class="tabsBox">
@@ -263,6 +276,7 @@
         </div>
       </div>
     </div>
+    <teacherCertification :isShow="teacherDialog" @dialog-Change="dialogChange" />
   </div>
 </template>
 
@@ -281,10 +295,17 @@
 import videoIcon from '@/assets/images/digitalTextbooks/video.png'
 import VRIcon from '@/assets/images/digitalTextbooks/VR.png'
 import ziliaoIcon from '@/assets/images/digitalTextbooks/ziliao.png'
+import teacherCertification from '@/views/personalCenter/teacherCertification.vue'
+import { ElMessage } from 'element-plus'
+
 import { ref, onBeforeMount, inject, reactive, onMounted, watchEffect } from 'vue'
 const MG = inject('MG')
 const config = inject('config')
 const logIn = inject('logIn')
+import { useUserStore } from '@/store'
+const userStore = useUserStore()
+let teacherDialog = ref(false)
+
 import { useRouter, useRoute } from 'vue-router'
 import { applyBookStore } from '@/store'
 const route = useRoute()
@@ -294,8 +315,10 @@
 let resourceData = ref([])
 let recommendBookListData = ref([])
 let editableTabsValue = ref('1')
+let activateCode = ref('')
 let resourceHave = ref(true)
 let loading = ref(false)
+let buyBookCodeDialog = ref(false)
 var chartDom = null
 var myChart = {}
 var option = null
@@ -339,6 +362,78 @@
   }
 })
 
+const userActiveCodeGet = () => {
+  let lock = true
+  console.log(activateCode.value, 'activateCode.value')
+
+  if (activateCode.value == '') {
+    ElMessage({
+      type: 'error',
+      message: '璇疯緭鍏ユ縺娲荤爜锛�',
+    })
+  } else {
+    if (lock) {
+      lock = false
+
+      MG.store
+        .getActiveCode({
+          code: activateCode.value,
+        })
+        .then((res) => {
+          console.log(res, 'res')
+          const cfg = JSON.parse(res.config)
+          console.log(cfg, 'cfg')
+          if (cfg && cfg.length > 0) {
+            const isActive = cfg.findIndex((item) => item.id == digitalTextId.value)
+
+            if (isActive > -1) {
+              MG.store
+                .userActiveCode({
+                  code: activateCode.value,
+                })
+                .then((res) => {
+                  ElMessage({
+                    type: res == '婵�娲绘垚鍔�' ? 'success' : 'error',
+                    message: res,
+                  })
+                  activateCode.value = ''
+                  buyBookCodeDialog.value = false
+                  getBookDetail(digitalTextId.value)
+                  lock = true
+                })
+            } else {
+              ElMessage({
+                type: 'error',
+                message: '鎮ㄨ緭鍏ョ殑璐功鐮佹湁璇�',
+              })
+            }
+          } else {
+            ElMessage({
+              type: 'error',
+              message: '鎮ㄨ緭鍏ョ殑璐功鐮佹湁璇�',
+            })
+          }
+        })
+    }
+  }
+}
+
+const useCode = () => {
+  if (localStorage.getItem(config.tokenKey)) {
+    buyBookCodeDialog.value = true
+  } else {
+    logIn()
+  }
+}
+
+const dialogChange = (val) => {
+  if (val == false) {
+    teacherDialog.value = false
+  } else {
+    teacherDialog.value = true
+  }
+}
+
 //鏀惰棌涔︾睄
 const collectBook = () => {
   if (localStorage.getItem(config.tokenKey)) {
@@ -368,10 +463,20 @@
 
 //鐢宠璇曠敤
 const applyTextBook = () => {
-  localStorage.setItem('applyBookInfo', JSON.stringify(bookInfo.value))
-  router.push({
-    path: '/textBookApply',
-  })
+  console.log(userStore.userInfo, 'userInfo')
+
+  if (localStorage.getItem(config.tokenKey)) {
+    if (userStore.userInfo && userStore.userInfo.role == 'Teacher') {
+      localStorage.setItem('applyBookInfo', JSON.stringify(bookInfo.value))
+      router.push({
+        path: '/textBookApply',
+      })
+    } else {
+      teacherDialog.value = true
+    }
+  } else {
+    logIn()
+  }
 }
 
 const getRecommendBookList = () => {
@@ -624,8 +729,8 @@
   box-sizing: border-box;
 }
 .collectText {
-  font-size: 16px;
-  line-height: 25px;
+  font-size: 18px;
+  line-height: 18px;
   display: inline-block;
 }
 .bookName {
@@ -926,4 +1031,15 @@
   margin-top: 20px;
   line-height: 28px;
 }
+.buyBookCode {
+  width: 100%;
+  display: flex;
+  padding: 40px 10px;
+  text-align: center;
+  align-items: center;
+}
+.tab-name {
+  width: 100px;
+  height: 40px;
+}
 </style>
diff --git a/src/views/bookStore/textBookApply.vue b/src/views/bookStore/textBookApply.vue
index 8a4bb49..80adb91 100644
--- a/src/views/bookStore/textBookApply.vue
+++ b/src/views/bookStore/textBookApply.vue
@@ -4,7 +4,7 @@
       <div class="crumbBox">
         <el-breadcrumb separator-class="el-icon-arrow-right">
           <span style="float: left">褰撳墠浣嶇疆锛�</span>
-          <el-breadcrumb-item :to="{ path: '/textbooks' }">鏁板瓧鏁欐潗</el-breadcrumb-item>
+          <el-breadcrumb-item :to="{}" @click="backRouet">鏁板瓧鏁欐潗</el-breadcrumb-item>
           <el-breadcrumb-item>鐢宠璇曠敤</el-breadcrumb-item>
         </el-breadcrumb>
       </div>
@@ -63,6 +63,7 @@
 import { ElMessage, ElMessageBox } from 'element-plus'
 
 import { useRouter } from 'vue-router'
+import router from '@/router'
 const toolClass = inject('toolClass')
 const userStore = useUserStore()
 onMounted(() => {
@@ -90,6 +91,14 @@
   teachingMaterials: [{ required: true, message: '璇峰~鍐欐墍鐢ㄦ暀鏉�' }],
 }
 
+const backRouet = () => {
+  router.push({
+    path: '/bookdetail',
+    query: {
+      bookId: textBookInfo.value.id,
+    },
+  })
+}
 const getType = () => {
   const data = {
     refCodes: ['sampleBook'],
@@ -125,17 +134,19 @@
       MG.ugc.newTopicMessage(data).then((res) => {
         loading.value = false
         if (res) {
-          ElMessageBox.confirm('鎮ㄧ殑璇曠敤鐢宠宸叉彁浜わ紝绠$悊鍛樺鏍镐腑锛�', 'success', {
+          ElMessageBox.confirm('鎮ㄧ殑璇曠敤鐢宠宸叉彁浜わ紝绠$悊鍛樺鏍镐腑锛�', '鎻愮ず', {
             confirmButtonText: '纭畾',
             cancelButtonText: '鍙栨秷',
             type: 'success',
           })
             .then(() => {
-              this.$router.go(-1)
+              router.push({
+                path: '/myApply',
+              })
               formEl.resetFields()
             })
             .catch(() => {
-              this.$router.go(-1)
+              backRouet()
               formEl.resetFields()
             })
         }
@@ -143,7 +154,9 @@
     }
   })
 }
-const toSelectBook = () => {}
+const toSelectBook = () => {
+  backRouet()
+}
 </script>
 
 <style scoped>
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index f836b74..cd70a91 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -124,10 +124,11 @@
 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')
@@ -138,6 +139,7 @@
 const informationList = reactive([])
 let classfeild = ref([])
 let activeName = ref('A1')
+let callbackLink = ref(null)
 
 let bookListData = ref([])
 let navBookList = ref([])
@@ -180,6 +182,13 @@
   getBookList()
   getNavBookList()
 })
+
+watch(
+  () => route, // 鐩戝惉 path 鍙樺寲
+  (newPath, oldPath) => {
+    console.log('璺敱璺緞浠�', oldPath, '鍙樹负', newPath)
+  },
+)
 
 const toMore = () => {
   router.push({
@@ -512,7 +521,7 @@
 
 .titleTabs {
   margin-left: 50px;
-  width: 75%;
+  width: 85%;
 }
 .bookListTitle {
   display: flex;
@@ -548,4 +557,11 @@
     margin-top: 10px;
   }
 }
+
+::v-deep(.el-tabs__item) {
+  align-items: stretch;
+  height: 50px !important;
+  white-space: pre-wrap !important;
+  width: 40% !important;
+}
 </style>

--
Gitblit v1.9.1