This commit is contained in:
parent
f7a6e516c0
commit
16f8ae697a
|
|
@ -128,19 +128,103 @@ const preview = () => {
|
|||
// 拍照/上传
|
||||
const handlePhoto = () => {
|
||||
console.log('拍照/上传')
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
// uni.chooseImage({
|
||||
// count: 1,
|
||||
// sizeType: ['compressed'],
|
||||
// sourceType: ['album', 'camera'],
|
||||
// success: (res) => {
|
||||
// console.log('🚀 ~ handlePhoto ~ res.tempFilePaths[0]:', res)
|
||||
// // imgPath.value = res.tempFilePaths[0]
|
||||
// // isRotate.value = false
|
||||
// signType.value = 1
|
||||
// uploadImg(res.tempFilePaths[0])
|
||||
// },
|
||||
// })
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
success: (res) => {
|
||||
console.log('🚀 ~ handlePhoto ~ res.tempFilePaths[0]:', res)
|
||||
// imgPath.value = res.tempFilePaths[0]
|
||||
// isRotate.value = false
|
||||
signType.value = 1
|
||||
uploadImg(res.tempFilePaths[0])
|
||||
if (res.tapIndex === 0) {
|
||||
getCamera()
|
||||
} else if (res.tapIndex === 1) {
|
||||
// 从相册选择
|
||||
getPhoto()
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('操作菜单选择失败:', err)
|
||||
},
|
||||
})
|
||||
}
|
||||
// 拍照
|
||||
function getCamera() {
|
||||
navigator.camera.getPicture(onCameraSuccess, onCameraError, {
|
||||
quality: 50,
|
||||
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||
sourceType: window.Camera.PictureSourceType.CAMERA,
|
||||
})
|
||||
}
|
||||
// 从相册选择
|
||||
function getPhoto() {
|
||||
navigator.camera.getPicture(onCameraSuccess, onCameraError, {
|
||||
quality: 50,
|
||||
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||
sourceType: window.Camera.PictureSourceType.SAVEDPHOTOALBUM,
|
||||
})
|
||||
}
|
||||
|
||||
function onCameraError(message) {
|
||||
console.log('🚀 ~ onCameraError ~ message:', message)
|
||||
}
|
||||
async function onCameraSuccess(file) {
|
||||
// const file1 = "data:image/jpeg;base64," + file;
|
||||
const file1 = file
|
||||
let params = {
|
||||
image: file1,
|
||||
jiju_type: '',
|
||||
auth_lic:
|
||||
'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
||||
}
|
||||
console.log('🚀 ~ onCameraSuccess ~ params:', params)
|
||||
|
||||
try {
|
||||
const signUrl = params
|
||||
if (opts.isLease) {
|
||||
const params = {
|
||||
id: opts.id,
|
||||
leaseSignUrl: signUrl,
|
||||
leaseSignType: signType.value,
|
||||
}
|
||||
console.log('🚀 ~ success: ~ params:', params)
|
||||
const res = await updateLeaseApplyInfoSign(params)
|
||||
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
|
||||
uni.navigateBack()
|
||||
} else if (opts.isBack) {
|
||||
const params = {
|
||||
id: opts.id,
|
||||
backSignUrl: signUrl,
|
||||
backSignType: signType.value,
|
||||
}
|
||||
console.log('🚀 ~ success: ~ params:', params)
|
||||
const res = await updateSignById(params)
|
||||
console.log('🚀 ~ uploadImg-退料 ~ res:', res)
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
const params = {
|
||||
signUrl: signUrl,
|
||||
signType: signType.value,
|
||||
}
|
||||
const res = await updateSign(params)
|
||||
console.log('🚀 ~ uploadImg-个人中心 ~ res:', res)
|
||||
getSignData()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ uploadImg ~ error:', error)
|
||||
uni.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
}
|
||||
// 上传
|
||||
const uploadImg2 = async (base64Data) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -491,10 +491,10 @@ const scanStart = () => {
|
|||
|
||||
// 处理扫描成功事件
|
||||
const handleScanSuccess = (result) => {
|
||||
qrCodeScan.value = result?.text?.split('?qrcode=')[1] || result?.text
|
||||
if (qrCodeScan.value === '') {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
} else {
|
||||
qrCodeScan.value = result?.text?.split('?qrcode=')[1] || result?.text
|
||||
getMaInfoScan()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue