Skip to content

Commit

Permalink
💄 调整帖子卡片颜色,对于宽度不低于690的图片进行铺满
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Sep 7, 2024
1 parent 3517f91 commit 5bc6871
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/components/main/t-postcard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-card rounded v-if="card">
<v-card :rounded="true" v-if="card">
<div class="tpc-cover">
<img :src="card.cover" alt="cover" @click="createPost(card)" />
<div v-if="isAct" class="tpc-act">
Expand Down Expand Up @@ -100,19 +100,19 @@ onBeforeMount(() => {
const EnumStatus = {
STARTED: {
status: "进行中",
colorCss: "#1EE2BA",
colorCss: "var(--tgc-od-green)",
},
FINISHED: {
status: "已结束",
colorCss: "#C0C5C8",
colorCss: "var(--tgc-od-white)",
},
SELECTION: {
status: "评选中",
colorCss: "#FF983B",
colorCss: "var(--tgc-od-orange)",
},
UNKNOWN: {
status: "未知",
colorCss: "#F03F24", // 胭脂红
colorCss: "var(--tgc-od-red)",
},
};
Expand Down
11 changes: 9 additions & 2 deletions src/components/post/tp-image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<img :src="localUrl" :alt="props.data.insert.image" :title="getImageTitle()" />
</div>
<div v-else class="tp-image-load" :title="getImageUrl()">
<v-progress-circular indeterminate color="primary" size="small" />
<v-progress-circular :indeterminate="true" color="primary" size="small" />
<span>加载中...</span>
</div>
<TpoImage :image="props.data" v-model="showOverlay" />
</template>
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from "vue";
import { computed, ref, onMounted, onUnmounted } from "vue";
import { saveImgLocal } from "../../utils/TGShare.js";
import { bytesToSize } from "../../utils/toolFunc.js";
Expand Down Expand Up @@ -37,6 +37,12 @@ const props = defineProps<TpImageProps>();
const showOverlay = ref(false);
const localUrl = ref<string | undefined>(undefined);
const imgWidth = computed<string>(() => {
if (props.data.attributes === undefined) return "auto";
if (props.data.attributes.width >= 690) return "100%";
return `${props.data.attributes.width}px`;
});
console.log("tp-image", props.data.insert.image, props.data.attributes);
onMounted(async () => {
Expand Down Expand Up @@ -79,6 +85,7 @@ function getImageUrl(): string {
}
.tp-image-box img {
width: v-bind(imgWidth);
max-width: 100%;
height: auto;
border-radius: 10px;
Expand Down

0 comments on commit 5bc6871

Please sign in to comment.