文件上传
This commit is contained in:
1 parent
d418e9b853
commit
ae997fe850
6 files changed
+1584
No files matched your search
+710
@@ -0,0 +1,710 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("viewerjs"), require("vue"));
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["viewerjs", "vue"], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["VueViewer"] = factory(require("viewerjs"), require("vue"));
|
||||
else
|
||||
root["VueViewer"] = factory(root["Viewer"], root["Vue"]);
|
||||
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__) {
|
||||
return /******/ (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;
|
||||
/******/
|
||||
/******/ // identity function for calling harmony imports with the correct context
|
||||
/******/ __webpack_require__.i = function(value) { return value; };
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // 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 = 6);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony export (immutable) */ __webpack_exports__["a"] = extend;
|
||||
|
||||
function extend() {
|
||||
var extended = {};
|
||||
var deep = false;
|
||||
var i = 0;
|
||||
var length = arguments.length;
|
||||
|
||||
if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {
|
||||
deep = arguments[0];
|
||||
i++;
|
||||
}
|
||||
|
||||
function merge(obj) {
|
||||
for (var prop in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
||||
if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {
|
||||
extended[prop] = extend(true, extended[prop], obj[prop]);
|
||||
} else {
|
||||
extended[prop] = obj[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (; i < length; i++) {
|
||||
var obj = arguments[i];
|
||||
merge(obj);
|
||||
}
|
||||
|
||||
return extended;
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_viewerjs__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_viewerjs___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_viewerjs__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_vue__ = __webpack_require__(2);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_vue__);
|
||||
|
||||
|
||||
|
||||
|
||||
var api = function api() {
|
||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref$images = _ref.images,
|
||||
images = _ref$images === undefined ? [] : _ref$images,
|
||||
_ref$options = _ref.options,
|
||||
options = _ref$options === undefined ? {} : _ref$options;
|
||||
|
||||
options = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__utils__["a" /* extend */])(options, {
|
||||
inline: false });
|
||||
|
||||
var ViewerToken = __WEBPACK_IMPORTED_MODULE_2_vue___default.a.extend({
|
||||
render: function render(h) {
|
||||
return h('div', {
|
||||
style: {
|
||||
display: 'none'
|
||||
},
|
||||
class: ['__viewer-token']
|
||||
}, images.map(function (attr) {
|
||||
return h('img', {
|
||||
attrs: typeof attr === 'string' ? { src: attr } : attr
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
var token = new ViewerToken();
|
||||
token.$mount();
|
||||
document.body.appendChild(token.$el);
|
||||
|
||||
var $viewer = new __WEBPACK_IMPORTED_MODULE_0_viewerjs___default.a(token.$el, options);
|
||||
var $destroy = $viewer.destroy.bind($viewer);
|
||||
$viewer.destroy = function () {
|
||||
$destroy();
|
||||
token.$destroy();
|
||||
document.body.removeChild(token.$el);
|
||||
return $viewer;
|
||||
};
|
||||
$viewer.show();
|
||||
|
||||
token.$el.addEventListener('hidden', function () {
|
||||
if (this.viewer === $viewer) {
|
||||
$viewer.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
return $viewer;
|
||||
};
|
||||
|
||||
/* harmony default export */ __webpack_exports__["a"] = (api);
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_viewerjs__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_viewerjs___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_viewerjs__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_throttle_debounce__ = __webpack_require__(7);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_throttle_debounce___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_throttle_debounce__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_vue__ = __webpack_require__(2);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_vue__);
|
||||
|
||||
|
||||
|
||||
|
||||
var directive = function directive() {
|
||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref$name = _ref.name,
|
||||
name = _ref$name === undefined ? 'viewer' : _ref$name,
|
||||
_ref$debug = _ref.debug,
|
||||
debug = _ref$debug === undefined ? false : _ref$debug;
|
||||
|
||||
function createViewer(el, options) {
|
||||
var rebuild = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var observer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_2_vue___default.a.nextTick(function () {
|
||||
if (observer && !imageDiff(el)) return;
|
||||
if (rebuild || !el['$' + name]) {
|
||||
destroyViewer(el);
|
||||
el['$' + name] = new __WEBPACK_IMPORTED_MODULE_0_viewerjs___default.a(el, options);
|
||||
log('Viewer created');
|
||||
} else {
|
||||
el['$' + name].update();
|
||||
log('Viewer updated');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function imageDiff(el) {
|
||||
var imageContent = el.innerHTML.match(/<img([\w\W]+?)[\\/]?>/g);
|
||||
var viewerImageText = imageContent ? imageContent.join('') : undefined;
|
||||
if (el.__viewerImageDiffCache === viewerImageText) {
|
||||
log('Element change detected, but image(s) has not changed');
|
||||
return false;
|
||||
} else {
|
||||
log('Image change detected');
|
||||
el.__viewerImageDiffCache = viewerImageText;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function createObserver(el, options, debouncedCreateViewer, rebuild) {
|
||||
destroyObserver(el);
|
||||
var MutationObserver = global.MutationObserver || global.WebKitMutationObserver || global.MozMutationObserver;
|
||||
if (!MutationObserver) {
|
||||
log('Observer not supported');
|
||||
return;
|
||||
}
|
||||
var observer = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
log('Viewer mutation:' + mutation.type);
|
||||
debouncedCreateViewer(el, options, rebuild, true);
|
||||
});
|
||||
});
|
||||
var config = { attributes: true, childList: true, characterData: true, subtree: true };
|
||||
observer.observe(el, config);
|
||||
el.__viewerMutationObserver = observer;
|
||||
log('Observer created');
|
||||
}
|
||||
|
||||
function createWatcher(el, _ref2, vnode, debouncedCreateViewer) {
|
||||
var expression = _ref2.expression;
|
||||
|
||||
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
||||
if (!expression || !simplePathRE.test(expression)) {
|
||||
log('Only simple dot-delimited paths can create watcher');
|
||||
return;
|
||||
}
|
||||
el.__viewerUnwatch = vnode.context.$watch(expression, function (newVal, oldVal) {
|
||||
log('Change detected by watcher: ', expression);
|
||||
debouncedCreateViewer(el, newVal, true);
|
||||
}, {
|
||||
deep: true
|
||||
});
|
||||
log('Watcher created, expression: ', expression);
|
||||
}
|
||||
|
||||
function destroyViewer(el) {
|
||||
if (!el['$' + name]) {
|
||||
return;
|
||||
}
|
||||
el['$' + name].destroy();
|
||||
delete el['$' + name];
|
||||
log('Viewer destroyed');
|
||||
}
|
||||
|
||||
function destroyObserver(el) {
|
||||
if (!el.__viewerMutationObserver) {
|
||||
return;
|
||||
}
|
||||
el.__viewerMutationObserver.disconnect();
|
||||
delete el.__viewerMutationObserver;
|
||||
log('Observer destroyed');
|
||||
}
|
||||
|
||||
function destroyWatcher(el) {
|
||||
if (!el.__viewerUnwatch) {
|
||||
return;
|
||||
}
|
||||
el.__viewerUnwatch();
|
||||
delete el.__viewerUnwatch;
|
||||
log('Watcher destroyed');
|
||||
}
|
||||
|
||||
function log() {
|
||||
var _console;
|
||||
|
||||
debug && (_console = console).log.apply(_console, arguments);
|
||||
}
|
||||
|
||||
var directive = {
|
||||
bind: function bind(el, binding, vnode) {
|
||||
log('Viewer bind');
|
||||
var debouncedCreateViewer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_throttle_debounce__["debounce"])(50, createViewer);
|
||||
debouncedCreateViewer(el, binding.value);
|
||||
|
||||
createWatcher(el, binding, vnode, debouncedCreateViewer);
|
||||
|
||||
if (!binding.modifiers.static) {
|
||||
createObserver(el, binding.value, debouncedCreateViewer, binding.modifiers.rebuild);
|
||||
}
|
||||
},
|
||||
unbind: function unbind(el, binding) {
|
||||
log('Viewer unbind');
|
||||
|
||||
destroyObserver(el);
|
||||
|
||||
destroyWatcher(el);
|
||||
|
||||
destroyViewer(el);
|
||||
}
|
||||
};
|
||||
|
||||
return directive;
|
||||
};
|
||||
|
||||
/* harmony default export */ __webpack_exports__["a"] = (directive);
|
||||
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var Component = __webpack_require__(10)(
|
||||
/* script */
|
||||
__webpack_require__(8),
|
||||
/* template */
|
||||
__webpack_require__(11),
|
||||
/* scopeId */
|
||||
null,
|
||||
/* cssModules */
|
||||
null
|
||||
)
|
||||
Component.options.__file = "/Volumes/public/Workspace/web/v-viewer/src/component.vue"
|
||||
if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key !== "__esModule"})) {console.error("named exports are not supported in *.vue files.")}
|
||||
if (Component.options.functional) {console.error("[vue-loader] component.vue: functional components are not supported with templates, they should use render functions.")}
|
||||
|
||||
/* hot reload */
|
||||
if (false) {(function () {
|
||||
var hotAPI = require("vue-hot-reload-api")
|
||||
hotAPI.install(require("vue"), false)
|
||||
if (!hotAPI.compatible) return
|
||||
module.hot.accept()
|
||||
if (!module.hot.data) {
|
||||
hotAPI.createRecord("data-v-3091014c", Component.options)
|
||||
} else {
|
||||
hotAPI.reload("data-v-3091014c", Component.options)
|
||||
}
|
||||
})()}
|
||||
|
||||
module.exports = Component.exports
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(1);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_viewerjs__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_viewerjs___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_viewerjs__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__component_vue__ = __webpack_require__(5);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__component_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__component_vue__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__directive__ = __webpack_require__(4);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__api__ = __webpack_require__(3);
|
||||
/* harmony reexport (default from non-hamory) */ __webpack_require__.d(__webpack_exports__, "component", function() { return __WEBPACK_IMPORTED_MODULE_2__component_vue___default.a; });
|
||||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "directive", function() { return __WEBPACK_IMPORTED_MODULE_3__directive__["a"]; });
|
||||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "api", function() { return __WEBPACK_IMPORTED_MODULE_4__api__["a"]; });
|
||||
/* harmony reexport (default from non-hamory) */ __webpack_require__.d(__webpack_exports__, "Viewer", function() { return __WEBPACK_IMPORTED_MODULE_1_viewerjs___default.a; });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||
install: function install(Vue) {
|
||||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
_ref$name = _ref.name,
|
||||
name = _ref$name === undefined ? 'viewer' : _ref$name,
|
||||
_ref$debug = _ref.debug,
|
||||
debug = _ref$debug === undefined ? false : _ref$debug,
|
||||
defaultOptions = _ref.defaultOptions;
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_1_viewerjs___default.a.setDefaults(defaultOptions);
|
||||
|
||||
Vue.component(name, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__utils__["a" /* extend */])(__WEBPACK_IMPORTED_MODULE_2__component_vue___default.a, { name: name }));
|
||||
Vue.directive(name, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__directive__["a" /* default */])({ name: name, debug: debug }));
|
||||
Vue.prototype['$' + name + 'Api'] = __WEBPACK_IMPORTED_MODULE_4__api__["a" /* default */];
|
||||
},
|
||||
setDefaults: function setDefaults(defaultOptions) {
|
||||
__WEBPACK_IMPORTED_MODULE_1_viewerjs___default.a.setDefaults(defaultOptions);
|
||||
}
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
(function (global, factory) {
|
||||
( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||||
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.throttleDebounce = {}));
|
||||
})(this, function (exports) {
|
||||
'use strict';
|
||||
|
||||
function throttle(delay, noTrailing, callback, debounceMode) {
|
||||
var timeoutID;
|
||||
var cancelled = false;
|
||||
|
||||
var lastExec = 0;
|
||||
|
||||
function clearExistingTimeout() {
|
||||
if (timeoutID) {
|
||||
clearTimeout(timeoutID);
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
clearExistingTimeout();
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
if (typeof noTrailing !== 'boolean') {
|
||||
debounceMode = callback;
|
||||
callback = noTrailing;
|
||||
noTrailing = undefined;
|
||||
}
|
||||
|
||||
|
||||
function wrapper() {
|
||||
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
arguments_[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var elapsed = Date.now() - lastExec;
|
||||
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
function exec() {
|
||||
lastExec = Date.now();
|
||||
callback.apply(self, arguments_);
|
||||
}
|
||||
|
||||
|
||||
function clear() {
|
||||
timeoutID = undefined;
|
||||
}
|
||||
|
||||
if (debounceMode && !timeoutID) {
|
||||
exec();
|
||||
}
|
||||
|
||||
clearExistingTimeout();
|
||||
|
||||
if (debounceMode === undefined && elapsed > delay) {
|
||||
exec();
|
||||
} else if (noTrailing !== true) {
|
||||
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.cancel = cancel;
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function debounce(delay, atBegin, callback) {
|
||||
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
|
||||
}
|
||||
|
||||
exports.debounce = debounce;
|
||||
exports.throttle = throttle;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_viewerjs__ = __webpack_require__(0);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_viewerjs___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_viewerjs__);
|
||||
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ __webpack_exports__["default"] = ({
|
||||
props: {
|
||||
images: {
|
||||
type: Array
|
||||
},
|
||||
rebuild: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
trigger: {},
|
||||
options: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
|
||||
data: function data() {
|
||||
return {};
|
||||
},
|
||||
|
||||
|
||||
computed: {},
|
||||
|
||||
methods: {
|
||||
onChange: function onChange() {
|
||||
if (this.rebuild) {
|
||||
this.rebuildViewer();
|
||||
} else {
|
||||
this.updateViewer();
|
||||
}
|
||||
},
|
||||
rebuildViewer: function rebuildViewer() {
|
||||
this.destroyViewer();
|
||||
this.createViewer();
|
||||
},
|
||||
updateViewer: function updateViewer() {
|
||||
if (this.$viewer) {
|
||||
this.$viewer.update();
|
||||
this.$emit('inited', this.$viewer);
|
||||
} else {
|
||||
this.createViewer();
|
||||
}
|
||||
},
|
||||
destroyViewer: function destroyViewer() {
|
||||
this.$viewer && this.$viewer.destroy();
|
||||
},
|
||||
createViewer: function createViewer() {
|
||||
this.$viewer = new __WEBPACK_IMPORTED_MODULE_0_viewerjs___default.a(this.$el, this.options);
|
||||
this.$emit('inited', this.$viewer);
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
images: function images() {
|
||||
var _this = this;
|
||||
|
||||
this.$nextTick(function () {
|
||||
_this.onChange();
|
||||
});
|
||||
},
|
||||
|
||||
trigger: {
|
||||
handler: function handler() {
|
||||
var _this2 = this;
|
||||
|
||||
this.$nextTick(function () {
|
||||
_this2.onChange();
|
||||
});
|
||||
},
|
||||
|
||||
deep: true
|
||||
},
|
||||
options: {
|
||||
handler: function handler() {
|
||||
var _this3 = this;
|
||||
|
||||
this.$nextTick(function () {
|
||||
_this3.rebuildViewer();
|
||||
});
|
||||
},
|
||||
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function mounted() {
|
||||
this.createViewer();
|
||||
},
|
||||
destroyed: function destroyed() {
|
||||
this.destroyViewer();
|
||||
}
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var g;
|
||||
|
||||
g = function () {
|
||||
return this;
|
||||
}();
|
||||
|
||||
try {
|
||||
g = g || Function("return this")() || (1, eval)("this");
|
||||
} catch (e) {
|
||||
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
|
||||
}
|
||||
|
||||
module.exports = g;
|
||||
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// this module is a runtime utility for cleaner component module output and will
|
||||
// be included in the final webpack user bundle
|
||||
|
||||
module.exports = function normalizeComponent (
|
||||
rawScriptExports,
|
||||
compiledTemplate,
|
||||
scopeId,
|
||||
cssModules
|
||||
) {
|
||||
var esModule
|
||||
var scriptExports = rawScriptExports = rawScriptExports || {}
|
||||
|
||||
// ES6 modules interop
|
||||
var type = typeof rawScriptExports.default
|
||||
if (type === 'object' || type === 'function') {
|
||||
esModule = rawScriptExports
|
||||
scriptExports = rawScriptExports.default
|
||||
}
|
||||
|
||||
// Vue.extend constructor export interop
|
||||
var options = typeof scriptExports === 'function'
|
||||
? scriptExports.options
|
||||
: scriptExports
|
||||
|
||||
// render functions
|
||||
if (compiledTemplate) {
|
||||
options.render = compiledTemplate.render
|
||||
options.staticRenderFns = compiledTemplate.staticRenderFns
|
||||
}
|
||||
|
||||
// scopedId
|
||||
if (scopeId) {
|
||||
options._scopeId = scopeId
|
||||
}
|
||||
|
||||
// inject cssModules
|
||||
if (cssModules) {
|
||||
var computed = Object.create(options.computed || null)
|
||||
Object.keys(cssModules).forEach(function (key) {
|
||||
var module = cssModules[key]
|
||||
computed[key] = function () { return module }
|
||||
})
|
||||
options.computed = computed
|
||||
}
|
||||
|
||||
return {
|
||||
esModule: esModule,
|
||||
exports: scriptExports,
|
||||
options: options
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 11 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
|
||||
return _c('div', [_vm._t("default", null, {
|
||||
"images": _vm.images,
|
||||
"options": _vm.options
|
||||
})], 2)
|
||||
},staticRenderFns: []}
|
||||
module.exports.render._withStripped = true
|
||||
if (false) {
|
||||
module.hot.accept()
|
||||
if (module.hot.data) {
|
||||
require("vue-hot-reload-api").rerender("data-v-3091014c", module.exports)
|
||||
}
|
||||
}
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
});
|
||||
+446
@@ -0,0 +1,446 @@
|
||||
/*!
|
||||
* Viewer.js v1.11.5
|
||||
* https://fengyuanchen.github.io/viewerjs
|
||||
*
|
||||
* Copyright 2015-present Chen Fengyuan
|
||||
* Released under the MIT license
|
||||
*
|
||||
* Date: 2023-08-26T07:33:14.329Z
|
||||
*/
|
||||
|
||||
.viewer-zoom-in::before, .viewer-zoom-out::before, .viewer-one-to-one::before, .viewer-reset::before, .viewer-prev::before, .viewer-play::before, .viewer-next::before, .viewer-rotate-left::before, .viewer-rotate-right::before, .viewer-flip-horizontal::before, .viewer-flip-vertical::before, .viewer-fullscreen::before, .viewer-fullscreen-exit::before, .viewer-close::before {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAUCAYAAABWOyJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAQPSURBVHic7Zs/iFxVFMa/0U2UaJGksUgnIVhYxVhpjDbZCBmLdAYECxsRFBTUamcXUiSNncgKQbSxsxH8gzAP3FU2jY0kKKJNiiiIghFlccnP4p3nPCdv3p9778vsLOcHB2bfveeb7955c3jvvNkBIMdxnD64a94GHMfZu3iBcRynN7zAOI7TG15gHCeeNUkr8zaxG2lbYDYsdgMbktBsP03jdQwljSXdtBhLOmtjowC9Mg9L+knSlcD8TNKpSA9lBpK2JF2VdDSR5n5J64m0qli399hNFMUlpshQii5jbXTbHGviB0nLNeNDSd9VO4A2UdB2fp+x0eCnaXxWXGA2X0au/3HgN9P4LFCjIANOJdrLr0zzZ+BEpNYDwKbpnQMeAw4m8HjQtM6Z9qa917zPQwFr3M5KgA6J5rTJCdFZJj9/lyvGhsDvwFNVuV2MhhjrK6b9bFiE+j1r87eBl4HDwCF7/U/k+ofAX5b/EXBv5JoLMuILzf3Ap6Z3EzgdqHMCuF7hcQf4HDgeoHnccncqdK/TvSDWffFXI/exICY/xZyqc6XLWF1UFZna4gJ7q8BsRvgd2/xXpo6P+D9dfT7PpECtA3cnWPM0GXGFZh/wgWltA+cDNC7X+AP4GzjZQe+k5dRxuYPeiuXU7e1qwLpDz7dFjXKRaSwuMLvAlG8zZlG+YmiK1HoFqT7wP2z+4Q45TfEGcMt01xLoNZEBTwRqD4BLpnMLeC1A41UmVxsXgXeBayV/Wx20rpTyrpnWRft7p6O/FdqzGrDukPNtkaMoMo3FBdBSQMOnYBCReyf05s126fU9ytfX98+mY54Kxnp7S9K3kj6U9KYdG0h6UdLbkh7poFXMfUnSOyVvL0h6VtIXHbS6nOP+s/Zm9mvyXW1uuC9ohZ72E9uDmXWLJOB1GxsH+DxPftsB8B6wlGDN02TAkxG6+4D3TWsbeC5CS8CDFce+AW500LhhOW2020TRjK3b21HEmgti9m0RonxbdMZeVzV+/4tF3cBpP7E9mKHNL5q8h5g0eYsCMQz0epq8gQrwMXAgcs0FGXGFRcB9wCemF9PkbYqM/Bas7fxLwNeJPdTdpo4itQti8lPMqTpXuozVRVXPpbHI3KkNTB1NfkL81j2mvhDp91HgV9MKuRIqrykj3WPq4rHyL+axj8/qGPmTqi6F9YDlHOvJU6oYcTsh/TYSzWmTE6JT19CtLTJt32D6CmHe0eQn1O8z5AXgT4sx4Vcu0/EQecMydB8z0hUWkTd2t4CrwNEePqMBcAR4mrBbwyXLPWJa8zrXmmLEhNBmfpkuY2102xxrih+pb+ieAb6vGhuA97UcJ5KR8gZ77K+99xxeYBzH6Q3/Z0fHcXrDC4zjOL3hBcZxnN74F+zlvXFWXF9PAAAAAElFTkSuQmCC");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 280px;
|
||||
color: transparent;
|
||||
display: block;
|
||||
font-size: 0;
|
||||
height: 20px;
|
||||
line-height: 0;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.viewer-zoom-in::before {
|
||||
background-position: 0 0;
|
||||
content: "Zoom In";
|
||||
}
|
||||
|
||||
.viewer-zoom-out::before {
|
||||
background-position: -20px 0;
|
||||
content: "Zoom Out";
|
||||
}
|
||||
|
||||
.viewer-one-to-one::before {
|
||||
background-position: -40px 0;
|
||||
content: "One to One";
|
||||
}
|
||||
|
||||
.viewer-reset::before {
|
||||
background-position: -60px 0;
|
||||
content: "Reset";
|
||||
}
|
||||
|
||||
.viewer-prev::before {
|
||||
background-position: -80px 0;
|
||||
content: "Previous";
|
||||
}
|
||||
|
||||
.viewer-play::before {
|
||||
background-position: -100px 0;
|
||||
content: "Play";
|
||||
}
|
||||
|
||||
.viewer-next::before {
|
||||
background-position: -120px 0;
|
||||
content: "Next";
|
||||
}
|
||||
|
||||
.viewer-rotate-left::before {
|
||||
background-position: -140px 0;
|
||||
content: "Rotate Left";
|
||||
}
|
||||
|
||||
.viewer-rotate-right::before {
|
||||
background-position: -160px 0;
|
||||
content: "Rotate Right";
|
||||
}
|
||||
|
||||
.viewer-flip-horizontal::before {
|
||||
background-position: -180px 0;
|
||||
content: "Flip Horizontal";
|
||||
}
|
||||
|
||||
.viewer-flip-vertical::before {
|
||||
background-position: -200px 0;
|
||||
content: "Flip Vertical";
|
||||
}
|
||||
|
||||
.viewer-fullscreen::before {
|
||||
background-position: -220px 0;
|
||||
content: "Enter Full Screen";
|
||||
}
|
||||
|
||||
.viewer-fullscreen-exit::before {
|
||||
background-position: -240px 0;
|
||||
content: "Exit Full Screen";
|
||||
}
|
||||
|
||||
.viewer-close::before {
|
||||
background-position: -260px 0;
|
||||
content: "Close";
|
||||
}
|
||||
|
||||
.viewer-container {
|
||||
bottom: 0;
|
||||
direction: ltr;
|
||||
font-size: 0;
|
||||
left: 0;
|
||||
line-height: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
top: 0;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.viewer-container::-moz-selection, .viewer-container *::-moz-selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.viewer-container::selection,
|
||||
.viewer-container *::selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.viewer-container:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.viewer-container img {
|
||||
display: block;
|
||||
height: auto;
|
||||
max-height: none !important;
|
||||
max-width: none !important;
|
||||
min-height: 0 !important;
|
||||
min-width: 0 !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.viewer-canvas {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.viewer-canvas > img {
|
||||
height: auto;
|
||||
margin: 15px auto;
|
||||
max-width: 90% !important;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.viewer-footer {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.viewer-navbar {
|
||||
background-color: rgba(0, 0, 0, 50%);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.viewer-list {
|
||||
box-sizing: content-box;
|
||||
height: 50px;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
||||
.viewer-list > li {
|
||||
color: transparent;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
font-size: 0;
|
||||
height: 50px;
|
||||
line-height: 0;
|
||||
opacity: 0.5;
|
||||
overflow: hidden;
|
||||
transition: opacity 0.15s;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.viewer-list > li:focus,
|
||||
.viewer-list > li:hover {
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.viewer-list > li:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.viewer-list > li + li {
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
.viewer-list > .viewer-loading {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.viewer-list > .viewer-loading::after {
|
||||
border-width: 2px;
|
||||
height: 20px;
|
||||
margin-left: -10px;
|
||||
margin-top: -10px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.viewer-list > .viewer-active,
|
||||
.viewer-list > .viewer-active:focus,
|
||||
.viewer-list > .viewer-active:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.viewer-player {
|
||||
background-color: #000;
|
||||
bottom: 0;
|
||||
cursor: none;
|
||||
display: none;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.viewer-player > img {
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul {
|
||||
display: inline-block;
|
||||
margin: 0 auto 5px;
|
||||
overflow: hidden;
|
||||
padding: 6px 3px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > li {
|
||||
background-color: rgba(0, 0, 0, 50%);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
height: 24px;
|
||||
overflow: hidden;
|
||||
transition: background-color 0.15s;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > li:focus,
|
||||
.viewer-toolbar > ul > li:hover {
|
||||
background-color: rgba(0, 0, 0, 80%);
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > li:focus {
|
||||
box-shadow: 0 0 3px #fff;
|
||||
outline: 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > li::before {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > li + li {
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > .viewer-small {
|
||||
height: 18px;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px;
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > .viewer-small::before {
|
||||
margin: -1px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > .viewer-large {
|
||||
height: 30px;
|
||||
margin-bottom: -3px;
|
||||
margin-top: -3px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.viewer-toolbar > ul > .viewer-large::before {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.viewer-tooltip {
|
||||
background-color: rgba(0, 0, 0, 80%);
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
height: 20px;
|
||||
left: 50%;
|
||||
line-height: 20px;
|
||||
margin-left: -25px;
|
||||
margin-top: -10px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 50%;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.viewer-title {
|
||||
color: #ccc;
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
margin: 5px 5%;
|
||||
max-width: 90%;
|
||||
min-height: 14px;
|
||||
opacity: 0.8;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
transition: opacity 0.15s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.viewer-title:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.viewer-button {
|
||||
-webkit-app-region: no-drag;
|
||||
background-color: rgba(0, 0, 0, 50%);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
height: 80px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
right: -40px;
|
||||
top: -40px;
|
||||
transition: background-color 0.15s;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.viewer-button:focus,
|
||||
.viewer-button:hover {
|
||||
background-color: rgba(0, 0, 0, 80%);
|
||||
}
|
||||
|
||||
.viewer-button:focus {
|
||||
box-shadow: 0 0 3px #fff;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.viewer-button::before {
|
||||
bottom: 15px;
|
||||
left: 15px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.viewer-fixed {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.viewer-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.viewer-show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.viewer-hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.viewer-backdrop {
|
||||
background-color: rgba(0, 0, 0, 50%);
|
||||
}
|
||||
|
||||
.viewer-invisible {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.viewer-move {
|
||||
cursor: move;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.viewer-fade {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.viewer-in {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.viewer-transition {
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
@keyframes viewer-spinner {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.viewer-loading::after {
|
||||
animation: viewer-spinner 1s linear infinite;
|
||||
border: 4px solid rgba(255, 255, 255, 10%);
|
||||
border-left-color: rgba(255, 255, 255, 50%);
|
||||
border-radius: 50%;
|
||||
content: "";
|
||||
display: inline-block;
|
||||
height: 40px;
|
||||
left: 50%;
|
||||
margin-left: -20px;
|
||||
margin-top: -20px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 40px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.viewer-hide-xs-down {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.viewer-hide-sm-down {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.viewer-hide-md-down {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*!
|
||||
* Viewer.js v1.11.5
|
||||
* https://fengyuanchen.github.io/viewerjs
|
||||
*
|
||||
* Copyright 2015-present Chen Fengyuan
|
||||
* Released under the MIT license
|
||||
*
|
||||
* Date: 2023-08-26T07:33:16.755Z
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Viewer=e()}(this,function(){"use strict";function s(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function P(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach(function(t){var e,i;e=n,i=o[t=t],(t=l(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);if("object"!=typeof(i=i.call(t,e||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}var W={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{},a=!(!t||!e.document.documentElement)&&"ontouchstart"in e.document.documentElement,i=t&&"PointerEvent"in e,g="viewer",h="move",j="switch",c="zoom",f="".concat(g,"-active"),H="".concat(g,"-close"),B="".concat(g,"-fade"),V="".concat(g,"-fixed"),U="".concat(g,"-fullscreen"),K="".concat(g,"-fullscreen-exit"),v="".concat(g,"-hide"),Z="".concat(g,"-hide-md-down"),$="".concat(g,"-hide-sm-down"),_="".concat(g,"-hide-xs-down"),u="".concat(g,"-in"),p="".concat(g,"-invisible"),b="".concat(g,"-loading"),G="".concat(g,"-move"),J="".concat(g,"-open"),d="".concat(g,"-show"),m="".concat(g,"-transition"),w="click",Q="dblclick",tt="dragstart",et="focusin",it="keydown",y="load",x="error",nt=i?"pointerdown":a?"touchstart":"mousedown",ot=i?"pointermove":a?"touchmove":"mousemove",st=i?"pointerup pointercancel":a?"touchend touchcancel":"mouseup",at="resize",k="transitionend",rt="wheel",z="viewed",lt="rotated",ht="".concat(g,"Action"),ct=/\s\s*/,ut=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function T(t){return"string"==typeof t}var dt=Number.isNaN||e.isNaN;function E(t){return"number"==typeof t&&!dt(t)}function D(t){return void 0===t}function o(t){return"object"===n(t)&&null!==t}var mt=Object.prototype.hasOwnProperty;function S(t){if(!o(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&mt.call(i,"isPrototypeOf")}catch(t){return!1}}function I(t){return"function"==typeof t}function A(e,i){if(e&&I(i))if(Array.isArray(e)||E(e.length))for(var t=e.length,n=0;n<t&&!1!==i.call(e,e[n],n,e);n+=1);else o(e)&&Object.keys(e).forEach(function(t){i.call(e,e[t],t,e)})}var O=Object.assign||function(i){for(var t=arguments.length,e=new Array(1<t?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return o(i)&&0<e.length&&e.forEach(function(e){o(e)&&Object.keys(e).forEach(function(t){i[t]=e[t]})}),i},gt=/^(?:width|height|left|top|marginLeft|marginTop)$/;function C(t,e){var i=t.style;A(e,function(t,e){gt.test(e)&&E(t)&&(t+="px"),i[e]=t})}function L(t,e){return t&&e&&(t.classList?t.classList.contains(e):-1<t.className.indexOf(e))}function R(t,e){var i;t&&e&&(E(t.length)?A(t,function(t){R(t,e)}):t.classList?t.classList.add(e):(i=t.className.trim())?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e)}function M(t,e){t&&e&&(E(t.length)?A(t,function(t){M(t,e)}):t.classList?t.classList.remove(e):0<=t.className.indexOf(e)&&(t.className=t.className.replace(e,"")))}function F(t,e,i){e&&(E(t.length)?A(t,function(t){F(t,e,i)}):(i?R:M)(t,e))}var ft=/Line truncated
|
||||
@@ -0,0 +1,52 @@
|
||||
const Service = require('egg').Service;
|
||||
const validateUtil = require('@jianghujs/jianghu/app/common/validateUtil');
|
||||
const { BizError, errorInfoEnum } = require('../constant/error');
|
||||
const _ = require('lodash');
|
||||
|
||||
|
||||
const actionDataScheme = Object.freeze({
|
||||
generateBizIdOfBeforeHook: {
|
||||
type: 'object',
|
||||
additionalProperties: true,
|
||||
required: [ 'type', 'bizId', 'tableName' ],
|
||||
properties: {
|
||||
type: { type: 'string', enum: [ 'idSequence' ] },
|
||||
bizId: { anyOf: [{ type: "string" }, { type: "number" }] },
|
||||
tableName: { anyOf: [{ type: "string" }, { type: "number" }] },
|
||||
prefix: { anyOf: [{ type: "string" }, { type: "number" }, { type: "null" }] },
|
||||
},
|
||||
},
|
||||
});
|
||||
class CommonService extends Service {
|
||||
|
||||
async generateBizIdOfBeforeHook() {
|
||||
const { jianghuKnex } = this.app;
|
||||
const bizIdGenerate = this.ctx.request.body.appData.bizIdGenerate;
|
||||
validateUtil.validate(actionDataScheme.generateBizIdOfBeforeHook, bizIdGenerate, "BizId生成");
|
||||
const { type, bizId, tableName } = bizIdGenerate;
|
||||
const prefix = bizIdGenerate.prefix || '';
|
||||
const startValue = bizIdGenerate.startValue || 1001;
|
||||
|
||||
if (type === 'idSequence') {
|
||||
let newIdSequence = null;
|
||||
const newIdSequenceResult = await jianghuKnex(tableName, this.ctx)
|
||||
.max('idSequence', { as: "newIdSequence" })
|
||||
.first();
|
||||
if (!newIdSequenceResult.newIdSequence) {
|
||||
newIdSequence = startValue
|
||||
} if (newIdSequenceResult.newIdSequence < startValue) {
|
||||
newIdSequence = startValue
|
||||
} else {
|
||||
newIdSequence = parseInt(newIdSequenceResult.newIdSequence) + 1;
|
||||
}
|
||||
const newBizId = prefix+ newIdSequence;
|
||||
this.ctx.request.body.appData.actionData.idSequence = newIdSequence;
|
||||
this.ctx.request.body.appData.actionData[bizId] = newBizId;
|
||||
} else {
|
||||
throw new BizError(errorInfoEnum.data_exception);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = CommonService;
|
||||
@@ -0,0 +1,150 @@
|
||||
<template id="file-upload">
|
||||
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
|
||||
<v-file-input multiple v-model="inputFile" hide-input dense filled single-line style="width: 10px;" color="red"
|
||||
label="请选择文件"></v-file-input>
|
||||
<v-card outlined class="mt-2" v-if="value && value.length > 0">
|
||||
<v-data-table :headers="headers" :items="value"
|
||||
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }" :items-per-page="100" :loading="isTableLoading"
|
||||
mobile-breakpoint="0" :class="{'mx-2': isMobile}"
|
||||
class="elevation-0 mt-0 flex-fill d-flex flex-column">
|
||||
<template v-slot:item.download-path="{ item }">
|
||||
<preview-file-group :file-list="[item]" />
|
||||
</template>
|
||||
<template v-slot:item.action="{ item, index }">
|
||||
<span role="button" class="success--text font-weight-medium font-size-2"
|
||||
@click="doUiAction('deleteItem', { item, index })">
|
||||
<v-icon size="14" class="success--text">mdi-trash-can-outline</v-icon>删除
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.operationAt="{ item }">
|
||||
{{ item.operationAt && dayjs(item.operationAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
{% include 'component/common/previewFileGroup.html' %}
|
||||
|
||||
<script type="module">
|
||||
Vue.component("file-upload", {
|
||||
template: '#file-upload',
|
||||
props: {
|
||||
fileBizId: {
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
value: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
vuetify: new Vuetify(),
|
||||
data: () => ({
|
||||
isMobile: window.innerWidth < 600,
|
||||
|
||||
serverSearchInput: {
|
||||
rowStatus: ['正常']
|
||||
},
|
||||
// 表格相关数据
|
||||
requireRules: [v => !!v || '必填'],
|
||||
constantCollection: {},
|
||||
isTableLoading: false,
|
||||
headers: [
|
||||
{ text: "文件预览/下载", value: "download-path", align: 'center', sortable: false, width: 150, },
|
||||
{ text: "文件名", value: "filename", width: 120, class: 'fixed' },
|
||||
{ text: "文件大小(KB)", value: "binarySize", width: 100 },
|
||||
{ text: '操作', value: 'action', align: 'center', sortable: false, width: 150, },
|
||||
],
|
||||
|
||||
inputFile: [],
|
||||
}),
|
||||
computed: {
|
||||
isMobile() {
|
||||
return window.innerWidth < 600;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'inputFile':{
|
||||
handler(newVal,oldVal){
|
||||
console.log('inputFile', newVal);
|
||||
newVal.forEach(element => {
|
||||
this.uploadFn(element)
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
async doUiAction(uiActionId, uiActionData) {
|
||||
switch (uiActionId) {
|
||||
case 'deleteItem':
|
||||
await this.confirmDeleteItemDialog(uiActionData);
|
||||
await this.doDeleteItem(uiActionData);
|
||||
break;
|
||||
default:
|
||||
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
async uploadFn(file){
|
||||
this.isTableLoading = true
|
||||
const fileBizId = this.fileBizId;
|
||||
await window.vtoast.loading("保存中");
|
||||
window.vtoast.loading(`${file.name} 上传进度: 0.00%`);
|
||||
const result = await window.jianghuAxios.httpUploadByStream({
|
||||
file,
|
||||
fileDirectory: `test`,
|
||||
onProgress: (total, loaded) => {
|
||||
const progress = Number((loaded * 100 / total).toFixed(2));
|
||||
window.vtoast.loading(`${file.name} 上传进度: ${progress}%`);
|
||||
if (loaded === total) {
|
||||
window.vtoast.success(`${file.name} 上传进度: 100%`);
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log('uploadFn', result);
|
||||
|
||||
const { filename, downloadPath, binarySize } = result.data.appData.resultData;
|
||||
this.$emit('input', [...this.value, {filename, downloadPath, binarySize}]);
|
||||
|
||||
const { status } = result.data;
|
||||
if (status === 'success') {
|
||||
await window.jianghuAxios({
|
||||
data: {
|
||||
appData: {
|
||||
pageId: 'allPage',
|
||||
actionId: 'insertItem',
|
||||
actionData: { filename, downloadPath, binarySize }
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// this.uploadFail++
|
||||
await window.vtoast.fail(filename + "上传失败");
|
||||
}
|
||||
this.isTableLoading = false
|
||||
},
|
||||
|
||||
// deleteItem
|
||||
async confirmDeleteItemDialog({ item:{ filename } }) {
|
||||
if (await window.confirmDialog({ title: "删除", content: "确定删除文件" + filename + "吗?" }) === false) {
|
||||
throw new Error("[confirmDeleteItemDialog] 否");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
// TODO::只是删除了value的数据,并没有删除文件
|
||||
async doDeleteItem({index}) {
|
||||
this.$emit('input', this.value.filter((f, i) => index != i))
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,216 @@
|
||||
<template id="preview-file-group">
|
||||
<v-container class="pa-0">
|
||||
<div class="img-group" v-if="false">
|
||||
<div class="img" v-for="(item, index) in fileList" @click="doUiAction('previewFile', { item })"
|
||||
:style="`background-image: url(/<$ ctx.app.config.appId $>/upload${item.downloadPath})`"></div>
|
||||
</div>
|
||||
<div class="file-group">
|
||||
<div class="file" v-for="(item, index) in fileList">
|
||||
<span small role="button" class="success--text font-weight-medium font-size-2 mr-1 mr-sm-2"
|
||||
v-if="item.downloadPath" @click="doUiAction('previewFile', { item })">查看</span>
|
||||
<span small role="button" class="success--text font-weight-medium font-size-2 mr-1 mr-sm-2"
|
||||
v-if="item.downloadPath" @click="doUiAction('downloadFile', { item })">下载</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 文件预览 -->
|
||||
<v-overlay v-if="previewFileType === 'pdf'" :value="previewOverlay" @click="previewOverlay = false" :opacity="0.85" style="z-index: 49999">
|
||||
<v-icon style="position: fixed; right: 10px; top: 5px; z-index: 50000" large color="green"
|
||||
@click="previewOverlay = false">
|
||||
mdi-close-circle
|
||||
</v-icon>
|
||||
|
||||
<iframe :src="'/<$ ctx.app.config.appId $>/public/pdf/web/viewer.html?file=' + previewFileUrl" frameborder="0"
|
||||
style="width: 75vw; height: 100vh; padding: 50px 0 0 0;"></iframe>
|
||||
</v-overlay>
|
||||
|
||||
<viewer ref="viewer" :images="previewFileUrl" class="images clearfix">
|
||||
<template slot-scope="scope">
|
||||
<img style="display: none" :src="previewFileUrl" class="image">
|
||||
</template>
|
||||
</viewer>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<link href="/<$ ctx.app.config.appId $>/public/lib/viewerjs/viewer.min.css" rel="stylesheet">
|
||||
<script src="/<$ ctx.app.config.appId $>/public/lib/viewerjs/viewer.min.js"></script>
|
||||
<script src="/<$ ctx.app.config.appId $>/public/lib/viewerjs/v-viewer.min.js"></script>
|
||||
|
||||
|
||||
<script type="module">
|
||||
Vue.use(VueViewer.default)
|
||||
Vue.component("preview-file-group", {
|
||||
template: '#preview-file-group',
|
||||
props: {
|
||||
fileList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data: () => ({
|
||||
previewPrefix: `/<$ ctx.app.config.appId $>/upload`,
|
||||
previewOverlay: false,
|
||||
previewFileUrl: '',
|
||||
previewFileBase64: '',
|
||||
previewFilename: '',
|
||||
previewFileType: '',
|
||||
downloadPath: '',
|
||||
}),
|
||||
methods: {
|
||||
async doUiAction(uiActionId, uiActionData) {
|
||||
switch (uiActionId) {
|
||||
case 'previewFile':
|
||||
await this.previewFile(uiActionData);
|
||||
break;
|
||||
case 'downloadFile':
|
||||
await this.downloadFile(uiActionData);
|
||||
break;
|
||||
case 'downloadPreviewFile':
|
||||
await this.downloadPreviewFile(uiActionData);
|
||||
break;
|
||||
case 'imgWheelFn':
|
||||
await this.imgWheelFn(uiActionData)
|
||||
break;
|
||||
default:
|
||||
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* uiActionId: downloadFile
|
||||
* description: ✅下载
|
||||
* main: [{"function":"downloadFile"}]
|
||||
*/
|
||||
async downloadFile({ item }) {
|
||||
const { filename, downloadPath } = item;
|
||||
window.vtoast.loading('文件下载进度0.00%');
|
||||
const buffer = await window.jianghuAxios.httpDownloadByStream({
|
||||
downloadPath, filename,
|
||||
onProgress: (total, loaded) => {
|
||||
const progress = Number((loaded * 100 / total).toFixed(2));
|
||||
window.vtoast.loading(`文件下载进度${progress}%`);
|
||||
if (progress === 100) {
|
||||
window.vtoast.success('文件下载成功');
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
window.vtoast.fail({ message: err.errorReason });
|
||||
throw err;
|
||||
});
|
||||
window.jianghuAxios.downloadBufferToChrome({ buffer, filename });
|
||||
},
|
||||
/**
|
||||
* uiActionId: previewFile
|
||||
* description: ✅预览文件
|
||||
* main: [{"function":"previewFile"}]
|
||||
*/
|
||||
async previewFile({ item }) {
|
||||
const { filename, downloadPath, binarySize } = item;
|
||||
if (binarySize > 50 * 1024) {
|
||||
window.vtoast.fail('文件大于50M, 不支持预览!');
|
||||
// 中断uiAction
|
||||
return false;
|
||||
}
|
||||
this.filename = filename;
|
||||
if (/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(filename)) {
|
||||
this.previewFileType = 'img';
|
||||
this.previewFileUrl = `/<$ ctx.app.config.appId $>/upload${downloadPath}`;
|
||||
|
||||
this.$refs.viewer.$viewer.show()
|
||||
|
||||
}
|
||||
if (/\.(pdf|PDF)$/.test(filename)) {
|
||||
this.previewFileType = 'pdf';
|
||||
this.previewFileUrl = encodeURIComponent(`/<$ ctx.app.config.appId $>/upload${downloadPath}`);
|
||||
}
|
||||
|
||||
if (/\.(xls|xlsx)$/.test(filename)){
|
||||
this.previewFileType = 'excel';
|
||||
window.vtoast.success('excel文件不能预览');
|
||||
}
|
||||
this.previewFilename = filename;
|
||||
this.previewOverlay = true;
|
||||
this.downloadPath = downloadPath;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* uiActionId: downloadPreviewFile
|
||||
* description: ✅下载正在预览的文件
|
||||
* main: [{"function":"downloadPreviewFile"}]
|
||||
*/
|
||||
async downloadPreviewFile() {
|
||||
const oReq = new XMLHttpRequest();
|
||||
const url = `/<$ ctx.app.config.appId $>/upload${this.downloadPath}`;
|
||||
const filename = this.previewFilename;
|
||||
oReq.open("GET", url, true);
|
||||
oReq.responseType = "arraybuffer";
|
||||
oReq.onprogress = function (event) {
|
||||
if (event.lengthComputable) {
|
||||
const progress = Number((event.loaded * 100 / event.total).toFixed(2));
|
||||
window.vtoast.loading(`文件下载进度${progress}%`);
|
||||
if (progress === 100) {
|
||||
window.vtoast.success('文件下载成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
oReq.onload = function (oEvent) {
|
||||
const buffer = oReq.response;
|
||||
let url = window.URL.createObjectURL(new Blob([buffer], { type: "arraybuffer" }))
|
||||
const link = document.createElement('a');
|
||||
link.style.display = 'none';
|
||||
link.href = url;
|
||||
link.setAttribute('download', filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
oReq.send(null);
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.add-btn {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.img-group {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.img-group .img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background-size: cover;
|
||||
margin-right: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.img-group .img :last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.file-group {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.file-group .file {
|
||||
margin-bottom: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.file-group .file:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.v-overlay {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user