login.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="./css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="./css/iconfont.css" />
  10. <link rel="stylesheet" type="text/css" href="./css/style.css" />
  11. <style>
  12. html,body{
  13. height:100%;
  14. }
  15. .bot-input {
  16. width: 95%;
  17. }
  18. .hotel-top-back {
  19. background-color: #fff;
  20. }
  21. a, a:hover, a:active, a:hover, a:visited, a:link {
  22. color: #D9251C;
  23. }
  24. </style>
  25. <script>
  26. (function(w, d, m) {
  27. function r() {
  28. var t = 100,
  29. o = 750,
  30. e = d.documentElement.clientWidth || w.innerWidth,
  31. n = m.max(m.min(e, 480), 320),
  32. h = 50;
  33. 320 >= n && (h = m.floor(n / o * t * .99)),
  34. n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
  35. n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
  36. n > 375 && (h = m.floor(n / o * t * .97)),
  37. d.querySelector("html").style.fontSize = h + "px"
  38. };
  39. r();
  40. d.querySelector("html").style.height = w.innerHeight + "px"
  41. w.onresize = function() {
  42. r()
  43. }
  44. })(window, document, Math);
  45. </script>
  46. </head>
  47. <body>
  48. <div class="topbar"></div>
  49. <header class="back-header">
  50. <ul>
  51. <li class="padding-20"><div class="hotel-top-back mask-hidden back-btn"><span class="iconfont" style="color: #000;font-size: 0.35rem;background-color: #fff;">&#xeb6a;</span></div></li>
  52. <li class="back-header-title"></li>
  53. <li class="more-btn">注册</li>
  54. </ul>
  55. </header>
  56. <section class="new-list">
  57. <div class="login-logo"><img src="image/logo2.png" /></div>
  58. <div>
  59. <input class="bot-input" id="username" type="text" placeholder="手机号/用户名" />
  60. <div class="h5"></div>
  61. <input class="bot-input" id="password" type="password" placeholder="登录密码" />
  62. <div class="h20"></div>
  63. <div class="h20"></div>
  64. <div class="m-bottom">登 录</div>
  65. <div class="h20" style="height: 0.5rem;"></div>
  66. <div class="">
  67. <div class="find-pad">找回密码</div>
  68. <div class="code-login">验证码登录</div>
  69. </div>
  70. <div class="h50"></div>
  71. </div>
  72. <div class="h50"></div>
  73. </section>
  74. <div class="setting-item" style="text-align: center;font-size: 0.28rem;border-bottom:none;position: absolute;bottom: 0.2rem;text-align: center;width: 100%;">
  75. <div>登录即代表同意<a href="javascript:go_privacy();">《用户协议》</a>和<a href="javascript:go_private();">《隐私政策》</a></div>
  76. </div>
  77. <div class="more-landing" style="bottom: 1rem;position: absolute;">
  78. <ul>
  79. <li>&nbsp;</li>
  80. <li style="width:70%;"><img id="qq-login" src="image/qq_login.png" style="margin-right: 0.15rem;" />
  81. <img id="wx-login" src="image/wx_login.png" style="margin-left: 0.15rem;" /></li>
  82. <li>&nbsp;</li>
  83. </ul>
  84. </div>
  85. </body>
  86. <script type="text/javascript" src="./script/api.js"></script>
  87. <script type="text/javascript" src="script/jquery.min.js"></script>
  88. <script type="text/javascript" src="script/jquery.tap.js"></script>
  89. <script type="text/javascript">
  90. var _isjump = false;
  91. apiready = function() {
  92. setFixStatusBar();
  93. setBackDisable();
  94. _isjump = api.pageParam.keyid;
  95. isinwx();
  96. isinqq();
  97. isjump();
  98. };
  99. $(".m-bottom").on("tap", function() {
  100. getRouteData();
  101. return false;
  102. })
  103. function isjump() {
  104. // body...
  105. if (_isjump) {
  106. $(".hotel-top-back").removeClass("mask-hidden");
  107. }
  108. }
  109. function getRouteData() {
  110. if ($("#username").val() == "" || $("#password").val() == "") {
  111. api.toast({ msg: '用户名或密码不能为空!' });
  112. return false;
  113. }
  114. $.ajax({
  115. url: siteurl + 'v1/entry/login',
  116. data: {
  117. account: $("#username").val(),
  118. pwd: $("#password").val()
  119. },
  120. dataType: 'json',
  121. type: 'post',
  122. success: function(datas) {
  123. if (datas.result) {
  124. $api.setStorage("memberid", datas.data.member_id);
  125. $api.setStorage("accesstoken", datas.data.token);
  126. $api.setStorage("storeid", datas.data.store_id);
  127. $api.setStorage("agent_id", datas.data.agent_id);
  128. dologin(datas);
  129. setTimeCloseWin("login");
  130. } else {
  131. $api.rmStorage("memberid");
  132. $api.rmStorage("accesstoken");
  133. $api.rmStorage("storeid");
  134. $api.rmStorage("agent_id");
  135. }
  136. api.toast({ msg: datas.msg });
  137. }
  138. });
  139. }
  140. function dologin(e) {
  141. // body...
  142. if (e.data.is_store == 1) {
  143. $api.rmStorage("memberid");
  144. $api.rmStorage("agent_id");
  145. api.openWin({
  146. name: 'hotelindex',
  147. url: './html/hotel/index.html',
  148. bounces: false
  149. })
  150. return false;
  151. } if (e.data.is_agent == 1) {
  152. $api.rmStorage("storeid");
  153. $api.rmStorage("memberid");
  154. api.openWin({
  155. name: 'agentindex',
  156. url: './html/agent/index.html',
  157. bounces: false
  158. })
  159. return false;
  160. } else {
  161. $api.rmStorage("agent_id");
  162. $api.rmStorage("storeid");
  163. if (_isjump) {
  164. api.closeWin();
  165. }
  166. api.openWin({
  167. name: 'index',
  168. url: 'index.html',
  169. bounces: false
  170. })
  171. return false;
  172. }
  173. }
  174. function go_privacy() {
  175. api.openWin({
  176. name: 'privacy',
  177. url: './html/my/privacy.html',
  178. bounces: false
  179. });
  180. return false;
  181. }
  182. function go_private() {
  183. api.openWin({
  184. name: 'private',
  185. url: './html/my/private.html',
  186. bounces: false
  187. });
  188. return false;
  189. }
  190. $(".find-pad").on("tap", function() {
  191. api.openWin({
  192. name: 'findpad',
  193. allowEdit: true,
  194. url: 'findpad.html',
  195. bounces: false
  196. });
  197. })
  198. $(".code-login").on("tap", function() {
  199. api.openWin({
  200. name: 'codelogin',
  201. allowEdit: true,
  202. url: 'codelogin.html',
  203. bounces: false
  204. });
  205. })
  206. $(".more-btn").on("tap", function() {
  207. api.openWin({
  208. name: 'register',
  209. allowEdit: true,
  210. url: 'register.html',
  211. bounces: false
  212. });
  213. })
  214. ///
  215. function isinwx(){
  216. var wx = api.require('wx');
  217. wx.isInstalled(function(ret, err) {
  218. if (ret.installed) {
  219. $("#wx-login").fadeIn();
  220. } else {
  221. $("#wx-login").fadeOut();
  222. }
  223. })
  224. }
  225. function isinqq(){
  226. var qq = api.require('QQPlus');
  227. qq.installed(function(ret, err) {
  228. if (ret.status) {
  229. $("#qq-login").fadeIn();
  230. } else {
  231. $("#qq-login").fadeOut();
  232. }
  233. })
  234. }
  235. $("#wx-login").on("tap", function() {
  236. var wx = api.require('wx');
  237. wx.isInstalled(function(ret, err) {
  238. if (ret.installed) {
  239. wx.auth({
  240. apiKey: ''
  241. }, function(ret, err) {
  242. if (ret.status) {
  243. wx.getToken({
  244. code: ret.code
  245. }, function(ret, err) {
  246. if (ret.status) {
  247. $.ajax({
  248. url: siteurl + 'v1/entry/account',
  249. data: {
  250. openid: ret.openId,
  251. auth: 'wx'
  252. },
  253. dataType: 'json',
  254. type: 'post',
  255. success: function(datas) {
  256. if (datas.result) {
  257. api.toast({ msg: '登录成功!' });
  258. $api.setStorage("memberid", datas.data.member_id);
  259. $api.setStorage("accesstoken", datas.data.token);
  260. $api.setStorage("storeid", datas.data.store_id);
  261. $api.setStorage("agent_id", datas.data.agent_id);
  262. dologin(datas);
  263. setTimeCloseWin("login");
  264. } else {
  265. api.openWin({
  266. name: 'register',
  267. url: 'register.html',
  268. bounces: false,
  269. pageParam: {
  270. openid: ret.openId,
  271. auth: 'wx'
  272. }
  273. });
  274. $api.rmStorage("storeid");
  275. $api.rmStorage("agent_id");
  276. $api.rmStorage("accesstoken");
  277. $api.rmStorage("memberid");
  278. }
  279. }
  280. });
  281. } else {
  282. api.toast({ msg: '获取授权失败!' });
  283. }
  284. });
  285. } else {
  286. api.toast({ msg: '获取code失败!' });
  287. }
  288. });
  289. } else {
  290. api.toast({ msg: '系统没有安装微信!' });
  291. }
  292. });
  293. })
  294. ///
  295. $("#qq-login").on("tap", function() {
  296. var qq = api.require('QQPlus');
  297. qq.installed(function(ret, err) {
  298. if (ret.status) {
  299. qq.login(function(ret, err) {
  300. if (ret.openId) {
  301. $.ajax({
  302. url: siteurl + 'v1/entry/account',
  303. data: {
  304. openid: ret.openId,
  305. auth: 'qq'
  306. },
  307. dataType: 'json',
  308. type: 'post',
  309. success: function(datas) {
  310. if (datas.result) {
  311. api.toast({ msg: '登录成功!' });
  312. $api.setStorage("memberid", datas.data.member_id);
  313. $api.setStorage("accesstoken", datas.data.token);
  314. $api.setStorage("storeid", datas.data.store_id);
  315. $api.setStorage("agent_id", datas.data.agent_id);
  316. dologin(datas);
  317. setTimeCloseWin("login");
  318. } else {
  319. api.openWin({
  320. name: 'register',
  321. url: 'register.html',
  322. bounces: false,
  323. pageParam: {
  324. openid: ret.openId,
  325. auth: 'qq'
  326. }
  327. });
  328. $api.rmStorage("storeid");
  329. $api.rmStorage("agent_id");
  330. $api.rmStorage("accesstoken");
  331. $api.rmStorage("memberid");
  332. }
  333. }
  334. });
  335. } else {
  336. api.toast({ msg: '获取授权失败!' });
  337. }
  338. });
  339. } else {
  340. api.toast({ msg: "系统没有安装QQ!" });
  341. }
  342. });
  343. })
  344. var windowInnerHeight = window.innerHeight; //获取当前浏览器窗口高度
  345. document.body.style.height = window.innerHeight + "px"
  346. $(window).resize(function() {
  347. setTimeout(function(){
  348. if (window.innerHeight < windowInnerHeight) {
  349. $('.more-landing').css('position', 'static'); //当内部高度变小时
  350. } else {
  351. $('.more-landing').css('position', 'fixed');
  352. $(".more-landing").show();
  353. $(".setting-item").show();
  354. }
  355. }, 50)
  356. });
  357. document.body.addEventListener('click', function (e) {
  358. if (e.target.type == 'textarea' || e.target.type == 'text' || e.target.type == 'password' || e.target.type == 'search') {
  359. $(".more-landing").hide();
  360. $(".setting-item").hide();
  361. }
  362. e.target.addEventListener('blur', function(){
  363. $(".more-landing").show();
  364. $(".setting-item").show();
  365. })
  366. })
  367. </script>
  368. </html>