code.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>客户认证</title>
  8. <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
  9. </head>
  10. <body>
  11. <div class="body">
  12. <h2 style="margin-bottom:50px;">客户手机号认证</h2>
  13. <div style="margin-bottom: 20px;">
  14. <input id="test" name="test" type="text" placeholder="输入验证码" />
  15. </div>
  16. <div>
  17. <button id="code" style="background-color:#ffa133;">获取验证码</button>
  18. <button id="tijiao" style="background-color:#95bbff;">提交</button>
  19. </div>
  20. </div>
  21. </body>
  22. <script>
  23. //获取url中的参数
  24. function getQueryString(name) {
  25. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  26. var r = window.location.search.substr(1).match(reg);
  27. if (r != null) return unescape(r[2]); return null;
  28. }
  29. var baseurl = getQueryString("baseurl");
  30. var orderno = getQueryString("orderno");
  31. $("#code").click(function () {
  32. $.ajax({
  33. contentType: "application/json",
  34. type: "post", // 请求方式
  35. data: JSON.stringify({
  36. orderno: orderno,
  37. }),
  38. url: baseurl + "/order/yongAn/getMessage", // 请求路径
  39. dataType: "json", // 预期返回一个 json 类型数据
  40. success: function (data) { // data是形参名,代表返回的数据
  41. console.log(data)
  42. }
  43. });
  44. });
  45. $("#tijiao").click(function () {
  46. var code = $("input").val();
  47. $.ajax({
  48. contentType: "application/json",
  49. type: "post", // 请求方式
  50. data: JSON.stringify({
  51. orderno: orderno,
  52. verificationCode: code,
  53. }),
  54. url: baseurl + "/api/yongan/getPayUrl", // 请求路径
  55. dataType: "json", // 预期返回一个 json 类型数据
  56. success: function (data) { // data是形参名,代表返回的数据
  57. console.log(data)
  58. if (data.code == '200') {
  59. window.location.href = data.msg;
  60. }
  61. }
  62. });
  63. });
  64. </script>
  65. </html>
  66. <style>
  67. .body {
  68. padding: 30px;
  69. width: 100%;
  70. height: auto;
  71. box-sizing: border-box;
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. position: absolute;
  76. top: 0;
  77. left: 0;
  78. bottom: 0;
  79. right: 0;
  80. margin: auto;
  81. }
  82. input {
  83. outline-style: none;
  84. border: 1px solid #ccc;
  85. border-radius: 3px;
  86. padding: 13px 14px;
  87. width: 250px;
  88. font-size: 14px;
  89. font-weight: 700;
  90. font-family: "Microsoft soft";
  91. }
  92. input:focus {
  93. border-color: #66afe9;
  94. outline: 0;
  95. -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
  96. box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
  97. }
  98. button {
  99. border: none;
  100. width: 130px;
  101. height: 40px;
  102. border-radius: 10px;
  103. color: #fff;
  104. }
  105. </style>