Commit 0819347e by zhangzhen

功能优化

parent 59067845
......@@ -127,7 +127,7 @@
if(res.data.result && res.data.result.length){
this.swiperList = res.data.result.map(item =>{
return {
img:this.assetsPath+"/hggp/file/download/docId/"+item.DOC_ID
img:this.assetsPath+"/hggp/file/download/"+item.DOC_ID
}
})
......@@ -149,7 +149,7 @@
let list = resData.map(item=>{
return {
...item,
appIconUrl: item.docIdApp ? this.assetsPath+"/hggp/file/download/docId/"+item.docIdApp: ''
appIconUrl: item.docIdApp ? this.assetsPath+"/hggp/file/download/"+item.docIdApp: ''
}
})
this.companyInfo = list[0]
......@@ -171,7 +171,7 @@
this.list = res.data.menu.map(item=>{
return {
...item,
imagePath: item.imagePath? this.assetsPath+"/hggp/file/download/docId/"+item.imagePath:false
imagePath: item.imagePath? this.assetsPath+"/hggp/file/download/"+item.imagePath:false
}
});
}else{
......
......@@ -155,8 +155,8 @@
<text class="text-black text-title text-lg">图片上传:</text>
</view>
<view class="">
<u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="6"></u-upload>
<u-upload :fileList="fileList" @oversize="afterRead" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="6" :maxSize="1024*1024*5"></u-upload>
</view>
</view>
......@@ -233,7 +233,7 @@
this.orderInfo = {
...rows[0],
quantity: rows[0].unregisterQuantity,
weight: Number(rows[0].unregisterQuantity)*Number(rows[0].singleWeight)
weight: (Number(rows[0].unregisterQuantity)*Number(rows[0].singleWeight)).toFixed(2)
};
}
}
......@@ -243,10 +243,30 @@
deletePic(event) {
this.fileList.splice(event.index, 1)
},
onOversize(fileData){
let indexS = [];
let upLoad = []
fileData.file.forEach((item,k) => {
if(item.size> 1024*1024*5){
indexS.push(k+1)
}else{
upLoad.push(item)
}
})
if(indexS.length){
uni.showToast({
icon:"none",
title: `图片第${indexS.join('、')}张,大小超出5MB限制`,
duration:3000
})
}
return upLoad
},
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file);
console.log(event,"文件资源")
let lists = this.onOversize(event);
console.log(lists,9999)
let fileListLen = this.fileList.length;
lists.map((item) => {
this.fileList.push({
......@@ -260,12 +280,13 @@
url: lists[i].url
})
console.log(result,99999)
let res = JSON.parse(result.data)
let item = this.fileList[fileListLen]
this.fileList.splice(fileListLen, 1, Object.assign(item, {
status: 'success',
status: res.status == 500?'failed':'success',
message: '',
url: lists[i].url,
id: JSON.parse(result.data).id
id: res.id
}))
fileListLen++
}
......
......@@ -84,12 +84,12 @@
<text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.registeredQuantity}}</text>
</view>
<view class="flex-row">
<view v-if="Number(orderInfo.unregisterQuantity)" class="flex-row">
<text class="text-gray part-1">待报工数量</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.unregisterQuantity}}</text>
</view>
<view class="flex-row">
<view v-if="Number(orderInfo.unregisterWeight)" class="flex-row">
<text class="text-gray part-1">待报工重量</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{Number(orderInfo.unregisterWeight)}}</text>
......@@ -163,6 +163,7 @@
<script>
import config from "@/config/index.config";
import {checkIsImg} from "@/utils/tools.js";
import {
pathToBase64,
base64ToPath
......@@ -278,12 +279,12 @@
matId: item.id,
bizType: "SCBG"
})
let imgList = toJsonData(imgDatas.data.__blocks__.result.rows, imgDatas.data.__blocks__.result.meta.columns)
let imgList = toJsonData(imgDatas.data.__blocks__.result.rows, imgDatas.data.__blocks__.result.meta.columns).filter(item=>checkIsImg(item.docName))
list.push({
...item,
imgList : imgList.length? imgList.map(val=>{
return {
url: this.assetsPath+"/hggp/file/download/docId/"+val.docId
url: this.assetsPath+"/hggp/file/download/"+val.docId
}
}):[]
})
......
......@@ -182,3 +182,9 @@ export function formatForLen14 (dateStr) {
}
return dateStr
}
export function checkIsImg(fileName){
const extension = fileName.split(".").pop().toLowerCase();
const imgExtensions = ["jpg","png","jpeg","gif","bmp","webp","svg"]
return imgExtensions.includes(extension)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment