Commit 35bfbed2 authored by yaya's avatar yaya

feat:添加图片拖拽功能

parent 0df24380
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
"vue2-org-tree": "^1.3.6", "vue2-org-tree": "^1.3.6",
"vued3tree": "^5.1.0", "vued3tree": "^5.1.0",
"vuex": "3.0.1", "vuex": "3.0.1",
"xlsx": "^0.11.16" "xlsx": "^0.11.16",
"vuedraggable": "^2.23.2"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "8.5.0", "autoprefixer": "8.5.0",
......
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
<div class="detail_image"> <div class="detail_image">
<div class="detail_title">{{ `钱币图片:` }}</div> <div class="detail_title">{{ `钱币图片:` }}</div>
<div class="list"> <div class="list">
<Draggable
v-model="imageList"
class="flex f-fw-w img__wrapper"
handle=".gallery"
anmition="500"
delay="20">
<div v-for="(item, index) in imageList" :key="item + index" class="select_item"> <div v-for="(item, index) in imageList" :key="item + index" class="select_item">
<img :src="item" class="gallery" @click="handleShowLargeDialog(item)"> <img :src="item" class="gallery" @click="handleShowLargeDialog(item)">
<div class="edit" @click="handlerChangeImage(item)">编辑</div> <div class="edit" @click="handlerChangeImage(item)">编辑</div>
...@@ -42,6 +48,8 @@ ...@@ -42,6 +48,8 @@
{{ imageMainPosition === index ? '主图' : '设为主图' }} {{ imageMainPosition === index ? '主图' : '设为主图' }}
</div> </div>
</div> </div>
</Draggable>
</div> </div>
</div> </div>
...@@ -195,6 +203,7 @@ import { ...@@ -195,6 +203,7 @@ import {
import CheckLargeImageDialog from './components/CheckLargeImageDialog' import CheckLargeImageDialog from './components/CheckLargeImageDialog'
import CutImageDialog from './components/CutImageDialog' import CutImageDialog from './components/CutImageDialog'
import CutEditImageDialog from './components/CutEditImageDialog' import CutEditImageDialog from './components/CutEditImageDialog'
import Draggable from 'vuedraggable'
export default { export default {
name: 'InfoSet', name: 'InfoSet',
...@@ -205,7 +214,8 @@ export default { ...@@ -205,7 +214,8 @@ export default {
SelectImageDialog, SelectImageDialog,
VuePictureCut, VuePictureCut,
VuePictureCutMask, VuePictureCutMask,
VuePictureCutMenu VuePictureCutMenu,
Draggable
}, },
filters: { filters: {
trimHtml(html_str) { trimHtml(html_str) {
...@@ -413,6 +423,17 @@ export default { ...@@ -413,6 +423,17 @@ export default {
this.$message.warning('请设置主图') this.$message.warning('请设置主图')
return return
} }
if (this.imageList.length) {
const list = []
for (let i = 0; i < this.imageList.length; i++) {
if (this.goodsParams.images.indexOf(this.imageList[i]) !== -1) {
list.push(this.imageList[i])
}
}
this.goodsParams.images = list
}
console.log('========', this.goodsParams.images)
this.goodsParams.state = 10 this.goodsParams.state = 10
editGoods(this.goodsParams).then(response => { editGoods(this.goodsParams).then(response => {
this.$message.success('发布成功') this.$message.success('发布成功')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment