Nessuna descrizione

register.html 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no">
  7. <title>金牛记账</title>
  8. <style type="text/css">
  9. body,html{
  10. font-size: 0.16rem;
  11. }
  12. body, div, button, h3, h6, span, ul, li, p, a, input{
  13. font-family: -apple-system,SF UI Text,Helvetica Neue,Helvetica,Arial,sans-serif;
  14. padding: 0;
  15. margin: 0;
  16. box-sizing: inherit;
  17. font-weight: normal;
  18. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  19. }
  20. button{
  21. outline: none;
  22. }
  23. a, a:visited{
  24. text-decoration: none;
  25. }
  26. body{
  27. width: 100%;
  28. background:linear-gradient(180deg,rgba(255,229,0,1),rgba(255,206,17,1));
  29. padding-top: 0.42rem;
  30. }
  31. .banner{
  32. width: 3.53rem;
  33. height: 1.98rem;
  34. display: block;
  35. margin: auto;
  36. }
  37. .banner img{
  38. width: 100%;
  39. height: 100%;
  40. }
  41. .loginInput{
  42. width: 3.55rem;
  43. height: 0.5rem;
  44. display: block;
  45. background: #FFFFFF;
  46. border-radius: 0.04rem;
  47. margin: auto;
  48. }
  49. .cellPhoneNumber{
  50. width: 3.27rem;
  51. margin-top: 0.16rem;
  52. }
  53. input{
  54. padding-left: 0.28rem;
  55. border: none;
  56. outline: none;
  57. font-size: 0.15rem;
  58. color: #333333;
  59. }
  60. .loginYzm{
  61. display: -webkit-flex;
  62. display: -webkit-box;
  63. display: -moz-box;
  64. display: -ms-flexbox;
  65. display: flex;
  66. justify-content: space-between;
  67. align-items: center;
  68. margin-top: 0.1rem;
  69. margin-bottom: 0.1rem;
  70. }
  71. .yzmIpt{
  72. height: 0.5rem;
  73. width: 2.04rem;
  74. }
  75. .yzm{
  76. width: 1.22rem;
  77. line-height: 0.28rem;
  78. text-align: center;
  79. color: #DB1D1D;
  80. font-size: 0.15rem;
  81. font-weight: bold;
  82. background: #ffffff;
  83. border: none;
  84. border-left: 0.01rem solid #FFE500;
  85. outline: none;
  86. }
  87. .mima{
  88. margin-top: 0;
  89. }
  90. .register{
  91. width: 2.34rem;
  92. height: 0.5rem;
  93. margin: auto;
  94. margin-top: 0.34rem;
  95. margin-bottom: 0.5rem;
  96. background: url(../H5/register.png) no-repeat;
  97. background-size: 100%;
  98. }
  99. .share{
  100. width: 3.25rem;
  101. height: 2.66rem;
  102. display: block;
  103. margin: auto;
  104. margin-bottom: 0.25rem;
  105. }
  106. .registerMask{
  107. display: none;
  108. width: 100%;
  109. height: 100%;
  110. position: fixed;
  111. top: 0;
  112. left: 0;
  113. background: rgba(0,0,0,0.5);
  114. }
  115. .registerTost{
  116. width: 3rem;
  117. background: #FFFFFF;
  118. position: absolute;
  119. top: 30%;
  120. left: 0;
  121. right: 0;
  122. margin: auto;
  123. border-radius: 0.04rem;
  124. }
  125. .registerTost p{
  126. padding: 0 0.18rem;
  127. padding-top: 0.44rem;
  128. padding-bottom: 0.33rem;
  129. text-align: center;
  130. color: #000000;
  131. font-size: 0.16rem;
  132. }
  133. .registerTost div{
  134. color: #16B80A;
  135. font-size: 0.18rem;
  136. line-height: 0.55rem;
  137. text-align: center;
  138. border-top: 0.01rem solid #D8D8D8;
  139. }
  140. .yzmNo{
  141. color: #cccccc;
  142. }
  143. .yzmMask{
  144. width: 100%;
  145. height: 100%;
  146. background: rgba(0,0,0,0.5);
  147. position: fixed;
  148. top: 0;
  149. left: 0;
  150. display: none;
  151. }
  152. .yzmMask .con{
  153. width: 2.6rem;
  154. background: #FFFFFF;
  155. border-radius: 0.04rem;
  156. position: absolute;
  157. top: 30%;
  158. left: 0;
  159. right: 0;
  160. margin: auto;
  161. }
  162. .yzmMask .con img{
  163. width: 2rem;
  164. display: block;
  165. margin: auto;
  166. margin-top: 0.2rem;
  167. }
  168. .yzmMask .con input{
  169. height: 0.5rem;
  170. border-radius: 0.04rem;
  171. font-size: 0.15rem;
  172. border: 0.01rem solid #ccc;
  173. display: block;
  174. margin: auto;
  175. margin-top: 0.15rem;
  176. }
  177. .yesOrNo{
  178. display: flex;
  179. background: #d8d8d8;
  180. color: #666666;
  181. line-height: 0.44rem;
  182. text-align: center;
  183. border-radius: 0.04rem;
  184. margin-top: 0.15rem;
  185. }
  186. .yesOrNo div{
  187. width: 50%;
  188. }
  189. .yesOrNo div:nth-of-type(2){
  190. background: #FFCE11;
  191. color: #FFFFFF;
  192. }
  193. </style>
  194. <script type="text/javascript">
  195. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  196. window.onresize = function(){
  197. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  198. }
  199. </script>
  200. </head>
  201. <body>
  202. <div class="banner"></div>
  203. <!--<img src="" class="banner"/>-->
  204. <input class="cellPhoneNumber loginInput" id='teleNumber' type="tel" placeholder="请输入手机号"/>
  205. <div class="loginInput loginYzm">
  206. <input class="yzmIpt" placeholder="输入验证码" type="tel"/>
  207. <button class="yzm">获取验证码</button>
  208. </div>
  209. <input class="cellPhoneNumber loginInput mima" type="password" placeholder="设置密码"/>
  210. <div class="register"></div>
  211. <img src="../H5/share.png" class="share" />
  212. <div class="registerMask">
  213. <div class="registerTost">
  214. <p>恭喜您注册成功,点击 确认 下载app 就可以开启财务自由之旅啦</p>
  215. <div class="yes">确认</div>
  216. </div>
  217. </div>
  218. <div class="yzmMask">
  219. <div class="con">
  220. <div class="yzmImg">
  221. <img src="/api/V1/imgCode"/>
  222. </div>
  223. <input type="text" placeholder="请输入验证码" class="yzmImgId"/>
  224. <div class="yesOrNo">
  225. <div class="no">取消</div>
  226. <div class="yes">确定</div>
  227. </div>
  228. </div>
  229. </div>
  230. </body>
  231. </html>
  232. <script type="text/javascript" src="../jquery-2.1.0.js"></script>
  233. <script type="text/javascript">
  234. var time = 0;
  235. var timeInterval = null;
  236. // var appUrl = null;
  237. var appName = "金牛记账";
  238. var share_code = null;
  239. var zhuceFlag = false;
  240. var str=location.href; //取得整个地址栏
  241. var num=str.indexOf("?");
  242. str=str.substr(num+1); //str得到?之后的字符串
  243. var brr=str.split("&");
  244. for(var i = 0 ; i<brr.length; i++){
  245. if(brr[i].indexOf('share_code') != -1){
  246. share_code = brr[i].split('=')[1];
  247. console.log(share_code)
  248. }
  249. // if(brr[i].indexOf('appUrl') != -1){
  250. // appUrl = brr[i].split('=')[1];//appUrl
  251. // appUrl = decodeURIComponent(appUrl);
  252. // }
  253. if(brr[i].indexOf('appName') != -1){
  254. appName = brr[i].split('=')[1];//appName
  255. appName = decodeURI(appName);
  256. }
  257. }
  258. if(appName == "钱多记账"|| appName == "钱多记账钱多记账"){
  259. document.title="钱多记账"
  260. $(".banner").html(`<img src="../H5/loginBanner_qd.png"/>`)
  261. }else if (appName == "金牛记账"){
  262. document.title="金牛记账"
  263. $(".banner").html(`<img src="../H5/loginBanner.png"/>`)
  264. }
  265. //手机验证码
  266. $(".yzm").click(function () {
  267. var teleNumber = $("#teleNumber").val();
  268. var myreg=/^[0-9]{11}$/;
  269.    if (!myreg.test(teleNumber)) {
  270. //手机号码未填写及填写不正确
  271. $(".registerMask").css('display','block');
  272. $(".registerTost").find('p').html('请正确填写手机号码');
  273. }else{
  274. $(".yzmMask").css('display','block');
  275. $(".yzmImg img").attr("src",'/api/V1/imgCode?mobile=' + teleNumber + '&tmp=' + Date.parse(new Date()));
  276. $(".yzmImgId").val("");
  277. }
  278. })
  279. // 点击注册
  280. $(".register").click(function () {
  281. registerApi();
  282. })
  283. //点击确定
  284. $(".yes").click(function () {
  285. if(zhuceFlag){
  286. goApp();
  287. }
  288. document.documentElement.style.overflow='scroll';
  289. $(".registerMask").css('display','none')
  290. })
  291. //取消
  292. $(".no").click(function () {
  293. $(".yzmMask").css('display','none')
  294. })
  295. //确定 -----------
  296. $(".yesOrNo .yes").click(function () {
  297. sendCode($(".yzmImgId")[0].value,$("#teleNumber").val());
  298. $(".yzmMask").css('display','none')
  299. })
  300. //更换验证图片验证码
  301. $(".yzmImg").click(function () {
  302. $(".yzmImg img").attr("src",'/api/V1/imgCode?mobile=' + $("#teleNumber").val() + '&tmp=' + Date.parse(new Date()));
  303. $(".yzmImgId").val("")
  304. })
  305. function sendCode (imgCode,teleNumber) {
  306. $.ajax({
  307. type:"post",
  308. url:"/api/V1/h5SendCode",
  309. data: {
  310. img_code:imgCode,
  311. mobile:teleNumber,
  312. code_type:1,
  313. send_type:1
  314. },
  315. success: function (res) {
  316. if(JSON.parse(res).code == 0){
  317. time = JSON.parse(res).res.time_out;
  318. timeInterval = setInterval(timeDown,1000);
  319. }else{
  320. var msg = JSON.parse(res).message[0]
  321. $(".registerMask").css('display','block');
  322. if(msg.indexOf("img_code") != -1){
  323. msg = msg.replace('img_code', '图片验证码');
  324. }
  325. $(".registerTost").find('p').html(msg);
  326. }
  327. }
  328. });
  329. }
  330. function registerApi () {
  331. var psd = "";
  332. var msg = '';
  333. $.post(
  334. "/api/V1/register",
  335. {
  336. "mobile":$("#teleNumber").val(),
  337. "password":$(".mima").val(),
  338. "c_password":$(".mima").val(),
  339. "code":$(".yzmIpt").val(),
  340. "share_code":share_code
  341. },
  342. function(data,status){
  343. if(JSON.parse(data).code == 0){
  344. document.documentElement.style.overflow='hidden';
  345. $(".registerMask").css('display','block');
  346. $(".registerTost").find('p').html('恭喜您注册成功,点击 确认 下载app 就可以开启财务自由之旅啦');
  347. zhuceFlag = true;
  348. }else{
  349. msg = JSON.parse(data).message[0];
  350. if(msg.match("code") != undefined){
  351. msg = msg.replace('code', '验证码');
  352. }
  353. if(msg.indexOf("password")[0] != -1){
  354. msg = msg.replace('password', '密码');
  355. }
  356. $(".registerMask").css('display','block');
  357. $(".registerTost").find('p').html(msg);
  358. zhuceFlag = false;
  359. }
  360. }
  361. );
  362. }
  363. function timeDown () {
  364. $(".loginYzm .yzm").attr('disabled','true')
  365. time -- ;
  366. if(time == 0){
  367. $(".loginYzm .yzm").html('获取验证码');
  368. $(".loginYzm .yzm").removeAttr('disabled')
  369. clearInterval(timeInterval);
  370. }else{
  371. $(".loginYzm .yzm").html(time);
  372. }
  373. }
  374. function goApp () {
  375. if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
  376. if(appName == "金牛记账"){
  377. window.location.href='http://a.app.qq.com/o/simple.jsp?pkgname=com.kuxuan.jinniunote&from=singlemessage&isappinstalled=0';
  378. }else if(appName == "钱多记账"){
  379. window.location.href="https://itunes.apple.com/cn/app/%E9%92%B1%E5%A4%9A%E8%AE%B0%E8%B4%A6%E6%9C%AC-%E7%B2%BE%E8%87%B4%E7%94%9F%E6%B4%BB%E5%BF%85%E5%A4%87%E6%97%A5%E8%AE%B0%E8%B4%A6%E6%9C%AC/id1300097774?mt=8"
  380. }
  381. }
  382. if(navigator.userAgent.match(/android/i)){
  383. if(appName == "金牛记账"){
  384. window.location.href='http://android.myapp.com/myapp/detail.htm?apkName=com.kuxuan.jinniunote';
  385. }else if(appName == "钱多记账"){
  386. window.location.href="http://sj.qq.com/myapp/detail.htm?apkName=com.kuxuan.moneynote";
  387. }
  388. }
  389. }
  390. </script>