index.html 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <link rel="stylesheet" href="//at.alicdn.com/t/font_733225_6fmwc1k362l.css">
  8. <title>城的空间签到助手</title>
  9. <style>
  10. body,
  11. div,
  12. p {
  13. padding: 0;
  14. margin: 0;
  15. }
  16. html,
  17. body {
  18. font-family: PingFangSC-Regular;
  19. width: 100%;
  20. height: 100%;
  21. overflow: hidden;
  22. }
  23. .changeView {
  24. width: 100%;
  25. height: 100%;
  26. }
  27. .container {
  28. width: 100%;
  29. height: 100%;
  30. padding-top: 20%;
  31. background: #fff;
  32. display: -webkit-box;
  33. display: -ms-flexbox;
  34. display: flex;
  35. -webkit-box-orient: vertical;
  36. -webkit-box-direction: normal;
  37. -ms-flex-direction: column;
  38. flex-direction: column;
  39. -webkit-box-pack: start;
  40. -ms-flex-pack: start;
  41. justify-content: flex-start;
  42. -webkit-box-align: center;
  43. -ms-flex-align: center;
  44. align-items: center;
  45. }
  46. .icon_c {
  47. width: 100%;
  48. display: -webkit-box;
  49. display: -ms-flexbox;
  50. display: flex;
  51. -webkit-box-orient: vertical;
  52. -webkit-box-direction: normal;
  53. -ms-flex-direction: column;
  54. flex-direction: column;
  55. -webkit-box-pack: start;
  56. -ms-flex-pack: start;
  57. justify-content: flex-start;
  58. -webkit-box-align: center;
  59. -ms-flex-align: center;
  60. align-items: center;
  61. }
  62. .icon_c div {
  63. font-size: 1.8rem;
  64. color: #FF421C;
  65. }
  66. .icon_c p:nth-of-type(1) {
  67. font-size: 16px;
  68. color: #323B45;
  69. margin: 0.48rem 0 0.24rem 0;
  70. }
  71. .icon_c p:nth-of-type(2) {
  72. width: 66%;
  73. font-size: 16px;
  74. color: #404040;
  75. text-align: center;
  76. }
  77. .check_img {
  78. width: 4.0533rem;
  79. height: 4.0533rem;
  80. margin: 0.72rem 0 0.56rem 0;
  81. }
  82. .jcjy_logo {
  83. width: 2.88rem;
  84. height: 0.8rem;
  85. opacity: 0.22;
  86. }
  87. .fail {
  88. padding: 0;
  89. -webkit-box-pack: center;
  90. -ms-flex-pack: center;
  91. justify-content: center;
  92. -webkit-box-align: center;
  93. -ms-flex-align: center;
  94. align-items: center
  95. }
  96. .fail .jcjy_logo {
  97. position: absolute;
  98. bottom: 10%;
  99. left: 50%;
  100. transform: translateX(-50%);
  101. }
  102. .fail .icon_c div {
  103. color: #ccc;
  104. }
  105. .loading {
  106. width: 100%;
  107. height: 100%;
  108. background-color: #fff;
  109. position: fixed;
  110. top: 0;
  111. right: 0;
  112. left: 0;
  113. bottom: 0;
  114. z-index: 99999;
  115. display: block;
  116. }
  117. .loader {
  118. margin: 0 0 2em;
  119. height: 100px;
  120. width: 20%;
  121. text-align: center;
  122. padding: 1em;
  123. margin: 0 auto 1em;
  124. display: inline-block;
  125. vertical-align: top;
  126. position: absolute;
  127. top: 50%;
  128. left: 50%;
  129. transform: translate(-50%, -50%);
  130. }
  131. svg path,
  132. svg rect {
  133. fill: #FF6700;
  134. }
  135. </style>
  136. </head>
  137. <body>
  138. <div class="loading">
  139. <div class="loader">
  140. <svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns-xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
  141. width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xmlSpace="preserve">
  142. <path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
  143. s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
  144. c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"
  145. />
  146. <path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
  147. C22.32,8.481,24.301,9.057,26.013,10.047z">
  148. <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 20 20" to="360 20 20" dur="0.5s" repeatCount="indefinite"
  149. />
  150. </path>
  151. </svg>
  152. </div>
  153. </div>
  154. <div class="changeView" id="js_changeView">
  155. <div class="container success" style="display: none;">
  156. <div class="icon_c">
  157. <div class="iconfont icon-qunfengzhifuchenggong"></div>
  158. <p>签到成功!</p>
  159. <p>扫描下方二维码即可关注城的空间公众号,获取更多服务~</p>
  160. </div>
  161. <div class="check_img">
  162. <img src="https://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/citymini/qrcode_city.jpg" alt="" width="100%" height="100%">
  163. </div>
  164. <div class="jcjy_logo">
  165. <img src="https://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/citymini/miniLogo.png" alt="" width="100%" height="100%">
  166. </div>
  167. </div>
  168. <div class="container fail" style="display: none;">
  169. <div class="icon_c">
  170. <div class="iconfont icon-guanbi"></div>
  171. <p>签到失败!请重新扫码签到~</p>
  172. </div>
  173. <div class="jcjy_logo">
  174. <img src="https://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/citymini/miniLogo.png" alt="" width="100%" height="100%">
  175. </div>
  176. </div>
  177. </div>
  178. </body>
  179. <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
  180. <script>
  181. // cdkj
  182. // appid = wx947e3c267f20ed46
  183. var appid = {
  184. prod: 'wx947e3c267f20ed46',
  185. dev: 'wx7320287e057bbeee'
  186. }
  187. var wxModules = (function () {
  188. const wxConfig = {
  189. appid: appid.dev,
  190. redirect_uri: encodeURIComponent(window.location.href),
  191. response_type: 'code',
  192. scope: 'snsapi_base',
  193. state: '12313'
  194. }
  195. const url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + wxConfig.appid +
  196. '&redirect_uri=' +
  197. wxConfig.redirect_uri + '&response_type=' + wxConfig.response_type + '&scope=' + wxConfig.scope +
  198. '&state=' +
  199. wxConfig.state + '#wechat_redirect';
  200. // alert(url);
  201. return {
  202. wxConfig: wxConfig,
  203. url: url,
  204. checkCodeQuery: function (code) {
  205. return window.location.search.indexOf(code) > -1;
  206. },
  207. getSeacrhRequire: function (name) {
  208. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
  209. var r = window.location.href.split('?')[1]
  210. if (!r) {
  211. return
  212. } else {
  213. r = window.location.href.split('?')[1].match(reg)
  214. }
  215. if (r != null) return unescape(r[2])
  216. return null
  217. }
  218. }
  219. })()
  220. $(function () {
  221. console.log('发起了签到请求')
  222. if (!wxModules.checkCodeQuery('code')) {
  223. return window.location.assign(wxModules.url);
  224. };
  225. var $changeView = $('#js_changeView');
  226. $.ajax({
  227. method: 'POST',
  228. url: '/api/guest/MQ/case/checkin',
  229. data: {
  230. code: wxModules.getSeacrhRequire('code'),
  231. tel: wxModules.getSeacrhRequire('tel'),
  232. fieldId: wxModules.getSeacrhRequire('fieldId')
  233. }
  234. }).then(res => {
  235. $('.loading').hide();
  236. if (res.code == 200) {
  237. $changeView.find('.container').eq(0).show()
  238. } else {
  239. $changeView.find('.container').eq(1).show()
  240. }
  241. }).catch(error => {
  242. console.log('------error:', error);
  243. // alert(JSON.stringify(error.message));
  244. })
  245. })
  246. </script>
  247. </html>