更新组件代码,优化material选择器功能,并修复部分错误
This commit is contained in:
parent
7446d2c97f
commit
c43b561d6c
|
@ -128,7 +128,7 @@
|
|||
<ul class="file-list flex flex-wrap mt-4">
|
||||
<li class="file-item-wrap" v-for="item in pager.lists" :key="item.id" :style="{ width: fileSize }">
|
||||
<del-wrap @close="batchFileDelete([item.id])">
|
||||
<file-item :uri="item.url" :file-size="fileSize" :type="type" @click="selectFile(item)">
|
||||
<file-item :uri="item.uri" :file-size="fileSize" :type="type" @click="selectFile(item)">
|
||||
<div class="item-selected" v-if="isSelect(item.id)">
|
||||
<icon :size="24" name="el-icon-Check" color="#fff" />
|
||||
</div>
|
||||
|
@ -143,7 +143,7 @@
|
|||
</popover-input>
|
||||
|
||||
<el-button v-if="item.type === 10 || item.type === 20" type="primary" link
|
||||
@click="handlePreview(item.url)">
|
||||
@click="handlePreview(item.uri)">
|
||||
查看
|
||||
</el-button>
|
||||
|
||||
|
@ -170,7 +170,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="名称" min-width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link @click.stop="handlePreview(row.url)" :underline="false">
|
||||
<el-link @click.stop="handlePreview(row.uri)" :underline="false">
|
||||
{{ row.name }}
|
||||
</el-link>
|
||||
</template>
|
||||
|
@ -185,8 +185,8 @@
|
|||
</popover-input>
|
||||
</div>
|
||||
<div class="inline-block">
|
||||
<el-button type="primary" link @click.stop="handlePreview(row.url)">
|
||||
查12看
|
||||
<el-button type="primary" link @click.stop="handlePreview(row.uri)">
|
||||
查看
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="inline-block">
|
||||
|
@ -247,7 +247,7 @@
|
|||
<li class="mb-4" v-for="item in select" :key="item.id">
|
||||
<div class="select-item">
|
||||
<del-wrap @close="cancelSelete(item.id)">
|
||||
<file-item :uri="item.url" file-size="100px" :type="type"></file-item>
|
||||
<file-item :uri="item.uri" file-size="100px" :type="type"></file-item>
|
||||
</del-wrap>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -1,33 +1,18 @@
|
|||
<template>
|
||||
<div class="material-select">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
width="830px"
|
||||
custom-class="body-padding"
|
||||
:title="`选择${tipsText}`"
|
||||
@confirm="handleConfirm"
|
||||
@close="handleClose"
|
||||
>
|
||||
<popup ref="popupRef" width="830px" custom-class="body-padding" :title="`选择${tipsText}`" @confirm="handleConfirm"
|
||||
@close="handleClose">
|
||||
<template v-if="!hiddenUpload" #trigger>
|
||||
<div class="material-select__trigger clearfix" @click.stop>
|
||||
<draggable class="draggable" v-model="fileList" animation="300" item-key="id">
|
||||
<template v-slot:item="{ element, index }">
|
||||
<div
|
||||
class="material-preview"
|
||||
:class="{
|
||||
'is-disabled': disabled,
|
||||
'is-one': limit == 1
|
||||
}"
|
||||
@click="showPopup(index)"
|
||||
>
|
||||
<div class="material-preview" :class="{
|
||||
'is-disabled': disabled,
|
||||
'is-one': limit == 1
|
||||
}" @click="showPopup(index)">
|
||||
<del-wrap @close="deleteImg(index)">
|
||||
<file-item
|
||||
:uri="excludeDomain ? getImageUrl(element) : element"
|
||||
:file-size="size"
|
||||
:width="width"
|
||||
:height="height"
|
||||
:type="type"
|
||||
></file-item>
|
||||
<file-item :uri="excludeDomain ? getImageUrl(element) : element" :file-size="size"
|
||||
:width="width" :height="height" :type="type"></file-item>
|
||||
</del-wrap>
|
||||
<div class="operation-btns text-xs text-center">
|
||||
<span>修改</span>
|
||||
|
@ -37,24 +22,16 @@
|
|||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
<div
|
||||
class="material-upload"
|
||||
@click="showPopup(-1)"
|
||||
v-show="showUpload"
|
||||
:class="{
|
||||
'is-disabled': disabled,
|
||||
'is-one': limit == 1,
|
||||
[uploadClass]: true
|
||||
}"
|
||||
>
|
||||
<div class="material-upload" @click="showPopup(-1)" v-show="showUpload" :class="{
|
||||
'is-disabled': disabled,
|
||||
'is-one': limit == 1,
|
||||
[uploadClass]: true
|
||||
}">
|
||||
<slot name="upload">
|
||||
<div
|
||||
class="upload-btn"
|
||||
:style="{
|
||||
width: width || size,
|
||||
height: height || size
|
||||
}"
|
||||
>
|
||||
<div class="upload-btn" :style="{
|
||||
width: width || size,
|
||||
height: height || size
|
||||
}">
|
||||
<icon :size="25" name="el-icon-Plus" />
|
||||
<span>添加</span>
|
||||
</div>
|
||||
|
@ -64,13 +41,8 @@
|
|||
</template>
|
||||
<el-scrollbar>
|
||||
<div class="material-wrap">
|
||||
<material
|
||||
ref="materialRef"
|
||||
:type="type"
|
||||
:file-size="fileSize"
|
||||
:limit="meterialLimit"
|
||||
@change="selectChange"
|
||||
/>
|
||||
<material ref="materialRef" :type="type" :file-size="fileSize" :limit="meterialLimit"
|
||||
@change="selectChange" />
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</popup>
|
||||
|
@ -186,7 +158,7 @@ export default defineComponent({
|
|||
const handleConfirm = useThrottleFn(
|
||||
() => {
|
||||
const selectUri = select.value.map((item) =>
|
||||
props.excludeDomain ? item.uri : item.url
|
||||
props.excludeDomain ? item.uri : item.uri
|
||||
)
|
||||
if (!isAdd.value) {
|
||||
fileList.value.splice(currentIndex.value, 1, selectUri.shift())
|
||||
|
@ -270,6 +242,7 @@ export default defineComponent({
|
|||
|
||||
<style scoped lang="scss">
|
||||
.material-select {
|
||||
|
||||
.material-upload,
|
||||
.material-preview {
|
||||
position: relative;
|
||||
|
@ -279,17 +252,21 @@ export default defineComponent({
|
|||
margin-bottom: 8px;
|
||||
box-sizing: border-box;
|
||||
float: left;
|
||||
|
||||
&.is-disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&.is-one {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.operation-btns {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.operation-btns {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
@ -301,12 +278,14 @@ export default defineComponent({
|
|||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.material-upload {
|
||||
:deep(.upload-btn) {
|
||||
@apply text-tx-secondary box-border rounded border-br border-dashed border flex flex-col justify-center items-center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.material-wrap {
|
||||
min-width: 720px;
|
||||
height: 430px;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<el-form-item label="店员名称" prop="staff_name">
|
||||
<el-input v-model="formData.staff_name" clearable placeholder="请输入店员名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像">
|
||||
<el-form-item label="头34像">
|
||||
<material-picker v-model="formData.avatar" :limit="1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="店员账号" prop="account">
|
||||
|
|
Loading…
Reference in New Issue