bug修复

This commit is contained in:
BianLzhaoMin 2025-06-23 17:13:54 +08:00
parent 76e162abd4
commit 6d91392695
3 changed files with 86 additions and 45 deletions

View File

@ -7,8 +7,10 @@ module.exports = {
// baseUrl: 'http://192.168.0.58:19090', // 杰
// baseUrl: 'http://192.168.0.176:18080', // 强
// baseUrl: 'http://192.168.0.38:18080', // 强
fileUrl: 'http://192.168.0.14:21626/file/statics/', // 测试环境
fileUrl2: 'http://192.168.0.14:21626/file/statics', // 测试环境
// fileUrl: 'http://192.168.0.14:21626/file/statics/', // 测试环境
fileUrl: 'http://192.168.0.14:1999/file/statics/', // 测试环境
// fileUrl2: 'http://192.168.0.14:21626/file/statics', // 测试环境
fileUrl2: 'http://192.168.0.14:1999/file/statics', // 测试环境
// 课件: 文件视频路径
coursewareUrl: 'http://192.168.0.14:9090/nxdt-courseware',
// fileUrl: 'http://218.21.27.6:1999/file/statics/', // 产线环境

View File

@ -31,9 +31,9 @@
:disabled="opt.pageType === 'view'"
/>
</u-form-item>
<u-form-item label="照片" prop="photoList" required>
<u-form-item label="照片" prop="photoType" required>
<uni-file-picker
v-model="formData.photoList"
v-model="photoType"
:auto-upload="false"
ref="files"
limit="9"
@ -95,16 +95,18 @@ export default {
formData: {
proName: '', //
proId: '', // id
description: '', // -
photoList: [], //
photoType: [] // -
description: '' // -
// photoList: [] //
// photoType: [] // -
},
// -
proOptions: [],
rules: {
proName: { required: true, message: '请输入检查标题', trigger: ['blur'] },
description: [{ required: true, message: '请输入问题描述', trigger: ['blur', 'change'] }]
}
// photoType: [{ required: true, message: '', trigger: ['blur', 'change'] }]
},
photoType: []
}
},
onLoad(opt) {
@ -114,11 +116,14 @@ export default {
this.getProOptions()
if (this.opt.pageType === 'edit' || this.opt.pageType === 'view') {
this.formData = this.opt
this.formData.photoList.forEach(item => {
item.filePath = item.url = config.fileUrl + item.filePath
// this.formData.photoType = []
this.photoType = JSON.parse(opt.params).photoList
console.log(item.filePath, '************', item.url)
})
if (this.photoType.length > 0) {
this.photoType.forEach(item => {
item.url = config.fileUrl + item.filePath
})
}
}
},
methods: {
@ -143,9 +148,11 @@ export default {
},
selectImg(e) {
console.log('🚀 ~ selectImg ~ e:', e)
e.tempFiles.forEach(item => {
this.formData.photoList.push(item)
})
// e.tempFiles.forEach(item => {
// this.formData.photoList.push(item)
// })
this.upload(e.tempFiles[0].path)
},
upload(path) {
console.log('🚀 ~ upload ~ path:', path)
@ -160,21 +167,48 @@ export default {
tokenType: 'APP'
},
success: res => {
console.log('🚀 ~ upload ~ res:', res)
console.log(decryptCBC(JSON.parse(res.data).data))
this.formData.photoType.push(JSON.parse(res.data).data[0])
console.log('🚀 ~ upload ~ this.formData.photoType:', this.formData.photoType)
// console.log('-----', res)
// console.log(decryptCBC(JSON.parse(res.data).data))
const data = JSON.parse(res.data).data[0]
console.log('data-----', data)
// this.formData.photoType.push(JSON.parse(res.data).data[0])
// console.log(this.formData.photoType, ' this.formData.photoType')
this.photoType.push({
...data,
url: config.fileUrl + data.filePath
})
this.formData.photoList.push({
...data,
url: config.fileUrl + data.filePath
})
// console.log('🚀 ~ upload ~ this.formData.photoType:', this.formData.photoType)
},
fail: err => {
console.log('🚀 ~ upload ~ err:', err)
uni.showToast({
title: '上传失败',
icon: 'none',
duration: 500
})
}
})
},
deleteImg(e) {
this.formData.photoList.splice(e.index, 1)
console.log(e, '删除----')
// this.formData.photoType.splice(e.index, 1)
// this.formData.photoType = this.formData.photoType.filter(item => item.uuid !== e.uuid)
this.photoType = this.photoType.filter(item => item.filePath !== e.tempFile.filePath)
this.formData.photoList = this.formData.photoList.filter(item => item.filePath !== e.tempFile.filePath)
// console.log(this.formData.photoType, '----')
},
async submitForm() {
if (!this.formData.photoList.length) {
if (!this.photoType.length) {
uni.showToast({
title: '请添加照片',
icon: 'none',
@ -186,29 +220,30 @@ export default {
this.$refs.uForm
.validate()
.then(async valid => {
this.formData.photoType = []
// this.formData.photoType = []
this.submit()
//
const uploadPromises = this.formData.photoList.map(item => {
console.log('🚀 ~ submitForm ~ item:', item)
if (item.uuid) {
return this.upload(item.path)
}
return Promise.resolve()
})
// const uploadPromises = this.formData.photoList.map(item => {
// console.log('🚀 ~ submitForm ~ item:', item)
// if (item.uuid) {
// return this.upload(item.path)
// }
// return Promise.resolve()
// })
Promise.all(uploadPromises)
.then(() => {
//
setTimeout(() => {
this.submit()
}, 800)
})
.catch(error => {
//
console.error('上传失败', error)
this.isLoading = false
this.formData.photoType = []
})
// Promise.all(uploadPromises)
// .then(() => {
// //
// setTimeout(() => {
// this.submit()
// }, 800)
// })
// .catch(error => {
// //
// console.error('', error)
// this.isLoading = false
// this.formData.photoType = []
// })
})
.catch(() => {
this.isLoading = false
@ -221,7 +256,11 @@ export default {
if (this.opt.pageType === 'edit') {
this.formData.id = this.opt.id
}
const res = await addSnapshotForm(this.formData)
const params = JSON.parse(JSON.stringify(this.formData))
params.photoType = params.photoList
console.log('提交参数---', params)
const res = await addSnapshotForm(params)
console.log('🚀 ~ submit ~ res:', res)
this.isLoading = false
uni.showToast({

View File

@ -6,12 +6,12 @@ const cbc_iv = CryptoJS.enc.Utf8.parse('1234567812345678')
* 默认参数需要加密
* @type {boolean}
*/
const jia_mi = false
const jia_mi = true
/**
* 默认后台会自动加密
* @type {boolean}
*/
const jie_mi = false
const jie_mi = true
/**
* 加密
* @param word