一、发布成功自动返回消息列表页面,并更新列表,显示当前最新记录
appcan.ajax({
url : url + '/appInterface/submitGrowTrace', type : 'POST',
data : { userName : getstorage('username'), stageId : stage, content : con, photoId : picture, token : getstorage('token') }, dataType : 'json', timeout : 30000, success : function(data) { if (data.result == 0) { appcan.window.openToast('发布成功,您可在记录页查看~~', '2000'); appcan.window.close({ aniId : '', animDuration : '' }); uexWindow.evaluateMultiPopoverScript("index", "index_content", "1", "getData();"); uexWindow.evaluateMultiPopoverScript("index", "index_content", stage-101999, "getData();"); } else if (data.result == 1) { } }, error : function(xhr, textStatus, errorThrown) { appcan.window.openToast('请求失败,请稍后再试。', '2000', '5', '0'); } })
二、下拉刷新
window.uexOnload = function(type) { uexWindow.setBounce(1); uexWindow.setBounce("1"); getData(); uexWindow.onBounceStateChange = function(type, state) { if (type == 0 && state == 2) { //顶部弹动 getData(); uexWindow.resetBounceView("0"); } }; uexWindow.setBounceParams( '0', "{'pullToReloadText':'下拉刷新','releaseToReloadText':'释放刷新','loadingText':'正在刷新,请稍候'}"); uexWindow.showBounceView(0, "rgba(255,255,255,0)", 1); uexWindow.notifyBounceEvent(0, 1); }
三、页面滑动
function openPages(){ var titHeight = $('#tabview').offset().height; appcan.frame.open({ id : "index_content", url : [{ "inPageName" : "1", "inUrl" : "start_content1.html", }, { "inPageName" : "2", "inUrl" : "start_content2.html", }, { "inPageName" : "3", "inUrl" : "start_content3.html", },{ "inPageName" : "4", "inUrl" : "start_content4.html", }, { "inPageName" : "5", "inUrl" : "start_content5.html", }, { "inPageName" : "6", "inUrl" : "start_content6.html", }, { "inPageName" : "7", "inUrl" : "start_content7.html", }], top : titHeight, left : 0, index : 0, name:"index_content", change:function(err,res){ uexWindow.evaluateMultiPopoverScript("", "index_content", res.multiPopSelectedIndex+1, "getData();"); tabview.moveTo(res.multiPopSelectedIndex); } }); } var tabview = appcan.tab({ selector : "#tabview", hasIcon : false, hasAnim : true, hasLabel : true, hasBadge : false, data : [{ label : "全部", }, { label : "播种", }, { label : "发芽", },{ label : "长叶", }, { label : "开花", }, { label : "结果", }, { label : "总结", }] }); tabview.on("click", function(obj, index) { appcan.window.selectMultiPopover("index_content",index); })
四、选项卡切换
var tabview_footer = appcan.tab({ selector: "#footer", hasIcon: true, hasAnim: false, hasLabel: true, hasBadge: false, data: [{ label: "记录", icon: "fa-video-camera" },{ label: "发布", icon: "fa-camera" }, { label: "通知", icon: "fa-comment" }, { label: "我", icon: "fa-user" }]});tabview_footer.on("click", function (obj, index) { if(index == 0) { appcan.frame.closeMulti('index_content'); appcan.frame.close('content'); appcan.frame.open("content", "index_content.html",0,0); } else if (index == 1) { appcan.frame.closeMulti('index_content'); appcan.frame.close('content'); appcan.frame.open("content", "picture.html",0,0); } else if (index == 2) { appcan.frame.closeMulti('index_content'); appcan.frame.close('content'); appcan.frame.open("content", "message_content.html",0,0); } else if (index == 3) { appcan.frame.closeMulti('index_content'); appcan.frame.close('content'); appcan.frame.open("content", "myInfor_content.html",0,0); } appcan.frame.resize("content",0,0);});