Commit 7ecafec9d68ed0acf1a3fe4918305155c5d40a09
0 parents
init
Showing
48 changed files
with
4613 additions
and
0 deletions
Too many changes to show.
To preserve performance only 48 of 53 files are displayed.
.gitignore
0 → 100644
axios.js
0 → 100644
1 | +++ a/axios.js | |
1 | +/* axios v0.19.0-beta.1 | (c) 2018 by Matt Zabriskie */ | |
2 | +(function webpackUniversalModuleDefinition(root, factory) { | |
3 | + if(typeof exports === 'object' && typeof module === 'object') | |
4 | + module.exports = factory(); | |
5 | + else if(typeof define === 'function' && define.amd) | |
6 | + define([], factory); | |
7 | + else if(typeof exports === 'object') | |
8 | + exports["axios"] = factory(); | |
9 | + else | |
10 | + root["axios"] = factory(); | |
11 | +})(this, function() { | |
12 | +return /******/ (function(modules) { // webpackBootstrap | |
13 | +/******/ // The module cache | |
14 | +/******/ var installedModules = {}; | |
15 | +/******/ | |
16 | +/******/ // The require function | |
17 | +/******/ function __webpack_require__(moduleId) { | |
18 | +/******/ | |
19 | +/******/ // Check if module is in cache | |
20 | +/******/ if(installedModules[moduleId]) | |
21 | +/******/ return installedModules[moduleId].exports; | |
22 | +/******/ | |
23 | +/******/ // Create a new module (and put it into the cache) | |
24 | +/******/ var module = installedModules[moduleId] = { | |
25 | +/******/ exports: {}, | |
26 | +/******/ id: moduleId, | |
27 | +/******/ loaded: false | |
28 | +/******/ }; | |
29 | +/******/ | |
30 | +/******/ // Execute the module function | |
31 | +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
32 | +/******/ | |
33 | +/******/ // Flag the module as loaded | |
34 | +/******/ module.loaded = true; | |
35 | +/******/ | |
36 | +/******/ // Return the exports of the module | |
37 | +/******/ return module.exports; | |
38 | +/******/ } | |
39 | +/******/ | |
40 | +/******/ | |
41 | +/******/ // expose the modules object (__webpack_modules__) | |
42 | +/******/ __webpack_require__.m = modules; | |
43 | +/******/ | |
44 | +/******/ // expose the module cache | |
45 | +/******/ __webpack_require__.c = installedModules; | |
46 | +/******/ | |
47 | +/******/ // __webpack_public_path__ | |
48 | +/******/ __webpack_require__.p = ""; | |
49 | +/******/ | |
50 | +/******/ // Load entry module and return exports | |
51 | +/******/ return __webpack_require__(0); | |
52 | +/******/ }) | |
53 | +/************************************************************************/ | |
54 | +/******/ ([ | |
55 | +/* 0 */ | |
56 | +/***/ (function(module, exports, __webpack_require__) { | |
57 | + | |
58 | + module.exports = __webpack_require__(1); | |
59 | + | |
60 | +/***/ }), | |
61 | +/* 1 */ | |
62 | +/***/ (function(module, exports, __webpack_require__) { | |
63 | + | |
64 | + 'use strict'; | |
65 | + | |
66 | + var utils = __webpack_require__(2); | |
67 | + var bind = __webpack_require__(3); | |
68 | + var Axios = __webpack_require__(5); | |
69 | + var mergeConfig = __webpack_require__(22); | |
70 | + var defaults = __webpack_require__(11); | |
71 | + | |
72 | + /** | |
73 | + * Create an instance of Axios | |
74 | + * | |
75 | + * @param {Object} defaultConfig The default config for the instance | |
76 | + * @return {Axios} A new instance of Axios | |
77 | + */ | |
78 | + function createInstance(defaultConfig) { | |
79 | + var context = new Axios(defaultConfig); | |
80 | + var instance = bind(Axios.prototype.request, context); | |
81 | + | |
82 | + // Copy axios.prototype to instance | |
83 | + utils.extend(instance, Axios.prototype, context); | |
84 | + | |
85 | + // Copy context to instance | |
86 | + utils.extend(instance, context); | |
87 | + | |
88 | + return instance; | |
89 | + } | |
90 | + | |
91 | + // Create the default instance to be exported | |
92 | + var axios = createInstance(defaults); | |
93 | + | |
94 | + // Expose Axios class to allow class inheritance | |
95 | + axios.Axios = Axios; | |
96 | + | |
97 | + // Factory for creating new instances | |
98 | + axios.create = function create(instanceConfig) { | |
99 | + return createInstance(mergeConfig(axios.defaults, instanceConfig)); | |
100 | + }; | |
101 | + | |
102 | + // Expose Cancel & CancelToken | |
103 | + axios.Cancel = __webpack_require__(23); | |
104 | + axios.CancelToken = __webpack_require__(24); | |
105 | + axios.isCancel = __webpack_require__(10); | |
106 | + | |
107 | + // Expose all/spread | |
108 | + axios.all = function all(promises) { | |
109 | + return Promise.all(promises); | |
110 | + }; | |
111 | + axios.spread = __webpack_require__(25); | |
112 | + | |
113 | + module.exports = axios; | |
114 | + | |
115 | + // Allow use of default import syntax in TypeScript | |
116 | + module.exports.default = axios; | |
117 | + | |
118 | + | |
119 | +/***/ }), | |
120 | +/* 2 */ | |
121 | +/***/ (function(module, exports, __webpack_require__) { | |
122 | + | |
123 | + 'use strict'; | |
124 | + | |
125 | + var bind = __webpack_require__(3); | |
126 | + var isBuffer = __webpack_require__(4); | |
127 | + | |
128 | + /*global toString:true*/ | |
129 | + | |
130 | + // utils is a library of generic helper functions non-specific to axios | |
131 | + | |
132 | + var toString = Object.prototype.toString; | |
133 | + | |
134 | + /** | |
135 | + * Determine if a value is an Array | |
136 | + * | |
137 | + * @param {Object} val The value to test | |
138 | + * @returns {boolean} True if value is an Array, otherwise false | |
139 | + */ | |
140 | + function isArray(val) { | |
141 | + return toString.call(val) === '[object Array]'; | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * Determine if a value is an ArrayBuffer | |
146 | + * | |
147 | + * @param {Object} val The value to test | |
148 | + * @returns {boolean} True if value is an ArrayBuffer, otherwise false | |
149 | + */ | |
150 | + function isArrayBuffer(val) { | |
151 | + return toString.call(val) === '[object ArrayBuffer]'; | |
152 | + } | |
153 | + | |
154 | + /** | |
155 | + * Determine if a value is a FormData | |
156 | + * | |
157 | + * @param {Object} val The value to test | |
158 | + * @returns {boolean} True if value is an FormData, otherwise false | |
159 | + */ | |
160 | + function isFormData(val) { | |
161 | + return (typeof FormData !== 'undefined') && (val instanceof FormData); | |
162 | + } | |
163 | + | |
164 | + /** | |
165 | + * Determine if a value is a view on an ArrayBuffer | |
166 | + * | |
167 | + * @param {Object} val The value to test | |
168 | + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false | |
169 | + */ | |
170 | + function isArrayBufferView(val) { | |
171 | + var result; | |
172 | + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { | |
173 | + result = ArrayBuffer.isView(val); | |
174 | + } else { | |
175 | + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); | |
176 | + } | |
177 | + return result; | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * Determine if a value is a String | |
182 | + * | |
183 | + * @param {Object} val The value to test | |
184 | + * @returns {boolean} True if value is a String, otherwise false | |
185 | + */ | |
186 | + function isString(val) { | |
187 | + return typeof val === 'string'; | |
188 | + } | |
189 | + | |
190 | + /** | |
191 | + * Determine if a value is a Number | |
192 | + * | |
193 | + * @param {Object} val The value to test | |
194 | + * @returns {boolean} True if value is a Number, otherwise false | |
195 | + */ | |
196 | + function isNumber(val) { | |
197 | + return typeof val === 'number'; | |
198 | + } | |
199 | + | |
200 | + /** | |
201 | + * Determine if a value is undefined | |
202 | + * | |
203 | + * @param {Object} val The value to test | |
204 | + * @returns {boolean} True if the value is undefined, otherwise false | |
205 | + */ | |
206 | + function isUndefined(val) { | |
207 | + return typeof val === 'undefined'; | |
208 | + } | |
209 | + | |
210 | + /** | |
211 | + * Determine if a value is an Object | |
212 | + * | |
213 | + * @param {Object} val The value to test | |
214 | + * @returns {boolean} True if value is an Object, otherwise false | |
215 | + */ | |
216 | + function isObject(val) { | |
217 | + return val !== null && typeof val === 'object'; | |
218 | + } | |
219 | + | |
220 | + /** | |
221 | + * Determine if a value is a Date | |
222 | + * | |
223 | + * @param {Object} val The value to test | |
224 | + * @returns {boolean} True if value is a Date, otherwise false | |
225 | + */ | |
226 | + function isDate(val) { | |
227 | + return toString.call(val) === '[object Date]'; | |
228 | + } | |
229 | + | |
230 | + /** | |
231 | + * Determine if a value is a File | |
232 | + * | |
233 | + * @param {Object} val The value to test | |
234 | + * @returns {boolean} True if value is a File, otherwise false | |
235 | + */ | |
236 | + function isFile(val) { | |
237 | + return toString.call(val) === '[object File]'; | |
238 | + } | |
239 | + | |
240 | + /** | |
241 | + * Determine if a value is a Blob | |
242 | + * | |
243 | + * @param {Object} val The value to test | |
244 | + * @returns {boolean} True if value is a Blob, otherwise false | |
245 | + */ | |
246 | + function isBlob(val) { | |
247 | + return toString.call(val) === '[object Blob]'; | |
248 | + } | |
249 | + | |
250 | + /** | |
251 | + * Determine if a value is a Function | |
252 | + * | |
253 | + * @param {Object} val The value to test | |
254 | + * @returns {boolean} True if value is a Function, otherwise false | |
255 | + */ | |
256 | + function isFunction(val) { | |
257 | + return toString.call(val) === '[object Function]'; | |
258 | + } | |
259 | + | |
260 | + /** | |
261 | + * Determine if a value is a Stream | |
262 | + * | |
263 | + * @param {Object} val The value to test | |
264 | + * @returns {boolean} True if value is a Stream, otherwise false | |
265 | + */ | |
266 | + function isStream(val) { | |
267 | + return isObject(val) && isFunction(val.pipe); | |
268 | + } | |
269 | + | |
270 | + /** | |
271 | + * Determine if a value is a URLSearchParams object | |
272 | + * | |
273 | + * @param {Object} val The value to test | |
274 | + * @returns {boolean} True if value is a URLSearchParams object, otherwise false | |
275 | + */ | |
276 | + function isURLSearchParams(val) { | |
277 | + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; | |
278 | + } | |
279 | + | |
280 | + /** | |
281 | + * Trim excess whitespace off the beginning and end of a string | |
282 | + * | |
283 | + * @param {String} str The String to trim | |
284 | + * @returns {String} The String freed of excess whitespace | |
285 | + */ | |
286 | + function trim(str) { | |
287 | + return str.replace(/^\s*/, '').replace(/\s*$/, ''); | |
288 | + } | |
289 | + | |
290 | + /** | |
291 | + * Determine if we're running in a standard browser environment | |
292 | + * | |
293 | + * This allows axios to run in a web worker, and react-native. | |
294 | + * Both environments support XMLHttpRequest, but not fully standard globals. | |
295 | + * | |
296 | + * web workers: | |
297 | + * typeof window -> undefined | |
298 | + * typeof document -> undefined | |
299 | + * | |
300 | + * react-native: | |
301 | + * navigator.product -> 'ReactNative' | |
302 | + * nativescript | |
303 | + * navigator.product -> 'NativeScript' or 'NS' | |
304 | + */ | |
305 | + function isStandardBrowserEnv() { | |
306 | + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || | |
307 | + navigator.product === 'NativeScript' || | |
308 | + navigator.product === 'NS')) { | |
309 | + return false; | |
310 | + } | |
311 | + return ( | |
312 | + typeof window !== 'undefined' && | |
313 | + typeof document !== 'undefined' | |
314 | + ); | |
315 | + } | |
316 | + | |
317 | + /** | |
318 | + * Iterate over an Array or an Object invoking a function for each item. | |
319 | + * | |
320 | + * If `obj` is an Array callback will be called passing | |
321 | + * the value, index, and complete array for each item. | |
322 | + * | |
323 | + * If 'obj' is an Object callback will be called passing | |
324 | + * the value, key, and complete object for each property. | |
325 | + * | |
326 | + * @param {Object|Array} obj The object to iterate | |
327 | + * @param {Function} fn The callback to invoke for each item | |
328 | + */ | |
329 | + function forEach(obj, fn) { | |
330 | + // Don't bother if no value provided | |
331 | + if (obj === null || typeof obj === 'undefined') { | |
332 | + return; | |
333 | + } | |
334 | + | |
335 | + // Force an array if not already something iterable | |
336 | + if (typeof obj !== 'object') { | |
337 | + /*eslint no-param-reassign:0*/ | |
338 | + obj = [obj]; | |
339 | + } | |
340 | + | |
341 | + if (isArray(obj)) { | |
342 | + // Iterate over array values | |
343 | + for (var i = 0, l = obj.length; i < l; i++) { | |
344 | + fn.call(null, obj[i], i, obj); | |
345 | + } | |
346 | + } else { | |
347 | + // Iterate over object keys | |
348 | + for (var key in obj) { | |
349 | + if (Object.prototype.hasOwnProperty.call(obj, key)) { | |
350 | + fn.call(null, obj[key], key, obj); | |
351 | + } | |
352 | + } | |
353 | + } | |
354 | + } | |
355 | + | |
356 | + /** | |
357 | + * Accepts varargs expecting each argument to be an object, then | |
358 | + * immutably merges the properties of each object and returns result. | |
359 | + * | |
360 | + * When multiple objects contain the same key the later object in | |
361 | + * the arguments list will take precedence. | |
362 | + * | |
363 | + * Example: | |
364 | + * | |
365 | + * ```js | |
366 | + * var result = merge({foo: 123}, {foo: 456}); | |
367 | + * console.log(result.foo); // outputs 456 | |
368 | + * ``` | |
369 | + * | |
370 | + * @param {Object} obj1 Object to merge | |
371 | + * @returns {Object} Result of all merge properties | |
372 | + */ | |
373 | + function merge(/* obj1, obj2, obj3, ... */) { | |
374 | + var result = {}; | |
375 | + function assignValue(val, key) { | |
376 | + if (typeof result[key] === 'object' && typeof val === 'object') { | |
377 | + result[key] = merge(result[key], val); | |
378 | + } else { | |
379 | + result[key] = val; | |
380 | + } | |
381 | + } | |
382 | + | |
383 | + for (var i = 0, l = arguments.length; i < l; i++) { | |
384 | + forEach(arguments[i], assignValue); | |
385 | + } | |
386 | + return result; | |
387 | + } | |
388 | + | |
389 | + /** | |
390 | + * Function equal to merge with the difference being that no reference | |
391 | + * to original objects is kept. | |
392 | + * | |
393 | + * @see merge | |
394 | + * @param {Object} obj1 Object to merge | |
395 | + * @returns {Object} Result of all merge properties | |
396 | + */ | |
397 | + function deepMerge(/* obj1, obj2, obj3, ... */) { | |
398 | + var result = {}; | |
399 | + function assignValue(val, key) { | |
400 | + if (typeof result[key] === 'object' && typeof val === 'object') { | |
401 | + result[key] = deepMerge(result[key], val); | |
402 | + } else if (typeof val === 'object') { | |
403 | + result[key] = deepMerge({}, val); | |
404 | + } else { | |
405 | + result[key] = val; | |
406 | + } | |
407 | + } | |
408 | + | |
409 | + for (var i = 0, l = arguments.length; i < l; i++) { | |
410 | + forEach(arguments[i], assignValue); | |
411 | + } | |
412 | + return result; | |
413 | + } | |
414 | + | |
415 | + /** | |
416 | + * Extends object a by mutably adding to it the properties of object b. | |
417 | + * | |
418 | + * @param {Object} a The object to be extended | |
419 | + * @param {Object} b The object to copy properties from | |
420 | + * @param {Object} thisArg The object to bind function to | |
421 | + * @return {Object} The resulting value of object a | |
422 | + */ | |
423 | + function extend(a, b, thisArg) { | |
424 | + forEach(b, function assignValue(val, key) { | |
425 | + if (thisArg && typeof val === 'function') { | |
426 | + a[key] = bind(val, thisArg); | |
427 | + } else { | |
428 | + a[key] = val; | |
429 | + } | |
430 | + }); | |
431 | + return a; | |
432 | + } | |
433 | + | |
434 | + module.exports = { | |
435 | + isArray: isArray, | |
436 | + isArrayBuffer: isArrayBuffer, | |
437 | + isBuffer: isBuffer, | |
438 | + isFormData: isFormData, | |
439 | + isArrayBufferView: isArrayBufferView, | |
440 | + isString: isString, | |
441 | + isNumber: isNumber, | |
442 | + isObject: isObject, | |
443 | + isUndefined: isUndefined, | |
444 | + isDate: isDate, | |
445 | + isFile: isFile, | |
446 | + isBlob: isBlob, | |
447 | + isFunction: isFunction, | |
448 | + isStream: isStream, | |
449 | + isURLSearchParams: isURLSearchParams, | |
450 | + isStandardBrowserEnv: isStandardBrowserEnv, | |
451 | + forEach: forEach, | |
452 | + merge: merge, | |
453 | + deepMerge: deepMerge, | |
454 | + extend: extend, | |
455 | + trim: trim | |
456 | + }; | |
457 | + | |
458 | + | |
459 | +/***/ }), | |
460 | +/* 3 */ | |
461 | +/***/ (function(module, exports) { | |
462 | + | |
463 | + 'use strict'; | |
464 | + | |
465 | + module.exports = function bind(fn, thisArg) { | |
466 | + return function wrap() { | |
467 | + var args = new Array(arguments.length); | |
468 | + for (var i = 0; i < args.length; i++) { | |
469 | + args[i] = arguments[i]; | |
470 | + } | |
471 | + return fn.apply(thisArg, args); | |
472 | + }; | |
473 | + }; | |
474 | + | |
475 | + | |
476 | +/***/ }), | |
477 | +/* 4 */ | |
478 | +/***/ (function(module, exports) { | |
479 | + | |
480 | + /*! | |
481 | + * Determine if an object is a Buffer | |
482 | + * | |
483 | + * @author Feross Aboukhadijeh <https://feross.org> | |
484 | + * @license MIT | |
485 | + */ | |
486 | + | |
487 | + module.exports = function isBuffer (obj) { | |
488 | + return obj != null && obj.constructor != null && | |
489 | + typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) | |
490 | + } | |
491 | + | |
492 | + | |
493 | +/***/ }), | |
494 | +/* 5 */ | |
495 | +/***/ (function(module, exports, __webpack_require__) { | |
496 | + | |
497 | + 'use strict'; | |
498 | + | |
499 | + var utils = __webpack_require__(2); | |
500 | + var buildURL = __webpack_require__(6); | |
501 | + var InterceptorManager = __webpack_require__(7); | |
502 | + var dispatchRequest = __webpack_require__(8); | |
503 | + var mergeConfig = __webpack_require__(22); | |
504 | + | |
505 | + /** | |
506 | + * Create a new instance of Axios | |
507 | + * | |
508 | + * @param {Object} instanceConfig The default config for the instance | |
509 | + */ | |
510 | + function Axios(instanceConfig) { | |
511 | + this.defaults = instanceConfig; | |
512 | + this.interceptors = { | |
513 | + request: new InterceptorManager(), | |
514 | + response: new InterceptorManager() | |
515 | + }; | |
516 | + } | |
517 | + | |
518 | + /** | |
519 | + * Dispatch a request | |
520 | + * | |
521 | + * @param {Object} config The config specific for this request (merged with this.defaults) | |
522 | + */ | |
523 | + Axios.prototype.request = function request(config) { | |
524 | + /*eslint no-param-reassign:0*/ | |
525 | + // Allow for axios('example/url'[, config]) a la fetch API | |
526 | + if (typeof config === 'string') { | |
527 | + config = arguments[1] || {}; | |
528 | + config.url = arguments[0]; | |
529 | + } else { | |
530 | + config = config || {}; | |
531 | + } | |
532 | + | |
533 | + config = mergeConfig(this.defaults, config); | |
534 | + config.method = config.method ? config.method.toLowerCase() : 'get'; | |
535 | + | |
536 | + // Hook up interceptors middleware | |
537 | + var chain = [dispatchRequest, undefined]; | |
538 | + var promise = Promise.resolve(config); | |
539 | + | |
540 | + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { | |
541 | + chain.unshift(interceptor.fulfilled, interceptor.rejected); | |
542 | + }); | |
543 | + | |
544 | + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { | |
545 | + chain.push(interceptor.fulfilled, interceptor.rejected); | |
546 | + }); | |
547 | + | |
548 | + while (chain.length) { | |
549 | + promise = promise.then(chain.shift(), chain.shift()); | |
550 | + } | |
551 | + | |
552 | + return promise; | |
553 | + }; | |
554 | + | |
555 | + Axios.prototype.getUri = function getUri(config) { | |
556 | + config = mergeConfig(this.defaults, config); | |
557 | + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); | |
558 | + }; | |
559 | + | |
560 | + // Provide aliases for supported request methods | |
561 | + utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { | |
562 | + /*eslint func-names:0*/ | |
563 | + Axios.prototype[method] = function(url, config) { | |
564 | + return this.request(utils.merge(config || {}, { | |
565 | + method: method, | |
566 | + url: url | |
567 | + })); | |
568 | + }; | |
569 | + }); | |
570 | + | |
571 | + utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | |
572 | + /*eslint func-names:0*/ | |
573 | + Axios.prototype[method] = function(url, data, config) { | |
574 | + return this.request(utils.merge(config || {}, { | |
575 | + method: method, | |
576 | + url: url, | |
577 | + data: data | |
578 | + })); | |
579 | + }; | |
580 | + }); | |
581 | + | |
582 | + module.exports = Axios; | |
583 | + | |
584 | + | |
585 | +/***/ }), | |
586 | +/* 6 */ | |
587 | +/***/ (function(module, exports, __webpack_require__) { | |
588 | + | |
589 | + 'use strict'; | |
590 | + | |
591 | + var utils = __webpack_require__(2); | |
592 | + | |
593 | + function encode(val) { | |
594 | + return encodeURIComponent(val). | |
595 | + replace(/%40/gi, '@'). | |
596 | + replace(/%3A/gi, ':'). | |
597 | + replace(/%24/g, '$'). | |
598 | + replace(/%2C/gi, ','). | |
599 | + replace(/%20/g, '+'). | |
600 | + replace(/%5B/gi, '['). | |
601 | + replace(/%5D/gi, ']'); | |
602 | + } | |
603 | + | |
604 | + /** | |
605 | + * Build a URL by appending params to the end | |
606 | + * | |
607 | + * @param {string} url The base of the url (e.g., http://www.google.com) | |
608 | + * @param {object} [params] The params to be appended | |
609 | + * @returns {string} The formatted url | |
610 | + */ | |
611 | + module.exports = function buildURL(url, params, paramsSerializer) { | |
612 | + /*eslint no-param-reassign:0*/ | |
613 | + if (!params) { | |
614 | + return url; | |
615 | + } | |
616 | + | |
617 | + var serializedParams; | |
618 | + if (paramsSerializer) { | |
619 | + serializedParams = paramsSerializer(params); | |
620 | + } else if (utils.isURLSearchParams(params)) { | |
621 | + serializedParams = params.toString(); | |
622 | + } else { | |
623 | + var parts = []; | |
624 | + | |
625 | + utils.forEach(params, function serialize(val, key) { | |
626 | + if (val === null || typeof val === 'undefined') { | |
627 | + return; | |
628 | + } | |
629 | + | |
630 | + if (utils.isArray(val)) { | |
631 | + key = key + '[]'; | |
632 | + } else { | |
633 | + val = [val]; | |
634 | + } | |
635 | + | |
636 | + utils.forEach(val, function parseValue(v) { | |
637 | + if (utils.isDate(v)) { | |
638 | + v = v.toISOString(); | |
639 | + } else if (utils.isObject(v)) { | |
640 | + v = JSON.stringify(v); | |
641 | + } | |
642 | + parts.push(encode(key) + '=' + encode(v)); | |
643 | + }); | |
644 | + }); | |
645 | + | |
646 | + serializedParams = parts.join('&'); | |
647 | + } | |
648 | + | |
649 | + if (serializedParams) { | |
650 | + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; | |
651 | + } | |
652 | + | |
653 | + return url; | |
654 | + }; | |
655 | + | |
656 | + | |
657 | +/***/ }), | |
658 | +/* 7 */ | |
659 | +/***/ (function(module, exports, __webpack_require__) { | |
660 | + | |
661 | + 'use strict'; | |
662 | + | |
663 | + var utils = __webpack_require__(2); | |
664 | + | |
665 | + function InterceptorManager() { | |
666 | + this.handlers = []; | |
667 | + } | |
668 | + | |
669 | + /** | |
670 | + * Add a new interceptor to the stack | |
671 | + * | |
672 | + * @param {Function} fulfilled The function to handle `then` for a `Promise` | |
673 | + * @param {Function} rejected The function to handle `reject` for a `Promise` | |
674 | + * | |
675 | + * @return {Number} An ID used to remove interceptor later | |
676 | + */ | |
677 | + InterceptorManager.prototype.use = function use(fulfilled, rejected) { | |
678 | + this.handlers.push({ | |
679 | + fulfilled: fulfilled, | |
680 | + rejected: rejected | |
681 | + }); | |
682 | + return this.handlers.length - 1; | |
683 | + }; | |
684 | + | |
685 | + /** | |
686 | + * Remove an interceptor from the stack | |
687 | + * | |
688 | + * @param {Number} id The ID that was returned by `use` | |
689 | + */ | |
690 | + InterceptorManager.prototype.eject = function eject(id) { | |
691 | + if (this.handlers[id]) { | |
692 | + this.handlers[id] = null; | |
693 | + } | |
694 | + }; | |
695 | + | |
696 | + /** | |
697 | + * Iterate over all the registered interceptors | |
698 | + * | |
699 | + * This method is particularly useful for skipping over any | |
700 | + * interceptors that may have become `null` calling `eject`. | |
701 | + * | |
702 | + * @param {Function} fn The function to call for each interceptor | |
703 | + */ | |
704 | + InterceptorManager.prototype.forEach = function forEach(fn) { | |
705 | + utils.forEach(this.handlers, function forEachHandler(h) { | |
706 | + if (h !== null) { | |
707 | + fn(h); | |
708 | + } | |
709 | + }); | |
710 | + }; | |
711 | + | |
712 | + module.exports = InterceptorManager; | |
713 | + | |
714 | + | |
715 | +/***/ }), | |
716 | +/* 8 */ | |
717 | +/***/ (function(module, exports, __webpack_require__) { | |
718 | + | |
719 | + 'use strict'; | |
720 | + | |
721 | + var utils = __webpack_require__(2); | |
722 | + var transformData = __webpack_require__(9); | |
723 | + var isCancel = __webpack_require__(10); | |
724 | + var defaults = __webpack_require__(11); | |
725 | + var isAbsoluteURL = __webpack_require__(20); | |
726 | + var combineURLs = __webpack_require__(21); | |
727 | + | |
728 | + /** | |
729 | + * Throws a `Cancel` if cancellation has been requested. | |
730 | + */ | |
731 | + function throwIfCancellationRequested(config) { | |
732 | + if (config.cancelToken) { | |
733 | + config.cancelToken.throwIfRequested(); | |
734 | + } | |
735 | + } | |
736 | + | |
737 | + /** | |
738 | + * Dispatch a request to the server using the configured adapter. | |
739 | + * | |
740 | + * @param {object} config The config that is to be used for the request | |
741 | + * @returns {Promise} The Promise to be fulfilled | |
742 | + */ | |
743 | + module.exports = function dispatchRequest(config) { | |
744 | + throwIfCancellationRequested(config); | |
745 | + | |
746 | + // Support baseURL config | |
747 | + if (config.baseURL && !isAbsoluteURL(config.url)) { | |
748 | + config.url = combineURLs(config.baseURL, config.url); | |
749 | + } | |
750 | + | |
751 | + // Ensure headers exist | |
752 | + config.headers = config.headers || {}; | |
753 | + | |
754 | + // Transform request data | |
755 | + config.data = transformData( | |
756 | + config.data, | |
757 | + config.headers, | |
758 | + config.transformRequest | |
759 | + ); | |
760 | + | |
761 | + // Flatten headers | |
762 | + config.headers = utils.merge( | |
763 | + config.headers.common || {}, | |
764 | + config.headers[config.method] || {}, | |
765 | + config.headers || {} | |
766 | + ); | |
767 | + | |
768 | + utils.forEach( | |
769 | + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], | |
770 | + function cleanHeaderConfig(method) { | |
771 | + delete config.headers[method]; | |
772 | + } | |
773 | + ); | |
774 | + | |
775 | + var adapter = config.adapter || defaults.adapter; | |
776 | + | |
777 | + return adapter(config).then(function onAdapterResolution(response) { | |
778 | + throwIfCancellationRequested(config); | |
779 | + | |
780 | + // Transform response data | |
781 | + response.data = transformData( | |
782 | + response.data, | |
783 | + response.headers, | |
784 | + config.transformResponse | |
785 | + ); | |
786 | + | |
787 | + return response; | |
788 | + }, function onAdapterRejection(reason) { | |
789 | + if (!isCancel(reason)) { | |
790 | + throwIfCancellationRequested(config); | |
791 | + | |
792 | + // Transform response data | |
793 | + if (reason && reason.response) { | |
794 | + reason.response.data = transformData( | |
795 | + reason.response.data, | |
796 | + reason.response.headers, | |
797 | + config.transformResponse | |
798 | + ); | |
799 | + } | |
800 | + } | |
801 | + | |
802 | + return Promise.reject(reason); | |
803 | + }); | |
804 | + }; | |
805 | + | |
806 | + | |
807 | +/***/ }), | |
808 | +/* 9 */ | |
809 | +/***/ (function(module, exports, __webpack_require__) { | |
810 | + | |
811 | + 'use strict'; | |
812 | + | |
813 | + var utils = __webpack_require__(2); | |
814 | + | |
815 | + /** | |
816 | + * Transform the data for a request or a response | |
817 | + * | |
818 | + * @param {Object|String} data The data to be transformed | |
819 | + * @param {Array} headers The headers for the request or response | |
820 | + * @param {Array|Function} fns A single function or Array of functions | |
821 | + * @returns {*} The resulting transformed data | |
822 | + */ | |
823 | + module.exports = function transformData(data, headers, fns) { | |
824 | + /*eslint no-param-reassign:0*/ | |
825 | + utils.forEach(fns, function transform(fn) { | |
826 | + data = fn(data, headers); | |
827 | + }); | |
828 | + | |
829 | + return data; | |
830 | + }; | |
831 | + | |
832 | + | |
833 | +/***/ }), | |
834 | +/* 10 */ | |
835 | +/***/ (function(module, exports) { | |
836 | + | |
837 | + 'use strict'; | |
838 | + | |
839 | + module.exports = function isCancel(value) { | |
840 | + return !!(value && value.__CANCEL__); | |
841 | + }; | |
842 | + | |
843 | + | |
844 | +/***/ }), | |
845 | +/* 11 */ | |
846 | +/***/ (function(module, exports, __webpack_require__) { | |
847 | + | |
848 | + 'use strict'; | |
849 | + | |
850 | + var utils = __webpack_require__(2); | |
851 | + var normalizeHeaderName = __webpack_require__(12); | |
852 | + | |
853 | + var DEFAULT_CONTENT_TYPE = { | |
854 | + 'Content-Type': 'application/x-www-form-urlencoded' | |
855 | + }; | |
856 | + | |
857 | + function setContentTypeIfUnset(headers, value) { | |
858 | + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { | |
859 | + headers['Content-Type'] = value; | |
860 | + } | |
861 | + } | |
862 | + | |
863 | + function getDefaultAdapter() { | |
864 | + var adapter; | |
865 | + // Only Node.JS has a process variable that is of [[Class]] process | |
866 | + if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { | |
867 | + // For node use HTTP adapter | |
868 | + adapter = __webpack_require__(13); | |
869 | + } else if (typeof XMLHttpRequest !== 'undefined') { | |
870 | + // For browsers use XHR adapter | |
871 | + adapter = __webpack_require__(13); | |
872 | + } | |
873 | + return adapter; | |
874 | + } | |
875 | + | |
876 | + var defaults = { | |
877 | + adapter: getDefaultAdapter(), | |
878 | + | |
879 | + transformRequest: [function transformRequest(data, headers) { | |
880 | + normalizeHeaderName(headers, 'Accept'); | |
881 | + normalizeHeaderName(headers, 'Content-Type'); | |
882 | + if (utils.isFormData(data) || | |
883 | + utils.isArrayBuffer(data) || | |
884 | + utils.isBuffer(data) || | |
885 | + utils.isStream(data) || | |
886 | + utils.isFile(data) || | |
887 | + utils.isBlob(data) | |
888 | + ) { | |
889 | + return data; | |
890 | + } | |
891 | + if (utils.isArrayBufferView(data)) { | |
892 | + return data.buffer; | |
893 | + } | |
894 | + if (utils.isURLSearchParams(data)) { | |
895 | + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); | |
896 | + return data.toString(); | |
897 | + } | |
898 | + if (utils.isObject(data)) { | |
899 | + setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); | |
900 | + return JSON.stringify(data); | |
901 | + } | |
902 | + return data; | |
903 | + }], | |
904 | + | |
905 | + transformResponse: [function transformResponse(data) { | |
906 | + /*eslint no-param-reassign:0*/ | |
907 | + if (typeof data === 'string') { | |
908 | + try { | |
909 | + data = JSON.parse(data); | |
910 | + } catch (e) { /* Ignore */ } | |
911 | + } | |
912 | + return data; | |
913 | + }], | |
914 | + | |
915 | + /** | |
916 | + * A timeout in milliseconds to abort a request. If set to 0 (default) a | |
917 | + * timeout is not created. | |
918 | + */ | |
919 | + timeout: 0, | |
920 | + | |
921 | + xsrfCookieName: 'XSRF-TOKEN', | |
922 | + xsrfHeaderName: 'X-XSRF-TOKEN', | |
923 | + | |
924 | + maxContentLength: -1, | |
925 | + | |
926 | + validateStatus: function validateStatus(status) { | |
927 | + return status >= 200 && status < 300; | |
928 | + } | |
929 | + }; | |
930 | + | |
931 | + defaults.headers = { | |
932 | + common: { | |
933 | + 'Accept': 'application/json, text/plain, */*' | |
934 | + } | |
935 | + }; | |
936 | + | |
937 | + utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { | |
938 | + defaults.headers[method] = {}; | |
939 | + }); | |
940 | + | |
941 | + utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | |
942 | + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); | |
943 | + }); | |
944 | + | |
945 | + module.exports = defaults; | |
946 | + | |
947 | + | |
948 | +/***/ }), | |
949 | +/* 12 */ | |
950 | +/***/ (function(module, exports, __webpack_require__) { | |
951 | + | |
952 | + 'use strict'; | |
953 | + | |
954 | + var utils = __webpack_require__(2); | |
955 | + | |
956 | + module.exports = function normalizeHeaderName(headers, normalizedName) { | |
957 | + utils.forEach(headers, function processHeader(value, name) { | |
958 | + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { | |
959 | + headers[normalizedName] = value; | |
960 | + delete headers[name]; | |
961 | + } | |
962 | + }); | |
963 | + }; | |
964 | + | |
965 | + | |
966 | +/***/ }), | |
967 | +/* 13 */ | |
968 | +/***/ (function(module, exports, __webpack_require__) { | |
969 | + | |
970 | + 'use strict'; | |
971 | + | |
972 | + var utils = __webpack_require__(2); | |
973 | + var settle = __webpack_require__(14); | |
974 | + var buildURL = __webpack_require__(6); | |
975 | + var parseHeaders = __webpack_require__(17); | |
976 | + var isURLSameOrigin = __webpack_require__(18); | |
977 | + var createError = __webpack_require__(15); | |
978 | + | |
979 | + module.exports = function xhrAdapter(config) { | |
980 | + return new Promise(function dispatchXhrRequest(resolve, reject) { | |
981 | + var requestData = config.data; | |
982 | + var requestHeaders = config.headers; | |
983 | + | |
984 | + if (utils.isFormData(requestData)) { | |
985 | + delete requestHeaders['Content-Type']; // Let the browser set it | |
986 | + } | |
987 | + | |
988 | + var request = new XMLHttpRequest(); | |
989 | + | |
990 | + // HTTP basic authentication | |
991 | + if (config.auth) { | |
992 | + var username = config.auth.username || ''; | |
993 | + var password = config.auth.password || ''; | |
994 | + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); | |
995 | + } | |
996 | + | |
997 | + request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); | |
998 | + | |
999 | + // Set the request timeout in MS | |
1000 | + request.timeout = config.timeout; | |
1001 | + | |
1002 | + // Listen for ready state | |
1003 | + request.onreadystatechange = function handleLoad() { | |
1004 | + if (!request || request.readyState !== 4) { | |
1005 | + return; | |
1006 | + } | |
1007 | + | |
1008 | + // The request errored out and we didn't get a response, this will be | |
1009 | + // handled by onerror instead | |
1010 | + // With one exception: request that using file: protocol, most browsers | |
1011 | + // will return status as 0 even though it's a successful request | |
1012 | + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { | |
1013 | + return; | |
1014 | + } | |
1015 | + | |
1016 | + // Prepare the response | |
1017 | + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; | |
1018 | + var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; | |
1019 | + var response = { | |
1020 | + data: responseData, | |
1021 | + status: request.status, | |
1022 | + statusText: request.statusText, | |
1023 | + headers: responseHeaders, | |
1024 | + config: config, | |
1025 | + request: request | |
1026 | + }; | |
1027 | + | |
1028 | + settle(resolve, reject, response); | |
1029 | + | |
1030 | + // Clean up request | |
1031 | + request = null; | |
1032 | + }; | |
1033 | + | |
1034 | + // Handle browser request cancellation (as opposed to a manual cancellation) | |
1035 | + request.onabort = function handleAbort() { | |
1036 | + if (!request) { | |
1037 | + return; | |
1038 | + } | |
1039 | + | |
1040 | + reject(createError('Request aborted', config, 'ECONNABORTED', request)); | |
1041 | + | |
1042 | + // Clean up request | |
1043 | + request = null; | |
1044 | + }; | |
1045 | + | |
1046 | + // Handle low level network errors | |
1047 | + request.onerror = function handleError() { | |
1048 | + // Real errors are hidden from us by the browser | |
1049 | + // onerror should only fire if it's a network error | |
1050 | + reject(createError('Network Error', config, null, request)); | |
1051 | + | |
1052 | + // Clean up request | |
1053 | + request = null; | |
1054 | + }; | |
1055 | + | |
1056 | + // Handle timeout | |
1057 | + request.ontimeout = function handleTimeout() { | |
1058 | + reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', | |
1059 | + request)); | |
1060 | + | |
1061 | + // Clean up request | |
1062 | + request = null; | |
1063 | + }; | |
1064 | + | |
1065 | + // Add xsrf header | |
1066 | + // This is only done if running in a standard browser environment. | |
1067 | + // Specifically not if we're in a web worker, or react-native. | |
1068 | + if (utils.isStandardBrowserEnv()) { | |
1069 | + var cookies = __webpack_require__(19); | |
1070 | + | |
1071 | + // Add xsrf header | |
1072 | + var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? | |
1073 | + cookies.read(config.xsrfCookieName) : | |
1074 | + undefined; | |
1075 | + | |
1076 | + if (xsrfValue) { | |
1077 | + requestHeaders[config.xsrfHeaderName] = xsrfValue; | |
1078 | + } | |
1079 | + } | |
1080 | + | |
1081 | + // Add headers to the request | |
1082 | + if ('setRequestHeader' in request) { | |
1083 | + utils.forEach(requestHeaders, function setRequestHeader(val, key) { | |
1084 | + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { | |
1085 | + // Remove Content-Type if data is undefined | |
1086 | + delete requestHeaders[key]; | |
1087 | + } else { | |
1088 | + // Otherwise add header to the request | |
1089 | + request.setRequestHeader(key, val); | |
1090 | + } | |
1091 | + }); | |
1092 | + } | |
1093 | + | |
1094 | + // Add withCredentials to request if needed | |
1095 | + if (config.withCredentials) { | |
1096 | + request.withCredentials = true; | |
1097 | + } | |
1098 | + | |
1099 | + // Add responseType to request if needed | |
1100 | + if (config.responseType) { | |
1101 | + try { | |
1102 | + request.responseType = config.responseType; | |
1103 | + } catch (e) { | |
1104 | + // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. | |
1105 | + // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. | |
1106 | + if (config.responseType !== 'json') { | |
1107 | + throw e; | |
1108 | + } | |
1109 | + } | |
1110 | + } | |
1111 | + | |
1112 | + // Handle progress if needed | |
1113 | + if (typeof config.onDownloadProgress === 'function') { | |
1114 | + request.addEventListener('progress', config.onDownloadProgress); | |
1115 | + } | |
1116 | + | |
1117 | + // Not all browsers support upload events | |
1118 | + if (typeof config.onUploadProgress === 'function' && request.upload) { | |
1119 | + request.upload.addEventListener('progress', config.onUploadProgress); | |
1120 | + } | |
1121 | + | |
1122 | + if (config.cancelToken) { | |
1123 | + // Handle cancellation | |
1124 | + config.cancelToken.promise.then(function onCanceled(cancel) { | |
1125 | + if (!request) { | |
1126 | + return; | |
1127 | + } | |
1128 | + | |
1129 | + request.abort(); | |
1130 | + reject(cancel); | |
1131 | + // Clean up request | |
1132 | + request = null; | |
1133 | + }); | |
1134 | + } | |
1135 | + | |
1136 | + if (requestData === undefined) { | |
1137 | + requestData = null; | |
1138 | + } | |
1139 | + | |
1140 | + // Send the request | |
1141 | + request.send(requestData); | |
1142 | + }); | |
1143 | + }; | |
1144 | + | |
1145 | + | |
1146 | +/***/ }), | |
1147 | +/* 14 */ | |
1148 | +/***/ (function(module, exports, __webpack_require__) { | |
1149 | + | |
1150 | + 'use strict'; | |
1151 | + | |
1152 | + var createError = __webpack_require__(15); | |
1153 | + | |
1154 | + /** | |
1155 | + * Resolve or reject a Promise based on response status. | |
1156 | + * | |
1157 | + * @param {Function} resolve A function that resolves the promise. | |
1158 | + * @param {Function} reject A function that rejects the promise. | |
1159 | + * @param {object} response The response. | |
1160 | + */ | |
1161 | + module.exports = function settle(resolve, reject, response) { | |
1162 | + var validateStatus = response.config.validateStatus; | |
1163 | + if (!validateStatus || validateStatus(response.status)) { | |
1164 | + resolve(response); | |
1165 | + } else { | |
1166 | + reject(createError( | |
1167 | + 'Request failed with status code ' + response.status, | |
1168 | + response.config, | |
1169 | + null, | |
1170 | + response.request, | |
1171 | + response | |
1172 | + )); | |
1173 | + } | |
1174 | + }; | |
1175 | + | |
1176 | + | |
1177 | +/***/ }), | |
1178 | +/* 15 */ | |
1179 | +/***/ (function(module, exports, __webpack_require__) { | |
1180 | + | |
1181 | + 'use strict'; | |
1182 | + | |
1183 | + var enhanceError = __webpack_require__(16); | |
1184 | + | |
1185 | + /** | |
1186 | + * Create an Error with the specified message, config, error code, request and response. | |
1187 | + * | |
1188 | + * @param {string} message The error message. | |
1189 | + * @param {Object} config The config. | |
1190 | + * @param {string} [code] The error code (for example, 'ECONNABORTED'). | |
1191 | + * @param {Object} [request] The request. | |
1192 | + * @param {Object} [response] The response. | |
1193 | + * @returns {Error} The created error. | |
1194 | + */ | |
1195 | + module.exports = function createError(message, config, code, request, response) { | |
1196 | + var error = new Error(message); | |
1197 | + return enhanceError(error, config, code, request, response); | |
1198 | + }; | |
1199 | + | |
1200 | + | |
1201 | +/***/ }), | |
1202 | +/* 16 */ | |
1203 | +/***/ (function(module, exports) { | |
1204 | + | |
1205 | + 'use strict'; | |
1206 | + | |
1207 | + /** | |
1208 | + * Update an Error with the specified config, error code, and response. | |
1209 | + * | |
1210 | + * @param {Error} error The error to update. | |
1211 | + * @param {Object} config The config. | |
1212 | + * @param {string} [code] The error code (for example, 'ECONNABORTED'). | |
1213 | + * @param {Object} [request] The request. | |
1214 | + * @param {Object} [response] The response. | |
1215 | + * @returns {Error} The error. | |
1216 | + */ | |
1217 | + module.exports = function enhanceError(error, config, code, request, response) { | |
1218 | + error.config = config; | |
1219 | + if (code) { | |
1220 | + error.code = code; | |
1221 | + } | |
1222 | + error.request = request; | |
1223 | + error.response = response; | |
1224 | + error.toJSON = function() { | |
1225 | + return { | |
1226 | + // Standard | |
1227 | + message: this.message, | |
1228 | + name: this.name, | |
1229 | + // Microsoft | |
1230 | + description: this.description, | |
1231 | + number: this.number, | |
1232 | + // Mozilla | |
1233 | + fileName: this.fileName, | |
1234 | + lineNumber: this.lineNumber, | |
1235 | + columnNumber: this.columnNumber, | |
1236 | + stack: this.stack, | |
1237 | + // Axios | |
1238 | + config: this.config, | |
1239 | + code: this.code | |
1240 | + }; | |
1241 | + }; | |
1242 | + return error; | |
1243 | + }; | |
1244 | + | |
1245 | + | |
1246 | +/***/ }), | |
1247 | +/* 17 */ | |
1248 | +/***/ (function(module, exports, __webpack_require__) { | |
1249 | + | |
1250 | + 'use strict'; | |
1251 | + | |
1252 | + var utils = __webpack_require__(2); | |
1253 | + | |
1254 | + // Headers whose duplicates are ignored by node | |
1255 | + // c.f. https://nodejs.org/api/http.html#http_message_headers | |
1256 | + var ignoreDuplicateOf = [ | |
1257 | + 'age', 'authorization', 'content-length', 'content-type', 'etag', | |
1258 | + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', | |
1259 | + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', | |
1260 | + 'referer', 'retry-after', 'user-agent' | |
1261 | + ]; | |
1262 | + | |
1263 | + /** | |
1264 | + * Parse headers into an object | |
1265 | + * | |
1266 | + * ``` | |
1267 | + * Date: Wed, 27 Aug 2014 08:58:49 GMT | |
1268 | + * Content-Type: application/json | |
1269 | + * Connection: keep-alive | |
1270 | + * Transfer-Encoding: chunked | |
1271 | + * ``` | |
1272 | + * | |
1273 | + * @param {String} headers Headers needing to be parsed | |
1274 | + * @returns {Object} Headers parsed into an object | |
1275 | + */ | |
1276 | + module.exports = function parseHeaders(headers) { | |
1277 | + var parsed = {}; | |
1278 | + var key; | |
1279 | + var val; | |
1280 | + var i; | |
1281 | + | |
1282 | + if (!headers) { return parsed; } | |
1283 | + | |
1284 | + utils.forEach(headers.split('\n'), function parser(line) { | |
1285 | + i = line.indexOf(':'); | |
1286 | + key = utils.trim(line.substr(0, i)).toLowerCase(); | |
1287 | + val = utils.trim(line.substr(i + 1)); | |
1288 | + | |
1289 | + if (key) { | |
1290 | + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { | |
1291 | + return; | |
1292 | + } | |
1293 | + if (key === 'set-cookie') { | |
1294 | + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); | |
1295 | + } else { | |
1296 | + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; | |
1297 | + } | |
1298 | + } | |
1299 | + }); | |
1300 | + | |
1301 | + return parsed; | |
1302 | + }; | |
1303 | + | |
1304 | + | |
1305 | +/***/ }), | |
1306 | +/* 18 */ | |
1307 | +/***/ (function(module, exports, __webpack_require__) { | |
1308 | + | |
1309 | + 'use strict'; | |
1310 | + | |
1311 | + var utils = __webpack_require__(2); | |
1312 | + | |
1313 | + module.exports = ( | |
1314 | + utils.isStandardBrowserEnv() ? | |
1315 | + | |
1316 | + // Standard browser envs have full support of the APIs needed to test | |
1317 | + // whether the request URL is of the same origin as current location. | |
1318 | + (function standardBrowserEnv() { | |
1319 | + var msie = /(msie|trident)/i.test(navigator.userAgent); | |
1320 | + var urlParsingNode = document.createElement('a'); | |
1321 | + var originURL; | |
1322 | + | |
1323 | + /** | |
1324 | + * Parse a URL to discover it's components | |
1325 | + * | |
1326 | + * @param {String} url The URL to be parsed | |
1327 | + * @returns {Object} | |
1328 | + */ | |
1329 | + function resolveURL(url) { | |
1330 | + var href = url; | |
1331 | + | |
1332 | + if (msie) { | |
1333 | + // IE needs attribute set twice to normalize properties | |
1334 | + urlParsingNode.setAttribute('href', href); | |
1335 | + href = urlParsingNode.href; | |
1336 | + } | |
1337 | + | |
1338 | + urlParsingNode.setAttribute('href', href); | |
1339 | + | |
1340 | + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils | |
1341 | + return { | |
1342 | + href: urlParsingNode.href, | |
1343 | + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', | |
1344 | + host: urlParsingNode.host, | |
1345 | + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', | |
1346 | + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', | |
1347 | + hostname: urlParsingNode.hostname, | |
1348 | + port: urlParsingNode.port, | |
1349 | + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | |
1350 | + urlParsingNode.pathname : | |
1351 | + '/' + urlParsingNode.pathname | |
1352 | + }; | |
1353 | + } | |
1354 | + | |
1355 | + originURL = resolveURL(window.location.href); | |
1356 | + | |
1357 | + /** | |
1358 | + * Determine if a URL shares the same origin as the current location | |
1359 | + * | |
1360 | + * @param {String} requestURL The URL to test | |
1361 | + * @returns {boolean} True if URL shares the same origin, otherwise false | |
1362 | + */ | |
1363 | + return function isURLSameOrigin(requestURL) { | |
1364 | + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; | |
1365 | + return (parsed.protocol === originURL.protocol && | |
1366 | + parsed.host === originURL.host); | |
1367 | + }; | |
1368 | + })() : | |
1369 | + | |
1370 | + // Non standard browser envs (web workers, react-native) lack needed support. | |
1371 | + (function nonStandardBrowserEnv() { | |
1372 | + return function isURLSameOrigin() { | |
1373 | + return true; | |
1374 | + }; | |
1375 | + })() | |
1376 | + ); | |
1377 | + | |
1378 | + | |
1379 | +/***/ }), | |
1380 | +/* 19 */ | |
1381 | +/***/ (function(module, exports, __webpack_require__) { | |
1382 | + | |
1383 | + 'use strict'; | |
1384 | + | |
1385 | + var utils = __webpack_require__(2); | |
1386 | + | |
1387 | + module.exports = ( | |
1388 | + utils.isStandardBrowserEnv() ? | |
1389 | + | |
1390 | + // Standard browser envs support document.cookie | |
1391 | + (function standardBrowserEnv() { | |
1392 | + return { | |
1393 | + write: function write(name, value, expires, path, domain, secure) { | |
1394 | + var cookie = []; | |
1395 | + cookie.push(name + '=' + encodeURIComponent(value)); | |
1396 | + | |
1397 | + if (utils.isNumber(expires)) { | |
1398 | + cookie.push('expires=' + new Date(expires).toGMTString()); | |
1399 | + } | |
1400 | + | |
1401 | + if (utils.isString(path)) { | |
1402 | + cookie.push('path=' + path); | |
1403 | + } | |
1404 | + | |
1405 | + if (utils.isString(domain)) { | |
1406 | + cookie.push('domain=' + domain); | |
1407 | + } | |
1408 | + | |
1409 | + if (secure === true) { | |
1410 | + cookie.push('secure'); | |
1411 | + } | |
1412 | + | |
1413 | + document.cookie = cookie.join('; '); | |
1414 | + }, | |
1415 | + | |
1416 | + read: function read(name) { | |
1417 | + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); | |
1418 | + return (match ? decodeURIComponent(match[3]) : null); | |
1419 | + }, | |
1420 | + | |
1421 | + remove: function remove(name) { | |
1422 | + this.write(name, '', Date.now() - 86400000); | |
1423 | + } | |
1424 | + }; | |
1425 | + })() : | |
1426 | + | |
1427 | + // Non standard browser env (web workers, react-native) lack needed support. | |
1428 | + (function nonStandardBrowserEnv() { | |
1429 | + return { | |
1430 | + write: function write() {}, | |
1431 | + read: function read() { return null; }, | |
1432 | + remove: function remove() {} | |
1433 | + }; | |
1434 | + })() | |
1435 | + ); | |
1436 | + | |
1437 | + | |
1438 | +/***/ }), | |
1439 | +/* 20 */ | |
1440 | +/***/ (function(module, exports) { | |
1441 | + | |
1442 | + 'use strict'; | |
1443 | + | |
1444 | + /** | |
1445 | + * Determines whether the specified URL is absolute | |
1446 | + * | |
1447 | + * @param {string} url The URL to test | |
1448 | + * @returns {boolean} True if the specified URL is absolute, otherwise false | |
1449 | + */ | |
1450 | + module.exports = function isAbsoluteURL(url) { | |
1451 | + // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). | |
1452 | + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed | |
1453 | + // by any combination of letters, digits, plus, period, or hyphen. | |
1454 | + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); | |
1455 | + }; | |
1456 | + | |
1457 | + | |
1458 | +/***/ }), | |
1459 | +/* 21 */ | |
1460 | +/***/ (function(module, exports) { | |
1461 | + | |
1462 | + 'use strict'; | |
1463 | + | |
1464 | + /** | |
1465 | + * Creates a new URL by combining the specified URLs | |
1466 | + * | |
1467 | + * @param {string} baseURL The base URL | |
1468 | + * @param {string} relativeURL The relative URL | |
1469 | + * @returns {string} The combined URL | |
1470 | + */ | |
1471 | + module.exports = function combineURLs(baseURL, relativeURL) { | |
1472 | + return relativeURL | |
1473 | + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') | |
1474 | + : baseURL; | |
1475 | + }; | |
1476 | + | |
1477 | + | |
1478 | +/***/ }), | |
1479 | +/* 22 */ | |
1480 | +/***/ (function(module, exports, __webpack_require__) { | |
1481 | + | |
1482 | + 'use strict'; | |
1483 | + | |
1484 | + var utils = __webpack_require__(2); | |
1485 | + | |
1486 | + /** | |
1487 | + * Config-specific merge-function which creates a new config-object | |
1488 | + * by merging two configuration objects together. | |
1489 | + * | |
1490 | + * @param {Object} config1 | |
1491 | + * @param {Object} config2 | |
1492 | + * @returns {Object} New object resulting from merging config2 to config1 | |
1493 | + */ | |
1494 | + module.exports = function mergeConfig(config1, config2) { | |
1495 | + // eslint-disable-next-line no-param-reassign | |
1496 | + config2 = config2 || {}; | |
1497 | + var config = {}; | |
1498 | + | |
1499 | + utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) { | |
1500 | + if (typeof config2[prop] !== 'undefined') { | |
1501 | + config[prop] = config2[prop]; | |
1502 | + } | |
1503 | + }); | |
1504 | + | |
1505 | + utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) { | |
1506 | + if (utils.isObject(config2[prop])) { | |
1507 | + config[prop] = utils.deepMerge(config1[prop], config2[prop]); | |
1508 | + } else if (typeof config2[prop] !== 'undefined') { | |
1509 | + config[prop] = config2[prop]; | |
1510 | + } else if (utils.isObject(config1[prop])) { | |
1511 | + config[prop] = utils.deepMerge(config1[prop]); | |
1512 | + } else if (typeof config1[prop] !== 'undefined') { | |
1513 | + config[prop] = config1[prop]; | |
1514 | + } | |
1515 | + }); | |
1516 | + | |
1517 | + utils.forEach([ | |
1518 | + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', | |
1519 | + 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', | |
1520 | + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength', | |
1521 | + 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken', | |
1522 | + 'socketPath' | |
1523 | + ], function defaultToConfig2(prop) { | |
1524 | + if (typeof config2[prop] !== 'undefined') { | |
1525 | + config[prop] = config2[prop]; | |
1526 | + } else if (typeof config1[prop] !== 'undefined') { | |
1527 | + config[prop] = config1[prop]; | |
1528 | + } | |
1529 | + }); | |
1530 | + | |
1531 | + return config; | |
1532 | + }; | |
1533 | + | |
1534 | + | |
1535 | +/***/ }), | |
1536 | +/* 23 */ | |
1537 | +/***/ (function(module, exports) { | |
1538 | + | |
1539 | + 'use strict'; | |
1540 | + | |
1541 | + /** | |
1542 | + * A `Cancel` is an object that is thrown when an operation is canceled. | |
1543 | + * | |
1544 | + * @class | |
1545 | + * @param {string=} message The message. | |
1546 | + */ | |
1547 | + function Cancel(message) { | |
1548 | + this.message = message; | |
1549 | + } | |
1550 | + | |
1551 | + Cancel.prototype.toString = function toString() { | |
1552 | + return 'Cancel' + (this.message ? ': ' + this.message : ''); | |
1553 | + }; | |
1554 | + | |
1555 | + Cancel.prototype.__CANCEL__ = true; | |
1556 | + | |
1557 | + module.exports = Cancel; | |
1558 | + | |
1559 | + | |
1560 | +/***/ }), | |
1561 | +/* 24 */ | |
1562 | +/***/ (function(module, exports, __webpack_require__) { | |
1563 | + | |
1564 | + 'use strict'; | |
1565 | + | |
1566 | + var Cancel = __webpack_require__(23); | |
1567 | + | |
1568 | + /** | |
1569 | + * A `CancelToken` is an object that can be used to request cancellation of an operation. | |
1570 | + * | |
1571 | + * @class | |
1572 | + * @param {Function} executor The executor function. | |
1573 | + */ | |
1574 | + function CancelToken(executor) { | |
1575 | + if (typeof executor !== 'function') { | |
1576 | + throw new TypeError('executor must be a function.'); | |
1577 | + } | |
1578 | + | |
1579 | + var resolvePromise; | |
1580 | + this.promise = new Promise(function promiseExecutor(resolve) { | |
1581 | + resolvePromise = resolve; | |
1582 | + }); | |
1583 | + | |
1584 | + var token = this; | |
1585 | + executor(function cancel(message) { | |
1586 | + if (token.reason) { | |
1587 | + // Cancellation has already been requested | |
1588 | + return; | |
1589 | + } | |
1590 | + | |
1591 | + token.reason = new Cancel(message); | |
1592 | + resolvePromise(token.reason); | |
1593 | + }); | |
1594 | + } | |
1595 | + | |
1596 | + /** | |
1597 | + * Throws a `Cancel` if cancellation has been requested. | |
1598 | + */ | |
1599 | + CancelToken.prototype.throwIfRequested = function throwIfRequested() { | |
1600 | + if (this.reason) { | |
1601 | + throw this.reason; | |
1602 | + } | |
1603 | + }; | |
1604 | + | |
1605 | + /** | |
1606 | + * Returns an object that contains a new `CancelToken` and a function that, when called, | |
1607 | + * cancels the `CancelToken`. | |
1608 | + */ | |
1609 | + CancelToken.source = function source() { | |
1610 | + var cancel; | |
1611 | + var token = new CancelToken(function executor(c) { | |
1612 | + cancel = c; | |
1613 | + }); | |
1614 | + return { | |
1615 | + token: token, | |
1616 | + cancel: cancel | |
1617 | + }; | |
1618 | + }; | |
1619 | + | |
1620 | + module.exports = CancelToken; | |
1621 | + | |
1622 | + | |
1623 | +/***/ }), | |
1624 | +/* 25 */ | |
1625 | +/***/ (function(module, exports) { | |
1626 | + | |
1627 | + 'use strict'; | |
1628 | + | |
1629 | + /** | |
1630 | + * Syntactic sugar for invoking a function and expanding an array for arguments. | |
1631 | + * | |
1632 | + * Common use case would be to use `Function.prototype.apply`. | |
1633 | + * | |
1634 | + * ```js | |
1635 | + * function f(x, y, z) {} | |
1636 | + * var args = [1, 2, 3]; | |
1637 | + * f.apply(null, args); | |
1638 | + * ``` | |
1639 | + * | |
1640 | + * With `spread` this example can be re-written. | |
1641 | + * | |
1642 | + * ```js | |
1643 | + * spread(function(x, y, z) {})([1, 2, 3]); | |
1644 | + * ``` | |
1645 | + * | |
1646 | + * @param {Function} callback | |
1647 | + * @returns {Function} | |
1648 | + */ | |
1649 | + module.exports = function spread(callback) { | |
1650 | + return function wrap(arr) { | |
1651 | + return callback.apply(null, arr); | |
1652 | + }; | |
1653 | + }; | |
1654 | + | |
1655 | + | |
1656 | +/***/ }) | |
1657 | +/******/ ]) | |
1658 | +}); | |
1659 | +; | |
1660 | +//# sourceMappingURL=axios.map | |
0 | 1661 | \ No newline at end of file |
... | ... |
generateUserCache.php
0 → 100644
1 | +++ a/generateUserCache.php | |
1 | +<?php | |
2 | + | |
3 | +/** | |
4 | + * 线上的用户数据提前生成到本地js,主要是为了缓存图片数据,防止页面加载图片慢 | |
5 | + */ | |
6 | + | |
7 | +include "phpapi/Common/request.php"; | |
8 | +include "phpapi/Common/Encrypter.php"; | |
9 | +// 生成的本地js文件 | |
10 | +const CACHE_FILE = 'usercache.js'; | |
11 | +// 获取线上的用户列表 | |
12 | +$url = "http://yq.vchangyi.com/party/phpapi/apicp.GetUserList.php"; | |
13 | +$request = new Request(); | |
14 | +$request->get($url); | |
15 | +var_dump($request->response); | |
16 | +$data = json_decode($request->response, true); | |
17 | + | |
18 | +// 获取本地已经缓存过的用户数据 | |
19 | +$fileExists = file_exists(CACHE_FILE); | |
20 | +$fileJsonArray = []; | |
21 | +if ($fileExists) { | |
22 | + $text = ltrim(file_get_contents(CACHE_FILE),'let userData = '); | |
23 | + $fileJsonArray = json_decode($text, true); | |
24 | +} | |
25 | + | |
26 | +// 对比线上本地数据,生成未缓存到本地的js数据 | |
27 | +$cacheData = []; | |
28 | +foreach ($data['result'] as $item) { | |
29 | + if (empty($fileJsonArray[$item['id']])) { | |
30 | + $temp = $item; | |
31 | + $temp['headimg'] = createImg($item['headimg']); | |
32 | + $cacheData[$item['id']] = $temp; | |
33 | + } | |
34 | +} | |
35 | +$userArray = $fileJsonArray + $cacheData; | |
36 | +$jsontext = 'let userData = ' . json_encode($userArray); | |
37 | +// 输出 | |
38 | +file_put_contents(CACHE_FILE, $jsontext); | |
39 | +echo 'SUCCESS'; | |
40 | + | |
41 | +/** | |
42 | + * 保存图片 | |
43 | + */ | |
44 | +function createImg($url) | |
45 | +{ | |
46 | + $request = new Request(); | |
47 | + $request->get($url); | |
48 | + $img = $request->response; | |
49 | + $filename = time() . rand(1000,9999) . ".jpg"; | |
50 | + $tarfilename = "cacheUserImg/" .$filename; | |
51 | + $fp = fopen($tarfilename, "w"); | |
52 | + fwrite($fp, $img); | |
53 | + fclose($fp); | |
54 | + return $tarfilename; | |
55 | + | |
56 | +} | |
0 | 57 | \ No newline at end of file |
... | ... |
home.html
0 → 100644
1 | +++ a/home.html | |
1 | +<!-- <!DOCTYPE html> --> | |
2 | +<html> | |
3 | +<head> | |
4 | + <style> | |
5 | + html,body{top:0;left:0;padding: 0;margin: 0;border: 0;height:100%;overflow: hidden;width:100%} | |
6 | + body{background-color: #000;background-size:1024px 768px;background-repeat: no-repeat;} | |
7 | + #users{margin-left: 25px;width:auto;} | |
8 | + .headimg{border:1px solid transparent;width:95px;height:95px;overflow: hidden;position: relative;float:left;} | |
9 | + .headImg>img{width:95px;height:auto;min-height: 95px;} | |
10 | + .headImg>.img-opacity{position: absolute;top:-5px;left:-5px;width: 120px;height:120px;z-index: 2;background-color: #333;opacity: 0.7;} | |
11 | + | |
12 | + .logo{width:700px;height:700px;overflow: hidden;border-radius: 50%;background-image: url("img/logo.png");position: absolute; left:430px;top:5px;background-size: 85%;background-repeat: no-repeat;z-index:100;background-position: center;animation: breathing 2s;animation-iteration-count: infinite;animation-direction: alternate;display: none;} | |
13 | + @keyframes breathing{from {opacity: 0.8;} to {opacity: 1;} } | |
14 | + </style> | |
15 | + <script src="axios.js"></script> | |
16 | + <script src="jquery.min.js"></script> | |
17 | + <script src="usercache.js"></script> | |
18 | + <script src="home.js"></script> | |
19 | +</head> | |
20 | +<body> | |
21 | +<div id="div-high"></div> | |
22 | +<div id="users" z-for-container = "users-bind"> | |
23 | + <div z-for-item = "user-item" class="headimg"><img z-for-data = "headimg" /><div class="img-opacity"></div></div> | |
24 | +</div> | |
25 | +<div class="logo"></div> | |
26 | +</body> | |
27 | +<script> | |
28 | + action.init(1, 1); | |
29 | + </script> | |
30 | +</html> | |
0 | 31 | \ No newline at end of file |
... | ... |
home.js
0 → 100644
1 | +++ a/home.js | |
1 | + | |
2 | +var baseURL = 'http://dsc-b.vchangyi.com/party/phpapi'; | |
3 | + | |
4 | +let showData = []; | |
5 | +let action ={ | |
6 | + // 初始化,参数:文字展示次数 | |
7 | + init: (fontRunTime, showModel)=>{ | |
8 | + // 页面激活,重新加载页面 | |
9 | + document.addEventListener('visibilitychange', function() { | |
10 | + var isHidden = document.hidden; | |
11 | + if (!isHidden) { | |
12 | + location.reload(); | |
13 | + } | |
14 | + }); | |
15 | + if (showModel == 1) { | |
16 | + baseRquest.get('/apicp.GetUserList.php', {}, data =>{ | |
17 | + console.log(data); | |
18 | + if (data.length == 0) { | |
19 | + alert('暂无用户'); | |
20 | + return; | |
21 | + } | |
22 | + // 绑定数据到页面 | |
23 | + let dataLength = data.length; | |
24 | + let i = 0; | |
25 | + while (showData.length <144) { | |
26 | + showData.push(data[i]); | |
27 | + i++; | |
28 | + if (i == dataLength) { | |
29 | + i = 0; | |
30 | + } | |
31 | + } | |
32 | + showData.sort(function(a, b) { | |
33 | + return Math.random()>.5 ? -1 : 1; | |
34 | + }); | |
35 | + console.log(showData); | |
36 | + dataListBind('users-bind', 'user-item', showData); | |
37 | + action.fontRunTime = fontRunTime; | |
38 | + // showtime | |
39 | + action.fontChange(); | |
40 | + | |
41 | + }); | |
42 | + } else { | |
43 | + let allUser = []; | |
44 | + Object.keys(userData).forEach(function(key){ | |
45 | + allUser.push(userData[key]); | |
46 | + }) | |
47 | + let dataLength = allUser.length; | |
48 | + let i = 0; | |
49 | + while (showData.length <144) { | |
50 | + showData.push(allUser[i]); | |
51 | + i++; | |
52 | + if (i == dataLength) { | |
53 | + i = 0; | |
54 | + } | |
55 | + } | |
56 | + showData.sort(function(a, b) { | |
57 | + return Math.random()>.5 ? -1 : 1; | |
58 | + }); | |
59 | + console.log(showData); | |
60 | + dataListBind('users-bind', 'user-item', showData); | |
61 | + action.fontRunTime = fontRunTime; | |
62 | + // showtime | |
63 | + action.fontChange(); | |
64 | + } | |
65 | + }, | |
66 | + fontRunTime: 0, | |
67 | + // 第一段动画,动态文字拼接 | |
68 | + fontChange: ()=>{ | |
69 | + console.log(new Date()); | |
70 | + let count = $('#users .img-opacity').length; | |
71 | + let fontKey = [ | |
72 | + [36,37,38,39,51,67,83,100,101,102,103,42,46,59,61,76,92,108], | |
73 | + [19,20,21,22,23,35,51,67,68,69,70,71,87,103,119,118,117,116,115,74,89,90,91,106,122,123,61,77,93,109,125,94,95,111,127] | |
74 | + ]; | |
75 | + let change = function(i, fontIndex){ | |
76 | + // console.log(fontIndex); | |
77 | + let hideTimeOut = setTimeout(() => { | |
78 | + if (fontIndex.indexOf(i) < 0) { | |
79 | + $('#users .img-opacity').eq(i).css('background-color','#000').fadeIn(); | |
80 | + } else { | |
81 | + $('#users .img-opacity').eq(i).css('background-color','rgb(40,117,232)').fadeIn(); | |
82 | + } | |
83 | + clearTimeout(hideTimeOut); | |
84 | + }, 500); | |
85 | + } | |
86 | + let j = 0; | |
87 | + let fontRunTime = action.fontRunTime; | |
88 | + let show = ()=>{ | |
89 | + let i = 0; | |
90 | + let fontIndex = fontKey[j]; | |
91 | + let intervalUse = setInterval(() => { | |
92 | + $('#users .img-opacity').eq(i).fadeOut(200 , change(i,fontIndex)); | |
93 | + i++; | |
94 | + if (count == i) { | |
95 | + clearInterval(intervalUse); | |
96 | + } | |
97 | + }, 10); | |
98 | + j++; | |
99 | + if (fontKey.length == j) { | |
100 | + j = 0; | |
101 | + fontRunTime--; | |
102 | + } | |
103 | + if (fontRunTime == 0) { | |
104 | + clearInterval(interval); | |
105 | + fontRunTime = action.fontRunTime; | |
106 | + action.showLogo(); | |
107 | + } | |
108 | + return show; | |
109 | + } | |
110 | + let interval = setInterval(show(), 20000); | |
111 | + | |
112 | + }, | |
113 | + // 第二段动画,展示logo | |
114 | + showLogo: ()=>{ | |
115 | + // 20s后开始 | |
116 | + let interval = setInterval(()=>{ | |
117 | + let i = 0; | |
118 | + let count = $('#users .img-opacity').length; | |
119 | + // 展示需要65s | |
120 | + let intervalUse = setInterval(() => { | |
121 | + $('#users .img-opacity').eq(i).fadeOut(300); | |
122 | + i++; | |
123 | + if (count == i) { | |
124 | + clearInterval(intervalUse); | |
125 | + } | |
126 | + }, 500); | |
127 | + // logo展示延迟135秒 | |
128 | + let intervalLogo = setInterval(() => { | |
129 | + $('#users .img-opacity').css('background-color','#000').fadeIn(2000); | |
130 | + $('.logo').fadeIn(2000); | |
131 | + clearInterval(intervalLogo); | |
132 | + action.reset(); | |
133 | + },74000); | |
134 | + clearInterval(interval); | |
135 | + }, 20000); | |
136 | + }, | |
137 | + // 重置动画 | |
138 | + reset: ()=>{ | |
139 | + let interval = setTimeout(()=>{ | |
140 | + location.reload(); | |
141 | + },60000); | |
142 | + } | |
143 | +} | |
144 | +// 山寨dom数据列表绑定控件,没有实现事件callback | |
145 | +// 要求设置容器名称z-for-container,设置循环列数据模板z-for-item | |
146 | +// 参数1:容器名称,存放列表数据的容器 2:设置的数据模板 3:json数据 | |
147 | +let dataListBind = (container, itemName, data)=>{ | |
148 | + let trs = ''; | |
149 | + // 获取模板 | |
150 | + $('*[z-for-item="'+ itemName +'"]').show(); | |
151 | + let trTemplate = $('*[z-for-item="'+ itemName +'"]').prop("outerHTML"); | |
152 | + $('*[z-for-item="'+ itemName +'"]').hide(); | |
153 | + let trTemplateHide = $('*[z-for-item="'+ itemName +'"]').prop("outerHTML"); | |
154 | + for(let i = 0; data.length > i; i++) { | |
155 | + // 创建一行dom | |
156 | + let tr = trTemplate; | |
157 | + // 模板需要赋值项 | |
158 | + let forDataItem = $(tr).find("*[z-for-data]"); | |
159 | + for(let j = 0; forDataItem.length > j; j++) { | |
160 | + let item = $(forDataItem).eq(j).prop("outerHTML"); | |
161 | + // 获取dom标签绑定的映射名称 | |
162 | + let column = $(forDataItem).eq(j).attr("z-for-data"); | |
163 | + let tagName = $(forDataItem)[j].tagName.toLowerCase(); | |
164 | + // 列表中的img和input支持直接赋值,其他标签赋值到标签中间 | |
165 | + if (tagName == 'img') { | |
166 | + $(forDataItem).eq(j).attr('src', data[i][column]); | |
167 | + } else if (tagName == 'input') { | |
168 | + $(forDataItem).eq(j).val(data[i][column]); | |
169 | + } else { | |
170 | + $(forDataItem).eq(j).html(data[i][column]); | |
171 | + } | |
172 | + tr = tr.replace(item,$(forDataItem).eq(j).prop("outerHTML")); | |
173 | + } | |
174 | + trs += $(tr).removeAttr('z-for-item').prop("outerHTML"); | |
175 | + } | |
176 | + $('*[z-for-container="'+ container +'"]').html(trTemplateHide + trs); | |
177 | +} | |
178 | + | |
179 | +// api接口数据请求,数据交互引用的axios | |
180 | +let baseRquest = { | |
181 | + // get请求 | |
182 | + get: function(url, params, callback) { | |
183 | + let token = localStorage["token"]; | |
184 | + axios.defaults.baseURL = baseURL; | |
185 | + axios.get(url, { | |
186 | + params : params, | |
187 | + headers: { | |
188 | + 'Content-Type': 'application/x-www-form-urlencoded', | |
189 | + token: token | |
190 | + } | |
191 | + }).then(function (response) { | |
192 | + if (response.status == 200) | |
193 | + { | |
194 | + data = response.data; | |
195 | + if (!!data) { | |
196 | + // 过滤错误信息,统一抛出 | |
197 | + if (data.errcode != 0 && data.errcode != 200) { | |
198 | + alert(data.errmsg); | |
199 | + } else { | |
200 | + callback(data.result); | |
201 | + } | |
202 | + } | |
203 | + }else { | |
204 | + alert('get无法访问接口'); | |
205 | + } | |
206 | + }) | |
207 | + .catch(function (error) { | |
208 | + }); | |
209 | + }, | |
210 | + | |
211 | + // post请求 | |
212 | + post: function(url, params, callback) { | |
213 | + let token = localStorage["token"]; | |
214 | + axios.defaults.baseURL = baseURL; | |
215 | + let data = new URLSearchParams(); | |
216 | + Object.keys(params).forEach(function(key){ | |
217 | + data.append(key, params[key]); | |
218 | + }); | |
219 | + axios.post(url, data,{ | |
220 | + headers: { | |
221 | + 'Content-Type': 'application/x-www-form-urlencoded', | |
222 | + token: token | |
223 | + } | |
224 | + }).then(function (response) { | |
225 | + if (response.status == 200) | |
226 | + { | |
227 | + data = response.data; | |
228 | + if (!!data) { | |
229 | + // 过滤错误信息,统一抛出 | |
230 | + if (data.errcode != 0 && data.errcode != 200) { | |
231 | + alert(data.errmsg); | |
232 | + } else { | |
233 | + callback(data.result); | |
234 | + } | |
235 | + } | |
236 | + }else { | |
237 | + alert('post无法访问接口'); | |
238 | + } | |
239 | + }) | |
240 | + .catch(function (error) { | |
241 | + console.log(error); | |
242 | + }); | |
243 | + } | |
244 | +} | |
0 | 245 | \ No newline at end of file |
... | ... |
img/bg-detail.png
0 → 100644
62.1 KB
img/bg.png
0 → 100644
111 KB
img/delete.png
0 → 100644
1.1 KB
img/five.png
0 → 100644
205 KB
img/head.png
0 → 100644
38 KB
img/logo.png
0 → 100644
28.1 KB
img/lottery-floor.png
0 → 100644
460 KB
img/lottery-floor1024.png
0 → 100644
236 KB
img/lottery-header.png
0 → 100644
467 KB
img/lottery-header1024.png
0 → 100644
200 KB
img/mian.png
0 → 100644
279 KB
img/pink.jpg
0 → 100644
24.9 KB
img/star.png
0 → 100644
84.2 KB
img/winner-flag.png
0 → 100644
73.8 KB
jquery.min.js
0 → 100644
1 | +++ a/jquery.min.js | |
1 | +/*! jQuery v1.7.2 jquery.com | jquery.org/license */ | |
2 | +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( | |
3 | +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f | |
4 | +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); | |
0 | 5 | \ No newline at end of file |
... | ... |
lottery.html
0 → 100644
1 | +++ a/lottery.html | |
1 | +<!DOCTYPE html> | |
2 | +<html> | |
3 | +<head> | |
4 | + <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no"> | |
5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
6 | + <meta charset="UTF-8"> | |
7 | + <title>畅移5周年庆典</title> | |
8 | + <style> | |
9 | + html,body{top:0;left:0;padding: 0;margin: 0;border: 0;height:100%;overflow: hidden;background-color:#000000;min-height: 768px;} | |
10 | + | |
11 | + .header{background-image: url("img/lottery-header1024.png");background-position: center top;top:0;left:0;height: 115px;width: 100%;color: #E3BF75;line-height: 115px;text-align: center;font-size: 50px;} | |
12 | + .main{width:100%;height: 520px;} | |
13 | + .left,.right{width:50%;float:left;height:500px;position: relative;} | |
14 | + .left .user-count{color:#E3BF75;font-size: 28px;width:100%;text-align: center;margin-top: 75px; line-height: 40px} | |
15 | + .left .user-head{width:100%;} | |
16 | + .left .user-head-img-line{ margin: 20px auto 0 auto;border: 1px solid rgb(130,114,84);border-radius:100%;width:258px;height: 258px;position: relative;overflow: hidden;} | |
17 | + .left .user-head-img-line .head-winner{border-radius:100%;width:210px;height: 210px;overflow: hidden;margin: 23px auto;} | |
18 | + .left .user-head-img-line .head-winner img{width:210px;height: auto;} | |
19 | + .left .user-head-img-line .headimg-bind{width:210px;height: 210px;overflow: hidden;} | |
20 | + .left .user-head-img-line .headimg-bind .head-img{position:absolute;top:23px;left:-212px;border: 1px solid transparent;border-radius:50%;width:210px;height: 210px;overflow: hidden;margin: 0;} | |
21 | + .left .user-head-img-line .headimg-bind .head-img img{width: 220px;height: auto;} | |
22 | + .left .user-award{margin-top: 40px;width: 100%;text-align: center;} | |
23 | + .left .user-award select{width:280px;height: 45px;border: 1px solid rgb(100,100,100); border-radius: 18px;background-color: transparent;color:#ffffff;padding-left:18px;outline:0 none !important;font-size:25px;text-indent: 70px;} | |
24 | + .left .user-award option{background-color: rgb(43,36,22);text-indent: 90px;} | |
25 | + | |
26 | + .right .lottery-list{border: 1px solid rgb(98,82,51);border-radius: 5px;width:400px;margin:60px auto 0 auto;height: 450px;overflow-y: auto;} | |
27 | + .right .title{background-color: rgb(43,36,22);height: 45px;line-height: 45px;padding-left: 20px;font-size: 18px;color: #E3BF75;} | |
28 | + .right .data-headimg{border-radius:100%;width:43px;height: 43px;} | |
29 | + .right .data-headimg img{width: 43px;height: 43px;border-radius:100%;min-height: 43px;} | |
30 | + .right .table{color:#E3BF75;font-size: 18px;width:100%;margin-top: 20px;} | |
31 | + .right .table .tr{height: 43px;line-height: 43px;font-size: 18px;margin-bottom: 10px;} | |
32 | + .right .table .sort{float:left;width:72px;text-align: center} | |
33 | + .right .table .head{float:left;width: 43px;padding-right: 14px;} | |
34 | + .right .table .name{float:left;padding-right: 14px;max-width: 160px;overflow: hidden;height: 43px;} | |
35 | + .right .table .number{float:right;text-align: right;margin-right: 14px;} | |
36 | + .right .table .delete{float:right;text-align: right;margin-right: 16px;margin-top: 3px} | |
37 | + .right .table .delete img{width:20px;height:20px;} | |
38 | + | |
39 | + #winner-show-dlg{width:100%;height:100%;position: fixed;opacity: 0.5; background-color: #000000;min-height: 100px;min-width: 100px;z-index: 20;left:0;top:0;display: none;} | |
40 | + #winner-show{z-index: 121;position: absolute;left:0;top:0;width:100%;height: 100%;display: none;} | |
41 | + #winner-show .winner-main{width: 653px;height: 450px;background-image: url('img/winner-flag.png');background-size: 653px 450px;background-position: top;margin: 148px auto 0 auto;} | |
42 | + #winner-show ul{list-style: none;width: 100%;margin: 0;padding: 0;text-align: center;} | |
43 | + #winner-show .title{height: 170px;line-height: 250px;font-size: 20px;color: #E3BF75;margin-top:148px;} | |
44 | + #winner-show .winner-no{height: 100px;line-height: 100px;font-size: 50px;color: #E3BF75;} | |
45 | + #winner-show .winner-name{height: 50px;line-height: 50px;font-size: 25px;color: #E3BF75;} | |
46 | + | |
47 | + .form-data{width: 300px; margin: 50px auto 0px auto;} | |
48 | + .form-data input{width:280px;height: 35px;border: 1px solid rgb(100,100,100); border-radius: 18px;background-color: transparent;color:#fff;padding-left:18px;outline:0 none !important;font-size:16px;} | |
49 | + | |
50 | + .floor{position: absolute;width:100%;height: 87px;left: 0;bottom: 0;text-align: center;z-index:11;background-image: url('img/lottery-floor1024.png');background-repeat: no-repeat;background-size: 100% auto;padding-top: 70px;background-position: 0 -50px;} | |
51 | + .floor div{width:50%;text-align: center;float: left;} | |
52 | + .floor .start{width:330px;height: 40px;line-height: 35px;border: 1px solid rgb(227,191,117); border-radius: 18px;background-color: rgb(227,191,117);color: #fff;outline:0 none !important;font-size:21px;} | |
53 | + .floor .stop{width:330px;height: 40px;line-height: 35px;border: 1px solid rgb(227,191,117); border-radius: 18px;background-color: transparent;color: rgb(227,191,117);outline:0 none !important;font-size:21px;} | |
54 | + | |
55 | + </style> | |
56 | + <script src="axios.js"></script> | |
57 | + <script src="jquery.min.js"></script> | |
58 | + <script src="usercache.js"></script> | |
59 | + <script src="lottery.js"></script> | |
60 | +</head> | |
61 | +<body> | |
62 | + <div class="header"> | |
63 | + 畅移2019年度盛典抽奖 | |
64 | + </div> | |
65 | + <div class="main"> | |
66 | + <div class="left"> | |
67 | + <div class="user-count">活动参与人数:<span z-bind="lottery.userCount"></span>人</div> | |
68 | + <div class="user-head"> | |
69 | + <div class="user-head-img-line"> | |
70 | + <div class="head-winner"> | |
71 | + <img z-bind = "winner.headimg" src = "./img/head.png" /> | |
72 | + </div> | |
73 | + <div z-for-container = "headimg-bind" class="headimg-bind"> | |
74 | + <div z-for-item = "headimg" class="head-img"> | |
75 | + <img z-for-data = 'headimg' src = "./img/head.png"/> | |
76 | + </div> | |
77 | + </div> | |
78 | + </div> | |
79 | + <div class="user-award"> | |
80 | + <select onchange="action.winnerList()"> | |
81 | + <option>一等奖</option> | |
82 | + <option>二等奖</option> | |
83 | + <option>三等奖</option> | |
84 | + <option>四等奖</option> | |
85 | + <option>五等奖</option> | |
86 | + <option>六等奖</option> | |
87 | + </select> | |
88 | + </div> | |
89 | + </div> | |
90 | + </div> | |
91 | + <div class="right"> | |
92 | + <div class="lottery-list"> | |
93 | + <div class="title"><span z-bind = "lottery.award"></span>:<span z-bind = "lottery.winnerCount">0</span>人</div> | |
94 | + <div class="data"> | |
95 | + <div class="table" z-for-container = "winner-bind"> | |
96 | + <div class="tr" z-for-item = "winner"> | |
97 | + <div class="sort" z-for-data = "user_id"></div> | |
98 | + <div class="head"><div class="data-headimg"><img z-for-data ="headimg" src="" /></div></div> | |
99 | + <div class="name" z-for-data = "realname"></div> | |
100 | + <div class="delete" z-for-click="action.delWinner"><img src="./img/delete.png"></div> | |
101 | + </div> | |
102 | + </div> | |
103 | + </div> | |
104 | + </div> | |
105 | + </div> | |
106 | + </div> | |
107 | + <div id="winner-show-dlg"> | |
108 | + </div> | |
109 | + <div id="winner-show" onclick="$(this).hide(500);$('#winner-show-dlg').hide();"> | |
110 | + <div class="winner-main"> | |
111 | + <ul> | |
112 | + <li class="title" z-bind = "lottery.award"></li> | |
113 | + <li class="winner-no">NO.<span z-bind="winner.number"></span></li> | |
114 | + <li class="winner-name" z-bind="winner.realname"></li> | |
115 | + </ul> | |
116 | + </div> | |
117 | + </div> | |
118 | + <div class="floor"> | |
119 | + <div> | |
120 | + <button class="start" onclick="action.start(this)">开始抽奖</button></div> | |
121 | + <div> | |
122 | + <button class="stop" onclick="action.stop(this)">停止</button> | |
123 | + </div> | |
124 | + </div> | |
125 | + <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script> | |
126 | + <script> | |
127 | + // var vConsole = new VConsole(); | |
128 | + action.init(1); | |
129 | + </script> | |
130 | +</body> | |
131 | +</html> | |
0 | 132 | \ No newline at end of file |
... | ... |
lottery.js
0 → 100644
1 | +++ a/lottery.js | |
1 | +// var baseURL = 'https://yq.vchangyi.com/party/phpapi'; | |
2 | +var baseURL = 'http://dsc-b.vchangyi.com/party/phpapi'; | |
3 | +// var baseURL = 'http://t.dev/party/phpapi' | |
4 | + | |
5 | +let interval = null; | |
6 | +// 抽奖页面动作 | |
7 | +let action ={ | |
8 | + // 动态数据绑定初始化对象 | |
9 | + bindData: { | |
10 | + lottery :{ | |
11 | + userCount : 0, | |
12 | + award : '一等奖', | |
13 | + winnerCount : 0, | |
14 | + }, | |
15 | + winner :{ | |
16 | + realname : '', | |
17 | + number : 0, | |
18 | + headimg : 'img/head.png', | |
19 | + } | |
20 | + }, | |
21 | + // 初始化数据 参数showModel 1=演示用,0=实际使用 | |
22 | + init: function(showModel = 0){ | |
23 | + $(".stop").removeAttr("disabled"); | |
24 | + // 用户数据获取提前生成到本地的用户数据脚本,因为用户头像数据量较大,页面加载会慢 | |
25 | + if (userData.length == 0) { | |
26 | + alert('暂无数据'); | |
27 | + return; | |
28 | + } | |
29 | + // 1=演示用,0=实际使用 | |
30 | + if (showModel == 1) { | |
31 | + // 直接获取线上用户数据,演示用,人多了图片加载不上 | |
32 | + baseRquest.get('/apicp.GetUserList.php', {}, data =>{ | |
33 | + console.log(data); | |
34 | + if (data.length == 0) { | |
35 | + alert('暂无用户'); | |
36 | + return; | |
37 | + } | |
38 | + // 绑定数据到页面 | |
39 | + dataListBind('headimg-bind', 'headimg', allUser); | |
40 | + this.bindData.lottery.userCount = allUser.length; | |
41 | + | |
42 | + }); | |
43 | + } else { | |
44 | + // 获取生成到本地的缓存数据,实际使用场景 | |
45 | + let allUser = []; | |
46 | + Object.keys(userData).forEach(function(key){ | |
47 | + allUser.push(userData[key]); | |
48 | + }) | |
49 | + console.log(allUser); | |
50 | + // 用户头像数据绑定 | |
51 | + dataListBind('headimg-bind', 'headimg', allUser); | |
52 | + // 抽奖总人数数据展示 | |
53 | + this.bindData.lottery.userCount = allUser.length; | |
54 | + } | |
55 | + | |
56 | + // 中奖数据绑定 | |
57 | + this.winnerList(); | |
58 | + }, | |
59 | + // 开始按钮 | |
60 | + start: function(e){ | |
61 | + if (userData.length == 0) { | |
62 | + alert('暂无数据'); | |
63 | + return; | |
64 | + } | |
65 | + // 按钮效果 | |
66 | + $('#winner-show').hide(); | |
67 | + $('.head-winner').hide(); | |
68 | + $(e).attr("disabled",true); | |
69 | + $(".stop").removeAttr("disabled"); | |
70 | + $(e).css({"background-color":"transparent","color":"rgb(227,191,117)"}); | |
71 | + $('.stop').css({"background-color":"rgb(227,191,117)","color":"#ffffff"}); | |
72 | + // 请求抽奖接口 | |
73 | + let award = $('.user-award select').val(); | |
74 | + let url = "/apicp.lottery.php"; | |
75 | + baseRquest.post(url, {award : award}, data =>{ | |
76 | + console.log(data); | |
77 | + if (data.length == 0) { | |
78 | + alert('没有多余的号码可以抽出'); | |
79 | + location.reload(); | |
80 | + } | |
81 | + // 绑定数据到页面 | |
82 | + this.bindData.winner.realname = data.realname; | |
83 | + this.bindData.winner.number = data.user_id; | |
84 | + this.bindData.winner.headimg = data.headimg; | |
85 | + }); | |
86 | + // 开始抽奖动画 | |
87 | + this.lotteryAnimation(); | |
88 | + }, | |
89 | + // 停止按钮 | |
90 | + stop: function(e){ | |
91 | + // 按钮效果 | |
92 | + $(e).attr("disabled",true); | |
93 | + $(".start").removeAttr("disabled"); | |
94 | + $(e).css({"background-color":"transparent","color":"rgb(227,191,117)"}); | |
95 | + $('.start').css({"background-color":"rgb(227,191,117)","color":"#ffffff"}); | |
96 | + // 停止抽奖动画 | |
97 | + clearInterval(interval); | |
98 | + // 重置位置 | |
99 | + $('.head-img').css("left","-212px"); | |
100 | + // 展示中奖用户 | |
101 | + if(this.bindData.winner.number != 0) { | |
102 | + $('#winner-show-dlg').show(); | |
103 | + $('#winner-show').show(); | |
104 | + $('.head-winner').show(); | |
105 | + } | |
106 | + // 中奖名单列表重置 | |
107 | + this.winnerList(); | |
108 | + }, | |
109 | + // 抽奖动画 | |
110 | + lotteryAnimation: function(){ | |
111 | + let i = 0; | |
112 | + interval = setInterval(() => { | |
113 | + | |
114 | + $('.head-img').css("left","-212px"); | |
115 | + $('.head-img').eq(i).css("left","23px"); | |
116 | + i++; | |
117 | + if ($('.head-img').length == i) { | |
118 | + i = 0; | |
119 | + } | |
120 | + }, 100); | |
121 | + }, | |
122 | + winnerListData : null, | |
123 | + // 删除中奖用户 | |
124 | + delWinner: function(row){ | |
125 | + console.log(action.winnerListData); | |
126 | + let item = action.winnerListData[row]; | |
127 | + let url = "/apicp.DelLottery.php"; | |
128 | + baseRquest.post(url, {id : item.id}, data => { | |
129 | + action.winnerList(); | |
130 | + }); | |
131 | + }, | |
132 | + // 中奖名单,传入参数:中奖类型(一等,二等),type=2是中奖名单 | |
133 | + winnerList:function(){ | |
134 | + // 获取中奖者名单, | |
135 | + let url = "/apicp.GetUserList.php"; | |
136 | + let award = $('.user-award select').val(); | |
137 | + baseRquest.get(url, {award : award, type : 2}, data => { | |
138 | + this.bindData.lottery.winnerCount = data.length; | |
139 | + this.bindData.lottery.award = $('.user-award select').val(); | |
140 | + for (let i = 1; i <= data.length; i++) { | |
141 | + data[i-1].no = i; | |
142 | + } | |
143 | + action.winnerListData = data; | |
144 | + console.log(data); | |
145 | + dataListBind('winner-bind', 'winner', data); | |
146 | + }); | |
147 | + } | |
148 | +} | |
149 | +// 系统设置动作 | |
150 | +let setting = { | |
151 | + //用户数据 | |
152 | + userData: null, | |
153 | + // 登录 | |
154 | + login: function(){ | |
155 | + let pwd = $('#pwd').val(); | |
156 | + let url = "/apicp.AdminLogin.php"; | |
157 | + baseRquest.get(url, {id : pwd}, data => { | |
158 | + localStorage['token'] = data.token; | |
159 | + alert('登录成功'); | |
160 | + }); | |
161 | + }, | |
162 | + // 登录 | |
163 | + loginOut: function(){ | |
164 | + localStorage['token'] = ''; | |
165 | + alert('已退出'); | |
166 | + }, | |
167 | + // 用户列表 | |
168 | + userList: function(){ | |
169 | + let url = "/apicp.GetUserList.php"; | |
170 | + baseRquest.get(url, {}, data => { | |
171 | + this.userData = data; | |
172 | + dataListBind('user-bind', 'user', data); | |
173 | + }); | |
174 | + }, | |
175 | + // 删除用户 | |
176 | + delUser: function(row){ | |
177 | + console.log(this.userData); | |
178 | + let item = this.userData[row]; | |
179 | + let url = "/apicp.DelUser.php"; | |
180 | + baseRquest.post(url, {id : item.id}, data => { | |
181 | + this.userList(); | |
182 | + }); | |
183 | + }, | |
184 | + // 组织更变 | |
185 | + editDep: function(row){ | |
186 | + console.log(this.userData); | |
187 | + let item = this.userData[row]; | |
188 | + let url = "/apicp.DelUser.php"; | |
189 | + baseRquest.post(url, {id : item.id,dep: 1}, data => { | |
190 | + this.userList(); | |
191 | + }); | |
192 | + }, | |
193 | + // 开始签到 | |
194 | + startSign: function(row){ | |
195 | + let url = "/apicp.Setting.php"; | |
196 | + baseRquest.post(url, {flag : 'isStopSign',value: 2}, data => { | |
197 | + alert('设置成功'); | |
198 | + }); | |
199 | + }, | |
200 | + // 结束签到 | |
201 | + stopSign: function(row){ | |
202 | + let url = "/apicp.Setting.php"; | |
203 | + baseRquest.post(url, {flag : 'isStopSign',value: 1}, data => { | |
204 | + alert('设置成功'); | |
205 | + }); | |
206 | + }, | |
207 | + // 开启投票 | |
208 | + startVote: function(row){ | |
209 | + let url = "/apicp.Setting.php"; | |
210 | + baseRquest.post(url, {flag : 'isStartVote',value: 1}, data => { | |
211 | + alert('设置成功'); | |
212 | + }); | |
213 | + }, | |
214 | + // 结束投票 | |
215 | + stopVote: function(row){ | |
216 | + let url = "/apicp.Setting.php"; | |
217 | + baseRquest.post(url, {flag : 'isStartVote',value: 2}, data => { | |
218 | + alert('提交成功'); | |
219 | + }); | |
220 | + }, | |
221 | + // 重置数据 | |
222 | + resetUser: function(row){ | |
223 | + let user = $('#user-id').val(); | |
224 | + if (user == '') { | |
225 | + return; | |
226 | + } | |
227 | + let url = "/apicp.ResetUser.php"; | |
228 | + baseRquest.post(url, {id : user}, data => { | |
229 | + alert('提交成功'); | |
230 | + }); | |
231 | + } | |
232 | +} | |
233 | + | |
234 | +// 山寨dom数据列表绑定控件,没有实现事件callback | |
235 | +// 要求设置容器名称z-for-container,设置循环列数据模板z-for-item | |
236 | +// 参数1:容器名称,存放列表数据的容器 2:设置的数据模板 3:json数据 | |
237 | +let dataListBind = (container, itemName, data)=>{ | |
238 | + let trs = ''; | |
239 | + // 获取模板 | |
240 | + $('*[z-for-item="'+ itemName +'"]').show(); | |
241 | + let trTemplate = $('*[z-for-item="'+ itemName +'"]').prop("outerHTML"); | |
242 | + $('*[z-for-item="'+ itemName +'"]').hide(); | |
243 | + let trTemplateHide = $('*[z-for-item="'+ itemName +'"]').prop("outerHTML"); | |
244 | + for(let i = 0; data.length > i; i++) { | |
245 | + // 创建一行dom | |
246 | + let tr = trTemplate; | |
247 | + // 模板需要赋值项 | |
248 | + let forDataItem = $(tr).find("*[z-for-data]"); | |
249 | + for(let j = 0; forDataItem.length > j; j++) { | |
250 | + let item = $(forDataItem).eq(j).prop("outerHTML"); | |
251 | + // 获取dom标签绑定的映射名称 | |
252 | + let column = $(forDataItem).eq(j).attr("z-for-data"); | |
253 | + let tagName = $(forDataItem)[j].tagName.toLowerCase(); | |
254 | + // 列表中的img和input支持直接赋值,其他标签赋值到标签中间 | |
255 | + if (tagName == 'img') { | |
256 | + $(forDataItem).eq(j).attr('src', data[i][column]); | |
257 | + } else if (tagName == 'input') { | |
258 | + $(forDataItem).eq(j).val(data[i][column]); | |
259 | + } else { | |
260 | + $(forDataItem).eq(j).html(data[i][column]); | |
261 | + } | |
262 | + tr = tr.replace(item,$(forDataItem).eq(j).prop("outerHTML")); | |
263 | + } | |
264 | + // 事件回调,默认返回当前行对象 | |
265 | + let forClickItem = $(tr).find("*[z-for-click]"); | |
266 | + for(let x = 0; forClickItem.length > x; x++) { | |
267 | + let clickItem = $(forClickItem).eq(x).prop("outerHTML"); | |
268 | + let click = $(forClickItem).eq(x).attr("z-for-click"); | |
269 | + $(forClickItem).eq(x).attr('onClick', click + "("+ i +")"); | |
270 | + tr = tr.replace(clickItem,$(forClickItem).eq(x).prop("outerHTML")); | |
271 | + } | |
272 | + trs += $(tr).removeAttr('z-for-item').prop("outerHTML"); | |
273 | + } | |
274 | + $('*[z-for-container="'+ container +'"]').html(trTemplateHide + trs); | |
275 | +} | |
276 | + | |
277 | +// 山寨版双向数据绑定 | |
278 | +let doubleBind = ()=>{ | |
279 | + // 页面监听,改变的数据写入对象 | |
280 | + $(()=>{ | |
281 | + $('*[z-for-item]').hide(); | |
282 | + $('*[z-bind]').change(function(){ | |
283 | + dataBind.bindToData($this); | |
284 | + }) | |
285 | + }) | |
286 | + // 动态数据自动绑定,bindData中的值必须是对象 | |
287 | + Object.keys(action.bindData).forEach((key)=>{ | |
288 | + Object.keys(action.bindData[key]).forEach((keyKey)=>{ | |
289 | + // bind初始值 | |
290 | + dataBind.bindToPage(key + '.' + keyKey, action.bindData[key][keyKey]); | |
291 | + // 监听这个对象的每个值变化,动态改变页面数据 | |
292 | + let value = action.bindData[key][keyKey]; | |
293 | + Object.defineProperty(action.bindData[key], keyKey ,{ | |
294 | + enumerable: true, | |
295 | + configurable: true, | |
296 | + get:function (){ | |
297 | + //当获取值的时候触发的函数 | |
298 | + return value; | |
299 | + }, | |
300 | + set:function(newValue){ | |
301 | + if(value != newValue) { | |
302 | + value = newValue | |
303 | + } | |
304 | + let propertyValue = key + '.' + keyKey; | |
305 | + dataBind.bindToPage(propertyValue, newValue); | |
306 | + }, | |
307 | + }); | |
308 | + }) | |
309 | + }) | |
310 | +} | |
311 | + | |
312 | +// 双向数据绑定事件 | |
313 | +let dataBind = { | |
314 | + // 数据动态绑定到页面 | |
315 | + bindToPage: (propertyValue, value)=>{ | |
316 | + let tag = $('*[z-bind="'+ propertyValue +'"]')[0]; | |
317 | + if ($('*[z-bind="'+ propertyValue +'"]').length == 0) { | |
318 | + return; | |
319 | + } | |
320 | + let tagName = $('*[z-bind="'+ propertyValue +'"]')[0].tagName.toLowerCase(); | |
321 | + if (tagName == 'img') { | |
322 | + $('*[z-bind="'+ propertyValue +'"]').attr('src', value); | |
323 | + } else if (tagName == "select" || tagName == "input") { | |
324 | + $('*[z-bind="'+ propertyValue +'"]').val(value); | |
325 | + } else { | |
326 | + $('*[z-bind="'+ propertyValue +'"]').html(value); | |
327 | + } | |
328 | + }, | |
329 | + // 页面数据动态绑定 | |
330 | + bindToData: (e)=>{ | |
331 | + let dataName = $(e).attr('z-bind'); | |
332 | + // 数据格式 z-bind = lottery.winnerCount | |
333 | + // lottery为对象名,区分数据组,winnerCount为对象键 | |
334 | + let prop = dataName.split('.'); | |
335 | + if (prop.length != 2) { | |
336 | + console.log('z-data数据格式不正确'); | |
337 | + return; | |
338 | + } | |
339 | + let tagName = $(e)[0].tagName.toLowerCase(); | |
340 | + if (tagName == 'img') { | |
341 | + action.bindData[prop[0]][prop[1]] = $(e).attr('src'); | |
342 | + } else if (tagName == "select" || tagName == "input") { | |
343 | + action.bindData[prop[0]][prop[1]] = $(e).val(); | |
344 | + } else { | |
345 | + action.bindData[prop[0]][prop[1]] = $(e).html(); | |
346 | + } | |
347 | + } | |
348 | +} | |
349 | +// 启动双向绑定监听 | |
350 | +$(()=>{doubleBind()}); | |
351 | + | |
352 | +// api接口数据请求,数据交互引用的axios | |
353 | +let baseRquest = { | |
354 | + // get请求 | |
355 | + get: function(url, params, callback) { | |
356 | + let token = localStorage["token"]; | |
357 | + axios.defaults.baseURL = baseURL; | |
358 | + axios.get(url, { | |
359 | + params : params, | |
360 | + headers: { | |
361 | + 'Content-Type': 'application/x-www-form-urlencoded', | |
362 | + token: token | |
363 | + } | |
364 | + }).then(function (response) { | |
365 | + if (response.status == 200) | |
366 | + { | |
367 | + data = response.data; | |
368 | + if (!!data) { | |
369 | + // 过滤错误信息,统一抛出 | |
370 | + if (data.errcode != 0 && data.errcode != 200) { | |
371 | + alert(data.errmsg); | |
372 | + } else { | |
373 | + callback(data.result); | |
374 | + } | |
375 | + } | |
376 | + }else { | |
377 | + alert('get无法访问接口'); | |
378 | + } | |
379 | + }) | |
380 | + .catch(function (error) { | |
381 | + }); | |
382 | + }, | |
383 | + | |
384 | + // post请求 | |
385 | + post: function(url, params, callback) { | |
386 | + let token = localStorage["token"]; | |
387 | + axios.defaults.baseURL = baseURL; | |
388 | + let data = new URLSearchParams(); | |
389 | + Object.keys(params).forEach(function(key){ | |
390 | + data.append(key, params[key]); | |
391 | + }); | |
392 | + axios.post(url, data,{ | |
393 | + headers: { | |
394 | + 'Content-Type': 'application/x-www-form-urlencoded', | |
395 | + token: token | |
396 | + } | |
397 | + }).then(function (response) { | |
398 | + if (response.status == 200) | |
399 | + { | |
400 | + data = response.data; | |
401 | + if (!!data) { | |
402 | + // 过滤错误信息,统一抛出 | |
403 | + if (data.errcode != 0 && data.errcode != 200) { | |
404 | + alert(data.errmsg); | |
405 | + } else { | |
406 | + callback(data.result); | |
407 | + } | |
408 | + } | |
409 | + }else { | |
410 | + alert('post无法访问接口'); | |
411 | + } | |
412 | + }) | |
413 | + .catch(function (error) { | |
414 | + console.log(error); | |
415 | + }); | |
416 | + } | |
417 | +} | |
0 | 418 | \ No newline at end of file |
... | ... |
mobile.html
0 → 100644
1 | +++ a/mobile.html | |
1 | +<!DOCTYPE html> | |
2 | +<html> | |
3 | +<head> | |
4 | + <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no"> | |
5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
6 | + <meta charset="UTF-8"> | |
7 | + <title>畅移5周年庆典</title> | |
8 | + <script> | |
9 | + (function (doc, win) { | |
10 | + var docEl = doc.documentElement, | |
11 | + dpr = 1, | |
12 | + scale = 1 / dpr; | |
13 | + var metaEl = doc.createElement('meta'); | |
14 | + metaEl.name = "viewport"; | |
15 | + metaEl.content = 'initial-scale=' + scale + ',maximum-scale=' + scale + ',minimum-scale=' + scale; | |
16 | + docEl.firstElementChild.appendChild(metaEl); | |
17 | + var recalc = function () { | |
18 | + var deviceWidth = docEl.clientWidth; | |
19 | + if (deviceWidth > 750) deviceWidth = 750; | |
20 | + docEl.style.fontSize = deviceWidth / 7.5 + 'px'; | |
21 | + }; | |
22 | + recalc(); | |
23 | + })(document, window); | |
24 | + </script> | |
25 | +<style> | |
26 | + html,body{top:0;left:0;padding: 0;margin: 0;border: 0;height:100%; | |
27 | + background-image: url("./img/bg.png"); | |
28 | + background-size: 100% 100%; | |
29 | + background-repeat: no-repeat; | |
30 | + } | |
31 | + | |
32 | + #show{position: fixed;z-index: 30;top:0;left:0;width:100%;height: 100%;min-height: 570px;} | |
33 | + #index{position: absolute;z-index: 20;top:0;left:0;width:100%;height: 100%;display:none;min-height: 570px;} | |
34 | + #detail{position: absolute;z-index: 10;top:0;left:0;width:100%;height: 100%;display: none;background-color: rgb(240,240,240);padding: 0;min-height: 570px;} | |
35 | + | |
36 | + .show-img{margin:20px auto 0 auto;width: 100%;max-width: 375px;} | |
37 | + .show-img img{width: 100%;display:inline-block;height: auto;} | |
38 | + | |
39 | + .box{ | |
40 | + height: 400px; | |
41 | + width: 100%; | |
42 | + margin-top: 30%; | |
43 | + position: relative; | |
44 | + margin-bottom: 0px; | |
45 | + } | |
46 | + @media screen and (max-width: 320px) { | |
47 | + .box{ | |
48 | + height: 400px; | |
49 | + width: 100%; | |
50 | + margin-top: 20%; | |
51 | + position: relative; | |
52 | + margin-bottom:-50px; | |
53 | + } | |
54 | + } | |
55 | + @media screen and (min-device-width: 414px) { | |
56 | + .box{ | |
57 | + height: 400px; | |
58 | + width: 100%; | |
59 | + margin-top: 20%; | |
60 | + position: relative; | |
61 | + margin-bottom:50px; | |
62 | + } | |
63 | + } | |
64 | + .box .main{ | |
65 | + background-image: url("./img/mian.png"); | |
66 | + background-size: 100% auto; | |
67 | + background-repeat: no-repeat; | |
68 | + width: 100%; | |
69 | + height: 100%; | |
70 | + | |
71 | + } | |
72 | + .box .five{ | |
73 | + position: absolute; | |
74 | + top: 0; | |
75 | + left: 0; | |
76 | + width: 100%; | |
77 | + height: 100%; | |
78 | + background-image: url("./img/five.png"); | |
79 | + background-size: 100% auto; | |
80 | + background-repeat: no-repeat; | |
81 | + animation: five 1.5s; | |
82 | + animation-iteration-count: infinite; | |
83 | + } | |
84 | + | |
85 | + .box .star{ | |
86 | + position: absolute; | |
87 | + top: 0; | |
88 | + left: 0; | |
89 | + width: 100%; | |
90 | + height: 100%; | |
91 | + background-image: url("./img/star.png"); | |
92 | + background-size: 100% auto; | |
93 | + background-repeat: no-repeat; | |
94 | + animation: star 3s; | |
95 | + animation-iteration-count: infinite; | |
96 | + } | |
97 | + .box-bottom{ | |
98 | + background: -webkit-linear-gradient(left, #FFE29A , #E0B65F); | |
99 | + width: 258px; | |
100 | + height: 40px; | |
101 | + line-height: 40px; | |
102 | + margin: 0 auto; | |
103 | + border-radius:40px ; | |
104 | + font-size: 14px; | |
105 | + text-align: center; | |
106 | + } | |
107 | + | |
108 | + @keyframes five | |
109 | + { | |
110 | + 0{ | |
111 | + | |
112 | + background-image: url("./img/five.png"); | |
113 | + background-size: 100% auto; | |
114 | + background-repeat: no-repeat; | |
115 | + } | |
116 | + 60% { | |
117 | + background-image: none; | |
118 | + } | |
119 | + 100% { | |
120 | + background-image: url("./img/five.png"); | |
121 | + background-size: 100% auto; | |
122 | + background-repeat: no-repeat; | |
123 | + } | |
124 | + } | |
125 | + @keyframes star | |
126 | + { | |
127 | + 0 { top: 2px ; } | |
128 | + 10% { top: 4px ; } | |
129 | + 20% { top: 6px ; } | |
130 | + 30% { top: 8px ; } | |
131 | + 40% { top: 10px ; } | |
132 | + 50% { top: 10px ; } | |
133 | + 60% { top: 8px ; } | |
134 | + 70% { top: 6px ; } | |
135 | + 80% { top: 4px ; } | |
136 | + 90% { top: 2px ; } | |
137 | + 100% { top: 0px ; } | |
138 | + | |
139 | + } | |
140 | + | |
141 | + #index .head-img-line{ border: 1px solid rgb(130,114,84);border-radius:50%;width:152px;height: 152px;margin: 125px auto 0px auto;position: relative;} | |
142 | + #index .head-img-line .head-img{position:absolute;top:10px;left:10px;border: 1px solid transparent;border-radius:50%;width:130px;height: 130px;overflow: hidden;margin: 0;} | |
143 | + #index .head-img-line .head-img img{width: 140px;height: auto;min-height: 140px;} | |
144 | + .form-data{width: 300px; margin: 50px auto 0px auto;} | |
145 | + .form-data input{width:280px;height: 35px;border: 1px solid rgb(100,100,100); border-radius: 18px;background-color: transparent;color:#666;padding-left:18px;outline:0 none !important;font-size:16px;} | |
146 | + .form-bottom{position: absolute;width:100%;height: 40px;left: 0;bottom: 40px;text-align: center;z-index:41;} | |
147 | + .form-bottom button{width:298px;height: 35px;border: 1px solid rgb(227,191,117); border-radius: 18px;background-color: rgb(227,191,117);color: #fff;outline:0 none !important;bottom:50px;font-size:16px;} | |
148 | + | |
149 | + .detail-bg{margin:110px auto 0 auto;width: 100%;max-width: 308px;max-height: 370px;} | |
150 | + .detail-bg>img{width: 100%;height: auto;} | |
151 | + #detail .content{position: absolute;z-index: 21;top:0px;left:0;width:100%;text-align: center;} | |
152 | + #detail .detail-head{border: 1px solid transparent;border-radius:50%;width:100px;height: 100px;overflow: hidden;margin: 60px auto 0 auto;} | |
153 | + #detail .detail-head>img{width: 110px;height: auto;min-width: 110px;min-height: 110px;} | |
154 | + .detail-realname{font-size: 16px;color:#ffffff;margin-top:30px;height: 30px;} | |
155 | + .detail-lottery-num-txt{font-size: 22px;color:#DFC082;margin-top:50px;} | |
156 | + .detail-lottery-num{font-size: 50px;color:#DFC082;} | |
157 | + .detail-lottery-notice{font-size: 12px;color:#919191;margin-top:50px;} | |
158 | + .sharelogo{display: none;} | |
159 | +</style> | |
160 | +<script src="https://cdn.bootcss.com/axios/0.19.0-beta.1/axios.js"></script> | |
161 | +<script src="mobile.js?t=2"></script> | |
162 | +<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> | |
163 | +<script src="https://cdn.bootcss.com/jquery/1.7.2/jquery.min.js"></script> | |
164 | +</head> | |
165 | +<body> | |
166 | + <img src="img/logo.jpg" class="sharelogo"/> | |
167 | + <!--开场--> | |
168 | + <div id="show"> | |
169 | + <div class="box"> | |
170 | + <div class="main"></div> | |
171 | + <div class="star"></div> | |
172 | + <div class="five"></div> | |
173 | + | |
174 | + </div> | |
175 | + <div class="box-bottom" onclick="action.openCamera()">开启年会之旅</div> | |
176 | + </div> | |
177 | + <!--签到--> | |
178 | + <div id="index"> | |
179 | + <div class="head-img-line"> | |
180 | + <dig class="head-img" onclick="action.openCamera()"> | |
181 | + <img src="img/pink.jpg" class="head-img-show" /> | |
182 | + <input type="hidden" class="data-img" /> | |
183 | + </dig> | |
184 | + </div> | |
185 | + <div class="form-data"> | |
186 | + <input type="text" value="姓名:陈独秀" class="data-realname" > | |
187 | + </div> | |
188 | + <div class="form-bottom"> | |
189 | + <button type="button" onclick="action.submit()">马上签到</button> | |
190 | + </div> | |
191 | + </div> | |
192 | + <!--用户信息--> | |
193 | + <div id="detail"> | |
194 | + <div class="content"> | |
195 | + <div class="detail-head"> | |
196 | + <img src="img/pink.jpg" class="detail-head-img"/> | |
197 | + </div> | |
198 | + <div class="detail-realname"></div> | |
199 | + <div class="detail-lottery-num-txt">抽奖码</div> | |
200 | + <div class="detail-lottery-num"></div> | |
201 | + <div class="detail-lottery-notice">你牢记您的抽奖码</div> | |
202 | + </div> | |
203 | + <div class="detail-bg"> | |
204 | + <img src="img/bg-detail.png" /> | |
205 | + </div> | |
206 | + <div class="form-bottom"> | |
207 | + <button type="button" onclick="action.vote()">节目投票</button> | |
208 | + </div> | |
209 | + </div> | |
210 | + <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script> | |
211 | + <script> | |
212 | + // var vConsole = new VConsole(); | |
213 | + action.init(); | |
214 | + $(function() { | |
215 | + $('.data-realname').focus(function(){ | |
216 | + if($(this).val() == '姓名:陈独秀') { | |
217 | + $(this).val(''); | |
218 | + } | |
219 | + }); | |
220 | + $('.data-realname').blur(function(){ | |
221 | + $('body,html').animate({ scrollTop: 0 }, 100); | |
222 | + }); | |
223 | + }) | |
224 | + </script> | |
225 | +</body> | |
226 | +</html> | |
0 | 227 | \ No newline at end of file |
... | ... |
mobile.js
0 → 100644
1 | +++ a/mobile.js | |
1 | +var baseURL = 'http://dsc-b.vchangyi.com/party/phpapi'; | |
2 | +// var baseURL = 'https://yq.vchangyi.com/party/phpapi'; | |
3 | +// var baseURL = 'http://t.dev/party/phpapi' | |
4 | +// 页面数据绑定操作 | |
5 | +var action = { | |
6 | + // 是否开始签到 | |
7 | + isRun : 0, | |
8 | + init : function() { | |
9 | + var WECHAT_JS_SIGN_URL = '/api.WechatJsSign.php'; | |
10 | + var USER_DETAIL_URL = '/api.UserDetail.php'; | |
11 | + // 获取微信jsapi签名 | |
12 | + baseRquest.get(WECHAT_JS_SIGN_URL, {'url' : location.href}, action.sign); | |
13 | + // 用户信息 | |
14 | + baseRquest.get(USER_DETAIL_URL, {}, action.userDetail); | |
15 | + }, | |
16 | + // 配置微信jsapi config,回调触发 | |
17 | + sign : function(data) { | |
18 | + wx.config({ | |
19 | + debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 | |
20 | + appId: data.appId, // 必填,公众号的唯一标识 | |
21 | + timestamp: data.timestamp, // 必填,生成签名的时间戳 | |
22 | + nonceStr: data.nonceStr, // 必填,生成签名的随机串 | |
23 | + signature: data.signature,// 必填,签名 | |
24 | + jsApiList: ['chooseImage','uploadImage','getLocalImgData','downloadImage','getLocation'] // 必填,需要使用的JS接口列表 | |
25 | + }); | |
26 | + }, | |
27 | + // 回调触发,获取用户信息 | |
28 | + userDetail : function(data) { | |
29 | + // openid不存在 | |
30 | + if (!data) { | |
31 | + alert('数据异常,不要搞事情'); | |
32 | + return; | |
33 | + } | |
34 | + // 如果数据中有isLogin,有登录流程 | |
35 | + if (data.isLogin !== undefined) { | |
36 | + location.href = baseURL + '/api.WechatAuth.php'; | |
37 | + } | |
38 | + action.isRun = 1; | |
39 | + // 未提交过资料,展示开场 | |
40 | + if (data.realname === undefined || data.realname == '') { | |
41 | + $('#show').show(); | |
42 | + $('#index').hide(); | |
43 | + $('#detail').hide(); | |
44 | + } else { | |
45 | + // 提交过资料,展示个人信息 | |
46 | + $('.detail-realname').html(data.realname); | |
47 | + $('.detail-lottery-num').html('NO.' + data.id); | |
48 | + $('.detail-head-img').attr('src', data.headimg); | |
49 | + $('#show').hide(); | |
50 | + $('#index').hide(); | |
51 | + $('#detail').show(); | |
52 | + } | |
53 | + }, | |
54 | + // 打开摄像头 | |
55 | + openCamera : function(){ | |
56 | + // if (action.isRun == 0) { | |
57 | + // alert('尚未开启,请稍后尝试'); | |
58 | + // return; | |
59 | + // } | |
60 | + wx.chooseImage({ | |
61 | + count: 1, // 默认9 | |
62 | + sizeType: ['compressed'], // 'original', 'compressed'指定是原图还是压缩图,默认都有 | |
63 | + sourceType: ['camera','album'], // 'album', 'camera'指定来源是相册还是相机,默认都有 | |
64 | + success: function (res) { | |
65 | + var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片 | |
66 | + wx.uploadImage({ | |
67 | + localId: localIds.toString(), // 需要上传的图片的ID,由chooseImage接口获得 | |
68 | + isShowProgressTips: 1, // 进度提示 | |
69 | + success: function (res) { | |
70 | + var serverId = res.serverId; // 返回图片的服务器端ID,即mediaId | |
71 | + $(".data-img").val(serverId); | |
72 | + console.log(serverId); | |
73 | + wx.downloadImage({ | |
74 | + serverId: serverId, // 需要下载的图片的服务器端ID,由uploadImage接口获得 | |
75 | + isShowProgressTips: 1, // 默认为1,显示进度提示 | |
76 | + success: function (res) { | |
77 | + var localId = res.localId; // 返回图片下载后的本地ID | |
78 | + $('#show').hide(); | |
79 | + $('#index').show(); | |
80 | + $('#detail').hide(); | |
81 | + action.wxgetLocalImgData(localId, 1); | |
82 | + } | |
83 | + }); | |
84 | + }, | |
85 | + fail: function (res) { | |
86 | + alert('图片上传失败,请重试'); | |
87 | + } | |
88 | + }); | |
89 | + } | |
90 | + }); | |
91 | + }, | |
92 | + // 展示选中的图片 | |
93 | + wxgetLocalImgData : function(e,num){ | |
94 | + var headimg = $(".head-img-show"); | |
95 | + if(window.__wxjs_is_wkwebview){ | |
96 | + wx.getLocalImgData({ | |
97 | + localId: e, // 图片的localID | |
98 | + success: function (res) { | |
99 | + var localData = res.localData; // localData是图片的base64数据,可以用img标签显示 | |
100 | + localData = localData.replace('jgp', 'jpeg');//iOS 系统里面得到的数据,类型为 image/jgp,因此需要替换一下 | |
101 | + $(headimg).attr("src", localData); | |
102 | + },fail:function(res){ | |
103 | + alert("显示失败"); | |
104 | + } | |
105 | + }); | |
106 | + }else{ | |
107 | + $(headimg).attr("src", e); | |
108 | + } | |
109 | + }, | |
110 | + | |
111 | + // 提交签到申请 | |
112 | + submit : function(){ | |
113 | + var mediaId = $(".data-img").val(); | |
114 | + var realname = $(".data-realname").val().replace( /^\s*/, ''); | |
115 | + if (realname == '' || mediaId == '' || realname == '姓名:陈独秀') { | |
116 | + alert('提交的资料数据不完整'); | |
117 | + return; | |
118 | + } | |
119 | + wx.getLocation({ | |
120 | + type: 'gcj02', | |
121 | + success: (res) => { | |
122 | + console.log(res); | |
123 | + let latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90 | |
124 | + let longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。 | |
125 | + let data = { | |
126 | + mediaId : mediaId, | |
127 | + realname : realname, | |
128 | + latitude : latitude, | |
129 | + longitude : longitude | |
130 | + } | |
131 | + // 提交签到 | |
132 | + let ADD_USER_URL = '/api.AddUser.php'; | |
133 | + baseRquest.post(ADD_USER_URL, data, this.addUserResult); | |
134 | + } | |
135 | + }); | |
136 | + }, | |
137 | + // 增加成功,重新加载页面,进入用户详情页 | |
138 | + addUserResult : function(data) { | |
139 | + console.log(data); | |
140 | + let url = window.location.href; //获取当前url | |
141 | + let key = '?t='; | |
142 | + if (url.indexOf("?") > 0) { | |
143 | + key = '&t='; | |
144 | + } | |
145 | + | |
146 | + location.href = url + key + (new Date()).valueOf(); | |
147 | + }, | |
148 | + // 投票 | |
149 | + vote : function(){ | |
150 | + let VOTE_URL = '/api.Vote.php'; | |
151 | + baseRquest.get(VOTE_URL, {a:'a'}, (data)=>{ | |
152 | + console.log(data); | |
153 | + location.href = data.url; | |
154 | + }); | |
155 | + } | |
156 | +} | |
157 | + | |
158 | +// api接口数据请求,数据交互引用的axios | |
159 | +let baseRquest = { | |
160 | + // get请求 | |
161 | + get: function(url, params, callback) { | |
162 | + axios.defaults.baseURL = baseURL; | |
163 | + axios.get(url, { | |
164 | + params : params | |
165 | + }).then(function (response) { | |
166 | + if (response.status == 200) | |
167 | + { | |
168 | + data = response.data; | |
169 | + if (!!data) { | |
170 | + // 过滤错误信息,统一抛出 | |
171 | + if (data.errcode != 0 && data.errcode != 200) { | |
172 | + alert(data.errmsg); | |
173 | + } else { | |
174 | + callback(data.result); | |
175 | + } | |
176 | + } | |
177 | + }else { | |
178 | + alert('get无法访问接口'); | |
179 | + } | |
180 | + }) | |
181 | + .catch(function (error) { | |
182 | + }); | |
183 | + }, | |
184 | + | |
185 | + // post请求 | |
186 | + post: function(url, params, callback) { | |
187 | + axios.defaults.baseURL = baseURL; | |
188 | + let data = new URLSearchParams(); | |
189 | + Object.keys(params).forEach(function(key){ | |
190 | + data.append(key, params[key]); | |
191 | + }); | |
192 | + axios.post(url, data,{headers: { 'Content-Type': 'application/x-www-form-urlencoded','Authorization':'123'}}) | |
193 | + .then(function (response) { | |
194 | + if (response.status == 200) | |
195 | + { | |
196 | + data = response.data; | |
197 | + if (!!data) { | |
198 | + // 过滤错误信息,统一抛出 | |
199 | + if (data.errcode != 0 && data.errcode != 200) { | |
200 | + alert(data.errmsg); | |
201 | + } else { | |
202 | + callback(data.result); | |
203 | + } | |
204 | + } | |
205 | + }else { | |
206 | + alert('post无法访问接口'); | |
207 | + } | |
208 | + }) | |
209 | + .catch(function (error) { | |
210 | + console.log(error); | |
211 | + }); | |
212 | + } | |
213 | +} | |
0 | 214 | \ No newline at end of file |
... | ... |
phpapi/AdminAuth.php
0 → 100644
1 | +++ a/phpapi/AdminAuth.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 后台登录验证 | |
4 | + * 跨域处理,以及请求头token验证 | |
5 | + */ | |
6 | + header('Access-Control-Allow-Origin:*'); | |
7 | + header("Access-Control-Allow-Methods:GET,POST"); | |
8 | + header("Access-Control-Allow-Headers:Content-Type,token,X-Requested-With"); | |
9 | + if(strtoupper($_SERVER['REQUEST_METHOD'])== 'OPTIONS'){ | |
10 | + exit; | |
11 | + } | |
12 | + if (!isset($_SERVER['HTTP_TOKEN'])) { | |
13 | + JsonResponse::error('未登录:token验证失败'); | |
14 | + } | |
15 | + // 是否和管理员密钥保持一致 | |
16 | + $token = $_SERVER['HTTP_TOKEN']; | |
17 | + $config = include('Common/config.php'); | |
18 | + $enctypt = new Encrypter(); | |
19 | + if (md5($enctypt->decrypt($token)) != $config['admin']) { | |
20 | + JsonResponse::error('未登录:token验证失败'); | |
21 | + } | |
0 | 22 | \ No newline at end of file |
... | ... |
phpapi/Common/Encrypter.php
0 → 100644
1 | +++ a/phpapi/Common/Encrypter.php | |
1 | +<?php | |
2 | + | |
3 | +include 'config.php'; | |
4 | + | |
5 | +/** | |
6 | + * 加解密帮助类 | |
7 | + */ | |
8 | +class Encrypter | |
9 | +{ | |
10 | + /** | |
11 | + * @desc加密 | |
12 | + * @param string $str 待加密字符串 | |
13 | + * @param string $key 密钥 | |
14 | + * @return string | |
15 | + */ | |
16 | + public function encrypt($str){ | |
17 | + $key = include('config.php')['key']; | |
18 | + $mixStr = md5(date('Y-m-d H:i:s').rand(1000,9999)); | |
19 | + $tmp = ''; | |
20 | + $strLen = strlen($str); | |
21 | + for($i=0, $j=0; $i<$strLen; $i++, $j++){ | |
22 | + $j = $j == 32 ? 0 : $j; | |
23 | + $tmp .= $mixStr[$j].($str[$i] ^ $mixStr[$j]); | |
24 | + } | |
25 | + return base64_encode($this->bind_key($tmp, $key)); | |
26 | + } | |
27 | + | |
28 | + /** | |
29 | + * @desc解密 | |
30 | + * @param string $str 待解密字符串 | |
31 | + * @param string $key 密钥 | |
32 | + * @return string | |
33 | + */ | |
34 | + public function decrypt($str){ | |
35 | + $key = include('config.php')['key']; | |
36 | + $str = $this->bind_key(base64_decode($str), $key); | |
37 | + $strLen = strlen($str); | |
38 | + $tmp = ''; | |
39 | + for($i=0; $i<$strLen; $i++){ | |
40 | + $tmp .= $str[$i] ^ $str[++$i]; | |
41 | + } | |
42 | + return $tmp; | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * @desc辅助方法 用密钥对随机化操作后的字符串进行处理 | |
47 | + * @param $str | |
48 | + * @param $key | |
49 | + * @return string | |
50 | + */ | |
51 | + private function bind_key($str, $key){ | |
52 | + $encrypt_key = md5($key); | |
53 | + | |
54 | + $tmp = ''; | |
55 | + $strLen = strlen($str); | |
56 | + for($i=0, $j=0; $i<$strLen; $i++, $j++){ | |
57 | + $j = $j == 32 ? 0 : $j; | |
58 | + $tmp .= $str[$i] ^ $encrypt_key[$j]; | |
59 | + } | |
60 | + return $tmp; | |
61 | + } | |
62 | +} | |
0 | 63 | \ No newline at end of file |
... | ... |
phpapi/Common/JsonResponse.php
0 → 100644
1 | +++ a/phpapi/Common/JsonResponse.php | |
1 | +<?php | |
2 | +/** | |
3 | + * 给前端返回json帮助类 | |
4 | + */ | |
5 | +header('Content-Type:application/json;charset=utf-8'); | |
6 | +class JsonResponse | |
7 | +{ | |
8 | + public static function result($result) | |
9 | + { | |
10 | + $data = [ | |
11 | + 'errcode' => 0, | |
12 | + 'errmsg' => 'ok', | |
13 | + 'timestamp' => time(), | |
14 | + 'result' => $result, | |
15 | + ]; | |
16 | + echo json_encode($data); | |
17 | + die; | |
18 | + } | |
19 | + | |
20 | + public static function error($errmsg = '', $code = '500') | |
21 | + { | |
22 | + $data = [ | |
23 | + 'errcode' => $code, | |
24 | + 'errmsg' => $errmsg, | |
25 | + 'timestamp' => time(), | |
26 | + 'result' => [], | |
27 | + ]; | |
28 | + echo json_encode($data); | |
29 | + die; | |
30 | + } | |
31 | +} | |
0 | 32 | \ No newline at end of file |
... | ... |
phpapi/Common/WechatHelper.php
0 → 100644
1 | +++ a/phpapi/Common/WechatHelper.php | |
1 | +<?php | |
2 | +/** | |
3 | + * 微信公众号帮助类 | |
4 | + */ | |
5 | +include "request.php"; | |
6 | +class WechatHelper | |
7 | +{ | |
8 | + const APPID = 'wx0b48573ec1daefba'; | |
9 | + const SECRET = 'ee953f7bbae3673ed532e2aad2ee9b62'; | |
10 | + const WECHAT_DATA_TICKET = 'WechatData/ticket.txt'; | |
11 | + const WECHAT_DATA_TOKEN = 'WechatData/token.txt'; | |
12 | + // 获取微信token url | |
13 | + const ACCESS_TOKEN_URL = 'https://api.weixin.qq.com/cgi-bin/token'; | |
14 | + // 获取微信jsapi ticket url | |
15 | + const JSAPI_TICKET_URL = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket'; | |
16 | + // 获取openid | |
17 | + const OPENID_URL = 'https://api.weixin.qq.com/sns/oauth2/access_token'; | |
18 | + // 获取微信临时素材 | |
19 | + const GET_MEDIA_URL = 'https://api.weixin.qq.com/cgi-bin/media/get'; | |
20 | + // 微信端首页url | |
21 | + const HOME_URL = '/party/mobile.html'; | |
22 | + | |
23 | + // 获取微信临时素材 | |
24 | + public function getMedia($mediaId) | |
25 | + { | |
26 | + $token = $this->getToken(); | |
27 | + $params = [ | |
28 | + 'access_token' => $token, | |
29 | + 'media_id' => $mediaId, | |
30 | + ]; | |
31 | + $url = self::GET_MEDIA_URL . '?'. http_build_query($params); | |
32 | + $request = new Request(); | |
33 | + $request->get($url); | |
34 | + $text = $request->response; | |
35 | + if (strlen($text) <300) { | |
36 | + if (strstr($text, '40001')) { | |
37 | + JsonResponse::error('图片上传失败:' . $text); | |
38 | + } | |
39 | + } | |
40 | + return $text; | |
41 | + } | |
42 | + | |
43 | + // 获取前端配置参数 | |
44 | + public function getSignPackage($url) { | |
45 | + // 获取token | |
46 | + $token = $this->getToken(); | |
47 | + // 获取ticket | |
48 | + $ticket = $this->getTicket($token); | |
49 | + // 时间戳 | |
50 | + $timestamp = time(); | |
51 | + // 随机字符串 | |
52 | + $nonceStr = $this->_createNoncestr(); | |
53 | + // 这里参数的顺序要按照 key 值 ASCII 码升序排序 j -> n -> t -> u | |
54 | + $string = "jsapi_ticket=$ticket&noncestr=$nonceStr×tamp=$timestamp&url=$url"; | |
55 | + $signature = sha1($string); | |
56 | + | |
57 | + $result = [ | |
58 | + "appId" => self::APPID, | |
59 | + "nonceStr" => $nonceStr, | |
60 | + "timestamp" => $timestamp, | |
61 | + "url" => $url, | |
62 | + "signature" => $signature, | |
63 | + "ticket" => $ticket, | |
64 | + "token" => $token | |
65 | + ]; | |
66 | + return $result; | |
67 | + } | |
68 | + | |
69 | + //获取ticket | |
70 | + public function getTicket($token = ''){ | |
71 | + if (empty($token)) { | |
72 | + $token = $this->getToken(); | |
73 | + } | |
74 | + if (file_exists(self::WECHAT_DATA_TICKET)) { | |
75 | + $text = file_get_contents(self::WECHAT_DATA_TICKET); | |
76 | + $data = explode(',', $text); | |
77 | + if (count($data) != 2) { | |
78 | + JsonResponse::error('获取微信ticket失败:' . $text); | |
79 | + } | |
80 | + if ($data[1] + 7200 < time()) { | |
81 | + return $this->_createJsApiTicket($token); | |
82 | + } | |
83 | + return $data[0]; | |
84 | + } else { | |
85 | + return $this->_createJsApiTicket($token); | |
86 | + } | |
87 | + return null; | |
88 | + } | |
89 | + | |
90 | + //获取token | |
91 | + public function getToken(){ | |
92 | + if (file_exists(self::WECHAT_DATA_TOKEN)) { | |
93 | + $text = file_get_contents(self::WECHAT_DATA_TOKEN); | |
94 | + $data = explode(',', $text); | |
95 | + if (count($data) != 2) { | |
96 | + JsonResponse::error('获取微信token失败:' . $text); | |
97 | + } | |
98 | + if ($data[1] + 7000 < time()) { | |
99 | + $token = $this->_createAccessToken(); | |
100 | + return $token; | |
101 | + } | |
102 | + return $data[0]; | |
103 | + } else { | |
104 | + $token = $this->_createAccessToken(); | |
105 | + return $token; | |
106 | + } | |
107 | + return null; | |
108 | + } | |
109 | + | |
110 | + // 生成ticket | |
111 | + private function _createJsApiTicket($token) | |
112 | + { | |
113 | + $params = [ | |
114 | + 'type' => 'jsapi', | |
115 | + 'access_token' => $token, | |
116 | + ]; | |
117 | + $url = self::JSAPI_TICKET_URL . '?' . http_build_query($params); | |
118 | + $request = new Request(); | |
119 | + $request->get($url); | |
120 | + $text = $request->response; | |
121 | + $result = json_decode($text, true); | |
122 | + $data = $result['ticket']; | |
123 | + if (!empty($data)) { | |
124 | + file_put_contents(self::WECHAT_DATA_TICKET, $data . ',' . time()); | |
125 | + } else | |
126 | + JsonResponse::error('获取ticket失败:' . $text); | |
127 | + return $data; | |
128 | + } | |
129 | + | |
130 | + // 生成token | |
131 | + private function _createAccessToken() | |
132 | + { | |
133 | + $params = [ | |
134 | + 'grant_type' => 'client_credential', | |
135 | + 'appid' => self::APPID, | |
136 | + 'secret' => self::SECRET, | |
137 | + ]; | |
138 | + $url = self::ACCESS_TOKEN_URL . '?'. http_build_query($params); | |
139 | + $request = new Request(); | |
140 | + $request->get($url); | |
141 | + $text = $request->response; | |
142 | + $result = json_decode($text, true); | |
143 | + $data = $result['access_token']; | |
144 | + if (!empty($data)) { | |
145 | + try { | |
146 | + unlink(self::WECHAT_DATA_TICKET); | |
147 | + unlink(self::WECHAT_DATA_TOKEN); | |
148 | + file_put_contents(self::WECHAT_DATA_TOKEN, $data . ',' . time()); | |
149 | + } catch (\Exception $ex) { | |
150 | + JsonResponse::error('error:' . $ex); | |
151 | + } | |
152 | + } else | |
153 | + JsonResponse::error('获取token失败:' . $text); | |
154 | + return $data; | |
155 | + } | |
156 | + | |
157 | + // 获取openid | |
158 | + public function getOpenid($code) | |
159 | + { | |
160 | + $params = [ | |
161 | + 'code' => $code, | |
162 | + 'appid' => self::APPID, | |
163 | + 'secret' => self::SECRET, | |
164 | + 'grant_type' => 'authorization_code' | |
165 | + ]; | |
166 | + $url = self::OPENID_URL . '?'. http_build_query($params); | |
167 | + $request = new Request(); | |
168 | + $request->get($url); | |
169 | + $text = $request->response; | |
170 | + $result = json_decode($text, true); | |
171 | + $data = $result['openid']; | |
172 | + if (empty($data)) | |
173 | + JsonResponse::error('获取openid失败:' . $text); | |
174 | + return $data; | |
175 | + } | |
176 | + | |
177 | + | |
178 | + // 创建随机字符串 | |
179 | + private function _createNoncestr($length = 16) { | |
180 | + $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
181 | + $str = ""; | |
182 | + for($i = 0; $i < $length; $i ++) { | |
183 | + $str .= substr ( $chars, mt_rand ( 0, strlen ( $chars ) - 1 ), 1 ); | |
184 | + } | |
185 | + return $str; | |
186 | + } | |
187 | + | |
188 | + // 当前页url | |
189 | + public function curPageURL() | |
190 | + { | |
191 | + $pageURL = 'http'; | |
192 | + if ($_SERVER["HTTPS"] == "on") { | |
193 | + $pageURL .= "s"; | |
194 | + } | |
195 | + $pageURL .= "://"; | |
196 | + if ($_SERVER["SERVER_PORT"] != "80") { | |
197 | + $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; | |
198 | + } else { | |
199 | + $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; | |
200 | + } | |
201 | + return $pageURL; | |
202 | + } | |
203 | + | |
204 | + // 首页url | |
205 | + public function IndexPageURL() | |
206 | + { | |
207 | + $pageURL = 'http'; | |
208 | + if ($_SERVER["HTTPS"] == "on") { | |
209 | + $pageURL .= "s"; | |
210 | + } | |
211 | + $pageURL .= "://"; | |
212 | + $pageURL .= $_SERVER["SERVER_NAME"] . self::HOME_URL; | |
213 | + return $pageURL; | |
214 | + } | |
215 | + | |
216 | +} | |
0 | 217 | \ No newline at end of file |
... | ... |
phpapi/Common/config.bak.php
0 → 100644
1 | +++ a/phpapi/Common/config.bak.php | |
1 | +<?php | |
2 | + | |
3 | +return [ | |
4 | + 'driver' => 'mysql', | |
5 | + 'host' => '182.254.128.241', | |
6 | + 'port' => 5060, | |
7 | + 'dbname' => 'party', | |
8 | + 'user' => 'cdb_outerroot', | |
9 | + 'pass' => 'knP18jdQbC2a_ob8', | |
10 | + 'key' => '7553f1d152a71e6d2b7faa8ef30e2ea7', | |
11 | + 'longitude' => '108.907470703125', | |
12 | + 'latitude' => '34.24637222290039', | |
13 | + 'admin' => 'user', | |
14 | + 'distance' => 1000 | |
15 | +]; | |
0 | 16 | \ No newline at end of file |
... | ... |
phpapi/Common/data.sql
0 → 100644
1 | +++ a/phpapi/Common/data.sql | |
1 | +-- 员工表 | |
2 | +DROP TABLE IF EXISTS `user`; | |
3 | +CREATE TABLE `user` ( | |
4 | + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID', | |
5 | + `realname` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名', | |
6 | + `headimg` varchar(255) NOT NULL DEFAULT '' COMMENT '自拍图片', | |
7 | + `openid` char(32) NOT NULL UNIQUE COMMENT '微信openid', | |
8 | + `status` int DEFAULT 1 COMMENT '1=正常 2=删除 3=其他组织', | |
9 | + `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', | |
10 | + PRIMARY KEY (`id`) | |
11 | +)ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COMMENT='员工表'; | |
12 | + | |
13 | +-- 中奖信息 | |
14 | +DROP TABLE IF EXISTS `lottery`; | |
15 | +CREATE TABLE `lottery` ( | |
16 | + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID', | |
17 | + `user_id` int(10) NOT NULL UNIQUE DEFAULT 0 COMMENT '用户id', | |
18 | + `award` varchar(50) NOT NULL DEFAULT '' COMMENT '奖品', | |
19 | + `is_cancel` int NOT NULL DEFAULT 0 COMMENT '是否取消 0=否 1=是', | |
20 | + `is_next` int NOT NULL DEFAULT 0 COMMENT '取消中奖后是否能再次参与 0=不能 1=能', | |
21 | + `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', | |
22 | + PRIMARY KEY (`id`) | |
23 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='中奖记录表'; | |
24 | + | |
25 | +-- 抽奖设置 | |
26 | +DROP TABLE IF EXISTS `setting`; | |
27 | +CREATE TABLE `setting` ( | |
28 | + `key` char(50) NOT NULL UNIQUE COMMENT '键', | |
29 | + `value` varchar(500) NOT NULL DEFAULT '' COMMENT '值', | |
30 | + `note` varchar(255) NOT NULL DEFAULT '' COMMENT '描述' | |
31 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='抽奖设置'; | |
32 | + | |
33 | +INSERT INTO `setting` values('isStopSign','1','是否停止注册 1=停止 2=开启'); | |
34 | +INSERT INTO `setting` values('isStartVote','1','是否开启节目投票通道 1=开启 2=关闭'); | |
35 | +INSERT INTO `setting` values('voteUrl','https://yq.vchangyi.com/B7BCF1B00A692CB96953A60ECF016356/Questionnaire/h5/index.html#/app/page/questionnaire/fillin-questionnaire?_identifier=yuanquan&qu_id=20129','节目投票通道url'); | |
... | ... |
phpapi/Common/mysqlHelper.php
0 → 100644
1 | +++ a/phpapi/Common/mysqlHelper.php | |
1 | +<?php | |
2 | +/** | |
3 | + * 数据库帮助类 | |
4 | + */ | |
5 | +class mysqlHelper | |
6 | +{ | |
7 | + protected $config = []; | |
8 | + | |
9 | + protected $connection; | |
10 | + | |
11 | + public function __construct($config = '') | |
12 | + { | |
13 | + $cfg = include('config.php'); | |
14 | + $this->config = empty($config) ? $config = [ | |
15 | + 'driver' => $cfg['driver'], | |
16 | + 'host' => $cfg['host'], | |
17 | + 'port' => $cfg['port'], | |
18 | + 'dbname' => $cfg['dbname'], | |
19 | + 'user' => $cfg['user'], | |
20 | + 'pass' => $cfg['pass'], | |
21 | + 'options' => [ | |
22 | + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
23 | + PDO::ATTR_CASE => PDO::CASE_NATURAL | |
24 | + ] | |
25 | + ] : $config; | |
26 | + $this->connection = $this->createConnection(); | |
27 | + } | |
28 | + | |
29 | + private function createConnection() | |
30 | + { | |
31 | + $config = $this->config; | |
32 | + try { | |
33 | + | |
34 | + $dsn = "{$config['driver']}:host={$config['host']};port={$config['port']};dbname={$config['dbname']}"; | |
35 | + $connection = new PDO($dsn, $config['user'], $config['pass'], $config['options']); | |
36 | + $connection->exec('set names utf8'); | |
37 | + return $connection; | |
38 | + } catch (\Exception $e) { | |
39 | + die($e->getMessage()); | |
40 | + } | |
41 | + } | |
42 | + | |
43 | + public function insert($table, $data = []) | |
44 | + { | |
45 | + $placeholder = rtrim(implode(", ", array_fill(0, count($data), '?')), ','); | |
46 | + $format = "INSERT INTO `{$table}` (%s) VALUES (%s)"; | |
47 | + $query = vsprintf($format, [implode(', ', array_keys($data)), $placeholder]); | |
48 | + $statement = $this->connection->prepare($query); | |
49 | + $statement->execute(array_values($data)); | |
50 | + } | |
51 | + | |
52 | + public function update($query, $data = []) | |
53 | + { | |
54 | + $statement = $this->connection->prepare($query); | |
55 | + // for ($i = 1; count($params) >= $i; $i++) { | |
56 | + // $statement->bindValue($i, $params[i]); | |
57 | + // } | |
58 | + $statement->execute($data); | |
59 | + return $statement->rowCount(); | |
60 | + } | |
61 | + | |
62 | + public function fetch($query, $data = []) | |
63 | + { | |
64 | + $statement = $this->connection->prepare($query); | |
65 | + $statement->execute($data); | |
66 | + | |
67 | + return $statement->fetch(PDO::FETCH_ASSOC); | |
68 | + } | |
69 | + | |
70 | + public function fetchAll($query, $data = []) | |
71 | + { | |
72 | + $statement = $this->connection->prepare($query); | |
73 | + $statement->execute($data); | |
74 | + | |
75 | + return $statement->fetchAll(PDO::FETCH_ASSOC); | |
76 | + } | |
77 | + | |
78 | + public function getLastInsertId() | |
79 | + { | |
80 | + return $this->connection->lastInsertId(); | |
81 | + } | |
82 | +} | |
... | ... |
phpapi/Common/request.php
0 → 100644
1 | +++ a/phpapi/Common/request.php | |
1 | +<?php | |
2 | +/** | |
3 | + * curl帮助类 | |
4 | + */ | |
5 | +class Request | |
6 | +{ | |
7 | + /** | |
8 | + * cURL 实例对象 | |
9 | + * @var | |
10 | + */ | |
11 | + public $curl; | |
12 | + /** | |
13 | + * 相应结果 | |
14 | + * @var mixed | |
15 | + */ | |
16 | + public $response; | |
17 | + /** | |
18 | + * cookie 信息 | |
19 | + * @var array | |
20 | + */ | |
21 | + public $cookies = []; | |
22 | + /** | |
23 | + * 头信息 | |
24 | + * @var array | |
25 | + */ | |
26 | + public $headers = []; | |
27 | + /** | |
28 | + * 响应头信息 | |
29 | + * @var array | |
30 | + */ | |
31 | + public $responseHeaders = []; | |
32 | + /** | |
33 | + * 请求头信息 | |
34 | + * @var array | |
35 | + */ | |
36 | + public $requestHeaders = []; | |
37 | + /** | |
38 | + * 错误状态 | |
39 | + * @var bool | |
40 | + */ | |
41 | + public $error = false; | |
42 | + /** | |
43 | + * 错误嘛 | |
44 | + * @var int | |
45 | + */ | |
46 | + public $errorCode = 0; | |
47 | + /** | |
48 | + * 错误信息 | |
49 | + * @var null | |
50 | + */ | |
51 | + public $errorMessage = null; | |
52 | + /** | |
53 | + * cURL 错误状态 | |
54 | + * @var bool | |
55 | + */ | |
56 | + public $curlError = false; | |
57 | + /** | |
58 | + * cURL 错误码 | |
59 | + * @var int | |
60 | + */ | |
61 | + public $curlErrorCode = 0; | |
62 | + /** | |
63 | + * cURL 错误信息 | |
64 | + * @var null | |
65 | + */ | |
66 | + public $curlErrorMessage = null; | |
67 | + /** | |
68 | + * HTTP 错误状态 | |
69 | + * @var bool | |
70 | + */ | |
71 | + public $httpError = false; | |
72 | + /** | |
73 | + * HTTP 错误码 | |
74 | + * @var int | |
75 | + */ | |
76 | + public $httpStatusCode = 0; | |
77 | + /** | |
78 | + * HTTP 错误信息 | |
79 | + * @var null | |
80 | + */ | |
81 | + public $httpErrorMessage = null; | |
82 | + /** | |
83 | + * 禁止SSL验证 | |
84 | + * @var bool | |
85 | + */ | |
86 | + public $prohibitSSLauth = false; | |
87 | + /** | |
88 | + * cURL 构造方法 | |
89 | + */ | |
90 | + public function __construct() | |
91 | + { | |
92 | + $this->init(); | |
93 | + } | |
94 | + /** | |
95 | + * 初始化 | |
96 | + * @return $this | |
97 | + */ | |
98 | + private function init() | |
99 | + { | |
100 | + $this->curl = curl_init(); | |
101 | + // 发送请求的字符串 | |
102 | + $this->setOpt(CURLINFO_HEADER_OUT, true); | |
103 | + // 是否输出响应头信息 | |
104 | + $this->setOpt(CURLOPT_HEADER, false); | |
105 | + $this->setOpt(CURLOPT_RETURNTRANSFER, true); | |
106 | + // 是否禁止SSL验证 | |
107 | + if ($this->prohibitSSLauth === true) { | |
108 | + $this->setOpt(CURLOPT_SSL_VERIFYHOST, false); | |
109 | + $this->setOpt(CURLOPT_SSL_VERIFYPEER, false); | |
110 | + } | |
111 | + return $this; | |
112 | + } | |
113 | + /** | |
114 | + * 开始执行cURL的基础设置 | |
115 | + * @return int|mixed | |
116 | + */ | |
117 | + private function execute() | |
118 | + { | |
119 | + $this->response = curl_exec($this->curl); | |
120 | + $this->curlErrorCode = curl_errno($this->curl); | |
121 | + $this->curlErrorMessage = curl_error($this->curl); | |
122 | + $this->curlError = !($this->curlErrorCode === 0); | |
123 | + $this->httpStatusCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE); | |
124 | + $this->httpError = in_array(floor($this->httpStatusCode / 100), [4, 5]); | |
125 | + $this->error = $this->curlError || $this->httpError; | |
126 | + $this->errorCode = $this->error ? ($this->curlError ? $this->curlErrorCode : $this->httpStatusCode) : 0; | |
127 | + $this->requestHeaders = preg_split('/\r\n/', curl_getinfo($this->curl, CURLINFO_HEADER_OUT), null, PREG_SPLIT_NO_EMPTY); | |
128 | + $matchResult = preg_match('/HTTP\\/1.[0-9] [0-9]{3}.*OK/', $this->response); | |
129 | + if (!(strpos($this->response, "\r\n\r\n") === false) && $matchResult) { | |
130 | + list($responseHeader, $this->response) = explode("\r\n\r\n", $this->response, 2); | |
131 | + while (strtolower(trim($responseHeader)) === 'http/1.1 100 continue') { | |
132 | + list($responseHeader, $this->response) = explode("\r\n\r\n", $this->response, 2); | |
133 | + } | |
134 | + $this->responseHeaders = preg_split('/\r\n/', $responseHeader, null, PREG_SPLIT_NO_EMPTY); | |
135 | + } | |
136 | + $this->httpErrorMessage = $this->error ? (isset($this->responseHeaders['0']) ? $this->responseHeaders['0'] : '') : ''; | |
137 | + $this->errorMessage = $this->curlError ? $this->curlErrorMessage : $this->httpErrorMessage; | |
138 | + return $this->errorCode; | |
139 | + } | |
140 | + /** | |
141 | + * 发送GET请求 | |
142 | + * @param $url | |
143 | + * @param array $data | |
144 | + * @return $this | |
145 | + */ | |
146 | + public function get($url, $data = [], $json = false) | |
147 | + { | |
148 | + // 转json | |
149 | + if ($json === true) { | |
150 | + $data = empty($data) ? '{}' : json_encode($data); | |
151 | + } | |
152 | + if (is_array($data) && count($data) > 0) { | |
153 | + $this->setOpt(CURLOPT_URL, $url.'?'.http_build_query($data)); | |
154 | + } else { | |
155 | + $this->setOpt(CURLOPT_URL, $url); | |
156 | + } | |
157 | + $this->setOpt(CURLOPT_HTTPGET, true); | |
158 | + $this->execute(); | |
159 | + return $this; | |
160 | + } | |
161 | + /** | |
162 | + * 发送POST请求 | |
163 | + * @param $url | |
164 | + * @param array $data | |
165 | + * @param bool $json | |
166 | + * @return $this | |
167 | + */ | |
168 | + public function post($url, $data = [], $json = false) | |
169 | + { | |
170 | + // 转json | |
171 | + if ($json === true) { | |
172 | + $data = empty($data) ? '{}' : json_encode($data); | |
173 | + } | |
174 | + $this->setOpt(CURLOPT_URL, $url); | |
175 | + $this->setOpt(CURLOPT_POST, true); | |
176 | + $this->setOpt(CURLOPT_POSTFIELDS, $data); | |
177 | + $this->execute(); | |
178 | + return $this; | |
179 | + } | |
180 | + /** | |
181 | + * @param $url | |
182 | + * @param array $data | |
183 | + * @param bool $json | |
184 | + * @param bool $payload | |
185 | + * @return $this | |
186 | + */ | |
187 | + public function put($url, $data = [], $json = false, $payload = false) | |
188 | + { | |
189 | + if ($payload === true) { | |
190 | + $url .= '?'.http_build_query($data); | |
191 | + } | |
192 | + // 转json | |
193 | + if ($json === true) { | |
194 | + $data = empty($data) ? '{}' : json_encode($data); | |
195 | + } | |
196 | + $this->setOpt(CURLOPT_URL, $url); | |
197 | + $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT'); | |
198 | + $this->setOpt(CURLOPT_POST, true); | |
199 | + $this->setOpt(CURLOPT_POSTFIELDS, $data); | |
200 | + $this->execute(); | |
201 | + return $this; | |
202 | + } | |
203 | + /** | |
204 | + * @param $url | |
205 | + * @param array $data | |
206 | + * @param bool $payload | |
207 | + * @return $this | |
208 | + */ | |
209 | + public function patch($url, $data = [], $payload = false) | |
210 | + { | |
211 | + if ($payload === true) { | |
212 | + $url .= '?'.http_build_query($data); | |
213 | + } | |
214 | + $this->setOpt(CURLOPT_URL, $url); | |
215 | + $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH'); | |
216 | + $this->setOpt(CURLOPT_POST, true); | |
217 | + $this->setOpt(CURLOPT_POSTFIELDS, $data); | |
218 | + $this->execute(); | |
219 | + return $this; | |
220 | + } | |
221 | + /** | |
222 | + * @param $url | |
223 | + * @param array $data | |
224 | + * @param bool $payload | |
225 | + * @return $this | |
226 | + */ | |
227 | + public function delete($url, $data = [], $payload = false) | |
228 | + { | |
229 | + if ($payload === true) { | |
230 | + $url .= '?'.http_build_query($data); | |
231 | + } | |
232 | + $this->setOpt(CURLOPT_URL, $url); | |
233 | + $this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE'); | |
234 | + $this->setOpt(CURLOPT_POST, true); | |
235 | + $this->setOpt(CURLOPT_POSTFIELDS, $data); | |
236 | + $this->execute(); | |
237 | + return $this; | |
238 | + } | |
239 | + /** | |
240 | + * 设置允许 cURL 函数执行的最长秒数 | |
241 | + * @param $second | |
242 | + * @return $this | |
243 | + */ | |
244 | + public function setTimeout($second) | |
245 | + { | |
246 | + $this->setOpt('CURLOPT_TIMEOUT', $second); | |
247 | + return $this; | |
248 | + } | |
249 | + /** | |
250 | + * 设置cURL 参数 | |
251 | + * @param $option | |
252 | + * @param $value | |
253 | + * @return bool | |
254 | + */ | |
255 | + public function setOpt($option, $value) | |
256 | + { | |
257 | + return curl_setopt($this->curl, $option, $value); | |
258 | + } | |
259 | + /** | |
260 | + * 设置请求头信息 | |
261 | + * @param $key | |
262 | + * @param $value | |
263 | + * @return $this | |
264 | + */ | |
265 | + public function setHeader($key, $value) | |
266 | + { | |
267 | + $this->headers[$key] = $key.': '.$value; | |
268 | + $this->setOpt(CURLOPT_HTTPHEADER, array_values($this->headers)); | |
269 | + return $this; | |
270 | + } | |
271 | + /** | |
272 | + * 设置cookie | |
273 | + * @param $key | |
274 | + * @param $value | |
275 | + * @return $this | |
276 | + */ | |
277 | + public function setCookie($key, $value) | |
278 | + { | |
279 | + $this->cookies[$key] = $value; | |
280 | + $this->setOpt(CURLOPT_COOKIE, http_build_query($this->cookies, '', '; ')); | |
281 | + return $this; | |
282 | + } | |
283 | + /** | |
284 | + * 请求是否成功 | |
285 | + * @return bool | |
286 | + */ | |
287 | + public function isSuccess() | |
288 | + { | |
289 | + return $this->httpStatusCode >=200 && $this->httpStatusCode < 300; | |
290 | + } | |
291 | + /** | |
292 | + * 是否已经被重定向 | |
293 | + * @return bool | |
294 | + */ | |
295 | + public function isRedirect() | |
296 | + { | |
297 | + return $this->httpStatusCode >= 300 && $this->httpStatusCode < 400; | |
298 | + } | |
299 | + /** | |
300 | + * 客户端或者服务器端是否有错误 | |
301 | + * @return bool | |
302 | + */ | |
303 | + public function isError() | |
304 | + { | |
305 | + return $this->httpStatusCode >= 400 && $this->httpStatusCode < 600; | |
306 | + } | |
307 | + /** | |
308 | + * 客户端错误 | |
309 | + * @return bool | |
310 | + */ | |
311 | + public function isClientError() | |
312 | + { | |
313 | + return $this->httpStatusCode >= 400 && $this->httpStatusCode < 500; | |
314 | + } | |
315 | + /** | |
316 | + * 服务器端错误 | |
317 | + * @return bool | |
318 | + */ | |
319 | + public function isServerError() | |
320 | + { | |
321 | + return $this->httpStatusCode >= 500 && $this->httpStatusCode < 600; | |
322 | + } | |
323 | + /** | |
324 | + * 释放cURL资源 | |
325 | + * @return $this | |
326 | + */ | |
327 | + private function close() | |
328 | + { | |
329 | + if (is_resource($this->curl)) { | |
330 | + curl_close($this->curl); | |
331 | + } | |
332 | + return $this; | |
333 | + } | |
334 | + /** | |
335 | + * 关闭cURL、释放资源 | |
336 | + */ | |
337 | + public function __destruct() | |
338 | + { | |
339 | + return $this->close(); | |
340 | + } | |
341 | +} | |
... | ... |
phpapi/api.AddUser.php
0 → 100644
1 | +++ a/phpapi/api.AddUser.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 增加用户,对于程序设计,走的是修改逻辑 | |
4 | + */ | |
5 | + | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/mysqlHelper.php"; | |
8 | + include "Common/WechatHelper.php"; | |
9 | + include "Common/Encrypter.php"; | |
10 | + | |
11 | + // 验证注册通道 | |
12 | + isStopSign(); | |
13 | + // 头像,姓名必填 | |
14 | + if (!isset($_POST['realname']) || !isset($_POST['mediaId'])) { | |
15 | + JsonResponse::error('姓名或照片不能为空'); | |
16 | + } | |
17 | + // 坐标不能为空 | |
18 | + if (!isset($_POST['latitude']) || !isset($_POST['longitude'])) { | |
19 | + JsonResponse::error('用户坐标不能为空'); | |
20 | + } | |
21 | + // 登录验证,验证cookie是否有openid,没有前端走微信openid获取流程 | |
22 | + if (!isset($_COOKIE['openid'])) { | |
23 | + JsonResponse::error('进入姿势不对?'); | |
24 | + } | |
25 | + // 年会签到地址 | |
26 | + $config = include('Common/config.php'); | |
27 | + $partyLat = $config['latitude']; | |
28 | + $partyLng = $config['longitude']; | |
29 | + $distance = getDistance($partyLng, $partyLat, $_POST['longitude'], $_POST['latitude']); | |
30 | + // 签掉距离不能大于200m,配置文件设置 | |
31 | + if ($distance > $config['distance']) { | |
32 | + JsonResponse::error('不在签到范围内'); | |
33 | + } | |
34 | + // 姓名唯一 | |
35 | + $realname = $_POST['realname']; | |
36 | + $mysql = new mysqlHelper(); | |
37 | + $data = $mysql->fetch("SELECT id FROM user WHERE realname = ?", [ $realname ]); | |
38 | + if ($data) { | |
39 | + JsonResponse::error("Hello {$_POST['realname']} ,你的姓名重复了"); | |
40 | + } | |
41 | + // 获取头像数据,从微信临时素材图片中。 | |
42 | + $wechat = new WechatHelper(); | |
43 | + $img = $wechat->getMedia($_POST['mediaId']); | |
44 | + | |
45 | + // 保存图片 | |
46 | + $filename = time() . rand(1000,9999) . ".jpg"; | |
47 | + $tarfilename = "/party/upload/" .$filename; | |
48 | + $dir = str_replace('\\','/',realpath(dirname(__FILE__).'/')); | |
49 | + $dir = rtrim($dir, '/party/phpapi/'); | |
50 | + $fp = fopen($dir . $tarfilename, "w"); | |
51 | + fwrite($fp, $img); | |
52 | + fclose($fp); | |
53 | + | |
54 | + // 组装新增用户需要的数据 | |
55 | + $params[] = $_POST['realname']; | |
56 | + $params[] = 'http://' . $_SERVER['SERVER_NAME'] . $tarfilename; | |
57 | + // 这里openid解密 | |
58 | + $enctypt = new Encrypter(); | |
59 | + $params[] = $enctypt->decrypt($_COOKIE['openid']); | |
60 | + $time = time(); | |
61 | + // pdo保存数据 | |
62 | + $updateSql = "UPDATE user SET realname = ?, headimg = ?, `status` = 1, created = {$time} WHERE openid = ?;"; | |
63 | + $rowCount = $mysql->update($updateSql, $params); | |
64 | + if ($rowCount) { | |
65 | + JsonResponse::result(['distance' => $distance]); | |
66 | + } else { | |
67 | + JsonResponse::error('报名失败'); | |
68 | + } | |
69 | + | |
70 | + | |
71 | + function rad($dis) | |
72 | + { | |
73 | + return round($dis * (3.1415926535898 / 180), 6); | |
74 | + } | |
75 | + // 计算距离 | |
76 | + function getDistance($lat1, $lng1, $lat2, $lng2) | |
77 | + { | |
78 | + $lat1 = round($lat1, 6); | |
79 | + $lng1 = round($lng1, 6); | |
80 | + $lat2 = round($lat2, 6); | |
81 | + $lng2 = round($lng2, 6); | |
82 | + $radLat1 = rad($lat1); | |
83 | + $radLat2 = rad($lat2); | |
84 | + $a = $radLat1 - $radLat2; | |
85 | + $b = rad($lng1) - rad($lng2); | |
86 | + $s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2))); | |
87 | + $s = round($s * 6378137, 0); | |
88 | + return $s; | |
89 | + } | |
90 | + | |
91 | + // 验证注册通道是否关闭 | |
92 | + function isStopSign() | |
93 | + { | |
94 | + $mysql = new mysqlHelper(); | |
95 | + | |
96 | + $data = $mysql->fetch("SELECT `value` FROM `setting` WHERE `key` = 'isStopSign' AND `value` = 1"); | |
97 | + if ($data) { | |
98 | + JsonResponse::error("注册通道已经关闭,自己人联系颖慧"); | |
99 | + } | |
100 | + } | |
0 | 101 | \ No newline at end of file |
... | ... |
phpapi/api.UserDetail.php
0 → 100644
1 | +++ a/phpapi/api.UserDetail.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 获取用户详情 | |
4 | + */ | |
5 | + include "Common/JsonResponse.php"; | |
6 | + include "Common/mysqlHelper.php"; | |
7 | + include "Common/Encrypter.php"; | |
8 | + | |
9 | + // 登录验证,验证cookie是否有openid,没有前端走微信openid获取流程 | |
10 | + if (!isset($_COOKIE['openid'])) { | |
11 | + // 验证注册通道是否开始 | |
12 | + isStopSign(); | |
13 | + JsonResponse::result(['isLogin' => 0]); | |
14 | + } | |
15 | + | |
16 | + $enctypt = new Encrypter(); | |
17 | + $openid = $enctypt->decrypt($_COOKIE['openid']); | |
18 | + | |
19 | + // 查找用户 | |
20 | + $mysql = new mysqlHelper(); | |
21 | + $data = $mysql->fetch('SELECT * FROM user WHERE openid=? AND `status` <> 2', [$openid]); | |
22 | + if ($data) { | |
23 | + JsonResponse::result($data); | |
24 | + } else { | |
25 | + JsonResponse::error('获取用户数据失败'); | |
26 | + } | |
27 | + | |
28 | + // 验证注册通道是否开启 | |
29 | + function isStopSign() | |
30 | + { | |
31 | + $mysql = new mysqlHelper(); | |
32 | + | |
33 | + $data = $mysql->fetch("SELECT `value` FROM `setting` WHERE `key` = 'isStopSign' AND `value` = 1"); | |
34 | + if ($data) { | |
35 | + JsonResponse::error("年会签到通道暂未开启"); | |
36 | + } | |
37 | + } | |
0 | 38 | \ No newline at end of file |
... | ... |
phpapi/api.Vote.php
0 → 100644
1 | +++ a/phpapi/api.Vote.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 获取投票通道 | |
4 | + */ | |
5 | + | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/mysqlHelper.php"; | |
8 | + | |
9 | + // 登录验证,验证cookie是否有openid,没有前端走微信openid获取流程 | |
10 | + if (!isset($_COOKIE['openid'])) { | |
11 | + JsonResponse::error('进入姿势不对?'); | |
12 | + } | |
13 | + // 查询是否可以投票 | |
14 | + $mysql = new mysqlHelper(); | |
15 | + // pdo保存数据 | |
16 | + $sql = "SELECT `value` from `setting` WHERE `key` = 'isStartVote' AND `value` = 1;"; | |
17 | + $data = $mysql->fetch($sql); | |
18 | + if (empty($data)) { | |
19 | + JsonResponse::error('等候主持人宣布开启投票通道'); | |
20 | + } | |
21 | + $sql = "SELECT `value` from `setting` WHERE `key` = 'voteUrl';"; | |
22 | + $data = $mysql->fetch($sql); | |
23 | + if (empty($data)) { | |
24 | + JsonResponse::error('等候主持人宣布开启投票通道'); | |
25 | + } else { | |
26 | + JsonResponse::result(['url' => $data['value']]); | |
27 | + } | |
28 | + | |
29 | + | |
30 | + | |
31 | + | |
32 | + | |
... | ... |
phpapi/api.WechatAuth.php
0 → 100644
1 | +++ a/phpapi/api.WechatAuth.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 登录逻辑,获取用户openid,用于锁定唯一的用户身份 | |
4 | + */ | |
5 | + include "Common/JsonResponse.php"; | |
6 | + include "Common/mysqlHelper.php"; | |
7 | + include "Common/WechatHelper.php"; | |
8 | + include "Common/Encrypter.php"; | |
9 | + | |
10 | + $wechar = new WechatHelper(); | |
11 | + // 查看是否有cookie | |
12 | + if (isset($_COOKIE['openid'])) { | |
13 | + $enctypt = new Encrypter(); | |
14 | + $openid = $enctypt->decrypt($_COOKIE['openid']); | |
15 | + $mysql = new mysqlHelper(); | |
16 | + $data = $mysql->fetch('select * from user where openid=?',[$openid]); | |
17 | + if ($data) { | |
18 | + header('location:' . $wechar->IndexPageURL()); | |
19 | + } | |
20 | + } else { | |
21 | + // 本地没有记录,去微信获取openid | |
22 | + if (!isset($_GET['code'])) { | |
23 | + // 获取openid先获取code | |
24 | + $appid = WechatHelper::APPID; | |
25 | + $redirect_uri=urlencode($wechar->curPageURL()); | |
26 | + $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_base&state=1#wechat_redirect"; | |
27 | + header("location:" . $url); | |
28 | + } else { | |
29 | + // 获取openid | |
30 | + $openid = $wechar->getOpenid($_GET['code']); | |
31 | + // openid写入数据库 | |
32 | + $mysql = new mysqlHelper(); | |
33 | + $data = $mysql->fetch('select * from user where openid=?',[$openid]); | |
34 | + if (!$data) { | |
35 | + $mysql->insert('user', ['openid' => $openid, 'created' => time() ]); | |
36 | + } | |
37 | + | |
38 | + // openid加密写入cookie | |
39 | + $enctypt = new Encrypter(); | |
40 | + setcookie("openid",$enctypt->encrypt($openid),time()+3600*24, '/', $_SERVER["SERVER_NAME"]); | |
41 | + header('location:' . $wechar->IndexPageURL()); | |
42 | + } | |
43 | + } | |
... | ... |
phpapi/api.WechatJsSign.php
0 → 100644
1 | +++ a/phpapi/api.WechatJsSign.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 生成前端请求微信api的config参数 | |
4 | + */ | |
5 | + | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/WechatHelper.php"; | |
8 | + | |
9 | + // 该URL为使用JSSDK接口的URL | |
10 | + if (!isset($_GET['url'])) { | |
11 | + JsonResponse::error('url参数空了'); | |
12 | + } | |
13 | + $wechat = new WechatHelper(); | |
14 | + $result = $wechat->getSignPackage($_GET['url']); | |
15 | + JsonResponse::result($result); | |
0 | 16 | \ No newline at end of file |
... | ... |
phpapi/apicp.AdminLogin.php
0 → 100644
1 | +++ a/phpapi/apicp.AdminLogin.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 管理员登录,简单验证 | |
4 | + * 根据接收的密钥,生成永久token | |
5 | + */ | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/Encrypter.php"; | |
8 | + | |
9 | + header('Access-Control-Allow-Origin:*'); | |
10 | + header("Access-Control-Allow-Methods:GET,POST,OPTIONS"); | |
11 | + header("Access-Control-Allow-Headers:Content-Type,token,X-Requested-With"); | |
12 | + if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){ | |
13 | + exit; | |
14 | + } | |
15 | + if(!isset($_GET['id'])) { | |
16 | + JsonResponse::error('验证失败'); | |
17 | + } | |
18 | + $config = include('Common/config.php'); | |
19 | + if ($config['admin'] != md5($_GET['id'])) { | |
20 | + JsonResponse::error('验证失败'); | |
21 | + } | |
22 | + $enctypt = new Encrypter(); | |
23 | + // 生成token,并返回前端 | |
24 | + $token = $enctypt->encrypt($_GET['id']); | |
25 | + JsonResponse::result(['token' => $token]); | |
0 | 26 | \ No newline at end of file |
... | ... |
phpapi/apicp.DelLottery.php
0 → 100644
1 | +++ a/phpapi/apicp.DelLottery.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 删除中奖的用户 | |
4 | + */ | |
5 | + | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/mysqlHelper.php"; | |
8 | + include "Common/Encrypter.php"; | |
9 | + | |
10 | + // 登录验证 | |
11 | + include "AdminAuth.php"; | |
12 | + | |
13 | + // 删除的id | |
14 | + if (!isset($_POST['id'])) { | |
15 | + JsonResponse::error('id不能为空'); | |
16 | + } | |
17 | + | |
18 | + // 组装新增用户需要的数据 | |
19 | + $params[] = $_POST['id']; | |
20 | + $mysql = new mysqlHelper(); | |
21 | + // pdo保存数据 | |
22 | + $updateSql = "UPDATE `lottery` SET is_cancel = 1 WHERE id = ?;"; | |
23 | + $rowCount = $mysql->update($updateSql, $params); | |
24 | + if ($rowCount) { | |
25 | + JsonResponse::result([]); | |
26 | + } else { | |
27 | + JsonResponse::error('删除失败'); | |
28 | + } | |
0 | 29 | \ No newline at end of file |
... | ... |
phpapi/apicp.DelUser.php
0 → 100644
1 | +++ a/phpapi/apicp.DelUser.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 删除用户 | |
4 | + */ | |
5 | + | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/mysqlHelper.php"; | |
8 | + include "Common/Encrypter.php"; | |
9 | + | |
10 | + // 登录验证 | |
11 | + include "AdminAuth.php"; | |
12 | + | |
13 | + // 删除的id | |
14 | + if (!isset($_POST['id'])) { | |
15 | + JsonResponse::error('id不能为空'); | |
16 | + } | |
17 | + $status = 2; | |
18 | + if (isset($_POST['dep'])) { | |
19 | + $status = 3; | |
20 | + } | |
21 | + $params[] = $_POST['id']; | |
22 | + $mysql = new mysqlHelper(); | |
23 | + // pdo保存数据 | |
24 | + $updateSql = "UPDATE `user` SET `status` = {$status} WHERE id = ?;"; | |
25 | + $rowCount = $mysql->update($updateSql, $params); | |
26 | + JsonResponse::result([]); | |
0 | 27 | \ No newline at end of file |
... | ... |
phpapi/apicp.GetUserList.php
0 → 100644
1 | +++ a/phpapi/apicp.GetUserList.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 获取用户列表 | |
4 | + * 中奖用户列表会多给中奖类型和中奖时间 | |
5 | + */ | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/mysqlHelper.php"; | |
8 | + include "Common/Encrypter.php"; | |
9 | + header('Access-Control-Allow-Origin:*'); | |
10 | + header("Access-Control-Allow-Methods:GET,POST"); | |
11 | + header("Access-Control-Allow-Headers:Content-Type,token,X-Requested-With"); | |
12 | + if(strtoupper($_SERVER['REQUEST_METHOD'])== 'OPTIONS'){ | |
13 | + exit; | |
14 | + } | |
15 | + // 身份验证 | |
16 | + // if (!isset($_COOKIE['admin'])) { | |
17 | + // JsonResponse::error('未登录'); | |
18 | + // } | |
19 | + | |
20 | + $type = 1; | |
21 | + $award = ''; | |
22 | + // 获取展示类型 1=所有用户 2=中奖用户 3=未中奖用户 | |
23 | + if (isset($_GET['type'])) { | |
24 | + $type = $_GET['type']; | |
25 | + } | |
26 | + if (isset($_GET['award']) && $type == 2) { | |
27 | + $award = $_GET['award']; | |
28 | + } | |
29 | + $sql = ''; | |
30 | + $params = []; | |
31 | + if ($type == 1) { | |
32 | + // 所有用户sql | |
33 | + $sql = "SELECT id, realname, headimg, `status` FROM user WHERE realname <> '' AND headimg <> '' AND `status` <> 2"; | |
34 | + } else if ($type == 2) { | |
35 | + // 获取中奖用户SQL | |
36 | + $sql = "SELECT lottery.id as id,user_id,realname,headimg,award,lottery.created from lottery JOIN user ON user.id = lottery.user_id WHERE realname <> '' AND headimg <> '' AND is_cancel = 0 "; | |
37 | + // 如果传入了奖品名称,则查询该奖品的中奖人员 | |
38 | + if (!empty($award)) { | |
39 | + $sql .= " AND award = ?"; | |
40 | + $params[] = $award; | |
41 | + } | |
42 | + $sql .= ' order by lottery.created desc'; | |
43 | + } else if ($type == 3) { | |
44 | + // 查询未中奖用户Sql | |
45 | + $sql = "SELECT id, realname, headimg FROM user WHERE realname <> '' AND headimg <> '' AND id NOT IN (SELECT user_id FROM lottery WHERE is_cancel = 0) AND `status` <> 2"; | |
46 | + } | |
47 | + | |
48 | + $mysql = new mysqlHelper(); | |
49 | + $data = $mysql->fetchAll($sql, $params); | |
50 | + JsonResponse::result($data); | |
0 | 51 | \ No newline at end of file |
... | ... |
phpapi/apicp.ResetUser.php
0 → 100644
1 | +++ a/phpapi/apicp.ResetUser.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 重置用户数据, | |
4 | + * 姓名头像重置为空,用户可以重新填写 | |
5 | + */ | |
6 | + | |
7 | + include "Common/JsonResponse.php"; | |
8 | + include "Common/mysqlHelper.php"; | |
9 | + include "Common/Encrypter.php"; | |
10 | + | |
11 | + // 登录验证 | |
12 | + include "AdminAuth.php"; | |
13 | + | |
14 | + // 删除的id | |
15 | + if (!isset($_POST['id'])) { | |
16 | + JsonResponse::error('id不能为空'); | |
17 | + } | |
18 | + | |
19 | + $params[] = $_POST['id']; | |
20 | + $mysql = new mysqlHelper(); | |
21 | + // pdo保存数据 | |
22 | + $updateSql = "UPDATE `user` SET `realname` = '', headimg = '' WHERE id = ?;"; | |
23 | + $rowCount = $mysql->update($updateSql, $params); | |
24 | + if ($rowCount) { | |
25 | + JsonResponse::result([]); | |
26 | + } else { | |
27 | + JsonResponse::error('重置失败'); | |
28 | + } | |
0 | 29 | \ No newline at end of file |
... | ... |
phpapi/apicp.Setting.php
0 → 100644
1 | +++ a/phpapi/apicp.Setting.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 抽奖后台设置 | |
4 | + */ | |
5 | + | |
6 | + include "Common/JsonResponse.php"; | |
7 | + include "Common/mysqlHelper.php"; | |
8 | + include "Common/Encrypter.php"; | |
9 | + | |
10 | + // 登录验证 | |
11 | + include "AdminAuth.php"; | |
12 | + | |
13 | + // 设置 | |
14 | + if (!isset($_POST['flag']) || !isset($_POST['value'])) { | |
15 | + JsonResponse::error('参数不能为空'); | |
16 | + } | |
17 | + // 组装新增用户需要的数据 | |
18 | + $params = [ | |
19 | + $_POST['value'], | |
20 | + $_POST['flag'] | |
21 | + ]; | |
22 | + $mysql = new mysqlHelper(); | |
23 | + // pdo保存数据 | |
24 | + $updateSql = "UPDATE `setting` SET `value` = ? WHERE `key` = ?;"; | |
25 | + $rowCount = $mysql->update($updateSql, $params); | |
26 | + if ($rowCount) { | |
27 | + JsonResponse::result(['status'=>1]); | |
28 | + } else { | |
29 | + JsonResponse::result(['status'=>0]); | |
30 | + } | |
0 | 31 | \ No newline at end of file |
... | ... |
phpapi/apicp.lottery.php
0 → 100644
1 | +++ a/phpapi/apicp.lottery.php | |
1 | +<?php | |
2 | + /** | |
3 | + * 抽奖函数 | |
4 | + */ | |
5 | + include "Common/JsonResponse.php"; | |
6 | + include "Common/mysqlHelper.php"; | |
7 | + include "Common/Encrypter.php"; | |
8 | + | |
9 | + // 登录验证 | |
10 | + include "AdminAuth.php"; | |
11 | + if (!isset($_POST['award'])) { | |
12 | + JsonResponse::error('抽奖必须设置奖品'); | |
13 | + } | |
14 | + $award = $_POST['award']; | |
15 | + | |
16 | + /** | |
17 | + * 可以参加抽奖用户的条件: | |
18 | + * 1. 必须是签到过的畅移同事 | |
19 | + * 2. 必须是未中过奖的同事 | |
20 | + * 3. 中过奖但是已经取消中奖信息的不在参加范围内 | |
21 | + * 4. 取消中奖但是准许下次继续参加抽奖的可以参加 | |
22 | + */ | |
23 | + $sql = "SELECT id FROM user WHERE realname <> '' AND headimg <> '' AND id NOT IN (SELECT user_id FROM lottery WHERE is_cancel = 0 OR (is_cancel = 1 AND is_next = 0 )) AND `status` = 1"; | |
24 | + $mysql = new mysqlHelper(); | |
25 | + $data = $mysql->fetchAll($sql); | |
26 | + if (empty($data)) { | |
27 | + JsonResponse::result([]); | |
28 | + } | |
29 | + // 获取所有参与的抽奖号码 | |
30 | + $ids = array_column($data, 'id'); | |
31 | + $lottery = 0; | |
32 | + | |
33 | + // 号码池随机打乱两次(shuffle随机数不需要播种,函数内已处理) | |
34 | + shuffle($ids); | |
35 | + shuffle($ids); | |
36 | + // 号码池如果超过10个,先分几次筛选到10个一下 | |
37 | + while (count($ids) > 10) { | |
38 | + // 号码池留下一半 | |
39 | + $ids = array_slice($ids, 0, floor(count($ids)/2)); | |
40 | + // 再次打乱 | |
41 | + shuffle($ids); | |
42 | + shuffle($ids); | |
43 | + } | |
44 | + // 取最后一个,就是中奖号码 | |
45 | + $lottery = $ids[count($ids) -1]; | |
46 | + // 记录中奖信息,写入数据库 | |
47 | + $params = [ | |
48 | + 'user_id' => $lottery, | |
49 | + 'award' => $award, | |
50 | + 'created' => time() | |
51 | + ]; | |
52 | + $mysql->insert('lottery', $params); | |
53 | + $data = $mysql->fetch('SELECT * FROM user WHERE id=?', [$lottery]); | |
54 | + $result = []; | |
55 | + if ($data) { | |
56 | + $result = [ | |
57 | + 'realname' => $data['realname'], | |
58 | + 'headimg' => $data['headimg'], | |
59 | + 'user_id' => $lottery, | |
60 | + 'award' => $award, | |
61 | + ]; | |
62 | + } | |
63 | + JsonResponse::result($result); | |
0 | 64 | \ No newline at end of file |
... | ... |
phpapi/clearCookie.php
0 → 100644
phpapi/code.php
0 → 100644
1 | +++ a/phpapi/code.php | |
1 | +<?php | |
2 | +/** | |
3 | + * Created by PhpStorm. | |
4 | + * User: zhaojie | |
5 | + * Date: 2018/8/28 | |
6 | + * Time: 上午11:44 | |
7 | + */ | |
8 | + | |
9 | +$log = new Log(); | |
10 | +$param = ''; | |
11 | +if (isset($_GET['param'])) { | |
12 | + $param = $_GET['param']; | |
13 | +} | |
14 | +$log->Index($param); | |
15 | + | |
16 | +/** | |
17 | + * 项目日志管理接口 | |
18 | + * Class LogController | |
19 | + * @package Apimini\Controller\Home | |
20 | + */ | |
21 | +class Log | |
22 | +{ | |
23 | + public function Index($param, $del = null) | |
24 | + { | |
25 | + $serverPath = str_replace('\\','/',realpath(dirname(__FILE__).'/')); | |
26 | + $path = rtrim($serverPath, 'phpapi') . $param; | |
27 | + // 是否需要删除文件操作 | |
28 | + if (!empty($del) || strpos(strtolower($param), '.log')) { | |
29 | + $delPath = $path . '/' . $del; | |
30 | + $this->delFile($delPath); | |
31 | + } | |
32 | + | |
33 | + // 判断访问的是文件还是文件夹 | |
34 | + if(strpos($param, '.')) { | |
35 | + $this->ReadFile($path); | |
36 | + } else { | |
37 | + echo '目录: ' . ' <a href="?param=">party</a> / '; | |
38 | + $this->Banner($param); | |
39 | + $dir = $this->ReadPath($path, $param); | |
40 | + echo $dir; | |
41 | + } | |
42 | + return true; | |
43 | + } | |
44 | + | |
45 | + // 删除文件 | |
46 | + // private function delFile($file_path) | |
47 | + // { | |
48 | + // if(file_exists($file_path)){ | |
49 | + // unlink($file_path); | |
50 | + // } | |
51 | + // } | |
52 | + | |
53 | + /** | |
54 | + * 读取文件 | |
55 | + * @param $file_path | |
56 | + */ | |
57 | + private function ReadFile($file_path) | |
58 | + { | |
59 | + if(strpos($file_path,'config.') !== false || strpos($file_path,'upload') !== false || strpos($file_path,'img') !== false){ | |
60 | + return; | |
61 | + } | |
62 | + if(file_exists($file_path)){ | |
63 | + $file_arr = file($file_path); | |
64 | + for($i=0;$i<count($file_arr);$i++){//逐行读取文件内容 | |
65 | + echo $file_arr[$i] . "<br />"; | |
66 | + } | |
67 | + } | |
68 | + } | |
69 | + | |
70 | + /** | |
71 | + * 面包屑 | |
72 | + * @param $param | |
73 | + */ | |
74 | + private function Banner($param) | |
75 | + { | |
76 | + $timestamp = '&t=' . time(); | |
77 | + $url = '?param='; | |
78 | + $str = ''; | |
79 | + foreach (explode('/',$param) as $item) { | |
80 | + if (empty($item)) | |
81 | + continue; | |
82 | + $url .= '/' . $item; | |
83 | + $str .= '<a href="'. $url . $timestamp .'">'. $item .'</a> / '; | |
84 | + } | |
85 | + echo $str . '<hr />'; | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * 读取文件夹 | |
90 | + * @param $path | |
91 | + * @param $param | |
92 | + * @return string | |
93 | + */ | |
94 | + private function ReadPath($path, $param) | |
95 | + { | |
96 | + $timestamp = '&t=' . time(); | |
97 | + | |
98 | + $fileArr = []; | |
99 | + if(is_dir($path)){ | |
100 | + if($dh = @opendir($path)){ | |
101 | + while(($file = readdir($dh)) !== false){ | |
102 | + if($file != '.' && $file != '..'){ | |
103 | + $fileArr[] = $file; | |
104 | + } | |
105 | + } | |
106 | + closedir($dh); // 关闭 | |
107 | + } | |
108 | + } | |
109 | + // 给目录文件增加点击链接 | |
110 | + $url = ''; | |
111 | + foreach ($fileArr as $file) { | |
112 | + if(strpos($file,'config.') !== false || strpos($file,'upload') !== false || strpos($file,'img') !== false){ | |
113 | + continue; | |
114 | + } | |
115 | + $target = ''; | |
116 | + $del = ''; | |
117 | + if (strpos($file, '.')) { | |
118 | + $target = ' target = "_blank"'; | |
119 | + } | |
120 | + $url .= '<a href="?param='. $param . '/' . $file . $timestamp . '" '. $target .'>' . $file . '</a> ' . $del . ' <br />'; | |
121 | + } | |
122 | + return $url; | |
123 | + } | |
124 | + | |
125 | +} | |
... | ... |
phpapi/mock.php
0 → 100644
1 | +++ a/phpapi/mock.php | |
1 | +<?php | |
2 | + // 模拟我openid登录 | |
3 | + include "Common/mysqlHelper.php"; | |
4 | + include "Common/WechatHelper.php"; | |
5 | + include "Common/Encrypter.php"; | |
6 | + $enctypt = new Encrypter(); | |
7 | + setcookie("openid",$enctypt->encrypt('ouEVM1Ieii_IBRZgClekbbuTUXKA'),time()+3600*24, '/', $_SERVER["SERVER_NAME"]); | |
8 | + $wechar = new WechatHelper(); | |
9 | + header('location:' . $wechar->IndexPageURL()); | |
... | ... |
py_face/face.py
0 → 100644
1 | +++ a/py_face/face.py | |
1 | +import cv2 | |
2 | +import os | |
3 | +import shutil | |
4 | + | |
5 | +Img_dir = '../cacheUserImg' | |
6 | +Copy_dir = '../cacheUserImgCopy' | |
7 | +cv2.namedWindow("show", 0) | |
8 | +# 获取人脸识别训练数据 | |
9 | +# face_cascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml') | |
10 | +face_cascade = cv2.CascadeClassifier('./haarcascade_frontalface_alt.xml') | |
11 | + | |
12 | + | |
13 | +def show(img, ms=0, reduce=3): | |
14 | + """ 显示 """ | |
15 | + cv2.imshow('show', img) | |
16 | + h, w = img.shape[:2] | |
17 | + cv2.resizeWindow("show", w//reduce, h//reduce) | |
18 | + cv2.waitKey(ms) | |
19 | + | |
20 | + | |
21 | +def rotate_img_bad(img, angle): | |
22 | + """ 旋转 """ | |
23 | + # 原图的高、宽 以及通道数 | |
24 | + h, w = img.shape[:2] | |
25 | + M = cv2.getRotationMatrix2D((w / 2, h / 2), angle, 1.0) | |
26 | + rotated_img = cv2.warpAffine(img, M, (w, h)) | |
27 | + # show(rotated_img) | |
28 | + cv2.imwrite(f'./test_{angle}.png', rotated_img) | |
29 | + return rotated_img | |
30 | + | |
31 | + | |
32 | +def rotate_img(image, angle): | |
33 | + # grab the dimensions of the image and then determine the | |
34 | + # center | |
35 | + (h, w) = image.shape[:2] | |
36 | + (cX, cY) = (w // 2, h // 2) | |
37 | + | |
38 | + # grab the rotation matrix (applying the negative of the | |
39 | + # angle to rotate clockwise), then grab the sine and cosine | |
40 | + # (i.e., the rotation components of the matrix) | |
41 | + M = cv2.getRotationMatrix2D((cX, cY), -angle, 1.0) | |
42 | + # print(M, type(M)) | |
43 | + cos = abs(M[0, 0]) | |
44 | + sin = abs(M[0, 1]) | |
45 | + # print(f"cos {cos}, sin {sin}.\t h,w:{h},{w}\tangle:{angle} \t point:{cX},{cY}") | |
46 | + | |
47 | + # compute the new bounding dimensions of the image | |
48 | + nW = int((h * sin) + (w * cos)) | |
49 | + nH = int((h * cos) + (w * sin)) | |
50 | + | |
51 | + # adjust the rotation matrix to take into account translation | |
52 | + M[0, 2] += (nW / 2) - cX | |
53 | + M[1, 2] += (nH / 2) - cY | |
54 | + | |
55 | + # perform the actual rotation and return the image | |
56 | + rotated_img = cv2.warpAffine(image, M, (nW, nH)) | |
57 | + # cv2.imwrite(f'./test_{angle}.png', rotated_img) | |
58 | + return rotated_img | |
59 | + | |
60 | + | |
61 | +def check_face(img_gray, cascade): | |
62 | + """ 检测人脸 """ | |
63 | + # 探测图片中的人脸 | |
64 | + faces = face_cascade.detectMultiScale( | |
65 | + img_gray, | |
66 | + scaleFactor=1.1, # 每次缩减比例 | |
67 | + minNeighbors=5, # 检测多次 | |
68 | + flags=cv2.CASCADE_SCALE_IMAGE, | |
69 | + minSize=(100, 100) | |
70 | + ) | |
71 | + | |
72 | + print("检测到人脸区域:{}".format(faces)) | |
73 | + return faces | |
74 | + | |
75 | + | |
76 | +def mark_face(img, faces): | |
77 | + """ 标记人脸 """ | |
78 | + print("mark face") | |
79 | + iy, ix = img.shape[:2] | |
80 | + for x, y, w, h in faces: | |
81 | + # cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 2) | |
82 | + show(img, 100) | |
83 | + | |
84 | + # 裁剪图片 | |
85 | + print(ix, iy, x, y, w, h) | |
86 | + length2 = min(ix, iy) | |
87 | + | |
88 | + length = int(w*2.5) | |
89 | + length = min(length2, length) | |
90 | + print(f"length: {length2} {length}") | |
91 | + | |
92 | + | |
93 | + ow = length-w | |
94 | + ow1 = ow//2 | |
95 | + oh = length-h | |
96 | + oh1 = oh//2 | |
97 | + | |
98 | + y1, y2 = y-oh1, y+h+oh1 | |
99 | + x1, x2 = x-ow1, x+w+ow1 | |
100 | + | |
101 | + | |
102 | + # 检测图片溢出 | |
103 | + print(y1, y2, x1, x2) | |
104 | + if y1 < 0: | |
105 | + print('裁剪:1 顶部溢出') | |
106 | + y1 = 0 | |
107 | + y2 = length | |
108 | + if y2 > iy: | |
109 | + print('裁剪:2 底部溢出') | |
110 | + y2 = iy | |
111 | + y1 = iy-length | |
112 | + if x1 < 0: | |
113 | + print('裁剪:3 左侧溢出') | |
114 | + x1 = 0 | |
115 | + x2 = length | |
116 | + if x2 > ix: | |
117 | + print('裁剪:4 右侧溢出') | |
118 | + x2 = ix | |
119 | + x1 = ix-length | |
120 | + | |
121 | + img2 = img[y1:y2, x1:x2] | |
122 | + show(img2, 200) | |
123 | + return img2 | |
124 | + | |
125 | + | |
126 | +def run(img_name): | |
127 | + # 读取图片,灰度转换 | |
128 | + img_bgr = cv2.imread(os.path.join(Img_dir, img_name)) | |
129 | + img_gray = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2GRAY) | |
130 | + | |
131 | + # 旋转图片 | |
132 | + find = False | |
133 | + for angle in range(0, 360, 90): | |
134 | + show(rotate_img(img_bgr, angle), 100) | |
135 | + print(f"angle: {angle}") | |
136 | + if angle > 0: | |
137 | + img_bgr_r = rotate_img(img_bgr, angle) | |
138 | + img_gray_r = rotate_img(img_gray, angle) | |
139 | + else: | |
140 | + img_bgr_r = img_bgr | |
141 | + img_gray_r = img_gray | |
142 | + | |
143 | + faces = check_face(img_gray_r, face_cascade) | |
144 | + | |
145 | + if not isinstance(faces, tuple): | |
146 | + print("find face") | |
147 | + img_final = mark_face(img_bgr_r, faces) | |
148 | + find = True | |
149 | + break | |
150 | + # show(img_bgr_r, 1000) | |
151 | + print('end') | |
152 | + if not find: | |
153 | + print("未找到人脸,使用原图") | |
154 | + img_final = img_bgr | |
155 | + | |
156 | + | |
157 | + cv2.imwrite(os.path.join(Img_dir, img_name), img_final) | |
158 | + | |
159 | + | |
160 | + | |
161 | +if __name__ == '__main__': | |
162 | + file_list = os.listdir(Img_dir) | |
163 | + for i in range(len(file_list)): | |
164 | + file_name = file_list[i] | |
165 | + print("处理图片{0}/{1}: {2}".format(i+1, len(file_list), file_name)) | |
166 | + if not os.path.exists(os.path.join(Copy_dir, file_name)): | |
167 | + shutil.copy(f'{Img_dir}/{file_name}', f'{Copy_dir}/{file_name}') | |
168 | + try: | |
169 | + run(file_name) | |
170 | + except Exception as _: | |
171 | + pass | |
172 | + | |
173 | + cv2.destroyAllWindows() | |
... | ... |