mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 06:38:13 -05:00
Updated: gallery functions
This commit is contained in:
parent
1781a8902c
commit
5d9e0a311d
@ -5,6 +5,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-row class="gallery-list">
|
<el-row class="gallery-list">
|
||||||
<el-col :span="20" :offset="2">
|
<el-col :span="20" :offset="2">
|
||||||
|
<el-row class="handle-bar" :gutter="16">
|
||||||
|
<el-col :span="6" v-for="(item, index) in $picBed" :key="item.type">
|
||||||
|
<div class="pic-bed-item" @click="choosePicBed(item.type)" :class="{active: choosedPicBed.indexOf(item.type) !== -1}">
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="item-base delete">
|
||||||
|
<i class="el-icon-delete"></i> 批量删除
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<gallerys
|
<gallerys
|
||||||
:images="images"
|
:images="images"
|
||||||
@ -12,7 +24,7 @@
|
|||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
:options="options"
|
:options="options"
|
||||||
></gallerys>
|
></gallerys>
|
||||||
<el-col :span="6" v-for="(item, index) in images" :key="item.id">
|
<el-col :span="6" v-for="(item, index) in images" :key="item.id" class="gallery-list__img">
|
||||||
<div
|
<div
|
||||||
class="gallery-list__item"
|
class="gallery-list__item"
|
||||||
:style="{ 'background-image': `url(${item.imgUrl})` }"
|
:style="{ 'background-image': `url(${item.imgUrl})` }"
|
||||||
@ -23,6 +35,7 @@
|
|||||||
<i class="el-icon-document" @click="copy(item.imgUrl)"></i>
|
<i class="el-icon-document" @click="copy(item.imgUrl)"></i>
|
||||||
<i class="el-icon-edit-outline" @click="openDialog(item)"></i>
|
<i class="el-icon-edit-outline" @click="openDialog(item)"></i>
|
||||||
<i class="el-icon-delete" @click="remove(item.id)"></i>
|
<i class="el-icon-delete" @click="remove(item.id)"></i>
|
||||||
|
<el-checkbox v-model="choosedList[item.id]" class="pull-right"></el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -63,12 +76,31 @@ export default {
|
|||||||
imgInfo: {
|
imgInfo: {
|
||||||
id: null,
|
id: null,
|
||||||
imgUrl: ''
|
imgUrl: ''
|
||||||
}
|
},
|
||||||
|
choosedList: {},
|
||||||
|
choosedPicBed: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.getGallery()
|
this.getGallery()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
choosedPicBed (val) {
|
||||||
|
if (val.length > 0) {
|
||||||
|
this.images = []
|
||||||
|
let arr = []
|
||||||
|
val.forEach(item => {
|
||||||
|
arr = arr.concat(this.$db.read().get('uploaded').filter({type: item}).reverse().value())
|
||||||
|
})
|
||||||
|
this.images = arr
|
||||||
|
} else {
|
||||||
|
this.images = this.$db.read().get('uploaded').slice().reverse().value()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
choosedList (val) {
|
||||||
|
console.log(val)
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getGallery () {
|
getGallery () {
|
||||||
this.images = this.$db.read().get('uploaded').slice().reverse().value()
|
this.images = this.$db.read().get('uploaded').slice().reverse().value()
|
||||||
@ -134,6 +166,14 @@ export default {
|
|||||||
}
|
}
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.getGallery()
|
this.getGallery()
|
||||||
|
},
|
||||||
|
choosePicBed (type) {
|
||||||
|
let idx = this.choosedPicBed.indexOf(type)
|
||||||
|
if (idx !== -1) {
|
||||||
|
this.choosedPicBed.splice(idx, 1)
|
||||||
|
} else {
|
||||||
|
this.choosedPicBed.push(type)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,14 +186,30 @@ export default {
|
|||||||
margin 10px auto
|
margin 10px auto
|
||||||
.sub-title
|
.sub-title
|
||||||
font-size 14px
|
font-size 14px
|
||||||
|
.item-base
|
||||||
|
background #2E2E2E
|
||||||
|
text-align center
|
||||||
|
margin-bottom 10px
|
||||||
|
padding 6px 0
|
||||||
|
cursor pointer
|
||||||
|
font-size 13px
|
||||||
|
transition all .2s ease-in-out
|
||||||
|
&.delete
|
||||||
|
cursor not-allowed
|
||||||
|
&.delete.active
|
||||||
|
cursor pointer
|
||||||
|
background #49B1F5
|
||||||
|
color #fff
|
||||||
#gallery-view
|
#gallery-view
|
||||||
|
.pull-right
|
||||||
|
float right
|
||||||
.gallery-list
|
.gallery-list
|
||||||
height 360px
|
height 360px
|
||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
padding 8px 0
|
padding 8px 0
|
||||||
overflow-y auto
|
overflow-y auto
|
||||||
overflow-x hidden
|
overflow-x hidden
|
||||||
.el-col
|
&__img
|
||||||
height 150px
|
height 150px
|
||||||
position relative
|
position relative
|
||||||
margin-bottom 16px
|
margin-bottom 16px
|
||||||
@ -193,4 +249,12 @@ export default {
|
|||||||
.blueimp-gallery
|
.blueimp-gallery
|
||||||
.title
|
.title
|
||||||
top 30px
|
top 30px
|
||||||
|
.handle-bar
|
||||||
|
color #ddd
|
||||||
|
.pic-bed-item
|
||||||
|
@extend .item-base
|
||||||
|
&:hover,
|
||||||
|
&.active
|
||||||
|
background #49B1F5
|
||||||
|
color #fff
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user