|
@@ -2,8 +2,11 @@
|
|
|
<div class="VueDraggable">
|
|
|
<VueDraggable v-if="list.length" class="draggable" ref="el" v-model="list" @sort="onChange">
|
|
|
<div class="item" v-for="(item, index) in list" :key="item.id" @click="handleItem(index)">
|
|
|
- <img class="itemImg" src="https://4dscene.4dage.com/new4dkk/v2/lang/images/home/caseList/bwg.png" alt="" />
|
|
|
- <div class="text">{{ item.name }}</div>
|
|
|
+ <img class="itemImg" :src="item.imgUrl" alt="" />
|
|
|
+ <div class="text">
|
|
|
+ {{ item.imgInfo }}
|
|
|
+ <EditPen @click.stop="handleEdit(item)" class="EditPen" />
|
|
|
+ </div>
|
|
|
<CircleCloseFilled @click.stop="handleDet(index)" class="itemIcon" />
|
|
|
</div>
|
|
|
</VueDraggable>
|
|
@@ -13,10 +16,11 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, onMounted, watch } from 'vue'
|
|
|
-import { Case } from "@/store/case";
|
|
|
+import { caseImgList, CaseImg } from "@/store/case";
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
+import { addCaseImgFile } from "../quisk";
|
|
|
// import { IconRabbish } from '@element-plus/icons-vue'
|
|
|
-const props = defineProps({ sortType: Boolean });
|
|
|
+const props = defineProps({ sortType: Boolean, caseId: Number });
|
|
|
const emit = defineEmits<{
|
|
|
(e: "changeList", value: Case[] | null): void;
|
|
|
(e: "handleItem", value: Number | null): void;
|
|
@@ -125,13 +129,24 @@ function handleItem(index) {
|
|
|
emit("handleItem", index);
|
|
|
|
|
|
}
|
|
|
+async function getList () {
|
|
|
+ let lists = await caseImgList(props.caseId)
|
|
|
+ list.value = lists.data
|
|
|
+ emit("changeList", list.value);
|
|
|
+
|
|
|
+}
|
|
|
function handleDet(index: Number) {
|
|
|
list.value.splice(index, 1)
|
|
|
emit("changeList", list.value);
|
|
|
console.log('handleDet', list.value);
|
|
|
}
|
|
|
+function handleEdit(params) {
|
|
|
+ addCaseImgFile({ caseId: props.caseId, data: {
|
|
|
+ ...params,
|
|
|
+ } });
|
|
|
+}
|
|
|
onMounted(() => {
|
|
|
- emit("changeList", list.value);
|
|
|
+ getList()
|
|
|
// emit("update:list", props.list.value);
|
|
|
})
|
|
|
|
|
@@ -152,6 +167,15 @@ onMounted(() => {
|
|
|
margin-top: 16px;
|
|
|
.itemImg{
|
|
|
width: 100%;
|
|
|
+ height: 62px;
|
|
|
+ object-fit: cover;
|
|
|
+ }
|
|
|
+ .text{
|
|
|
+ .EditPen{
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
}
|
|
|
.itemIcon{
|
|
|
width: 20px;
|