123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- var isManage;
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- isManage = self.isManage;
- bindEvents();
- })
- mui.back = function(){
- var self = plus.webview.currentWebview(),
- opener = self.opener();
- mui.fire(opener, "reload");
- mui.later(function(){
- self.close();
- }, 300);
- }
- function bindEvents(){
- $(".radius-input").on("input", function(){
- if($(this).prop('comstart')){
- return;
- }
- var text = $.trim($(this).val());
- if(text.length > 0){
- $(".fa-times-circle").show();
- }
- }).on('compositionstart', function(){
- $(this).prop('comstart', true);
- //console.log('中文输入:开始');
- }).on('compositionend', function(){
- $(this).prop('comstart', false);
- // console.log('中文输入:结束');
- })
-
- $(".fa-times-circle").on('click', function(){
- $(".radius-input").val("");
- $(this).hide();
- })
-
- $("#nBtn").on('click', function(){
- var text = $.trim($(".radius-input").val());
- if(text.length == 0){
- mui.toast("请输入SN码");
- return false;
- }
- //判断设备是否已经绑定了用户
- var b = /^[0-9a-zA-Z]*$/g;
- if(!b.test(text)){
- mui.toast("对不起,您输入的SN有误,请重新输入");
- return false;
- }
- checkSnBind(text);
- })
- }
- function checkSnBind(code){
- plus.nativeUI.showWaiting();
- var url = "doctor/device/getDeviceInfoByDeviceSn",
- params = {
- deviceSn: code,
- };
- sendGet(url+"?deviceSn="+code, {}, null, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- var isMultiUser = res.data.isMultiUser, //0-只有一个键,1-多个键
- bindLength = res.data.bindingInfo.length; //获取绑定信息的长度
- if((!isMultiUser && bindLength == 1) || (isMultiUser && bindLength > 1)){
- //默认最多只有两个键
- dialog({
- title: "识别提示",
- content: "设备已被绑定,是否更换绑定居民?",
- okValue: "是",
- ok: function(){
- openWebview("device-bind-info.html", {info: res.data, sn: code, isManage: isManage});
- },
- cancelValue: "否",
- cancel: function(){
-
- }
- }).showModal();
- }else{
- openWebview("device-bind-info.html", {info: res.data, sn: code, isManage: isManage});
- }
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
|