weieryang 11 miesięcy temu
rodzic
commit
bf90c3372a

+ 56 - 87
双汇APP-h5/js/feedback-page-work.js

@@ -29,27 +29,57 @@ document.getElementById('headImage').addEventListener('tap', function() {
29 29
 			}
30 30
 		})
31 31
 	} else if (typeof window !== 'undefined' && window.File && window.FileReader && window.FileList && window.Blob) {
32
-        // 浏览器环境
32
+
33 33
         var input = document.createElement('input');
34
-        input.type = 'file';
35
-        input.accept = 'image/*';
36
-        input.onchange = function(e) {
37
-            var file = e.target.files[0];
38
-            if (file) {
39
-                var reader = new FileReader();
40
-                reader.onload = function(e) {
41
-                    var base64 = e.target.result;
42
-                    // 处理Base64图片数据
43
-                    setHtml('', base64);
44
-                    fileArr.push(base64);
45
-                    if (imgUpLength == fileArr.length) {
46
-                        upFile();
47
-                    }
48
-                };
49
-                reader.readAsDataURL(file);
50
-            }
51
-        };
52
-        input.click();
34
+		input.type = 'file';
35
+		input.accept = 'image/*';
36
+		input.multiple = true; // 允许选择多张图片
37
+		input.capture = 'camera';
38
+		
39
+		input.onchange = function(e) {
40
+		    var files = e.target.files;
41
+		
42
+		    if (files.length > 0) {
43
+		        var promises = [];
44
+		
45
+		        for (var i = 0; i < files.length; i++) {
46
+		            var file = files[i];
47
+		            var reader = new FileReader();
48
+		
49
+		            var promise = new Promise(function(resolve, reject) {
50
+		                reader.onload = function(e) {
51
+		                    var base64 = e.target.result;
52
+		                    resolve({
53
+		                    	base64
54
+		                    });
55
+		                };
56
+		                reader.onerror = function(e) {
57
+		                    reject(e);
58
+		                };
59
+		                reader.readAsDataURL(file);
60
+		            });
61
+		
62
+		            promises.push(promise);
63
+		        }
64
+		
65
+		        Promise.all(promises).then(function(res) {
66
+		        	for (var info of res) {
67
+						if (info.base64) {
68
+							setHtml(info.base64, info.base64);
69
+							fileArr.push(info.base64);
70
+							
71
+						}
72
+						
73
+					}
74
+		        	
75
+		            upFile();
76
+		        }).catch(function(error) {
77
+		            console.error('读取文件失败:', error);
78
+		        });
79
+		    }
80
+		};
81
+		
82
+		input.click();
53 83
     }
54 84
 }, false);
55 85
 // 拍照获取图片  
@@ -122,6 +152,8 @@ $("#imgs").on("tap", ".deleteBtn", function() {
122 152
 })
123 153
 
124 154
 function upFile() {
155
+	
156
+	console.log(fileArr, 'fileArr')
125 157
 	mui.ajax(huayi.config.callcenter_url + '/ApplicationsVersion/UploadBase64', {
126 158
 		data: {
127 159
 			"dataurl": fileArr
@@ -136,16 +168,16 @@ function upFile() {
136 168
 					$("#imgs li").eq(Number(imgsLength)).attr("imgId", data.acs[i].F_Id)
137 169
           imgsLength++;
138 170
 				}
139
-				mui.alert("图片上传成功");
140
-				plus.nativeUI.closeWaiting(); 
171
+				mui.toast("图片上传成功");
172
+				// plus.nativeUI.closeWaiting(); 
141 173
 			} else {
142 174
 				mui.alert("上传失败");
143
-        plus.nativeUI.closeWaiting(); 
175
+        		//plus.nativeUI.closeWaiting(); 
144 176
 			}
145 177
 		},
146 178
 		error: function(xhr, type, errorThrown) {
147 179
 			mui.alert(errorThrown);
148
-      plus.nativeUI.closeWaiting(); 
180
+      		// plus.nativeUI.closeWaiting(); 
149 181
 		}
150 182
 	});
151 183
 }
@@ -190,69 +222,6 @@ function appendFile(path) {
190 222
 			
191 223
 }
192 224
 
193
-function appendFileH5(path) {
194
-////fileArr=[]
195
-//	var bitmap = new plus.nativeObj.Bitmap("test");
196
-//	// 从本地加载Bitmap图片  
197
-//	bitmap.load(path,function(){  
198
-//		var base64 = bitmap.toBase64Data()  
199
-//		var img = new Image();
200
-//		img .crossOrigin = "Anonymous"; 
201
-//		img.src = path; // 传过来的图片路径在这里用。   
202
-//		img.onload = function() {
203
-//			var that = this;
204
-//			//生成比例   
205
-//			var w = that.width,
206
-//				h = that.height,
207
-//				scale = w / h;
208
-//			w = 480 || w; //480  你想压缩到多大,改这里  
209
-//			h = w / scale;
210
-//			//生成canvas  
211
-//			var canvas = document.createElement('canvas');
212
-//			var ctx = canvas.getContext('2d');
213
-//			$(canvas).attr({
214
-//				width: w,
215
-//				height: h
216
-//			});
217
-//			ctx.drawImage(that, 0, 0, w, h);
218
-//			var base64 = canvas.toDataURL('image/jpeg', 1 || 0.8); //1最清晰,越低越模糊。有一点不清楚这里明明设置的是jpeg。弹出 base64 开头的一段 data:image/png;却是png。哎开心就好,开心就好       
219
-//			f1 = base64; // 把base64数据丢过去,上传要用。
220
-//			setHtml(path, f1);
221
-//			fileArr.push(f1);
222
-//			if (imgUpLength == fileArr.length) {
223
-//				upFile()			
224
-//			}
225
-//		}
226
-//	},function(e){  
227
-//		console.log('加载图片失败:'+JSON.stringify(e)); 
228
-//	}); 
229
-	
230
-	
231
-	var img = new Image();
232
-	img.crossOrigin = "Anonymous";
233
-	img.src = path;
234
-	img.onload = function() {
235
-	    var that = this;
236
-	    var w = that.width, h = that.height, scale = w / h;
237
-	    w = 480 || w;
238
-	    h = w / scale;
239
-	    var canvas = document.createElement('canvas');
240
-	    var ctx = canvas.getContext('2d');
241
-	    $(canvas).attr({ width: w, height: h });
242
-	    ctx.drawImage(that, 0, 0, w, h);
243
-	    var base64 = canvas.toDataURL('image/jpeg', 1 || 0.8);
244
-	    f1 = base64; // 把base64数据丢过去,上传要用。
245
-		setHtml(path, f1);
246
-		fileArr.push(f1);
247
-		if (imgUpLength == fileArr.length) {
248
-			upFile()
249
-				
250
-		}
251
-	};
252
-
253
-			
254
-}
255
-
256 225
 // function appendFile(path) {
257 226
 // 	var img = new Image();
258 227
 // 	img.src = path; // 传过来的图片路径在这里用。   

+ 18 - 9
双汇APP-h5/workOrder/Work-dispose.html

@@ -196,10 +196,16 @@
196 196
 		<script src="../js/feedback-page-work.js"></script>
197 197
 		<script type="text/javascript">
198 198
 			mui.init();
199
-			mui.plusReady(function() {
200
-				var wv = plus.webview.currentWebview();
199
+			mui.ready(function() {
200
+				var urlParams = new URLSearchParams(window.location.search);
201
+			    var param1 = urlParams.get('name');
202
+			    var param2 = urlParams.get('classImport');
203
+				var wv = {
204
+					name: param1,
205
+					classImport: param2
206
+				}
201 207
 				var vText = wv.name;
202
-				var token = wv.token; 
208
+				var token = localStorage.getItem("token"); 
203 209
 				var str_ary;
204 210
 				var classImport = wv.classImport;
205 211
 				var orderState = wv.orderState;
@@ -231,24 +237,27 @@
231 237
 							timeout: 10000, //超时时间设置为10秒;
232 238
 							success: function(data) {
233 239
 								if(data.state == "success") {
234
-									plus.nativeUI.toast('处理成功');
240
+									mui.toast('处理成功');
235 241
 									$("#result").val('');
236 242
 									if (classImport) {
237 243
 										if (classImport==2) {
238
-											var wobj = plus.webview.getWebviewById("Work-listCJ");
244
+											// var wobj = plus.webview.getWebviewById("Work-listCJ");
245
+											window.location.href = "Work-listCJ.html";
239 246
 										}else{
240
-											var wobj = plus.webview.getWebviewById("Work-listClass");
247
+											// var wobj = plus.webview.getWebviewById("Work-listClass");
248
+											window.location.href = "Work-listClass.html";
241 249
 										}
242 250
 									}else{
243
-										var wobj = plus.webview.getWebviewById("Work-list");
251
+										// var wobj = plus.webview.getWebviewById("Work-list");
252
+										window.location.href = "Work-list.html";
244 253
 									}
245
-									wobj.reload(true);
254
+									// wobj.reload(true);
246 255
 								} else {
247 256
 									mui.alert(data.message);
248 257
 								}
249 258
 							},
250 259
 							error: function(xhr, type, errorThrown) {
251
-								plus.nativeUI.toast('失败');
260
+								mui.alert('失败');
252 261
 							}
253 262
 						});
254 263
 

+ 9 - 6
双汇APP-h5/workOrder/js/Work-list.js

@@ -1,6 +1,6 @@
1 1
 window.onload = function() {
2 2
 
3
-	mui.plusReady(function() {
3
+	mui.ready(function() {
4 4
 		//var isdeal=helper.request.queryString("isdeal");
5 5
 		var token = localStorage.getItem("token");
6 6
 		var F_See = localStorage.getItem("F_See");
@@ -10,14 +10,14 @@ window.onload = function() {
10 10
 		var pageSize = 10; //每页显示条目
11 11
 		var comprehensive = -1
12 12
 		var total; //数据总条数
13
-		var wv = plus.webview.currentWebview();
13
+		var wv = {}//plus.webview.currentWebview();
14 14
 		var index = wv.index; //交办条件
15 15
 		var importClass = wv.importClass; //工单等级
16 16
 		var keyw="";
17
-		plus.nativeUI.closeWaiting();
17
+		// plus.nativeUI.closeWaiting();
18 18
 		console.log(index)
19 19
 		//显示当前页面
20
-		mui.currentWebview.show();
20
+		// mui.currentWebview.show();
21 21
 		
22 22
 		if(index == 0) {
23 23
 			$(".Totle-box").text('待提交')
@@ -208,6 +208,8 @@ window.onload = function() {
208 208
 			page=1;
209 209
 			pageSize=10;
210 210
 			console.log(comprehensive)
211
+			
212
+			
211 213
 			mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
212 214
 				data: {
213 215
 					token: token, 
@@ -222,6 +224,7 @@ window.onload = function() {
222 224
 					comprehensive:comprehensive
223 225
 				},
224 226
 				dataType: 'json', //服务器返回json格式数据
227
+				crossDomain: true,
225 228
 				type: 'get', //HTTP请求类型
226 229
 				timeout: 10000, //超时时间设置为10秒;
227 230
 				headers: {
@@ -329,7 +332,7 @@ window.onload = function() {
329 332
 			var id = $(this).attr('data-index');
330 333
 			mui.openWindow({
331 334
 				id: 'WorkDetails',
332
-				url: 'WorkDetails.html',
335
+				url: 'WorkDetails.html?name=' + id + '&classImport=' + classImport,
333 336
 				createNew: true,
334 337
 				show: {
335 338
 					aniShow: 'pop-in'
@@ -351,7 +354,7 @@ window.onload = function() {
351 354
 		function submitFun(b) {
352 355
 			mui.openWindow({
353 356
 				id: 'Work-assign',
354
-				url: 'Work-assign.html',
357
+				url: 'Work-assign.html?name=' + b,
355 358
 				createNew: true,
356 359
 				show: {
357 360
 					aniShow: 'pop-in'

+ 18 - 9
双汇APP-h5/workOrder/js/detail.js

@@ -5,8 +5,17 @@ mui.init({
5 5
 	} 
6 6
 });
7 7
 mui.previewImage();
8
-mui.plusReady(function() {
9
-	var wv = plus.webview.currentWebview();
8
+mui.ready(function() {
9
+	
10
+	var urlParams = new URLSearchParams(window.location.search);
11
+    var param1 = urlParams.get('name');
12
+    var param2 = urlParams.get('classImport');
13
+    
14
+    console.log(param1, 'currentWebview')
15
+	var wv = {
16
+		name: param1,
17
+		classImport: param2,
18
+	}//plus.webview.currentWebview();
10 19
 	var vText = wv.name;
11 20
 	//var classImport = wv.classImport;
12 21
 	var ID = vText;
@@ -258,7 +267,7 @@ mui.plusReady(function() {
258 267
 	function remind() {
259 268
 		mui.openWindow({
260 269
 			id: 'Work-remind',
261
-			url: 'Work-remind.html',
270
+			url: 'Work-remind.html?name=' + vText + '&classImport=' +classImport,
262 271
 			createNew:true,
263 272
 			show: {
264 273
 				aniShow: 'pop-in'
@@ -280,7 +289,7 @@ mui.plusReady(function() {
280 289
 	function backFun() {
281 290
 		mui.openWindow({
282 291
 			id: 'Work-HT',
283
-			url: 'Work-HT.html',
292
+			url: 'Work-HT.html?name=' + vText + '&classImport=' +classImport,
284 293
 			createNew:true,
285 294
 			show: {
286 295
 				aniShow: 'pop-in'
@@ -302,7 +311,7 @@ mui.plusReady(function() {
302 311
 	function submitFun() {
303 312
 		mui.openWindow({
304 313
 			id: 'Work-assign',
305
-			url: 'Work-assign.html',
314
+			url: 'Work-assign.html?name=' + vText + '&classImport=' +classImport,
306 315
 			createNew:true,
307 316
 			show: {
308 317
 				aniShow: 'pop-in'
@@ -324,7 +333,7 @@ mui.plusReady(function() {
324 333
 	function appointFun() {
325 334
 		mui.openWindow({
326 335
 			id: 'Work-appoint',
327
-			url: 'Work-appoint.html',
336
+			url: 'Work-appoint.html?name=' + vText + '&classImport=' +classImport,
328 337
 			createNew:true,
329 338
 			show: {
330 339
 				aniShow: 'pop-in'
@@ -346,7 +355,7 @@ mui.plusReady(function() {
346 355
 	function disposeFun() {
347 356
 		mui.openWindow({
348 357
 			id: 'Work-dispose',
349
-			url: 'Work-dispose.html',
358
+			url: 'Work-dispose.html?name=' + vText + '&classImport=' +classImport + '&orderState=' + orderState,
350 359
 			createNew:true,
351 360
 			show: {
352 361
 				aniShow: 'pop-in'
@@ -369,7 +378,7 @@ mui.plusReady(function() {
369 378
 	function signFun() {
370 379
 		mui.openWindow({
371 380
 			id: 'Work-sign',
372
-			url: 'Work-sign.html',
381
+			url: 'Work-sign.html?name=' + vText + '&classImport=' +classImport,
373 382
 			createNew:true,
374 383
 			show: {
375 384
 				aniShow: 'pop-in'
@@ -391,7 +400,7 @@ mui.plusReady(function() {
391 400
 	function completeFun() {
392 401
 		mui.openWindow({
393 402
 			id: 'Work-complete',
394
-			url: 'Work-complete.html',
403
+			url: 'Work-complete.html?name=' + vText + '&classImport=' +classImport,
395 404
 			createNew: true,
396 405
 			show: {
397 406
 				aniShow: 'pop-in'

+ 9 - 3
双汇APP-h5/workOrder/js/work-assign.js

@@ -1,9 +1,15 @@
1 1
 mui.init({
2 2
 	swipeBack: false,
3 3
 })
4
-mui.plusReady(function() {
5
-	var wv = plus.webview.currentWebview();
6
-	var token = wv.token;
4
+mui.ready(function() {
5
+	var urlParams = new URLSearchParams(window.location.search);
6
+    var param1 = urlParams.get('name');
7
+    var param2 = urlParams.get('classImport');
8
+	var wv = {
9
+		name: param1,
10
+		classImport: classImport,
11
+	}//plus.webview.currentWebview();
12
+	var token = localStorage.getItem("token");
7 13
 	var classImport = wv.classImport;
8 14
 	var isdeals = wv.name;
9 15
 	//交办单位