测试手机是三星S6,SM-G9208, android5.1.1
问题代码:document.location.href="#show_year";
整页代码如下:
所有课程
var tmp_data = [{"CourseID":"01122","timeSegment":"08:00~10:00","OrgID":"0000001","OrgName":"海豚教育","CourseName":"高二物理1","bSubmited":1,"bConfirmed":1},{"CourseID":"01123","timeSegment":"10:00~12:00","OrgID":"0000002","OrgName":"优学教育","CourseName":"一对一王思聪","bSubmited":0,"bConfirmed":0}];
mui.init();
mui.plusReady(function() {
plus.webview.currentWebview().setStyle({
scrollIndicator: 'none'
});
(function($, doc) {
$.init();
$.ready(function() {
//普通示例
var userPicker = new $.PopPicker();
userPicker.setData([{
value: '2015',
text: '2015年'
}, {
value: '2016',
text: '2016年'
}, {
value: '2017',
text: '2017年'
}, {
value: '2018',
text: '2018年'
}, {
value: '2019',
text: '2019年'
}, {
value: '2020',
text: '2020年'
}]);
var showUserPickerButton = doc.getElementById('select_year');
//var userResult = doc.getElementById('userResult');
showUserPickerButton.addEventListener('tap', function(event) {
userPicker.show(function(items) {
//userResult.innerText = JSON.stringify(items[0]);
doc.getElementById('show_year').innerText = items[0].value;
document.location.href="#show_year";
//返回 false 可以阻止选择框的关闭
//return false;
});
}, false);
});
})(mui, document);
});
function saveData(date_str, server_data){
var myDate = new Date();
app.setStorageValue(date_str,'');
app.setStorageValue(date_str,JSON.stringify(server_data));
//记录最后的访问时间,以此判断是否需要从服务器重新获取数据
app.setStorageValue(date_str "_lastVisit",'');
app.setStorageValue(date_str "_lastVisit",myDate.getTime().toString());
};
//
//
//
//
10:00~12:00 优学教育英语//
//
13:00~15:00 学大教育语文//
//
function appendDate(value, content, data, obj){
//apend data
obj.innerHTML = '' content '';
var ul='
- ';
for(var o in data) {
ul = '
ul = data[o].timeSegment " " data[o].OrgName data[o].CourseName;
';// alert(o ":" ul);
}
ul = '
';// alert(ul);
// alert("brefor:" obj.innerHTML);
obj.innerHTML = ul;
// alert(obj.innerHTML);
};
var bSub_li = false;
mui("#month_list").on('tap','ul>li>ul>li a',function(){
bSub_li = true;
var value = this.getAttribute("value");
//传值给详情页面,通知加载新数据
var detailPage = null;
var index = value.indexOf("|1");
if(index > 0) {
var value_rel = value.substr(0,index);
detailPage = plus.webview.getWebviewById('submit');
//mui.fire(detailPage,'getDetail',{id:id});
mui.fire(detailPage,'courseID',{
id:value_rel
});
mui.openWindow({
id:'submit',
url:'submit.html',
show:{
aniShow:'none'
},
waiting:{
autoShow:false
}
});
} else {
index = value.indexOf("|0");
var value_rel = value.substr(0,index);
detailPage = plus.webview.getWebviewById('un_submit');
//mui.fire(detailPage,'getDetail',{id:id});
mui.fire(detailPage,'courseID',{
id:value_rel
});
mui.openWindow({
id:'un_submit',
url:'un_submit.html',
show:{
aniShow:'none'
},
waiting:{
autoShow:false
}
});
}
});
mui("#month_list").on('tap','ul>li a',function(){
if(bSub_li == true) {
bSub_li = false;
return;
}
var value = this.getAttribute("value");
var content = this.innerHTML;
var myDate = new Date();
//alert(document.getElementById("show_year").innerText);
var key_lastVisit = document.getElementById('show_year').innerText "_" value "_lastVisit";
var key = document.getElementById('show_year').innerText "_" value;
if(myDate.getTime() - app.getStorageValue(key_lastVisit)*1 > 5*50*1000) {
saveData(document.getElementById('show_year').innerText "_" value, tmp_data);
}
//alert(this.parentElement.innerHTML);
appendDate(value, content, JSON.parse(app.getStorageValue(key)), this.parentElement);
});
document.getElementById("search").addEventListener('tap',function(){
mui.openWindow({
url: '../consume/search.html',
id: 'search',
show: {
aniShow: 'pop-in'
},
waiting: {
autoShow: false
}
});
});