From cabc1ce19c57a7c7388502952eaaafd558363145 Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期五, 22 八月 2025 18:18:51 +0800
Subject: [PATCH] 数字教材相关

---
 src/views/home/index.vue |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 153 insertions(+), 12 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index ace2d24..974cb22 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -56,18 +56,33 @@
     </div>
     <div class="contentBox">
       <div class="funBox">
-        <div class="authentication"></div>
-        <div class="manual"></div>
+        <div class="authentication">
+          <div class="cardNav" @click="toAuthentication(true)">
+            <div class="cardTitle">鏁欏笀璁よ瘉</div>
+            <div class="cardText">
+              瀛︽牎浠昏鑰佸笀涓婁紶鏁欏笀璇佹槑鏂囦欢锛岄�氳繃璁よ瘉鍚庯紝鍙繘琛屾牱涔︿笌鏁欏璧勬簮涓嬭浇鐢宠
+            </div>
+          </div>
+        </div>
+        <div class="manual">
+          <div class="cardNav" @click="toAuthentication(false)">
+            <div class="cardTitle">鎿嶄綔鎵嬪唽</div>
+            <div class="cardText">蹇�熶簡瑙d娇鐢ㄦ楠わ紝杞绘澗寮�鍚暀瀛︽敮鎸佷箣鏃呫��</div>
+          </div>
+        </div>
       </div>
 
       <div class="bookListTitle">
         <div class="title" style="display: flex; line-height: 50px">
-          <div>鏂伴椈璧勮</div>
-          <div class="titleTabs">
-            <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
-              <el-tab-pane label="楂樼瓑鑱屼笟鏁欐潗" name="first"> </el-tab-pane>
-              <el-tab-pane label="涓撳崌鏈暀鏉�" name="second"></el-tab-pane>
-              <el-tab-pane label="鍗忓拰鍖诲闄㈡暀鏉�" name="third"></el-tab-pane>
+          <div>鏁欏瀵艰埅</div>
+          <div class="titleTabs" v-if="classfeild.length > 0">
+            <el-tabs v-model="activeName" @tab-change="handleClick">
+              <el-tab-pane
+                v-for="item in classfeild"
+                :key="item.value"
+                :label="item.name"
+                :name="item.value"
+              />
             </el-tabs>
           </div>
         </div>
@@ -75,7 +90,7 @@
         <div class="more">鏇村></div>
       </div>
       <div class="recommendList">
-        <div class="recommendItem" v-for="item in bookListData" :key="item.id">
+        <div class="recommendItem" v-for="item in navBookList" :key="item.id">
           <div class="recommendItemImg">
             <img class="autoImg" :src="item.icon" />
           </div>
@@ -96,22 +111,30 @@
         </div>
       </div>
     </div>
+    <teacherCertification :isShow="teacherDialog" @dialog-Change="dialogChange" />
   </div>
 </template>
 
 <script setup>
 import moment from 'moment'
+import { ElMessage } from 'element-plus'
+import teacherCertification from '@/views/personalCenter/teacherCertification.vue'
 import { ref, onBeforeMount, inject, reactive, onMounted } from 'vue'
 let screenheight = ref(document.documentElement.clientHeight / 2)
 const MG = inject('MG')
 const config = inject('config')
 const tool = inject('tool')
+const toolClass = inject('toolClass')
 const banner = reactive([])
 const informationList = reactive([])
+let classfeild = ref([])
+let activeName = ref('A1')
+
 let bookListData = ref([])
+let navBookList = ref([])
+let teacherDialog = ref(false)
 onBeforeMount(() => {
   console.log(document.documentElement.clientWidth / 2.628)
-
   window.onresize = () => {
     let c = 2.628
     if (document.documentElement.clientWidth >= 1220) {
@@ -123,9 +146,111 @@
 
 onMounted(() => {
   getBanner()
+  classifList()
   getInformationList()
   getBookList()
+  getNavBookList()
 })
+
+const handleClick = (tab, event) => {
+  console.log(tab)
+
+  activeName.value = tab
+  getNavBookList()
+}
+
+const classifList = () => {
+  const query = {
+    refCodes: ['digitalTextbooks'],
+  }
+  MG.resource.getCmsTypeByRefCode(query).then((res) => {
+    const types = toolClass.handleTypeList(res)
+    const typeData = types[0].cmsTypeLinks[0].children
+    const temp_classfeild = typeData.find((item) => item.typeField.refCode === 'teachingLevel')
+      ?.typeField.cfg.option
+
+    const noCheck = temp_classfeild.map((item) => {
+      return {
+        name: item.name,
+        value: item.value,
+      }
+    })
+    console.log(noCheck, 'noCheck')
+
+    classfeild.value = noCheck
+    console.log(classfeild, 'classfeild')
+  })
+}
+
+const getNavBookList = () => {
+  MG.store
+    .getProductList({
+      path: '*',
+      queryType: '*',
+      storeInfo: 'defaultGoodsStore1',
+      paging: {
+        start: 0,
+        size: 5,
+      },
+      fields: {
+        'teachingLevel=': activeName.value,
+      },
+    })
+    .then((res) => {
+      console.log(res, '11111111111')
+      navBookList.value = res.datas
+    })
+}
+
+const dialogChange = (val) => {
+  getTeacherInfo()
+  if (val == false) {
+    teacherDialog.value = false
+  } else {
+    teacherDialog.value = true
+  }
+}
+
+//鏁欏笀淇℃伅
+function getTeacherInfo() {
+  const data = {
+    start: 0,
+    size: 10,
+    topicIdOrRefCode: 'teacherRoleApproval',
+    appRefCode: config.appRefCode,
+    sort: {
+      type: 'Desc',
+      field: 'CreateDate',
+    },
+  }
+  MG.ugc.getTopicMessageList(data).then((res) => {
+    try {
+      const resData = res.datas.find((i) => i.appUserCreator.userId == userId.value)
+      if (resData) {
+        teacherState.value = resData.state
+        if (resData.feedBack != null) {
+          reasonTxt.value = JSON.parse(resData.feedBack).reason
+        }
+      } else {
+        teacherState.value = ''
+      }
+      loading.value = false
+    } catch (error) {
+      loading.value = false
+    }
+  })
+}
+
+const toAuthentication = (type) => {
+  if (type) {
+    teacherDialog.value = true
+  } else {
+    ElMessage({
+      message: '寤鸿涓�...',
+      type: 'warning',
+    })
+  }
+}
 
 const getBookList = () => {
   MG.store
@@ -315,14 +440,14 @@
   margin-bottom: 60px;
   .authentication {
     width: 40%;
-    height: 80px;
+    height: 100px;
     background-repeat: no-repeat;
     background-size: 100% 100%;
     background-image: url('@/assets/images/xiehe/home/jiaoshirenzheng.png');
   }
   .manual {
     width: 40%;
-    height: 80px;
+    height: 100px;
     background-repeat: no-repeat;
     background-size: 100% 100%;
     background-image: url('@/assets/images/xiehe/home/jiaoshirenzheng.png');
@@ -331,6 +456,7 @@
 
 .titleTabs {
   margin-left: 50px;
+  width: 70%;
 }
 .bookListTitle {
   display: flex;
@@ -351,4 +477,19 @@
     cursor: pointer;
   }
 }
+.cardNav {
+  margin-left: 30%;
+  margin-top: 20px;
+  padding-right: 20px;
+  cursor: pointer;
+  .cardTitle {
+    font-size: 28px;
+    color: #ffffff;
+  }
+  .cardText {
+    font-size: 14px;
+    color: #ccc;
+    margin-top: 10px;
+  }
+}
 </style>

--
Gitblit v1.9.1