|
|
@@ -46,7 +46,6 @@
|
|
|
<el-pagination
|
|
|
background
|
|
|
:small="screenWidth <= 768"
|
|
|
- hide-on-single-page
|
|
|
layout="prev, pager, next"
|
|
|
:page-size="pageSize"
|
|
|
:current-page="currentPage"
|
|
|
@@ -95,27 +94,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- document.title = '图片'
|
|
|
-
|
|
|
- getImages(this.currentPage).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.dataList = resp.data
|
|
|
- } else {
|
|
|
- this.$notify({
|
|
|
- title: '获取数据失败',
|
|
|
- message: res.msg,
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
- }
|
|
|
- }).catch(error => {
|
|
|
- this.$notify({
|
|
|
- title: '获取数据错误',
|
|
|
- message: error.message,
|
|
|
- type: 'error',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
- })
|
|
|
+ document.title = '图片主页'
|
|
|
+ this.getImagesWrapper(this.currentPage)
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -129,11 +109,34 @@ export default {
|
|
|
methods: {
|
|
|
handleCurrentChange(currentPage) {
|
|
|
this.currentPage = currentPage
|
|
|
- this.$store.commit('updatePage', currentPage)
|
|
|
- this.$store.dispatch('getPageBean')
|
|
|
+ this.getImagesWrapper(this.currentPage)
|
|
|
+
|
|
|
// 回到顶部
|
|
|
scrollTo(0, 0)
|
|
|
},
|
|
|
+ getImagesWrapper(page) {
|
|
|
+ getImages(page).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.dataList = resp.data.list
|
|
|
+ this.totalPages = resp.totalPages
|
|
|
+ this.totalSize = resp.totalSize
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title: '获取数据失败',
|
|
|
+ message: res.msg,
|
|
|
+ type: 'warning',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$notify({
|
|
|
+ title: '获取数据错误',
|
|
|
+ message: error.message,
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
showImages(index) {
|
|
|
const imageUrls = []
|
|
|
for (const i of this.dataList) {
|