wtt
2025-10-10 0a23b1aa90404be282b630959e5784f3974a6acd
解决扫码频率快导致播放成功错误音乐-99错误
3个文件已修改
20 ■■■■ 已修改文件
manifest.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/shengchanlingliao/form.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/common.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json
@@ -2,8 +2,8 @@
    "name" : "智云LMES",
    "appid" : "__UNI__B002F49",
    "description" : "",
    "versionName" : "1.0.94",
    "versionCode" : 194,
    "versionName" : "1.0.96",
    "versionCode" : 196,
    "transformPx" : false,
    /* 5+App特有相关 */
    "app-plus" : {
pages/shengchanlingliao/form.vue
@@ -616,6 +616,7 @@
                            console.log('扫码返回', res.data);
                            this.hform.HBarCode = ''
                            if (res.data.count == 1) {
                                CommonUtils.playSound(1);
                                var data = res.data.data
                                if (data.hBarTypeField == '仓库条码') {
                                    this.hform.HWHName = data.hWhNameField
@@ -702,6 +703,7 @@
                                //清空数量
                                this.hform.HQty = ''
                            } else {
                                CommonUtils.playSound(0);
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
@@ -711,6 +713,7 @@
                            this.refreshHBarCodeFocus()
                        },
                        fail: (res) => {
                            CommonUtils.playSound(0);
                            console.log(res);
                            uni.showToast({
                                title: '接口请求失败',
utils/common.js
@@ -302,7 +302,6 @@
    // uni-app 播放音频封装
    playSound(e) {
        console.log(e);
        const innerAudioContext = uni.createInnerAudioContext();
        if (e == 1) {
            innerAudioContext.src = '/static/success.wav';
@@ -310,6 +309,18 @@
            innerAudioContext.src = '/static/jingbao.wav';
        }
        innerAudioContext.play(); // 播放音频
        innerAudioContext.onPlay(() => {
            console.log('开始播放');
        });
        innerAudioContext.onError((res) => {
            console.log(res.errMsg);
            console.log(res.errCode);
        });
        innerAudioContext.onPause(function(){
            console.log('播放出现错误,销毁');
            innerAudioContext.destroy();
        })
    }
    
    replaceWithFunction(str, handler) {