adver.html 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
  7. <title>Title</title>
  8. </head>
  9. <body>
  10. <input type="text" id="title" value="18978059931">
  11. <input type="text" id="image" value="https://lorempixel.com/450/200/">
  12. <input type="text" id="image_group" value="https://lorempixel.com/450/200/,https://lorempixel.com/450/200/">
  13. <input type="text" id="industry" value="111">
  14. <input type="text" id="content" value="原标题:十九届中央第三轮巡视“剑指”央企">
  15. <input type="text" id="redirect" value="https://lorempixel.com/450/200/">
  16. <input type="text" id="province" value="1">
  17. <input type="text" id="city" value="35">
  18. <input type="text" id="district" value="380">
  19. <input type="text" id="start_time" value="2019-3-21 18:30:37">
  20. <input type="text" id="end_time" value="2019-3-21 18:30:40">
  21. <input type="text" id="total_num" value="1">
  22. <input type="text" id="price" value="0.01">
  23. <input type="text" id="total_price" value="0.01">
  24. <input type="text" id="guarantee" value="0">
  25. <input type="text" id="bet_uid" value="2">
  26. <input type="text" id="bet_money" value="100">
  27. <input type="text" id="bet_start_time" value="2019-3-21 18:30:56">
  28. <input type="text" id="bet_end_time" value="2019-3-21 18:31:02">
  29. <input type="text" id="is_company" value="1">
  30. <input type="text" id="company_name" value="哈哈哈有限公司">
  31. <input type="text" id="compny_industry" value="111">
  32. <input type="text" id="license" value="https://lorempixel.com/450/200/">
  33. <input type="text" id="license_number" value="12">
  34. <input type="text" id="guarantee_content" value="今天下不下雨?">
  35. <input type="text" id="pay_type" value="2">
  36. <input type="text" id="scene" value="1">
  37. <button type="botton">提交</button>
  38. </body>
  39. <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  40. <script>
  41. $("button").click(function () {
  42. $.ajax({
  43. url: 'api/adver/add',
  44. data: {
  45. title: $("#title").val(),
  46. image: $("#image").val(),
  47. image_group: $("#image_group").val(),
  48. industry: $("#industry").val(),
  49. content: $("#content").val(),
  50. redirect: $("#redirect").val(),
  51. province: $("#province").val(),
  52. city: $("#city").val(),
  53. district: $("#district").val(),
  54. start_time: $("#start_time").val(),
  55. end_time: $("#end_time").val(),
  56. total_num: $("#total_num").val(),
  57. price: $("#price").val(),
  58. total_price: $("#total_price").val(),
  59. guarantee: $("#guarantee").val(),
  60. bet_uid: $("#bet_uid").val(),
  61. bet_money: $("#bet_money").val(),
  62. bet_start_time: $("#bet_start_time").val(),
  63. bet_end_time: $("#bet_end_time").val(),
  64. is_company: $("#is_company").val(),
  65. company_name: $("#company_name").val(),
  66. company_industry: $("#compny_industry").val(),
  67. license: $("#license").val(),
  68. license_number: $("#license_number").val(),
  69. guarantee_content: $("#guarantee_content").val(),
  70. pay_type: $("#pay_type").val(),
  71. scene: $("#scene").val(),
  72. },
  73. beforeSend: function (request) {
  74. request.setRequestHeader("Authorization", 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMGRzbS53b2h1aWNuLmNvbVwvYXBpXC9sb2dpbiIsImlhdCI6MTU1NjUwMDk4OSwiZXhwIjoxNTU2NTg3Mzg5LCJuYmYiOjE1NTY1MDA5ODksImp0aSI6InAwaW5LYkFZM0hoeU5QeFYiLCJzdWIiOjIxLCJwcnYiOiJmNDFkNzc0ZjA0ZDYxM2FkYmRjYmNlN2Y2ZDcwOThiMjk3NjI5MGY4In0.gPUT-aF8u9hr2SVcMX13oDd-gnNzIDTR0H6z8UQOATk');
  75. },
  76. dataType: 'JSON',
  77. async: true,//请求是否异步,默认为异步
  78. type: 'POST',
  79. success: function (data) {
  80. console.log(data)
  81. },
  82. error: function (data) {
  83. console.log('error')
  84. $('body').append(data.responseText);
  85. $("form").attr("target", "_blank");
  86. console.log(data.responseText)
  87. }
  88. });
  89. });
  90. </script>
  91. </html>