|
@@ -1,6 +1,6 @@
|
1
|
1
|
<template>
|
2
|
2
|
<view class="page HuoDongZhaoPianQiang">
|
3
|
|
- <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
|
|
3
|
+ <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
|
4
|
4
|
|
5
|
5
|
<!-- 活动照片墙 -->
|
6
|
6
|
<view class="PhotoList">
|
|
@@ -9,18 +9,23 @@
|
9
|
9
|
<image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongzhaopianqiang.png"></image>
|
10
|
10
|
</view>
|
11
|
11
|
</view>
|
12
|
|
- <view class="List">
|
|
12
|
+ <view class="ListContainer">
|
13
|
13
|
<view v-for="(item, index) in PageList" :key="index">
|
14
|
|
- <text>{{item.Month}}</text>
|
15
|
|
- <view>
|
|
14
|
+ <view class="Title flex-h">
|
|
15
|
+ <text class="flex-item">{{item.name}}</text>
|
|
16
|
+ <text class="iconfont iconxiala" v-if="!item.Show" @tap="ShowItemList(item, index)"></text>
|
|
17
|
+ <text class="iconfont iconshangla" v-else @tap="item.Show = false"></text>
|
|
18
|
+ </view>
|
|
19
|
+ <view class="List" v-show="item.Show">
|
16
|
20
|
<view v-for="(subItem, subIndex) in item.List" :key="subIndex">
|
17
|
|
- <view class="Img" @tap="CheckBigImg(subItem.imgUrl)">
|
|
21
|
+ <view class="Img" @tap="CheckBigImg(item, subItem.imgUrl)">
|
18
|
22
|
<view class="MainItemImg">
|
19
|
23
|
<image mode="aspectFill" :src="subItem.imgUrl"></image>
|
20
|
24
|
</view>
|
21
|
25
|
</view>
|
22
|
26
|
</view>
|
23
|
27
|
</view>
|
|
28
|
+ <text class="More" v-if="item.Show" @tap="GetMore(item, index)">{{item.Loading ? '加载中...' : item.pageNum < item.pages ? '加载更多' : '加载完毕'}}</text>
|
24
|
29
|
</view>
|
25
|
30
|
</view>
|
26
|
31
|
</view>
|
|
@@ -57,6 +62,7 @@ export default {
|
57
|
62
|
},
|
58
|
63
|
computed: {
|
59
|
64
|
...mapIndexState({
|
|
65
|
+ GalleryTypeList: x => x.GalleryTypeList, // 照片墙类型列表
|
60
|
66
|
PhotoList: x => x.PhotoList // 照片墙列表
|
61
|
67
|
})
|
62
|
68
|
},
|
|
@@ -76,9 +82,11 @@ export default {
|
76
|
82
|
'EditUserInfo' // 编辑用户信息
|
77
|
83
|
]),
|
78
|
84
|
...mapIndexActions([
|
|
85
|
+ 'GetGalleryType', // 获取照片墙列表类型
|
79
|
86
|
'GetPhotoList' // 获取照片墙列表
|
80
|
87
|
]),
|
81
|
88
|
...mapIndexMutations([
|
|
89
|
+ 'EmptyGalleryTypeList', // 清空照片墙类型列表
|
82
|
90
|
'EmptyPhotoList' // 清空照片墙列表
|
83
|
91
|
]),
|
84
|
92
|
Init () { // 初始化
|
|
@@ -87,39 +95,63 @@ export default {
|
87
|
95
|
this.PageList = []
|
88
|
96
|
this.PhotoUrlArr = []
|
89
|
97
|
this.EmptyPhotoList() // 清空照片墙列表
|
90
|
|
- this.ToGetPageList() // 获取列表
|
91
|
|
- },
|
92
|
|
- CheckBigImg (url) { // 查看大图
|
93
|
|
- wx.previewImage({
|
94
|
|
- current: url, // 当前显示图片的http链接
|
95
|
|
- urls: this.PhotoUrlArr // 需要预览的图片http链接列表
|
|
98
|
+ this.EmptyGalleryTypeList() // 清空照片墙类型列表
|
|
99
|
+ this.GetGalleryType({ queryData: { pageNum: 1, pageSize: 10000 } }).then(() => {
|
|
100
|
+ this.GalleryTypeList.map((item) => {
|
|
101
|
+ this.PageList.push({ ...item, List: [], Show: false, pageNum: 1, pageSize: 10, pages: 2, Loading: false })
|
|
102
|
+ })
|
96
|
103
|
})
|
97
|
104
|
},
|
98
|
|
- ToGetPageList () { // 获取列表
|
99
|
|
- this.GetPhotoList({ queryData: { ...this.PageData } }).then((res) => { // 获取照片墙列表
|
100
|
|
- let Arr = []
|
101
|
|
- this.PhotoList.map((item) => {
|
102
|
|
- this.PhotoUrlArr.push(item.imgUrl)
|
103
|
|
- if (Arr.length && item.typeId === Arr[Arr.length - 1].Month) {
|
104
|
|
- Arr[Arr.length - 1].List.push({ ...item })
|
105
|
|
- } else {
|
106
|
|
- Arr.push({ Month: item.typeId, List: [{ ...item }] })
|
107
|
|
- }
|
|
105
|
+ GetMore (item, index) { // 加载更多
|
|
106
|
+ if (this.DataLock) return
|
|
107
|
+ this.DataLock = true
|
|
108
|
+ item.Loading = true
|
|
109
|
+ item.pageNum += 1
|
|
110
|
+ this.GetPhotoList({ queryData: { pageNum: item.pageNum, pageSize: item.pageSize, typeId: item.typeId } }).then((res) => {
|
|
111
|
+ item.pageNum = res.data.data.current - 0
|
|
112
|
+ item.pages = res.data.data.pages - 0
|
|
113
|
+ this.PhotoList.map((subItem) => {
|
|
114
|
+ item.List.push({ ...subItem })
|
108
|
115
|
})
|
109
|
|
- this.PageList = Arr
|
110
|
|
- this.HasNextPage = res.data.data.current < res.data.data.pages
|
111
|
116
|
this.DataLock = false
|
112
|
|
- this.IsRefreshing = false
|
113
|
|
- }).catch(() => {
|
|
117
|
+ item.Loading = false
|
|
118
|
+ }).catch((res) => {
|
114
|
119
|
this.DataLock = false
|
115
|
|
- this.IsRefreshing = false
|
|
120
|
+ item.Loading = false
|
116
|
121
|
})
|
117
|
122
|
},
|
118
|
|
- ScrollBottom () { // 上拉加载
|
119
|
|
- if (this.DataLock || !this.HasNextPage) return
|
120
|
|
- this.DataLock = true
|
121
|
|
- this.PageData.pageNum += 1
|
122
|
|
- this.ToGetPageList() // 获取列表
|
|
123
|
+ ShowItemList (item, index) { // 显示图片列表
|
|
124
|
+ if (item.List.length) {
|
|
125
|
+ item.Show = true
|
|
126
|
+ } else {
|
|
127
|
+ if (this.DataLock) return
|
|
128
|
+ this.DataLock = true
|
|
129
|
+ item.Loading = true
|
|
130
|
+ item.List = []
|
|
131
|
+ this.GetPhotoList({ queryData: { pageNum: item.pageNum, pageSize: item.pageSize, typeId: item.typeId } }).then((res) => {
|
|
132
|
+ item.pageNum = res.data.data.current - 0
|
|
133
|
+ item.pages = res.data.data.pages - 0
|
|
134
|
+ this.PhotoList.map((subItem) => {
|
|
135
|
+ item.List.push({ ...subItem })
|
|
136
|
+ })
|
|
137
|
+ item.Show = true
|
|
138
|
+ this.DataLock = false
|
|
139
|
+ item.Loading = false
|
|
140
|
+ }).catch((res) => {
|
|
141
|
+ this.DataLock = false
|
|
142
|
+ item.Loading = false
|
|
143
|
+ })
|
|
144
|
+ }
|
|
145
|
+ },
|
|
146
|
+ CheckBigImg (item, url) { // 查看大图
|
|
147
|
+ this.PhotoUrlArr = []
|
|
148
|
+ item.List.map((item) => {
|
|
149
|
+ this.PhotoUrlArr.push(item.imgUrl)
|
|
150
|
+ })
|
|
151
|
+ wx.previewImage({
|
|
152
|
+ current: url, // 当前显示图片的http链接
|
|
153
|
+ urls: this.PhotoUrlArr // 需要预览的图片http链接列表
|
|
154
|
+ })
|
123
|
155
|
},
|
124
|
156
|
Refresh (e) { // 页面下拉刷新
|
125
|
157
|
if (this.DataLock) return
|