logIn.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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. <a href="/index/index/index.html">
  24. <div class="pageLogo">
  25. <img src="/assets/index/asstes/icon/logo.png" alt="">
  26. </div>
  27. </a>
  28. <section class="pageSection">
  29. <!-- 登录模块 -->
  30. <div id="loginModel">
  31. <h1 class="modelTitle">Sign In</h1>
  32. <div class="modelContainer">
  33. <!-- 电子邮箱 -->
  34. <div class="modelItem">
  35. <p class="miTitle">Email Address</p>
  36. <input class="input" type="text" name="" id="userName">
  37. </div>
  38. <!-- 密码 -->
  39. <div class="modelItem">
  40. <p class="miTitle">Password</p>
  41. <input class="input" type="password" name="" id="password">
  42. </div>
  43. <a href="/index/passport/retrievePassword.html"><p class="forgotPassword">Forgot Password?</p>
  44. </a>
  45. <!-- 登录 -->
  46. <div class="pageButton" id="loginButton">Sign In</div>
  47. <!-- 没有账户 -->
  48. <div class="accountTips">
  49. <p>No account? </p>
  50. <span id="toRegister">&nbsp;Sign Up</span>
  51. </div>
  52. <div class="accountTips">
  53. <p></p>
  54. <a href="/index/index/index.html" style="text-decoration: underline;"><span id="toHome1">Store Home</span></a>
  55. </div>
  56. </div>
  57. </div>
  58. <!-- 注册模块 -->
  59. <div id="registerModel">
  60. <!-- 电子邮箱输入模块 -->
  61. <div id="emailInputModel">
  62. <h1 class="modelTitle">Sign Up</h1>
  63. <div class="modelContainer">
  64. <!-- 电子邮箱地址 -->
  65. <div class="modelItem">
  66. <p class="miTitle">Email Address</p>
  67. <input class="input" type="text" name="" id="email">
  68. </div>
  69. <div class="pageButton" id="continueButton">Continue</div>
  70. <div class="accountTips">
  71. <p>Already a member?</p>
  72. <span id="toLogin">&nbsp;Sign In</span>
  73. </div>
  74. <div class="accountTips">
  75. <p></p>
  76. <a href="/index/index/index.html" style="text-decoration: underline;"><span id="toHome2">Store Home</span></a>
  77. </div>
  78. </div>
  79. </div>
  80. <!-- 电子邮箱验证模块 -->
  81. <div id="emailVerifyModel">
  82. <h1 class="modelTitle">Verify Email Address</h1>
  83. <p class="modelTips">Code has been sent to <span id="emailAddress"></span></p>
  84. <div class="modelContainer">
  85. <!-- 电子邮箱验证码 -->
  86. <div class="modelItem">
  87. <p class="miTitle">Code</p>
  88. <input class="input" type="text" name="" id="vcode">
  89. </div>
  90. <!-- 验证 -->
  91. <div class="pageButton" id="verifyButton">Verify</div>
  92. </div>
  93. </div>
  94. <!-- 设置密码 -->
  95. <div id="setPasswordModel">
  96. <h1 class="modelTitle">Password</h1>
  97. <div class="modelContainer">
  98. <!-- 设置密码 -->
  99. <div class="modelItem">
  100. <p class="miTitle">Password</p>
  101. <input class="input" type="password" name="" id="regPassword">
  102. </div>
  103. <!-- 注册 -->
  104. <div class="pageButton" id="registerButton">Register</div>
  105. </div>
  106. </div>
  107. </div>
  108. </section>
  109. </div>
  110. </main>
  111. <!-- 年龄提示层 -->
  112. <section class="maskContainer">
  113. <div class="ageReminderBox">
  114. <img class="ageReminderBack"
  115. 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"
  116. alt="">
  117. <div class="ageReminderInfo">
  118. <h3>ARE YOU OF LEAAL SMOKIND AGE?</h3>
  119. <div class="ageReminderButBox">
  120. <div class="ageRBut ageReminderNo"><span>NO</span></div>
  121. <div class="ageRBut ageReminderYes"><span>Yes, I am 21+</span></div>
  122. </div>
  123. </div>
  124. </div>
  125. </section>
  126. <!-- 吐司提示 -->
  127. <div id="toastContainer"></div>
  128. </body>
  129. <script src="/assets/index/js/jquery-1.12.0.js"></script>
  130. <script src="/assets/index/js/flexible.js"></script>
  131. <script src="/assets/index/js/public.js"></script>
  132. <script src="/assets/index/js/login.js?y=10"></script>
  133. <script>
  134. $(document).ready(function () {
  135. //用户存储token名
  136. const VAPES_TOKEN = "vapes_token"
  137. //触屏事件 || 点击事件
  138. const tap = "ontouchstart" in window ? "touchstart" : "click";
  139. /**
  140. * 吐司提示
  141. * @param message 消息
  142. * @returns
  143. */
  144. function showToast(message) {
  145. var toastElement = $('#toastContainer');
  146. toastElement.text(message);
  147. toastElement.stop(true, true).fadeIn(200).delay(2000).fadeOut(200);
  148. }
  149. //去登录
  150. $("#toLogin").on(tap, function (event) {
  151. event.preventDefault();
  152. $("#registerModel").hide(0)
  153. $("#loginModel").show(0)
  154. });
  155. //去注册
  156. $("#toRegister").on(tap, function () {
  157. $("#loginModel").hide(0)
  158. $("#registerModel").show(0)
  159. });
  160. //登录
  161. $("#loginButton").on(tap, function (event) {
  162. event.preventDefault();
  163. const userNameEle = $("#userName");
  164. const passwordEle = $("#password");
  165. //输入框不存在
  166. if (!userNameEle || !passwordEle) {
  167. return
  168. }
  169. //用户名
  170. const userName = userNameEle.val()
  171. //密码
  172. const password = passwordEle.val()
  173. if (!userName || userName == "") {
  174. userNameEle.focus();
  175. return
  176. }
  177. if (!password || password == "") {
  178. passwordEle.focus();
  179. return
  180. }
  181. console.log("用户名", userName)
  182. console.log("密码", password)
  183. var dp = {
  184. form: {
  185. mobile: userName,
  186. smsCode: '888888',
  187. password: password,
  188. isParty: false,
  189. partyData: []
  190. }
  191. }
  192. $.ajax({
  193. url: "/index/passport/login",
  194. headers: {platform: 'H5', storeId: 10001},
  195. dataType: 'json',
  196. data: JSON.stringify(dp),
  197. type: "POST",
  198. contentType: 'application/json',
  199. success: function (obj) {
  200. console.log(obj);
  201. //return false;
  202. //注册成功后进入
  203. if (obj.status === 200 || obj.status === '200') {
  204. showToast('Login successful')
  205. setTimeout(function () {
  206. //jumpPage()
  207. if (obj.data.returnUri !== ''){
  208. window.location.replace(obj.data.returnUri);
  209. }else {
  210. window.location.replace('/index/index/index.html');
  211. }
  212. }, 2000)
  213. } else {
  214. showToast(obj.message)
  215. }
  216. }
  217. })
  218. });
  219. let countdown = 60;
  220. let countdownTimer;
  221. //继续(注册)
  222. $("#continueButton").on(tap, function (event) {
  223. event.preventDefault();
  224. console.log(2)
  225. if (countdownTimer) {
  226. return;
  227. }
  228. const emailEle = $("#email");
  229. //输入框不存在
  230. if (!emailEle) {
  231. return
  232. }
  233. //电子邮箱地址
  234. const email = emailEle.val()
  235. if (!email || email == "") {
  236. emailEle.focus();
  237. return
  238. }
  239. // 点击后立即执行一次倒计时
  240. countdown = 60
  241. $(this).text(countdown + 's');
  242. countdown--;
  243. const dp = {
  244. form: {
  245. mobile: email,
  246. smsCode: "hjhjhj",
  247. isParty: false,
  248. partyData: []
  249. }
  250. };
  251. // 开始倒计时
  252. countdownTimer = setInterval(() => {
  253. if (countdown <= 0) {
  254. clearInterval(countdownTimer);
  255. countdownTimer = null;
  256. // 倒计时结束后恢复按钮状态
  257. $(this).text('Get code');
  258. } else {
  259. $(this).text(countdown + 's');
  260. countdown--;
  261. }
  262. }, 1000);
  263. $.ajax({
  264. url: "/index/captcha/sendEmailCaptcha",
  265. headers: {platform: 'H5'},
  266. dataType: 'json',
  267. data: JSON.stringify(dp),
  268. type: "POST",
  269. contentType: 'application/json',
  270. success: function (obj) {
  271. console.log(obj);
  272. //return false;
  273. //注册成功后进入
  274. if (obj.status === 200 || obj.status === '200') {
  275. showToast('Code has been sent! Please check your new mails.')
  276. const parentElement = $(this).parent();
  277. //parentElement.hide(0)
  278. //parentElement.siblings().hide(0)
  279. $("#emailVerifyModel").show(0).siblings().hide(0)
  280. $("#emailAddress").text(email)
  281. } else {
  282. showToast(obj.message)
  283. }
  284. }
  285. })
  286. //验证成功后进入
  287. });
  288. //验证电子邮箱(注册)
  289. $("#verifyButton").on(tap, function (event) {
  290. event.preventDefault();
  291. const vcodeEle = $("#vcode");
  292. //输入框不存在
  293. if (!vcodeEle) {
  294. return
  295. }
  296. //验证码
  297. const vcode = vcodeEle.val()
  298. if (!vcode || vcode == "") {
  299. vcodeEle.focus();
  300. return
  301. }
  302. console.log("验证码", vcode)//checkEmailCaptcha
  303. const emailEle = $("#email");
  304. const email = emailEle.val()
  305. const dp = {
  306. mobile: email,
  307. smsCode: vcode,
  308. };
  309. $.ajax({
  310. url: "/index/captcha/checkEmailCaptcha",
  311. headers: {platform: 'H5'},
  312. dataType: 'json',
  313. data: JSON.stringify(dp),
  314. type: "POST",
  315. contentType: 'application/json',
  316. success: function (obj) {
  317. //console.log(obj);
  318. //验证成功后进入
  319. if (obj.status === 200 || obj.status === '200') {
  320. const parentElement = $(this).parent();
  321. //parentElement.hide(0)
  322. //parentElement.siblings().hide(0)
  323. $("#setPasswordModel").show(0).siblings().hide(0)
  324. } else {
  325. showToast(obj.message)
  326. //showToast('Please try again later.')
  327. }
  328. }
  329. })
  330. });
  331. //确认注册(注册)
  332. $("#registerButton").on(tap, function (event) {
  333. event.preventDefault();
  334. const emailEle = $("#email");
  335. const vcodeEle = $("#vcode");
  336. const regPasswordEle = $("#regPassword");
  337. const email = emailEle.val()
  338. const vcode = vcodeEle.val()
  339. const password = regPasswordEle.val()
  340. if (!password || password == "") {
  341. regPasswordEle.focus();
  342. return
  343. }
  344. var dp = {
  345. form: {
  346. mobile: email,
  347. smsCode: vcode,
  348. password: password,
  349. isParty: false,
  350. partyData: []
  351. }
  352. }
  353. $.ajax({
  354. url: "/index/passport/register",
  355. headers: {platform: 'H5'},
  356. dataType: 'json',
  357. data: JSON.stringify(dp),
  358. type: "POST",
  359. contentType: 'application/json',
  360. success: function (obj) {
  361. //注册成功后进入
  362. if (obj.status === 200 || obj.status === '200') {
  363. // console.log("注册成功",obj.data.token)
  364. // localStorage.setItem(VAPES_TOKEN, obj.data.token)
  365. showToast('Register successful')
  366. setTimeout(function () {
  367. window.location.replace('/index/passport/login.html');
  368. }, 2000)
  369. } else {
  370. showToast(obj.message)
  371. }
  372. }
  373. })
  374. })
  375. function jumpPage() {
  376. const url = window.location.href;
  377. // 判断是否存在 return 参数 && 可返回上一页
  378. if (url.indexOf('return') != -1 && window.history.length > 1) {
  379. // 返回上一页
  380. window.history.back();
  381. } else {
  382. //跳转首页
  383. window.location.replace('/index/index/index.html');
  384. }
  385. }
  386. })
  387. </script>
  388. </html>