Commit c029fddc by 前端

oss优化

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