} | } | ||||
function scanNfc() { | function scanNfc() { | ||||
tools.showLoadingAlert("扫描蓝牙中"); | |||||
tools.showLoadingAlert("扫描NFC中"); | |||||
//先断开所有设备 | //先断开所有设备 | ||||
NFCAPI.remove(() => { | NFCAPI.remove(() => { | ||||
//开始扫描设备 | //开始扫描设备 | ||||
} | } | ||||
</script> | </script> | ||||
<style lang='scss' scoped> | <style lang='scss' scoped> | ||||
image { | |||||
width: 40rpx; | |||||
height: 40rpx; | |||||
} | |||||
</style> | </style> |
import { | import { | ||||
msg, | msg, | ||||
checkStr, | checkStr, | ||||
strReplace | |||||
strReplace, | |||||
uploadFile | |||||
} from "@/utils/utils"; | } from "@/utils/utils"; | ||||
import { | import { | ||||
onLoad, | onLoad, | ||||
state.isTakePhotoModeShow = false | state.isTakePhotoModeShow = false | ||||
var imageType = state.choiceIndex; | var imageType = state.choiceIndex; | ||||
console.log("图片地址val", val.tempImagePath) | console.log("图片地址val", val.tempImagePath) | ||||
// uploadFile(val.tempImagePath,imageType,etcOcrCard).then((res)=>{ | |||||
// }) | |||||
uni.uploadFile({ | uni.uploadFile({ | ||||
url: 'https://qtzl.etcjz.cn/minIo/upload', //仅为示例,非真实的接口地址 | url: 'https://qtzl.etcjz.cn/minIo/upload', //仅为示例,非真实的接口地址 | ||||
filePath: val.tempImagePath, | filePath: val.tempImagePath, |
uni.chooseImage({ | uni.chooseImage({ | ||||
count: 1, //只能选取一张照片 | count: 1, //只能选取一张照片 | ||||
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有 | sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有 | ||||
sourceType: ["camera", "album"], //从相册选择 | |||||
sourceType: ["camera",], //从相册选择 | |||||
success: function (res) { | success: function (res) { | ||||
pathToBase64(res.tempFilePaths[0]) | pathToBase64(res.tempFilePaths[0]) | ||||
.then((path) => { | .then((path) => { | ||||
}, | }, | ||||
}); | }); | ||||
}; | }; | ||||
// const strReplace = (str : string) => { | |||||
// let imgUrl = str.replace("http://192.168.101.145:9000", envs[process.env.NODE_ENV].baseUrl); | |||||
// imgUrl = imgUrl.replace("http://100.64.2.113:9000", envs[process.env.NODE_ENV].baseUrl); | |||||
// return imgUrl; | |||||
// }; | |||||
const state = reactive({ | const state = reactive({ | ||||
phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面 | phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面 | ||||
} | } | ||||
state.isTakePhotoModeShow = false | state.isTakePhotoModeShow = false | ||||
}); | }); | ||||
// }) | |||||
// .catch((error) => { }); | |||||
}, | }, | ||||
}) | }) | ||||
} | } |
import { getItem, StorageKeys } from "./storage"; | import { getItem, StorageKeys } from "./storage"; | ||||
import { OrderStatus, OrderTypes } from "@/datas/enum.ts"; | import { OrderStatus, OrderTypes } from "@/datas/enum.ts"; | ||||
import { envs } from "@/utils/network/api.js"; | import { envs } from "@/utils/network/api.js"; | ||||
import { | |||||
stringToJson | |||||
} from "@/utils/network/encryption"; | |||||
import { | |||||
request | |||||
} from "@/utils/network/request.js"; | |||||
//toast | //toast | ||||
export const msg = (title : string = "", param : any = {}) => { | export const msg = (title : string = "", param : any = {}) => { | ||||
if (!title) return; | if (!title) return; | ||||
function formatNumber(n : any) { | function formatNumber(n : any) { | ||||
n = n.toString() | n = n.toString() | ||||
return n[1] ? n : `0${n}` | return n[1] ? n : `0${n}` | ||||
} | |||||
export function uploadFile(tempImagePath, imageType, code) { | |||||
uni.uploadFile({ | |||||
url: 'https://qtzl.etcjz.cn/minIo/upload', //仅为示例,非真实的接口地址 | |||||
filePath: tempImagePath, | |||||
name: 'file', | |||||
formData: { | |||||
'user': 'test', | |||||
"bucket": 'default-bucket' | |||||
}, | |||||
success: (uploadFileRes) => { | |||||
let uploadFileImage = 'http://100.64.2.113:9000' + '/default-bucket/' + JSON.parse(uploadFileRes.data).data.ossFilePath | |||||
console.log("111", JSON.parse(uploadFileRes.data).data.ossFilePath); | |||||
var data = { | |||||
source: "1", | |||||
agencyId: "52010106004", | |||||
imageType: imageType, | |||||
fileName: tempImagePath, | |||||
url: uploadFileImage | |||||
}; | |||||
const options = { | |||||
type: 2, | |||||
data: data, | |||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
console.log('输出内容=====123') | |||||
request(code, options).then((res) => { | |||||
const data = stringToJson(res.bizContent); | |||||
return data | |||||
}); | |||||
} | |||||
}); | |||||
} | } |