图片显示

This commit is contained in:
nisen
2023-09-07 10:41:39 +08:00
parent cf17d75f0e
commit 98759fc83d
2 changed files with 15 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@@ -24,7 +24,8 @@
<template #bodyCell="{ column, record }">
<div v-if="column.dataIndex === 'title'" style="display:flex;align-items:center;">
<div>
<a-image :width="150" :height="75" :src="record.coverImg"></a-image>
<img v-if="record.coverImg" :width="150" :height="75" :src="useImgUrl(record.coverImg)" />
<img v-else :width="150" :height="75" src="../../assets/images/course.png" alt="">
</div>
<div style="height:75px;margin-left: 10px;">
<div style="height:25px">{{ record.name }}</div>
@@ -64,6 +65,19 @@
import { defineProps, ref, computed, reactive, nextTick, watch } from "vue";
import { Form, message } from "ant-design-vue";
import { addCourselList, courseIds, saveCourseList } from "@/api/grateful";
const fileBaseUrl = ref('https:' + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_AVATAR_PATH)
const useImgUrl = (url) => {
let imgUrl = url
if (imgUrl && imgUrl && imgUrl.startsWith('http')) {
return imgUrl;
}
if (imgUrl && imgUrl && imgUrl != "") {
return fileBaseUrl.value + imgUrl;
} else if (imgUrl == "") {
return "../../assets/images/course.png";
}
return ''
}
const formatNum = (num) => {
let rsNum = 0;
if (num < 5) { return num; }