Commit caf2d5f0dac77309c35eb17d8ea84d0750bdeab8
1 parent
c72c87c8
Exists in
master
feat:意见反馈修改
Showing
3 changed files
with
133 additions
and
110 deletions
Show diff stats
src/views/GrowUp/MyAlbum.vue
... | ... | @@ -2,10 +2,16 @@ |
2 | 2 | <div id="MyAlbum"> |
3 | 3 | <div class="photo_box"> |
4 | 4 | <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getUserAlbum"> |
5 | - <div class="day_box" v-for="(dayItem,dayIndex) in photoArr" :key="dayIndex"> | |
6 | - <p class="day_time">{{dayItem.time}}</p> | |
7 | - <div class="item" v-for="(item,index) in dayItem.photos" :key="index" :style="'background-image:url('+item.img+')'" @click="handlePhoto(dayIndex,index)"> | |
8 | - <div class="check_icon" :class="item.checked?'checked':''" v-if="controlStatus=='del'"> | |
5 | + <div class="day_box" v-for="(dayItem, dayIndex) in photoArr" :key="dayIndex"> | |
6 | + <p class="day_time">{{ dayItem.time }}</p> | |
7 | + <div | |
8 | + class="item" | |
9 | + v-for="(item, index) in dayItem.photos" | |
10 | + :key="index" | |
11 | + :style="'background-image:url(' + item.img + ')'" | |
12 | + @click="handlePhoto(dayIndex, index)" | |
13 | + > | |
14 | + <div class="check_icon" :class="item.checked ? 'checked' : ''" v-if="controlStatus == 'del'"> | |
9 | 15 | <van-icon class="icon" name="success" /> |
10 | 16 | </div> |
11 | 17 | </div> |
... | ... | @@ -13,22 +19,22 @@ |
13 | 19 | </van-list> |
14 | 20 | </div> |
15 | 21 | <div class="control_panel"> |
16 | - <p class="control_btn" @click="controlStatus='control'" v-if="controlStatus=='default'">管理相册({{spaceSize}}/2G)</p> | |
17 | - <div class="control_box" v-if="controlStatus=='control'"> | |
22 | + <p class="control_btn" @click="controlStatus = 'control'" v-if="controlStatus == 'default'">管理相册({{ spaceSize }}/2G)</p> | |
23 | + <div class="control_box" v-if="controlStatus == 'control'"> | |
18 | 24 | <van-uploader multiple :after-read="afterRead"> |
19 | 25 | <div class="btn add"> |
20 | 26 | <van-icon class="icon" name="add-o" /> |
21 | 27 | <p class="text">添加</p> |
22 | 28 | </div> |
23 | 29 | </van-uploader> |
24 | - <div class="btn del" @click="controlStatus='del'"> | |
30 | + <div class="btn del" @click="controlStatus = 'del'"> | |
25 | 31 | <van-icon class="icon" name="delete-o" /> |
26 | 32 | <p class="text">删除</p> |
27 | 33 | </div> |
28 | - <van-button class="blue_btn" type="info" round color="#3074FF" @click="controlStatus='default'">完成</van-button> | |
34 | + <van-button class="blue_btn" type="info" round color="#3074FF" @click="controlStatus = 'default'">完成</van-button> | |
29 | 35 | </div> |
30 | - <p class="cancel_btn" @click="controlStatus='control'" v-if="controlStatus=='del'">取消</p> | |
31 | - <p class="del_btn" @click="handleDel" v-if="controlStatus=='del'">删除相片</p> | |
36 | + <p class="cancel_btn" @click="controlStatus = 'control'" v-if="controlStatus == 'del'">取消</p> | |
37 | + <p class="del_btn" @click="handleDel" v-if="controlStatus == 'del'">删除相片</p> | |
32 | 38 | </div> |
33 | 39 | <van-image-preview v-model="showPreview" :images="previewArr" :start-position="startPosition" @change="previewChange"> |
34 | 40 | </van-image-preview> |
... | ... | @@ -37,11 +43,11 @@ |
37 | 43 | <script> |
38 | 44 | import Axios from 'axios' |
39 | 45 | export default { |
40 | - data () { | |
46 | + data() { | |
41 | 47 | return { |
42 | 48 | userInfo: '', |
43 | - photoArr: [],//照片数组 | |
44 | - total: '',//照片总数 | |
49 | + photoArr: [], //照片数组 | |
50 | + total: '', //照片总数 | |
45 | 51 | showPreview: false, |
46 | 52 | startPosition: 0, |
47 | 53 | previewIndex: 0, |
... | ... | @@ -50,16 +56,16 @@ export default { |
50 | 56 | pageNum: 1, |
51 | 57 | loading: false, |
52 | 58 | finished: false, |
53 | - controlStatus: 'default',//默认状态:default 管理状态:control 删除状态:del | |
54 | - delIds: [],//需要删除的图片id数组 | |
55 | - uploadImgList: [],//上传图片数组 | |
56 | - spaceSize:[],//用户空间 | |
59 | + controlStatus: 'default', //默认状态:default 管理状态:control 删除状态:del | |
60 | + delIds: [], //需要删除的图片id数组 | |
61 | + uploadImgList: [], //上传图片数组 | |
62 | + spaceSize: [], //用户空间 | |
57 | 63 | } |
58 | 64 | }, |
59 | - mounted () { | |
60 | - var userInfo = localStorage.getItem('userInfo'); | |
65 | + mounted() { | |
66 | + var userInfo = localStorage.getItem('userInfo') | |
61 | 67 | if (userInfo) { |
62 | - this.userInfo = JSON.parse(userInfo); | |
68 | + this.userInfo = JSON.parse(userInfo) | |
63 | 69 | } |
64 | 70 | |
65 | 71 | // this.getUserAlbum()//获取当前用户相关的商户相册 |
... | ... | @@ -67,50 +73,56 @@ export default { |
67 | 73 | }, |
68 | 74 | methods: { |
69 | 75 | //获取当前用户相关的商户相册 |
70 | - getUserAlbum () { | |
71 | - this.loading = true; | |
72 | - this.yxAxios.post(`${this.proxyUrl}/api/growth/photo/userAlbum`,{ | |
73 | - "centerNo": this.userInfo.centerNo, | |
74 | - pageSize: this.pageSize, | |
75 | - pageNum: this.pageNum, | |
76 | - }).then((res) => { | |
77 | - console.log('相册详情:', res) | |
78 | - this.loading = false | |
79 | - if (res.data.code == 200) { | |
80 | - this.formatPhoto(res.data.rows) | |
81 | - this.total = res.data.total | |
82 | - if (this.pageSize * this.pageNum >= res.data.total) { | |
83 | - this.finished = true | |
76 | + getUserAlbum() { | |
77 | + this.loading = true | |
78 | + this.yxAxios | |
79 | + .post(`${this.proxyUrl}/api/growth/photo/userAlbum`, { | |
80 | + centerNo: this.userInfo.centerNo, | |
81 | + pageSize: this.pageSize, | |
82 | + pageNum: this.pageNum, | |
83 | + }) | |
84 | + .then((res) => { | |
85 | + console.log('相册详情:', res) | |
86 | + this.loading = false | |
87 | + if (res.data.code == 200) { | |
88 | + this.formatPhoto(res.data.rows) | |
89 | + this.total = res.data.total | |
90 | + if (this.pageSize * this.pageNum >= res.data.total) { | |
91 | + this.finished = true | |
92 | + } else { | |
93 | + this.pageNum++ | |
94 | + } | |
84 | 95 | } else { |
85 | - this.pageNum++ | |
96 | + // this.$toast(res.data.message); | |
97 | + console.log(res.data.message) | |
86 | 98 | } |
87 | - } else { | |
88 | - this.$toast(res.data.message); | |
89 | - } | |
90 | - }) | |
99 | + }) | |
91 | 100 | }, |
92 | 101 | // 获取用户空间大小 |
93 | - getUserSpaceSize () { | |
94 | - this.yxAxios.post(`${this.proxyUrl}/api/growth/photo/getUserSpaceSize`,{ | |
95 | - "centerNo": this.userInfo.centerNo, | |
96 | - }).then((res) => { | |
97 | - console.log('空间大小:', res) | |
98 | - if (res.data.code == 200) { | |
99 | - const sizeM = res.data.data/1024/1024; | |
100 | - if(sizeM/1024>1000){ | |
101 | - this.spaceSize = (sizeM/1024).toFixed(2)+'G' | |
102 | - }else{ | |
103 | - this.spaceSize = (sizeM).toFixed(2)+'M' | |
102 | + getUserSpaceSize() { | |
103 | + this.yxAxios | |
104 | + .post(`${this.proxyUrl}/api/growth/photo/getUserSpaceSize`, { | |
105 | + centerNo: this.userInfo.centerNo, | |
106 | + }) | |
107 | + .then((res) => { | |
108 | + console.log('空间大小:', res) | |
109 | + if (res.data.code == 200) { | |
110 | + const sizeM = res.data.data / 1024 / 1024 | |
111 | + if (sizeM / 1024 > 1000) { | |
112 | + this.spaceSize = (sizeM / 1024).toFixed(2) + 'G' | |
113 | + } else { | |
114 | + this.spaceSize = sizeM.toFixed(2) + 'M' | |
115 | + } | |
116 | + console.log(this.spaceSize) | |
117 | + } else { | |
118 | + // this.$toast(res.data.message); | |
119 | + console.log(res.data.message) | |
104 | 120 | } |
105 | - console.log(this.spaceSize) | |
106 | - } else { | |
107 | - this.$toast(res.data.message); | |
108 | - } | |
109 | - }) | |
121 | + }) | |
110 | 122 | }, |
111 | 123 | // 处理照片数组 |
112 | - formatPhoto (data) { | |
113 | - let photoArr = this.photoArr; | |
124 | + formatPhoto(data) { | |
125 | + let photoArr = this.photoArr | |
114 | 126 | var weekArr = ['一', '二', '三', '四', '五', '六', '日'] |
115 | 127 | for (let i in data) { |
116 | 128 | let week = this.Moment(data[i].createTime).isoWeekday() |
... | ... | @@ -119,14 +131,14 @@ export default { |
119 | 131 | if (photoArr.length == 0) { |
120 | 132 | photoArr.push({ |
121 | 133 | time: data[i].time, |
122 | - photos: [data[i]] | |
134 | + photos: [data[i]], | |
123 | 135 | }) |
124 | 136 | } else if (photoArr[photoArr.length - 1].time == data[i].time) { |
125 | 137 | photoArr[photoArr.length - 1].photos.push(data[i]) |
126 | 138 | } else { |
127 | 139 | photoArr.push({ |
128 | 140 | time: data[i].time, |
129 | - photos: [data[i]] | |
141 | + photos: [data[i]], | |
130 | 142 | }) |
131 | 143 | } |
132 | 144 | } |
... | ... | @@ -134,11 +146,11 @@ export default { |
134 | 146 | this.photoArr = photoArr |
135 | 147 | }, |
136 | 148 | // 预览图切换 |
137 | - previewChange (index) { | |
149 | + previewChange(index) { | |
138 | 150 | this.previewIndex = index |
139 | 151 | }, |
140 | 152 | // 点击照片 |
141 | - handlePhoto (dayIndex, index) { | |
153 | + handlePhoto(dayIndex, index) { | |
142 | 154 | // 先判断状态,删除操作时为选择图片,默认状态为预览图片操作,操作状态不触发事件 |
143 | 155 | if (this.controlStatus == 'del') { |
144 | 156 | this.photoArr[dayIndex].photos[index].checked = !this.photoArr[dayIndex].photos[index].checked |
... | ... | @@ -150,14 +162,14 @@ export default { |
150 | 162 | this.previewArr = previewArr |
151 | 163 | this.startPosition = index |
152 | 164 | this.previewIndex = index |
153 | - this.showPreview = true; | |
165 | + this.showPreview = true | |
154 | 166 | } |
155 | 167 | }, |
156 | 168 | |
157 | 169 | // 点击删除照片 |
158 | - handleDel () { | |
170 | + handleDel() { | |
159 | 171 | // 计算需要删除的图片 |
160 | - let delIds = []; | |
172 | + let delIds = [] | |
161 | 173 | for (let i in this.photoArr) { |
162 | 174 | for (let j in this.photoArr[i].photos) { |
163 | 175 | if (this.photoArr[i].photos[j].checked) { |
... | ... | @@ -169,67 +181,68 @@ export default { |
169 | 181 | if (this.delIds.length == 0) { |
170 | 182 | this.$toast('请至少选择一张照片') |
171 | 183 | } else { |
172 | - this.$dialog.confirm({ | |
173 | - title: '警告', | |
174 | - message: '确认删除照片?', | |
175 | - }) | |
184 | + this.$dialog | |
185 | + .confirm({ | |
186 | + title: '警告', | |
187 | + message: '确认删除照片?', | |
188 | + }) | |
176 | 189 | .then(() => { |
177 | 190 | this.delPhotoByIds() |
178 | 191 | }) |
179 | 192 | .catch(() => { |
180 | 193 | // on cancel |
181 | - }); | |
194 | + }) | |
182 | 195 | } |
183 | 196 | }, |
184 | 197 | // 删除照片操作 |
185 | - delPhotoByIds () { | |
198 | + delPhotoByIds() { | |
186 | 199 | this.$toast.loading({ |
187 | 200 | message: '正在删除...', |
188 | 201 | duration: 0, |
189 | - forbidClick: true | |
202 | + forbidClick: true, | |
190 | 203 | }) |
191 | 204 | this.http.removePersonPhoto(this.delIds.join(',')).then((res) => { |
192 | 205 | this.$toast.clear() |
193 | 206 | if (res.code == 200) { |
194 | - this.$toast('删除成功'); | |
195 | - this.controlStatus = 'control'; | |
196 | - this.pageReload()//删除成功后页面重新加载 | |
207 | + this.$toast('删除成功') | |
208 | + this.controlStatus = 'control' | |
209 | + this.pageReload() //删除成功后页面重新加载 | |
197 | 210 | } else { |
198 | - this.$toast(res.message); | |
211 | + this.$toast(res.message) | |
199 | 212 | } |
200 | 213 | }) |
201 | 214 | }, |
202 | 215 | // 页面数据重新加载 |
203 | - pageReload () { | |
204 | - this.pageNum = 1; | |
205 | - this.finished = false; | |
206 | - this.photoArr = []; | |
216 | + pageReload() { | |
217 | + this.pageNum = 1 | |
218 | + this.finished = false | |
219 | + this.photoArr = [] | |
207 | 220 | this.getUserAlbum() |
208 | 221 | this.getUserSpaceSize() |
209 | 222 | }, |
210 | 223 | // 读取到文件后 |
211 | - afterRead (file) { | |
224 | + afterRead(file) { | |
212 | 225 | if (Array.isArray(file)) { |
213 | 226 | this.fileUpload(file, 0) |
214 | 227 | } else { |
215 | 228 | this.fileUpload([file], 0) |
216 | - | |
217 | 229 | } |
218 | 230 | }, |
219 | 231 | // 上传照片到文件服务器 |
220 | - fileUpload (files, index) { | |
232 | + fileUpload(files, index) { | |
221 | 233 | this.$toast.loading({ |
222 | 234 | message: `上传中 ${index + 1}/${files.length}...`, |
223 | 235 | duration: 0, |
224 | - forbidClick: true | |
236 | + forbidClick: true, | |
225 | 237 | }) |
226 | 238 | let size = files[index].file.size |
227 | 239 | let params = new FormData() |
228 | 240 | params.append('file', files[index].file, files[index].file.name) |
229 | 241 | let config = { |
230 | - headers: { //添加请求头 | |
231 | - 'Content-Type': 'multipart/form-data' | |
232 | - } | |
242 | + headers: { | |
243 | + //添加请求头 | |
244 | + 'Content-Type': 'multipart/form-data', | |
245 | + }, | |
233 | 246 | } |
234 | 247 | Axios.post('https://market.myjxt.com:51311/file/fileUpload', params, config).then((res) => { |
235 | 248 | this.$toast.clear() |
... | ... | @@ -247,27 +260,29 @@ export default { |
247 | 260 | }) |
248 | 261 | }, |
249 | 262 | // 上传照片 |
250 | - uploadUserAlbum () { | |
263 | + uploadUserAlbum() { | |
251 | 264 | this.$toast.loading({ |
252 | 265 | message: `同步照片到我的相册...`, |
253 | 266 | duration: 0, |
254 | - forbidClick: true | |
267 | + forbidClick: true, | |
255 | 268 | }) |
256 | - this.http.uploadUserAlbum({ | |
257 | - "centerNo": this.userInfo.centerNo, | |
258 | - "imgList": this.uploadImgList | |
259 | - }).then((res) => { | |
260 | - this.$toast.clear() | |
261 | - if (res.code == 200) { | |
262 | - this.$toast('同步完成'); | |
263 | - this.uploadImgList = []; | |
264 | - this.pageReload()//上传完成后页面重新加载 | |
265 | - } else { | |
266 | - this.$toast(res.message); | |
267 | - } | |
268 | - }) | |
269 | - } | |
270 | - } | |
269 | + this.http | |
270 | + .uploadUserAlbum({ | |
271 | + centerNo: this.userInfo.centerNo, | |
272 | + imgList: this.uploadImgList, | |
273 | + }) | |
274 | + .then((res) => { | |
275 | + this.$toast.clear() | |
276 | + if (res.code == 200) { | |
277 | + this.$toast('同步完成') | |
278 | + this.uploadImgList = [] | |
279 | + this.pageReload() //上传完成后页面重新加载 | |
280 | + } else { | |
281 | + this.$toast(res.message) | |
282 | + } | |
283 | + }) | |
284 | + }, | |
285 | + }, | |
271 | 286 | } |
272 | 287 | </script> |
273 | 288 | <style lang="scss"> |
... | ... | @@ -394,7 +409,9 @@ export default { |
394 | 409 | <style lang="scss"> |
395 | 410 | // 长辈版 |
396 | 411 | .elder { |
397 | - #MyAlbum .control_panel .control_btn, #MyAlbum .control_panel .cancel_btn, #MyAlbum .control_panel .del_btn{ | |
412 | + #MyAlbum .control_panel .control_btn, | |
413 | + #MyAlbum .control_panel .cancel_btn, | |
414 | + #MyAlbum .control_panel .del_btn { | |
398 | 415 | font-size: 36px; |
399 | 416 | } |
400 | 417 | } | ... | ... |
src/views/Home/HomeYX.vue
... | ... | @@ -45,13 +45,13 @@ |
45 | 45 | </div> |
46 | 46 | <van-icon name="arrow" /> |
47 | 47 | </div> |
48 | - <div class="item" @click="handleClearCache"> | |
48 | + <!-- <div class="item" @click="handleClearCache"> | |
49 | 49 | <div class="left"> |
50 | 50 | <van-icon class="icon" name="user-circle-o" /> |
51 | 51 | <span>清除缓存</span> |
52 | 52 | </div> |
53 | 53 | <van-icon name="arrow" /> |
54 | - </div> | |
54 | + </div> --> | |
55 | 55 | <div class="item" @click="handelElder"> |
56 | 56 | <div class="left"> |
57 | 57 | <van-icon class="icon" name="friends-o" /> | ... | ... |
src/views/Home/MyCollect.vue
... | ... | @@ -39,7 +39,8 @@ export default { |
39 | 39 | if (res.data.code == 200) { |
40 | 40 | this.CollectList = res.data.rows |
41 | 41 | } else { |
42 | - this.$toast.fail(res.data.message) | |
42 | + console.log(res.data.message) | |
43 | + // this.$toast.fail(res.data.message) | |
43 | 44 | } |
44 | 45 | }) |
45 | 46 | }, |
... | ... | @@ -62,7 +63,10 @@ export default { |
62 | 63 | } |
63 | 64 | }, |
64 | 65 | handleCourse(item) { |
65 | - this.$router.push({ name: 'ServiceAbroadDetail', query: { courseId: item.productId, publicName: localStorage.getItem('publicName') } }) | |
66 | + this.$router.push({ | |
67 | + name: 'ServiceAbroadDetail', | |
68 | + query: { courseId: item.productId, publicName: localStorage.getItem('publicName') }, | |
69 | + }) | |
66 | 70 | }, |
67 | 71 | // 点击按钮取消收藏 |
68 | 72 | deleteCollect(index) { |
... | ... | @@ -87,7 +91,8 @@ export default { |
87 | 91 | this.$toast('取消收藏成功') |
88 | 92 | this.getMyCollect() |
89 | 93 | } else { |
90 | - this.$toast.fail(res.data.message) | |
94 | + console.log(res.data.message) | |
95 | + // this.$toast.fail(res.data.message) | |
91 | 96 | } |
92 | 97 | }) |
93 | 98 | }, |
... | ... | @@ -147,7 +152,8 @@ export default { |
147 | 152 | <style lang="scss"> |
148 | 153 | // 长辈版 |
149 | 154 | .elder { |
150 | - #MyCollect .collect_item .right .course_name,#MyCollect .collect_item .right .course_price{ | |
155 | + #MyCollect .collect_item .right .course_name, | |
156 | + #MyCollect .collect_item .right .course_price { | |
151 | 157 | font-size: 36px; |
152 | 158 | } |
153 | 159 | } | ... | ... |