123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <!-- 教科书 -->
- <div class="Textbook">
- <div class="top">
- <div class="title">
- <span class="text"> 教研资料 </span>
- <div class="more" @click="goMore">
- <span> 查看更多 </span>
- <img src="../../assets/teacherdev/moreImage.png" alt="" />
- </div>
- </div>
- </div>
- <div class="class_list">
- <div v-for="(item, i) in classList" :key="i" @click="gopreview(item)">
- <div class="listImage">
- <img
- :src="
- require('../../assets/teacherdev/' + getimgurl(item) + '.png')
- "
- alt=""
- />
- <!-- <span v-else>加载失败</span> -->
- </div>
- <!-- <el-image
- lazy
- :src="require('../../assets/teacherdev/' + getimgurl(item) + '.png')"
- alt=""
- ></el-image> -->
- <p class="one_name">{{ item.name }}</p>
- <p class="price">
- ¥
- <span class="price_1" v-text="changePrice('1', item.price)"></span>
- <span class="price_2" v-text="changePrice('2', item.price)"></span>
- </p>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- props: ["classList", "type"],
- data() {
- return {};
- },
- methods: {
- // 前往更多
- goMore() {
- this.$router.push({
- path: "/Viewmore",
- query: {
- classify: "TEXTBOOK",
- },
- });
- },
- gopreview(item) {
- this.$router.push({
- path: "/Preview",
- query: {
- id: item.id,
- },
- });
- },
- // 根据不同的文件类型展示不同图片
- getimgurl(item) {
- let index = item.tag.indexOf("downloadable");
- let type = "";
- if (index != -1) {
- type = item.tag[2];
- } else {
- type = item.tag[1];
- }
- switch (type) {
- case "ppt":
- return "ppt";
- case "pptx":
- return "ppt";
- case "pdf":
- return "pdf";
- case "xlsx":
- return "exceil";
- case "xls":
- return "exceil";
- case "doc":
- return "word";
- case "docx":
- return "word";
- case "word":
- return "word";
- default:
- return "word";
- }
- },
- // 处理价格
- changePrice(type, item) {
- if (item.indexOf(".") != -1) {
- if (type == 1) {
- return item.split(".")[0];
- } else if (type == 2) {
- if (item.split(".")[1] * 1 >= 10) {
- return "." + item.split(".")[1];
- } else {
- return "." + item.split(".")[1] + "0";
- }
- }
- } else {
- if (type == 1) {
- return item;
- }
- if (type == 2) {
- return ".00";
- }
- }
- },
- },
- created() {},
- };
- </script>
- <style lang="scss" scoped>
- .Textbook {
- .top {
- width: 1200px;
- margin: 0 auto;
- display: flex;
- justify-content: space-between;
- .title {
- width: 100%;
- height: 90px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .text {
- position: relative;
- font-size: 24px;
- font-weight: bold;
- }
- .more {
- cursor: pointer;
- font-size: 16px;
- display: flex;
- align-items: center;
- span {
- opacity: 0.4;
- }
- img {
- width: 25px;
- height: 19px;
- }
- }
- }
- }
- .class_list {
- width: 1200px;
- box-sizing: border-box;
- margin: 0 auto;
- background: #fff;
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- padding: 50px 20px 8px 20px;
- > div {
- width: 192px;
- margin-left: 20px;
- margin-right: 20px;
- transition: all 1s;
- cursor: pointer;
- .one_name {
- height: 48px;
- margin-top: 16px;
- line-height: 150%;
- word-break: break-all;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- text-overflow: ellipsis;
- overflow: hidden;
- font-size: 16px;
- color: #2c2c2c;
- cursor: pointer;
- padding-left: 4px;
- }
- .price {
- font-weight: bold;
- color: #2c2c2c;
- font-size: 24px;
- margin-bottom: 32px;
- .price_2 {
- font-size: 16px;
- }
- }
- p {
- font-size: 16px;
- }
- .listImage {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 256px;
- // border: 1px solid rgba(0, 0, 0, 0.15);
- img {
- max-width: 100%;
- max-height: 100%;
- }
- color: #c0c4cc;
- }
- .gray {
- color: #a3a3a3;
- }
- .origin {
- color: #ff9900;
- }
- }
- .more {
- background: url("../../assets/teacherdev/image 13.png") center;
- position: relative;
- .shade {
- position: absolute;
- width: 100%;
- height: 100%;
- background: #000000;
- opacity: 0.6;
- cursor: pointer;
- display: flex;
- justify-content: center;
- align-items: center;
- > div {
- img {
- width: 58px;
- height: 58px;
- }
- span {
- position: relative;
- color: white;
- top: -20px;
- }
- }
- }
- }
- }
- }
- </style>
|