This commit is contained in:
parent
f7a6e516c0
commit
16f8ae697a
|
|
@ -128,19 +128,103 @@ const preview = () => {
|
||||||
// 拍照/上传
|
// 拍照/上传
|
||||||
const handlePhoto = () => {
|
const handlePhoto = () => {
|
||||||
console.log('拍照/上传')
|
console.log('拍照/上传')
|
||||||
uni.chooseImage({
|
// uni.chooseImage({
|
||||||
count: 1,
|
// count: 1,
|
||||||
sizeType: ['compressed'],
|
// sizeType: ['compressed'],
|
||||||
sourceType: ['album', 'camera'],
|
// 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) => {
|
success: (res) => {
|
||||||
console.log('🚀 ~ handlePhoto ~ res.tempFilePaths[0]:', res)
|
if (res.tapIndex === 0) {
|
||||||
// imgPath.value = res.tempFilePaths[0]
|
getCamera()
|
||||||
// isRotate.value = false
|
} else if (res.tapIndex === 1) {
|
||||||
signType.value = 1
|
// 从相册选择
|
||||||
uploadImg(res.tempFilePaths[0])
|
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) => {
|
const uploadImg2 = async (base64Data) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -491,10 +491,10 @@ const scanStart = () => {
|
||||||
|
|
||||||
// 处理扫描成功事件
|
// 处理扫描成功事件
|
||||||
const handleScanSuccess = (result) => {
|
const handleScanSuccess = (result) => {
|
||||||
|
qrCodeScan.value = result?.text?.split('?qrcode=')[1] || result?.text
|
||||||
if (qrCodeScan.value === '') {
|
if (qrCodeScan.value === '') {
|
||||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||||
} else {
|
} else {
|
||||||
qrCodeScan.value = result?.text?.split('?qrcode=')[1] || result?.text
|
|
||||||
getMaInfoScan()
|
getMaInfoScan()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue