yuantianjiao 6 years ago
parent
commit
d176718b97
2 changed files with 283 additions and 0 deletions
  1. 271
    0
      index.html
  2. 12
    0
      vconsole.min.js

+ 271
- 0
index.html View File

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

+ 12
- 0
vconsole.min.js
File diff suppressed because it is too large
View File