测试问题代码提交

master
zhangdi 11 months ago
parent 74379dad29
commit 2159041f3a
  1. 7
      package.json
  2. 96
      src/views/components/requestSub.vue
  3. 32
      src/views/goodsManagement/reciviceList.vue
  4. 4
      vue.config.js

@ -23,12 +23,10 @@
"element-ui": "^2.15.6",
"file-saver": "^2.0.5",
"html2canvas": "^1.4.1",
"html2canvas": "^1.4.1",
"js-base64": "^2.5.1",
"js-cookie": "^2.2.0",
"js-md5": "^0.7.3",
"jspdf": "^2.5.2",
"jspdf": "^2.5.2",
"jszip": "^3.10.1",
"mockjs": "^1.0.1-beta3",
"moment": "^2.30.1",
@ -45,12 +43,11 @@
"vue-i18n": "^8.7.0",
"vue-print-nb": "^1.7.5",
"vue-printjs": "^1.0.0",
"vue-printjs": "^1.0.0",
"vue-router": "^3.0.1",
"vue-seamless-scroll": "^1.1.23",
"vuex": "^3.1.1",
"xlsx": "^0.18.5",
"vxe-table": "^4.6.25"
"vxe-table": "^4.6.25",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.1.1",

@ -653,48 +653,46 @@ export default {
},
beforeAvatarUpload(index){
return (file) =>{
console.log('file------>',file)
if(this.addForm[index].form.videoAttaches && this.addForm[index].form.picAttaches && this.addForm[index].form.videoAttaches.length + this.addForm[index].form.picAttaches.length < 3){
const isLt3M = file.size
if(isLt3M > 1024 * 1024 * 5){
// if(isLt3M > 1024 * 1024 * 2){
// const r = confirm(
// // `5Mb,()`
// `5Mb,`
// )
// console.log('r=========>',r)
// if(r){
// // const _this = this
// // return new Promise((resolve, reject) => {
// // const image = new Image()
// // let resultBlob = ''
// // image.src = URL.createObjectURL(file)
// // image.onload = () => {
// // // blob
// // resultBlob = _this.compressUpload(image, file)
// // const fs = new File([resultBlob], file.name, {
// // type: file.type,
// // width:200,
// // height:200
// // })
// // console.log('fs============>',fs)
// // if (fs.size > 1024 * 1024 * 3) {
// // // this.commonZipPic(fs)
// // this.$message.warning('3Mb')
// // reject()
// // }
// // resolve(fs)
// // }
// // image.onerror = () => {
// // reject()
// // }
// // })
const _this = this
return new Promise((resolve, reject) => {
const image = new Image()
let resultBlob = ''
image.src = URL.createObjectURL(file)
image.onload = () => {
// blob
resultBlob = _this.compressUpload(image, file)
const fs = new File([resultBlob], file.name, {
type: file.type,
width:200,
height:200
})
if (fs.size > 1024 * 1024 * 3) {
// this.commonZipPic(fs)
this.$message.warning('压缩后图片仍大于3Mb,请您手动压缩')
reject()
}
resolve(fs)
}
image.onerror = () => {
reject()
}
})
// }else{
this.$message.warning('您上传的图片大小超过5Mb,请手动压缩后在上传')
return false
// this.$message.warning('5Mb,')
// return false
// }
}else{
return true
}
// }else{
// return true
// }
}else{
this.$message.error('故障视频与故障图片最多可上传3个')
return false
@ -706,17 +704,28 @@ export default {
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
// const initSize = image.src.length
const { width } = image
const { height } = image
canvas.width = width
canvas.height = height
const width = image.width * 0.1 // *
const height = image.height * 0.1 // *
canvas.width = width //
canvas.height = height //
// const { width } = image
// const { height } = image
// canvas.width = width
// canvas.height = height
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.drawImage(image, 0, 0, width / 10, height / 10)
// 0.1
const compressData = canvas.toDataURL(file.type || 'image/jpeg', 0.1)
// ctx.drawImage(image, 0, 0, width / 10, height / 10)
ctx.drawImage(image, 0, 0, width, height)
const dataUrl = canvas.toDataURL(file.type) //
const blobData = this.dataURItoBlob(dataUrl, file.type) //
// // 0.1
// const compressData = canvas.toDataURL(file.type || 'image/jpeg', 0.1)
// base64Blob
const blobImg = this.dataURItoBlob(compressData)
return blobImg
// const blobImg = this.dataURItoBlob(blobData)
return blobData
},
/* base64转Blob对象 */
dataURItoBlob(data) {
@ -735,7 +744,6 @@ export default {
},
//
uploadCompressVideo(file) {
console.log('file===================>',file)
if (file) {
let filename = file.name;
let filetype = file.type;
@ -758,7 +766,7 @@ export default {
this.fileList.push({ name: item.name, link: item.response ? item.response.data.link : item.url })
this.imgList.push({ name: item.name, url: item.response ? item.response.data.link : item.url })
})
this.addForm[index].form.picAttaches = fileList
this.addForm[index].form.picAttaches = this.fileList
}
},
changeDescribe(event, index) {

@ -262,22 +262,22 @@ export default {
searchValue: dateFormat(new Date(), "yyyy-MM-dd"),
searchClearable: false,
},
{
label: "仓库编号",
labelWidth: 120,
prop: "applyUser",
search: true,
hide: true,
viewDisplay: false,
},
{
label: "物料名称",
labelWidth: 120,
prop: "applyUser",
search: true,
hide: true,
viewDisplay: false,
},
// {
// label: "",
// labelWidth: 120,
// prop: "applyUser",
// search: true,
// hide: true,
// viewDisplay: false,
// },
// {
// label: "",
// labelWidth: 120,
// prop: "applyUser",
// search: true,
// hide: true,
// viewDisplay: false,
// },
{
label: "是否需要归还",
labelWidth: 150,

@ -28,8 +28,8 @@ module.exports = {
//本地服务接口地址
// target: 'http://localhost',
// target:'http://192.168.0.111:80',
target:'http://192.168.1.12:10001',
// target:'http://192.168.1.4:10001',
// target:'http://192.168.1.12:10001',
target:'http://192.168.1.4:10001',
// target:'http://192.168.0.116:80',
// target:'http://192.168.0.108:80',
//远程演示服务地址,可用于直接启动项目

Loading…
Cancel
Save