gjy hace 2 años
padre
commit
b6167f6ae7
Se han modificado 2 ficheros con 33 adiciones y 10 borrados
  1. 23 5
      pages/business/record.vue
  2. 10 5
      pages/business/release.vue

+ 23 - 5
pages/business/record.vue

@@ -174,14 +174,14 @@
 				})
 			},
 			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
-			upCallback(page) {
+			async upCallback(page) {
 				//联网加载数据
 				let _obj = {
 					pageSize: page.size,
 					currentPage: page.num,
 					userId: this.userInfo.id,
 				}
-				this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
+				await this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
 					console.log(res.data)
 					if (res.data.code == 200) {
 						let curPageData = res.data.data.records;
@@ -191,12 +191,30 @@
 						this.goods = this.goods.concat(curPageData);
 						console.log(curPageLen, totalPage)
 						this.mescroll.endByPage(curPageLen, totalPage);
-						for (let i = 0; i < this.goods.length; i++) {
-							this.goods[i].imgList = this.goods[i].urlImg.split(',')
-						}
+						// for (let i = 0; i < this.goods.length; i++) {
+						// 	this.goods[i].imgList = this.goods[i].urlImg.split(',')
+						// }
 					}
 					uni.hideLoading()
 				})
+				if (this.goods.length > 0) {
+					for (let i = 0; i < this.goods.length; i++) {
+						await this.$api.doRequest('get', 'appendix/query/getFileList', {
+							appendixIds: this.goods[i].urlImg
+						}).then(res1 => {
+							if (i == this.goods.length - 1) {
+								uni.hideLoading()
+							}
+							var arr = []
+							for (let q = 0; q < res1.data.data.length; q++) {
+								arr.push(res1.data.data[q].appendixPath)
+							}
+							this.goods[i].imgList = arr
+							this.$forceUpdate()
+						})
+				
+					}
+				}
 			},
 			//点击空布局按钮的回调
 			emptyClick() {

+ 10 - 5
pages/business/release.vue

@@ -161,14 +161,19 @@
 		watch: {
 			imgList: {
 				handler: function() {
-					this.$api.doRequest('get', 'appendix/query/getFileList', {
-						appendixIds: this.imgList.toString()
+					var that = this
+					setTimeout(()=>{
+						that.$api.doRequest('get', 'appendix/query/getFileList', {
+						appendixIds: that.imgList.toString()
 					}).then(res => {
-						this.imgList2 = res.data.data
-						this.$forceUpdate()
+						that.imgList2 = res.data.data
+						that.$forceUpdate()
 					})
+					},1000)
+					
 				},
-				deep: true
+				deep: true,
+				immediate:true
 			}
 		},
 		methods: {