gjy 2 anos atrás
pai
commit
1d2adb4a5d
2 arquivos alterados com 97 adições e 75 exclusões
  1. 54 44
      pages/business/businessNew.vue
  2. 43 31
      pages/business/release.vue

+ 54 - 44
pages/business/businessNew.vue

@@ -5,13 +5,14 @@
 				<view class="search">
 					<view class="place">
 						<selectAddress @selectAddress='selectAddress' :searchPlace='searchPlace'>
-							<u-icon :slot="'icon'" name="arrow-down" color="#333333" size="17" bold style='margin-left: 6rpx;'></u-icon>
+							<u-icon :slot="'icon'" name="arrow-down" color="#333333" size="17" bold
+								style='margin-left: 6rpx;'></u-icon>
 						</selectAddress>
 						<!-- 					<picker @change="bindPickerChange" :value="multiIndex" :range="multiArray" range-key='label'
 							mode="multiSelector" @columnchange='columnchange'>
 							<view class="text">{{searchPlace}}</view>
 						</picker> -->
-						
+
 					</view>
 					<u-search placeholder="请输入作物名称或用户名称" v-model="keyword" :input-style='inputStyle'
 						:show-action="false" disabled @click='toSearch'>
@@ -40,10 +41,14 @@
 									</view>
 								</view>
 							</view>
-							<view class="right" v-if="item.followed==1&&item.commonUser&&item.commonUser.userName!=userInfo.userName" @click="follow(item,1)">
+							<view class="right"
+								v-if="item.followed==1&&item.commonUser&&item.commonUser.userName!=userInfo.userName"
+								@click="follow(item,1)">
 								<text class="case" style="color:#878C9C;">已关注</text>
 							</view>
-							<view class="right" v-else-if='item.followed!=1&&item.commonUser&&item.commonUser.userName!=userInfo.userName' @click="follow(item,2)">
+							<view class="right"
+								v-else-if='item.followed!=1&&item.commonUser&&item.commonUser.userName!=userInfo.userName'
+								@click="follow(item,2)">
 								<u-icon name="plus" color="#333333" size="17" bold></u-icon><text class="case">关注</text>
 							</view>
 
@@ -52,9 +57,11 @@
 							<mote-lines-divide :dt="item.publishingContent" :line="3" expandText="展开" foldHint="收起" />
 						</view>
 						<view class="row3">
-							<image :src="item1" mode="aspectFill" v-for="(item1,index) in item.imgList"  @tap="previewImage(item,index)" class="img">
+							<image :src="item1" mode="aspectFill" v-for="(item1,index) in item.imgList"
+								@tap="previewImage(item,index)" class="img">
 							</image>
-							<image v-if='item.imgList.length%3==1||item.imgList.length%3==2' class="img" style='background:#fff;'></image>
+							<image v-if='item.imgList.length%3==1||item.imgList.length%3==2' class="img"
+								style='background:#fff;'></image>
 							<image v-if='item.imgList.length%3==1' class="img" style='background:#fff;'></image>
 							<!-- 	<u-row justify="space-between" gutter="10">
 								<u-col span="4">
@@ -82,7 +89,7 @@
 							<text class="text">{{item.placeDelivery}}</text>
 						</view>
 					</view>
-					
+
 				</view>
 
 				<!-- <good-list :list="goods"></good-list> -->
@@ -99,8 +106,9 @@
 			:content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
 			showCancelButton='false' content="尚未登录,是否立即登录" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
 		<u-modal v-model="isSHowReleaseAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
-			:content-style="{fontSize: '14px',fontWeight:'400','text-align':'left'}" confirm-color='#22C572' confirm-text='我知道了'
-			title='温馨提示' content="交易信息为用户自由发布,正式签订合同前切勿进行任何付款操作,以免给您的财产造成损失。" @confirm="releaseAlertbtn"></u-modal>
+			:content-style="{fontSize: '14px',fontWeight:'400','text-align':'left'}" confirm-color='#22C572'
+			confirm-text='我知道了' title='温馨提示' content="交易信息为用户自由发布,正式签订合同前切勿进行任何付款操作,以免给您的财产造成损失。"
+			@confirm="releaseAlertbtn"></u-modal>
 		<u-toast ref="uToast" />
 	</view>
 </template>
@@ -132,8 +140,8 @@
 				selectPlace: '',
 				mescroll: null,
 				isShowAlert: false,
-				showCancelButton:'true',
-				showCancelButton1:'false',
+				showCancelButton: 'true',
+				showCancelButton1: 'false',
 				contentStyle: {
 					"font-weight": 700
 				},
@@ -141,7 +149,7 @@
 				selectItem: {},
 				show: false,
 				keyword: '',
-				keyword1:'',
+				keyword1: '',
 				inputStyle: {
 					// "padding-left": '30rpx'
 				},
@@ -252,14 +260,14 @@
 		},
 
 		methods: {
-			previewImage(item,index){
+			previewImage(item, index) {
 				console.log(111111111)
-			        var i = item.imgList; //获取当前页面的轮播图数据
-			        //uniapp预览轮播图
-			        uni.previewImage({
-			            current:index, //预览图片的下标
-			            urls:i //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
-			        })
+				var i = item.imgList; //获取当前页面的轮播图数据
+				//uniapp预览轮播图
+				uni.previewImage({
+					current: index, //预览图片的下标
+					urls: i //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
+				})
 			},
 			releaseAlertbtn() {
 				getApp().globalData.userRelease = false
@@ -299,11 +307,10 @@
 				this.keyword = e
 			},
 			toSearch() {
+
 				this.keyword1=this.keyword
 				uni.setStorageSync('jiaoyikeyword',this.keyword)
 				this.isShowSearch = true
-			
-				console.log(this.keyword1)
 			},
 			follow(val, type) {
 				// 2关注
@@ -395,38 +402,39 @@
 						pcphone: 'mobile'
 					}
 				}
-				await this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
-					if (res.data.code == 200) {
-						console.log(res.data.data.records,page.num)
-						let curPageData = res.data.data.records;
-						let curPageLen = curPageData.length;
-						let totalPage = res.data.data.total;
-						if (page.num == 1) this.goods = [];
-						this.goods = this.goods.concat(curPageData);
-						console.log(curPageLen, totalPage)
-						this.mescroll.endByPage(curPageLen, totalPage);
-					}
-				})
-				
-				if(this.goods.length>0){
+				await this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(
+					res => {
+						if (res.data.code == 200) {
+							console.log(res.data.data.records, page.num)
+							let curPageData = res.data.data.records;
+							let curPageLen = curPageData.length;
+							let totalPage = res.data.data.total;
+							if (page.num == 1) this.goods = [];
+							this.goods = this.goods.concat(curPageData);
+							console.log(curPageLen, totalPage)
+							this.mescroll.endByPage(curPageLen, totalPage);
+						}
+					})
+
+				if (this.goods.length > 0) {
 					for (let i = 0; i < this.goods.length; i++) {
-					await this.$api.doRequest('get', 'appendix/query/getFileList', {
+						await this.$api.doRequest('get', 'appendix/query/getFileList', {
 							appendixIds: this.goods[i].urlImg
 						}).then(res1 => {
-							if(i==this.goods.length-1){
+							if (i == this.goods.length - 1) {
 								uni.hideLoading()
 							}
-							var arr=[]
+							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() {
@@ -456,9 +464,11 @@
 	.content {
 		background: #F5F6FA;
 	}
-	/deep/.button-show{
-		width:80rpx;
+
+	/deep/.button-show {
+		width: 80rpx;
 	}
+
 	.flex {
 		display: flex;
 	}
@@ -582,8 +592,8 @@
 					display: flex;
 					align-items: center;
 					/* justify-content: space-between; */
-					width: 31.6333%;
-					height: 214rpx;
+					width: 210rpx;
+					height: 210rpx;
 					margin-bottom: 20rpx;
 					background: lightblue;
 					list-style: none;

+ 43 - 31
pages/business/release.vue

@@ -132,6 +132,7 @@
 				action: this.$uploadUrl,
 				maxSize: 50 * 1024 * 1024, //限制文件大小 50M
 				isAdd: false,
+				num:0
 			};
 		},
 		onShow() {
@@ -164,6 +165,7 @@
 						appendixIds: this.imgList.toString()
 					}).then(res => {
 						this.imgList2 = res.data.data
+						this.$forceUpdate()
 					})
 				},
 				deep: true
@@ -171,6 +173,7 @@
 		},
 		methods: {
 			deleteImg(index) {
+				this.num=this.imgList.length
 				this.imgList.splice(index, 1)
 			},
 			async uploadClick() {
@@ -183,7 +186,7 @@
 					})
 					return 
 				}
-				uni.chooseImage({
+				await uni.chooseImage({
 					count:9,
 					success: (chooseImageRes) => {
 						console.log('chooseImageRes',chooseImageRes)
@@ -196,37 +199,45 @@
 						}
 						console.log(files)
 						for (let i = 0; i < files.length; i++) {
-							uni.uploadFile({
-							url: baseUrlNew + 'appendix/api/uploadFiles',
-							// url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
-							// files: files[i],
-							filePath:files[i].url,
-							name:files[i].name,
-							formData: {
-								// fileName: chooseImageRes.tempFiles[0],
-								companyId: pcUserInfo.compId,
-								modelId: '',
-								vesselId: '',
-							},
-							success: (uploadFileRes) => {
-								console.log(JSON.parse(uploadFileRes.data))
-								var data = JSON.parse(uploadFileRes.data).data
-								data.compId = pcUserInfo.compId
-								this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
-									newAppendixs: [data],
-									oldAppendixIds: ""
-								}).then(res => {
-									console.log(res.data.data)
-									this.imgList.push(res.data.data[0])
-									
-								})
-								console.log(uploadFileRes.data);
-							},
-							fail(res) {
-								
-								console.log(res);
+							this.num++
+							if(this.num<10){
+								console.log(this.num)
+								uni.uploadFile({
+									url: baseUrlNew + 'appendix/api/uploadFiles',
+									// url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
+									// files: files[i],
+									filePath:files[i].url,
+									name:files[i].name,
+									formData: {
+										// fileName: chooseImageRes.tempFiles[0],
+										companyId: pcUserInfo.compId,
+										modelId: '',
+										vesselId: '',
+									},
+									success: (uploadFileRes) => {
+										console.log(JSON.parse(uploadFileRes.data))
+										var data = JSON.parse(uploadFileRes.data).data
+										data.compId = pcUserInfo.compId
+										this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
+											newAppendixs: [data],
+											oldAppendixIds: ""
+										}).then(res => {
+											
+											console.log(res.data.data)
+											this.imgList.push(res.data.data[0])
+											
+											
+										})
+										console.log(uploadFileRes.data);
+									},
+									fail(res) {
+										console.log(res);
+									}
+								});
+							}else{
+								break;
 							}
-						});
+							
 						}
 						
 					}
@@ -321,6 +332,7 @@
 				this.$api.doRequest('post', '/transactionExchangeInfo/addInfo', this.dataObj).then(res => {
 					console.log(res)
 					if (res.data.code == 200) {
+						this.num=0
 						uni.navigateBack({
 							delta: 1
 						})