374664010@qq.com
374664010@qq.com
  • 发布:2019-03-14 19:14
  • 更新:2019-03-15 12:27
  • 阅读:46

【报Bug】softinputMode: "adjustResize" ios在真机调试下好使,打包后键盘下出现黑色可滚动区域

分类:HBuilder

详细问题描述

(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)
[内容]
softinputMode: "adjustResize" ios在真机调试下好使,打包后键盘下出现黑色可滚动区域

重现步骤

[步骤]
[结果]
[期望]
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]

IDE运行环境说明

[HBuilder 或 HBuilderX] HBuilder
[IDE版本号]9.1.29.201811231920
[windows版本号]
[mac版本号]

uni-app运行环境说明

[运行端是h5或app或某个小程序]
[运行端版本号]

App运行环境说明

[Android版本号]
[iOS版本号] 12.1.4
[手机型号]
[模拟器型号]

附件

[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段]

联系方式

[QQ] 374664010

2019-03-14 19:14 分享
已邀请:
374664010@qq.com

374664010@qq.com (作者)

<!DOCTYPE html>
<html>

<head>  
    <meta charset="utf-8">  
    <title>图文咨询</title>  
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />  
    <!--删除默认的苹果工具栏和菜单栏,当我们需要显示工具栏和菜单栏时,这个行meta就不用加了,默认就是显示-->  
    <meta name="apple-mobile-web-app-capable" content="yes" />  
    <!--作用是控制状态栏显示样式,默认black和black-translucent-->  
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />  
    <link href="../../css/mui.min.css" rel="stylesheet" />  
    <link href="../../js/loading/css/loading.css" rel="stylesheet" />  
    <link href="../../css/mui.imageviewer.css" rel="stylesheet" />  
    <link href="../../css/consulting1.css" rel="stylesheet" />  
    <link href="../../fonts/iconfont/iconfont.css" rel="stylesheet" />  
    <style>  
        html,  
        body {  
            height: 100%;  
            margin: 0px;  
            padding: 0px;  
            overflow: hidden;  
            -webkit-touch-callout: none;  
            -webkit-user-select: none;  
        }  

        footer {  
            position: fixed;  
            width: 100%;  
            height: 50px;  
            min-height: 50px;  
            border-top: solid 1px #bbb;  
            left: 0px;  
            bottom: 0px;  
            overflow: hidden;  
            /*padding: 0px 50px;*/  
            background-color: #fafafa;  
        }  

        .footer-left {  
            position: absolute;  
            width: 50px;  
            height: 50px;  
            right: 0px;  
            top: 0px;  
            text-align: center;  
            vertical-align: middle;  
            line-height: 100%;  
            padding: 12px 4px;  
        }  

        .footer-right {  
            position: absolute;  
            width: 50px;  
            height: 50px;  
            left: 0px;  
            top: 0px;  
            text-align: center;  
            vertical-align: middle;  
            line-height: 100%;  
            padding: 12px 5px;  
            display: inline-block;  
        }  

        .footer-center {  
            height: 100%;  
            padding: 5px 50px;  
        }  

        .footer-center [class*=input] {  
            width: 100%;  
            height: 100%;  
            border-radius: 5px;  
        }  

        .footer-center .input-text {  
            background: #fff;  
            border: solid 1px #ddd;  
            padding: 10px !important;  
            font-size: 16px !important;  
            line-height: 18px !important;  
            font-family: verdana !important;  
            overflow: hidden;  
        }  

        .footer-center .input-sound {  
            background-color: #eee;  
        }  

        .mui-content {  
            height: 100%;  
            padding: 44px 0px 50px 0px;  
            overflow: auto;  
            background-color: #eaeaea;  
        }  

        #msg-list {  
            height: 100%;  
            overflow: auto;  
            -webkit-overflow-scrolling: touch;  
        }  

        .msg-item {  
            padding: 8px;  
            clear: both;  
        }  

        .msg-item .mui-item-clear {  
            clear: both;  
        }  

        .msg-item .msg-user {  
            width: 38px;  
            height: 38px;  
            border: solid 1px #d3d3d3;  
            display: inline-block;  
            background: #fff;  
            border-radius: 3px;  
            vertical-align: top;  
            text-align: center;  
            float: left;  
            padding: 3px;  
            color: #ddd;  
        }  

        .msg-item .msg-user-img {  
            width: 38px;  
            height: 38px;  
            display: inline-block;  
            border-radius: 3px;  
            vertical-align: top;  
            text-align: center;  
            float: left;  
            color: #ddd;  
        }  

        .msg-item .msg-content {  
            display: inline-block;  
            border-radius: 5px;  
            border: solid 1px #d3d3d3;  
            background-color: #FFFFFF;  
            color: #333;  
            padding: 8px;  
            vertical-align: top;  
            font-size: 15px;  
            position: relative;  
            margin: 0px 8px;  
            max-width: 75%;  
            min-width: 35px;  
            float: left;  
        }  

        .msg-item .msg-content .msg-content-inner {  
            overflow-x: hidden;  
        }  

        .msg-item .msg-content .msg-content-arrow {  
            position: absolute;  
            border: solid 1px #d3d3d3;  
            border-right: none;  
            border-top: none;  
            background-color: #FFFFFF;  
            width: 10px;  
            height: 10px;  
            left: -5px;  
            top: 12px;  
            -webkit-transform: rotateZ(45deg);  
            transform: rotateZ(45deg);  
        }  

        .msg-item-self .msg-user,  
        .msg-item-self .msg-content {  
            float: right;  
        }  

        .msg-item-self .msg-content .msg-content-arrow {  
            left: auto;  
            right: -5px;  
            -webkit-transform: rotateZ(225deg);  
            transform: rotateZ(225deg);  
        }  

        .msg-item-self .msg-content,  
        .msg-item-self .msg-content .msg-content-arrow {  
            background-color: #4CD964;  
            color: #fff;  
            border-color: #2AC845;  
        }  

        footer .mui-icon {  
            color: #000;  
        }  

        footer .mui-icon:active {  
            color: #007AFF !important;  
        }  

        footer .mui-icon-paperplane:before {  
            content: "发送";  
            font-size: 16px;  
        }  

        footer .mui-icon-paperplane {  
            /*-webkit-transform: rotateZ(45deg);  
            transform: rotateZ(45deg);*/  
            font-size: 16px;  
            word-break: keep-all;  
            line-height: 100%;  
            padding-top: 6px;  
            color: rgba(0, 135, 250, 1);  
        }  

        #msg-sound {  
            -webkit-user-select: none !important;  
            user-select: none !important;  
        }  

        .rprogress {  
            position: absolute;  
            left: 50%;  
            top: 50%;  
            width: 140px;  
            height: 140px;  
            margin-left: -70px;  
            margin-top: -70px;  
            background-image: url(../images/arecord.png);  
            background-repeat: no-repeat;  
            background-position: center center;  
            background-size: 30px 30px;  
            background-color: rgba(0, 0, 0, 0.7);  
            border-radius: 5px;  
            display: none;  
            -webkit-transition: .15s;  
        }  

        .rschedule {  
            background-color: rgba(0, 0, 0, 0);  
            border: 5px solid rgba(0, 183, 229, 0.9);  
            opacity: .9;  
            border-left: 5px solid rgba(0, 0, 0, 0);  
            border-right: 5px solid rgba(0, 0, 0, 0);  
            border-radius: 50px;  
            box-shadow: 0 0 15px #2187e7;  
            width: 46px;  
            height: 46px;  
            position: absolute;  
            left: 50%;  
            top: 50%;  
            margin-left: -23px;  
            margin-top: -23px;  
            -webkit-animation: spin 1s infinite linear;  
            animation: spin 1s infinite linear;  
        }  

        .r-sigh {  
            display: none;  
            border-radius: 50px;  
            box-shadow: 0 0 15px #2187e7;  
            width: 46px;  
            height: 46px;  
            position: absolute;  
            left: 50%;  
            top: 50%;  
            margin-left: -23px;  
            margin-top: -23px;  
            text-align: center;  
            line-height: 46px;  
            font-size: 40px;  
            font-weight: bold;  
            color: #2187e7;  
        }  

        .rprogress-sigh {  
            background-image: none !important;  
        }  

        .rprogress-sigh .rschedule {  
            display: none !important;  
        }  

        .rprogress-sigh .r-sigh {  
            display: block !important;  
        }  

        .rsalert {  
            font-size: 12px;  
            color: #bbb;  
            text-align: center;  
            position: absolute;  
            border-radius: 5px;  
            width: 130px;  
            margin: 5px 5px;  
            padding: 5px;  
            left: 0px;  
            bottom: 0px;  
        }  

        @-webkit-keyframes spin {  
            0% {  
                -webkit-transform: rotate(0deg);  
            }  
            100% {  
                -webkit-transform: rotate(360deg);  
            }  
        }  

        @keyframes spin {  
            0% {  
                transform: rotate(0deg);  
            }  
            100% {  
                transform: rotate(360deg);  
            }  
        }  

        .cancel {  
            background-color: darkred;  
        }  

        .mui-icon-camera:before {  
            font-size: 24px;  
            content:"\e63b"  
        }  
        .scan-right {  
            z-index: 99;  
            float: right;  
            width: 19px;  
            height: 19px;  
            margin-top: 20px;  
            margin-right: 9px;  
            background-image: url(../../images/white-hot.png);  
            background-repeat:no-repeat;  
            background-size: 100%;  
        }  
        .sign{  
            display: none;  
            width: 100;  
        }  
        .sign_boxs {  
            width: 100%;  
            float: left;  
        }  

        .sign_box {  
            width: 25%;  
            float: left;  
        }  

        .sign_box img {  
            width: 100%;  
            padding: 0 15px;  
            height: auto;  
        }  
        .sign_font{  
            text-align: center;  
        }  
    </style>  
</head>  

<body contextmenu="return false;">  
    <!--  
        作者:Y@R  
        时间:2019-01-08  
        描述:图文咨询  
    -->  

    <!--top-->  
    <header class="mui-bar mui-bar-nav" style="background-color: #4EBBFE;">  
        <img id="fanhuishangyiye" onclick="mui.back();" src="../../images/return.png" alt="" width="30" style="position: relative;margin-top: 6px;" />  
        <h1 class="mui-title" id="docName" style="color: white;"></h1>  
        <a onclick="scheme()" class="scan-right"></a>  
    </header>  

    <div class="mui-content">  
        <div id='msg-list'>  
        </div>  
    </div>  
    <!--footer-->  
    <footer id="foot">  
        <div class="footer-left">  
            <i id='msg-image' class="iconfont mui-icon-camera"></i>  
        </div>  
        <div class="footer-center">  
            <textarea id='msg-text' type="text" class='input-text'></textarea>  
            <button id='msg-sound' type="button" class='input-sound' style="display: none;">按住说话</button>  
        </div>  
        <label for="" class="footer-right">  
            <i id='msg-type' class="mui-icon mui-icon-mic"></i>  
        </label>  
        <div class="sign" id="sign" >  
            <div class="sign_boxs">  
                <div class="sign_box" id="tp">  
                    <img src="../../images/sign_tp.png" />  
                    <p class="sign_font" >图片</p>  
                </div>  
                <!--<div class="sign_box" id="xsp"><img src="../../images/sign_xsp.png" />  
                    <p class="sign_font" >小视频</p>  
                </div>-->  
                <div class="sign_box" id="sc"><img src="../../images/sign_sc.png" />  
                    <p class="sign_font" >收藏</p>  
                </div>  
                <!--<div class="sign_box" id="spth"><img src="../../images/sign_spth.png" />  
                    <p class="sign_font" >视频通话</p>  
                </div>-->  
                <div class="sign_box" id="kfrz"><img src="../../images/sign_kfrz.png" />  
                    <p class="sign_font" >康复日志</p>  
                </div>  
                <div class="sign_box" id="kffa"><img src="../../images/sign_kffa.png" />  
                    <p class="sign_font" >康复方案</p>  
                </div>  
                <div class="sign_box" id="kfcp"><img src="../../images/sign_kfcp.png" />  
                    <p class="sign_font" >康复产品</p>  
                </div>  
                <div class="sign_box" id="wdrw"><img src="../../images/sign_wdrw.png" />  
                    <p class="sign_font" >我的任务</p>  
                </div>  
            </div>  
        </div>  
    </footer>  

    <!--footer-end-->  
    <div id='sound-alert' class="rprogress">  
        <div class="rschedule"></div>  
        <div class="r-sigh">!</div>  
        <div id="audio_tips" class="rsalert">手指上滑,取消发送</div>  
    </div>  
    <script src="../../js/mui.min.js"></script>  
    <script src="../../js/mui.imageViewer.js"></script>  
    <script src="../../js/arttmpl.js"></script>  
    <script src="../../js/db.js"></script>  
    <script src="../../js/saveImg.js"></script>  
    <script src="../../js/jquery-1.8.3.js"></script>  
    <script src="../../js/time.js" type="text/javascript"></script>  
    <script src="../../js/loading/js/loading.js" type="text/javascript"></script>  
    <script src="../../js/fangdatu.js"></script>  
    <script src="../../js/config.js"></script>  
    <script src="../../js/consulting.js"></script>  
    <script type="text/javascript" charset="utf-8">  
    //定义所有的变量//  
    var users = localStorage.getItem("username");  
    //页面数据  
    var content = '';  
    //医生名字  
    var doc_name;  
    //会话名称  
    var doc_name = '';  
    //服务次数  
    var question_number = '';  
    //用户头像  
    var patientuser_url = '';  
    //会话id  
    var im_group_id = '';  
    //定义语音对象  
    var player = '';  
    var magnify;  
    var num;  
    var keys = 0;  
    var token = localStorage.getItem("token");  
    //变量定义完成//  
        (function($, doc) {  
            var MIN_SOUND_TIME = 800;  
            $.init({  
                gestureConfig: {  
                    tap: true, //默认为true  
                    doubletap: true, //默认为false  
                    longtap: true, //默认为false  
                    swipe: true, //默认为true  
                    drag: true, //默认为true  
                    hold: true, //默认为false,不监听  
                    release: true //默认为false,不监听  
                }  
            });  
            template.config('escape', false);  

            if(mui.os.ios) {  
                // 解决在ios上fixed元素focusin时位置出现错误的问题   
                document.addEventListener('DOMContentLoaded', function() {  
                    var footerDom = document.querySelector('footer');  

                    document.addEventListener('focusin', function() {  
                        footerDom.style.position = 'absolute';  
                    });  
                    document.addEventListener('focusout', function() {  
                        footerDom.style.position = 'fixed';  
                    });  
                });  
            }  

            $.plusReady(function() {  

                //是否打开指导页  
                if(!plus.storage.getItem("consultImg")){  
                    mui.openWindow({  
                        url: './consulting1.html',  
                        id: 'consulting1.html',  
                        styles: {},  
                        extras: {  
                            // .....//自定义扩展参数,可以用来处理页面间传值  
                        },  
                        createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示  
                        show: {  
                            autoShow: true, //页面loaded事件发生后自动显示,默认为true  
                        },  
                        waiting: {  
                            autoShow: true, //自动显示等待框,默认为true  
                            title: '正在加载...',  
                        },  
                    })  
                }  
                var x = plus.webview.currentWebview();  
                im_group_id = x.bid;  
                sel_name(im_group_id);  
                select(patientuser_id, im_group_id);  
                patientuser_url = localStorage.getItem("patientuser_url")+' ';  
                if(patientuser_url.substring(0, 4) != 'http') {  
                    patientuser_url = 'http://ipa.早健康.net' + localStorage.getItem("patientuser_url");  
                } else {  
                    patientuser_url = localStorage.getItem("patientuser_url");  
                }  
                plus.webview.currentWebview().setStyle({  
                    softinputMode: "adjustResize"  
                });  
                var showKeyboard = function() {  
                    if($.os.ios) {  
                        var webView = plus.webview.currentWebview().nativeInstanceObject();  
                        webView.plusCallMethod({  
                            "setKeyboardDisplayRequiresUserAction": false  
                        });  
                    } else {  
                        var Context = plus.android.importClass("android.content.Context");  
                        var InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");  
                        var main = plus.android.runtimeMainActivity();  
                        var imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);  
                        imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);  
                        //var view = ((ViewGroup)main.findViewById(android.R.id.content)).getChildAt(0);  
                        imm.showSoftInput(main.getWindow().getDecorView(), InputMethodManager.SHOW_IMPLICIT);  
                        //alert("ll");  
                    }  
                };  

                var ui = {  
                    body: doc.querySelector('body'),  
                    footer: doc.querySelector('footer'),  
                    footerRight: doc.querySelector('.footer-right'),  
                    footerLeft: doc.querySelector('.footer-left'),  
                    btnMsgType: doc.querySelector('#msg-type'),  
                    boxMsgText: doc.querySelector('#msg-text'),  
                    boxMsgSound: doc.querySelector('#msg-sound'),  
                    btnMsgImage: doc.querySelector('#msg-image'),  
                    areaMsgList: doc.querySelector('#msg-list'),  
                    boxSoundAlert: doc.querySelector('#sound-alert'),  
                    content: doc.querySelector('.mui-content')  
                };  

                //alert(ui.boxMsgText.offsetWidth );  
                var footerPadding = ui.footer.offsetHeight - ui.boxMsgText.offsetHeight;  
                var msgItemTap = function(msgItem, event) {  
                    var msgType = msgItem.getAttribute('msg-type');  
                    var msgContent = msgItem.getAttribute('msg-content')  
                    if(msgType == 'sound') {  
                        player = plus.audio.createPlayer(msgContent);  
                        var playState = msgItem.querySelector('.play-state');  
                        playState.innerText = '正在播放...';  
                        player.play(function() {  
                            playState.innerText = '点击播放';  
                        }, function(e) {  
                            playState.innerText = '点击播放';  
                        });  
                    }  
                };  
                var imageViewer = new $.ImageViewer('.msg-content-image', {  
                    dbl: false  
                });  
                window.addEventListener('resize', function() {  
                    ui.areaMsgList.scrollTop = ui.areaMsgList.scrollHeight + ui.areaMsgList.offsetHeight;  
                }, false);  

                function msgTextFocus() {  
                    ui.boxMsgText.focus();  
                    setTimeout(function() {  
                        ui.boxMsgText.focus();  
                    }, 150);  
                }  
                //解决长按“发送”按钮,导致键盘关闭的问题;  
                ui.footerLeft.addEventListener('touchstart', function(event) {  
                    if(ui.btnMsgType.classList.contains('mui-icon-paperplane')) {  
                        msgTextFocus();  
                        event.preventDefault();  
                    }  
                });  
                //解决长按“发送”按钮,导致键盘关闭的问题;  
                ui.footerRight.addEventListener('touchmove', function(event) {  
                    if(ui.btnMsgType.classList.contains('mui-icon-paperplane')) {  
                        msgTextFocus();  
                        event.preventDefault();  
                    }  
                });  

                //点击底部左侧按钮  
                ui.footerRight.addEventListener('release', function(event) {  
                    if(document.getElementById('sign').style.display == 'block'){  
                        document.getElementById('sign').style.display = 'none';  
                        document.getElementById('foot').style.height = '50px';  

                    }  
                    if(ui.btnMsgType.classList.contains('mui-icon-mic')) {  
                        ui.btnMsgType.classList.add('mui-icon-compose');  
                        ui.btnMsgType.classList.remove('mui-icon-mic');  
                        ui.boxMsgText.style.display = 'none';  
                        ui.boxMsgSound.style.display = 'block';  
                        ui.boxMsgText.blur();  
                        document.body.focus();  
                    } else if(ui.btnMsgType.classList.contains('mui-icon-compose')) {  
                        ui.btnMsgType.classList.add('mui-icon-mic');  
                        ui.btnMsgType.classList.remove('mui-icon-compose');  
                        ui.boxMsgSound.style.display = 'none';  
                        ui.boxMsgText.style.display = 'block';  
                        //--  
                        //showKeyboard();  
                        ui.boxMsgText.focus();  
                        setTimeout(function() {  
                            ui.boxMsgText.focus();  
                        }, 150);  
                    }  
                }, false);  

                //点击底部右侧按钮  
                ui.footerLeft.addEventListener('tap', function(event) {  

// alert(ui.btnMsgImage.classList.contains('mui-icon-paperplane'));
if(ui.btnMsgImage.classList.contains('mui-icon-paperplane')) {
//showKeyboard();
ui.boxMsgText.focus();
setTimeout(function() {
ui.boxMsgText.focus();
}, 150);
send(ui.boxMsgText.value.replace(new RegExp('\n', 'gm'), '<br/>'));
// send({
// sender: 'self',
// type: 'text',
// content: ui.boxMsgText.value.replace(new RegExp('\n', 'gm'), '<br/>')
// });
ui.boxMsgText.value = '';
$.trigger(ui.boxMsgText, 'input', null);
}else{
ui.boxMsgText.blur();
setTimeout(function() {
ui.boxMsgText.blur();
}, 0);
focus = true;
setTimeout(function() {
focus = false;
}, 1000);
event.detail.gesture.preventDefault();
if(document.getElementById('sign').style.display == 'none' || document.getElementById('sign').style.display == ''){
document.getElementById('sign').style.display = 'block';
document.getElementById('foot').style.height = 'auto';
}else{
document.getElementById('sign').style.display = 'none';
document.getElementById('foot').style.height = '50px';
}
}

                }, false);  

                //上滑取消  
                var setSoundAlertVisable = function(show) {  
                    if(show) {  
                        ui.boxSoundAlert.style.display = 'block';  
                        ui.boxSoundAlert.style.opacity = 1;  
                    } else {  
                        ui.boxSoundAlert.style.opacity = 0;  
                        //fadeOut 完成再真正隐藏  
                        setTimeout(function() {  
                            ui.boxSoundAlert.style.display = 'none';  
                        }, 200);  
                    }  
                };  
                var recordCancel = false;  
                var recorder = null;  
                var audio_tips = document.getElementById("audio_tips");  
                var startTimestamp = null;  
                var stopTimestamp = null;  
                var stopTimer = null;  

                ui.boxMsgSound.addEventListener('hold', function(event) {  
                    recordCancel = false;  
                    if(stopTimer) clearTimeout(stopTimer);  
                    audio_tips.innerHTML = "手指上划,取消发送";  
                    ui.boxSoundAlert.classList.remove('rprogress-sigh');  
                    setSoundAlertVisable(true);  
                    // 获取当前设备的录音对象  
                    recorder = plus.audio.getRecorder();  
                    if(recorder == null) {  
                        plus.nativeUI.toast("不能获取录音对象");  
                        return;  
                    }  
                    startTimestamp = (new Date()).getTime();  
                    recorder.record({  
                        filename: "_doc/audio/",  
                        format: "amr" //iOS平台支持"wav"、"aac"、"amr"格式,默认为"wav"  
                    }, function(path) {  
                        if(recordCancel) return;  
                        //                          addData(time(),path,1,3)//3是语音文件  
                        Audio2dataURL(path);  
                    }, function(e) {  
                        plus.nativeUI.toast("录音时出现异常: " + e.message);  
                    });  

                }, false);  

                ui.body.addEventListener('drag', function(event) {  
                    //console.log('drag');  
                    if(Math.abs(event.detail.deltaY) > 50) {  
                        if(!recordCancel) {  
                            recordCancel = true;  
                            if(!audio_tips.classList.contains("cancel")) {  
                                audio_tips.classList.add("cancel");  
                            }  
                            audio_tips.innerHTML = "松开手指,取消发送";  
                        }  
                    } else {  
                        if(recordCancel) {  
                            recordCancel = false;  
                            if(audio_tips.classList.contains("cancel")) {  
                                audio_tips.classList.remove("cancel");  
                            }  
                            audio_tips.innerHTML = "手指上划,取消发送";  
                        }  
                    }  
                }, false);  

                ui.boxMsgSound.addEventListener('release', function(event) {  
                    //console.log('release');  
                    if(audio_tips.classList.contains("cancel")) {  
                        audio_tips.classList.remove("cancel");  
                        audio_tips.innerHTML = "手指上划,取消发送";  
                    }  
                    //  
                    stopTimestamp = (new Date()).getTime();  
                    if(stopTimestamp - startTimestamp < MIN_SOUND_TIME) {  
                        audio_tips.innerHTML = "录音时间太短";  
                        ui.boxSoundAlert.classList.add('rprogress-sigh');  
                        recordCancel = true;  
                        stopTimer = setTimeout(function() {  
                            setSoundAlertVisable(false);  
                        }, 800);  
                    } else {  
                        setSoundAlertVisable(false);  
                    }  
                    recorder.stop();  
                }, false);  

                ui.boxMsgSound.addEventListener("touchstart", function(e) {  
                    //console.log("start....");  
                    e.preventDefault();  
                });  

                //切换发送与加号  
                ui.boxMsgText.addEventListener('input', function(event) {  
                    ui.btnMsgImage.classList[ui.boxMsgText.value == '' ? 'remove' : 'add']('mui-icon-paperplane');  
                    ui.btnMsgType.setAttribute("for", ui.boxMsgText.value == '' ? '' : 'msg-text');  

                    ui.content.style.paddingBottom = ui.footer.style.height;  
                });  

                var focus = false;  
                //点击文字框  
                ui.boxMsgText.addEventListener('tap', function(event) {  

                    ui.boxMsgText.focus();  
                    if(document.getElementById('sign').style.display == 'block'){  
                        document.getElementById('sign').style.display = 'none';  
                        document.getElementById('foot').style.height = '50px';  

                    }  
                    setTimeout(function() {  
                        ui.boxMsgText.focus();  
                    }, 0);  
                    focus = true;  
                    setTimeout(function() {  
                        focus = false;  
                    }, 1000);  

// event.detail.gesture.preventDefault();
}, false);
//点击消息列表,关闭键盘
ui.areaMsgList.addEventListener('click', function(event) {
if(!focus) {
ui.boxMsgText.blur();
}
if(document.getElementById('sign').style.display == 'block'){
document.getElementById('sign').style.display = 'none';
document.getElementById('foot').style.height = '50px';
}
})

            });  
        }(mui, document));  
    </script>  
</body>  

</html>

页面的代码如上

374664010@qq.com

374664010@qq.com (作者)

有人帮忙看下么

要回复问题请先登录注册