Skip to content

Commit

Permalink
optimize: subject card in collection page. (#621)
Browse files Browse the repository at this point in the history
* optimize: subject card in collection page.

* docs: update CHANGELOG.MD
  • Loading branch information
ChiveHao authored Jul 12, 2024
1 parent fd0841a commit 4f30fdb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

- 收藏的接口聚合和优化 #617

## 问题修复

- Console的收藏页条目卡片非预期边框和进度条

# 0.13.1

## 优化
Expand Down
37 changes: 22 additions & 15 deletions console/src/components/modules/content/subject/SubjectCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import {ElCard, ElProgress} from 'element-plus';
import {onMounted, ref, watch} from 'vue';
import {computed, onMounted, ref, watch} from 'vue';
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -78,29 +78,34 @@ const changeStyleByPercentage = (percentage: number) => {
}
};
const isPercentageExists = computed({
get() {
return props.percentage && props.percentage >= 0;
},
set() {
}
});
onMounted(() => {
changeStyleByPercentage(props.percentage);
if (isPercentageExists.value) {
changeStyleByPercentage(props.percentage);
} else {
cardStyle.value = {border: ''};
}
});
</script>

<template>
<el-card
shadow="hover"
class="container"
:body-style="{ padding: '0px' }"
:style="cardStyle"
>
<el-card shadow="hover" class="container" :body-style="{ padding: '0px' }" :style="cardStyle">
<template #header>
<div class="card-header">
<span>{{ props.name }} </span>
<span class="grey">{{ props.nameCn }}</span>
</div>
</template>
<el-progress
:percentage="props.percentage"
:color="progressColor"
:show-text="false"
/>
<el-progress v-if="isPercentageExists" :percentage="props.percentage" :color="progressColor"
:show-text="false"/>
<span class="card-body">
<img :src="props.cover" />
</span>
Expand All @@ -113,12 +118,14 @@ onMounted(() => {
width: 100%;
height: auto;
aspect-ratio: 24/39;
.card-header {
.card-header {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 15px;
.grey {
.grey {
font-size: 10px;
color: #999;
}
Expand Down

0 comments on commit 4f30fdb

Please sign in to comment.