补充组件

This commit is contained in:
yanghang
2025-06-19 18:51:11 +08:00
parent a28f134234
commit be952c8501
8 changed files with 619 additions and 16 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<view class="course-item-box" @click="clickItem">
<view class="img-box-view">
<ImagePreview class="img-box"></ImagePreview>
<ImagePreview class="img-box" :imgId="itemInfo.imgId"></ImagePreview>
<view class="item-grade">{{itemInfo.evalGrade}}</view>
</view>
<view class="cont-box">
+15 -15
View File
@@ -1,6 +1,6 @@
<template>
<!-- <image :src="imgUrlShow"></image> -->
<image class="img" src="@/static/images/test/1.png"></image>
<image :src="imgUrlShow"></image>
<!-- <image class="img" src="@/static/images/test/1.png"></image> -->
</template>
<script>
@@ -8,7 +8,7 @@
export default {
name:"image-preview",
props:{
modelValue:{
imgId:{
default:'',
type:String
}
@@ -19,7 +19,7 @@
};
},
watch: {
modelValue: {
imgId: {
handler(newval, oldval) {
if (newval) {
this.getPreviewUrlBlob(newval);
@@ -40,20 +40,20 @@
},
methods: {
getPreviewUrlBlob(id) {
this.imgUrlShow = '@/static/images/index/message_b.png'
// previewFile(id).then((res) => {
// this.imgUrlShow = URL.createObjectURL(res);
// // const reader = new FileReader();
// // reader.readAsDataURL(res)
// // reader.onloadend = () => {
// // this.imgUrlShow = reader.result;
// // }
// });
// this.imgUrlShow = '@/static/images/index/message_b.png'
previewFile(id).then((res) => {
this.imgUrlShow = URL.createObjectURL(res);
// const reader = new FileReader();
// reader.readAsDataURL(res)
// reader.onloadend = () => {
// this.imgUrlShow = reader.result;
// }
});
},
},
mounted() {
if (this.modelValue) {
this.getPreviewUrlBlob(this.modelValue);
if (this.imgId) {
this.getPreviewUrlBlob(this.imgId);
}
},
beforeDestroy() {