瀏覽代碼

完善文件上传和ios适配

LuChongMei 11 月之前
父節點
當前提交
23c82030a6

+ 32 - 583
jp-mobile/pages.json

@@ -13,36 +13,36 @@
 				"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
-		{
-		    "path" : "pages/commonseal/addCommon",
-		    "style" : {
-				"navigationBarTitleText": "新增拟稿申请"
-			}
-		},
-		{
-		    "path" : "pages/commonseal/examineCommon",
-		    "style" : {
-				"navigationBarTitleText": "拟稿审批"
-			}
-		},
-		{
-		    "path" : "pages/commonseal/commonInfo",
-		    "style" : {
-				"navigationBarTitleText": "拟稿详情"
-			}
-		},
-		{
-		    "path" : "pages/commonseal/commonList",
-		    "style" : {
-				"navigationBarTitleText": "列表"
-			}
-		},
-		{
-		    "path" : "pages/commonseal/statistics",
-		    "style" : {
-				"navigationBarTitleText": "用章统计"
-			}
-		},
+		// {
+		//     "path" : "pages/commonseal/addCommon",
+		//     "style" : {
+		// 		"navigationBarTitleText": "新增拟稿申请"
+		// 	}
+		// },
+		// {
+		//     "path" : "pages/commonseal/examineCommon",
+		//     "style" : {
+		// 		"navigationBarTitleText": "拟稿审批"
+		// 	}
+		// },
+		// {
+		//     "path" : "pages/commonseal/commonInfo",
+		//     "style" : {
+		// 		"navigationBarTitleText": "拟稿详情"
+		// 	}
+		// },
+		// {
+		//     "path" : "pages/commonseal/commonList",
+		//     "style" : {
+		// 		"navigationBarTitleText": "列表"
+		// 	}
+		// },
+		// {
+		//     "path" : "pages/commonseal/statistics",
+		//     "style" : {
+		// 		"navigationBarTitleText": "用章统计"
+		// 	}
+		// },
 		{
 		    "path" : "pages/fileTransmit/addFileTransmit",
 		    "style" : {
@@ -91,559 +91,9 @@
 				"navigationBarTitleText": "签名"
 			}
 		}
-        ,{
-            "path" : "pages/apps/notification/notification",
-            "style" : {
-				"navigationBarTitleText": "通知"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/mail",
-            "style" : {
-				"navigationBarTitleText": "站内信"
-			}
-        }
-        ,{
-            "path" : "pages/apps/notification/notificationDetail",
-            "style" : {
-				"navigationBarTitleText": "通知详情"
-			}
-        }
-        ,{
-            "path" : "pages/apps/notification/oaNotifyForm",
-            "style" : {
-				"navigationBarTitleText": "签发通知"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/inbox",
-            "style" : {
-				"navigationBarTitleText": "收件箱"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/outbox",
-            "style" : {
-				"navigationBarTitleText": "发件箱"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/draft",
-            "style" : {
-				"navigationBarTitleText": "草稿箱"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/trash",
-            "style" : {
-				"navigationBarTitleText": "垃圾箱"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/sendEmailForm",
-            "style" : {
-				"navigationBarTitleText": "发送邮件"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/sendEmailDetail",
-            "style" : {
-				"navigationBarTitleText": "邮件详情"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/receivedMailDetail",
-            "style" : {
-				"navigationBarTitleText": "邮件详情"
-			}
-        }
-        ,{
-            "path" : "pages/apps/mail/trashMailDetail",
-            "style" : {
-				"navigationBarTitleText": "邮件详情"
-			}
-        }
-        ,{
-            "path" : "pages/workbench/task/ApplyList",
-            "style" : {
-				"navigationBarTitleText": "我发起的"
-			}
-        }
-        ,{
-            "path" : "pages/workbench/task/TodoList",
-            "style" : {
-				"navigationBarTitleText": "待办事项"
-			}
-        }
-        ,{
-            "path" : "pages/workbench/task/HistoryList",
-            "style" : {
-				"navigationBarTitleText": "已办事项"
-			}
-        }
-        ,{
-            "path" : "pages/workbench/task/FlowCopyList",
-            "style" : {
-				"navigationBarTitleText": "抄送我的"
-			}
-        }
-        ,{
-            "path" : "pages/workbench/task/TaskForm",
-            "style" : {
-				"navigationBarTitleText": "流程表单" // 隐藏系统导航栏
-			}
-        }
-        ,{
-            "path" : "pages/workbench/task/TaskFormDetail",
-            "style" : {
-				"navigationBarTitleText": "表单详情" // 隐藏系统导航栏
-			}
-        },
-		{
-		    "path" : "pages/workbench/task/TaskFormEdit",
-		    "style" : {
-				"navigationBarTitleText": "表单编辑" // 隐藏系统导航栏
-			}
-		},
-		{
-		    "path" : "pages/test/mobile/TestMobileForm",
-		    "style" : {}
-		},
-		{
-		    "path" : "pages/test/mobile/TestMobileList",
-		    "style" : {
-				"navigationBarTitleText": "移动表单列表" // 隐藏系统导航栏
-			}
-		},
-		{
-		    "path" : "pages/test/activiti/TestActivitiLeaveForm",
-		    "style" : {}
-		},
-		{
-			"path" : "pages/example/basics/icon",
-			"style" : {
-				"navigationBarTitleText": "自定义图标"
-			}
-		},
-		{
-			"path": "pages/example/ucharts/ucharts",
-			"style": {
-				"navigationBarTitleText": "ucharts"
-			}
-		},
-		{
-			"path": "pages/example/components",
-			"style": {
-				"navigationBarTitleText": "uView UI"
-			}
-		}
+        
     ],
-	"subPackages": [{
-		"root": "pages/example/componentsA",
-		"pages": [
-			// 过渡动画
-			{
-				"path": "transition/transition",
-				"style": {
-					"navigationBarTitleText": "过渡动画"
-				}
-			},
-			{
-				"path": "test/test",
-				"style": {
-					"navigationBarTitleText": "测试"
-				}
-			},
-			{
-				"path": "icon/icon",
-				"style": {
-					"navigationBarTitleText": "图标"
-				}
-			},
-			{
-				"path": "cell/cell",
-				"style": {
-					"navigationBarTitleText": "单元格"
-				}
-			},
-			{
-				"path": "line/line",
-				"style": {
-					"navigationBarTitleText": "线条"
-				}
-			},
-			{
-				"path": "image/image",
-				"style": {
-					"navigationBarTitleText": "图片"
-				}
-			},
-			{
-				"path": "link/link",
-				"style": {
-					"navigationBarTitleText": "超链接"
-				}
-			},
-			{
-				"path": "button/button",
-				"style": {
-					"navigationBarTitleText": "按钮"
-				}
-			},
-			{
-				"path": "loading-icon/loading-icon",
-				"style": {
-					"navigationBarTitleText": "加载中图标"
-				}
-			},
-			{
-				"path": "overlay/overlay",
-				"style": {
-					"navigationBarTitleText": "遮罩层",
-					"navigationStyle": "custom"
-				}
-			},
-			{
-				"path": "loading-page/loading-page",
-				"style": {
-					"navigationBarTitleText": "加载页",
-					"navigationStyle": "custom"
-				}
-			},
-			{
-				"path": "popup/popup",
-				"style": {
-					"navigationBarTitleText": "弹窗",
-					"navigationStyle": "custom"
-				}
-			},
-			{
-				"path": "swipeAction/swipeAction",
-				"style": {
-					"navigationBarTitleText": "滑动单元格"
-				}
-			},
-			{
-				"path": "sticky/sticky",
-				"style": {
-					"navigationBarTitleText": "吸顶"
-				}
-			},
-			{
-				"path": "radio/radio",
-				"style": {
-					"navigationBarTitleText": "单选框"
-				}
-			},
-			{
-				"path": "checkbox/checkbox",
-				"style": {
-					"navigationBarTitleText": "复选框"
-				}
-			},
-			{
-				"path": "empty/empty",
-				"style": {
-					"navigationBarTitleText": "内容为空"
-				}
-			},
-			{
-				"path": "backtop/backtop",
-				"style": {
-					"navigationBarTitleText": "返回顶部"
-				}
-			},
-			{
-				"path": "divider/divider",
-				"style": {
-					"navigationBarTitleText": "分割线"
-				}
-			},
-			{
-				"path": "rate/rate",
-				"style": {
-					"navigationBarTitleText": "评分"
-				}
-			},
-			{
-				"path": "gap/gap",
-				"style": {
-					"navigationBarTitleText": "间隔槽"
-				}
-			},
-			{
-				"path": "grid/grid",
-				"style": {
-					"navigationBarTitleText": "宫格"
-				}
-			}
-		]
-	}, {
-		"root": "pages/example/componentsB",
-		"pages": [{
-			"path": "dropdown/dropdown",
-			"style": {
-				"navigationBarTitleText": "下拉菜单"
-			}
-		}, {
-			"path": "actionSheet/actionSheet",
-			"style": {
-				"navigationBarTitleText": "上拉菜单",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "parse/parse",
-			"style": {
-				"navigationBarTitleText": "富文本解析器"
-			}
-		}, {
-			"path": "parse/jump",
-			"style": {
-				"navigationBarTitleText": "内部链接"
-			}
-		}, {
-			"path": "toast/toast",
-			"style": {
-				"navigationBarTitleText": "提示消息"
-			}
-		}, {
-			"path": "keyboard/keyboard",
-			"style": {
-				"navigationBarTitleText": "键盘",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "slider/slider",
-			"style": {
-				"navigationBarTitleText": "滑动选择器"
-			}
-		}, {
-			"path": "upload/upload",
-			"style": {
-				"navigationBarTitleText": "上传"
-			}
-		}, {
-			"path": "notify/notify",
-			"style": {
-				"navigationBarTitleText": "消息提示"
-			}
-		}, {
-			"path": "countDown/countDown",
-			"style": {
-				"navigationBarTitleText": "倒计时"
-			}
-		}, {
-			"path": "color/color",
-			"style": {
-				"navigationBarTitleText": "色彩"
-			}
-		}, {
-			"path": "numberBox/numberBox",
-			"style": {
-				"navigationBarTitleText": "步进器"
-			}
-		}, {
-			"path": "countTo/countTo",
-			"style": {
-				"navigationBarTitleText": "数字滚动"
-			}
-		}, {
-			"path": "search/search",
-			"style": {
-				"navigationBarTitleText": "搜索"
-			}
-		}, {
-			"path": "badge/badge",
-			"style": {
-				"navigationBarTitleText": "徽标数"
-			}
-		}, {
-			"path": "tag/tag",
-			"style": {
-				"navigationBarTitleText": "标签"
-			}
-		}, {
-			"path": "alert/alert",
-			"style": {
-				"navigationBarTitleText": "警告"
-			}
-		}, {
-			"path": "switch/switch",
-			"style": {
-				"navigationBarTitleText": "开关"
-			}
-		}, {
-			"path": "collapse/collapse",
-			"style": {
-				"navigationBarTitleText": "折叠面板"
-			}
-		}, {
-			"path": "code/code",
-			"style": {
-				"navigationBarTitleText": "验证码"
-			}
-		}, {
-			"path": "noticeBar/noticeBar",
-			"style": {
-				"navigationBarTitleText": "滚动通知"
-			}
-		}, {
-			"path": "progress/progress",
-			"style": {
-				"navigationBarTitleText": "进度条"
-			}
-		}, {
-			"path": "tabbar/tabbar",
-			"style": {
-				"navigationBarTitleText": "Tabbar"
-			}
-		}]
-	}, {
-		"root": "pages/example/componentsC",
-		"pages": [{
-			"path": "table/table",
-			"style": {
-				"navigationBarTitleText": "表格"
-			}
-		}, {
-			"path": "form/form",
-			"style": {
-				"navigationBarTitleText": "表单",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "textarea/textarea",
-			"style": {
-				"navigationBarTitleText": "文本域"
-			}
-		}, {
-			"path": "noNetwork/noNetwork",
-			"style": {
-				"navigationBarTitleText": "无网络提示"
-			}
-		}, {
-			"path": "loadmore/loadmore",
-			"style": {
-				"navigationBarTitleText": "加载更多"
-			}
-		}, {
-			"path": "text/text",
-			"style": {
-				"navigationBarTitleText": "文本"
-			}
-		}, {
-			"path": "steps/steps",
-			"style": {
-				"navigationBarTitleText": "步骤条"
-			}
-		}, {
-			"path": "navbar/navbar",
-			"style": {
-				"navigationBarTitleText": "导航栏",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "skeleton/skeleton",
-			"style": {
-				"navigationBarTitleText": "骨架屏"
-			}
-		}, {
-			"path": "input/input",
-			"style": {
-				"navigationBarTitleText": "输入框"
-			}
-		}, {
-			"path": "album/album",
-			"style": {
-				"navigationBarTitleText": "相册"
-			}
-		}, {
-			"path": "avatar/avatar",
-			"style": {
-				"navigationBarTitleText": "头像"
-			}
-		}, {
-			"path": "readMore/readMore",
-			"style": {
-				"navigationBarTitleText": "阅读更多"
-			}
-		}, {
-			"path": "layout/layout",
-			"style": {
-				"navigationBarTitleText": "布局"
-			}
-		}, {
-			"path": "indexList/indexList",
-			"style": {
-				"navigationBarTitleText": "索引列表"
-			}
-		}, {
-			"path": "tooltip/tooltip",
-			"style": {
-				"navigationBarTitleText": "长按提示"
-			}
-		}, {
-			"path": "tabs/tabs",
-			"style": {
-				"navigationBarTitleText": "标签"
-			}
-		}, {
-			"path": "list/list",
-			"style": {
-				"navigationBarTitleText": "列表"
-			}
-		}, {
-			"path": "swiper/swiper",
-			"style": {
-				"navigationBarTitleText": "轮播"
-			}
-		}, {
-			"path": "scrollList/scrollList",
-			"style": {
-				"navigationBarTitleText": "横向滚动列表"
-			}
-		}, {
-			"path": "codeInput/codeInput",
-			"style": {
-				"navigationBarTitleText": "验证码输入"
-			}
-		}, {
-			"path": "modal/modal",
-			"style": {
-				"navigationBarTitleText": "模态框",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "picker/picker",
-			"style": {
-				"navigationBarTitleText": "选择器",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "calendar/calendar",
-			"style": {
-				"navigationBarTitleText": "日历",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "datetimePicker/datetimePicker",
-			"style": {
-				"navigationBarTitleText": "时间选择",
-				"navigationStyle": "custom"
-			}
-		}, {
-			"path": "subsection/subsection",
-			"style": {
-				"navigationBarTitleText": "分段器"
-			}
-		}]
-	}],
-	"preloadRule": {
-		"pages/example/components": {
-			"network": "all",
-			"packages": ["pages/componentsA", "pages/componentsB"]
-		}
-	},
+	
 	"globalStyle": {
 		"mp-alipay": {
 			/* 支付宝小程序特有相关 */
@@ -658,7 +108,6 @@
 		},
 		"app-plus":{
 			"navigationBarBackgroundColor": "#36a7f3",
-			"navigationBarTitleText": "公文流转",
 			"navigationBarTextStyle": "white"
 		}
 	},

+ 108 - 29
jp-mobile/pages/fileTransmit/addFileTransmit.vue

@@ -51,9 +51,11 @@
 				<view class="other_info">
 					<view class="other_pdf">
 						<u-cell-group>
-							<u-cell v-for="item in fileList" :title="item.name">
-								<u-icon slot="right-icon" size="28" name="trash-fill"
-									@click="deleteFile(item)"></u-icon>
+							<u-cell v-for="item in fileList" >
+								<view slot="title">
+									<u--text :lines="1" :text="item.name"></u--text>
+								</view>
+								<u-icon slot="value" size="28" name="trash-fill" @click="deleteFile(item)"></u-icon>
 							</u-cell>
 						</u-cell-group>
 					</view>
@@ -270,6 +272,25 @@
 					}
 				});
 			},
+			// 拍照上传
+			async uploadFilePromise(param) {
+				return new Promise((resolve, reject) => {
+
+					let a = uni.uploadFile({
+						url: this.BASE_URL + '/gwfile/upload?uploadPath=filetransmit',
+						filePath: param,
+						name: 'file',
+						header: {
+							"token": $auth.getUserToken()
+						},
+						success: (res) => {
+							setTimeout(() => {
+								resolve(res.data)
+							}, 300)
+						}
+					})
+				});
+			},
 			// 新增图片
 			afterRead(files) {
 				uni.showLoading({
@@ -279,10 +300,83 @@
 				this.files = files
 				for (let i = 0; i < lists.length; i++) {
 					if (lists[i].type == 'success') continue;
-					this.upload(lists[i].name)
+					if (isImageFormat(lists[i].name) && lists[i].size > 200 * 1024) {
+						this.compressAPP(lists[i], 150).then(res => {
+							this.files.get(lists[i].name).file = res
+							this.upload(lists[i].name)
+						})
+					} else {
+						this.upload(lists[i].name)
+					}
 				}
 
 			},
+			// app图片压缩
+			compressAPP(urlData, targetSizeKB, initialQuality = 1.0) {
+				const maxQuality = 1.0;
+				const minQuality = 0.0;
+				const tolerance = 0.01; // 根据需要调整公差
+				let that = this
+				return new Promise((resolve, reject) => {
+
+					let binarySearch = (min, max) => {
+						const midQuality = (min + max) / 2;
+						uni.getImageInfo({
+							src: urlData.path,
+							success: function(res) {
+								let img = new Image()
+								img.src = res.path
+								img.onload = function() {
+									const canvas = document.createElement('canvas');
+									const ctx = canvas.getContext('2d');
+
+									canvas.width = img.width;
+									canvas.height = img.height;
+
+									ctx.clearRect(0, 0, canvas.width, canvas.height);
+									ctx.drawImage(img, 0, 0, canvas.width, canvas
+										.height);
+
+									// 使用异步的 toBlob 方法
+									canvas.toBlob(async (blob) => {
+										const fileSizeKB = blob.size / 1024;
+										if (Math.abs(fileSizeKB -
+												targetSizeKB) <
+											tolerance || max - min <
+											tolerance) {
+
+											// 当前质量足够接近目标大小,使用当前质量解析
+											const file = new File([blob], urlData
+												.name, {
+													type: blob.type,
+													lastModified: new Date()
+														.getTime(), // 使用当前时间作为最后修改时间
+												});
+											setTimeout(() => {
+												resolve(file)
+											}, 300)
+										} else if (fileSizeKB >
+											targetSizeKB) {
+											// 如果文件大小太大,降低质量,继续二分查找
+											binarySearch(min, midQuality);
+										} else {
+											// 如果文件大小太小,增加质量,继续二分查找
+											binarySearch(midQuality, max);
+										}
+									}, urlData.file.type, midQuality);
+								};
+							},
+							fail: function(err) {
+								resolve(false);
+							}
+						});
+
+
+					}
+					// 开始二分查找
+					binarySearch(minQuality, maxQuality);
+				})
+			},
 			// APP手动上传
 			upload(name) {
 				// name=指定文件名,不指定则上传所有type等于waiting和fail的文件
@@ -293,23 +387,27 @@
 
 				// 更新当前窗口状态变化的文件
 				this.files.set(item.name, item);
-				this.fileLists.push(item)
+				let file = {
+					name: item.name,
+					path: item.responseText
+				}
+				this.fileLists.push(file)
 
 				const fileName = item.name.split(/[/\\=]/).pop();
 				if (isImageFormat(item.name)) {
 					let item1 = {
 						name: fileName,
-						url: BASE_URL + item.responseText
+						url: this.BASE_URL + item.responseText
 					}
 					this.imgList.push(item1)
-
 				} else {
 					let a = {
 						name: fileName,
-						url: BASE_URL + item.responseText
+						url: this.BASE_URL + item.responseText
 					}
 					this.fileList.push(a)
 				}
+				uni.hideLoading()
 				// 微信小程序Map对象for循环不显示,所以转成普通数组,
 				// 如果你用不惯Map对象,也可以像这样转普通数组,组件使用Map主要是避免反复文件去重操作
 				// #ifdef MP-WEIXIN
@@ -322,34 +420,15 @@
 				// ---可删除--演示判断是否所有文件均已上传成功
 				let isAll = [...this.files.values()].find(item => item.type !== 'success');
 				if (!isAll) {
-					uni.hideLoading()
+
 				} else {
 					console.log(isAll.name + '待上传');
 				}
 
 			},
-			// 
-			async uploadFilePromise(param) {
-				return new Promise((resolve, reject) => {
 
-					let a = uni.uploadFile({
-						url: this.BASE_URL + '/gwfile/upload?uploadPath=filetransmit',
-						filePath: param,
-						name: 'file',
-						header: {
-							"token": $auth.getUserToken()
-						},
-						success: (res) => {
-							setTimeout(() => {
-								resolve(res.data)
-							}, 300)
-						}
-					})
-				});
-			},
 			// 下载文件
 			download(param) {
-
 				fileService.download(param).then(data)
 			},
 
@@ -358,7 +437,7 @@
 				this.loading = true
 				let auditForm = Object.assign({}, this.inputForm);
 				let files = []
-				console.log('this.fileLists', this.fileLists);
+				console.log("this.fileLists==>", this.fileLists);
 				this.fileLists.forEach(item => {
 					files.push(item.path)
 				})

+ 7 - 33
jp-mobile/pages/fileTransmit/fileInfo.vue

@@ -13,16 +13,11 @@
 					:title="item.which=='0'?'办公室拟办':item.which=='1'?'领导审批':item.which=='2'?'承办情况':item.which=='3'?'承办转发':'待归档'"
 					:desc="item.state==1?item.nextTruename :item.nextTruename +' - '+item.createTime">
 				</u-steps-item>
-				<!-- <u-steps-item v-for="item in officeInfo" title="办公室拟办" :desc="item.nextTruename +' - '+item.updateTime">
-				</u-steps-item>
-				<u-steps-item title="领导审批" v-for="item in leaderInfo"
-					:desc="item.nextTruename +' - '+item.updateTime"></u-steps-item>
-				<u-steps-item title="承办情况" v-for="item in undertakeInfo"
-					:desc="item.nextTruename +' - '+item.updateTime"></u-steps-item> -->
-				<!-- <u-steps-item v-if="allNum == downList.length" title="归档" desc="">
-				</u-steps-item> -->
 			</u-steps>
 		</view>
+		<view class="info_footer">
+			
+		</view>
 	</view>
 </template>
 
@@ -33,31 +28,6 @@
 	export default {
 		onLoad(option) {
 			this.gwId = option.id
-
-		},
-		onHide() {
-			// 先获取页面栈
-			let pages = getCurrentPages();
-			// 当前页面的前一个页面
-			let prevPage = pages[pages.length - 1];
-			if (prevPage.options.type == '1') {
-				uni.$emit('refresh', {
-					type: 4
-				})
-				uni.navigateBack()
-			}
-		},
-		onUnload() {
-			// 先获取页面栈
-			let pages = getCurrentPages();
-			// 当前页面的前一个页面
-			let prevPage = pages[pages.length - 1];
-			if (prevPage.options.type == '1') {
-				uni.$emit('refresh', {
-					type: 4
-				})
-				uni.navigateBack()
-			}
 		},
 		components: {
 			fileCard,
@@ -108,4 +78,8 @@
 	.info_main {
 		margin: 20px;
 	}
+	.info_footer {
+		width: 100%;
+		height: 20px;
+	}
 </style>

+ 10 - 65
jp-mobile/pages/fileTransmit/fileTransmitList.vue

@@ -45,45 +45,16 @@
 	import gwFlowService from '@/api/circulation/gwFlowService.js'
 	import * as $auth from "@/common/auth.js"
 	export default {
-		onLoad(option) {
-			if (option.type) {
-				this.type = option.type
-				switch (option.type) {
-					case "1":
-						uni.setNavigationBarTitle({
-							title: '待办列表' // 设置为你想要显示的标题文本
-						});
-						break;
-					case "3":
-						uni.setNavigationBarTitle({
-							title: '归档列表' // 设置为你想要显示的标题文本
-						});
-						break;
-					case "4":
-						uni.setNavigationBarTitle({
-							title: '已办列表' // 设置为你想要显示的标题文本
-						});
-						break;
-					case "5":
-						uni.setNavigationBarTitle({
-							title: '公文列表' // 设置为你想要显示的标题文本
-						});
-						break;
-					default:
-						this.type = 5
-						uni.setNavigationBarTitle({
-							title: '公文列表' // 设置为你想要显示的标题文本
-						});
-				}
-				this.searchForm.state = this.type
-				this.loadmore()
-			}
-		},
 		onShow() {
-			uni.$on('refresh', (data) => {
+			// 先获取页面栈
+			let pages = getCurrentPages();
+			
+			// 当前页面的前一个页面
+			let prevPage = pages[pages.length - 1];
+			if (prevPage.options.type) {
 				this.dataList = []
-				this.type = data.type
-				switch (data.type) {
+				this.type = prevPage.options.type
+				switch (prevPage.options.type) {
 					case "1":
 						uni.setNavigationBarTitle({
 							title: '待办列表' // 设置为你想要显示的标题文本
@@ -105,16 +76,13 @@
 						});
 						break;
 				}
-				this.searchForm.state = data.type
+				this.searchForm.state = prevPage.options.type
 				this.tablePage.currentPage = 0
 				this.status = 'loading';
 				this.loadmore()
-			})
+			}
 
 		},
-		onUnload() {
-			uni.$off('refresh');
-		},
 		data() {
 			return {
 				status: 'loadmore',
@@ -158,29 +126,6 @@
 					uni.navigateTo({
 						url: '/pages/fileTransmit/examineFile?id=' + item.id
 					})
-					// let user = $auth.getUserInfo()
-					// let role = $auth.getUserInfo().roleNames
-					// if (role == '办公室主任') {
-					// 	uni.navigateTo({
-					// 		url: '/pages/fileTransmit/examineFile?id=' + item.id
-					// 	})
-					// } else {
-					// 	gwFlowService.queryByGwId(item.id).then(data => {
-					// 		let gw = data.filter(item => {
-					// 			return item.nextUser == user.id && item.state == 1
-					// 		})
-					// 		if (gw.length > 0) {
-					// 			uni.navigateTo({
-					// 				url: '/pages/fileTransmit/examineFile?id=' + item.id
-					// 			})
-					// 		} else {
-
-					// 		}
-
-					// 	})
-					// }
-
-
 				}
 			},
 			// 搜索

+ 17 - 19
jp-mobile/pages/index/index.vue

@@ -20,8 +20,9 @@
 					<text>消息</text>
 				</view>
 			</view> -->
-			<view class="action text-gray add-action"  @click="NavChange" data-cur="workbench">
-				<button class="cu-btn  shadow" :class="PageCur=='workbench'?'cuIcon-homefill bg-blue':'cuIcon-home bg-grey'"></button>
+			<view class="action text-gray add-action" @click="NavChange" data-cur="workbench">
+				<button class="cu-btn  shadow"
+					:class="PageCur=='workbench'?'cuIcon-homefill bg-blue':'cuIcon-home bg-grey'"></button>
 				工作台
 			</view>
 			<!-- 
@@ -31,14 +32,14 @@
 					<text>应用</text>
 				</view>
 			</view> -->
-			
+
 			<view class="action" @click="NavChange" data-cur="my">
 				<view :class="PageCur=='my'?'text-blue':'text-gray'">
 					<text class="lg" :class="PageCur=='my'?'cuIcon-profilefill':'cuIcon-profile'"></text>
 					<text>我的</text>
 				</view>
 			</view>
-	
+
 		</view>
 	</view>
 </template>
@@ -50,7 +51,7 @@
 	import workbench from '@/pages/workbench/workbench.vue'
 	import apps from '@/pages/apps/apps.vue'
 	export default {
-		components:{
+		components: {
 			person,
 			message,
 			workbench,
@@ -58,16 +59,13 @@
 			addressbook
 		},
 		onShow() {
-			uni.$on('refresh', (data) => {
-				this.PageCur= ''
-				setTimeout(()=>{
-					this.PageCur='workbench'
-				},300)
-			})
-		
-		},
-		onUnload() {
-			uni.$off('refresh');
+			if(this.PageCur == 'workbench'){
+				this.PageCur = ''
+				setTimeout(() => {
+					this.PageCur = 'workbench'
+				}, 300)
+			}
+
 		},
 		data() {
 			return {
@@ -83,7 +81,7 @@
 </script>
 
 <style>
-.cu-tag.badge {
-	right: 4px;
-}
-</style>
+	.cu-tag.badge {
+		right: 4px;
+	}
+</style>

+ 4 - 5
jp-mobile/pages/login/login.vue

@@ -6,7 +6,8 @@
 				<view class="top_ri"></view>
 			</view>
 			<view class="title">
-				<view style="font-size: 28px!important;">公文流转管理平台</view>
+				<view style="font-size: 28px!important;">盐都区工信局
+				<br>办公自动化平台</view>
 			</view>
 			<view class="login-form">
 				<u--form :model="inputForm" labelWidth="100px" labelPosition="left" :rules="rules" ref="uForm">
@@ -105,12 +106,10 @@
 </script>
 
 <style lang="scss" scoped>
-	// 记住账户展示
-	.focus_info {}
-
 	#box {
 		position: relative;
-		// color: $u-content-color;
+		width: 100vw;
+		overflow: hidden;
 	}
 
 	.title {

+ 289 - 164
jp-mobile/pages/user/person/person.vue

@@ -1,186 +1,311 @@
 <template>
-  <view class="main">
-	  <cu-custom bgColor="bg-blue">
-	  	<block slot="content">我的</block>
-	  </cu-custom>
-    <view class="person-head">
-	  <view class="cu-avatar xl round margin-left-sm" @tap="ChooseImage" :style="`background-image:url('${avatar}')`" ></view>
-      <view class="person-head-box">
-        <view class="person-head-nickname">{{userInfo.name}}</view>
-        <view class="person-head-username">ID:{{userInfo.loginName}}</view>
-      </view>
-    </view>
-	<u-cell-group :border="false" customStyle="padding: 5px">
-		<u-cell
-		    title="签名"
-			icon="home-fill"
-			:iconStyle="{color: '#0081ff'}"
-			isLink
-			url="/pages/user/setting/signature/signature"
-		></u-cell>
-		<u-cell
-		    title="部门"
-			icon="list-dot"
-			:iconStyle="{color: '#0081ff'}"
-			:value="userInfo.officeDTO && userInfo.officeDTO.name"
-		></u-cell>
-		<!-- <u-cell
+	<view class="main">
+		<cu-custom bgColor="bg-blue">
+			<block slot="content">我的</block>
+		</cu-custom>
+		<view class="person-head">
+			<lsj-upload ref="lsjUpload" childId="upload1" width="160rpx" height="140rpx" :option="option" :debug="false"
+				:instantly="false" @uploadEnd="onuploadEnd" @change="afterRead">
+				<view class="cu-avatar xl round margin-left-sm" :style="`background-image:url('${avatar}')`"></view>
+			</lsj-upload>
+
+			<view class="person-head-box">
+				<view class="person-head-nickname">{{userInfo.name?userInfo.name:''}}</view>
+				<view class="person-head-username">ID:{{userInfo.loginName?userInfo.loginName:''}}</view>
+			</view>
+		</view>
+		<u-cell-group :border="false" customStyle="padding: 5px">
+			<u-cell title="签名" icon="home-fill" :iconStyle="{color: '#0081ff'}" isLink
+				url="/pages/user/setting/signature/signature"></u-cell>
+			<u-cell title="部门" icon="list-dot" :iconStyle="{color: '#0081ff'}"
+				:value="userInfo.officeDTO && userInfo.officeDTO.name"></u-cell>
+			<!-- <u-cell
 		    title="岗位"
 			icon="account-fill"
 			:iconStyle="{color: '#0081ff'}"
 			:value="userInfo.post && userInfo.post.name"
 		></u-cell> -->
-		<u-cell
-		    title="角色"
-			icon="man-add-fill"
-			:iconStyle="{color: '#0081ff'}"
-			:value="userInfo.roleNames"
-		></u-cell>
-		<u-cell
-		    title="电话"
-			icon="phone-fill"
-			:iconStyle="{color: '#0081ff'}"
-			:value="userInfo.phone"
-		></u-cell>
-		<u-cell
-		    title="手机号"
-			icon="phone-fill"
-			:iconStyle="{color: '#0081ff'}"
-			:value="userInfo.mobile"
-		></u-cell>
-		<!-- <u-cell
+			<u-cell title="角色" icon="man-add-fill" :iconStyle="{color: '#0081ff'}"
+				:value="userInfo.roleNames?userInfo.roleNames:''"></u-cell>
+			<u-cell title="电话" icon="phone-fill" :iconStyle="{color: '#0081ff'}"
+				:value="userInfo.phone?userInfo.phone:''"></u-cell>
+			<u-cell title="手机号" icon="phone-fill" :iconStyle="{color: '#0081ff'}"
+				:value="userInfo.mobile?userInfo.mobile:''"></u-cell>
+			<!-- <u-cell
 		    title="邮箱"
 			icon="email-fill"
 			:iconStyle="{color: '#0081ff'}"
 			:value="userInfo.email"
 		></u-cell> -->
-		<u-cell
-		    title="修改密码"
-			icon="edit-pen"
-		    isLink
-			:iconStyle="{color: '#e54d42'}"
-		    url="/pages/user/setting/password/password"
-		></u-cell>
-	</u-cell-group>
-
-	<view class="padding-xl">
-		<u-button type="primary" text="退出登录" @click="outlogin"></u-button>
-		<!-- <u-gap height="80" bgColor="#fff"></u-gap> -->
-	</view>
+			<u-cell title="修改密码" icon="edit-pen" isLink :iconStyle="{color: '#e54d42'}"
+				url="/pages/user/setting/password/password"></u-cell>
+		</u-cell-group>
 
-  </view>
+		<view class="padding-xl">
+			<u-button type="primary" text="退出登录" @click="outlogin"></u-button>
+			<!-- <u-gap height="80" bgColor="#fff"></u-gap> -->
+		</view>
+
+	</view>
 
 </template>
 
 <script>
-  import {mapState, mapMutations, mapActions} from 'vuex'
-  import userService from "@/api/sys/userService"
-  import loginService from "@/api/auth/loginService"
-  import fileService from "@/api/file/fileService.js"
-  export default {
-	name: "person",
-	computed: mapState({
-		 userInfo: (state) => state.user.userInfo,
-		 avatar: (state) => state.user.avatar
+	import {
+		mapState,
+		mapMutations,
+		mapActions
+	} from 'vuex'
+	import {
+		isImageFormat
+	} from "@/common/util.js"
+	import BASE_URL from '@/config.js'
+	import * as $auth from "@/common/auth.js"
+	import userService from "@/api/sys/userService"
+	import loginService from "@/api/auth/loginService"
+	import fileService from "@/api/file/fileService.js"
+	export default {
+		name: "person",
+		computed: mapState({
+			userInfo: (state) => state.user.userInfo,
+			avatar: (state) => BASE_URL + state.user.avatar
 		}),
-    methods: {
-	  ...mapActions(['refreshUserInfo']),
-      /**
-       * 修改密码
-       */
-      toPassword() {
-        uni.navigateTo({
-          url: '/pages/user/setting/password/password'
-        })
-      },
-	 ChooseImage() {
-	 	uni.chooseImage({
-	 		count: 1, //默认9
-	 		sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-	 		sourceType: ['album'], //从相册选择
-	 		success: (res) => {
-				this.upload(res.tempFilePaths[0])
-	 		}
-	 	});
-	 },
-	 upload(filePath) {
-		fileService.upload(filePath).then((data) =>{
-			userService.saveInfo({
-				id: this.userInfo.id,
-				photo: data
-			}).then(()=>{
-				this.refreshUserInfo()
-			})
-		})
-	 },
-	  outlogin() {
-		    uni.showLoading()
-			loginService.logout().then((data)=>{
-	  		  		this.$store.commit('logout');
+		data() {
+			return {
+				files: [],
+				// 上传接口参数
+				option: {
+					url: BASE_URL + '/gwfile/upload?uploadPath=userdir',
+					name: 'file',
+					header: {
+						"token": $auth.getUserToken()
+					},
+				},
+			}
+		},
+		methods: {
+			...mapActions(['refreshUserInfo']),
+			/**
+			 * 修改密码
+			 */
+			toPassword() {
+				uni.navigateTo({
+					url: '/pages/user/setting/password/password'
+				})
+			},
+			// 新增图片
+			afterRead(files) {
+				uni.showLoading({
+					title: "更新中"
+				})
+				let lists = [...files.values()]
+				this.files = files
+				for (let i = 0; i < lists.length; i++) {
+					if (lists[i].type == 'success') continue;
+					if (!isImageFormat(lists[i].name)) {
+						uni.showToast({
+							title: '请上传图片',
+							icon: 'error'
+						})
+					} else {
+						if (lists[i].size > 200 * 1024) {
+							this.compressAPP(lists[i], 150).then(res => {
+								this.files.get(lists[i].name).file = res
+								this.upload(lists[i].name)
+							})
+						} else {
+							this.upload(lists[i].name)
+						}
+					}
+
+				}
+
+			},
+			// app图片压缩
+			compressAPP(urlData, targetSizeKB, initialQuality = 1.0) {
+				const maxQuality = 1.0;
+				const minQuality = 0.0;
+				const tolerance = 0.01; // 根据需要调整公差
+				let that = this
+				return new Promise((resolve, reject) => {
+
+					let binarySearch = (min, max) => {
+						const midQuality = (min + max) / 2;
+						uni.getImageInfo({
+							src: urlData.path,
+							success: function(res) {
+								let img = new Image()
+								img.src = res.path
+								img.onload = function() {
+									const canvas = document.createElement('canvas');
+									const ctx = canvas.getContext('2d');
+
+									canvas.width = img.width;
+									canvas.height = img.height;
+
+									ctx.clearRect(0, 0, canvas.width, canvas.height);
+									ctx.drawImage(img, 0, 0, canvas.width, canvas
+										.height);
+
+									// 使用异步的 toBlob 方法
+									canvas.toBlob(async (blob) => {
+										const fileSizeKB = blob.size / 1024;
+										if (Math.abs(fileSizeKB -
+												targetSizeKB) <
+											tolerance || max - min <
+											tolerance) {
+
+											// 当前质量足够接近目标大小,使用当前质量解析
+											const file = new File([blob], urlData
+												.name, {
+													type: blob.type,
+													lastModified: new Date()
+														.getTime(), // 使用当前时间作为最后修改时间
+												});
+											setTimeout(() => {
+												resolve(file)
+											}, 300)
+										} else if (fileSizeKB >
+											targetSizeKB) {
+											// 如果文件大小太大,降低质量,继续二分查找
+											binarySearch(min, midQuality);
+										} else {
+											// 如果文件大小太小,增加质量,继续二分查找
+											binarySearch(midQuality, max);
+										}
+									}, urlData.file.type, midQuality);
+								};
+							},
+							fail: function(err) {
+								resolve(false);
+							}
+						});
+
+
+					}
+					// 开始二分查找
+					binarySearch(minQuality, maxQuality);
+				})
+			},
+			// APP手动上传
+			upload(name) {
+				// name=指定文件名,不指定则上传所有type等于waiting和fail的文件
+				this.$refs['lsjUpload'].upload(name);
+			},
+			onuploadEnd(item) {
+				console.log(`${item.name}已上传结束,上传状态=${item.type}`);
+
+				// 更新当前窗口状态变化的文件
+				this.files.set(item.name, item);
+				let file = {
+					name: item.name,
+					path: item.responseText
+				}
+				// 微信小程序Map对象for循环不显示,所以转成普通数组,
+				// 如果你用不惯Map对象,也可以像这样转普通数组,组件使用Map主要是避免反复文件去重操作
+				// #ifdef MP-WEIXIN
+				this.wxFiles = [...this.files.values()];
+				// #endif
+
+				// 强制更新视图
+				this.$forceUpdate();
+				userService.saveInfo({
+					id: this.userInfo.id,
+					photo: item.responseText
+				}).then(() => {
+					this.refreshUserInfo()
+				})
+				uni.hideLoading()
+				// ---可删除--演示判断是否所有文件均已上传成功
+				let isAll = [...this.files.values()].find(item => item.type !== 'success');
+				if (!isAll) {
+
+				} else {
+					console.log(isAll.name + '待上传');
+				}
+
+			},
+			// upload(filePath) {
+			// 	fileService.upload(filePath).then((data) => {
+			// 		userService.saveInfo({
+			// 			id: this.userInfo.id,
+			// 			photo: data
+			// 		}).then(() => {
+			// 			this.refreshUserInfo()
+			// 		})
+			// 	})
+			// },
+			outlogin() {
+				uni.showLoading()
+				loginService.logout().then((data) => {
+					this.$store.commit('logout');
 					uni.clearStorage();
 					uni.hideLoading()
-	  		  		uni.reLaunch({
-	  		  			url: '/pages/login/login'
-	  		  		})
-					
-	  		})
-	  }
-    }
-  }
+					uni.reLaunch({
+						url: '/pages/login/login'
+					})
+
+				})
+			}
+		}
+	}
 </script>
 
 <style>
-  .person-head {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    height: 150px;
-    padding-left: 20px;
-    background: #0081ff;
-  }
-
-  .person-head-box {
-    display: flex;
-    flex-direction: column;
-    justify-content: center;
-    align-items: flex-start;
-    margin-left: 10px;
-  }
-
-  .person-head-nickname {
-    font-size: 18px;
-    font-weight: 500;
-    color: #fff;
-  }
-
-  .person-head-username {
-    font-size: 14px;
-    font-weight: 500;
-    color: #fff;
-  }
-
-  .person-list {
-    line-height: 0;
-  }
-  .cu-list.card-menu {
-      overflow: hidden;
-      margin-right: 5px;
-      margin-left: 5px;
-      border-radius: 7px;
-  }
-  .cu-list.card-menu.margin-top-20 {
-      margin-top: -20px;
-  }
-  .cu-list.menu>.cu-item .content>uni-view:first-child {
-      display: -webkit-box;
-      display: -webkit-flex;
-      display: flex;
-      -webkit-box-align: center;
-      /* -webkit-align-items: center; */
-      /* align-items: center; */
-      display: inline-block;
-      margin-right: 5px;
-      width: 1.6em;
-      text-align: center;
-  }
-</style>
+	.person-head {
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		height: 150px;
+		padding-left: 20px;
+		background: #0081ff;
+	}
+
+	.person-head-box {
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: flex-start;
+		margin-left: 10px;
+	}
+
+	.person-head-nickname {
+		font-size: 18px;
+		font-weight: 500;
+		color: #fff;
+	}
+
+	.person-head-username {
+		font-size: 14px;
+		font-weight: 500;
+		color: #fff;
+	}
+
+	.person-list {
+		line-height: 0;
+	}
+
+	.cu-list.card-menu {
+		overflow: hidden;
+		margin-right: 5px;
+		margin-left: 5px;
+		border-radius: 7px;
+	}
+
+	.cu-list.card-menu.margin-top-20 {
+		margin-top: -20px;
+	}
+
+	.cu-list.menu>.cu-item .content>uni-view:first-child {
+		display: -webkit-box;
+		display: -webkit-flex;
+		display: flex;
+		-webkit-box-align: center;
+		/* -webkit-align-items: center; */
+		/* align-items: center; */
+		display: inline-block;
+		margin-right: 5px;
+		width: 1.6em;
+		text-align: center;
+	}
+</style>

+ 125 - 82
jp-mobile/pages/user/setting/signature/signature.vue

@@ -1,12 +1,19 @@
 <template>
-	<view>
+	<view class="signature_info">
 		<u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" ref="inputForm">
 			<u-form-item label="旧签名" borderBottom prop="signPic">
 				<u--image :showLoading="true" :src="BASE_URL + inputForm.signPic " width="100px"
 					height="40px"></u--image>
 			</u-form-item>
 			<u-form-item label="上传签字图片" borderBottom prop="signPic">
-				<u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" :maxCount="1"></u-upload>
+				<lsj-upload v-if="fileList.length == 0" ref="lsjUpload" childId="upload1" width="250rpx" height="200rpx" :option="option"
+					:debug="false" :instantly="false" @uploadEnd="onuploadEnd" @change="afterRead">
+					<view class="addfile flex">
+						<u-icon size="20" bold name="plus"></u-icon>
+					</view>
+				</lsj-upload>
+				<u-upload :fileList="fileList" @delete="deletePic" :maxCount="fileList.length"
+					:previewFullImage="true"></u-upload>
 			</u-form-item>
 			<u--text size="10" type="warning" text="有签名图片,请上传,无,请点击下面签字生成"></u--text>
 			<u-form-item label="签字" borderBottom prop="signPic">
@@ -23,6 +30,9 @@
 </template>
 
 <script>
+	import {
+		isImageFormat
+	} from "@/common/util.js"
 	import userService from "@/api/sys/userService"
 	import * as $auth from "@/common/auth.js"
 	import BASE_URL from '@/config.js'
@@ -41,7 +51,16 @@
 				loading: false,
 				inputForm: this.$auth.getUserInfo(),
 				fileList: [],
-				signPic: ''
+				files:[],
+				signPic: '',
+				// 上传接口参数
+				option: {
+					url: BASE_URL + '/gwfile/upload?uploadPath=sign',
+					name: 'file',
+					header: {
+						"token": $auth.getUserToken()
+					},
+				},
 			}
 		},
 
@@ -64,120 +83,132 @@
 			deletePic(event) {
 				this.fileList.splice(event.index, 1)
 			},
-			// 图片压缩
-			compressH5(urlData, targetSizeKB, initialQuality = 1.0) {
+			// 新增图片
+			afterRead(files) {
+				uni.showLoading({
+					title: "上传中"
+				})
+				let lists = [...files.values()]
+				this.files = files
+				for (let i = 0; i < lists.length; i++) {
+					if (lists[i].type == 'success') continue;
+					if (!isImageFormat(lists[i].name)) {
+						uni.showToast({
+							title: '请上传图片',
+							icon: 'error'
+						})
+					} else {
+						if (lists[i].size > 200 * 1024) {
+							this.compressAPP(lists[i], 150).then(res => {
+								this.files.get(lists[i].name).file = res
+								this.upload(lists[i].name)
+							})
+						} else {
+							this.upload(lists[i].name)
+						}
+					}
+				}
+			
+			},
+			// app图片压缩
+			compressAPP(urlData, targetSizeKB, initialQuality = 1.0) {
 				const maxQuality = 1.0;
 				const minQuality = 0.0;
 				const tolerance = 0.01; // 根据需要调整公差
 				let that = this
 				return new Promise((resolve, reject) => {
+			
 					let binarySearch = (min, max) => {
 						const midQuality = (min + max) / 2;
 						uni.getImageInfo({
-							src: urlData.url,
-							success(res) {
+							src: urlData.path,
+							success: function(res) {
 								let img = new Image()
 								img.src = res.path
 								img.onload = function() {
 									const canvas = document.createElement('canvas');
 									const ctx = canvas.getContext('2d');
-
+			
 									canvas.width = img.width;
 									canvas.height = img.height;
-
+			
 									ctx.clearRect(0, 0, canvas.width, canvas.height);
-									ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
-
+									ctx.drawImage(img, 0, 0, canvas.width, canvas
+										.height);
+			
 									// 使用异步的 toBlob 方法
 									canvas.toBlob(async (blob) => {
 										const fileSizeKB = blob.size / 1024;
-										if (Math.abs(fileSizeKB - targetSizeKB) <
-											tolerance || max - min < tolerance) {
+										if (Math.abs(fileSizeKB -
+												targetSizeKB) <
+											tolerance || max - min <
+											tolerance) {
+			
 											// 当前质量足够接近目标大小,使用当前质量解析
-											const dataUrl = canvas.toDataURL(urlData
-												.type, midQuality);
-											let result = that
-												.uploadFilePromise(dataUrl)
+											const file = new File([blob], urlData
+												.name, {
+													type: blob.type,
+													lastModified: new Date()
+														.getTime(), // 使用当前时间作为最后修改时间
+												});
 											setTimeout(() => {
-												resolve(
-													result)
-											}, 1000)
-
-										} else if (fileSizeKB > targetSizeKB) {
+												resolve(file)
+											}, 300)
+										} else if (fileSizeKB >
+											targetSizeKB) {
 											// 如果文件大小太大,降低质量,继续二分查找
 											binarySearch(min, midQuality);
 										} else {
 											// 如果文件大小太小,增加质量,继续二分查找
 											binarySearch(midQuality, max);
 										}
-									}, urlData.type, midQuality);
+									}, urlData.file.type, midQuality);
 								};
 							},
-							fail() {
-								uni.showModal({
-									title: '提示',
-									content: '图片压缩失败',
-									showCancel: false
-								});
+							fail: function(err) {
+								resolve(false);
 							}
-						})
+						});
+			
+			
 					}
 					// 开始二分查找
 					binarySearch(minQuality, maxQuality);
 				})
 			},
-			// 新增图片
-			async afterRead(event) {
-
-				// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
-				let lists = [].concat(event.file)
-
-				let fileListLen = this.fileList.length
-				lists.map((item) => {
-					this.fileList.push({
-						...item,
-						status: 'uploading',
-						message: '上传中'
-					})
-				})
-				for (let i = 0; i < lists.length; i++) {
-
-					let result = ""
-					if (lists[i].size > (200 * 1024)) {
-						result = await this.compressH5(lists[i], 150);
-
-					} else {
-						result = await this.uploadFilePromise(lists[i].url)
-					}
-
-					let item = this.fileList[fileListLen]
-
-					this.fileList.splice(fileListLen, 1, Object.assign(item, {
-						status: 'success',
-						message: '',
-						url: result
-					}))
-					console.log("result", result);
-					fileListLen++
-				}
-
+			// APP手动上传
+			upload(name) {
+				// name=指定文件名,不指定则上传所有type等于waiting和fail的文件
+				this.$refs['lsjUpload'].upload(name);
 			},
-			uploadFilePromise(url) {
-				return new Promise((resolve, reject) => {
-					let a = uni.uploadFile({
-						url: this.BASE_URL + '/gwfile/upload?uploadPath=signature',
-						filePath: url,
-						name: 'file',
-						header: {
-							"token": $auth.getUserToken()
-						},
-						success: (res) => {
-							setTimeout(() => {
-								resolve(res.data)
-							}, 1000)
-						}
-					});
-				})
+			onuploadEnd(item) {
+				console.log(`${item.name}已上传结束,上传状态=${item.type}`);
+			
+				// 更新当前窗口状态变化的文件
+				this.files.set(item.name, item);
+				let file = {
+					name: item.name,
+					path: item.responseText
+				}
+				this.fileList.push(file)
+				uni.hideLoading()
+				// 微信小程序Map对象for循环不显示,所以转成普通数组,
+				// 如果你用不惯Map对象,也可以像这样转普通数组,组件使用Map主要是避免反复文件去重操作
+				// #ifdef MP-WEIXIN
+				this.wxFiles = [...this.files.values()];
+				// #endif
+			
+				// 强制更新视图
+				this.$forceUpdate();
+			
+				// ---可删除--演示判断是否所有文件均已上传成功
+				let isAll = [...this.files.values()].find(item => item.type !== 'success');
+				if (!isAll) {
+			
+				} else {
+					console.log(isAll.name + '待上传');
+				}
+			
 			},
 			formSubmit: function(e) {
 				//定义表单规则
@@ -186,7 +217,7 @@
 				let files = []
 				if (this.fileList.length > 0) {
 					this.fileList.forEach(item => {
-						files.push(item.url)
+						files.push(item.path)
 					})
 					this.inputForm.signPic = files.join(",");
 
@@ -221,6 +252,18 @@
 		background: linear-gradient(to right, #365fff, #36bbff);
 	}
 
+	.addfile {
+		width: 80px;
+		height: 80px;
+		background-color: #eee;
+		padding-left: 24%;
+		margin: 10px;
+	}
+
+	.signature_info .takephoto {
+		padding-left: 12%;
+	}
+
 	.btn-logout-hover {
 		background: linear-gradient(to right, #365fdd, #36bbfa);
 	}

+ 2 - 2
jp-mobile/pages/workbench/workbench.vue

@@ -54,7 +54,7 @@
 					<text>已归档</text>
 				</view>
 			</view>
-			<uni-section class="mb-10" title="用章审批" type="line"></uni-section>
+			<!-- <uni-section class="mb-10" title="用章审批" type="line"></uni-section>
 			<view class="cu-list grid col-4 no-border">
 				<view @tap="add(2)" class="circle-button-box">
 					<view><u--image src="/static/index/icon4.png" width="40px" height="40px"></u--image></view>
@@ -72,7 +72,7 @@
 					<view><u--image src="/static/index/icon2.png" width="40px" height="40px"></u--image></view>
 					<text>已归档</text>
 				</view>
-			</view>
+			</view> -->
 			<uni-section class="mb-10" title="公文统计" type="line"></uni-section>
 			<view class="cu-list grid col-4 no-border">
 				<view @tap="toApplyList" class="circle-button-box">

二進制
jp-mobile/static/BasicsBg.png


二進制
jp-mobile/static/cjkz.png


二進制
jp-mobile/static/componentBg.png


+ 4 - 1
jp-mobile/static/css/main.css

@@ -20,7 +20,10 @@ body {
 .main *{
 	font-size: 20px!important;
 }
-
+.main {
+	width: 100%;
+	overflow: hidden;
+}
 view,
 scroll-view,
 swiper,

二進制
jp-mobile/static/logo.png