logIn.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/html">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  8. <meta name='apple-touch-fullscreen' content='yes'>
  9. <meta name="apple-mobile-web-app-capable" content="yes"/>
  10. <meta content="fullscreen=yes,preventMove=no" name="ML-Config">
  11. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  12. <meta name="renderer" content="webkit">
  13. <meta name="apple-mobile-web-app-capable" content="yes"/>
  14. <meta name="keywords" content="电子烟,关键字"/>
  15. <meta name="Description" content="网站描述"/>
  16. <title>Log in|Register</title>
  17. <link rel="stylesheet" href="/assets/index/css/common.css?t=10100">
  18. <link rel="stylesheet" href="/assets/index/css/login.css?t=101">
  19. </head>
  20. <body>
  21. <main id="main">
  22. <div class="pageContainer">
  23. <div class="pageLogo">
  24. <img src="/assets/index/asstes/icon/logo.png" alt="">
  25. </div>
  26. <section class="pageSection">
  27. <!-- 登录模块 -->
  28. <div id="loginModel">
  29. <h1 class="modelTitle">Log in</h1>
  30. <div class="modelContainer">
  31. <!-- 电子邮箱 -->
  32. <div class="modelItem">
  33. <p class="miTitle">Email Address</p>
  34. <input class="input" type="text" name="" id="userName">
  35. </div>
  36. <!-- 密码 -->
  37. <div class="modelItem">
  38. <p class="miTitle">Password</p>
  39. <input class="input" type="password" name="" id="password">
  40. </div>
  41. <a href="/index/passport/retrievePassword.html"><p class="forgotPassword">Forget Your Password?</p>
  42. </a>
  43. <!-- 登录 -->
  44. <div class="pageButton" id="loginButton">Login</div>
  45. <!-- 没有账户 -->
  46. <div class="accountTips">
  47. <p>No account?</p>
  48. <span id="toRegister">Register</span>
  49. </div>
  50. </div>
  51. </div>
  52. <!-- 注册模块 -->
  53. <div id="registerModel">
  54. <!-- 电子邮箱输入模块 -->
  55. <div id="emailInputModel">
  56. <h1 class="modelTitle">Register</h1>
  57. <div class="modelContainer">
  58. <!-- 电子邮箱地址 -->
  59. <div class="modelItem">
  60. <p class="miTitle">Email Address</p>
  61. <input class="input" type="text" name="" id="email">
  62. </div>
  63. <div class="pageButton" id="continueButton">Continue</div>
  64. <div class="accountTips">
  65. <p>Have an Account?</p>
  66. <span id="toLogin">Login</span>
  67. </div>
  68. </div>
  69. </div>
  70. <!-- 电子邮箱验证模块 -->
  71. <div id="emailVerifyModel">
  72. <h1 class="modelTitle">Verify Email Address</h1>
  73. <p class="modelTips">Captcha has been sent<span id="emailAddress"></span></p>
  74. <div class="modelContainer">
  75. <!-- 电子邮箱验证码 -->
  76. <div class="modelItem">
  77. <p class="miTitle">Captcha</p>
  78. <input class="input" type="text" name="" id="vcode">
  79. </div>
  80. <!-- 验证 -->
  81. <div class="pageButton" id="verifyButton">Verify</div>
  82. </div>
  83. </div>
  84. <!-- 设置密码 -->
  85. <div id="setPasswordModel">
  86. <h1 class="modelTitle">Password</h1>
  87. <div class="modelContainer">
  88. <!-- 设置密码 -->
  89. <div class="modelItem">
  90. <p class="miTitle">Password</p>
  91. <input class="input" type="password" name="" id="regPassword">
  92. </div>
  93. <!-- 注册 -->
  94. <div class="pageButton" id="registerButton">Register</div>
  95. </div>
  96. </div>
  97. </div>
  98. </section>
  99. </div>
  100. </main>
  101. <!-- 年龄提示层 -->
  102. <section class="maskContainer">
  103. <div class="ageReminderBox">
  104. <img class="ageReminderBack"
  105. src="https://img1.baidu.com/it/u=3449617615,1431463931&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1709485200&t=489bafcac7c5bebed91cf50c14356269"
  106. alt="">
  107. <div class="ageReminderInfo">
  108. <h3>ARE YOU OF LEAAL SMOKIND AGE?</h3>
  109. <div class="ageReminderButBox">
  110. <div class="ageRBut ageReminderNo"><span>NO</span></div>
  111. <div class="ageRBut ageReminderYes"><span>Yes, I am 21+</span></div>
  112. </div>
  113. </div>
  114. </div>
  115. </section>
  116. <!-- 吐司提示 -->
  117. <div id="toastContainer"></div>
  118. </body>
  119. <script src="/assets/index/js/jquery-1.12.0.js"></script>
  120. <script src="/assets/index/js/flexible.js"></script>
  121. <script src="/assets/index/js/public.js"></script>
  122. <script src="/assets/index/js/login.js?y=10"></script>
  123. <script>
  124. $(document).ready(function () {
  125. //用户存储token名
  126. const VAPES_TOKEN = "vapes_token"
  127. //触屏事件 || 点击事件
  128. const tap = "ontouchstart" in window ? "touchstart" : "click";
  129. /**
  130. * 吐司提示
  131. * @param message 消息
  132. * @returns
  133. */
  134. function showToast(message) {
  135. var toastElement = $('#toastContainer');
  136. toastElement.text(message);
  137. toastElement.stop(true, true).fadeIn(200).delay(2000).fadeOut(200);
  138. }
  139. //去登录
  140. $("#toLogin").on(tap, function () {
  141. $("#registerModel").hide(0)
  142. $("#loginModel").show(0)
  143. });
  144. //去注册
  145. $("#toRegister").on(tap, function () {
  146. $("#loginModel").hide(0)
  147. $("#registerModel").show(0)
  148. });
  149. //登录
  150. $("#loginButton").on(tap, function (event) {
  151. event.preventDefault();
  152. const userNameEle = $("#userName");
  153. const passwordEle = $("#password");
  154. //输入框不存在
  155. if (!userNameEle || !passwordEle) {
  156. return
  157. }
  158. //用户名
  159. const userName = userNameEle.val()
  160. //密码
  161. const password = passwordEle.val()
  162. if (!userName || userName == "") {
  163. userNameEle.focus();
  164. return
  165. }
  166. if (!password || password == "") {
  167. passwordEle.focus();
  168. return
  169. }
  170. console.log("用户名", userName)
  171. console.log("密码", password)
  172. var dp = {
  173. form: {
  174. mobile: userName,
  175. smsCode: '888888',
  176. password: password,
  177. isParty: false,
  178. partyData: []
  179. }
  180. }
  181. $.ajax({
  182. url: "/index/passport/login",
  183. headers: {platform: 'H5', storeId: 10001},
  184. dataType: 'json',
  185. data: JSON.stringify(dp),
  186. type: "POST",
  187. contentType: 'application/json',
  188. success: function (obj) {
  189. console.log(obj);
  190. //return false;
  191. //注册成功后进入
  192. if (obj.status === 200 || obj.status === '200') {
  193. showToast('Login successful')
  194. setTimeout(function () {
  195. jumpPage()
  196. }, 2000)
  197. } else {
  198. showToast(obj.message)
  199. }
  200. }
  201. })
  202. });
  203. //继续(注册)
  204. $("#continueButton").on(tap, function (event) {
  205. event.preventDefault();
  206. console.log(2)
  207. const emailEle = $("#email");
  208. //输入框不存在
  209. if (!emailEle) {
  210. return
  211. }
  212. //电子邮箱地址
  213. const email = emailEle.val()
  214. if (!email || email == "") {
  215. emailEle.focus();
  216. return
  217. }
  218. const dp = {
  219. form: {
  220. mobile: email,
  221. smsCode: "hjhjhj",
  222. isParty: false,
  223. partyData: []
  224. }
  225. };
  226. $.ajax({
  227. url: "/index/captcha/sendEmailCaptcha",
  228. headers: {platform: 'H5'},
  229. dataType: 'json',
  230. data: JSON.stringify(dp),
  231. type: "POST",
  232. contentType: 'application/json',
  233. success: function (obj) {
  234. console.log(obj);
  235. //return false;
  236. //注册成功后进入
  237. if (obj.status === 200 || obj.status === '200') {
  238. const parentElement = $(this).parent();
  239. //parentElement.hide(0)
  240. //parentElement.siblings().hide(0)
  241. $("#emailVerifyModel").show(0).siblings().hide(0)
  242. $("#emailAddress").text(email)
  243. } else {
  244. showToast('Please try again later.')
  245. }
  246. }
  247. })
  248. //验证成功后进入
  249. });
  250. //验证电子邮箱(注册)
  251. $("#verifyButton").on(tap, function (event) {
  252. event.preventDefault();
  253. const vcodeEle = $("#vcode");
  254. //输入框不存在
  255. if (!vcodeEle) {
  256. return
  257. }
  258. //验证码
  259. const vcode = vcodeEle.val()
  260. if (!vcode || vcode == "") {
  261. vcodeEle.focus();
  262. return
  263. }
  264. console.log("验证码", vcode)//checkEmailCaptcha
  265. const emailEle = $("#email");
  266. const email = emailEle.val()
  267. const dp = {
  268. mobile: email,
  269. smsCode: vcode,
  270. };
  271. $.ajax({
  272. url: "/index/captcha/checkEmailCaptcha",
  273. headers: {platform: 'H5'},
  274. dataType: 'json',
  275. data: JSON.stringify(dp),
  276. type: "POST",
  277. contentType: 'application/json',
  278. success: function (obj) {
  279. console.log(obj);
  280. //return false;
  281. //验证成功后进入
  282. if (obj.status === 200 || obj.status === '200') {
  283. const parentElement = $(this).parent();
  284. //parentElement.hide(0)
  285. //parentElement.siblings().hide(0)
  286. $("#setPasswordModel").show(0).siblings().hide(0)
  287. } else {
  288. showToast('Please try again later.')
  289. }
  290. }
  291. })
  292. });
  293. //确认注册(注册)
  294. $("#registerButton").on(tap, function (event) {
  295. event.preventDefault();
  296. const emailEle = $("#email");
  297. const vcodeEle = $("#vcode");
  298. const regPasswordEle = $("#regPassword");
  299. const email = emailEle.val()
  300. const vcode = vcodeEle.val()
  301. const password = regPasswordEle.val()
  302. if (!password || password == "") {
  303. regPasswordEle.focus();
  304. return
  305. }
  306. var dp = {
  307. form: {
  308. mobile: email,
  309. smsCode: vcode,
  310. password: password,
  311. isParty: false,
  312. partyData: []
  313. }
  314. }
  315. $.ajax({
  316. url: "/index/passport/register",
  317. headers: {platform: 'H5'},
  318. dataType: 'json',
  319. data: JSON.stringify(dp),
  320. type: "POST",
  321. contentType: 'application/json',
  322. success: function (obj) {
  323. //注册成功后进入
  324. if (obj.status === 200 || obj.status === '200') {
  325. // console.log("注册成功",obj.data.token)
  326. // localStorage.setItem(VAPES_TOKEN, obj.data.token)
  327. showToast('Register successful')
  328. setTimeout(function () {
  329. window.location.replace('/index/passport/login.html');
  330. }, 2000)
  331. } else {
  332. showToast(obj.message)
  333. }
  334. }
  335. })
  336. })
  337. function jumpPage() {
  338. const url = window.location.href;
  339. // 判断是否存在 return 参数 && 可返回上一页
  340. if (url.indexOf('return') != -1 && window.history.length > 1) {
  341. // 返回上一页
  342. window.history.back();
  343. } else {
  344. //跳转首页
  345. window.location.replace('/index/index/index.html');
  346. }
  347. }
  348. })
  349. </script>
  350. </html>