login.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta content="名榜" http-equiv="keywords">
  6. <meta name="description" content="名榜,wangid">
  7. <meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
  8. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  9. <title>注册页面</title>
  10. <script type="text/javascript" src="https://cdnjs.gtimg.com/cdnjs/libs/jquery/2.1.1-rc2/jquery.min.js"></script>
  11. <style>
  12. @charset "utf-8";
  13. /*重置*/
  14. body,
  15. h1,
  16. p{
  17. margin: 0;
  18. padding: 0;
  19. }
  20. input,
  21. select,
  22. form,
  23. button {
  24. border: none;
  25. margin: 0;
  26. outline: none;
  27. padding: 0;
  28. appearance: none;
  29. }
  30. h1{
  31. font-weight: normal;
  32. }
  33. img {
  34. border: none;
  35. }
  36. a {
  37. text-decoration: none;
  38. }
  39. * {
  40. font: normal 10px/100% "Helvetica Neue", Helvetica, Arial, sans-serif;
  41. }
  42. body,
  43. html {
  44. width: 100%;
  45. height: 100%;
  46. }
  47. body {
  48. background-color: #f0f0f0;
  49. }
  50. @media screen and (min-width: 320px) {
  51. html {
  52. font-size: 50px;
  53. }
  54. }
  55. @media screen and (min-width: 360px) {
  56. html {
  57. font-size: 56.25px;
  58. }
  59. }
  60. @media screen and (min-width: 375px) {
  61. html {
  62. font-size: 58.59375px;
  63. }
  64. }
  65. @media screen and (min-width: 400px) {
  66. html {
  67. font-size: 62.5px;
  68. }
  69. }
  70. @media screen and (min-width: 414px) {
  71. html {
  72. font-size: 64.6875px;
  73. }
  74. }
  75. @media screen and (min-width: 440px) {
  76. html {
  77. font-size: 68.75px;
  78. }
  79. }
  80. @media screen and (min-width: 480px) {
  81. html {
  82. font-size: 75px;
  83. }
  84. }
  85. @media screen and (min-width: 520px) {
  86. html {
  87. font-size: 81.25px;
  88. }
  89. }
  90. @media screen and (min-width: 560px) {
  91. html {
  92. font-size: 87.5px;
  93. }
  94. }
  95. @media screen and (min-width: 600px) {
  96. html {
  97. font-size: 93.75px;
  98. }
  99. }
  100. @media screen and (min-width: 640px) {
  101. html {
  102. font-size: 100px;
  103. }
  104. }
  105. @media screen and (min-width: 680px) {
  106. html {
  107. font-size: 106.25px;
  108. }
  109. }
  110. @media screen and (min-width: 720px) {
  111. html {
  112. font-size: 112.5px;
  113. }
  114. }
  115. @media screen and (min-width: 760px) {
  116. html {
  117. font-size: 118.75px;
  118. }
  119. }
  120. @media screen and (min-width: 800px) {
  121. html {
  122. font-size: 125px;
  123. }
  124. }
  125. @media screen and (min-width: 960px) {
  126. html {
  127. font-size: 150px;
  128. }
  129. }
  130. /*top*/
  131. .topbox {
  132. position: relative;
  133. text-align: left;
  134. padding: 0 2%;
  135. height: .88rem;
  136. z-index: 10;
  137. }
  138. .topmain {
  139. overflow: hidden;
  140. text-align: left;
  141. width: 90%;
  142. margin: 0 auto;
  143. }
  144. .topmain h1 {
  145. display: inline-block;
  146. font-size: .40rem;
  147. line-height: .40rem;
  148. color: #666;
  149. margin-top: 10%;
  150. }
  151. .conbox {
  152. padding: 0 2%;
  153. }
  154. .conmain {
  155. padding-bottom: 5%;
  156. }
  157. .conmain form {
  158. width: 90%;
  159. margin: 0 auto;
  160. }
  161. .conmain form>div {
  162. margin-bottom: 3%;
  163. }
  164. .conmain form>div input {
  165. width: 96%;
  166. padding: 3.6% 2%;
  167. line-height: .3rem;
  168. font-size: .26rem;
  169. border: #ccc solid 1px;
  170. border-radius: .1rem;
  171. appearance: button;
  172. -moz-appearance: button;
  173. -webkit-appearance: button;
  174. }
  175. .conmain form>div input:focus {
  176. border: #2c8fcd solid 1px;
  177. }
  178. .conmain form>div.win_yzm input {
  179. width: 56%;
  180. margin-right: 2%;
  181. vertical-align: middle;
  182. }
  183. .conmain form>div.win_yzm label {
  184. display: inline-block;
  185. vertical-align: middle;
  186. border: #ccc solid 1px;
  187. width: 36.5%;
  188. text-align: center;
  189. padding: 3.6% 0;
  190. line-height: .3rem;
  191. background-color: #fff;
  192. border-radius: .1rem;
  193. font-size: .26rem;
  194. }
  195. .conmain form button {
  196. font-size: .32rem;
  197. width: 100%;
  198. background-color: #2c8fcd;
  199. color: #fff;
  200. padding: 4% 0;
  201. border-radius: .1rem;
  202. margin-top: 5%;
  203. }
  204. /*注册*/
  205. .register h2 {
  206. color: #666;
  207. font-size: .24rem;
  208. margin: 6% 0;
  209. }
  210. .register p {
  211. margin: 2% 0;
  212. padding-top: 2%;
  213. font-size: .24rem;
  214. }
  215. .register p a {
  216. color: #2c8fcd;
  217. font-size: .24rem;
  218. }
  219. #msg{
  220. color: red;
  221. font-size: .24rem;
  222. height: .30rem;
  223. }
  224. .msg-active{
  225. color: blue !important;
  226. }
  227. </style>
  228. </head>
  229. <body>
  230. <div class="topbox">
  231. <div class="topmain">
  232. <h1>注册</h1>
  233. </div>
  234. </div>
  235. <div class="conbox">
  236. <div class="conmain register">
  237. <h2></h2>
  238. <form>
  239. <div id="msg" class="msg-active"></div>
  240. <div>
  241. <input type="text" id="phone" placeholder="请输入手机号"/>
  242. </div>
  243. <div class="win_yzm">
  244. <input type="text" id="captchaCode" placeholder="请输入验证码"/><label id="fs" class="code">发送验证码</label>
  245. </div>
  246. <div>
  247. <input type="password" id="password1" placeholder="请输入您的密码"/>
  248. </div>
  249. <div>
  250. <input type="password" id="password2" placeholder="请再次输入您的密码"/>
  251. </div>
  252. <div style="display: none;">
  253. <input type="text" id="captchaId" placeholder="id"/>
  254. </div>
  255. <div>
  256. <input type="text" placeholder="请输入邀请码" id="inviteCode" disabled="disabled" value="000000"/>
  257. </div>
  258. <p>阅读<a href="#">《用户协议及隐私政策》</a></p>
  259. <button id="submit" type="button">同意以上协议并注册</button>
  260. <p>注册完成,<a href="https://www.pgyer.com/IzWp">下载安装包</a></p>
  261. </form>
  262. </div>
  263. </div>
  264. <script type="text/javascript">
  265. //获取url中的参数
  266. function getUrlParam(name) {
  267. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  268. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  269. if (r != null) return unescape(r[2]); return null; //返回参数值
  270. }
  271. $(function(){
  272. var inviteCode = getUrlParam("code");
  273. $("#inviteCode").val(inviteCode);
  274. })
  275. $("#fs").on("click",function(){
  276. var phone = $("#phone").val();
  277. $("#msg").html("");
  278. if(phone == ""){
  279. $("#msg").html("请输入手机号!");
  280. return true;
  281. }
  282. $.ajax({
  283. type:"post",
  284. url: "/api/v1/common/send-validate?phone=" + phone,
  285. contentType: "application/json;charset=utf-8",//这个参数也是header参数
  286. headers: {
  287. "Tenant-Id": "000000",
  288. "Authorization": "Basic c3dvcmQ6c3dvcmRfc2VjcmV0"
  289. },
  290. success: function(res){
  291. var msg = res.msg;
  292. $("#msg").html(msg);
  293. $("#msg").attr("class","msg-active");
  294. if(res.code == 200){
  295. var data = res.data;
  296. var captchaId = data.id;
  297. $("#captchaId").val(captchaId);
  298. }
  299. },
  300. error: function(){
  301. $("#msg").html("网络异常,请稍等...!");
  302. }
  303. })
  304. })
  305. //请求
  306. $("#submit").on("click", function(){
  307. var inviteCode = $("#inviteCode").val();
  308. var captchaId = $("#captchaId").val();
  309. var phone = $("#phone").val();
  310. var captchaCode = $("#captchaCode").val();
  311. var password1 = $("#password1").val();
  312. var password2 = $("#password2").val();
  313. $("#msg").html("");
  314. if(phone == ""){
  315. $("#msg").html("请输入手机号!");
  316. return true;
  317. }
  318. if(captchaCode == ""){
  319. $("#msg").html("请输入验证码!");
  320. return true;
  321. }
  322. if(password1 == ""){
  323. $("#msg").html("请输入密码!");
  324. return true;
  325. }
  326. if(password2 == ""){
  327. $("#msg").html("请输入密码!");
  328. return true;
  329. }
  330. if(password1 != password2){
  331. $("#msg").html("两次输入的密码不一致!");
  332. return true;
  333. }
  334. //请求参数
  335. var param = "phone=" + phone + "&inviteCode=" + inviteCode + "&password=" + password1 + "&captchaCode=" + captchaCode + "&captchaId=" + captchaId;
  336. $.ajax({
  337. type:"post",
  338. url: "/api/v1/user-register?" + param,
  339. contentType: "application/json;charset=utf-8",//这个参数也是header参数
  340. headers: {
  341. "Tenant-Id": "000000",
  342. "Authorization": "Basic c3dvcmQ6c3dvcmRfc2VjcmV0"
  343. },
  344. success: function(res){
  345. var msg = res.msg;
  346. $("#msg").html(msg);
  347. $("#msg").attr("class","msg-active");
  348. },
  349. error: function(){
  350. $("#msg").html("注册失败,请联系管理员!");
  351. }
  352. })
  353. return true;
  354. })
  355. </script>
  356. </body>
  357. </html>