New file |
| | |
| | | <template> |
| | | <div class="homePage"> |
| | | <el-carousel :height="'615px'"> |
| | | <el-carousel-item v-for="(item, index) in banner" :key="index"> |
| | | <div class="bannerBox"> |
| | | <img id="autoHeight" class="bannerImg" :src="item.icon" @click="bannerLink(item)" /> |
| | | </div> |
| | | </el-carousel-item> |
| | | </el-carousel> |
| | | <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" @click="toMore">更多></div> |
| | | </div> |
| | | <div class="informationList"> |
| | | <div class="informationItem" v-for="(item, index) in informationList" :key="index"> |
| | | <div class="imgBox"><img class="autoImg" :src="item.icon" alt="" /></div> |
| | | <div class="informationContent"> |
| | | <div class="informationTitle" :alt="item.name">{{ item.name }}</div> |
| | | <div class="informationDate">{{ moment(item.publishDate).format('YYYY-MM-DD') }}</div> |
| | | <div class="informationText">{{ item.description }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="bookListBox"> |
| | | <div class="contentBox"> |
| | | <div class="bookListTitle"> |
| | | <div class="titleBox"> |
| | | <span class="titleTextBg">推荐</span> |
| | | <span>教材</span> |
| | | </div> |
| | | <div class="more" @click="toMore">更多></div> |
| | | </div> |
| | | <div class="recommendList"> |
| | | <div class="recommendItem" v-for="item in bookListData" :key="item.id" @click="toDetail(item)"> |
| | | <div class="recommendItemImg"> |
| | | <img class="autoImg" :src="item.icon" /> |
| | | </div> |
| | | <div class="infoBox"> |
| | | <div class="bookName">{{ item.name }}</div> |
| | | <div class="author"> |
| | | {{ item.author ? item.author : '-' }} 著 |
| | | </div> |
| | | <div class="priceBox"> |
| | | <span class="price" v-if="item.price && item.price > 0"> |
| | | <span> ¥{{ item.price }}</span> |
| | | </span> |
| | | <span class="oldPrice" v-if="item.oldPrice > 0"> ¥{{ item.oldPrice }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="contentBox"> |
| | | <div class="funBox"> |
| | | <div class="authentication"> |
| | | <div class="cardNav" @click="toAuthentication(true)"> |
| | | <img id="rightImg" src="@/assets/images/xiehe/home/jxfw.png" alt=""> |
| | | <div class="cardTitle">教师认证</div> |
| | | <div class="cardText"> |
| | | 学校任课老师上传教师证明文件,通过认证后,可进行数字教材试用申请及开课开班 |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="manual"> |
| | | <div class="cardNav" @click="toAuthentication(false)"> |
| | | <img id="rightImg" src="@/assets/images/xiehe/home/jxfw.png" alt=""> |
| | | <div class="cardTitle">操作手册</div> |
| | | <div class="cardText">快速了解使用步骤,轻松开启教学支持之旅</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="bookListTitle"> |
| | | <div class="title" style="display: flex; line-height: 50px"> |
| | | <div class="titleBox"> |
| | | <span class="titleTextBg">教学</span> |
| | | <span>导航</span> |
| | | </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 class="more" style="margin-left: 30px; font-weight: normal" @click="toMore"> |
| | | 更多> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="recommendList"> |
| | | <div class="recommendItem" v-for="item in navBookList" :key="item.id" @click="toDetail(item)"> |
| | | <div class="recommendItemImg"> |
| | | <img class="autoImg" :src="item.icon" /> |
| | | </div> |
| | | <div class="infoBox"> |
| | | <div class="bookName">{{ item.name }}</div> |
| | | <div class="author"> |
| | | {{ item.author ? item.author : '-' }} 著 |
| | | </div> |
| | | <div class="priceBox"> |
| | | <span class="price" v-if="item.price && item.price > 0"> |
| | | <span>¥{{ item.price }}</span> |
| | | </span> |
| | | <span class="oldPrice" v-if="item.oldPrice > 0">¥{{ item.oldPrice }}</span> |
| | | </div> |
| | | </div> |
| | | </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, 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([]) |
| | | let teacherDialog = ref(false) |
| | | onBeforeMount(() => { |
| | | console.log(document.documentElement.clientWidth / 2.628) |
| | | window.onresize = () => { |
| | | let c = 2.628 |
| | | if (document.documentElement.clientWidth >= 1220) { |
| | | screenheight.value = document.documentElement.clientWidth / c |
| | | console.log(document.documentElement.clientWidth / c) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | // 获取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({ |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: item.id, |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | 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, |
| | | } |
| | | }) |
| | | |
| | | classfeild.value = noCheck |
| | | }) |
| | | } |
| | | |
| | | const getNavBookList = () => { |
| | | MG.store |
| | | .getProductList({ |
| | | path: '*', |
| | | queryType: '*', |
| | | storeInfo: 'defaultGoodsStore1', |
| | | paging: { |
| | | start: 0, |
| | | size: 5, |
| | | }, |
| | | fields: { |
| | | 'teachingLevel=': activeName.value, |
| | | author: [], |
| | | }, |
| | | }) |
| | | .then((res) => { |
| | | navBookList.value = res.datas?.map(item => { |
| | | return { |
| | | ...item, |
| | | price: toolClass.toDecimal2(item.price), |
| | | oldPrice: toolClass.toDecimal2(item.oldPrice), |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | 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) { |
| | | if (localStorage.getItem(config.tokenKey)) { |
| | | teacherDialog.value = true |
| | | } else { |
| | | logIn() |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | message: '建设中...', |
| | | type: 'warning', |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const getBookList = () => { |
| | | MG.store |
| | | .getProductList({ |
| | | path: 'recommendedTextbooks', |
| | | paging: { |
| | | start: 0, |
| | | size: 5, |
| | | }, |
| | | fields: { |
| | | author: [], |
| | | isbn: [] |
| | | }, |
| | | }) |
| | | .then((res) => { |
| | | bookListData.value = res.datas?.map(item => { |
| | | return { |
| | | ...item, |
| | | price: toolClass.toDecimal2(item.price), |
| | | oldPrice: toolClass.toDecimal2(item.oldPrice), |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const getInformationList = () => { |
| | | MG.resource |
| | | .getItem({ |
| | | path: 'information', |
| | | fields: { publishDate: [], content: [] }, |
| | | paging: { start: 0, size: 9 }, |
| | | }) |
| | | .then((res) => { |
| | | informationList.push(...res.datas) |
| | | console.log(res.datas) |
| | | }) |
| | | } |
| | | |
| | | const getBanner = () => { |
| | | MG.resource |
| | | .getItem({ |
| | | path: 'banner\\homeBanner', |
| | | fields: { link: [] }, |
| | | paging: { start: 0, size: 9 }, |
| | | }) |
| | | .then((res) => { |
| | | banner.push(...res.datas) |
| | | console.log(res.datas) |
| | | }) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .homePage { |
| | | min-width: 1220px; |
| | | min-height: calc(100vh - 61.8%); |
| | | background-color: #fff; |
| | | padding-bottom: 100px; |
| | | |
| | | .titleBox { |
| | | min-width: 127px; |
| | | font-family: JDLangZhengTi, JDLangZhengTi; |
| | | font-weight: 400; |
| | | font-size: 24px; |
| | | color: #000; |
| | | line-height: 24px; |
| | | text-align: left; |
| | | white-space: nowrap; |
| | | |
| | | .titleTextBg { |
| | | padding: 2px 5px; |
| | | box-sizing: border-box; |
| | | background-image: url('@/assets/images/xiehe/home/Text_bg2@.png'); |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | background-position: center; |
| | | color: #fff; |
| | | } |
| | | } |
| | | |
| | | .bannerBox { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | |
| | | .el-carousel__item h3 { |
| | | color: #475669; |
| | | opacity: 0.75; |
| | | line-height: 150px; |
| | | margin: 0; |
| | | text-align: center; |
| | | } |
| | | |
| | | .el-carousel__item:nth-child(2n) { |
| | | background-color: #99a9bf; |
| | | } |
| | | |
| | | .el-carousel__item:nth-child(2n + 1) { |
| | | background-color: #d3dce6; |
| | | } |
| | | |
| | | .informationList { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | |
| | | .informationItem { |
| | | display: flex; |
| | | width: 42%; |
| | | min-height: 100px; |
| | | margin-right: 5%; |
| | | margin-bottom: 20px; |
| | | border: 1px solid #ebebeb; |
| | | border-radius: 10px; |
| | | padding: 10px; |
| | | cursor: pointer; |
| | | |
| | | .imgBox { |
| | | width: 30%; |
| | | height: 100%; |
| | | position: relative; |
| | | } |
| | | |
| | | .informationContent { |
| | | width: 70%; |
| | | padding-left: 10px; |
| | | |
| | | .informationTitle { |
| | | font-size: 14px; |
| | | width: 100%; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | color: #333333; |
| | | font-weight: bold; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .informationDate { |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .informationText { |
| | | color: #666666; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | display: -webkit-box; |
| | | margin-top: 10px; |
| | | display: -webkit-box; |
| | | /* 将对象作为弹性伸缩盒子模型显示 */ |
| | | -webkit-line-clamp: 3; |
| | | /* 显示的行数 */ |
| | | -webkit-box-orient: vertical; |
| | | /* 设置或检索伸缩盒对象的子元素的排列方式 */ |
| | | overflow: hidden; |
| | | /* 溢出隐藏 */ |
| | | } |
| | | } |
| | | } |
| | | |
| | | // .informationItem:hover { |
| | | // border: 1px solid #019e58; |
| | | // } |
| | | } |
| | | |
| | | .bookListBox { |
| | | width: 100%; |
| | | padding: 80px 0; |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | background-image: url('@/assets/images/tuijian-bg.png'); |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | } |
| | | |
| | | .recommendList { |
| | | display: flex; |
| | | padding-top: 20px; |
| | | |
| | | .recommendItem { |
| | | flex: 1; |
| | | margin-right: 20px; |
| | | width: 261px; |
| | | height: 389px; |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | cursor: pointer; |
| | | border: 1px solid #dedede; |
| | | background-color: #fff; |
| | | padding-top: 10px; |
| | | background: rgba(255, 255, 255, 0.73); |
| | | border-radius: 8px 8px 8px 8px; |
| | | border: 1px solid #DEDEDE; |
| | | box-sizing: border-box; |
| | | padding: 30px 0; |
| | | box-sizing: border-box; |
| | | |
| | | &:last-child { |
| | | margin-right: 0; |
| | | } |
| | | } |
| | | |
| | | .recommendItem:hover { |
| | | background-image: url(@/assets/images/Mouse_fill.png); |
| | | background-position: center; |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | } |
| | | } |
| | | |
| | | .recommendItemImg { |
| | | width: 156px; |
| | | height: 210px; |
| | | position: relative; |
| | | margin: 0 auto; |
| | | } |
| | | |
| | | .infoBox { |
| | | text-align: center; |
| | | padding: 20px 0; |
| | | box-sizing: border-box; |
| | | font-family: Microsoft YaHei UI, Microsoft YaHei UI; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .bookName { |
| | | font-weight: bold; |
| | | font-size: 18px; |
| | | color: #000000; |
| | | font-weight: 700; |
| | | } |
| | | |
| | | .author { |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | color: #333333; |
| | | padding: 15px 0; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .priceBox { |
| | | font-family: DIN, DIN; |
| | | font-weight: 500; |
| | | font-size: 18px; |
| | | color: #D91523; |
| | | padding: 15px 0; |
| | | box-sizing: border-box; |
| | | |
| | | .oldPrice { |
| | | color: #999999; |
| | | text-decoration: line-through; |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | .price { |
| | | span { |
| | | font-weight: bold; |
| | | color: #d91523; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .funBox { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-top: 60px; |
| | | margin-bottom: 60px; |
| | | |
| | | .authentication { |
| | | width: 650px; |
| | | height: 123px; |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | background-image: url('@/assets/images/xiehe/home/jiaoshirenzheng.png'); |
| | | } |
| | | |
| | | .manual { |
| | | width: 650px; |
| | | height: 123px; |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | background-image: url('@/assets/images/xiehe/home/caozuoshouce.png'); |
| | | } |
| | | } |
| | | |
| | | .titleTabs { |
| | | margin-left: 30px; |
| | | width: 85%; |
| | | } |
| | | |
| | | .bookListTitle { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | border-bottom: 1px solid #ebebeb; |
| | | |
| | | |
| | | .title { |
| | | font-size: 20px; |
| | | color: #333333; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .more { |
| | | font-size: 14px; |
| | | color: #999999; |
| | | cursor: pointer; |
| | | font-weight: 500; |
| | | min-width: 60px; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | .cardNav { |
| | | margin-left: 150px; |
| | | margin-top: 20px; |
| | | padding-right: 20px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | |
| | | #rightImg { |
| | | position: absolute; |
| | | right: 48px; |
| | | top: 26px; |
| | | height: 30px; |
| | | } |
| | | |
| | | .cardTitle { |
| | | font-family: JDLangZhengTi, JDLangZhengTi; |
| | | font-weight: 400; |
| | | font-size: 32px; |
| | | color: #FFFFFF; |
| | | margin-bottom: 5px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .cardText { |
| | | width: 351px; |
| | | font-family: PingFang SC, PingFang SC; |
| | | font-weight: 400; |
| | | font-size: 14px; |
| | | color: #FFFFFF; |
| | | line-height: 25px; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | ::v-deep(.el-tabs__item) { |
| | | height: 50px; |
| | | line-height: 22px; |
| | | text-align: center; |
| | | padding: 15px 0; |
| | | box-sizing: border-box; |
| | | margin: 0 10px; |
| | | } |
| | | |
| | | |
| | | ::v-deep(.el-tabs__header) { |
| | | padding: 0; |
| | | position: relative; |
| | | margin: 0 0 0 0px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between |
| | | } |
| | | </style> |