Commit 15ead3de by 前端

s上传

1 parent 04832f27
...@@ -11,19 +11,29 @@ module.exports = { ...@@ -11,19 +11,29 @@ module.exports = {
// 查询接待素材 // 查询接待素材
findSoureList() { findSoureList() {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.recepiton.soure.findSoureList', method: "dj.api.smartcarlife.recepiton.soure.findSoureList",
sessionId: "b5e0a471-a2cd-4020-a522-72bcd68d6da7", sessionId: "b5e0a471-a2cd-4020-a522-72bcd68d6da7",
projectName: "boutique", projectName: "boutique",
}) });
}, },
// 查询门店支付配置 // 查询门店支付配置
findPayInfo(data) { findPayInfo(data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.recepiton.pay.findPayInfoConfigListByMerchantId', method:
"dj.api.smartcarlife.recepiton.pay.findPayInfoConfigListByMerchantId",
sessionId: "b5e0a471-a2cd-4020-a522-72bcd68d6da7",
projectName: "boutique",
...data,
});
},
// 查询门店支付配置
saveRecCustomer(data) {
return http.post({
method: "dj.api.smartcarlife.recepiton.customer.saveRecCustomer",
sessionId: "b5e0a471-a2cd-4020-a522-72bcd68d6da7", sessionId: "b5e0a471-a2cd-4020-a522-72bcd68d6da7",
projectName: "boutique", projectName: "boutique",
...data ...data,
}) });
}, },
getToken(data) { getToken(data) {
return http.post({ return http.post({
......
...@@ -2,12 +2,16 @@ ...@@ -2,12 +2,16 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48 * @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-08 16:38:43 * @LastEditTime: 2024-04-08 17:19:52
* @FilePath: \gl_tape\mixin\click.js * @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
const recorderManager = uni.getRecorderManager(); const recorderManager = uni.getRecorderManager();
let recording = false,
receptionStartTime,
receptionEndTime; //是否录音中
import upload from "@/utils/ossUploadFile/uploadFile.js"; import upload from "@/utils/ossUploadFile/uploadFile.js";
import utils from "@/utils/utils";
export default { export default {
data() { data() {
return { return {
...@@ -29,22 +33,38 @@ export default { ...@@ -29,22 +33,38 @@ export default {
this.initTime(); this.initTime();
this.checkVoice(); this.checkVoice();
recorderManager.onStop((res) => { recorderManager.onStop((res) => {
recording = false;
receptionEndTime = utils.convertDateTimeFormat(new Date());
uni.$storage.set("storageFile", res.tempFilePath); uni.$storage.set("storageFile", res.tempFilePath);
this.uploadVoice(res.tempFilePath); this.uploadVoice(res.tempFilePath);
}); });
recorderManager.onStart(() => {
recording = true;
receptionStartTime = utils.convertDateTimeFormat(new Date());
});
}, },
methods: { methods: {
checkVoice() { checkVoice() {
const file = uni.$storage.get("storageFile"); const file = uni.$storage.get("storageFile");
if (file) this.uploadVoice(file); if (file) this.uploadVoice(file);
}, },
uploadVoice(tempFilePath) { async uploadVoice(tempFilePath) {
upload(tempFilePath).then((res) => { const result = await upload(tempFilePath);
uni.$storage.set("storageFile", ""); uni.$api
.commonApi({
carPurchaseInvoice: result,
receptionStartTime,
receptionEndTime,
merchantId: uni.$storage.get("merchantId"),
})
.then((res) => {
console.log(res);
}); });
uni.$storage.set("storageFile", "");
}, },
//开始录音 //开始录音
start() { startAudio() {
if (recording) true;
recorderManager.start(); recorderManager.start();
}, },
//结束录音 //结束录音
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 17:16:46
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-08 17:18:40
* @FilePath: \gl_tape\utils\utils.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
function convertDateTimeFormat(dateTimeStr, separator = "-") {
const date = new Date(dateTimeStr);
const year = date.getFullYear();
const month = ("0" + (date.getMonth() + 1)).slice(-2); // 月份是从0开始的
const day = ("0" + date.getDate()).slice(-2);
const hours = ("0" + date.getHours()).slice(-2);
const minutes = ("0" + date.getMinutes()).slice(-2);
const seconds = ("0" + date.getSeconds()).slice(-2);
return `${month}${separator}${day}${separator}${year} ${hours}:${minutes}:${seconds}`;
}
export default {
convertDateTimeFormat,
};
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!