123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title></title>
- <link rel="stylesheet" type="text/css" href="./css/api.css" />
- <link rel="stylesheet" type="text/css" href="./css/style.css" />
- <style>
- body {
-
- }
- </style>
- <script>
- (function(w, d, m) {
- function r() {
- var t = 100,
- o = 750,
- e = d.documentElement.clientWidth || w.innerWidth,
- n = m.max(m.min(e, 480), 320),
- h = 50;
- 320 >= n && (h = m.floor(n / o * t * .99)),
- n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
- n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
- n > 375 && (h = m.floor(n / o * t * .97)),
- d.querySelector("html").style.fontSize = h + "px"
- };
- r();
- w.onresize = function() {
- r()
- }
- })(window, document, Math);
- </script>
- </head>
- <body>
- <div class="topbar"></div>
- <header class="back-header">
- <ul>
- <li class="padding-20 back-btn"><img class="back-header-ico" src="image/nav_button_back_default.png" /></li>
- <li class="back-header-title">验证码登录</li>
- <li class="more-btn">注册</li>
- </ul>
- </header>
- <section class="new-list">
- <div class="login-logo"><img src="image/logo2.png" /></div>
- <div style="position: relative;">
- <input class="bot-input" id="mobile" type="text" placeholder="输入手机号" />
- <div class="h5"></div>
- <input class="bot-input" id="code" type="text" placeholder="短信验证码" />
- <input class="get-code" type="button" value="获取验证码" />
- <div class="h20"></div>
- <div class="h20"></div>
- <div class="m-bottom">登 录</div>
- <div class="h20" style="height: 0.5rem;"></div>
- <div class="">
- <div class="pad-login">使用密码登录</div>
- </div>
- </div>
- <div class="h50"></div>
- </section>
- <div class="more-landing">
- <ul>
- <li> </li>
- <li style="width:70%;"><img id="qq-login" src="image/qq_login.png" style="margin-right:10px;" />
- <img id="wx-login" src="image/wx_login.png" style="margin-left:10px;" /></li>
- <li> </li>
- </ul>
- </div>
- </body>
- <script type="text/javascript" src="script/api.js"></script>
- <script type="text/javascript" src="script/jquery.min.js"></script>
- <script type="text/javascript" src="script/jquery.tap.js"></script>
- <script type="text/javascript">
- var countdown = 60;
- apiready = function() {
- setFixStatusBar();
- isinwx();
- isinqq();
- };
- $(".m-bottom").on("tap", function() {
- getRouteData();
- return false;
- })
- $(".get-code").on("tap", function() {
- var phone = $("#mobile").val();
- if(!(/^1[3456789]\d{9}$/.test(phone))){
- api.toast({ msg: '手机号不正确!' });
- return false;
- }
- if (countdown != 60) {
- return false;
- }
- $.ajax({
- url: siteurl + 'v1/entry/sms',
- data: {
- mobile: phone,
- scenes: 'login'
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- var obj = $(".get-code");
- settime(obj);
- }
- api.toast({ msg: datas.msg });
- }
- });
- return false;
- })
- function settime(obj) {
- if (countdown == 0) {
- obj.attr('disabled',false);
- obj.val("获取验证码");
- countdown = 60;
- } else {
- obj.attr('disabled',true);
- obj.val("重新发送(" + countdown + ")");
- countdown--;
- setTimeout(function() {
- settime(obj)
- }, 1000)
- }
- }
- function getRouteData() {
- var phone = $("#mobile").val();
- if(!(/^1[3456789]\d{9}$/.test(phone))){
- api.toast({ msg: '手机号不正确!' });
- return false;
- }
- $.ajax({
- url: siteurl + 'v1/entry/account',
- data: {
- account: phone,
- code: $("#code").val()
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- api.toast({ msg: datas.msg });
- if (datas.result) {
- $api.setStorage("accesstoken", datas.data.token);
- $api.setStorage("memberid", datas.data.member_id);
- $api.setStorage("storeid", datas.data.store_id);
- $api.setStorage("agent_id", datas.data.agent_id);
- dologin(datas);
- setTimeCloseWin("codelogin");
- } else {
- $api.rmStorage("storeid");
- $api.rmStorage("agent_id");
- $api.rmStorage("accesstoken");
- $api.rmStorage("memberid");
- }
- }
- });
- }
- function dologin(e) {
- // body...
- if (e.data.is_store == 1) {
- $api.rmStorage("memberid");
- $api.rmStorage("agent_id");
- api.openWin({
- name: 'hotelindex',
- url: './html/hotel/index.html',
- bounces: false
- })
- return false;
- } if (e.data.is_agent == 1) {
- $api.rmStorage("storeid");
- $api.rmStorage("memberid");
- api.openWin({
- name: 'agentindex',
- url: './html/agent/index.html',
- bounces: false
- })
- return false;
- } else {
- $api.rmStorage("agent_id");
- $api.rmStorage("storeid");
- api.openWin({
- name: 'index',
- url: 'index.html',
- bounces: false
- })
- }
- }
- $(".more-btn").on("tap", function() {
- api.openWin({
- name: 'register',
- allowEdit: true,
- url: 'register.html',
- bounces: false
- });
- setTimeCloseWin("codelogin");
- })
- $(".pad-login").on("tap", function() {
- api.closeWin();
- })
- ///
- function isinwx(){
- var wx = api.require('wx');
- wx.isInstalled(function(ret, err) {
- if (ret.installed) {
- $("#wx-login").fadeIn();
- } else {
- $("#wx-login").fadeOut();
- }
- })
- }
- function isinqq(){
- var qq = api.require('QQPlus');
- qq.installed(function(ret, err) {
- if (ret.status) {
- $("#qq-login").fadeIn();
- } else {
- $("#qq-login").fadeOut();
- }
- })
- }
- $("#wx-login").on("tap", function() {
- var wx = api.require('wx');
- wx.isInstalled(function(ret, err) {
- if (ret.installed) {
- wx.auth({
- apiKey: ''
- }, function(ret, err) {
- if (ret.status) {
- wx.getToken({
- code: ret.code
- }, function(ret, err) {
- if (ret.status) {
- $.ajax({
- url: siteurl + 'v1/entry/account',
- data: {
- openid: ret.openId,
- auth: 'wx'
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- api.toast({ msg: '登录成功!' });
- $api.setStorage("memberid", datas.data.member_id);
- $api.setStorage("accesstoken", datas.data.token);
- $api.setStorage("storeid", datas.data.store_id);
- $api.setStorage("agent_id", datas.data.agent_id);
- dologin(datas);
- setTimeCloseWin("login");
- } else {
- api.openWin({
- name: 'register',
- url: 'register.html',
- bounces: false,
- pageParam: {
- openid: ret.openId,
- auth: 'wx'
- }
- });
- $api.rmStorage("agent_id");
- $api.rmStorage("storeid");
- $api.rmStorage("accesstoken");
- $api.rmStorage("memberid");
- }
- }
- });
- } else {
- api.toast({ msg: '获取授权失败!' });
- }
- });
- } else {
- api.toast({ msg: '获取code失败!' });
- }
- });
- } else {
- api.toast({ msg: '系统没有安装微信!' });
- }
- });
- })
- ///
- $("#qq-login").on("tap", function() {
- var qq = api.require('QQPlus');
- qq.installed(function(ret, err) {
- if (ret.status) {
- qq.login(function(ret, err) {
- if (ret.openId) {
- $.ajax({
- url: siteurl + 'v1/entry/account',
- data: {
- openid: ret.openId,
- auth: 'qq'
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- api.toast({ msg: '登录成功!' });
- $api.setStorage("memberid", datas.data.member_id);
- $api.setStorage("accesstoken", datas.data.token);
- $api.setStorage("storeid", datas.data.store_id);
- $api.setStorage("agent_id", datas.data.agent_id);
- dologin(datas);
- setTimeCloseWin("login");
- } else {
- api.openWin({
- name: 'register',
- url: 'register.html',
- bounces: false,
- pageParam: {
- openid: ret.openId,
- auth: 'qq'
- }
- });
- $api.rmStorage("agent_id");
- $api.rmStorage("storeid");
- $api.rmStorage("accesstoken");
- $api.rmStorage("memberid");
- }
- }
- });
- } else {
- api.toast({ msg: '获取授权失败!' });
- }
- });
- } else {
- api.toast({ msg: "系统没有安装QQ!" });
- }
- });
- })
- var windowInnerHeight = window.innerHeight; //获取当前浏览器窗口高度
- $(window).resize(function() {
- if (window.innerHeight < windowInnerHeight) {
- $('.more-landing').css('position', 'static'); //当内部高度变小时
- } else {
- $('.more-landing').css('position', 'fixed');
- }
- });
- </script>
- </html>
|