feat: 添加深色模式和照片预览优化
- 新增全局深色模式切换功能,支持手动切换和跟随系统主题 - 优化照片墙预览,使用ElImageViewer组件支持左右切换 - 引入Element Plus深色模式相关样式文件 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+15
-10
@@ -75,10 +75,16 @@
|
||||
@current-change="pageChange">
|
||||
</el-pagination>
|
||||
</div>
|
||||
<el-image-viewer
|
||||
v-if="previewVisible"
|
||||
:url-list="previewUrlList"
|
||||
:initial-index="previewIndex"
|
||||
@close="previewVisible = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, h } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { MsgResult, Page } from '@/model/common.dto'
|
||||
@@ -106,8 +112,11 @@ const store = useStore()
|
||||
const { loading, total, search, setLoadData, loadDataBase, reset, pageChange, pageSizeChange } = useBaseList(new PhotoWallPage())
|
||||
|
||||
const allowUploadExt = ['jpg', 'jpeg', 'png']
|
||||
const photowallData = ref([])
|
||||
const photowallData = ref<PhotoWallModel[]>([])
|
||||
const isUploading = ref(false)
|
||||
const previewVisible = ref(false)
|
||||
const previewUrlList = ref<string[]>([])
|
||||
const previewIndex = ref(0)
|
||||
|
||||
let selectedData: string[] = []
|
||||
|
||||
@@ -157,15 +166,11 @@ function uploadError(error: Error) {
|
||||
ElMessage.error(error.message)
|
||||
}
|
||||
async function preview(row: PhotoWallModel) {
|
||||
const previewHeight = Math.floor(row.height * (500 / row.width))
|
||||
const pictureCdn = await http.get('/api/v2/common/config/picture_cdn')
|
||||
ElMessageBox({
|
||||
title: '图片预览',
|
||||
message: h('img', { style: `width:500px;height:${previewHeight}px;`, src: `${pictureCdn}/${row.name}` }, ''),
|
||||
showCancelButton: false,
|
||||
confirmButtonText: '关闭',
|
||||
customStyle: {width: '530px', maxWidth: 'unset'}
|
||||
}).catch(() => {})
|
||||
const index = photowallData.value.findIndex(item => item._id === row._id)
|
||||
previewUrlList.value = photowallData.value.map(item => `${pictureCdn}/${item.name}`)
|
||||
previewIndex.value = index >= 0 ? index : 0
|
||||
previewVisible.value = true
|
||||
}
|
||||
|
||||
// created
|
||||
|
||||
Reference in New Issue
Block a user