mui.init(); var params = {}; var first = true, docInfo, teamInfo,thisTeamsId , leader; mui.plusReady(function() { getStatus(); bindEvents(); }) //var main = plus.android.runtimeMainActivity(); //获取activity //var Intent = plus.android.importClass('android.content.Intent'); //var Settings = plus.android.importClass('android.provider.Settings'); //var intent = new Intent(Settings.ACTION_SOUND_SETTINGS);//显示设置,以允许配置声音和音量 //var intent = new Intent(Settings.ACTION_SETTINGS);//显示系统设置 //main.startActivity(intent); //页面初始请求开关状态 function getStatus(){ plus.nativeUI.showWaiting(); sendPost('doctor/message/getMessageNoticeSetting',{}, null,function(res) { if(res.status == 200){ params = res.data; var html = template("setting-tmp", res.data); document.getElementById('settingPanel').innerHTML = html; mui('.mui-switch').switch(); docInfo = JSON.parse(plus.storage.getItem("docInfo")); if(docInfo.level == 2){ $("#jgs_button").show() $('.jbs_ts').show() }else{ $("#jgs_button").hide() $('.jbs_ts').hide() } }else{ mui.toast(res.msg); } plus.nativeUI.closeWaiting(); },'GET'); } //更改状态发起的请求 function updateStatus(){ sendPost('doctor/message/saveMessageNoticeSetting', {json: JSON.stringify(params)}, null,function(res) { if(res.status == 200){ }else{ mui.toast(res.msg); } plus.nativeUI.closeWaiting(); },'POST'); } //更改状态后处理的事件 function bindEvents(){ $("body").on("toggle", ".mui-switch", function(e){ var $this = $(this), name = $this.attr("data-name"); if(e.originalEvent.detail.isActive){ params[name] = 1; }else{ params[name] = 0; } updateStatus(); }) }