查找律师
智能排序
价格
执业年限
法智帮 找律师 律所服务 消息
if(from_user){ $.post("https://sc.fzbwww.com/app/index.php?i=1&c=entry&m=ewei_shopv2&do=mobile&r=account.setlogin",{openid:from_user},function(rs,status){ },'json') } api.addEventListener({ name: 'resume' }, function(){ isBackGround.back = false; }); api.addEventListener({ name: 'pause' }, function(){ isBackGround.back = true; }); var isHomePage = 10; if(parseInt(isHomePage) == 20){ if (isshowxieyi!=1){ $('#isshowxieyi').show(); } else { $('#isshowxieyi').hide(); } $('.yes').click(function(){ $('#isshowxieyi').hide(); $api.setStorage("isshowxieyi",1); }); $('.no').click(function(){ //退出登录 $('#isshowxieyi').hide(); api.toLauncher(); }); api.sendEvent({ name: 'my_keyback' }); if (islocation==1){ } else { var permission = ['location'] var resultList = api.hasPermission({ list: permission }); if (resultList[0].granted) { // 已授权,可以继续下一步操作 } else { api.requestPermission({ list: permission, }, function(res) { if (res.list[0].granted) { // 已授权,可以继续下一步操作 //aaa(); window.location.reload() } else { $api.setStorage("islocation",1); } }); } } /* api.getLocation(function(ret, err) { if (ret && ret.status) { } else { api.hasPermission({ list: ['camera','location','storage'] }); //获取需要判断的权限 var temp = new Array(); var status = true; alert(rets); for (var obj in rets) { var granted = rets[obj].granted; var names = rets[obj].name; if (granted == false) { //alert(ret.granted); temp.push(names); status = false; } } alert(temp); if(temp){ api.requestPermission({ list:temp, code:1 }, function(ret, err){ //window.location.reload(); }); } } }); */ /**/ /*confirmPer(['camera','location','storage'],function(){ api.alert({ title: '判断完回来了。', msg: 'testmsg', }, function(ret, err){ }); }); */ } //alert(window.location.href); var regId = $api.getStorage("registrationId"); $.post("./index.php?i=1&c=entry&m=ewei_shopv2&do=mobile&r=member.bind_id",{device:regId},function(rs){}); $("#_app_qrcode").show(); $(document).on("click","#_app_qrcode",function(){ var FNScanner = api.require('FNScanner'); FNScanner.open({ autorotation: true }, function(ret, err) { if (ret) { switch(ret.eventType){ case 'cameraError': alert('访问摄像头失败'); break; case '': alert('访问相册失败'); break; case 'fail': alert('扫码失败'); break; case 'success': var msg = ret.content; var reg = /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/; msg = msg.replace("https","http"); if(reg.test(msg) && msg.indexOf('fzb') > 0){ window.location.href = msg; } } } else { alert(JSON.stringify(err)); } }); }); } /** * 判断APP是否持有该权限 * @param array one_per - 权限数组['camera','location'] */ function hasPermission(one_per) { var rets = api.hasPermission({ list: one_per }); //获取需要判断的权限 var temp = new Array(); var status = true; for (var obj in rets) { var granted = rets[obj].granted; var names = rets[obj].name; if (granted == false) { temp.push(names); status = false; } } //返回结果,和需要申请的权限 return { "status": status, "perms": temp }; } /** * 获取权限 * @param array one_per - 权限数组['camera','location'] * @param function callback - 回调函数 */ function reqPermission(one_per,callback) { api.requestPermission({ list: one_per, code: 100001 }, function(ret, err) { //获取处理结果 var list = ret.list; for (var i in list) { //只有有一项权限不足,就返回 if (list[i].granted == false) { api.toast({ msg: '权限不足,无法进行下一步操作', duration: 2000, location: 'bottom' }); return false; } } if (callback) { callback(); return; } }); } /** * 判断是否持有数组中的权限,无权限获取对应的权限 * @param array perm - 权限数组['camera','location'] * @param function callback - 回调函数 */ function confirmPer(perm, callback) { //权限类型有 //calendar日历,camera相机,contacts通讯录,location位置信息,microphone麦克风 //phone电话,sensor身体传感器,sms短信,storage存储空间,photos相册 console.log(perm); //ios系统直接跳过 if(api.systemType == 'ios'){ // callback(); // return false; } //判断多个权限是,使用 ,(英文逗号隔开) if (perm.indexOf(",") != -1) { var perms = perm.split(','); } else { var perms = new Array(perm); } //判断是否持有该数组中的权限 var has = hasPermission(perms); console.log(JSON.stringify(has)); if (!has.status) { //获取权限 reqPermission(has.perms,callback); return false; } callback(); return true; } -->