tzcloud-best-ui
Version:
A super practical component library that developed by vue2.x and element-ui
1,556 lines (1,355 loc) • 41.1 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("vue");
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(3);
/***/ }),
/* 2 */
/***/ (function(module) {
module.exports = JSON.parse("{\"name\":\"tzcloud-best-ui\",\"version\":\"0.6.2\",\"description\":\"A super practical component library that developed by vue2.x and element-ui\",\"main\":\"lib/best-ui.common.js\",\"scripts\":{\"test\":\"npm run test\",\"build:lib\":\"webpack --config build/webpack.common.js && webpack --config build/webpack.component.js\",\"build:theme\":\"webpack --config build/webpack.theme.js && rimraf lib/theme.js\",\"dist\":\"rimraf lib && npm run build:lib && npm run build:theme\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/EcanTech/tzcloud-best-ui.git\"},\"keywords\":[\"vue\",\"element-ui\",\"tzcloud\",\"component\",\"library\"],\"author\":\"EcanTech\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/EcanTech/tzcloud-best-ui/issues\"},\"homepage\":\"https://github.com/EcanTech/tzcloud-best-ui#readme\",\"devDependencies\":{\"@babel/core\":\"^7.0.0\",\"@babel/plugin-transform-runtime\":\"^7.12.10\",\"@babel/preset-env\":\"^7.12.11\",\"babel-loader\":\"^8.2.2\",\"copy-webpack-plugin\":\"^5.1.2\",\"css-loader\":\"^5.0.1\",\"mini-css-extract-plugin\":\"^1.3.3\",\"optimize-css-assets-webpack-plugin\":\"^4.0.3\",\"postcss\":\"^8.2.4\",\"postcss-import\":\"^14.0.0\",\"postcss-loader\":\"^4.1.0\",\"postcss-preset-env\":\"^6.7.0\",\"progress-bar-webpack-plugin\":\"^2.1.0\",\"rimraf\":\"^3.0.2\",\"vue-loader\":\"^15.9.6\",\"vue-style-loader\":\"^4.1.2\",\"vue-template-compiler\":\"^2.6.12\",\"webpack\":\"^4.45.0\",\"webpack-cli\":\"^3.3.12\",\"webpack-merge\":\"^5.7.3\",\"webpack-node-externals\":\"^2.5.2\"},\"dependencies\":{},\"peerDependencies\":{\"element-ui\":\"^2.14.1\",\"vue\":\"^2.6.12\"},\"browserslist\":[\"> 1%\",\"last 2 versions\",\"not ie <= 8\"],\"files\":[\"lib\",\"packages\",\"src\"]}");
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(0);
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/dialog/src/dialog.vue?vue&type=template&id=458af334&
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"el-dialog",
{
staticClass: "best-dialog",
attrs: {
visible: _vm.visible,
title: _vm.title,
width: _vm.width,
fullscreen: _vm.fullscreen,
top: _vm.top,
modal: _vm.modal,
"modal-append-to-body": _vm.modalAppendToBody,
"append-to-body": _vm.appendToBody,
"lock-scroll": _vm.lockScroll,
"custom-class": _vm.customClass,
"close-on-click-modal": _vm.closeOnClickModal,
"close-on-press-escape": _vm.closeOnPressEscape,
"show-close": _vm.showClose,
"before-close": _vm.beforeClose,
center: _vm.center,
"destroy-on-close": _vm.destroyOnClose
},
on: {
"update:visible": function($event) {
_vm.visible = $event
},
closed: _vm.handleClosed
}
},
[
_c(
_vm.mainComponent,
_vm._b(
{ ref: "main", tag: "component" },
"component",
_vm.mainProps,
false
)
),
_vm.showFooter
? _c(
"div",
{
staticClass: "best-dialog__footer",
attrs: { slot: "footer" },
slot: "footer"
},
[
_vm.showCancelButton
? _c("el-button", { on: { click: _vm.handleCancel } }, [
_vm._v(_vm._s(_vm.cancelButtonText))
])
: _vm._e(),
_vm.showConfirmButton
? _c(
"el-button",
{
attrs: { type: "primary" },
on: {
click: function($event) {
return _vm.handleConfirm("main")
}
}
},
[_vm._v(_vm._s(_vm.confirmButtonText))]
)
: _vm._e()
],
1
)
: _vm._e()
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/dialog/src/dialog.vue?vue&type=template&id=458af334&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/dialog/src/dialog.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
const DIALOG_DEFAULT_OPTIONS = {
// ElDialog default options
visible: false,
title: '',
width: '50%',
fullscreen: false,
top: '15vh',
modal: true,
modalAppendToBody: true,
appendToBody: false,
lockScroll: true,
customClass: '',
closeOnClickModal: false,
closeOnPressEscape: true,
showClose: true,
beforeClose: null,
center: false,
destroyOnClose: false,
// custom params
mainComponent: null,
mainProps: {},
showFooter: true,
showCancelButton: true,
showConfirmButton: true,
cancelButtonText: '取 消',
confirmButtonText: '确 定',
onClosed: () => {}
};
/* harmony default export */ var dialogvue_type_script_lang_js_ = ({
name: 'BestDialog',
provide() {
return {
bestDialog: this
};
},
data() {
return { ...DIALOG_DEFAULT_OPTIONS
};
},
methods: {
// closed callback
handleClosed() {
this.onClosed && this.onClosed();
},
// confirm
handleConfirm(name) {
const main = this.$refs.main;
if (typeof main.submitForm === 'function') {
main.submitForm(() => this.visible = false, {
start: options => this.showLoading(options),
finish: () => this.closeLoading()
});
} else {
this.visible = false;
} // instance.then
this.onConfirm && this.onConfirm();
},
// cancel
handleCancel() {
this.visible = false;
this.onCancel && this.onCancel();
},
showLoading(options = {}) {
this.submitLoading = this.$loading({
target: this.$el.querySelector('.el-dialog'),
text: options.text || '正在提交...'
});
},
closeLoading() {
this.submitLoading.close();
},
// reset
resetData() {
Object.assign(this.$data, DIALOG_DEFAULT_OPTIONS);
}
}
});
// CONCATENATED MODULE: ./packages/dialog/src/dialog.vue?vue&type=script&lang=js&
/* harmony default export */ var src_dialogvue_type_script_lang_js_ = (dialogvue_type_script_lang_js_);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
// CONCATENATED MODULE: ./packages/dialog/src/dialog.vue
/* normalize component */
var dialog_component = normalizeComponent(
src_dialogvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
dialog_component.options.__file = "packages/dialog/src/dialog.vue"
/* harmony default export */ var dialog = (dialog_component.exports);
// CONCATENATED MODULE: ./packages/dialog/src/dialog.js
const DialogConstructor = external_vue_default.a.extend(dialog);
DialogConstructor.prototype.then = function (callback) {
this.onConfirm = callback;
return this;
};
DialogConstructor.prototype.catch = function (callback) {
this.onCancel = callback;
return this;
};
let dialogQueue = []; // dialog queue
let id = 1; // dialog component id
const initData = function (component, options) {
options = options || {};
if (typeof options === 'string') {
options = {
title: options
};
}
options.mainComponent = component;
options.mainProps = options.props || {};
delete options.props; // unbind options props
const userClosed = options.onClosed;
options.onClosed = function () {
Dialog._recover(this.traceId);
userClosed && userClosed();
};
return options;
}; // Open current instance or create one
const Dialog = function (component, options) {
if (dialogQueue.length === 0) {
return Dialog.create(component, options);
} else {
let instance = dialogQueue[0];
Object.assign(instance.$data, initData(component, options));
setTimeout(() => {
instance.visible = true;
});
return instance;
}
}; // Create a new instance
Dialog.create = function (component, options) {
let instance = new DialogConstructor({
el: document.createElement('div'),
data: initData(component, options)
});
instance.traceId = id++; // set instance id
instance.$mount();
document.body.appendChild(instance.$el);
external_vue_default.a.nextTick(() => {
instance.visible = true;
}); // Add a dialog instance in pool
dialogQueue.push(instance);
return instance;
};
Dialog._recover = function (targetId) {
if (dialogQueue.length === 0) return;
if (dialogQueue.length === 1) {
// reset data
dialogQueue[0].resetData();
} else {
const index = dialogQueue.findIndex(instance => instance.traceId === targetId);
const instance = dialogQueue[index]; // remove instance
dialogQueue.splice(index, 1); // remove dom
instance.$el.parentNode.removeChild(instance.$el);
}
};
Dialog.close = function () {
if (dialogQueue.length === 0) return;
const instance = dialogQueue[dialogQueue.length - 1];
instance.visible = false;
};
Dialog.closeAll = function () {
let i = dialogQueue.length;
while (i--) {
const instance = dialogQueue[i - 1];
instance.visible = false;
}
};
/* harmony default export */ var src_dialog = (Dialog);
// CONCATENATED MODULE: ./packages/dialog/index.js
/* harmony default export */ var packages_dialog = (src_dialog);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/drawer/src/drawer.vue?vue&type=template&id=6aa8a2c6&
var drawervue_type_template_id_6aa8a2c6_render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"el-drawer",
{
directives: [
{
name: "clickoutside",
rawName: "v-clickoutside",
value: _vm.handleClose,
expression: "handleClose"
}
],
staticClass: "best-drawer",
style: _vm.position,
attrs: {
"append-to-body": _vm.appendToBody,
"before-close": _vm.beforeClose,
"close-on-press-escape": _vm.closeOnPressEscape,
"custom-class": _vm.customClass,
"destroy-on-close": _vm.destroyOnClose,
modal: _vm.modal,
"modal-append-to-body": _vm.modalAppendToBody,
direction: _vm.direction,
"show-close": _vm.showClose,
size: _vm.size,
title: _vm.title,
visible: _vm.visible,
wrapperClosable: _vm.wrapperClosable,
withHeader: _vm.withHeader
},
on: {
"update:visible": function($event) {
_vm.visible = $event
},
closed: _vm.handleClosed
}
},
[
_c(
_vm.mainComponent,
_vm._b(
{ ref: "main", tag: "component" },
"component",
_vm.mainProps,
false
)
)
],
1
)
}
var drawervue_type_template_id_6aa8a2c6_staticRenderFns = []
drawervue_type_template_id_6aa8a2c6_render._withStripped = true
// CONCATENATED MODULE: ./packages/drawer/src/drawer.vue?vue&type=template&id=6aa8a2c6&
// CONCATENATED MODULE: ./src/utils/clickoutside.js
const nodeList = [];
const ctx = '@@clickoutsideContext';
let mdEvent,
seed = 0;
document.addEventListener('mousedown', e => mdEvent = e);
document.addEventListener('mouseup', e => {
nodeList.forEach(node => node[ctx].clickHandler(e, mdEvent));
});
function insideMe(el, mouseup) {
const rect = el.getBoundingClientRect();
if (mouseup.pageX < rect.left || mouseup.pageX > rect.right || mouseup.pageY < rect.top || mouseup.pageY > rect.bottom) return false;else return true;
}
function wrapFn(el, binding, vnode) {
return function (mouseup = {}, mousedown = {}) {
if (!vnode || !vnode.context || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || vnode.context.popperElm && (vnode.context.popperElm.contains(mouseup.target) || vnode.context.popperElm.contains(mousedown.target)) || insideMe(el, mouseup)) return;
const methodName = binding.expression;
if (methodName && vnode.context[methodName]) {
vnode.context[methodName]();
}
};
}
/* harmony default export */ var clickoutside = ({
bind(el, binding, vnode) {
el[ctx] = {
id: seed++,
clickHandler: wrapFn(el, binding, vnode)
};
nodeList.push(el);
},
update(el, binding, vnode) {
el[ctx].clickHandler = wrapFn(el, binding, vnode);
},
unbind(el) {
for (let i = 0, len = nodeList.length; i < len; i++) {
const node = nodeList[i];
if (node[ctx].id === el[ctx].id) {
nodeList.splice(i, 1);
delete el[ctx];
break;
}
}
}
});
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/drawer/src/drawer.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
const DRAWER_DEFAULT_OPTIONS = {
// ElDrawer options
appendToBody: false,
beforeClose: null,
closeOnPressEscape: true,
customClass: '',
destroyOnClose: false,
modal: false,
modalAppendToBody: true,
direction: 'rtl',
showClose: true,
size: '100%',
title: '',
visible: false,
wrapperClosable: true,
withHeader: true,
// custom params
mainComponent: null,
mainProps: {},
position: {},
onClosed: () => {}
};
/* harmony default export */ var drawervue_type_script_lang_js_ = ({
name: 'BestDrawer',
data() {
return { ...DRAWER_DEFAULT_OPTIONS
};
},
methods: {
handleClose() {
this.visible = false;
},
handleClosed() {
this.onClosed && this.onClosed();
Object.assign(this.$data, DRAWER_DEFAULT_OPTIONS);
}
},
directives: {
clickoutside: clickoutside
}
});
// CONCATENATED MODULE: ./packages/drawer/src/drawer.vue?vue&type=script&lang=js&
/* harmony default export */ var src_drawervue_type_script_lang_js_ = (drawervue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/drawer/src/drawer.vue
/* normalize component */
var drawer_component = normalizeComponent(
src_drawervue_type_script_lang_js_,
drawervue_type_template_id_6aa8a2c6_render,
drawervue_type_template_id_6aa8a2c6_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var drawer_api; }
drawer_component.options.__file = "packages/drawer/src/drawer.vue"
/* harmony default export */ var drawer = (drawer_component.exports);
// CONCATENATED MODULE: ./packages/drawer/src/drawer.js
const DrawerConstructor = external_vue_default.a.extend(drawer);
let drawer_instance = null;
const drawer_initData = function (component, defaults, options = {}) {
options = Object.assign({}, defaults, options);
options.mainComponent = component;
options.mainProps = options.props || {};
delete options.props; // unbind options props
return options;
}; // Open current instance or create one
const Drawer = function (component, options) {
if (drawer_instance) {
Object.assign(drawer_instance.$data, drawer_initData(component, Drawer.defaults, options));
setTimeout(() => {
drawer_instance.visible = true;
});
} else {
drawer_instance = new DrawerConstructor({
el: document.createElement('div'),
data: drawer_initData(component, Drawer.defaults, options)
});
drawer_instance.$mount();
document.body.appendChild(drawer_instance.$el);
external_vue_default.a.nextTick(() => {
drawer_instance.visible = true;
});
}
return drawer_instance;
};
Drawer.defaults = {};
Drawer.close = function () {
if (drawer_instance) {
drawer_instance.visible = false;
}
};
Drawer.setDefaults = function (defaults) {
Drawer.defaults = Object.assign(Drawer.defaults, defaults);
};
/* harmony default export */ var src_drawer = (Drawer);
// CONCATENATED MODULE: ./packages/drawer/index.js
/* harmony default export */ var packages_drawer = (src_drawer);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/puzzler/src/puzzler.vue?vue&type=template&id=107c64cc&
var puzzlervue_type_template_id_107c64cc_render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("div", { staticClass: "best-puzzler" }, [
_c(
"div",
{ staticClass: "best-puzzler__inner" },
[
_c("img", {
staticClass: "best-puzzler__img1",
attrs: { src: _vm.imgs[0] },
on: { load: _vm.load$1 }
}),
_c("img", {
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.visible$2,
expression: "visible$2"
}
],
staticClass: "best-puzzler__img2",
style: _vm.style$2,
attrs: { src: _vm.imgs[1] },
on: { load: _vm.load$2 }
}),
_c("transition", { attrs: { name: "fade" } }, [
_c(
"div",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.loading,
expression: "loading"
}
],
staticClass: "best-puzzler__tips"
},
[
_c("div", { staticClass: "best-puzzler__tips-wrap" }, [
_c("span", { staticClass: "best-puzzler__tips-icon" }, [
_c("i", { class: _vm.tipsIcon })
]),
_c("p", { staticClass: "best-puzzler__tips-text" }, [
_vm._v(_vm._s(_vm.tipsText))
])
])
]
)
])
],
1
),
_c(
"div",
{ staticClass: "best-puzzler__slider", class: ["is-" + _vm.status] },
[
_c("div", { staticClass: "best-puzzler__slider-text" }, [
_vm._v("按住左边按钮拖动完成上方拼图")
]),
_c("el-slider", {
staticClass: "best-puzzler__slider-origin",
attrs: { max: _vm.distance, "show-tooltip": false },
on: { change: _vm.handleChange },
model: {
value: _vm.translate,
callback: function($$v) {
_vm.translate = $$v
},
expression: "translate"
}
})
],
1
)
])
}
var puzzlervue_type_template_id_107c64cc_staticRenderFns = []
puzzlervue_type_template_id_107c64cc_render._withStripped = true
// CONCATENATED MODULE: ./packages/puzzler/src/puzzler.vue?vue&type=template&id=107c64cc&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/puzzler/src/puzzler.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
const FEEDBACK_TIMEOUT = 500;
/* harmony default export */ var puzzlervue_type_script_lang_js_ = ({
name: "BestPuzzler",
props: {
imgs: Array,
position: [Number, String],
onChange: Function,
onSuccess: Function,
onFail: Function
},
data() {
return {
status: '',
tipsIcon: 'el-icon-loading',
tipsText: '加载中',
loading: false,
ratio: 0,
translate: 0,
width: 0,
naturalWidth$2: 0
};
},
computed: {
position$2() {
return Math.round(this.position * this.ratio);
},
width$2() {
return Math.round(this.naturalWidth$2 * this.ratio);
},
visible$2() {
return this.width$2 && this.position$2;
},
distance() {
return this.width - this.width$2 || 100;
},
style$2() {
return {
width: this.width$2 + 'px',
top: this.position$2 + 'px',
left: this.translate + 'px'
};
}
},
methods: {
load$1(e) {
const img = e.target || {};
const clientWidth = img.clientWidth;
this.width = clientWidth;
this.ratio = clientWidth / img.naturalWidth;
},
load$2(e) {
const img = e.target;
this.naturalWidth$2 = img.naturalWidth;
},
computePos() {
return [Math.round(this.translate / this.ratio), this.position$2].join(',');
},
sleep(wait) {
return new Promise((resolve, reject) => {
let timer = setTimeout(() => {
resolve();
clearTimeout(timer);
}, wait);
});
},
feedback(type, args = []) {
if (type === 'success') {
this.tipsIcon = 'el-icon-success';
this.tipsText = '验证通过';
this.sleep(FEEDBACK_TIMEOUT).then(() => {
if (typeof this.onSuccess === 'function') this.onSuccess.apply(this, args);
this.resetData();
});
} else {
this.tipsIcon = 'el-icon-error';
this.tipsText = '验证失败,请根据提示重新操作';
this.sleep(FEEDBACK_TIMEOUT).then(() => {
if (typeof this.onFail === 'function') this.onFail();
this.resetData();
});
}
this.status = type;
},
handleChange() {
this.loading = true;
if (typeof this.onChange === 'function') {
const answer = this.computePos();
this.onChange(answer).then((...args) => {
this.feedback('success', args);
}).catch(() => {
this.feedback('fail');
});
}
},
resetData() {
Object.assign(this.$data, this.$options.data.call(this));
}
}
});
// CONCATENATED MODULE: ./packages/puzzler/src/puzzler.vue?vue&type=script&lang=js&
/* harmony default export */ var src_puzzlervue_type_script_lang_js_ = (puzzlervue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/puzzler/src/puzzler.vue
/* normalize component */
var puzzler_component = normalizeComponent(
src_puzzlervue_type_script_lang_js_,
puzzlervue_type_template_id_107c64cc_render,
puzzlervue_type_template_id_107c64cc_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var puzzler_api; }
puzzler_component.options.__file = "packages/puzzler/src/puzzler.vue"
/* harmony default export */ var puzzler = (puzzler_component.exports);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/puzzler/src/main.vue?vue&type=template&id=79510183&
var mainvue_type_template_id_79510183_render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"el-dialog",
{
staticClass: "best-dialog-puzzler",
attrs: { visible: _vm.visible, width: _vm.width },
on: {
"update:visible": function($event) {
_vm.visible = $event
},
closed: _vm.handleClosed
}
},
[
_c("div", { staticClass: "best-dialog-puzzler__title" }, [
_vm._v("请完成安全验证")
]),
_c("best-puzzler", {
attrs: {
imgs: _vm.imgs,
position: _vm.position,
"on-change": _vm.handleChange,
"on-success": _vm.handleSuccess,
"on-fail": _vm.handleFail
}
})
],
1
)
}
var mainvue_type_template_id_79510183_staticRenderFns = []
mainvue_type_template_id_79510183_render._withStripped = true
// CONCATENATED MODULE: ./packages/puzzler/src/main.vue?vue&type=template&id=79510183&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/puzzler/src/main.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
components: {
BestPuzzler: puzzler
},
data() {
return {
position: '0',
width: '25%',
visible: false,
imgs: [],
onChange: null,
onSuccess: null,
onFail: null
};
},
methods: {
handleChange(...args) {
if (typeof this.onChange === 'function') {
return this.onChange.apply(this, args);
}
},
handleSuccess(...args) {
this.visible = false;
if (typeof this.onSuccess === 'function') {
return this.onSuccess.apply(this, args);
}
},
handleFail(...args) {
if (typeof this.onFail === 'function') {
return this.onFail.apply(this, args);
}
},
handleClosed() {
if (typeof this.onClosed === 'function') {
return this.onClosed.call(this);
}
}
}
});
// CONCATENATED MODULE: ./packages/puzzler/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/puzzler/src/main.vue
/* normalize component */
var main_component = normalizeComponent(
src_mainvue_type_script_lang_js_,
mainvue_type_template_id_79510183_render,
mainvue_type_template_id_79510183_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var main_api; }
main_component.options.__file = "packages/puzzler/src/main.vue"
/* harmony default export */ var main = (main_component.exports);
// CONCATENATED MODULE: ./packages/puzzler/src/main.js
const MainConstructor = external_vue_default.a.extend(main);
let main_instance = null;
const PuzzlerMethod = function (options = {}) {
// prevent fast-click
if (main_instance && main_instance.visible) return;
options = Object.assign({}, options);
const userClose = options.onClosed;
options.onClosed = () => {
userClose && userClose();
main_instance.$el.parentNode.removeChild(main_instance.$el);
main_instance = null;
};
main_instance = new MainConstructor({
el: document.createElement('div'),
data: options
});
main_instance.$mount();
document.body.appendChild(main_instance.$el);
external_vue_default.a.nextTick(() => {
main_instance.visible = true;
});
return main_instance;
};
/* harmony default export */ var src_main = (PuzzlerMethod);
// CONCATENATED MODULE: ./packages/puzzler/index.js
puzzler.install = function (Vue) {
Vue.component(puzzler.name, puzzler);
};
puzzler.service = src_main;
/* harmony default export */ var packages_puzzler = (puzzler);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/uploader/src/uploader.vue?vue&type=template&id=3aba74b4&
var uploadervue_type_template_id_3aba74b4_render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "best-uploader" },
[
_c(
"el-upload",
{
staticClass: "best-uploader__origin",
attrs: {
action: _vm.action,
accept: _vm.accept,
"auto-upload": _vm.autoUpload,
disabled: _vm.isDisabled,
"show-file-list": false,
"before-upload": _vm.handleBefore,
"on-change": _vm.handleChange,
"on-success": _vm.handleSuccess
}
},
[
_c(
"div",
{ style: { visibility: _vm.imageUrl ? "hidden" : "visible" } },
[
_vm.$slots.default
? _vm._t("default")
: _c(
"div",
{
staticClass: "best-uploader__inner",
style: _vm.innerStyle
},
[
_c("span", { staticClass: "best-uploader__icon" }, [
_c("i", { class: _vm.icon })
]),
_c("span", { staticClass: "best-uploader__text" }, [
_vm._v(_vm._s(_vm.text))
])
]
)
],
2
),
_vm.imageUrl
? _c("div", { staticClass: "best-uploader__modal" }, [
_c("img", { attrs: { src: _vm.imageUrl } }),
_c(
"div",
{
directives: [
{
name: "show",
rawName: "v-show",
value: !_vm.isDisabled,
expression: "!isDisabled"
}
],
staticClass: "best-uploader__mask"
},
[
_c(
"span",
{
staticClass: "best-uploader__action-remove",
on: {
click: function($event) {
$event.stopPropagation()
return _vm.handleRemove($event)
}
}
},
[_c("i", { staticClass: "el-icon-delete" })]
)
]
)
])
: _vm._e()
]
)
],
1
)
}
var uploadervue_type_template_id_3aba74b4_staticRenderFns = []
uploadervue_type_template_id_3aba74b4_render._withStripped = true
// CONCATENATED MODULE: ./packages/uploader/src/uploader.vue?vue&type=template&id=3aba74b4&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/uploader/src/uploader.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var uploadervue_type_script_lang_js_ = ({
name: "BestUploader",
inject: {
elForm: {
default: null
}
},
props: {
accept: String,
disabled: Boolean,
width: String,
height: String,
text: String,
url: String,
value: String,
beforeUpload: Function,
onSuccess: Function,
action: {
type: String,
default: '/merchantManage/files/upload'
},
icon: {
type: String,
default: 'el-icon-plus'
},
type: {
type: String,
default: 'image'
}
},
data() {
const imageUrl = this.type === 'base64' ? this.value : this.url;
return {
imageUrl: imageUrl
};
},
computed: {
autoUpload() {
return this.type === 'image';
},
isDisabled() {
return this.disabled || (this.elForm || {}).disabled;
},
innerStyle() {
return {
width: this.width,
height: this.height
};
}
},
watch: {
url(val) {
this.imageUrl = val;
}
},
methods: {
/**
* 图片上传限制
*/
handleBefore(file) {
if (typeof this.beforeUpload === 'function') {
return this.beforeUpload(file);
} else {
const isIMG = /(gif|jpe?g|png)/.test(file.type);
const isLt5M = file.size / 1024 / 1024 < 5;
if (!isIMG) {
this.$message.warning('图片仅支持 GIF、JPG、JPEG、PNG 格式');
}
if (!isLt5M) {
this.$message.warning('图片大小不超过5MB');
}
return isIMG && isLt5M;
}
},
/**
* 选择图片
*/
handleChange(file, fileList) {
if (this.type === 'base64') {
this.readAsBase64(file.raw);
}
},
/**
* 图片转 base64 格式
*/
readAsBase64(file) {
const reader = new FileReader();
reader.onload = () => {
this.imageUrl = reader.result;
this.$emit('input', reader.result);
};
reader.readAsDataURL(file);
},
/**
* 上传成功
*/
handleSuccess(res, file, fileList) {
if (typeof this.onSuccess === 'function') {
this.onSuccess(res, file, fileList);
} else {
if (res.pubResponse.code === '0000') {
const data = res.body;
this.imageUrl = data.accessUrl;
this.$emit('input', data.fid || this.value);
}
}
},
/**
* 移除图片
*/
handleRemove() {
if (this.isDisabled) return;
this.imageUrl = '';
this.$emit('input', this.imageUrl);
}
}
});
// CONCATENATED MODULE: ./packages/uploader/src/uploader.vue?vue&type=script&lang=js&
/* harmony default export */ var src_uploadervue_type_script_lang_js_ = (uploadervue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/uploader/src/uploader.vue
/* normalize component */
var uploader_component = normalizeComponent(
src_uploadervue_type_script_lang_js_,
uploadervue_type_template_id_3aba74b4_render,
uploadervue_type_template_id_3aba74b4_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var uploader_api; }
uploader_component.options.__file = "packages/uploader/src/uploader.vue"
/* harmony default export */ var uploader = (uploader_component.exports);
// CONCATENATED MODULE: ./packages/uploader/index.js
uploader.install = function (Vue) {
Vue.component(uploader.name, uploader);
};
/* harmony default export */ var packages_uploader = (uploader);
// CONCATENATED MODULE: ./src/index.js
/**
* TzcloudBestUI (c) Ecan Chen
*/
const BESTUI_VERSION = __webpack_require__(2).version;
const components = [packages_puzzler, packages_uploader];
const install = function (Vue) {
components.forEach(component => {
Vue.component(component.name, component);
});
Vue.prototype.$dialog = packages_dialog;
};
/* harmony default export */ var src = __webpack_exports__["default"] = ({
version: BESTUI_VERSION,
install,
Dialog: packages_dialog,
Drawer: packages_drawer,
Puzzler: packages_puzzler,
Uploader: packages_uploader
});
/***/ })
/******/ ])["default"];