123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <template>
- <!-- 教科书 -->
- <div class="Textbook">
- <div class="top">
- <div class="title">
- <span class="text"> <!-- 教研资料 -->{{ $t('Key554') }} </span>
- <div class="more" @click="goMore">
- <span> <!-- 查看更多 -->{{ $t('Key47') }} </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="getCoverImg(item)" alt="封面" />
- </div>
- <p class="one_name">{{ item.name }}</p>
- <p v-if="item.price * 1 > 0" class="price">
- ¥<span class="price_1" v-html="changePrice(item.price * 1, 24, 16)"></span>
- </p>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { getCoverImg } from '@/utils/index';
- export default {
- props: {
- classList: {
- type: Array,
- default: () => [],
- },
- },
- data() {
- return {
- getCoverImg,
- };
- },
- methods: {
- // 前往更多
- goMore() {
- this.$router.push({
- path: '/Viewmore',
- query: {
- classify: 'TEXTBOOK',
- },
- });
- },
- gopreview(item) {
- this.$router.push({
- path: '/Preview',
- query: {
- id: item.id,
- },
- });
- },
- // 处理价格
- changePrice(price, fontSize1, fontSize2) {
- let _price = price || 0;
- _price = _price.toFixed(2).toString();
- let arr = _price.split('.');
- let str = `<span style="font-size: ${fontSize1 || 16}px;">${arr[0]}</span>.<span style="font-size: ${
- fontSize2 || 16
- }px;">${arr[1]}</span>`;
- return str;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .Textbook {
- .top {
- display: flex;
- justify-content: space-between;
- width: 1200px;
- margin: 0 auto;
- .title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- height: 90px;
- .text {
- position: relative;
- font-size: 24px;
- font-weight: bold;
- }
- .more {
- display: flex;
- align-items: center;
- font-size: 16px;
- cursor: pointer;
- span {
- opacity: 0.4;
- }
- img {
- width: 25px;
- height: 19px;
- }
- }
- }
- }
- .class_list {
- box-sizing: border-box;
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- width: 1200px;
- padding: 50px 20px 8px;
- margin: 0 auto;
- background: #fff;
- > div {
- width: 192px;
- margin-right: 20px;
- margin-left: 20px;
- cursor: pointer;
- transition: all 1s;
- .one_name {
- display: -webkit-box;
- height: 48px;
- padding-left: 4px;
- margin-top: 16px;
- overflow: hidden;
- font-size: 16px;
- line-height: 150%;
- color: #2c2c2c;
- text-overflow: ellipsis;
- word-break: break-all;
- cursor: pointer;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .price {
- margin-bottom: 32px;
- font-size: 24px;
- font-weight: bold;
- color: #2c2c2c;
- .price_2 {
- font-size: 16px;
- }
- }
- p {
- font-size: 16px;
- }
- .listImage {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 256px;
- color: #c0c4cc;
- // border: 1px solid rgba(0, 0, 0, 0.15);
- img {
- max-width: 100%;
- max-height: 100%;
- }
- }
- .gray {
- color: #a3a3a3;
- }
- .origin {
- color: #f90;
- }
- }
- .more {
- position: relative;
- background: url('../../assets/teacherdev/image 13.png') center;
- .shade {
- position: absolute;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 100%;
- cursor: pointer;
- background: #000;
- opacity: 0.6;
- > div {
- img {
- width: 58px;
- height: 58px;
- }
- span {
- position: relative;
- top: -20px;
- color: white;
- }
- }
- }
- }
- }
- }
- </style>
|