Browse Source

完善签字上传和附件展示

LuChongMei 1 year ago
parent
commit
b2584c4e84

+ 2 - 0
jp-mobile/pages/fileTransmit/addFileTransmit.vue

@@ -245,6 +245,7 @@
 					let result = ""
 					if (isImageFormat(lists[i].name)) {
 						if (lists[i].size > (200 * 1024)) {
+							
 							result = await this.compressH5(lists[i], 150);
 						} else {
 							result = await this.uploadFilePromise(lists[i].url)
@@ -274,6 +275,7 @@
 				uni.hideLoading()
 			},
 			async uploadFilePromise(param) {
+				
 				return new Promise((resolve, reject) => {
 
 					let a = uni.uploadFile({

+ 1 - 1
jp-mobile/pages/fileTransmit/examineFile.vue

@@ -117,7 +117,7 @@
 				let down = data.filter(item => item.state == 0)
 				if (gw.length > 0) {
 					this.auditForm = gw[0]
-					if (gw[0].which == '3') this.isAll = true
+					if (gw[0].which == '4') this.isAll = true
 					if (!this.auditForm.content) this.auditForm.content = '已阅'
 				}
 				if (role == '办公室主任') {

+ 5 - 4
jp-mobile/pages/fileTransmit/fileCard.vue

@@ -115,16 +115,17 @@
 						<view class="other_pdf  flex  ">
 							<u--text decoration='underline' color='#36a7f3' :text="item.name"
 								@click="item.type=='pdf'?preview(item):download(item)"></u--text>
-
-							<!-- <a :href="item.url">{{item.name}}</a> -->
 						</view>
 					</view>
-					<u-upload :fileList="imgList" name="3" multiple :maxCount="imgList.length" :previewFullImage="true"
-						:deletable="false"></u-upload>
+					
 				</view>
 			</view>
 
 		</view>
+		<view style="margin-left: 20px;">
+			<u-upload :fileList="imgList"  multiple :maxCount="imgList.length" :previewFullImage="true"
+				:deletable="false" ></u-upload>
+		</view>
 		<u-overlay :show="ismask">
 			<view class="warp">
 				<view class="rect"><u-button plain loading loadingText="加载中"></u-button></view>

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

@@ -3,12 +3,12 @@
 		<fileCard :gwId="gwId"></fileCard>
 		<view class="info_main">
 			<u-steps :current="current" direction="column" inactiveColor="#36a7f3" activeColor="#5fdf50">
-				<u-steps-item title="发起" :desc="'办公室管理员 - '+inputForm.createTime">
+				<u-steps-item title="发起" :desc="inputForm.createTruename +' - '+inputForm.createTime">
 				</u-steps-item>
-				<u-steps-item v-for="item in downList" :title="item.which=='0'?'办公室拟办':item.which=='1'?'领导审批':item.which=='2'?'承办情况':'承办转发'"
+				<u-steps-item v-for="item in downList" :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 gwList" :title="item.which=='0'?'办公室拟办':item.which=='1'?'领导审批':item.which=='2'?'承办情况':'承办转发'"
+				<u-steps-item v-for="item in gwList" :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">
@@ -31,9 +31,6 @@
 	export default {
 		onLoad(option) {
 			this.gwId = option.id
-			gwCirculationCard2Service.queryById(this.gwId).then(data => {
-				this.inputForm = data
-			})
 		},
 		components: {
 			fileCard,
@@ -59,7 +56,7 @@
 				data.sort((a, b) => a.createTime.localeCompare(b.createTime) || a.createTime
 					.localeCompare(b.createTime));
 				this.allNum = data.length
-
+				this.inputForm = data[0]
 				data.forEach(item => {
 					if (item.state == 0) {
 						this.downList.push(item)

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

@@ -12,15 +12,23 @@
 			<view class="login-form">
 				<u--form :model="inputForm" labelWidth="100px" labelPosition="left" :rules="rules" ref="uForm">
 					<u-form-item label="用户名" borderBottom prop="username">
-						<u-input v-model="inputForm.username" />
-
+						<u-input @focus="isfocus = true" v-model="inputForm.username" />
 					</u-form-item>
 					<u-form-item label="密码" borderBottom prop="password">
-						<u-input password v-model="inputForm.password" />
+						<u-input @focus="isfocus = true"  password v-model="inputForm.password" />
 					</u-form-item>
-
+					<!-- <u-checkbox-group v-model="isrember" placement="column" @change="checkboxChange">
+						<u-checkbox :customStyle="{marginBottom: '8px'}" label="记住密码" name="true">
+						</u-checkbox>
+					</u-checkbox-group> -->
 				</u--form>
 			</view>
+			<!-- <view v-if="isfocus" class="focus_info" >
+				<view class="flex" v-for="item in accounts">
+					<u--text decoration='underline' color='#36a7f3' :text="item.username"
+						@click="checked"></u--text>
+				</view>
+			</view> -->
 			<view class="but">
 				<u-button type="primary" shape="circle" color="linear-gradient(90deg, #1989FA, #19C2FA)"
 					@click="bindLogin" text="欢迎登录"></u-button>
@@ -42,9 +50,18 @@
 	} from 'vuex'
 
 	export default {
+		mounted() {
+			// if(uni.getStorageSync("accounts")){
+			// 	this.accounts =[].concat(uni.getStorageSync("accounts")) 
+			// }
+			
+		},
 		data() {
 			return {
+				isfocus:false,
 				captchaImg: '',
+				accounts: [],
+				isrember: [],
 				inputForm: {
 					'username': '',
 					'password': '',
@@ -75,6 +92,10 @@
 		},
 		methods: {
 			...mapActions(['refreshUserInfo']),
+			checkboxChange(n) {
+				console.log('change', n);
+				this.isrember[0] = n
+			},
 			// 登录
 			bindLogin() {
 				/**
@@ -84,6 +105,11 @@
 				this.$refs.uForm.validate().then(res => {
 					loginService.login(this.inputForm).then((data) => {
 						this.$store.commit('SET_TOKEN', data.token);
+						// if (this.isrember[0]) {
+						// 	this.accounts.push(this.inputForm)
+						// 	uni.setStorageSync("accounts", this.accounts)
+						// }
+
 						this.refreshUserInfo();
 						uni.reLaunch({
 							url: '../index/index',
@@ -110,6 +136,10 @@
 </script>
 
 <style lang="scss" scoped>
+	// 记住账户展示
+	.focus_info{
+		
+	}
 	#box {
 		position: relative;
 		// color: $u-content-color;

+ 5 - 0
jp-mobile/pages/user/person/person.vue

@@ -115,6 +115,11 @@
 		    uni.showLoading()
 			loginService.logout().then((data)=>{
 	  		  		this.$store.commit('logout');
+					// uni.removeStorageSync("WMS-username");
+					// uni.removeStorageSync("WMS-userinfo");
+					// uni.removeStorageSync("dictList");
+					// uni.removeStorageSync("WMS-permission");
+					// uni.removeStorageSync("token");
 					uni.clearStorage();
 	  		  		uni.reLaunch({
 	  		  			url: '/pages/login/login'

+ 73 - 3
jp-mobile/pages/user/setting/signature/signature.vue

@@ -63,10 +63,73 @@
 			deletePic(event) {
 				this.fileList.splice(event.index, 1)
 			},
+			// 图片压缩
+			compressH5(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) {
+								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 dataUrl = canvas.toDataURL(urlData.type, midQuality);
+											let result = that
+												.uploadFilePromise(dataUrl)
+											setTimeout(() => {
+												resolve(
+													result)
+											}, 1000)
+			
+										} else if (fileSizeKB > targetSizeKB) {
+											// 如果文件大小太大,降低质量,继续二分查找
+											binarySearch(min, midQuality);
+										} else {
+											// 如果文件大小太小,增加质量,继续二分查找
+											binarySearch(midQuality, max);
+										}
+									}, urlData.type, midQuality);
+								};
+							},
+							fail() {
+								uni.showModal({
+									title: '提示',
+									content: '图片压缩失败',
+									showCancel: 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({
@@ -76,7 +139,15 @@
 					})
 				})
 				for (let i = 0; i < lists.length; i++) {
-					const result = await this.uploadFilePromise(lists[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, {
@@ -93,12 +164,11 @@
 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
 						url: this.BASE_URL + '/gwfile/upload?uploadPath=signature',
-						filePath: url.url,
+						filePath: url,
 						name: 'file',
 						header: {
 							"token": $auth.getUserToken()
 						},
-						formData: url,
 						success: (res) => {
 							setTimeout(() => {
 								resolve(res.data)