1***@qq.com
1***@qq.com
  • 发布:2016-09-27 11:31
  • 更新:2016-09-27 11:48
  • 阅读:1192

实现会议室预定,在查询会议室时老出现strIng index Out of range:-1

分类:MUI
<script type="text/javascript ">  
        mui.init();  
        var url=OCS.getUrl();         
        function add(meetingRecordInfo) {  
            var room_name = meetingRecordInfo.room_name;  
            var holdpeople = meetingRecordInfo.room_beholedpeople;  
            var room_price = meetingRecordInfo.room_price;  
            var h = '<li class="mui-table-view-cell btn " room_name="' + room_name + '" room_price="' + room_price + '">'; //图文列表  
            h += '<a id="result " class="mui-navigate-right " href="# " room_name="' + room_name + '" room_price="' + room_price + '">';  
            h += '<p>' + room_name + '<span class="right-sp ">容纳' + holdpeople + '人</span></p>';  
            h += '<p>' + room_price + '元<span class="right-sp "></span></p>';  
            h += '</a>';  
            h += '</li>';  
            return h;  
                 }  
    (function($, doc) {  
        mui.plusReady(function() {  
            mui.post(url + 'QCRI', {  
                open_date: window.localStorage.getItem(OCS.meet.dateTime),  
                start_time: window.localStorage.getItem(OCS.meet.startTime),  
                end_time: window.localStorage.getItem(OCS.meet.endTime),  
                area_name: window.localStorage.getItem(OCS.meet.address)  
            }, function(data) {  
                if(data.success +""== 'true') {  
                    var tmpStr = "";  
                    mui.alert(data.resultData.length);  
                    for(var i = 0; i <data.resultData.length; i++) {               
                        tmpStr += add(data.resultData[i]);  
                    }  
                    document.getElementById('ui').innerHTML = tmpStr;  
                /*每一个li中有一个事件发生*/     
                    var btns = mui('.btn');  
                    btns.each(function(i, e) {  
                        e.addEventListener('tap',  
                            function(e) {  
                                var room_name = e.currentTarget.getAttribute("room_name");  
                                var room_price = e.currentTarget.getAttribute("room_price");  
                                window.localStorage.setItem(OCS.meet.room_name,room_name);  
                                window.localStorage.setItem(OCS.meet.room_price,room_price);  
                                var hours=window.localStorage.getItem(OCS.meet.dishours);  
                                var num = new Number(hours*room_price);  
                                window.localStorage.setItem(OCS.meet.fee,num.toFixed(2));  
                                mui.openWindow({  
                                    url: "meetmsg.html"  
//                                  extras: {  
//                                      room_name: room_name,  
//                                      room_price: room_price  
//                                  }  
                                });  
                            }, false);  
                    });  
                } else {  
                    mui.alert(data.msg);  
                }  
            }, 'json');   
        });  
        })(mui, document);  
    </script>  
2016-09-27 11:31 负责人:无 分享
已邀请:
Trust

Trust - 少说废话

根据错误信息,检查下遍历中的索引是否超出范围了。

该问题目前已经被锁定, 无法添加新回复