From b76e716ff4656191d73eba398e9eb39ee975e13b Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期五, 04 七月 2025 12:58:09 +0800 Subject: [PATCH] 来料检优化,首检巡检 --- pages/QC/SJ/ImageItem.vue | 72 +++++++++++++++++++++++------------ 1 files changed, 47 insertions(+), 25 deletions(-) diff --git a/pages/QC/SJ/ImageItem.vue b/pages/QC/SJ/ImageItem.vue index 3eb8e81..c46185c 100644 --- a/pages/QC/SJ/ImageItem.vue +++ b/pages/QC/SJ/ImageItem.vue @@ -8,7 +8,7 @@ <view class="uni-flex" style="margin-bottom: 10px;"> <view class="uni-list-cell-left">鐐瑰嚮鍙瑙堥�夊ソ鐨勫浘鐗�</view> <view style="margin-left: auto;"> - <text class="click-t">{{ qsImage.length }}/{{ countIndex + 1 }}</text> + <text class="click-t">鍏辨湁{{ qsImage.length }}寮犲浘鐗�</text> </view> </view> <view class="uni-flex" style="flex-wrap: wrap;"> @@ -23,7 +23,7 @@ </view> </view> <view class="plus-button"> - <button type="warn" @click="save">涓婁紶鍥剧墖</button> + <button type="primary" class="upImg" @click="save">涓婁紶鍥剧墖</button> </view> </view> <!-- #ifdef APP --> @@ -107,7 +107,8 @@ uni.chooseImage({ sourceType: sourceTypeArray[this.sourceTypeIndex], - sizeType: sizeTypeArray[this.sizeTypeIndex], + //sizeType: sizeTypeArray[this.sizeTypeIndex], + sizeType: ['compressed'], // 寮哄埗浣跨敤鍘嬬缉妯″紡 crop: this.isCrop ? { "quality": this.cropPercent, "width": this.cropWidth, @@ -117,24 +118,25 @@ count: this.qsImage.length + this.count[this.countIndex] > 9 ? 9 - this.qsImage.length : this.count[this.countIndex], success: (res) => { let url = res.tempFilePaths[0]; - pathToBase64(url) - .then(base64 => { - // 鎵惧埌鏈�鍚庝竴涓枩鏉犵殑浣嶇疆 - let lastSlashIndex = url.lastIndexOf("/"); - // 鎻愬彇鏂囦欢鍚� - let fileName = url.substring(lastSlashIndex + 1); - let entity = {}; - entity.img = base64; - entity.Picturename = fileName; - entity.fid = this.fid; - entity.qsType = 1; - entity.base64Date = base64.split(',')[1]; - - this.qsImage.push(entity); - }) - .catch(error => { - console.error(error) - }) + pathToBase64(url) + .then(base64 => { + // 鎵惧埌鏈�鍚庝竴涓枩鏉犵殑浣嶇疆 + let lastSlashIndex = url.lastIndexOf("/"); + // 鎻愬彇鏂囦欢鍚� + let fileName = url.substring(lastSlashIndex + 1); + let entity = {}; + entity.img = base64; + entity.Picturename = fileName; + entity.fid = this.fid; + entity.qsType = 1; + entity.base64Date = base64.split(',')[1]; + + this.qsImage.push(entity); + }) + .catch(error => { + console.error(error) + }) + }, fail: (err) => { console.log("err: ", JSON.stringify(err)); @@ -142,16 +144,30 @@ }); }, previewImage(index) { + // console.log(this.qsImage.map(s=>s.img)[0]) + let imagesArry = []; + base64ToPath(this.qsImage.map(s=>s.img)[index]).then(path => { + uni.hideLoading(); + imagesArry[0] = path + console.log(path); + uni.previewImage({ + current: 0, + urls: imagesArry + }) + }) + + // uni.previewImage({ - // current: index, // 璁剧疆褰撳墠鏄剧ず鍥剧墖鐨勯摼鎺� + // current: '0', // 璁剧疆褰撳墠鏄剧ず鍥剧墖鐨勯摼鎺� // urls: this.qsImage.map(s=>s.img), // 闇�瑕侀瑙堢殑鍥剧墖閾炬帴鍒楄〃 // loop: false, // 鏄惁寮�鍚浘鐗囪疆鎾紝榛樿涓� false - // indicator: 'default',// 鍥剧墖鎸囩ず鍣ㄧ被鍨嬶紝鍙�夊�间负 "default"銆�"number"銆�"pointer"锛岄粯璁や负 "default" + // indicator: 'pointer',// 鍥剧墖鎸囩ず鍣ㄧ被鍨嬶紝鍙�夊�间负 "default"銆�"number"銆�"pointer"锛岄粯璁や负 "default" // }); }, init() { this.$post({ - url: "/Base/getByFid", + // url: "/Base/getLljAllImgByFid", + url: "/Base/getByFid", data: { fid: this.fid, qsType: 1 @@ -215,7 +231,7 @@ bottom: 0; width: 100%; background-color: #ffffff; /* 鑳屾櫙棰滆壊 */ - padding: 10px; + /* padding: 10px; */ box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1); /* 娣诲姞搴曢儴闃村奖鏁堟灉 */ z-index: 999; /* 纭繚鎸夐挳浣嶄簬椤跺眰 */ } @@ -224,4 +240,10 @@ max-height: calc(100vh - 240px); /* 灞忓箷楂樺害鍑忓幓涓婁紶鎸夐挳楂樺害 */ overflow-y: auto; /* 褰撳唴瀹硅秴鍑洪珮搴︽椂鍑虹幇鍨傜洿婊氬姩鏉� */ } +.upImg{ + + background-color: #3498db; + color: white; + +} </style> \ No newline at end of file -- Gitblit v1.9.3