Commit c029fddc by 前端

oss优化

1 parent a489104f
......@@ -9,8 +9,6 @@
<script>
import checkUpdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js";
import { mapState } from "vuex";
import * as sentry from "@/utils/sentryConfig/sentry-miniapp";
import { index } from "./env";
export default {
computed: {
...mapState("audio", ["isEnd", "isStart"]),
......@@ -45,9 +43,7 @@ export default {
},
onHide: function () {},
onError: function (e) {
if (index == 3) {
sentry.captureException(e);
}
this.$sendSentry(e);
},
};
</script>
......
......@@ -26,6 +26,7 @@ Vue.config.productionTip = false;
App.mpType = "app";
Vue.prototype.$ossDomain = config.OSS_DOMAIN;
import permision from "@/js_sdk/wa-permission/permission.js";
import { index } from "./env";
// switch (uni.getSystemInfoSync().platform) {
// case "android":
// permision.requestAndroidPermission("android.permission.RECORD_AUDIO");
......@@ -38,11 +39,15 @@ import permision from "@/js_sdk/wa-permission/permission.js";
// }
Vue.prototype.$permision = permision;
import sentryInit from "@/utils/sentryConfig/sentryInit";
sentryInit();
const sentry = sentryInit();
Vue.prototype.$sendSentry = function (e) {
if (index == 3) {
sentry.captureException(e);
}
};
const app = new Vue({
store,
...App,
});
app.$mount();
\ No newline at end of file
app.$mount();
......@@ -12,7 +12,7 @@ import upload from "@/utils/ossUploadFile/uploadFile.js";
import { mapMutations, mapState } from "vuex";
import utils from "@/utils/utils.js";
export default {
data () {
data() {
return {
voicePath: "",
timer: null,
......@@ -21,7 +21,7 @@ export default {
reaction: 1,
};
},
mounted () {
mounted() {
this.initTime();
// this.checkVoice();
},
......@@ -38,17 +38,17 @@ export default {
]),
...mapState(["user.customerInfo"]),
},
created () {
created() {
console.log("created");
},
onHide () {
onHide() {
console.log("隐藏");
// recorderManager.stop();
// recorderManager.start({
// duration: 10000,
// });
},
onShow () {
onShow() {
// console.log(utils.requestAndroidPermission());
},
methods: {
......@@ -61,30 +61,31 @@ export default {
"setBooks",
]),
//关闭提示
tipCancel () {
tipCancel() {
this.stopAudio();
this.setReceptionStatus(0);
this.setReasonType(1);
this.$refs.tipBox.close();
let { sceneType } = uni.$storage.get("userInfo");
uni.reLaunch({
url: sceneType == 0 ? "/pages/home/home" : "/pages/boutique/index" ,
url: sceneType == 0 ? "/pages/home/home" : "/pages/boutique/index",
});
},
//结束提示
tipConfirm () {
tipConfirm() {
this.times = 0;
this.$refs.tipBox.close();
},
//检查缓存录音
checkVoice () {
checkVoice() {
const file = uni.$storage.get("storageFile");
if (file) this.uploadVoice(file);
},
//保存录音记录及其他信息
async uploadVoice (tempFilePath) {
async uploadVoice(tempFilePath) {
try {
const { shopMerchantId, phone,sceneType } = uni.$storage.get("userInfo"),
const { shopMerchantId, phone, sceneType } =
uni.$storage.get("userInfo"),
{ customerName, phoneNumber, salesUuid, carModel, staffName } =
this.$store.state.user.customerInfo,
receptionCustomerPaySourceList = this.booksList.map((item) => {
......@@ -108,7 +109,7 @@ export default {
receptionEndTime: this.receptionEndTime,
receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId: shopMerchantId,
bussinessType: sceneType == 0 ? 1 : 2 // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
bussinessType: sceneType == 0 ? 1 : 2, // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
};
console.log(
customerName,
......@@ -132,7 +133,7 @@ export default {
}
},
//开始录音
async startAudio () {
async startAudio() {
if (this.isStart) return;
this.setAudioStart(true);
this.setAudioList([]);
......@@ -152,7 +153,11 @@ export default {
numberOfChannels: 1,
});
}
const result = await upload(res.tempFilePath);
const result = await this.checkUploadFile(res.tempFilePath);
if (result instanceof Error) {
console.error("上传失败:", result);
return;
}
const storageFile = [...this.audioList, result];
uni.$storage.set("storageFile", storageFile);
this.setAudioList(storageFile);
......@@ -162,6 +167,26 @@ export default {
return true;
});
},
async checkUploadFile(tempFilePath) {
let attempt = 0;
while (attempt < 3) {
try {
const result = await upload(tempFilePath);
// 上传成功
return result;
} catch (error) {
// 上传失败
console.error("上传失败,尝试重试:", error);
attempt++;
// 等待一段时间后重试
await new Promise((resolve) => setTimeout(resolve, 3000)); // 3秒后重试
}
}
// 达到最大尝试次数后,如果上传仍然失败,可以进行相应的处理
console.error("上传失败,达到最大尝试次数");
// 返回一个错误或者进行其他操作
return new Error("上传失败");
},
//结束录音
stopAudio: utils.throttle(async function () {
const result = await this.$permision.requestAndroidPermission(
......@@ -182,7 +207,7 @@ export default {
recorderManager.stop();
}, 1500),
//监听点击事件
initTime () {
initTime() {
if (!this.isStart) return;
this.timer = setInterval(() => {
this.times++;
......@@ -196,11 +221,11 @@ export default {
}
}, 1000 * 10);
},
handleTouchStart () {
handleTouchStart() {
this.times = 0;
},
},
beforeCreate () {
beforeCreate() {
clearInterval(this.timer);
this.timer = null;
},
......
......@@ -36,6 +36,7 @@
class="image-box"
src="../../assets/images/boutique/photos.png"
/>
<div class="gradient-overlay"></div>
<view class="name">
{{ item.customerName || "-" }}
</view>
......@@ -99,7 +100,7 @@
</tr>
<tr v-for="i in goodsList">
<td>{{ i.goodsName }}</td>
<td>{{ i.goodsPosition }}</td>
<td>{{ i.goodsPositionName }}</td>
<td>{{ i.number }}</td>
</tr>
</table>
......@@ -163,6 +164,7 @@ export default {
{ shopMerchantId } = userInfo;
this.getList('historyDealOrderPage',{
merchantId: [shopMerchantId],
sceneTypes:[1],
pageNum,
pageSize,
goodsTypeGroup:groupIndex
......@@ -350,9 +352,22 @@ export default {
height: 100%;
position: absolute;
top: 0rpx;
opacity: 0.5;
// opacity: 0.5;
right: 0rpx;
background-size: 100% 100%;
border-radius: 32rpx;
}
.gradient-overlay {
position: absolute;
top: 0;
right: 0;
width: 250rpx;
height: 100%;
background: linear-gradient(
to left,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 1) 100%
);
}
.info {
margin-top: 16rpx;
......
......@@ -6,7 +6,7 @@
* @LastEditTime: 2024-06-04 15:08:43
-->
<template>
<view style="position: relative;">
<view style="position: relative">
<view class="bg"></view>
<!-- <view class="nav-bar">
<view class="back" @click="back">
......@@ -25,16 +25,25 @@
>
<view
class="sprite-icon"
:class="[firstIndex == index ? `icon-${firstClass[index]} active` : '']"
:class="[
firstIndex == index ? `icon-${firstClass[index]} active` : '',
]"
:style="{ left: firstLeft[index] }"
></view>
<view class="text" :class="[firstIndex == index ? `active` : '']">{{ i.tabName }}</view>
<view class="text" :class="[firstIndex == index ? `active` : '']">{{
i.tabName
}}</view>
</view>
</view>
<view class="content" id="content">
<view class="second-tab" ref="secondTab" v-if="views[firstIndex].receptionSourceDetailInfoList.length > 0">
<view
class="second-tab"
ref="secondTab"
v-if="views[firstIndex].receptionSourceDetailInfoList.length > 0"
>
<view
v-for="(item, ind) in views[firstIndex].receptionSourceDetailInfoList"
v-for="(item, ind) in views[firstIndex]
.receptionSourceDetailInfoList"
:key="ind"
class="tab-item"
@click="changeIndex(ind, 'secondIndex')"
......@@ -46,16 +55,36 @@
>
</view>
</view>
<template v-if="views[firstIndex].receptionSourceDetailInfoList.length > 0 && views[firstIndex].receptionSourceDetailInfoList[secondIndex].receptionSourceDetailInfoList">
<view class="product-list left" :style="{height: views[firstIndex].receptionSourceDetailInfoList ? '958rpx' : '1032rpx'}">
<view class="product-item" v-for="(itm, idx) in views[firstIndex].receptionSourceDetailInfoList[secondIndex].receptionSourceDetailInfoList" :key="idx" @click="goDetail(itm)">
<image
:src="itm.thumbnail"
mode="scaleToFill"
class="product-img"
/>
<template
v-if="
views[firstIndex].receptionSourceDetailInfoList.length > 0 &&
views[firstIndex].receptionSourceDetailInfoList[secondIndex]
.receptionSourceDetailInfoList
"
>
<view
class="product-list left"
:style="{
height: views[firstIndex].receptionSourceDetailInfoList
? '958rpx'
: '1032rpx',
}"
>
<view
class="product-item"
v-for="(itm, idx) in views[firstIndex]
.receptionSourceDetailInfoList[secondIndex]
.receptionSourceDetailInfoList"
:key="idx"
@click="goDetail(itm)"
>
<image
:src="itm.thumbnail"
mode="scaleToFill"
class="product-img"
/>
</view>
</view>
</view>
</template>
<template v-else>
<view class="nothing flex">
......@@ -210,7 +239,7 @@ export default {
z-index: -1;
font-weight: 700;
font-size: 40rpx;
color: #2C66F7;
color: #2c66f7;
&::after {
content: "";
position: absolute;
......@@ -219,7 +248,7 @@ export default {
transform: translateX(-50%);
width: 48rpx;
height: 8rpx;
background-color: #2C66F7;
background-color: #2c66f7;
border-radius: 16rpx;
}
}
......@@ -242,12 +271,13 @@ export default {
margin-left: 64rpx;
margin-bottom: 48rpx;
.tab-item {
display: inline-block;
display: inline-flex;
align-items: center;
height: 100%;
.text {
display: flex;
align-items: center;
margin: 4rpx;
margin: 0 4rpx;
width: auto;
height: 84rpx;
padding: 0 48rpx;
......@@ -270,7 +300,7 @@ export default {
overflow-y: auto;
.product-item {
text-align: center;
background: #FFFFFF;
background: #ffffff;
box-shadow: 0 16rpx 24rpx 0 #2c66f71a;
border-radius: 24rpx;
height: 594rpx;
......@@ -290,7 +320,8 @@ export default {
width: 100%;
flex-direction: column;
font-size: 14px;
color: #999999;position: absolute;
color: #999999;
position: absolute;
top: 50%;
transform: translateY(-50%);
.icon {
......
import * as Sentry from "./sentry-miniapp";
export default function sentryInit() {
console.log("init");
Sentry.init({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn: "https://cce6491788ff4b8899d8f912e6982a96@sentry.glsx.com.cn/42",
})
});
return Sentry;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!