123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <template>
- <div class="card-cover-detail">
- <div class="cover-box">
- <img class="cover" :src="info.cover" alt="" v-if="is_normal" />
- <div class="is_normal" v-else>
- <img src="@/assets/icon/lapse.png" alt="" />
- </div>
- <div class="type">{{ is_normal ? type : "已失效" }}</div>
- </div>
- <div class="info-box" v-if="is_normal">
- <div class="title-box">
- <div class="series-title">{{ info.series_title }}</div>
- <div class="title">{{ info.title }}</div>
- </div>
- <div class="footer">
- <img class="app-logo" :src="info.app_logo" alt="" />
- <div class="app-name">{{ info.app_name }}</div>
- <img class="icon" src="@/assets/icon/play.png" />
- <div class="read-num">{{ info.read_num || 0 }}</div>
- </div>
- </div>
- <div class="info-box" v-else>
- <div class="is_normal">已失效</div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "CardCoverDetail",
- props: {
- info: {
- type: Object,
- },
- },
- data() {
- return {
- show: false,
- typeDict: {
- article_id: "图文",
- video_id: "视频",
- },
- };
- },
- computed: {
- type() {
- let typeKey = "";
- for (let key in this.typeDict) {
- if (Reflect.has(this.info, key)) {
- typeKey = key;
- }
- }
- if (typeKey == "video_id") {
- const time = this.info.duration;
- let m = Math.floor(time / 60),
- s = Math.floor(time - m * 60);
- s == 0 ? (s = 1) : "";
- return (
- m.toString().padStart(2, "0") + ":" + s.toString().padStart(2, "0")
- );
- } else {
- return this.typeDict[typeKey];
- }
- },
- is_normal() {
- return Reflect.has(this.info, "is_normal") ? !!this.info.is_normal : true;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .card-cover-detail {
- width: 100%;
- display: flex;
- align-items: center;
- cursor: default;
- .cover-box {
- width: 200px;
- height: 120px;
- position: relative;
- .cover {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- .is_normal {
- width: 100%;
- height: 100%;
- background: #d8d8d8;
- display: flex;
- align-items: center;
- justify-content: center;
- img {
- width: 20px;
- height: 20px;
- }
- }
- .type {
- padding: 0 3px;
- height: 18px;
- font-size: 12px;
- font-weight: 400;
- color: #ffffff;
- line-height: 18px;
- text-align: center;
- background: rgba(0, 0, 0, 0.7);
- border-radius: 2px;
- position: absolute;
- bottom: 10px;
- right: 10px;
- }
- }
- .info-box {
- width: calc(100% -140px);
- height: 114px;
- margin-left: 15px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding: 3px 0;
- .is_normal {
- width: 100%;
- height: 100%;
- text-align: center;
- line-height: 114px;
- color: #999999;
- font-size: 14px;
- }
- .title-box {
- width: 100%;
- height: 114px;
- .series-title {
- max-width: 500px;
- height: 25px;
- line-height: 25px;
- width: 100%;
- font-size: 16px;
- font-weight: 400;
- color: #222222;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- }
- .title {
- width: 100%;
- max-width: 500px;
- font-size: 16px;
- font-weight: 400;
- color: #222222;
- }
- }
- .footer {
- display: flex;
- align-items: center;
- .app-logo {
- width: 16px;
- height: 16px;
- border-radius: 50%;
- }
- .app-name {
- font-size: 12px;
- font-weight: 400;
- color: #666666;
- margin-left: 5px;
- }
- .icon {
- height: 14px;
- width: 14px;
- margin-left: 10px;
- }
- .read-num {
- font-size: 12px;
- font-weight: 400;
- color: #999999;
- margin-left: 3px;
- }
- }
- }
- }
- </style>
|