|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div v-loading="loading">
|
|
|
<el-row v-if="dataList.length !== 0">
|
|
|
<el-col
|
|
|
v-for="(album, index) in dataList"
|
|
|
@@ -18,44 +18,22 @@
|
|
|
/>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row v-else>
|
|
|
+<!-- <el-row v-else>
|
|
|
<span style="color: #007bff">这是一个空相册, 快去添加点照片到相册中吧!</span>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-pagination
|
|
|
- :small="screenWidth <= 768"
|
|
|
- hide-on-single-page
|
|
|
- layout="prev, pager, next"
|
|
|
- :page-size="pageSize"
|
|
|
- :current-page="currentPage"
|
|
|
- :total="totalSize"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- @prev-click="handleCurrentChange"
|
|
|
- @next-click="handleCurrentChange"
|
|
|
- />
|
|
|
- </el-row>
|
|
|
+ </el-row>-->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-import { createAlbum, getAlbumDetail } from '@/api/disk'
|
|
|
+import { getAlbumDetail } from '@/api/disk'
|
|
|
|
|
|
export default {
|
|
|
name: 'DiskAlbum',
|
|
|
data() {
|
|
|
return {
|
|
|
- // 屏幕宽度, 为了控制分页条的大小
|
|
|
- screenWidth: document.body.clientWidth,
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 12,
|
|
|
- totalSize: 0,
|
|
|
dataList: [],
|
|
|
- albumId: null,
|
|
|
- showCreateAlbumDialog: false,
|
|
|
- createAlbumForm: {
|
|
|
- albumName: null
|
|
|
- }
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -75,27 +53,20 @@ export default {
|
|
|
this.getData(albumId)
|
|
|
},
|
|
|
methods: {
|
|
|
- handleCurrentChange(pageNumber) {
|
|
|
- this.currentPage = pageNumber
|
|
|
- this.dataList = []
|
|
|
- // this.getData(albumId)
|
|
|
- // 回到顶部
|
|
|
- scrollTo(0, 0)
|
|
|
- },
|
|
|
getData(albumId) {
|
|
|
+ this.loading = true
|
|
|
getAlbumDetail(albumId).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
- this.dataList = resp.data.list
|
|
|
+ const respData = resp.data
|
|
|
+ document.title = respData.albumName
|
|
|
+ this.dataList = respData.diskFileList
|
|
|
+ } else {
|
|
|
+ this.$message.error(resp.msg)
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- onCreateAlbum() {
|
|
|
- this.showCreateAlbumDialog = true
|
|
|
- },
|
|
|
- createAlbum() {
|
|
|
- this.showCreateAlbumDialog = false
|
|
|
- createAlbum(this.createAlbumForm).then(resp => {
|
|
|
- this.$message.info(resp.msg)
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ }).finally(() => {
|
|
|
+ this.loading = false
|
|
|
})
|
|
|
},
|
|
|
showImages(index) {
|