<template>
|
<div class="minWidth">
|
<el-carousel :height="screenheight + 'px'" v-show="bannerState">
|
<el-carousel-item v-for="item in bannerList" :key="item.id">
|
<div class="bannerBox imgBox" :style="item.caupress_link ? 'cursor: pointer' : ''">
|
<img class="bannerImg" :src="item.icon" @click="bannerLink(item)" />
|
</div>
|
</el-carousel-item>
|
</el-carousel>
|
<div
|
:class="!bannerState ? 'show stow' : 'stow'"
|
@click="bannerState = !bannerState"
|
>
|
{{ bannerState ? "收起" : "显示" }}
|
轮播图
|
<i
|
:class="bannerState ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
|
></i>
|
</div>
|
<div class="contentBox">
|
<div class="tabs" v-show="!$route.query.searchOptionHidden">
|
<div
|
class="tabItem"
|
v-for="(item, index) in tab"
|
:key="index"
|
@click="toRoute(item)"
|
>
|
<div class="img">
|
<img src="@/assets/images/teaching/teacher.png" alt="" />
|
</div>
|
<p class="title">{{ item.name }}</p>
|
<p class="englishTitle">{{ item.englishName }}</p>
|
<div class="jump">
|
<img src="@/assets/images/teaching/arrow.png" alt="" />
|
</div>
|
</div>
|
</div>
|
|
<div class="notice">
|
<p>出版社 <span>公告 //</span></p>
|
<el-carousel height="40px" direction="vertical" :autoplay="true">
|
<el-carousel-item v-for="(item, index) in noticeList" :key="index">
|
<div class="ellipsis" :title="item.name">
|
{{ item.name }}
|
</div>
|
</el-carousel-item>
|
</el-carousel>
|
</div>
|
|
<List
|
:channel="
|
this.$route.query.searchPath
|
? this.$route.query.searchPath
|
: 'caupress_teachingResource'
|
"
|
:searchOptionHidden="searchOptionHidden"
|
:detailRoute="detailRoute"
|
></List>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import List from "@/components/list";
|
import tool from "@/assets/js/toolClass";
|
export default {
|
name: "teachingServices-index",
|
components: {
|
List,
|
},
|
data() {
|
return {
|
detailRoute: "teachingServices-detail",
|
bannerList: [],
|
tab: [
|
{
|
name: "教师认证",
|
englishName: "TEACHER CERTIFICATION",
|
icon: "@/assets/images/teaching/teacher.png",
|
jumpPath: "/personalCenter",
|
query: "1",
|
},
|
{
|
name: "样书申请",
|
englishName: "SAMPLE APPLICATION",
|
icon: "@/assets/images/teaching/sample.png",
|
jumpPath: "/teachingServices/applyBook-electronic",
|
},
|
{
|
name: "我的电子样书",
|
englishName: "ELECTRONIC BOOKS",
|
icon: "@/assets/images/teaching/electronicBooks.png",
|
jumpPath: "/personalCenter",
|
query: "5",
|
},
|
{
|
name: "我的纸质样书",
|
englishName: "PAPER COPIES",
|
icon: "@/assets/images/teaching/paperCopies.png",
|
jumpPath: "/personalCenter",
|
query: "6",
|
},
|
],
|
noticeList: [],
|
bannerState: true,
|
searchOptionHidden: this.$route.query.searchOptionHidden
|
? this.$route.query.searchOptionHidden
|
: false,
|
screenheight: document.documentElement.clientWidth / 2.628,
|
};
|
},
|
created() {
|
window.onresize = () => {
|
let c = 2.628;
|
if (document.documentElement.clientWidth >= 1220) {
|
this.screenheight = document.documentElement.clientWidth / c;
|
}
|
};
|
this.getBanner();
|
this.getNotice();
|
if(tool.getCookie(this.config.tokenKey)){
|
this.getUserInfo();
|
}
|
|
setTimeout(() => {
|
this.bannerState = false;
|
}, 15000);
|
},
|
methods: {
|
bannerLink(val) {
|
if (val.caupress_link) {
|
window.open(val.caupress_link);
|
}
|
},
|
//更新用户信息
|
getUserInfo() {
|
this.MG.identity.getCurrentAppUser().then((res) => {
|
if (res) {
|
let teacherRole = res.roleLinks.find(
|
(item) => item.role.refCode == "teacher"
|
);
|
let teacherInfo = res.infoList.find(
|
(item) => item.type == "teacherInfo"
|
);
|
let wechatInfo = res.infoList.find((item) => item.type == "WeChat");
|
let studentInfo = res.infoList.find((item) => item.type == "Default");
|
let phoneInfo = res.secretList.find(
|
(item) => item.type == "MobilePhone"
|
);
|
if (teacherRole && teacherInfo) {
|
let data = {};
|
try {
|
data = JSON.parse(teacherInfo.data);
|
} catch (error) {
|
data = {};
|
}
|
this.$store.dispatch("setUserInfo", {
|
...data,
|
name: data.fullName,
|
phoneNumber: phoneInfo?.credential,
|
role: "Teacher",
|
roleId: teacherRole.role.id,
|
});
|
} else if (wechatInfo) {
|
this.$store.dispatch("setUserInfo", {
|
...wechatInfo,
|
phoneNumber: phoneInfo?.credential,
|
role: "Student",
|
});
|
} else if (studentInfo) {
|
this.$store.dispatch("setUserInfo", {
|
...studentInfo,
|
phoneNumber: phoneInfo?.credential,
|
role: "Student",
|
});
|
}
|
}
|
});
|
},
|
//导航跳转
|
|
toRoute(item) {
|
if (!this.$store.state.token) {
|
this.$router.push({
|
path: "/login",
|
query: {
|
redirectPath: this.$route.fullPath
|
}
|
});
|
}else{
|
if (item.name == "样书申请") {
|
if (this.$store.state.userInfo.role !== "Teacher") {
|
this.$message({
|
showClose: true,
|
message: "请先进行教师认证",
|
type: "warning",
|
});
|
return;
|
}
|
if (
|
this.$store.state.electronicBookList.length == 0 &&
|
this.$store.state.paperCopiesList.length == 0
|
) {
|
this.$message.error("请添加样书后生成清单!");
|
} else if (this.$store.state.electronicBookList != 0) {
|
this.$router.push({
|
path: item.jumpPath,
|
query: {
|
tabsSelected: item.query ? item.query : null,
|
},
|
});
|
} else if (this.$store.state.paperCopiesList.length != 0) {
|
this.$router.push({
|
path: "/teachingServices/applyBook-paper",
|
query: {
|
tabsSelected: item.query ? item.query : null,
|
},
|
});
|
}
|
} else if (item.name == "教师认证") {
|
this.$router.push({
|
name: "personalCenter",
|
query: {
|
tabsSelected: 1,
|
},
|
});
|
} else if (item.name == "我的电子样书") {
|
this.$router.push({
|
name: "personalCenter",
|
query: {
|
tabsSelected: 5,
|
},
|
});
|
} else if (item.name == "我的纸质样书") {
|
this.$router.push({
|
name: "personalCenter",
|
query: {
|
tabsSelected: 6,
|
},
|
});
|
}
|
}
|
},
|
getBanner() {
|
this.MG.resource
|
.getItem({
|
path: "caupress_banner\\caupress_teachService",
|
fields: {
|
caupress_link: [],
|
},
|
coverSize: {
|
height: 750,
|
},
|
paging: {
|
start: 0,
|
size: 999,
|
},
|
})
|
.then((res) => {
|
this.bannerList = res.datas;
|
});
|
},
|
getNotice() {
|
this.MG.resource
|
.getItem({
|
path: "caupress_notes",
|
paging: {
|
start: 0,
|
size: 999,
|
},
|
})
|
.then((res) => {
|
this.noticeList = res.datas;
|
});
|
},
|
},
|
// 如果跳转页面不是详情,则将当前页面不缓存
|
beforeRouteLeave(to, from, next) {
|
if (to.name != "teachingServices-detail") {
|
this.$store.commit("delKeepAlive", from.name);
|
}
|
next();
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.autoImg {
|
max-height: none;
|
}
|
.minWidth {
|
min-width: 1220px;
|
}
|
.stow {
|
width: 160px;
|
margin: 0 auto;
|
text-align: center;
|
border: 1px solid #b3b3b3;
|
font-size: 16px;
|
line-height: 40px;
|
border-radius: 21px;
|
color: #b3b3b3;
|
cursor: pointer;
|
margin-top: 5px;
|
}
|
.show {
|
margin-top: 20px;
|
}
|
.bannerBox {
|
background: #f3f3f3;
|
}
|
.imgBox {
|
position: relative;
|
width: 100%;
|
height: 100%;
|
}
|
.contentBox {
|
background-color: rgb(241, 248, 244);
|
.tabs {
|
display: flex;
|
justify-content: space-between;
|
margin-top: 20px;
|
margin-bottom: 50px;
|
.tabItem {
|
width: 250px;
|
height: 250px;
|
background-color: #e7f9ef;
|
text-align: center;
|
position: relative;
|
cursor: pointer;
|
box-shadow: -1.04px 3.86px 20px 4px rgba(0, 0, 0, 0.1);
|
.img {
|
padding-left: 10px;
|
width: 250px;
|
}
|
.title {
|
font-size: 20px;
|
font-weight: 700;
|
color: #444444;
|
line-height: 30px;
|
}
|
.englishTitle {
|
font-size: 14px;
|
color: #b0b0b0;
|
line-height: 30px;
|
}
|
.jump {
|
width: 100%;
|
height: 30px;
|
background-color: #fff;
|
position: absolute;
|
bottom: 0;
|
img {
|
margin-top: 10px;
|
}
|
}
|
}
|
}
|
.notice {
|
display: flex;
|
line-height: 40px;
|
border-bottom: 1px solid #e6e6e6;
|
margin-bottom: 20px;
|
p {
|
width: 100px;
|
font-weight: 700;
|
span {
|
color: #00873c;
|
}
|
}
|
div {
|
font-size: 14px;
|
width: 1000px;
|
color: #666666;
|
cursor: pointer;
|
}
|
}
|
}
|
</style>
|