1004749546@qq.com 4 gadi atpakaļ
vecāks
revīzija
33bafce1f0
2 mainītis faili ar 52 papildinājumiem un 43 dzēšanām
  1. 44 42
      pages/index/addData.vue
  2. 8 1
      pages/index/index.vue

+ 44 - 42
pages/userCenter/addData.vue → pages/index/addData.vue

@@ -19,7 +19,7 @@
 				<image src="../../static/CLOTHES.png" mode=""  class="form-item-icon"></image>
 				<u-form-item label="建筑垃圾" >
 					<u-input placeholder="请输入" :maxlength="11" type="number" v-model="form.receiverPhone" />
-					<text slot="right" style="color: #000000;">桶(约{{125}} t)</text>
+					<text slot="right" style="color: #000000;">吨(约{{125}} kg)</text>
 				</u-form-item>
 			</view>
 			<view class="form-item">
@@ -34,8 +34,8 @@
 				<u-form-item label="清运照片" style="width: 100%;">
 					<text style="color: #c0c4cc;" v-if="!photograph">最多3张</text>
 						<u-icon v-show="photograph" name="close-circle-fill" color="#fa3534" size="50" class="close-circle-icon" @click="cancelPhotograph"></u-icon>
-						<u-icon  slot="right" name="camera" color="#2979ff" size="60" class="photograph-icon"  @click="photograph ? null : goPhotograph()"></u-icon>
-						<u-image v-show="photograph" width="100%" height="100%" :src="photograph" @click="previewPictures"></u-image>
+						<u-icon  slot="right" name="camera" color="#2979ff" size="60" class="photograph-icon"  @click="photograph.length ? null : goPhotograph()"></u-icon>
+						<u-image width="100%" height="100%" v-for="item in photograph" :src="item" @click="previewPictures"></u-image>
 					<!-- <u-icon  slot="right" name="camera" color="#2979ff" size="60" class="photograph-icon"></u-icon> -->
 					<!-- <camera device-position="back" flash="off"></camera>
 					        <!-- <button type="primary" @click="takePhoto">拍照</button>
@@ -64,65 +64,67 @@
 			return {
 				show: false,
 				src:"",
-				photograph: '', //  拍照临时地址
+				photograph: [], //  图片路径
 				form: {
 					receiverName: '',
 					receiverPhone: '',
 					receiveAddress: '' // 详细地址
 				},
-				receiveAreas: '', //地址编码
-				areaName: '', //地址
-				areaInfo: {},  //  省市区
-				areaIdArr: [],  //  省市区id数组
-				rules: {
-				}
 			};
 		},
 		onLoad(option) {
-			this.form = this.$store.state.vuex_OrderAddress
-			if (this.form.receiveAreasName) {
-				this.areaIdArr = this.form.receiveAreas.split(',')
-				this.areaInfo.label = this.form.receiveAreasName.replace(/\,/g,'-')
-				uni.setNavigationBarTitle({
-					title: '新增数据录入'
-				})
-			} else {
-				uni.setNavigationBarTitle({
-					title: '修改数据'
-				})
+			console.log(option,option.id,'ppppppppp')
+			// 查看
+			if(option && option.id){
+				
+			}else {
+				console.log('--------新增')
+				this.photograph = []
 			}
-			// 开启分享
-			uni.showShareMenu({
-				withShareTicket: true,
-				menus: ['shareAppMessage', 'shareTimeline']
-			})
 		},
 		onUnload() {
-			this.$u.vuex("vuex_OrderAddress",{})
 		},
 		methods: {
 			//  签到拍照
 			goPhotograph() {
-				const _this = this;
-				
-				wx.chooseImage({
-					count: 3, //最多可以选择的图片张数,默认9
-					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-					sourceType: ['camera'], //album 从相册选图,camera 使用相机,默认二者都有
-					success: function(res) {
-						// tempFilePaths 图片的本地文件路径列表,tempFiles 图片的本地文件列表,每一项是一个 File 对象
-						console.log(JSON.stringify(res.tempFilePaths));
+				uni.chooseImage({
+				    count: 3, //默认9
+				    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+				    sourceType: ['album','camera'], //从相册选择
+				    success:  (res) =>{
+				        console.log(JSON.stringify(res.tempFilePaths));
+						// this.photograph = JSON.stringify(res.tempFilePaths)
 						uni.showLoading({
 							title: '保存中,请稍后...', 
 							mask: true
 						})
-						// saveImgToAliOss(res.tempFilePaths[0],function(ret){
-						// 	console.log(ret)
-						// 	_this.photograph = ret.data
-						// 	uni.hideLoading()
-						// })
-					}
+						saveImgToAliOss(res.tempFilePaths[0],function(ret){
+							console.log(ret)
+							_this.photograph = ret.data
+							uni.hideLoading()
+						})
+				    }
 				});
+				// const _this = this;
+				
+				// wx.chooseImage({
+				// 	count: 3, //最多可以选择的图片张数,默认9
+				// 	sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+				// 	sourceType: ['camera'], //album 从相册选图,camera 使用相机,默认二者都有
+				// 	success: function(res) {
+				// 		// tempFilePaths 图片的本地文件路径列表,tempFiles 图片的本地文件列表,每一项是一个 File 对象
+				// 		console.log(JSON.stringify(res.tempFilePaths));
+				// 		uni.showLoading({
+				// 			title: '保存中,请稍后...', 
+				// 			mask: true
+				// 		})
+				// 		// saveImgToAliOss(res.tempFilePaths[0],function(ret){
+				// 		// 	console.log(ret)
+				// 		// 	_this.photograph = ret.data
+				// 		// 	uni.hideLoading()
+				// 		// })
+				// 	}
+				// });
 			},
 			//  预览签到图
 			previewPictures() {

+ 8 - 1
pages/index/index.vue

@@ -41,7 +41,7 @@
 				<u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
 			</view>
 		</scroll-view>
-		<view class="footer">
+		<view @click="intoPage()" class="footer">
 			<u-icon name="edit-pen" size="30"></u-icon>
 			<text>垃圾数据录入</text>
 		</view>
@@ -127,6 +127,13 @@
 					uni.showToast({ title: '已经到底了', icon: 'none' })
 					this.status = "nomore"
 				}
+			},
+			// 打开垃圾数据录入页面
+			intoPage(flag) {
+				let url = flag ? `/pages/index/addData?id=${flag}` : `/pages/index/addData`
+				uni.navigateTo({
+				    url: url
+				})
 			}
 		}
 	}