Commit 39f0c8c4 by 前端

fixed

1 parent 48c56546
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
*/ */
const recorderManager = uni.getRecorderManager(); const recorderManager = uni.getRecorderManager();
const plug = uni.requireNativePlugin("html5app-recordaudio"); const plug = uni.requireNativePlugin("html5app-recordaudio");
const UPLOAD_STATUS = {
// 上传状态
success: 1,
fail: 2,
};
import upload from "@/utils/ossUploadFile/uploadFile.js"; import upload from "@/utils/ossUploadFile/uploadFile.js";
import { mapMutations, mapState } from "vuex"; import { mapMutations, mapState } from "vuex";
import utils from "@/utils/utils.js"; import utils from "@/utils/utils.js";
...@@ -81,6 +86,34 @@ export default { ...@@ -81,6 +86,34 @@ export default {
const file = uni.$storage.get("storageFile"); const file = uni.$storage.get("storageFile");
if (file) this.uploadVoice(file); if (file) this.uploadVoice(file);
}, },
getParams() {
const { shopMerchantId, phone, sceneType } = uni.$storage.get("userInfo"),
{ customerName, phoneNumber, salesUuid, carModel, staffName } =
this.$store.state.user.customerInfo,
receptionCustomerPaySourceList = this.booksList.map((item) => {
return {
id: item.id,
sourceType: item.id,
sourceUrl: item.imgUrl,
};
}),
params = {
carModel,
endReasonType: this.endReasonType, //原因 1.异常 0.正常
customerName,
phoneNumber,
loginPhone: phone,
salesName: staffName,
salesUuid,
receptionStatus: this.receptionStatus, //接待结果 1.成交 0.战败
receptionStartTime: this.receptionStartTime,
receptionEndTime: this.receptionEndTime,
receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId: shopMerchantId,
bussinessType: sceneType == 0 ? 1 : 2, // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
};
return params;
},
//保存录音记录及其他信息 //保存录音记录及其他信息
async uploadVoice(tempFilePath) { async uploadVoice(tempFilePath) {
try { try {
...@@ -166,14 +199,15 @@ export default { ...@@ -166,14 +199,15 @@ export default {
console.error("上传失败:", result); console.error("上传失败:", result);
const { customerName, phoneNumber, salesUuid, carModel, staffName } = const { customerName, phoneNumber, salesUuid, carModel, staffName } =
this.$store.state.user.customerInfo; this.$store.state.user.customerInfo;
const { name } = uni.$storage.get("userInfo");
this.$sendSentry( this.$sendSentry(
`上传文件失败:手机号-${phoneNumber} 姓名-${customerName} 销售-${staffName} 车型-${carModel} 销售-${salesUuid}` `上传文件失败:手机号-${phoneNumber} 姓名-${customerName} 销售-${staffName} 车型-${carModel} 员工-${name},失败原因-${result}`
); );
// this.handleErrorFile(res.tempFilePath, "error"); // this.handleErrorFile(res.tempFilePath, UPLOAD_STATUS.fail);
// return; // return;
} else { } else {
// this.handleErrorFile(result, "success"); // this.handleErrorFile(result, UPLOAD_STATUS.success);
} }
const storageFile = [...this.audioList, result]; const storageFile = [...this.audioList, result];
uni.$storage.set("storageFile", storageFile); uni.$storage.set("storageFile", storageFile);
...@@ -185,12 +219,13 @@ export default { ...@@ -185,12 +219,13 @@ export default {
}, },
/**保存记录*/ /**保存记录*/
saveRecord() { saveRecord() {
const fileList = JSON.parse(uni.$storage.get("errorFile") || "[]"); const recordUrlList = JSON.parse(uni.$storage.get("errorFile") || "[]");
let recordList = JSON.parse(uni.$storage.get("recordList") || "[]"); let recordList = JSON.parse(uni.$storage.get("recordList") || "[]");
recordList = [ recordList = [
...recordList, ...recordList,
{ {
fileList, ...this.getParams(),
recordUrlList,
}, },
]; ];
uni.$storage.set("recordList", JSON.stringify(recordList)); uni.$storage.set("recordList", JSON.stringify(recordList));
...@@ -198,7 +233,9 @@ export default { ...@@ -198,7 +233,9 @@ export default {
/**是否存在错误文件*/ /**是否存在错误文件*/
hasErrorFile() { hasErrorFile() {
const fileList = JSON.parse(uni.$storage.get("errorFile") || "[]"); const fileList = JSON.parse(uni.$storage.get("errorFile") || "[]");
const errorFileList = fileList.filter((item) => item.status == "error"); const errorFileList = fileList.filter(
(item) => item.status == UPLOAD_STATUS.fail
);
return errorFileList.length > 0; return errorFileList.length > 0;
}, },
/**处理失败的文件*/ /**处理失败的文件*/
...@@ -207,15 +244,40 @@ export default { ...@@ -207,15 +244,40 @@ export default {
const errorFile = [...errorFileList, { file, status }]; const errorFile = [...errorFileList, { file, status }];
uni.$storage.set("errorFile", JSON.stringify(errorFile)); uni.$storage.set("errorFile", JSON.stringify(errorFile));
}, },
handleRerord() {}, /**上传记录*/
async handleRerord(val) {
let recordList = JSON.parse(uni.$storage.get("recordList") || "[]");
let idx = recordList.findIndex(
(item) => item.receptionStartTime == val.receptionStartTime
);
let recordUrlList = val.recordUrlList;
// 上传失败的记录
for (let i of recordUrlList) {
if (i.status == UPLOAD_STATUS.fail) {
const result = await this.checkUploadFile(i.file);
if (!(result instanceof Error)) {
i.status = UPLOAD_STATUS.success;
}
}
}
// 判断是否全部上传成功
if (recordUrlList.every((i) => i.status == UPLOAD_STATUS.success)) {
recordList.splice(idx, 1);
val.recordUrlList = val.recordUrlList.map((i) => i.file);
this.uploadVoice(val);
uni.$storage.set("recordList", JSON.stringify(recordList));
}
},
async checkUploadFile(tempFilePath) { async checkUploadFile(tempFilePath) {
let attempt = 0; let attempt = 0;
let errorMsg = "";
while (attempt < 3) { while (attempt < 3) {
try { try {
const result = await upload(tempFilePath); const result = await upload(tempFilePath);
// 上传成功 // 上传成功
return result; return result;
} catch (error) { } catch (error) {
errorMsg = error;
attempt++; attempt++;
// 等待一段时间后重试 // 等待一段时间后重试
await new Promise((resolve) => setTimeout(resolve, 3000)); // 3秒后重试 await new Promise((resolve) => setTimeout(resolve, 3000)); // 3秒后重试
...@@ -224,7 +286,7 @@ export default { ...@@ -224,7 +286,7 @@ export default {
// 达到最大尝试次数后,如果上传仍然失败,可以进行相应的处理 // 达到最大尝试次数后,如果上传仍然失败,可以进行相应的处理
console.error("上传失败,达到最大尝试次数"); console.error("上传失败,达到最大尝试次数");
// 返回一个错误或者进行其他操作 // 返回一个错误或者进行其他操作
return new Error("上传失败"); return new Error(errorMsg);
}, },
//结束录音 //结束录音
stopAudio: utils.throttle(async function () { stopAudio: utils.throttle(async function () {
......
...@@ -150,7 +150,7 @@ export default { ...@@ -150,7 +150,7 @@ export default {
} }
.box { .box {
padding: 64rpx; padding: 64rpx;
margin-top: 120rpx; margin-top: 90rpx;
.input-box { .input-box {
position: relative; position: relative;
.input { .input {
...@@ -192,7 +192,7 @@ export default { ...@@ -192,7 +192,7 @@ export default {
} }
} }
.record-box { .record-box {
height: calc(100vh - 300rpx); height: calc(100vh - 250rpx);
padding-top: 48rpx; padding-top: 48rpx;
} }
.list { .list {
...@@ -200,7 +200,7 @@ export default { ...@@ -200,7 +200,7 @@ export default {
grid-template-columns: repeat(5, 1fr); grid-template-columns: repeat(5, 1fr);
gap: 48rpx 50rpx; gap: 48rpx 50rpx;
.item { .item {
height: 544rpx; height: 536rpx;
background: #ffffff; background: #ffffff;
border-radius: 48rpx; border-radius: 48rpx;
box-shadow: 0 8rpx 24rpx 0 #4673ff1a; box-shadow: 0 8rpx 24rpx 0 #4673ff1a;
...@@ -223,7 +223,7 @@ export default { ...@@ -223,7 +223,7 @@ export default {
} }
.item-desc { .item-desc {
height: 140rpx; height: 140rpx;
padding: 28rpx 32rpx; padding: 24rpx 28rpx;
font-size: 32rpx; font-size: 32rpx;
color: #333333; color: #333333;
border-radius: 48rpx; border-radius: 48rpx;
......
...@@ -134,6 +134,9 @@ import Record from "@/mixin/record"; ...@@ -134,6 +134,9 @@ import Record from "@/mixin/record";
export default { export default {
name: '', name: '',
mixins:[Record], mixins:[Record],
props: {
show: Boolean
},
data() { data() {
return { return {
imageUrl: require('@/assets/images/noviceGuide/step1-1.webp'), imageUrl: require('@/assets/images/noviceGuide/step1-1.webp'),
...@@ -153,13 +156,8 @@ export default { ...@@ -153,13 +156,8 @@ export default {
], ],
} }
}, },
computed: {
watchStatus () {
return this.$store.state.user.historyStatus
},
},
watch:{ watch:{
watchStatus: { show: {
handler() { handler() {
this.changeIndex(1,true) this.changeIndex(1,true)
}, },
...@@ -195,7 +193,6 @@ export default { ...@@ -195,7 +193,6 @@ export default {
this.getRecordList() this.getRecordList()
}, },
getRecordList() { getRecordList() {
const { pageNum, pageSize,groupIndex } = this, const { pageNum, pageSize,groupIndex } = this,
userInfo = uni.$storage.get("userInfo"), userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo; { shopMerchantId } = userInfo;
...@@ -260,7 +257,7 @@ export default { ...@@ -260,7 +257,7 @@ export default {
.box { .box {
padding: 64rpx; padding: 64rpx;
margin-top: 120rpx; margin-top: 90rpx;
.data-tabs-box { .data-tabs-box {
position: relative; position: relative;
...@@ -322,7 +319,7 @@ export default { ...@@ -322,7 +319,7 @@ export default {
} }
} }
.record-box { .record-box {
height: calc(100vh - 300rpx); height: calc(100vh - 250rpx);
padding-top: 48rpx; padding-top: 48rpx;
} }
.end-text { .end-text {
......
...@@ -90,7 +90,6 @@ import Record from "@/mixin/record"; ...@@ -90,7 +90,6 @@ import Record from "@/mixin/record";
export default { export default {
mixins: [Record], mixins: [Record],
props: { props: {
customerType: Number,
show: Boolean show: Boolean
}, },
data () { data () {
...@@ -109,13 +108,8 @@ export default { ...@@ -109,13 +108,8 @@ export default {
chooseItem: {} chooseItem: {}
} }
}, },
computed: {
watchStatus () {
return this.$store.state.user.historyStatus
},
},
watch:{ watch:{
watchStatus:{ show:{
handler() { handler() {
this.init() this.init()
}, },
...@@ -236,7 +230,7 @@ export default { ...@@ -236,7 +230,7 @@ export default {
} }
.box { .box {
padding: 64rpx; padding: 64rpx;
margin-top: 120rpx; margin-top: 90rpx;
.input-box { .input-box {
position: relative; position: relative;
.input { .input {
...@@ -277,7 +271,7 @@ export default { ...@@ -277,7 +271,7 @@ export default {
} }
} }
.record-box { .record-box {
height: calc(100vh - 300rpx); height: calc(100vh - 250rpx);
padding-top: 48rpx; padding-top: 48rpx;
} }
.end-text { .end-text {
......
...@@ -34,12 +34,19 @@ export default { ...@@ -34,12 +34,19 @@ export default {
this.title = tabName this.title = tabName
this.sourceType = sourceType this.sourceType = sourceType
this.detailUrl = detailUrl this.detailUrl = detailUrl
const img = new Image() const _this = this
img.onload = ()=> { uni.getImageInfo({
this.width = document.querySelector('.img-detail').offsetHeight*img.height/img.width src: detailUrl, // 替换为你的图片路径
console.log(this.width) success (img) {
uni.createSelectorQuery().select('.img-detail').boundingClientRect(function(rect) {
_this.width = rect.height*img.height/img.width
}).exec();
},
fail: function (error) {
console.error('获取图片信息失败:', error);
} }
img.src = detailUrl });
}, },
methods: { methods: {
back() { back() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!