yc-ui2 0.1.2-beta25 → 0.1.2-beta26

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,113 +11,6 @@
11
11
  return /******/ (function() { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
- /***/ 1001:
15
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
16
-
17
- "use strict";
18
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19
- /* harmony export */ Z: function() { return /* binding */ normalizeComponent; }
20
- /* harmony export */ });
21
- /* globals __VUE_SSR_CONTEXT__ */
22
-
23
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
24
- // This module is a runtime utility for cleaner component module output and will
25
- // be included in the final webpack user bundle.
26
-
27
- function normalizeComponent(
28
- scriptExports,
29
- render,
30
- staticRenderFns,
31
- functionalTemplate,
32
- injectStyles,
33
- scopeId,
34
- moduleIdentifier /* server only */,
35
- shadowMode /* vue-cli only */
36
- ) {
37
- // Vue.extend constructor export interop
38
- var options =
39
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
40
-
41
- // render functions
42
- if (render) {
43
- options.render = render
44
- options.staticRenderFns = staticRenderFns
45
- options._compiled = true
46
- }
47
-
48
- // functional template
49
- if (functionalTemplate) {
50
- options.functional = true
51
- }
52
-
53
- // scopedId
54
- if (scopeId) {
55
- options._scopeId = 'data-v-' + scopeId
56
- }
57
-
58
- var hook
59
- if (moduleIdentifier) {
60
- // server build
61
- hook = function (context) {
62
- // 2.3 injection
63
- context =
64
- context || // cached call
65
- (this.$vnode && this.$vnode.ssrContext) || // stateful
66
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
67
- // 2.2 with runInNewContext: true
68
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
69
- context = __VUE_SSR_CONTEXT__
70
- }
71
- // inject component styles
72
- if (injectStyles) {
73
- injectStyles.call(this, context)
74
- }
75
- // register component module identifier for async chunk inferrence
76
- if (context && context._registeredComponents) {
77
- context._registeredComponents.add(moduleIdentifier)
78
- }
79
- }
80
- // used by ssr in case component is cached and beforeCreate
81
- // never gets called
82
- options._ssrRegister = hook
83
- } else if (injectStyles) {
84
- hook = shadowMode
85
- ? function () {
86
- injectStyles.call(
87
- this,
88
- (options.functional ? this.parent : this).$root.$options.shadowRoot
89
- )
90
- }
91
- : injectStyles
92
- }
93
-
94
- if (hook) {
95
- if (options.functional) {
96
- // for template-only hot-reload because in that case the render fn doesn't
97
- // go through the normalizer
98
- options._injectStyles = hook
99
- // register for functional component in vue file
100
- var originalRender = options.render
101
- options.render = function renderWithStyleInjection(h, context) {
102
- hook.call(context)
103
- return originalRender(h, context)
104
- }
105
- } else {
106
- // inject component registration as beforeCreate hook
107
- var existing = options.beforeCreate
108
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
109
- }
110
- }
111
-
112
- return {
113
- exports: scriptExports,
114
- options: options
115
- }
116
- }
117
-
118
-
119
- /***/ }),
120
-
121
14
  /***/ 9662:
122
15
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
123
16
 
@@ -6378,9 +6271,6 @@ module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgI
6378
6271
  /******/ return module.exports;
6379
6272
  /******/ }
6380
6273
  /******/
6381
- /******/ // expose the modules object (__webpack_modules__)
6382
- /******/ __webpack_require__.m = __webpack_modules__;
6383
- /******/
6384
6274
  /************************************************************************/
6385
6275
  /******/ /* webpack/runtime/compat get default export */
6386
6276
  /******/ !function() {
@@ -6406,37 +6296,6 @@ module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgI
6406
6296
  /******/ };
6407
6297
  /******/ }();
6408
6298
  /******/
6409
- /******/ /* webpack/runtime/ensure chunk */
6410
- /******/ !function() {
6411
- /******/ __webpack_require__.f = {};
6412
- /******/ // This file contains only the entry chunk.
6413
- /******/ // The chunk loading function for additional chunks
6414
- /******/ __webpack_require__.e = function(chunkId) {
6415
- /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {
6416
- /******/ __webpack_require__.f[key](chunkId, promises);
6417
- /******/ return promises;
6418
- /******/ }, []));
6419
- /******/ };
6420
- /******/ }();
6421
- /******/
6422
- /******/ /* webpack/runtime/get javascript chunk filename */
6423
- /******/ !function() {
6424
- /******/ // This function allow to reference async chunks
6425
- /******/ __webpack_require__.u = function(chunkId) {
6426
- /******/ // return url for filenames based on template
6427
- /******/ return "yc-ui2.umd." + chunkId + ".js";
6428
- /******/ };
6429
- /******/ }();
6430
- /******/
6431
- /******/ /* webpack/runtime/get mini-css chunk filename */
6432
- /******/ !function() {
6433
- /******/ // This function allow to reference async chunks
6434
- /******/ __webpack_require__.miniCssF = function(chunkId) {
6435
- /******/ // return url for filenames based on template
6436
- /******/ return "css/" + chunkId + "." + "de9a931f" + ".css";
6437
- /******/ };
6438
- /******/ }();
6439
- /******/
6440
6299
  /******/ /* webpack/runtime/global */
6441
6300
  /******/ !function() {
6442
6301
  /******/ __webpack_require__.g = (function() {
@@ -6454,52 +6313,6 @@ module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgI
6454
6313
  /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
6455
6314
  /******/ }();
6456
6315
  /******/
6457
- /******/ /* webpack/runtime/load script */
6458
- /******/ !function() {
6459
- /******/ var inProgress = {};
6460
- /******/ var dataWebpackPrefix = "yc-ui2:";
6461
- /******/ // loadScript function to load a script via script tag
6462
- /******/ __webpack_require__.l = function(url, done, key, chunkId) {
6463
- /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
6464
- /******/ var script, needAttach;
6465
- /******/ if(key !== undefined) {
6466
- /******/ var scripts = document.getElementsByTagName("script");
6467
- /******/ for(var i = 0; i < scripts.length; i++) {
6468
- /******/ var s = scripts[i];
6469
- /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
6470
- /******/ }
6471
- /******/ }
6472
- /******/ if(!script) {
6473
- /******/ needAttach = true;
6474
- /******/ script = document.createElement('script');
6475
- /******/
6476
- /******/ script.charset = 'utf-8';
6477
- /******/ script.timeout = 120;
6478
- /******/ if (__webpack_require__.nc) {
6479
- /******/ script.setAttribute("nonce", __webpack_require__.nc);
6480
- /******/ }
6481
- /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
6482
- /******/
6483
- /******/ script.src = url;
6484
- /******/ }
6485
- /******/ inProgress[url] = [done];
6486
- /******/ var onScriptComplete = function(prev, event) {
6487
- /******/ // avoid mem leaks in IE.
6488
- /******/ script.onerror = script.onload = null;
6489
- /******/ clearTimeout(timeout);
6490
- /******/ var doneFns = inProgress[url];
6491
- /******/ delete inProgress[url];
6492
- /******/ script.parentNode && script.parentNode.removeChild(script);
6493
- /******/ doneFns && doneFns.forEach(function(fn) { return fn(event); });
6494
- /******/ if(prev) return prev(event);
6495
- /******/ }
6496
- /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
6497
- /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
6498
- /******/ script.onload = onScriptComplete.bind(null, script.onload);
6499
- /******/ needAttach && document.head.appendChild(script);
6500
- /******/ };
6501
- /******/ }();
6502
- /******/
6503
6316
  /******/ /* webpack/runtime/make namespace object */
6504
6317
  /******/ !function() {
6505
6318
  /******/ // define __esModule on exports
@@ -6516,175 +6329,6 @@ module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgI
6516
6329
  /******/ __webpack_require__.p = "";
6517
6330
  /******/ }();
6518
6331
  /******/
6519
- /******/ /* webpack/runtime/css loading */
6520
- /******/ !function() {
6521
- /******/ if (typeof document === "undefined") return;
6522
- /******/ var createStylesheet = function(chunkId, fullhref, oldTag, resolve, reject) {
6523
- /******/ var linkTag = document.createElement("link");
6524
- /******/
6525
- /******/ linkTag.rel = "stylesheet";
6526
- /******/ linkTag.type = "text/css";
6527
- /******/ var onLinkComplete = function(event) {
6528
- /******/ // avoid mem leaks.
6529
- /******/ linkTag.onerror = linkTag.onload = null;
6530
- /******/ if (event.type === 'load') {
6531
- /******/ resolve();
6532
- /******/ } else {
6533
- /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
6534
- /******/ var realHref = event && event.target && event.target.href || fullhref;
6535
- /******/ var err = new Error("Loading CSS chunk " + chunkId + " failed.\n(" + realHref + ")");
6536
- /******/ err.code = "CSS_CHUNK_LOAD_FAILED";
6537
- /******/ err.type = errorType;
6538
- /******/ err.request = realHref;
6539
- /******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
6540
- /******/ reject(err);
6541
- /******/ }
6542
- /******/ }
6543
- /******/ linkTag.onerror = linkTag.onload = onLinkComplete;
6544
- /******/ linkTag.href = fullhref;
6545
- /******/
6546
- /******/ if (oldTag) {
6547
- /******/ oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);
6548
- /******/ } else {
6549
- /******/ document.head.appendChild(linkTag);
6550
- /******/ }
6551
- /******/ return linkTag;
6552
- /******/ };
6553
- /******/ var findStylesheet = function(href, fullhref) {
6554
- /******/ var existingLinkTags = document.getElementsByTagName("link");
6555
- /******/ for(var i = 0; i < existingLinkTags.length; i++) {
6556
- /******/ var tag = existingLinkTags[i];
6557
- /******/ var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");
6558
- /******/ if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return tag;
6559
- /******/ }
6560
- /******/ var existingStyleTags = document.getElementsByTagName("style");
6561
- /******/ for(var i = 0; i < existingStyleTags.length; i++) {
6562
- /******/ var tag = existingStyleTags[i];
6563
- /******/ var dataHref = tag.getAttribute("data-href");
6564
- /******/ if(dataHref === href || dataHref === fullhref) return tag;
6565
- /******/ }
6566
- /******/ };
6567
- /******/ var loadStylesheet = function(chunkId) {
6568
- /******/ return new Promise(function(resolve, reject) {
6569
- /******/ var href = __webpack_require__.miniCssF(chunkId);
6570
- /******/ var fullhref = __webpack_require__.p + href;
6571
- /******/ if(findStylesheet(href, fullhref)) return resolve();
6572
- /******/ createStylesheet(chunkId, fullhref, null, resolve, reject);
6573
- /******/ });
6574
- /******/ }
6575
- /******/ // object to store loaded CSS chunks
6576
- /******/ var installedCssChunks = {
6577
- /******/ 343: 0
6578
- /******/ };
6579
- /******/
6580
- /******/ __webpack_require__.f.miniCss = function(chunkId, promises) {
6581
- /******/ var cssChunks = {"774":1};
6582
- /******/ if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);
6583
- /******/ else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {
6584
- /******/ promises.push(installedCssChunks[chunkId] = loadStylesheet(chunkId).then(function() {
6585
- /******/ installedCssChunks[chunkId] = 0;
6586
- /******/ }, function(e) {
6587
- /******/ delete installedCssChunks[chunkId];
6588
- /******/ throw e;
6589
- /******/ }));
6590
- /******/ }
6591
- /******/ };
6592
- /******/
6593
- /******/ // no hmr
6594
- /******/ }();
6595
- /******/
6596
- /******/ /* webpack/runtime/jsonp chunk loading */
6597
- /******/ !function() {
6598
- /******/ // no baseURI
6599
- /******/
6600
- /******/ // object to store loaded and loading chunks
6601
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
6602
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
6603
- /******/ var installedChunks = {
6604
- /******/ 343: 0
6605
- /******/ };
6606
- /******/
6607
- /******/ __webpack_require__.f.j = function(chunkId, promises) {
6608
- /******/ // JSONP chunk loading for javascript
6609
- /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
6610
- /******/ if(installedChunkData !== 0) { // 0 means "already installed".
6611
- /******/
6612
- /******/ // a Promise means "currently loading".
6613
- /******/ if(installedChunkData) {
6614
- /******/ promises.push(installedChunkData[2]);
6615
- /******/ } else {
6616
- /******/ if(true) { // all chunks have JS
6617
- /******/ // setup Promise in chunk cache
6618
- /******/ var promise = new Promise(function(resolve, reject) { installedChunkData = installedChunks[chunkId] = [resolve, reject]; });
6619
- /******/ promises.push(installedChunkData[2] = promise);
6620
- /******/
6621
- /******/ // start chunk loading
6622
- /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
6623
- /******/ // create error before stack unwound to get useful stacktrace later
6624
- /******/ var error = new Error();
6625
- /******/ var loadingEnded = function(event) {
6626
- /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
6627
- /******/ installedChunkData = installedChunks[chunkId];
6628
- /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
6629
- /******/ if(installedChunkData) {
6630
- /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
6631
- /******/ var realSrc = event && event.target && event.target.src;
6632
- /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
6633
- /******/ error.name = 'ChunkLoadError';
6634
- /******/ error.type = errorType;
6635
- /******/ error.request = realSrc;
6636
- /******/ installedChunkData[1](error);
6637
- /******/ }
6638
- /******/ }
6639
- /******/ };
6640
- /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
6641
- /******/ }
6642
- /******/ }
6643
- /******/ }
6644
- /******/ };
6645
- /******/
6646
- /******/ // no prefetching
6647
- /******/
6648
- /******/ // no preloaded
6649
- /******/
6650
- /******/ // no HMR
6651
- /******/
6652
- /******/ // no HMR manifest
6653
- /******/
6654
- /******/ // no on chunks loaded
6655
- /******/
6656
- /******/ // install a JSONP callback for chunk loading
6657
- /******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) {
6658
- /******/ var chunkIds = data[0];
6659
- /******/ var moreModules = data[1];
6660
- /******/ var runtime = data[2];
6661
- /******/ // add "moreModules" to the modules object,
6662
- /******/ // then flag all "chunkIds" as loaded and fire callback
6663
- /******/ var moduleId, chunkId, i = 0;
6664
- /******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {
6665
- /******/ for(moduleId in moreModules) {
6666
- /******/ if(__webpack_require__.o(moreModules, moduleId)) {
6667
- /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
6668
- /******/ }
6669
- /******/ }
6670
- /******/ if(runtime) var result = runtime(__webpack_require__);
6671
- /******/ }
6672
- /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
6673
- /******/ for(;i < chunkIds.length; i++) {
6674
- /******/ chunkId = chunkIds[i];
6675
- /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
6676
- /******/ installedChunks[chunkId][0]();
6677
- /******/ }
6678
- /******/ installedChunks[chunkId] = 0;
6679
- /******/ }
6680
- /******/
6681
- /******/ }
6682
- /******/
6683
- /******/ var chunkLoadingGlobal = (typeof self !== 'undefined' ? self : this)["webpackChunkyc_ui2"] = (typeof self !== 'undefined' ? self : this)["webpackChunkyc_ui2"] || [];
6684
- /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
6685
- /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
6686
- /******/ }();
6687
- /******/
6688
6332
  /************************************************************************/
6689
6333
  var __webpack_exports__ = {};
6690
6334
  // This entry need to be wrapped in an IIFE because it need to be in strict mode.
@@ -6715,7 +6359,7 @@ if (typeof window !== 'undefined') {
6715
6359
  // Indicate to webpack that this file can be concatenated
6716
6360
  /* harmony default export */ var setPublicPath = (null);
6717
6361
 
6718
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/YcSlideVerify/index.vue?vue&type=template&id=27550b14&scoped=true&
6362
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/YcSlideVerify/index.vue?vue&type=template&id=2c1e2525&scoped=true&
6719
6363
  var render = function render() {
6720
6364
  var _vm = this,
6721
6365
  _c = _vm._self._c;
@@ -6753,12 +6397,530 @@ var staticRenderFns = [];
6753
6397
 
6754
6398
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
6755
6399
  var es_array_push = __webpack_require__(7658);
6400
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./node_modules/vue-monoplasty-slide-verify/src/lib/slide-verify.vue?vue&type=template&id=b67196d8&scoped=true&
6401
+ var slide_verifyvue_type_template_id_b67196d8_scoped_true_render = function render() {
6402
+ var _vm = this,
6403
+ _c = _vm._self._c;
6404
+ return _c('div', {
6405
+ staticClass: "slide-verify",
6406
+ style: {
6407
+ width: _vm.w + 'px'
6408
+ },
6409
+ attrs: {
6410
+ "id": "slideVerify",
6411
+ "onselectstart": "return false;"
6412
+ }
6413
+ }, [_c('div', {
6414
+ class: {
6415
+ 'slider-verify-loading': _vm.loadBlock
6416
+ }
6417
+ }), _c('canvas', {
6418
+ ref: "canvas",
6419
+ attrs: {
6420
+ "width": _vm.w,
6421
+ "height": _vm.h
6422
+ }
6423
+ }), _vm.show ? _c('div', {
6424
+ staticClass: "slide-verify-refresh-icon",
6425
+ on: {
6426
+ "click": _vm.refresh
6427
+ }
6428
+ }) : _vm._e(), _c('canvas', {
6429
+ ref: "block",
6430
+ staticClass: "slide-verify-block",
6431
+ attrs: {
6432
+ "width": _vm.w,
6433
+ "height": _vm.h
6434
+ }
6435
+ }), _c('div', {
6436
+ staticClass: "slide-verify-slider",
6437
+ class: {
6438
+ 'container-active': _vm.containerActive,
6439
+ 'container-success': _vm.containerSuccess,
6440
+ 'container-fail': _vm.containerFail
6441
+ }
6442
+ }, [_c('div', {
6443
+ staticClass: "slide-verify-slider-mask",
6444
+ style: {
6445
+ width: _vm.sliderMaskWidth
6446
+ }
6447
+ }, [_c('div', {
6448
+ staticClass: "slide-verify-slider-mask-item",
6449
+ style: {
6450
+ left: _vm.sliderLeft
6451
+ },
6452
+ on: {
6453
+ "mousedown": _vm.sliderDown,
6454
+ "touchstart": _vm.touchStartEvent,
6455
+ "touchmove": function ($event) {
6456
+ return _vm.handleMoveEvent($event, 'touch');
6457
+ },
6458
+ "touchend": function ($event) {
6459
+ return _vm.handleMoveEndEvent($event, 'touch');
6460
+ }
6461
+ }
6462
+ }, [_c('div', {
6463
+ staticClass: "slide-verify-slider-mask-item-icon"
6464
+ })])]), _c('span', {
6465
+ staticClass: "slide-verify-slider-text"
6466
+ }, [_vm._v(_vm._s(_vm.sliderText))])])]);
6467
+ };
6468
+ var slide_verifyvue_type_template_id_b67196d8_scoped_true_staticRenderFns = [];
6469
+
6470
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./node_modules/vue-monoplasty-slide-verify/src/lib/slide-verify.vue?vue&type=script&lang=js&
6471
+
6472
+ const PI = Math.PI;
6473
+ function sum(x, y) {
6474
+ return x + y;
6475
+ }
6476
+ function square(x) {
6477
+ return x * x;
6478
+ }
6479
+ /* harmony default export */ var slide_verifyvue_type_script_lang_js_ = ({
6480
+ name: "SlideVerify",
6481
+ props: {
6482
+ // block length
6483
+ l: {
6484
+ type: Number,
6485
+ default: 42
6486
+ },
6487
+ // block radius
6488
+ r: {
6489
+ type: Number,
6490
+ default: 10
6491
+ },
6492
+ // canvas width
6493
+ w: {
6494
+ type: Number,
6495
+ default: 310
6496
+ },
6497
+ // canvas height
6498
+ h: {
6499
+ type: Number,
6500
+ default: 155
6501
+ },
6502
+ sliderText: {
6503
+ type: String,
6504
+ default: "Slide filled right"
6505
+ },
6506
+ accuracy: {
6507
+ type: Number,
6508
+ default: 5 // 若为 -1 则不进行机器判断
6509
+ },
6510
+
6511
+ show: {
6512
+ type: Boolean,
6513
+ default: true
6514
+ },
6515
+ imgs: {
6516
+ type: Array,
6517
+ default: () => []
6518
+ }
6519
+ },
6520
+ data() {
6521
+ return {
6522
+ containerActive: false,
6523
+ // container active class
6524
+ containerSuccess: false,
6525
+ // container success class
6526
+ containerFail: false,
6527
+ // container fail class
6528
+ canvasCtx: null,
6529
+ blockCtx: null,
6530
+ block: null,
6531
+ block_x: undefined,
6532
+ // container random position
6533
+ block_y: undefined,
6534
+ L: this.l + this.r * 2 + 3,
6535
+ // block real length
6536
+ img: undefined,
6537
+ originX: undefined,
6538
+ originY: undefined,
6539
+ isMouseDown: false,
6540
+ trail: [],
6541
+ sliderLeft: 0,
6542
+ // block right offset
6543
+ sliderMaskWidth: 0,
6544
+ // mask width,
6545
+ success: false,
6546
+ // Bug Fixes 修复了验证成功后还能滑动
6547
+ loadBlock: true,
6548
+ // Features 图片加载提示,防止图片没加载完就开始验证
6549
+ timestamp: null
6550
+ };
6551
+ },
6552
+ mounted() {
6553
+ this.init();
6554
+ },
6555
+ methods: {
6556
+ init() {
6557
+ this.initDom();
6558
+ this.initImg();
6559
+ this.bindEvents();
6560
+ },
6561
+ initDom() {
6562
+ this.block = this.$refs.block;
6563
+ this.canvasCtx = this.$refs.canvas.getContext("2d");
6564
+ this.blockCtx = this.block.getContext("2d");
6565
+ },
6566
+ initImg() {
6567
+ const img = this.createImg(() => {
6568
+ // 图片加载完关闭遮蔽罩
6569
+ this.loadBlock = false;
6570
+ this.drawBlock();
6571
+ this.canvasCtx.drawImage(img, 0, 0, this.w, this.h);
6572
+ this.blockCtx.drawImage(img, 0, 0, this.w, this.h);
6573
+ let {
6574
+ block_x: x,
6575
+ block_y: y,
6576
+ r,
6577
+ L
6578
+ } = this;
6579
+ let _y = y - r * 2 - 1;
6580
+ let ImageData = this.blockCtx.getImageData(x, _y, L, L);
6581
+ this.block.width = L;
6582
+ this.blockCtx.putImageData(ImageData, 0, _y);
6583
+ });
6584
+ this.img = img;
6585
+ },
6586
+ drawBlock() {
6587
+ this.block_x = this.getRandomNumberByRange(this.L + 10, this.w - (this.L + 10));
6588
+ this.block_y = this.getRandomNumberByRange(10 + this.r * 2, this.h - (this.L + 10));
6589
+ this.draw(this.canvasCtx, this.block_x, this.block_y, "fill");
6590
+ this.draw(this.blockCtx, this.block_x, this.block_y, "clip");
6591
+ },
6592
+ draw(ctx, x, y, operation) {
6593
+ let {
6594
+ l,
6595
+ r
6596
+ } = this;
6597
+ ctx.beginPath();
6598
+ ctx.moveTo(x, y);
6599
+ ctx.arc(x + l / 2, y - r + 2, r, 0.72 * PI, 2.26 * PI);
6600
+ ctx.lineTo(x + l, y);
6601
+ ctx.arc(x + l + r - 2, y + l / 2, r, 1.21 * PI, 2.78 * PI);
6602
+ ctx.lineTo(x + l, y + l);
6603
+ ctx.lineTo(x, y + l);
6604
+ ctx.arc(x + r - 2, y + l / 2, r + 0.4, 2.76 * PI, 1.24 * PI, true);
6605
+ ctx.lineTo(x, y);
6606
+ ctx.lineWidth = 2;
6607
+ ctx.fillStyle = "rgba(255, 255, 255, 0.7)";
6608
+ ctx.strokeStyle = "rgba(255, 255, 255, 0.7)";
6609
+ ctx.stroke();
6610
+ ctx[operation]();
6611
+ // Bug Fixes 修复了火狐和ie显示问题
6612
+ ctx.globalCompositeOperation = "destination-over";
6613
+ },
6614
+ createImg(onload) {
6615
+ const img = document.createElement("img");
6616
+ img.crossOrigin = "Anonymous";
6617
+ img.onload = onload;
6618
+ img.onerror = () => {
6619
+ img.src = this.getRandomImg();
6620
+ };
6621
+ img.src = this.getRandomImg();
6622
+ return img;
6623
+ },
6624
+ // 随机生成img src
6625
+ getRandomImg() {
6626
+ // return require('../assets/img.jpg')
6627
+ const len = this.imgs.length;
6628
+ return len > 0 ? this.imgs[this.getRandomNumberByRange(0, len - 1)] :
6629
+ // "https://bing.ioliu.cn/v1/rand?w=300&h=150";
6630
+ "https://source.unsplash.com/300x150/?book,library";
6631
+ // "https://api.dujin.org/pic/fengjing";
6632
+ },
6633
+
6634
+ getRandomNumberByRange(start, end) {
6635
+ return Math.round(Math.random() * (end - start) + start);
6636
+ },
6637
+ refresh() {
6638
+ this.reset();
6639
+ this.$emit("refresh");
6640
+ },
6641
+ sliderDown(event) {
6642
+ if (this.success) return;
6643
+ this.originX = event.clientX;
6644
+ this.originY = event.clientY;
6645
+ this.isMouseDown = true;
6646
+ this.timestamp = +new Date();
6647
+ },
6648
+ touchStartEvent(e) {
6649
+ if (this.success) return;
6650
+ this.originX = e.changedTouches[0].pageX;
6651
+ this.originY = e.changedTouches[0].pageY;
6652
+ this.isMouseDown = true;
6653
+ this.timestamp = +new Date();
6654
+ },
6655
+ bindEvents() {
6656
+ document.addEventListener("mousemove", this.handleMoveEvent);
6657
+ document.addEventListener("mouseup", this.handleMoveEndEvent);
6658
+ },
6659
+ // 处理函数抽离
6660
+ handleMoveEvent: throttle(function (e, type = "mouse") {
6661
+ if (!this.isMouseDown) return false;
6662
+ const moveX = type === "mouse" ? e.clientX - this.originX : e.changedTouches[0].pageX - this.originX;
6663
+ const moveY = type === "mouse" ? e.clientY - this.originY : e.changedTouches[0].pageY - this.originY;
6664
+ if (moveX < 0 || moveX + 38 >= this.w) return false;
6665
+ this.sliderLeft = moveX + "px";
6666
+ let blockLeft = (this.w - 40 - 20) / (this.w - 40) * moveX;
6667
+ this.block.style.left = blockLeft + "px";
6668
+ this.containerActive = true; // add active
6669
+ this.sliderMaskWidth = moveX + "px";
6670
+ this.trail.push(moveY);
6671
+ }),
6672
+ handleMoveEndEvent(e, type = "mouse") {
6673
+ if (!this.isMouseDown) return false;
6674
+ this.isMouseDown = false;
6675
+ if (type === "mouse" && e.clientX === this.originX || type === "touch" && e.changedTouches[0].pageX === this.originX) return false;
6676
+ this.containerActive = false; // remove active
6677
+ this.timestamp = +new Date() - this.timestamp;
6678
+ const {
6679
+ spliced,
6680
+ TuringTest
6681
+ } = this.verify();
6682
+ if (spliced) {
6683
+ if (this.accuracy === -1) {
6684
+ this.containerSuccess = true;
6685
+ this.success = true;
6686
+ this.$emit("success", this.timestamp);
6687
+ return;
6688
+ }
6689
+ if (TuringTest) {
6690
+ // succ
6691
+ this.containerSuccess = true;
6692
+ this.success = true;
6693
+ this.$emit("success", this.timestamp);
6694
+ } else {
6695
+ this.containerFail = true;
6696
+ this.$emit("again");
6697
+ }
6698
+ } else {
6699
+ this.containerFail = true;
6700
+ this.$emit("fail");
6701
+ setTimeout(() => {
6702
+ this.reset();
6703
+ }, 1000);
6704
+ }
6705
+ },
6706
+ verify() {
6707
+ const arr = this.trail; // drag y move distance
6708
+ const average = arr.reduce(sum) / arr.length; // average
6709
+ const deviations = arr.map(x => x - average); // deviation array
6710
+ const stddev = Math.sqrt(deviations.map(square).reduce(sum) / arr.length); // standard deviation
6711
+ const left = parseInt(this.block.style.left);
6712
+ const accuracy = this.accuracy <= 1 ? 1 : this.accuracy > 10 ? 10 : this.accuracy;
6713
+ return {
6714
+ spliced: Math.abs(left - this.block_x) <= accuracy,
6715
+ TuringTest: average !== stddev // equal => not person operate
6716
+ };
6717
+ },
6718
+
6719
+ reset() {
6720
+ this.success = false;
6721
+ this.containerActive = false;
6722
+ this.containerSuccess = false;
6723
+ this.containerFail = false;
6724
+ this.sliderLeft = 0;
6725
+ this.block.style.left = 0;
6726
+ this.sliderMaskWidth = 0;
6727
+ // canvas
6728
+ let {
6729
+ w,
6730
+ h
6731
+ } = this;
6732
+ this.canvasCtx.clearRect(0, 0, w, h);
6733
+ this.blockCtx.clearRect(0, 0, w, h);
6734
+ this.block.width = w;
6735
+
6736
+ // generate img
6737
+ this.img.src = this.getRandomImg();
6738
+ this.$emit("fulfilled");
6739
+ }
6740
+ },
6741
+ destroyed() {
6742
+ document.removeEventListener("mousemove", this.handleMoveEvent);
6743
+ document.removeEventListener("mouseup", this.handleMoveEndEvent);
6744
+ }
6745
+ });
6746
+ function throttle(fn, interval = 50, options = {
6747
+ leading: true,
6748
+ trailing: true
6749
+ }) {
6750
+ const {
6751
+ leading,
6752
+ trailing,
6753
+ resultCallback
6754
+ } = options;
6755
+ let lastTime = 0;
6756
+ let timer = null;
6757
+ const _throttle = function (...args) {
6758
+ return new Promise((resolve, reject) => {
6759
+ const nowTime = new Date().getTime();
6760
+ if (!lastTime && !leading) lastTime = nowTime;
6761
+ const remainTime = interval - (nowTime - lastTime);
6762
+ if (remainTime <= 0) {
6763
+ if (timer) {
6764
+ clearTimeout(timer);
6765
+ timer = null;
6766
+ }
6767
+ const result = fn.apply(this, args);
6768
+ if (resultCallback) resultCallback(result);
6769
+ resolve(result);
6770
+ lastTime = nowTime;
6771
+ return;
6772
+ }
6773
+ if (trailing && !timer) {
6774
+ timer = setTimeout(() => {
6775
+ timer = null;
6776
+ lastTime = !leading ? 0 : new Date().getTime();
6777
+ const result = fn.apply(this, args);
6778
+ if (resultCallback) resultCallback(result);
6779
+ resolve(result);
6780
+ }, remainTime);
6781
+ }
6782
+ });
6783
+ };
6784
+ _throttle.cancel = function () {
6785
+ if (timer) clearTimeout(timer);
6786
+ timer = null;
6787
+ lastTime = 0;
6788
+ };
6789
+ return _throttle;
6790
+ }
6791
+ ;// CONCATENATED MODULE: ./node_modules/vue-monoplasty-slide-verify/src/lib/slide-verify.vue?vue&type=script&lang=js&
6792
+ /* harmony default export */ var lib_slide_verifyvue_type_script_lang_js_ = (slide_verifyvue_type_script_lang_js_);
6793
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./node_modules/vue-monoplasty-slide-verify/src/lib/slide-verify.vue?vue&type=style&index=0&id=b67196d8&prod&scoped=true&lang=css&
6794
+ // extracted by mini-css-extract-plugin
6795
+
6796
+ ;// CONCATENATED MODULE: ./node_modules/vue-monoplasty-slide-verify/src/lib/slide-verify.vue?vue&type=style&index=0&id=b67196d8&prod&scoped=true&lang=css&
6797
+
6798
+ ;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
6799
+ /* globals __VUE_SSR_CONTEXT__ */
6800
+
6801
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
6802
+ // This module is a runtime utility for cleaner component module output and will
6803
+ // be included in the final webpack user bundle.
6804
+
6805
+ function normalizeComponent(
6806
+ scriptExports,
6807
+ render,
6808
+ staticRenderFns,
6809
+ functionalTemplate,
6810
+ injectStyles,
6811
+ scopeId,
6812
+ moduleIdentifier /* server only */,
6813
+ shadowMode /* vue-cli only */
6814
+ ) {
6815
+ // Vue.extend constructor export interop
6816
+ var options =
6817
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
6818
+
6819
+ // render functions
6820
+ if (render) {
6821
+ options.render = render
6822
+ options.staticRenderFns = staticRenderFns
6823
+ options._compiled = true
6824
+ }
6825
+
6826
+ // functional template
6827
+ if (functionalTemplate) {
6828
+ options.functional = true
6829
+ }
6830
+
6831
+ // scopedId
6832
+ if (scopeId) {
6833
+ options._scopeId = 'data-v-' + scopeId
6834
+ }
6835
+
6836
+ var hook
6837
+ if (moduleIdentifier) {
6838
+ // server build
6839
+ hook = function (context) {
6840
+ // 2.3 injection
6841
+ context =
6842
+ context || // cached call
6843
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
6844
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
6845
+ // 2.2 with runInNewContext: true
6846
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
6847
+ context = __VUE_SSR_CONTEXT__
6848
+ }
6849
+ // inject component styles
6850
+ if (injectStyles) {
6851
+ injectStyles.call(this, context)
6852
+ }
6853
+ // register component module identifier for async chunk inferrence
6854
+ if (context && context._registeredComponents) {
6855
+ context._registeredComponents.add(moduleIdentifier)
6856
+ }
6857
+ }
6858
+ // used by ssr in case component is cached and beforeCreate
6859
+ // never gets called
6860
+ options._ssrRegister = hook
6861
+ } else if (injectStyles) {
6862
+ hook = shadowMode
6863
+ ? function () {
6864
+ injectStyles.call(
6865
+ this,
6866
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
6867
+ )
6868
+ }
6869
+ : injectStyles
6870
+ }
6871
+
6872
+ if (hook) {
6873
+ if (options.functional) {
6874
+ // for template-only hot-reload because in that case the render fn doesn't
6875
+ // go through the normalizer
6876
+ options._injectStyles = hook
6877
+ // register for functional component in vue file
6878
+ var originalRender = options.render
6879
+ options.render = function renderWithStyleInjection(h, context) {
6880
+ hook.call(context)
6881
+ return originalRender(h, context)
6882
+ }
6883
+ } else {
6884
+ // inject component registration as beforeCreate hook
6885
+ var existing = options.beforeCreate
6886
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
6887
+ }
6888
+ }
6889
+
6890
+ return {
6891
+ exports: scriptExports,
6892
+ options: options
6893
+ }
6894
+ }
6895
+
6896
+ ;// CONCATENATED MODULE: ./node_modules/vue-monoplasty-slide-verify/src/lib/slide-verify.vue
6897
+
6898
+
6899
+
6900
+ ;
6901
+
6902
+
6903
+ /* normalize component */
6904
+
6905
+ var component = normalizeComponent(
6906
+ lib_slide_verifyvue_type_script_lang_js_,
6907
+ slide_verifyvue_type_template_id_b67196d8_scoped_true_render,
6908
+ slide_verifyvue_type_template_id_b67196d8_scoped_true_staticRenderFns,
6909
+ false,
6910
+ null,
6911
+ "b67196d8",
6912
+ null
6913
+
6914
+ )
6915
+
6916
+ /* harmony default export */ var slide_verify = (component.exports);
6756
6917
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/YcSlideVerify/index.vue?vue&type=script&lang=js&
6757
6918
 
6919
+
6758
6920
  /* harmony default export */ var YcSlideVerifyvue_type_script_lang_js_ = ({
6759
6921
  name: "YcSlideVerify",
6760
6922
  components: {
6761
- slideVerify: () => __webpack_require__.e(/* import() */ 774).then(__webpack_require__.bind(__webpack_require__, 6774))
6923
+ SlideVerify: slide_verify
6762
6924
  },
6763
6925
  props: {
6764
6926
  title: {
@@ -6808,13 +6970,11 @@ var es_array_push = __webpack_require__(7658);
6808
6970
  });
6809
6971
  ;// CONCATENATED MODULE: ./src/components/YcSlideVerify/index.vue?vue&type=script&lang=js&
6810
6972
  /* harmony default export */ var components_YcSlideVerifyvue_type_script_lang_js_ = (YcSlideVerifyvue_type_script_lang_js_);
6811
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/YcSlideVerify/index.vue?vue&type=style&index=0&id=27550b14&prod&lang=scss&scoped=true&
6973
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/YcSlideVerify/index.vue?vue&type=style&index=0&id=2c1e2525&prod&lang=scss&scoped=true&
6812
6974
  // extracted by mini-css-extract-plugin
6813
6975
 
6814
- ;// CONCATENATED MODULE: ./src/components/YcSlideVerify/index.vue?vue&type=style&index=0&id=27550b14&prod&lang=scss&scoped=true&
6976
+ ;// CONCATENATED MODULE: ./src/components/YcSlideVerify/index.vue?vue&type=style&index=0&id=2c1e2525&prod&lang=scss&scoped=true&
6815
6977
 
6816
- // EXTERNAL MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
6817
- var componentNormalizer = __webpack_require__(1001);
6818
6978
  ;// CONCATENATED MODULE: ./src/components/YcSlideVerify/index.vue
6819
6979
 
6820
6980
 
@@ -6824,18 +6984,18 @@ var componentNormalizer = __webpack_require__(1001);
6824
6984
 
6825
6985
  /* normalize component */
6826
6986
 
6827
- var component = (0,componentNormalizer/* default */.Z)(
6987
+ var YcSlideVerify_component = normalizeComponent(
6828
6988
  components_YcSlideVerifyvue_type_script_lang_js_,
6829
6989
  render,
6830
6990
  staticRenderFns,
6831
6991
  false,
6832
6992
  null,
6833
- "27550b14",
6993
+ "2c1e2525",
6834
6994
  null
6835
6995
 
6836
6996
  )
6837
6997
 
6838
- /* harmony default export */ var YcSlideVerify = (component.exports);
6998
+ /* harmony default export */ var YcSlideVerify = (YcSlideVerify_component.exports);
6839
6999
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/YcCustomerService/index.vue?vue&type=template&id=849349a0&scoped=true&
6840
7000
  var YcCustomerServicevue_type_template_id_849349a0_scoped_true_render = function render() {
6841
7001
  var _vm = this,
@@ -7123,7 +7283,7 @@ var chatvue_type_template_id_755436e0_scoped_true_staticRenderFns = [];
7123
7283
 
7124
7284
  /* normalize component */
7125
7285
 
7126
- var chat_component = (0,componentNormalizer/* default */.Z)(
7286
+ var chat_component = normalizeComponent(
7127
7287
  YcCustomerService_chatvue_type_script_lang_js_,
7128
7288
  chatvue_type_template_id_755436e0_scoped_true_render,
7129
7289
  chatvue_type_template_id_755436e0_scoped_true_staticRenderFns,
@@ -7187,7 +7347,7 @@ var chat_component = (0,componentNormalizer/* default */.Z)(
7187
7347
 
7188
7348
  /* normalize component */
7189
7349
 
7190
- var YcCustomerService_component = (0,componentNormalizer/* default */.Z)(
7350
+ var YcCustomerService_component = normalizeComponent(
7191
7351
  components_YcCustomerServicevue_type_script_lang_js_,
7192
7352
  YcCustomerServicevue_type_template_id_849349a0_scoped_true_render,
7193
7353
  YcCustomerServicevue_type_template_id_849349a0_scoped_true_staticRenderFns,
@@ -7376,7 +7536,7 @@ var YcQuestionvue_type_template_id_6185ef7a_scoped_true_staticRenderFns = [];
7376
7536
 
7377
7537
  /* normalize component */
7378
7538
 
7379
- var YcQuestion_component = (0,componentNormalizer/* default */.Z)(
7539
+ var YcQuestion_component = normalizeComponent(
7380
7540
  components_YcQuestionvue_type_script_lang_js_,
7381
7541
  YcQuestionvue_type_template_id_6185ef7a_scoped_true_render,
7382
7542
  YcQuestionvue_type_template_id_6185ef7a_scoped_true_staticRenderFns,
@@ -9395,7 +9555,7 @@ function formateTime(dateStr) {
9395
9555
 
9396
9556
  /* normalize component */
9397
9557
 
9398
- var YcCA_component = (0,componentNormalizer/* default */.Z)(
9558
+ var YcCA_component = normalizeComponent(
9399
9559
  components_YcCAvue_type_script_lang_js_,
9400
9560
  YcCAvue_type_template_id_eeb04946_scoped_true_render,
9401
9561
  YcCAvue_type_template_id_eeb04946_scoped_true_staticRenderFns,