lilei 4 лет назад
Родитель
Сommit
8ab8e7aee6

+ 1 - 1
api/data.js

@@ -1,7 +1,7 @@
 import axios from '@/libs/axios.js'
 export const uploadImg = formData => {
   return axios.request({
-    url: 'image/upload',
+    url: 'upload',
     data: formData
   })
 }

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
hybrid/html/imgEdit/ped.min.js


+ 42 - 10
hybrid/html/video.html

@@ -42,6 +42,7 @@
           <!-- 机位 -->
           <div>
             <div>机位:</div>
+			<div></div>
             <div>
               <a-dropdown>
                 <a-menu slot="overlay">
@@ -75,7 +76,7 @@
         <div class="checkWork-head-row">
           <div>
             <div>进度:2/13</div>
-            <div>耗时:3时5分钟</div>
+            <div>耗时:{{tj.haoshi}}</div>
             <!-- <div>得分:10.2/22.3</div> -->
           </div>
           <div>
@@ -150,15 +151,15 @@
               <div><!-- 分值:10 <a-icon @click="openEditFs" type="edit" style="font-size: 20px;margin-left: 10px;"/> --></div>
               <div>
 				  <!-- 不适用 -->
-                <a-icon type="minus-circle" class="choose-bhs"/>
+                <a-icon @click="pingfen(0)" type="minus-circle" class="choose-bhs"/>
               </div>
 			  <div>
 				  <!-- 不合格 -->
-				  <a-icon type="close-circle" class="choose-bhg"/>
+				  <a-icon @click="pingfen(1)" type="close-circle" class="choose-bhg"/>
 			  </div>
 			  <div>
 				  <!-- 合格 -->
-				  <a-icon type="check-circle" class="choose-hg"/>
+				  <a-icon @click="pingfen(2)" type="check-circle" class="choose-hg"/>
 			  </div>
             </div>
           </div>
@@ -187,11 +188,11 @@
 		  <!-- 图片列表 -->
 		  <div class="imglist">
 			  <div>
-				  <img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
+				  <img @click="previewImgs('https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png')" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
 				  <a-icon class="aicon" type="close" />
 			  </div>
 			  <div>
-				  <img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
+				  <img @click="previewImgs('https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png')" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
 				  <a-icon class="aicon" type="close" />
 			  </div>
 		  </div>
@@ -224,9 +225,24 @@
 		  showLoading: true, // 页面加载条
 		  isEditImg: false, // 是否编辑图片
 		  PED: null, // 图片编辑对象
+		  hsID: null, // 耗时计时器id
+		  // 统计
+		  tj:{
+			  haoshi: '0时0分'
+		  }
 		},
 		mounted () {
+		  let _this = this
+		  moment.locale('zh-cn');
 		  this.videoInit()
+		  // 耗时计算
+		  this.haoshi()
+		  this.hsID = setInterval(function(){
+		  	_this.haoshi()
+		  }, 60000)
+		},
+		destroyed() {
+			clearInterval(this.hsID)
 		},
 		methods: {
 		  // 初始化播放器
@@ -303,7 +319,14 @@
 				  console.log(JSON.stringify(e),'error')
 			  })
 		  },
-		  // 发送消息给app
+		  // 耗时计算
+		  haoshi(){
+			let _this = this
+			// 耗时
+			let s = moment('2020-09-07 10:16:20')
+			_this.tj.haoshi = moment().diff(s,'hours') + '时' + moment().diff(s,'minutes')%60 + '分'
+		  },
+		  // 发送消息给app 页面
 		  sendMsg (action,msg) {
 		    uni.postMessage({
 		      data: {
@@ -336,15 +359,24 @@
 			   let _this = this
 			   _this.sendMsg('getWinStatus',JSON.stringify({key:'isEditImg',val: true}))
 			   this.PED = new window.PED.imageInfo(url,function(data){
-				   console.log(data)
-				   _this.sendMsg('getWinStatus',JSON.stringify({key:'isEditImg',val: false}))
+				   // 保存图片编辑
+				   // _this.saveEditImg(data)
+				   _this.sendMsg('saveEditImg',data)
 			   })
 		  },
 		  // 关闭图片编辑
 		  closeImgsEdit(){
-			  console.log('0000000000000000')
 			  this.PED.hidePED()
 			  this.sendMsg('getWinStatus',JSON.stringify({key:'isEditImg',val: false}))
+		  },
+		  // 更新编辑后的图片
+		  updateItemImg(path){
+			  console.log(path)
+		  },
+		  // 考评项相关代码
+		  // 评分,0 不适用,1 不合格,2 合格
+		  pingfen(type){
+			  
 		  }
 		}
 	})

+ 51 - 0
libs/tools.js

@@ -274,4 +274,55 @@ export const clzConfirm = function(opts){
 		{"title":opts.title,"buttons": opts.buttons || ["确定","取消"]},
 		)
 	// #endif
+}
+
+// 保存base64 图片数据到阿里云
+export const saveBase64ToAliOss = function(base64,callback){
+	let bitmap = new plus.nativeObj.Bitmap();
+	uni.showLoading({
+		mask:true,
+		title: '正在保存图片...'
+	})
+	// 保存图片到相册
+	bitmap.loadBase64Data(base64, function() {
+		var itemId = new Date().getTime()
+		//保存到系统相册
+		let filePath = "_doc/poster_"+itemId+".jpg"
+		bitmap.save(filePath, {
+			overwrite: true, //是否覆盖已有图片, true 是
+			quality: 100 //图片质量,1-100 默认50, 100质量最高
+		}, function(e) {
+			uni.uploadFile({
+				url: getApp().globalData.baseUrl + '/upload', //自行修改各自的对应的接口 
+				filePath: e.target,
+				name: 'file',
+				success: (uploadFileRes) => {
+					if (uploadFileRes) {
+						let res = JSON.parse(uploadFileRes.data);
+						callback(res)
+					}
+					uni.showToast({
+						icon: 'none',
+						title: uploadFileRes ? '保存图片成功' : '保存图片失败'
+					})
+					uni.hideLoading()
+				}
+			});
+			bitmap.clear()
+		}, function(e) {
+			bitmap.clear()
+			uni.showToast({
+				icon: 'none',
+				title: '图片保存失败'
+			})
+			uni.hideLoading()
+		});
+	}, function(e) {
+	    bitmap.clear()
+		uni.showToast({
+			icon: 'none',
+			title: '图片保存失败'
+		})
+		uni.hideLoading()
+	});
 }

+ 22 - 4
pages/shopTour/shopTour.vue

@@ -5,7 +5,7 @@
 </template>
 
 <script>
-	import { clzConfirm } from '@/libs/tools.js'
+	import { clzConfirm,saveBase64ToAliOss } from '@/libs/tools.js'
 	export default {
 		data() {
 			return {
@@ -16,14 +16,30 @@
 			};
 		},
 		methods: {
+			// 监听html页面事件
 			onmessage(event) {
 				let data = event.detail.data[0]
-				console.log(data)
+				// console.log(data)
 				// webview 窗口传过来的页面状态
 				if(data.action == 'getWinStatus'){
 					let d = JSON.parse(data.msg)
 					this[d.key] = d.val
 				}
+				// 保存编辑后的图片
+				if(data.action == 'saveEditImg'){
+					this.uploadImg(data.msg)
+				}
+			},
+			// 上传编辑后的图片到阿里云
+			uploadImg(formData) {
+				const _this = this;
+				saveBase64ToAliOss(formData,function(res){
+					// console.log(res);
+					// 关闭编辑图片
+					_this.wv.evalJS("vm.closeImgsEdit()")
+					// 更新编辑后的图片
+					_this.wv.evalJS("vm.updateItemImg('"+res.data+"')")
+				})
 			}
 		},
 		onReady() {
@@ -69,11 +85,13 @@
 				return true
 			}
 		},
+		// 添加考评模板
 		onNavigationBarButtonTap(e) {
-			if(e.index==0){
+			// 且当前没编辑图片或抓拍图片
+			if(e.index==0 && !this.isEditImg && !this.showPz){
 				console.log(e.text)
 			}
-		}
+		},
 	}
 </script>
 

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
unpackage/dist/dev/app-plus/app-service.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
unpackage/dist/dev/app-plus/hybrid/html/imgEdit/ped.min.js


+ 42 - 10
unpackage/dist/dev/app-plus/hybrid/html/video.html

@@ -42,6 +42,7 @@
           <!-- 机位 -->
           <div>
             <div>机位:</div>
+			<div></div>
             <div>
               <a-dropdown>
                 <a-menu slot="overlay">
@@ -75,7 +76,7 @@
         <div class="checkWork-head-row">
           <div>
             <div>进度:2/13</div>
-            <div>耗时:3时5分钟</div>
+            <div>耗时:{{tj.haoshi}}</div>
             <!-- <div>得分:10.2/22.3</div> -->
           </div>
           <div>
@@ -150,15 +151,15 @@
               <div><!-- 分值:10 <a-icon @click="openEditFs" type="edit" style="font-size: 20px;margin-left: 10px;"/> --></div>
               <div>
 				  <!-- 不适用 -->
-                <a-icon type="minus-circle" class="choose-bhs"/>
+                <a-icon @click="pingfen(0)" type="minus-circle" class="choose-bhs"/>
               </div>
 			  <div>
 				  <!-- 不合格 -->
-				  <a-icon type="close-circle" class="choose-bhg"/>
+				  <a-icon @click="pingfen(1)" type="close-circle" class="choose-bhg"/>
 			  </div>
 			  <div>
 				  <!-- 合格 -->
-				  <a-icon type="check-circle" class="choose-hg"/>
+				  <a-icon @click="pingfen(2)" type="check-circle" class="choose-hg"/>
 			  </div>
             </div>
           </div>
@@ -187,11 +188,11 @@
 		  <!-- 图片列表 -->
 		  <div class="imglist">
 			  <div>
-				  <img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
+				  <img @click="previewImgs('https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png')" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
 				  <a-icon class="aicon" type="close" />
 			  </div>
 			  <div>
-				  <img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
+				  <img @click="previewImgs('https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png')" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png">
 				  <a-icon class="aicon" type="close" />
 			  </div>
 		  </div>
@@ -224,9 +225,24 @@
 		  showLoading: true, // 页面加载条
 		  isEditImg: false, // 是否编辑图片
 		  PED: null, // 图片编辑对象
+		  hsID: null, // 耗时计时器id
+		  // 统计
+		  tj:{
+			  haoshi: '0时0分'
+		  }
 		},
 		mounted () {
+		  let _this = this
+		  moment.locale('zh-cn');
 		  this.videoInit()
+		  // 耗时计算
+		  this.haoshi()
+		  this.hsID = setInterval(function(){
+		  	_this.haoshi()
+		  }, 60000)
+		},
+		destroyed() {
+			clearInterval(this.hsID)
 		},
 		methods: {
 		  // 初始化播放器
@@ -303,7 +319,14 @@
 				  console.log(JSON.stringify(e),'error')
 			  })
 		  },
-		  // 发送消息给app
+		  // 耗时计算
+		  haoshi(){
+			let _this = this
+			// 耗时
+			let s = moment('2020-09-07 10:16:20')
+			_this.tj.haoshi = moment().diff(s,'hours') + '时' + moment().diff(s,'minutes')%60 + '分'
+		  },
+		  // 发送消息给app 页面
 		  sendMsg (action,msg) {
 		    uni.postMessage({
 		      data: {
@@ -336,15 +359,24 @@
 			   let _this = this
 			   _this.sendMsg('getWinStatus',JSON.stringify({key:'isEditImg',val: true}))
 			   this.PED = new window.PED.imageInfo(url,function(data){
-				   console.log(data)
-				   _this.sendMsg('getWinStatus',JSON.stringify({key:'isEditImg',val: false}))
+				   // 保存图片编辑
+				   // _this.saveEditImg(data)
+				   _this.sendMsg('saveEditImg',data)
 			   })
 		  },
 		  // 关闭图片编辑
 		  closeImgsEdit(){
-			  console.log('0000000000000000')
 			  this.PED.hidePED()
 			  this.sendMsg('getWinStatus',JSON.stringify({key:'isEditImg',val: false}))
+		  },
+		  // 更新编辑后的图片
+		  updateItemImg(path){
+			  console.log(path)
+		  },
+		  // 考评项相关代码
+		  // 评分,0 不适用,1 不合格,2 合格
+		  pingfen(type){
+			  
 		  }
 		}
 	})

Некоторые файлы не были показаны из-за большого количества измененных файлов