slide-vue3 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["index"]=t():e["index"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="2b1f")}({"0997":function(e,t,n){"use strict";var o=n("3d1e"),r=n("85b5"),i=n("f80f"),s=n("ab31"),a=n("9f97");function c(e){this.defaults=e,this.interceptors={request:new i,response:new i}}c.prototype.request=function(e){"string"===typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=a(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[s,void 0],n=Promise.resolve(e);this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));while(t.length)n=n.then(t.shift(),t.shift());return n},c.prototype.getUri=function(e){return e=a(this.defaults,e),r(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t}))}})),o.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,n,o){return this.request(a(o||{},{method:e,url:t,data:n}))}})),e.exports=c},"0cc7":function(e,t,n){"use strict";var o=n("3d1e");e.exports=function(e,t){o.forEach(e,(function(n,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[o])}))}},"26af":function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},"2a78":function(e,t,n){"use strict";var o=n("6c70");e.exports=function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(o("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},"2b1f":function(e,t,n){"use strict";if(n.r(t),"undefined"!==typeof window){var o=window.document.currentScript,r=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(n.p=r[1])}var i=n("5976"),s=n.n(i);const a=()=>{var e=navigator.userAgent.toLowerCase(),t="ipad"==e.match(/ipad/i),n="iphone os"==e.match(/iphone os/i),o="midp"==e.match(/midp/i),r="rv:1.2.3.4"==e.match(/rv:1.2.3.4/i),i="ucweb"==e.match(/ucweb/i),s="android"==e.match(/android/i),a="windows ce"==e.match(/windows ce/i),c="windows mobile"==e.match(/windows mobile/i);return!!(t||n||o||r||i||s||a||c)};n("cdfd");let c=n("9e42").default;a()&&(c=n("4554").default);const u={install:e=>{e.config.globalProperties.$getImg=(t,n)=>{const o=s.a.create();o({url:t,method:"get"}).then(({data:o})=>{if(o){const r=new c({frontimg:"data:image/png;base64,"+o.slidingImage,backimg:"data:image/png;base64,"+o.backImage,yHeight:o.yHeight,capcode:o.capcode,refreshcallback(o){switch(o){case!0:r.showTips(!0),setTimeout(()=>{r.destory()},500);break;case!1:r.showTips(!1),setTimeout(()=>{e.config.globalProperties.$getImg(t,n)},500);break;default:e.config.globalProperties.$getImg(t,n)}},callback(e){n({data:e,that:this})}})}})}}};var f=u;t["default"]=f},"3d1e":function(e,t,n){"use strict";var o=n("efe0"),r=Object.prototype.toString;function i(e){return"[object Array]"===r.call(e)}function s(e){return"undefined"===typeof e}function a(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"===typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function c(e){return"[object ArrayBuffer]"===r.call(e)}function u(e){return"undefined"!==typeof FormData&&e instanceof FormData}function f(e){var t;return t="undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t}function d(e){return"string"===typeof e}function l(e){return"number"===typeof e}function p(e){return null!==e&&"object"===typeof e}function h(e){if("[object Object]"!==r.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function m(e){return"[object Date]"===r.call(e)}function v(e){return"[object File]"===r.call(e)}function g(e){return"[object Blob]"===r.call(e)}function y(e){return"[object Function]"===r.call(e)}function b(e){return p(e)&&y(e.pipe)}function w(e){return"undefined"!==typeof URLSearchParams&&e instanceof URLSearchParams}function x(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function E(){return("undefined"===typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!==typeof window&&"undefined"!==typeof document)}function k(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),i(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(null,e[r],r,e)}function S(){var e={};function t(t,n){h(e[n])&&h(t)?e[n]=S(e[n],t):h(t)?e[n]=S({},t):i(t)?e[n]=t.slice():e[n]=t}for(var n=0,o=arguments.length;n<o;n++)k(arguments[n],t);return e}function D(e,t,n){return k(t,(function(t,r){e[r]=n&&"function"===typeof t?o(t,n):t})),e}function j(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}e.exports={isArray:i,isArrayBuffer:c,isBuffer:a,isFormData:u,isArrayBufferView:f,isString:d,isNumber:l,isObject:p,isPlainObject:h,isUndefined:s,isDate:m,isFile:v,isBlob:g,isFunction:y,isStream:b,isURLSearchParams:w,isStandardBrowserEnv:E,forEach:k,merge:S,extend:D,trim:x,stripBOM:j}},4554:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return o}));class o{constructor(e){const t={frontimg:"",backimg:"",callback:"",refreshcallback:"",yHeight:1};this.opts={...t,...e},this.offset={x:0,y:0},this.disX=0,this.moving=!1,this.init()}init(){const e=`\n <div class="code-k-div">\n <div class="code_bg"></div>\n <div class="code-con">\n <div class="code-img">\n <div class="code-img-con">\n <div class="code-mask" style="margin-top:${this.opts.yHeight}px"><img class="code-front-img" src="${this.opts.frontimg}"></div>\n <img class="code-back-img" src="${this.opts.backimg}">\n </div>\n <div class="code-push"><i class="icon-login-bg icon-w-25 icon-push">刷新</i><span class="code-tip"></span></div>\n </div>\n <div class="code-btn">\n <div class="code-btn-img code-btn-m"></div>\n <span class="code-span">按住滑块,拖动完成上方拼图</span>\n </div>\n </div>\n </div>`;this.destory();const t=document.createElement("div");t.className="slide-container",t.innerHTML=e,document.body.appendChild(t),this.maskDom=document.querySelector(".code-mask"),this.moveBtnDom=document.querySelector(".code-btn-m"),this.moveWrapDom=document.querySelector(".code-btn"),this.refreshDom=document.querySelector(".code-push"),this.tipDom=document.querySelector(".code-tip"),this.bgDom=document.querySelector(".code_bg"),this.initEvent()}initEvent(){this.refreshDom.addEventListener("click",()=>{this.opts.refreshcallback()}),this.moveBtnDom.addEventListener("touchstart",e=>{let t=e||window.event;t=t.targetTouches[0],this.offset={x:t.pageX,y:t.pageY},this.moving=!0,this.moveBtnDom.className+=" active"}),this.moveBtnDom.addEventListener("touchmove",e=>{if(!this.moving)return;let t=e||window.event;t=t.targetTouches[0];let n=t.pageX-this.offset.x;n<0?n=0:n>245&&(n=245),this.disX=n,this.moveBtnDom.style.left=n+10+"px",this.maskDom.style.left=n+"px"}),this.moveBtnDom.addEventListener("touchend",e=>{this.moveEnd(e)}),this.moveWrapDom.addEventListener("mouseleave",e=>{this.moveEnd(e)}),this.bgDom.addEventListener("click",()=>{this.moving||this.destory()})}moveEnd(){this.moving&&(this.offset={x:0,y:0},this.moving=!1,this.moveBtnDom.className=this.moveBtnDom.className.replace(" active",""),this.moveBtnDom.removeEventListener("mousemove",()=>{}),this.opts.callback({xpos:parseInt(this.disX),capcode:this.opts.capcode,image_valid_type:"slide_image"}))}showTips(e){const t={true:{name:"验证通过",color:"green"},false:{name:"验证不通过",color:"red"}};this.tipDom.innerHTML=t[e].name,this.tipDom.style.color=t[e].color}destory(){document.querySelector(".slide-container")&&document.body.removeChild(document.querySelector(".slide-container"))}}},"4a94":function(e,t,n){"use strict";var o=n("3d1e"),r=n("2a78"),i=n("a74f"),s=n("85b5"),a=n("d547"),c=n("ce40"),u=n("d5f5"),f=n("6c70");e.exports=function(e){return new Promise((function(t,n){var d=e.data,l=e.headers;o.isFormData(d)&&delete l["Content-Type"],(o.isBlob(d)||o.isFile(d))&&d.type&&delete l["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=unescape(encodeURIComponent(e.auth.password))||"";l.Authorization="Basic "+btoa(h+":"+m)}var v=a(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),s(v,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in p?c(p.getAllResponseHeaders()):null,i=e.responseType&&"text"!==e.responseType?p.response:p.responseText,s={data:i,status:p.status,statusText:p.statusText,headers:o,config:e,request:p};r(t,n,s),p=null}},p.onabort=function(){p&&(n(f("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(f("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(f(t,e,"ECONNABORTED",p)),p=null},o.isStandardBrowserEnv()){var g=(e.withCredentials||u(v))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;g&&(l[e.xsrfHeaderName]=g)}if("setRequestHeader"in p&&o.forEach(l,(function(e,t){"undefined"===typeof d&&"content-type"===t.toLowerCase()?delete l[t]:p.setRequestHeader(t,e)})),o.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(y){if("json"!==e.responseType)throw y}"function"===typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"===typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),d||(d=null),p.send(d)}))}},"50ca":function(e,t,n){"use strict";var o=n("3d1e");e.exports=function(e,t,n){return o.forEach(n,(function(n){e=n(e,t)})),e}},5976:function(e,t,n){e.exports=n("cf08")},"61f6":function(e,t,n){"use strict";e.exports=function(e,t,n,o,r){return e.config=t,n&&(e.code=n),e.request=o,e.response=r,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},6266:function(e,t,n){(function(e){function n(e,t){for(var n=0,o=e.length-1;o>=0;o--){var r=e[o];"."===r?e.splice(o,1):".."===r?(e.splice(o,1),n++):n&&(e.splice(o,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function o(e){"string"!==typeof e&&(e+="");var t,n=0,o=-1,r=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!r){n=t+1;break}}else-1===o&&(r=!1,o=t+1);return-1===o?"":e.slice(n,o)}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],o=0;o<e.length;o++)t(e[o],o,e)&&n.push(e[o]);return n}t.resolve=function(){for(var t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!==typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,o="/"===s.charAt(0))}return t=n(r(t.split("/"),(function(e){return!!e})),!o).join("/"),(o?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return e=n(r(e.split("/"),(function(e){return!!e})),!o).join("/"),e||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!==typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function o(e){for(var t=0;t<e.length;t++)if(""!==e[t])break;for(var n=e.length-1;n>=0;n--)if(""!==e[n])break;return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var r=o(e.split("/")),i=o(n.split("/")),s=Math.min(r.length,i.length),a=s,c=0;c<s;c++)if(r[c]!==i[c]){a=c;break}var u=[];for(c=a;c<r.length;c++)u.push("..");return u=u.concat(i.slice(a)),u.join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!==typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,r=!0,i=e.length-1;i>=1;--i)if(t=e.charCodeAt(i),47===t){if(!r){o=i;break}}else r=!1;return-1===o?n?"/":".":n&&1===o?"/":e.slice(0,o)},t.basename=function(e,t){var n=o(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!==typeof e&&(e+="");for(var t=-1,n=0,o=-1,r=!0,i=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===o&&(r=!1,o=s+1),46===a?-1===t?t=s:1!==i&&(i=1):-1!==t&&(i=-1);else if(!r){n=s+1;break}}return-1===t||-1===o||0===i||1===i&&t===o-1&&t===n+1?"":e.slice(t,o)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n("eef6"))},"6c70":function(e,t,n){"use strict";var o=n("61f6");e.exports=function(e,t,n,r,i){var s=new Error(e);return o(s,t,n,r,i)}},"85b5":function(e,t,n){"use strict";var o=n("3d1e");function r(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var s=[];o.forEach(t,(function(e,t){null!==e&&"undefined"!==typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,(function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},9147:function(e,t,n){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},"9e42":function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return o}));class o{constructor(e){const t={frontimg:"",backimg:"",callback:"",refreshcallback:"",yHeight:1};this.opts={...t,...e},this.offset={x:0,y:0},this.disX=0,this.moving=!1,this.init()}init(){const e=`\n <div class="code-k-div">\n <div class="code_bg"></div>\n <div class="code-con">\n <div class="code-img">\n <div class="code-img-con">\n <div class="code-mask" style="margin-top:${this.opts.yHeight}px"><img class="code-front-img" src="${this.opts.frontimg}"></div>\n <img class="code-back-img" src="${this.opts.backimg}">\n </div>\n <div class="code-push"><i class="icon-login-bg icon-w-25 icon-push">刷新</i><span class="code-tip"></span></div>\n </div>\n <div class="code-btn">\n <div class="code-btn-img code-btn-m"></div>\n <span class="code-span">按住滑块,拖动完成上方拼图</span>\n </div>\n </div>\n </div>`;this.destory();const t=document.createElement("div");t.className="slide-container",t.innerHTML=e,document.body.appendChild(t),this.maskDom=document.querySelector(".code-mask"),this.moveBtnDom=document.querySelector(".code-btn-m"),this.moveWrapDom=document.querySelector(".code-btn"),this.refreshDom=document.querySelector(".code-push"),this.tipDom=document.querySelector(".code-tip"),this.bgDom=document.querySelector(".code_bg"),this.body=document.body,this.initEvent()}initEvent(){this.refreshDom.addEventListener("click",()=>{this.opts.refreshcallback()}),this.moveBtnDom.addEventListener("mousedown",e=>{const t=e||window.event;this.offset={x:t.pageX,y:t.pageY},this.moving=!0,this.moveBtnDom.className+=" active"}),this.body.addEventListener("mousemove",e=>{if(!this.moving)return;const t=e||window.event;let n=t.pageX-this.offset.x;n<0?n=0:n>245&&(n=245),this.disX=n,this.moveBtnDom.style.left=n+10+"px",this.maskDom.style.left=n+"px"}),this.body.addEventListener("mouseup",e=>{this.moveEnd(e)}),this.bgDom.addEventListener("click",()=>{this.moving||this.destory()})}moveEnd(){this.moving&&(this.offset={x:0,y:0},this.moving=!1,this.moveBtnDom.className=this.moveBtnDom.className.replace(" active",""),this.moveBtnDom.removeEventListener("mousemove",()=>{}),this.opts.callback({xpos:parseInt(this.disX),capcode:this.opts.capcode,image_valid_type:"slide_image"}))}showTips(e){const t={true:{name:"验证通过",color:"green"},false:{name:"验证不通过",color:"red"}};this.tipDom.innerHTML=t[e].name,this.tipDom.style.color=t[e].color}destory(){document.querySelector(".slide-container")&&document.body.removeChild(document.querySelector(".slide-container"))}}},"9f97":function(e,t,n){"use strict";var o=n("3d1e");e.exports=function(e,t){t=t||{};var n={},r=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function u(r){o.isUndefined(t[r])?o.isUndefined(e[r])||(n[r]=c(void 0,e[r])):n[r]=c(e[r],t[r])}o.forEach(r,(function(e){o.isUndefined(t[e])||(n[e]=c(void 0,t[e]))})),o.forEach(i,u),o.forEach(s,(function(r){o.isUndefined(t[r])?o.isUndefined(e[r])||(n[r]=c(void 0,e[r])):n[r]=c(void 0,t[r])})),o.forEach(a,(function(o){o in t?n[o]=c(e[o],t[o]):o in e&&(n[o]=c(void 0,e[o]))}));var f=r.concat(i).concat(s).concat(a),d=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===f.indexOf(e)}));return o.forEach(d,u),n}},a620:function(e,t,n){"use strict";var o=n("9147");function r(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new o(e),t(n.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r((function(t){e=t}));return{token:t,cancel:e}},e.exports=r},a74f:function(e,t,n){"use strict";var o=n("3d1e");e.exports=o.isStandardBrowserEnv()?function(){return{write:function(e,t,n,r,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),o.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),o.isString(r)&&a.push("path="+r),o.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},ab31:function(e,t,n){"use strict";var o=n("3d1e"),r=n("50ca"),i=n("af9d"),s=n("fb04");function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){a(e),e.headers=e.headers||{},e.data=r(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]}));var t=e.adapter||s.adapter;return t(e).then((function(t){return a(e),t.data=r(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=r(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},af9d:function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},cdfd:function(e,t,n){},ce40:function(e,t,n){"use strict";var o=n("3d1e"),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(o.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=o.trim(e.substr(0,i)).toLowerCase(),n=o.trim(e.substr(i+1)),t){if(s[t]&&r.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},cf08:function(e,t,n){"use strict";var o=n("3d1e"),r=n("efe0"),i=n("0997"),s=n("9f97"),a=n("fb04");function c(e){var t=new i(e),n=r(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var u=c(a);u.Axios=i,u.create=function(e){return c(s(u.defaults,e))},u.Cancel=n("9147"),u.CancelToken=n("a620"),u.isCancel=n("af9d"),u.all=function(e){return Promise.all(e)},u.spread=n("ee08"),e.exports=u,e.exports.default=u},d547:function(e,t,n){"use strict";var o=n("da4a"),r=n("26af");e.exports=function(e,t){return e&&!o(t)?r(e,t):t}},d5f5:function(e,t,n){"use strict";var o=n("3d1e");e.exports=o.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var o=e;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=o.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return function(){return!0}}()},da4a:function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},ee08:function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},eef6:function(e,t,n){t.nextTick=function(e){var t=Array.prototype.slice.call(arguments);t.shift(),setTimeout((function(){e.apply(null,t)}),0)},t.platform=t.arch=t.execPath=t.title="browser",t.pid=1,t.browser=!0,t.env={},t.argv=[],t.binding=function(e){throw new Error("No such module. (Possibly not yet loaded)")},function(){var e,o="/";t.cwd=function(){return o},t.chdir=function(t){e||(e=n("6266")),o=e.resolve(t,o)}}(),t.exit=t.kill=t.umask=t.dlopen=t.uptime=t.memoryUsage=t.uvCounters=function(){},t.features={}},efe0:function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),o=0;o<n.length;o++)n[o]=arguments[o];return e.apply(t,n)}}},f80f:function(e,t,n){"use strict";var o=n("3d1e");function r(){this.handlers=[]}r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=r},fb04:function(e,t,n){"use strict";(function(t){var o=n("3d1e"),r=n("0cc7"),i={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function a(){var e;return("undefined"!==typeof XMLHttpRequest||"undefined"!==typeof t&&"[object process]"===Object.prototype.toString.call(t))&&(e=n("4a94")),e}var c={adapter:a(),transformRequest:[function(e,t){return r(t,"Accept"),r(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(s(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"===typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};o.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){c.headers[e]=o.merge(i)})),e.exports=c}).call(this,n("eef6"))}})}));
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "slidecode-vue3",
3
+ "version": "1.0.2",
4
+ "description": "web滑块验证码",
5
+ "main": "index.common.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
11
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "slide-vue3",
3
+ "version": "1.0.2",
4
+ "private": false,
5
+ "scripts": {
6
+ "dev": "vue-cli-service serve",
7
+ "serve": "vue-cli-service serve",
8
+ "build": "vue-cli-service build",
9
+ "test:unit": "vue-cli-service test:unit",
10
+ "lint": "vue-cli-service lint",
11
+ "lib": "vue-cli-service build --target lib --name index ./packages/index.js"
12
+ },
13
+ "dependencies": {
14
+ "axios": "^0.20.0",
15
+ "core-js": "^3.6.5",
16
+ "element-ui": "^2.13.2",
17
+ "js-cookie": "^2.2.1",
18
+ "qs": "^6.9.4",
19
+ "vue": "^3.2.25"
20
+ },
21
+ "devDependencies": {
22
+ "@vue/cli-plugin-babel": "~4.5.0",
23
+ "@vue/cli-plugin-eslint": "~4.5.0",
24
+ "@vue/cli-plugin-unit-jest": "~4.5.0",
25
+ "@vue/cli-service": "~4.5.0",
26
+ "@vue/eslint-config-airbnb": "^5.0.2",
27
+ "@vue/test-utils": "^1.0.3",
28
+ "babel-eslint": "^10.1.0",
29
+ "eslint": "^6.7.2",
30
+ "eslint-plugin-import": "^2.20.2",
31
+ "eslint-plugin-vue": "^6.2.2",
32
+ "node-sass": "^4.12.0",
33
+ "sass-loader": "^8.0.2",
34
+ "vue-template-compiler": "^2.6.11"
35
+ }
36
+ }
@@ -0,0 +1,50 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import axios from 'axios';
3
+ import { isMobile } from './slidecode/js/utils';
4
+ import './slidecode/css/slide.css';
5
+ // import SlideCode from'./slidecode/js/slidecode'
6
+
7
+ let SlideCode = require('./slidecode/js/slidecode').default
8
+ if(isMobile()){
9
+ SlideCode= require('./slidecode/js/slidecodeMobile').default;
10
+ }
11
+ const plugin = {
12
+ install: (app) => {
13
+
14
+ app.config.globalProperties.$getImg = (url,cb) => {
15
+
16
+ const service = axios.create();
17
+ service({ url, method: 'get' }).then(({ data }) => {
18
+ if (data) {
19
+ const slide = new SlideCode({
20
+ frontimg: `data:image/png;base64,${data.slidingImage}`,
21
+ backimg: `data:image/png;base64,${data.backImage}`,
22
+ yHeight: data.yHeight,
23
+ capcode: data.capcode,
24
+ refreshcallback(bool) {
25
+ switch (bool) {
26
+ case true:
27
+ slide.showTips(true);
28
+ setTimeout(() => {
29
+ slide.destory()
30
+ }, 500); break;
31
+ case false:
32
+ slide.showTips(false);
33
+ setTimeout(() => {
34
+ app.config.globalProperties.$getImg(url,cb);
35
+ }, 500);
36
+ break;
37
+ default: app.config.globalProperties.$getImg(url,cb);
38
+ }
39
+ },
40
+ callback(result) {
41
+ cb({ data: result, that: this });
42
+ },
43
+ });
44
+ }
45
+ });
46
+ };
47
+ },
48
+ };
49
+
50
+ export default plugin;
@@ -0,0 +1,106 @@
1
+ .code_bg{
2
+ position: fixed;
3
+ top:0;
4
+ left: 0;
5
+ right:0;
6
+ bottom:0;
7
+ background-color: rgba(0,0,0,.5);
8
+ z-index: 999;
9
+ }
10
+ .icon-login-bg{
11
+ background-image: url(../img/icon/loginicon.png);
12
+ background-repeat: no-repeat;
13
+ }
14
+ .code-con{
15
+ position: absolute;
16
+ top:30%;
17
+ width: 320px;
18
+ left: 50%;
19
+ margin-left: -160px;
20
+ background-color: #fff;
21
+ z-index: 1000;
22
+ -moz-user-select: none;
23
+ -webkit-user-select: none;
24
+ }
25
+ .code-img{
26
+ margin: 5px 5px;
27
+ padding: 5px 5px;
28
+ background-color: #f5f6f7;
29
+ }
30
+ .code-img img{
31
+ display: block;
32
+ }
33
+ .icon-w-25{
34
+ display: inline-block;
35
+ width: 25px;
36
+ height: 25px;
37
+ text-indent: -9999px;
38
+ }
39
+ .icon-push{
40
+ cursor: pointer;
41
+ background-position: -149px -98px;
42
+ }
43
+ .code-push{
44
+ height: 25px;
45
+ text-align: left;
46
+ }
47
+ .code-btn{
48
+ position: relative;
49
+ height: 30px;
50
+ text-align: center;
51
+ color: #999;
52
+ margin: 10px 10px;
53
+ box-sizing: border-box;
54
+ background-color: #f5f6f7;
55
+ border-radius: 15px;
56
+ border: 1px solid #e1e1e1;
57
+ }
58
+ .code-btn-m{
59
+ position: absolute;
60
+ width: 40px;
61
+ height: 40px;
62
+ border-radius: 50%;
63
+ background-color: #f5f6f7;
64
+ border: 1px solid #e1e1e1;
65
+ z-index: 5;
66
+ top:-8px;
67
+ left: 10px;
68
+ box-shadow: 0 0 3px #ccc;
69
+ cursor: pointer;
70
+ background-position: -63px 10px;
71
+ }
72
+ .code-btn-img{
73
+ background-image:url(../img/icon/arrow.png);
74
+ background-repeat: no-repeat;
75
+ }
76
+ .code-btn-img.active{
77
+ background-position: -134px 10px;
78
+ box-shadow: 0 0 8px #666;
79
+ }
80
+ .code-span{
81
+ line-height: 28px;
82
+ font-size: 14px;
83
+ display: inline-block;
84
+ vertical-align: top;
85
+ }
86
+ .code-btn-img.error{
87
+ background-position: 8px 10px;
88
+ }
89
+ .code-img-con{
90
+ position: relative;
91
+ }
92
+ .code-mask{
93
+ position: absolute;
94
+ top:0;
95
+ left: 0;
96
+ z-index: 10;
97
+ }
98
+ .code-tip{
99
+ line-height: 30px;
100
+ padding-left: 10px;
101
+ font-size: 12px;
102
+ color: #999;
103
+ vertical-align: top;
104
+ }
105
+
106
+
@@ -0,0 +1,124 @@
1
+ export default class SlideCode {
2
+ constructor(options) {
3
+ const defaults = {
4
+ frontimg: '',
5
+ backimg: '',
6
+ callback: '',
7
+ refreshcallback: '',
8
+ yHeight: 1,
9
+ };
10
+ this.opts = { ...defaults, ...options };
11
+ this.offset = { x: 0, y: 0 };
12
+ this.disX = 0;
13
+ this.moving = false;
14
+ this.init();
15
+ }
16
+
17
+ init() {
18
+ const html = `
19
+ <div class="code-k-div">
20
+ <div class="code_bg"></div>
21
+ <div class="code-con">
22
+ <div class="code-img">
23
+ <div class="code-img-con">
24
+ <div class="code-mask" style="margin-top:${this.opts.yHeight}px"><img class="code-front-img" src="${this.opts.frontimg}"></div>
25
+ <img class="code-back-img" src="${this.opts.backimg}">
26
+ </div>
27
+ <div class="code-push"><i class="icon-login-bg icon-w-25 icon-push">刷新</i><span class="code-tip"></span></div>
28
+ </div>
29
+ <div class="code-btn">
30
+ <div class="code-btn-img code-btn-m"></div>
31
+ <span class="code-span">按住滑块,拖动完成上方拼图</span>
32
+ </div>
33
+ </div>
34
+ </div>`;
35
+
36
+ this.destory()
37
+
38
+ const div = document.createElement('div');
39
+ div.className = 'slide-container';
40
+ div.innerHTML = html;
41
+ document.body.appendChild(div);
42
+
43
+ this.maskDom = document.querySelector('.code-mask');
44
+ this.moveBtnDom = document.querySelector('.code-btn-m');
45
+ this.moveWrapDom = document.querySelector('.code-btn');
46
+ this.refreshDom = document.querySelector('.code-push');
47
+ this.tipDom = document.querySelector('.code-tip');
48
+ this.bgDom = document.querySelector('.code_bg')
49
+ this.body = document.body
50
+
51
+ this.initEvent();
52
+ }
53
+
54
+ initEvent() {
55
+ this.refreshDom.addEventListener('click', () => {
56
+ this.opts.refreshcallback();
57
+ });
58
+ this.moveBtnDom.addEventListener('mousedown', (event) => {
59
+ const e = event || window.event;
60
+ this.offset = {
61
+ x: e.pageX,
62
+ y: e.pageY,
63
+ };
64
+ this.moving = true;
65
+ this.moveBtnDom.className += ' active';
66
+ });
67
+ this.body.addEventListener('mousemove', (event) => {
68
+
69
+ if (!this.moving) {
70
+ return;
71
+ }
72
+ const e = event || window.event;
73
+ let disX = e.pageX - this.offset.x;
74
+ if (disX < 0) {
75
+ disX = 0;
76
+ } else if (disX > 245) {
77
+ disX = 245;
78
+ }
79
+ this.disX = disX;
80
+ this.moveBtnDom.style.left = `${disX + 10}px`;
81
+ this.maskDom.style.left = `${disX}px`;
82
+ });
83
+ this.body.addEventListener('mouseup', (event) => {
84
+ this.moveEnd(event);
85
+ });
86
+ // this.moveWrapDom.addEventListener('mouseleave', (event) => {
87
+ // this.moveEnd(event);
88
+ // });
89
+ this.bgDom.addEventListener('click',()=>{
90
+ if (this.moving) {
91
+ return;
92
+ }
93
+ this.destory()
94
+ })
95
+ }
96
+
97
+ moveEnd() {
98
+ if (!this.moving) {
99
+ return;
100
+ }
101
+ this.offset = { x: 0, y: 0 };
102
+ this.moving = false;
103
+ this.moveBtnDom.className = this.moveBtnDom.className.replace(' active', '');
104
+ this.moveBtnDom.removeEventListener('mousemove', () => {});
105
+ this.opts.callback({
106
+ xpos: parseInt(this.disX),
107
+ capcode: this.opts.capcode,
108
+ image_valid_type: 'slide_image',
109
+ });
110
+ }
111
+ showTips(bool) {
112
+ const obj = {
113
+ true: { name: '验证通过', color: 'green' },
114
+ false: { name: '验证不通过', color: 'red' },
115
+ };
116
+ this.tipDom.innerHTML = obj[bool].name;
117
+ this.tipDom.style.color = obj[bool].color;
118
+ }
119
+ destory(){
120
+ if (document.querySelector('.slide-container')) {
121
+ document.body.removeChild(document.querySelector('.slide-container'));
122
+ }
123
+ }
124
+ }
@@ -0,0 +1,122 @@
1
+ export default class SlideCode {
2
+ constructor(options) {
3
+ const defaults = {
4
+ frontimg: '',
5
+ backimg: '',
6
+ callback: '',
7
+ refreshcallback: '',
8
+ yHeight: 1,
9
+ };
10
+ this.opts = { ...defaults, ...options };
11
+ this.offset = { x: 0, y: 0 };
12
+ this.disX = 0;
13
+ this.moving = false;
14
+ this.init();
15
+ }
16
+
17
+ init() {
18
+ const html = `
19
+ <div class="code-k-div">
20
+ <div class="code_bg"></div>
21
+ <div class="code-con">
22
+ <div class="code-img">
23
+ <div class="code-img-con">
24
+ <div class="code-mask" style="margin-top:${this.opts.yHeight}px"><img class="code-front-img" src="${this.opts.frontimg}"></div>
25
+ <img class="code-back-img" src="${this.opts.backimg}">
26
+ </div>
27
+ <div class="code-push"><i class="icon-login-bg icon-w-25 icon-push">刷新</i><span class="code-tip"></span></div>
28
+ </div>
29
+ <div class="code-btn">
30
+ <div class="code-btn-img code-btn-m"></div>
31
+ <span class="code-span">按住滑块,拖动完成上方拼图</span>
32
+ </div>
33
+ </div>
34
+ </div>`;
35
+ this.destory()
36
+ const div = document.createElement('div');
37
+ div.className = 'slide-container';
38
+ div.innerHTML = html;
39
+ document.body.appendChild(div);
40
+
41
+ this.maskDom = document.querySelector('.code-mask');
42
+ this.moveBtnDom = document.querySelector('.code-btn-m');
43
+ this.moveWrapDom = document.querySelector('.code-btn');
44
+ this.refreshDom = document.querySelector('.code-push');
45
+ this.tipDom = document.querySelector('.code-tip');
46
+ this.bgDom = document.querySelector('.code_bg')
47
+
48
+ this.initEvent();
49
+ }
50
+
51
+ initEvent() {
52
+ this.refreshDom.addEventListener('click', () => {
53
+ this.opts.refreshcallback();
54
+ });
55
+ this.moveBtnDom.addEventListener('touchstart', (event) => {
56
+ let e = event || window.event;
57
+ e= e.targetTouches[0]
58
+ this.offset = {
59
+ x: e.pageX,
60
+ y: e.pageY,
61
+ };
62
+ this.moving = true;
63
+ this.moveBtnDom.className += ' active';
64
+ });
65
+ this.moveBtnDom.addEventListener('touchmove', (event) => {
66
+ if (!this.moving) {
67
+ return;
68
+ }
69
+ let e = event || window.event;
70
+ e= e.targetTouches[0]
71
+ let disX = e.pageX - this.offset.x;
72
+ if (disX < 0) {
73
+ disX = 0;
74
+ } else if (disX > 245) {
75
+ disX = 245;
76
+ }
77
+ this.disX = disX;
78
+ this.moveBtnDom.style.left = `${disX + 10}px`;
79
+ this.maskDom.style.left = `${disX}px`;
80
+ });
81
+ this.moveBtnDom.addEventListener('touchend', (event) => {
82
+ this.moveEnd(event);
83
+ });
84
+ this.moveWrapDom.addEventListener('mouseleave', (event) => {
85
+ this.moveEnd(event);
86
+ });
87
+ this.bgDom.addEventListener('click',()=>{
88
+ if (this.moving) {
89
+ return;
90
+ }
91
+ this.destory()
92
+ })
93
+ }
94
+
95
+ moveEnd() {
96
+ if (!this.moving) {
97
+ return;
98
+ }
99
+ this.offset = { x: 0, y: 0 };
100
+ this.moving = false;
101
+ this.moveBtnDom.className = this.moveBtnDom.className.replace(' active', '');
102
+ this.moveBtnDom.removeEventListener('mousemove', () => {});
103
+ this.opts.callback({
104
+ xpos: parseInt(this.disX),
105
+ capcode: this.opts.capcode,
106
+ image_valid_type: 'slide_image',
107
+ });
108
+ }
109
+ showTips(bool) {
110
+ const obj = {
111
+ true: { name: '验证通过', color: 'green' },
112
+ false: { name: '验证不通过', color: 'red' },
113
+ };
114
+ this.tipDom.innerHTML = obj[bool].name;
115
+ this.tipDom.style.color = obj[bool].color;
116
+ }
117
+ destory(){
118
+ if (document.querySelector('.slide-container')) {
119
+ document.body.removeChild(document.querySelector('.slide-container'));
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,17 @@
1
+ const isMobile = ()=> {
2
+ var sUserAgent = navigator.userAgent.toLowerCase();
3
+ var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
4
+ var bIsIphoneOs = sUserAgent.match(/iphone os/i) == 'iphone os';
5
+ var bIsMidp = sUserAgent.match(/midp/i) == 'midp';
6
+ var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
7
+ var bIsUc = sUserAgent.match(/ucweb/i) == 'ucweb';
8
+ var bIsAndroid = sUserAgent.match(/android/i) == 'android';
9
+ var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
10
+ var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
11
+ if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
12
+ return true;
13
+ }
14
+ return false;
15
+ }
16
+
17
+ export { isMobile }
Binary file
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
8
+ <link rel="icon" href="<%= BASE_URL %>favicon.ico">
9
+ <title><%= htmlWebpackPlugin.options.title %></title>
10
+ </head>
11
+ <script src="./rsa/jsencrypt.min.js"></script>
12
+
13
+ <body>
14
+ <noscript>
15
+ <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
16
+ Please enable it to continue.</strong>
17
+ </noscript>
18
+ <div id="app"></div>
19
+ <!-- built files will be auto injected -->
20
+ </body>
21
+
22
+ </html>