|
@@ -1,16 +1,23 @@
|
|
|
<template>
|
|
|
<MainPanel>
|
|
|
<template v-slot:header>
|
|
|
- <ui-icon type="close" ctrl style="margin-right: 10px" @click="router.back" />
|
|
|
- 照片管理
|
|
|
+ <Header :count="selects.length">
|
|
|
+ <ui-button type="primary" @click="selectMode = !selectMode" width="96px">
|
|
|
+ {{ selectMode ? '取消' : '选择' }}
|
|
|
+ </ui-button>
|
|
|
+ </Header>
|
|
|
</template>
|
|
|
|
|
|
<Photos
|
|
|
v-model:active="active"
|
|
|
v-model:selects="selects"
|
|
|
+ :select-mode="selectMode"
|
|
|
:data="sortPhotos"
|
|
|
/>
|
|
|
- <ButtonPane class="back fun-ctrl" @click="router.push(writeRouteName.scene)">
|
|
|
+ <ButtonPane class="back fun-ctrl" @click="router.push(writeRouteName.scene)" v-if="!selectMode">
|
|
|
+ <ui-icon type="close" class="icon" />
|
|
|
+ </ButtonPane>
|
|
|
+ <ButtonPane class="del fun-ctrl" @click="delSelects" v-if="selects.length">
|
|
|
<ui-icon type="close" class="icon" />
|
|
|
</ButtonPane>
|
|
|
</MainPanel>
|
|
@@ -41,24 +48,39 @@
|
|
|
<script setup lang="ts">
|
|
|
import MainPanel from '@/components/main-panel/index.vue'
|
|
|
import FillSlide from '@/components/fill-slide/index.vue'
|
|
|
+import Header from '@/components/photos/header.vue'
|
|
|
import {PhotoRaw, photos} from '@/store/photos'
|
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
|
import {router, writeRouteName} from '@/router'
|
|
|
import ButtonPane from "@/components/button-pane/index.vue";
|
|
|
-import {computed, ref} from "vue";
|
|
|
+import {computed, ref, watchEffect} from "vue";
|
|
|
import {Mode} from '@/views/graphic/menus'
|
|
|
import UiButton from "@/components/base/components/button/index.vue";
|
|
|
import Photos from '@/components/photos'
|
|
|
|
|
|
const sortPhotos = computed(() => photos.value.reverse())
|
|
|
const active = ref<PhotoRaw>()
|
|
|
+const selectMode = ref(false)
|
|
|
const selects = ref<PhotoRaw[]>([])
|
|
|
-const delPhoto = () => {
|
|
|
- const index = photos.value.indexOf(active.value)
|
|
|
+
|
|
|
+watchEffect(() => {
|
|
|
+ if (!selectMode.value) {
|
|
|
+ selects.value = []
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const delPhoto = (photo = active.value) => {
|
|
|
+ const index = photos.value.indexOf(photo)
|
|
|
if (~index) {
|
|
|
photos.value.splice(index, 1)
|
|
|
}
|
|
|
}
|
|
|
+const delSelects = () => {
|
|
|
+ while (selects.value.length) {
|
|
|
+ delPhoto(selects.value[0])
|
|
|
+ selects.value.shift()
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
const gotoDraw = (mode: Mode) => {
|
|
|
router.push({ name: writeRouteName.graphic, params: {mode, id: active.value.id, action: 'add'} })
|
|
@@ -67,9 +89,7 @@ const gotoDraw = (mode: Mode) => {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-.back {
|
|
|
- right: var(--boundMargin);
|
|
|
- bottom: var(--boundMargin);
|
|
|
+.fun-ctrl {
|
|
|
color: #fff;
|
|
|
font-size: 20px;
|
|
|
transition: color .3s ease;
|
|
@@ -80,6 +100,17 @@ const gotoDraw = (mode: Mode) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+.back {
|
|
|
+ right: var(--boundMargin);
|
|
|
+ bottom: var(--boundMargin);
|
|
|
+}
|
|
|
+
|
|
|
+.del {
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ bottom: var(--boundMargin);
|
|
|
+}
|
|
|
+
|
|
|
.btns {
|
|
|
display: flex;
|
|
|
align-items: center;
|