作者 LIAO

mjbsnh

正在显示 1 个修改的文件 包含 75 行增加0 行删除
  1 +// var baseUrl = 'http://kindapp.w.bronet.cn/api/';
  2 +var baseUrl = 'http://192.168.1.3/api/';
  3 +
  4 +function sendAjax(post, url, params, header, callback) {
  5 + $.ajax({
  6 + url: baseUrl + url,
  7 + method: post,
  8 + data: params,
  9 + headers: header,
  10 + success: function (res) {
  11 + callback(JSON.parse(res))
  12 + },
  13 + fail: function (err) {
  14 + console.log('error')
  15 + }
  16 + })
  17 +}
  18 +
  19 +function show() {
  20 + var current = (current + 45) % 360;
  21 + // document.getElementById('target').style.transform = 'rotate(' + current + 'deg)';
  22 + $('#target').css('transform', 'rotate(' + current + 'deg)');
  23 + console.log( $('#target').css('transform', 'rotate(' + current + 'deg)'));
  24 + $('#show_menu').toggle()
  25 +}
  26 +
  27 +function getDevice() {
  28 + var login_device = '';
  29 + var sUserAgent = navigator.userAgent.toLowerCase();
  30 + var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  31 + var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  32 + var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  33 + var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  34 + var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  35 + var bIsAndroid = sUserAgent.match(/android/i) == "android";
  36 + var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  37 + var wx = sUserAgent.match(/MicroMessenger/i) == "micromessenger"
  38 + var mac = sUserAgent.match(/macintosh|mac os x/i) == "mac"
  39 + var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  40 + if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
  41 + var UA = window.navigator.userAgent;
  42 +
  43 + isAndorid = /android/i.test(UA),
  44 + isIphone = /iphone/i.test(UA),
  45 + //isIphone = /(?:iPhone)/.test(UA),
  46 + isPad = /ipad/i.test(UA),
  47 + isDolphin = typeof dolphin !== 'undefined';
  48 + device = isAndorid ? 'android' : isIphone ? 'iphone' : isPad ? 'ipad' : mac ? 'mac' : 'mobile';
  49 + switch (device) {
  50 + case 'iphone':
  51 + login_device = device;
  52 + break;
  53 + case 'android':
  54 + login_device = device;
  55 + break;
  56 + case 'ipad':
  57 + login_device = device;
  58 + break;
  59 + default:
  60 + login_device = device;
  61 + break;
  62 + }
  63 + } else {
  64 + pc_device = wx ? 'wx' : mac ? 'mac' : 'pc';
  65 + login_device = pc_device;
  66 + }
  67 + return login_device
  68 +}
  69 +
  70 +function getUrlParam(name) {
  71 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  72 + var r = window.location.search.substr(1).match(reg); //匹配目标参数
  73 + if (r != null) return unescape(r[2]);
  74 + return null; //返回参数值
  75 +}