zhangyun 4 سال پیش
والد
کامیت
97058eff96
5فایلهای تغییر یافته به همراه60 افزوده شده و 49 حذف شده
  1. 43 37
      pages/afterSale/addafter.vue
  2. 14 10
      pages/afterSale/index.vue
  3. 1 0
      pages/expertDiagnosis/introduce.vue
  4. 0 1
      pages/expertDiagnosis/wormcase.vue
  5. 2 1
      util/api.js

+ 43 - 37
pages/afterSale/addafter.vue

@@ -40,7 +40,7 @@
 						</view>
 						<view class="uploading" v-if="uploadingTF[index+3]">
 							<u-icon name="close" class="delete" @click="deletes(index+3)"></u-icon>
-							<video :src="selfList[index]" controls class="uploading"></video>
+							<video :src="BASE_URL+selfList[index]" controls class="uploading"></video>
 						</view>
 					</view>
 				</view>
@@ -53,6 +53,7 @@
 	export default {
 		data() {
 			return {
+				BASE_URL: 'http://182.92.193.64:8002',
 				adddata:{//设备参数
 					id:'',
 					name:'',
@@ -63,7 +64,6 @@
 					type_id:''
 				},
 				imageList:[],//图片链接
-				// postimageList:[],
 				uploadingTF:[false,false,false,false,false,false],//图片的删除
 				selfList:[],//视频链接
 				actionSheetList: [//设备选项
@@ -91,7 +91,9 @@
 				],
 				show:false,//选择器的显示
 				btnisTorF:false,
-				deviceid:false//设备号判断
+				deviceid:false,//设备号判断
+				imageFile:[],
+				phoneTF:true//手机号判断
 			}
 		},
 		methods: {
@@ -106,14 +108,17 @@
 				    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
 				    sourceType: ['album','camera'], //从相册选择
 				    success: (res)=> {
-						this.imageList[index]=res.tempFilePaths[0]
-						this.$forceUpdate() //强制刷新视图
-						this.uploadingTF[index]=true
-						// this.postimageList[index]=res.tempFilePaths[0].slice(res.tempFilePaths[0].indexOf(":")+1)
-						uni.getImageInfo({
-						    src: res.tempFilePaths[0],
-						    success:(image)=>{
-								console.log(image);
+						uni.uploadFile({
+						    url: 'http://182.92.193.64:8002/api/api_gateway?method=base.bases.base_photo', //仅为示例,非真实的接口地址
+							filePath: res.tempFilePaths[0],
+						    name: 'img_file',
+						    formData: {
+						        'user': 'test'
+						    },
+						    success: (uploadFileRes) => {
+								this.imageList[index]=JSON.parse(uploadFileRes.data).data.src
+								this.$forceUpdate() //强制刷新视图
+								this.uploadingTF[index]=true
 						    }
 						});
 					}
@@ -124,10 +129,19 @@
 				    count: 1,
 					mediaType:['video'],
 				    success:(res)=> {
-						console.log(res)
-						this.selfList[index]= res.tempFilePath;
-						this.$forceUpdate() //强制刷新视图
-						this.uploadingTF[index+3]=true
+						uni.uploadFile({
+						    url: 'http://182.92.193.64:8002/api/api_gateway?method=after_sale.after_sale_manage.video_upload', //仅为示例,非真实的接口地址
+						    file: res.tempFile,
+						    name: 'upload',
+						    formData: {
+						        'user': 'test'
+						    },
+						    success: (uploadFileRes) => {
+								this.selfList[index]=JSON.parse(uploadFileRes.data).data.data.src
+								this.$forceUpdate() //强制刷新视图
+								this.uploadingTF[index+3]=true
+						    }
+						});
 				    }
 				});
 			},
@@ -135,7 +149,7 @@
 				this.uploadingTF[index]=false
 				this.$forceUpdate() //强制刷新视图
 			},
-			async getaddafter(data) {
+			async getaddafter(data) {//提交数据
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_apply',
 					data:{
@@ -143,6 +157,7 @@
 						    d_type:data.type,
 						    errordesc:data.text,
 						    errorimg:data.imageList,
+							errorvideo:data.selfList,
 						    addr:data.site,
 						    user:data.name,
 						    userphone:data.phone,
@@ -150,14 +165,6 @@
 					}
 				})
 			},
-			async getaddvideo(data) {
-				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=after_sale.after_sale_manage.video_upload',
-					data:{
-						upload:data
-					}//after_sale.after_sale_manage.device_check
-				})
-			},
 			async getID(data) {
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=after_sale.after_sale_manage.device_check',
@@ -177,22 +184,20 @@
 				obj.type=this.adddata.type_id
 				obj.text=this.adddata.text
 				obj.imageList=JSON.stringify(this.imageList)
-				console.log(obj.imageList)
 				obj.site=this.adddata.site
 				obj.name=this.adddata.name
 				obj.phone=this.adddata.phone
-				// if(this.deviceid==false && this.adddata.type_id==''){
-				// 	uni.showToast({
-				// 	    title: '设备ID和设备类型不能为空',
-				// 	    duration: 2000,
-				// 		icon:'none'
-				// 	});
-				// }else{
-				// 	this.getaddafter(obj)
-				// 	if(this.selfList.length!=0){
-				// 		// this.getaddvideo(this.selfList)
-				// 	}
-				// }
+				obj.selfList=JSON.stringify(this.selfList)
+				if(this.deviceid && this.adddata.type_id!=''&&this.phoneTF){
+					this.getaddafter(obj)
+				}else{
+					console.log(1)
+					uni.showToast({
+					    title: '设备ID和设备类型不能为空',
+					    duration: 2000,
+						icon:"none"
+					});
+				}
 			},
 			actionSheetCallback(index) {//选择器选择
 				this.adddata.type = this.actionSheetList[index].text;
@@ -205,6 +210,7 @@
 					    duration: 2000,
 						icon:'none'
 					});
+					this.phoneTF=false
 				}
 			},
 			addID(){

+ 14 - 10
pages/afterSale/index.vue

@@ -83,7 +83,7 @@
 				})
 				this.faultdata = res.data
 				for (var i = 0; i < this.faultdata.length; i++) {
-					// this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
+					this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
 					if (this.faultdata[i].errorimg == null) {
 						this.faultdata[i].errorimg = []
 					}
@@ -99,14 +99,13 @@
 				this.faultvideo_tf=false
 			},
 			faultImg(info) { //查看故障图片
-				console.log(info)
 				this.faultimg=[]
-				// for (var i = 0; i < info.length; i++) {
-				// 	let obj = {}
-				// 	obj.image = info[i]
-				// 	console.log(obj.image )
-				// 	this.faultimg.push(obj)
-				// }
+				console.log(info)
+				for (var i = 0; i < info.length; i++) {
+					let obj = {}
+					obj.image = info[i]
+					this.faultimg.push(obj)
+				}
 				this.title="故障图片"
 				this.show = true
 				this.faultimg_tf = true
@@ -114,8 +113,13 @@
 				this.faultvideo_tf=false
 			},
 			faultVideo(info) { //查看故障视频
-			this.title="故障视频"
-				this.faultvideo=info
+				this.title="故障视频"
+				if(info.indexOf("[")!=-1){
+					this.faultvideo=JSON.parse(info)[0]
+				}else{
+					this.faultvideo=info
+				}
+				console.log(this.faultvideo)
 				this.show = true
 				this.faultimg_tf = false
 				this.faultinfo_tf=false

+ 1 - 0
pages/expertDiagnosis/introduce.vue

@@ -39,6 +39,7 @@
 						pest_id:data
 					}
 				})
+				console.log(res)
 				this.wormcasedata=res
 				var regex2 = /\[(.+?)\]/g; // [] 中括号
 				var str=this.wormcasedata.prevention

+ 0 - 1
pages/expertDiagnosis/wormcase.vue

@@ -53,7 +53,6 @@
 					}
 				})
 				this.content=this.content.concat(res.data)
-				console.log(res)
 			},
 			clickLeft(){
 				uni.navigateTo({

+ 2 - 1
util/api.js

@@ -35,7 +35,8 @@ export const myRequest=(options)=>{
 			success:(res)=>{
 				if(res.data.message!=""){
 					return	uni.showToast({
-						title:res.data.message
+						title:res.data.message,
+						icon:"none"
 					})
 				}
 				resolve(res.data.data)