杨磊
2 天以前 cabc1ce19c57a7c7388502952eaaafd558363145
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">快速了解使用步骤,轻松开启教学支持之旅。</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>