Authored by zzzzzzz

二维码登录唤醒app

  1 +require('./login/qrCheck');
1 require('./login/login'); 2 require('./login/login');
  1 +var qrCheck = {
  2 + getQuery: function(name) {
  3 + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
  4 + var r = window.location.search.substr(1).match(reg);
  5 +
  6 + if (r !== null) {
  7 + return unescape(r[2]);
  8 + }
  9 + return null;
  10 + },
  11 +
  12 + init: function() {
  13 + var ifr,
  14 + qr = this.getQuery('qrcode');
  15 +
  16 + if (qr) {
  17 + ifr = document.createElement('iframe');
  18 + ifr.src = 'yohobuy:///http://m.yohobuy.com/signin.html?qr=' + qr;
  19 + ifr.style.display = 'none';
  20 + document.body.appendChild(ifr);
  21 + window.location.href = 'yohobuy:///http://m.yohobuy.com/signin.html?qr=' + qr;
  22 + }
  23 + }
  24 +};
  25 +
  26 +qrCheck.init();