From 39feecb83cccbc4063a85177bf78b5bfcb7db1a1 Mon Sep 17 00:00:00 2001 From: liaozetao <1107136310@qq.com> Date: Wed, 20 Sep 2023 18:21:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=BE=A9=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=95=B0=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 4 +- package-lock.json | 84 +- package.json | 5 +- public/index.html | 13 +- .../css/bootstrap-combobox.css | 55 + .../js}/bootstrap-combobox-helper.js | 4 + .../js/bootstrap-combobox.js | 493 ++++ .../bootstrap-datepicker/css/datepicker3.css | 853 +++++++ .../js/bootstrap-datepicker.js | 2046 ++++++++++++++++ .../css/bootstrap-datetimepicker.css | 240 ++ .../js/bootstrap-datetimepicker.min.js | 1694 +++++++++++++ .../locales/bootstrap-datetimepicker.zh-CN.js | 14 + .../css/bootstrap-multiselect.css | 190 ++ .../js/bootstrap-multiselect.js | 2017 +++++++++++++++ .../bootstrap-select/css/bootstrap-select.css | 337 +++ .../bootstrap-select/js/bootstrap-select.js | 1738 +++++++++++++ .../css/validationEngine.jquery.css | 196 ++ .../js/jquery.validationEngine.js | 2163 +++++++++++++++++ .../jquery.validationEngine-zh_CN.js | 181 ++ src/components/header/index.vue | 11 +- src/components/maintainer/index.vue | 19 +- src/css/login.css | 1 + src/main.js | 28 +- src/store/modules/menu.js | 1 + src/views/anchor/AnchorFansMpAudioView.vue | 2 +- src/views/car/CarGoodsAdminView.vue | 2 +- src/views/login/index.vue | 16 +- 27 files changed, 12273 insertions(+), 134 deletions(-) create mode 100644 src/assets/plugins/bootstrap-combobox/css/bootstrap-combobox.css rename src/{utils => assets/plugins/bootstrap-combobox/js}/bootstrap-combobox-helper.js (91%) create mode 100644 src/assets/plugins/bootstrap-combobox/js/bootstrap-combobox.js create mode 100644 src/assets/plugins/bootstrap-datepicker/css/datepicker3.css create mode 100644 src/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js create mode 100644 src/assets/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css create mode 100644 src/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js create mode 100644 src/assets/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js create mode 100644 src/assets/plugins/bootstrap-multiselect/css/bootstrap-multiselect.css create mode 100644 src/assets/plugins/bootstrap-multiselect/js/bootstrap-multiselect.js create mode 100644 src/assets/plugins/bootstrap-select/css/bootstrap-select.css create mode 100644 src/assets/plugins/bootstrap-select/js/bootstrap-select.js create mode 100644 src/assets/plugins/jQuery-Validation-Engine/css/validationEngine.jquery.css create mode 100644 src/assets/plugins/jQuery-Validation-Engine/js/jquery.validationEngine.js create mode 100644 src/assets/plugins/jQuery-Validation-Engine/js/languages/jquery.validationEngine-zh_CN.js diff --git a/.eslintrc.js b/.eslintrc.js index fd5c68c..b06c640 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,8 @@ module.exports = { rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', - 'no-unused-vars': 'off' + 'no-unused-vars': 'off', + 'no-useless-escape': 'off', + 'no-control-regex': 'off', } } diff --git a/package-lock.json b/package-lock.json index d003482..12b354d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,14 +11,11 @@ "admin-lte": "^2.3.2", "axios": "^1.5.0", "bootstrap": "^3.3.5", - "bootstrap-datepicker": "^1.10.0", - "bootstrap-multiselect": "^0.9.15", - "bootstrap-select": "^1.13.18", "bootstrap-table": "^1.10.1", "core-js": "^3.8.3", - "eonasdan-bootstrap-datetimepicker": "^4.17.49", "font-awesome": "^4.6.3", "ionicons": "^2.0.1", + "jquery": "^2.2.0", "jquery.md5": "^1.0.0", "knockout": "^3.5.1", "less": "^4.2.0", @@ -3871,41 +3868,6 @@ "node": ">=0.10.1" } }, - "node_modules/bootstrap-datepicker": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/bootstrap-datepicker/-/bootstrap-datepicker-1.10.0.tgz", - "integrity": "sha512-lWxtSYddAQOpbAO8UhYhHLcK6425eWoSjb5JDvZU3ePHEPF6A3eUr51WKaFy4PccU19JRxUG6wEU3KdhtKfvpg==", - "dependencies": { - "jquery": ">=3.4.0 <4.0.0" - } - }, - "node_modules/bootstrap-datepicker/node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" - }, - "node_modules/bootstrap-multiselect": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/bootstrap-multiselect/-/bootstrap-multiselect-0.9.15.tgz", - "integrity": "sha512-UwF32a0QR82xkEEGpuNrn57Bu0b/7DfCuoiOaziSHfQKFj5arR6c7+MYLs5RiIf3zl4XZ+YnY7ZBi6/EN3vEZA==", - "dependencies": { - "jquery": "~2.1.3" - } - }, - "node_modules/bootstrap-multiselect/node_modules/jquery": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.1.4.tgz", - "integrity": "sha512-wWR+eCq/T/Qt0NcFyM+QVho0ZVzWxFYANijmSMImXiM5mjr1aOaf4SF0eOEPc92bbK2L2vDpxw3lIszus7eO8Q==" - }, - "node_modules/bootstrap-select": { - "version": "1.13.18", - "resolved": "https://registry.npmjs.org/bootstrap-select/-/bootstrap-select-1.13.18.tgz", - "integrity": "sha512-V1IzK4rxBq5FrJtkzSH6RmFLFBsjx50byFbfAf8jYyXROWs7ZpprGjdHeoyq2HSsHyjJhMMwjsQhRoYAfxCGow==", - "peerDependencies": { - "bootstrap": ">=3.0.0", - "jquery": "1.9.1 - 3" - } - }, "node_modules/bootstrap-table": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.10.1.tgz", @@ -5465,28 +5427,6 @@ "node": ">=6" } }, - "node_modules/eonasdan-bootstrap-datetimepicker": { - "version": "4.17.49", - "resolved": "https://registry.npmjs.org/eonasdan-bootstrap-datetimepicker/-/eonasdan-bootstrap-datetimepicker-4.17.49.tgz", - "integrity": "sha512-7KZeDpkj+A6AtPR3XjX8gAnRPUkPSfW0OmMANG1dkUOPMtLSzbyoCjDIdEcfRtQPU5X0D9Gob7wWKn0h4QWy7A==", - "dependencies": { - "bootstrap": "^3.3", - "jquery": "^3.5.1", - "moment": "^2.10", - "moment-timezone": "^0.4.0" - }, - "peerDependencies": { - "bootstrap": "^3.3", - "jquery": "^1.8.3 || ^2.0 || ^3.0", - "moment": "^2.10", - "moment-timezone": "^0.4.0 || ^0.5.0" - } - }, - "node_modules/eonasdan-bootstrap-datetimepicker/node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" - }, "node_modules/err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", @@ -7420,8 +7360,7 @@ "node_modules/jquery": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.0.tgz", - "integrity": "sha512-bQLMb56JzEBBs2CMzy8llOL0J1xm/JkDma6+UnF2cSPYJmvQHS9yZ+YGny/1YydkdZm8j0Ny8peiaeoWEwy9Zg==", - "peer": true + "integrity": "sha512-bQLMb56JzEBBs2CMzy8llOL0J1xm/JkDma6+UnF2cSPYJmvQHS9yZ+YGny/1YydkdZm8j0Ny8peiaeoWEwy9Zg==" }, "node_modules/jquery.md5": { "version": "1.0.0", @@ -8514,25 +8453,6 @@ "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==", "dev": true }, - "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", - "engines": { - "node": "*" - } - }, - "node_modules/moment-timezone": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.4.1.tgz", - "integrity": "sha512-5cNPVUwaVJDCe9JM8m/qz17f9SkaI8rpnRUyDJi2K5HAd6EwhuQ3n5nLclZkNC/qJnomKgQH2TIu70Gy2dxFKA==", - "dependencies": { - "moment": ">= 2.6.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/mrmime": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz", diff --git a/package.json b/package.json index 111e155..3f92f90 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,11 @@ "admin-lte": "^2.3.2", "axios": "^1.5.0", "bootstrap": "^3.3.5", - "bootstrap-datepicker": "^1.10.0", - "bootstrap-multiselect": "^0.9.15", - "bootstrap-select": "^1.13.18", "bootstrap-table": "^1.10.1", "core-js": "^3.8.3", - "eonasdan-bootstrap-datetimepicker": "^4.17.49", "font-awesome": "^4.6.3", "ionicons": "^2.0.1", + "jquery": "^2.2.0", "jquery.md5": "^1.0.0", "knockout": "^3.5.1", "less": "^4.2.0", diff --git a/public/index.html b/public/index.html index ce7bd94..8b2697e 100644 --- a/public/index.html +++ b/public/index.html @@ -6,17 +6,6 @@ - - - - - - - -
'); + break; + case "topLeft": + case "topRight": + arrow.html('
'); + prompt.append(arrow); + break; + } + } + // Add custom prompt class + if (options.addPromptClass) + prompt.addClass(options.addPromptClass); + + // Add custom prompt class defined in element + var requiredOverride = field.attr('data-required-class'); + if (requiredOverride !== undefined) { + prompt.addClass(requiredOverride); + } else { + if (options.prettySelect) { + if ($('#' + field.attr('id')).next().is('select')) { + var prettyOverrideClass = $('#' + field.attr('id').substr(options.usePrefix.length).substring(options.useSuffix.length)).attr('data-required-class'); + if (prettyOverrideClass !== undefined) { + prompt.addClass(prettyOverrideClass); + } + } + } + } + + prompt.css({ + "opacity": 0 + }); + if (positionType === 'inline') { + prompt.addClass("inline"); + if (typeof field.attr('data-prompt-target') !== 'undefined' && $('#' + field.attr('data-prompt-target')).length > 0) { + prompt.appendTo($('#' + field.attr('data-prompt-target'))); + } else { + field.after(prompt); + } + } else { + field.before(prompt); + } + + pos = methods._calculatePosition(field, prompt, options); + // Support RTL layouts by @yasser_lotfy ( Yasser Lotfy ) + if ($('body').hasClass('rtl')) { + prompt.css({ + 'position': positionType === 'inline' ? 'relative' : 'absolute', + "top": pos.callerTopPosition, + "left": "initial", + "right": pos.callerleftPosition, + "marginTop": pos.marginTopSize, + "opacity": 0 + }).data("callerField", field); + } else { + prompt.css({ + 'position': positionType === 'inline' ? 'relative' : 'absolute', + "top": pos.callerTopPosition, + "left": pos.callerleftPosition, + "right": "initial", + "marginTop": pos.marginTopSize, + "opacity": 0 + }).data("callerField", field); + } + + + if (options.autoHidePrompt) { + setTimeout(function () { + prompt.animate({ + "opacity": 0 + }, function () { + prompt.closest('.formError').remove(); + }); + }, options.autoHideDelay); + } + return prompt.animate({ + "opacity": 0.87 + }); + }, + /** + * Updates the prompt text field - the field for which the prompt + * @param {jqObject} field + * @param {String} promptText html text to display type + * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) + * @param {boolean} ajaxed - use to mark fields than being validated with ajax + * @param {Map} options user options + */ + _updatePrompt: function (field, prompt, promptText, type, ajaxed, options, noAnimation) { + + if (prompt) { + if (typeof type !== "undefined") { + if (type == "pass") + prompt.addClass("greenPopup"); + else + prompt.removeClass("greenPopup"); + + if (type == "load") + prompt.addClass("blackPopup"); + else + prompt.removeClass("blackPopup"); + } + if (ajaxed) + prompt.addClass("ajaxed"); + else + prompt.removeClass("ajaxed"); + + prompt.find(".formErrorContent").html(promptText); + + var pos = methods._calculatePosition(field, prompt, options); + // Support RTL layouts by @yasser_lotfy ( Yasser Lotfy ) + var css; + if ($('body').hasClass('rtl')) { + css = { + "top": pos.callerTopPosition, + "left": "initial", + "right": pos.callerleftPosition, + "marginTop": pos.marginTopSize, + "opacity": 0.87 + }; + } else { + css = { + "top": pos.callerTopPosition, + "left": pos.callerleftPosition, + "right": "initial", + "marginTop": pos.marginTopSize, + "opacity": 0.87 + }; + } + + prompt.css({ + "opacity": 0, + "display": "block" + }); + + if (noAnimation) + prompt.css(css); + else + prompt.animate(css); + } + }, + /** + * Closes the prompt associated with the given field + * + * @param {jqObject} + * field + */ + _closePrompt: function (field) { + var prompt = methods._getPrompt(field); + if (prompt) + prompt.fadeTo("fast", 0, function () { + prompt.closest('.formError').remove(); + }); + }, + closePrompt: function (field) { + return methods._closePrompt(field); + }, + /** + * Returns the error prompt matching the field if any + * + * @param {jqObject} + * field + * @return undefined or the error prompt (jqObject) + */ + _getPrompt: function (field) { + var formId = $(field).closest('form, .validationEngineContainer').attr('id'); + var className = methods._getClassName(field.attr("id")) + "formError"; + var match = $("." + methods._escapeExpression(className) + '.parentForm' + methods._getClassName(formId))[0]; + if (match) + return $(match); + }, + /** + * Returns the escapade classname + * + * @param {selector} + * className + */ + _escapeExpression: function (selector) { + return selector.replace(/([#;&,\.\+\*\~':"\!\^$\[\]\(\)=>\|])/g, "\\$1"); + }, + /** + * returns true if we are in a RTLed document + * + * @param {jqObject} field + */ + isRTL: function (field) { + var $document = $(document); + var $body = $('body'); + var rtl = + (field && field.hasClass('rtl')) || + (field && (field.attr('dir') || '').toLowerCase() === 'rtl') || + $document.hasClass('rtl') || + ($document.attr('dir') || '').toLowerCase() === 'rtl' || + $body.hasClass('rtl') || + ($body.attr('dir') || '').toLowerCase() === 'rtl'; + return Boolean(rtl); + }, + /** + * Calculates prompt position + * + * @param {jqObject} + * field + * @param {jqObject} + * the prompt + * @param {Map} + * options + * @return positions + */ + _calculatePosition: function (field, promptElmt, options) { + + var promptTopPosition, promptleftPosition, marginTopSize; + var fieldWidth = field.width(); + var fieldLeft = field.position().left; + var fieldTop = field.position().top; + var fieldHeight = field.height(); + var promptHeight = promptElmt.height(); + + + // is the form contained in an overflown container? + promptTopPosition = promptleftPosition = 0; + // compensation for the arrow + marginTopSize = -promptHeight; + + + //prompt positioning adjustment support + //now you can adjust prompt position + //usage: positionType:Xshift,Yshift + //for example: + // bottomLeft:+20 means bottomLeft position shifted by 20 pixels right horizontally + // topRight:20, -15 means topRight position shifted by 20 pixels to right and 15 pixels to top + //You can use +pixels, - pixels. If no sign is provided than + is default. + var positionType = field.data("promptPosition") || options.promptPosition; + var shift1 = ""; + var shift2 = ""; + var shiftX = 0; + var shiftY = 0; + if (typeof (positionType) == 'string') { + //do we have any position adjustments ? + if (positionType.indexOf(":") != -1) { + shift1 = positionType.substring(positionType.indexOf(":") + 1); + positionType = positionType.substring(0, positionType.indexOf(":")); + + //if any advanced positioning will be needed (percents or something else) - parser should be added here + //for now we use simple parseInt() + + //do we have second parameter? + if (shift1.indexOf(",") != -1) { + shift2 = shift1.substring(shift1.indexOf(",") + 1); + shift1 = shift1.substring(0, shift1.indexOf(",")); + shiftY = parseInt(shift2); + if (isNaN(shiftY)) shiftY = 0; + } + + shiftX = parseInt(shift1); + if (isNaN(shift1)) shift1 = 0; + + } + } + + + switch (positionType) { + default: + case "topRight": + promptleftPosition += fieldLeft + fieldWidth - 27; + promptTopPosition += fieldTop; + break; + + case "topLeft": + promptTopPosition += fieldTop; + promptleftPosition += fieldLeft; + break; + + case "centerRight": + promptTopPosition = fieldTop + 4; + marginTopSize = 0; + promptleftPosition = fieldLeft + field.outerWidth(true) + 5; + break; + case "centerLeft": + promptleftPosition = fieldLeft - (promptElmt.width() + 2); + promptTopPosition = fieldTop + 4; + marginTopSize = 0; + + break; + + case "bottomLeft": + promptTopPosition = fieldTop + field.height() + 5; + marginTopSize = 0; + promptleftPosition = fieldLeft; + break; + case "bottomRight": + promptleftPosition = fieldLeft + fieldWidth - 27; + promptTopPosition = fieldTop + field.height() + 5; + marginTopSize = 0; + break; + case "inline": + promptleftPosition = 0; + promptTopPosition = 0; + marginTopSize = 0; + } + + + + //apply adjusments if any + promptleftPosition += shiftX; + promptTopPosition += shiftY; + + return { + "callerTopPosition": promptTopPosition + "px", + "callerleftPosition": promptleftPosition + "px", + "marginTopSize": marginTopSize + "px" + }; + }, + /** + * Saves the user options and variables in the form.data + * + * @param {jqObject} + * form - the form where the user option should be saved + * @param {Map} + * options - the user options + * @return the user options (extended from the defaults) + */ + _saveOptions: function (form, options) { + + // is there a language localisation ? + if ($.validationEngineLanguage) + var allRules = $.validationEngineLanguage.allRules; + else + $.error("jQuery.validationEngine rules are not loaded, plz add localization files to the page"); + // --- Internals DO NOT TOUCH or OVERLOAD --- + // validation rules and i18 + $.validationEngine.defaults.allrules = allRules; + + var userOptions = $.extend(true, {}, $.validationEngine.defaults, options); + + form.data('jqv', userOptions); + return userOptions; + }, + + /** + * Removes forbidden characters from class name + * @param {String} className + */ + _getClassName: function (className) { + if (className) + return className.replace(/:/g, "_").replace(/\./g, "_"); + }, + /** + * Escape special character for jQuery selector + * http://totaldev.com/content/escaping-characters-get-valid-jquery-id + * @param {String} selector + */ + _jqSelector: function (str) { + return str.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); + }, + /** + * Conditionally required field + * + * @param {jqObject} field + * @param {Array[String]} rules + * @param {int} i rules index + * @param {Map} + * user options + * @return an error string if validation failed + */ + _condRequired: function (field, rules, i, options) { + var idx, dependingField; + + for (idx = (i + 1); idx < rules.length; idx++) { + dependingField = jQuery("#" + rules[idx]).first(); + + /* Use _required for determining wether dependingField has a value. + * There is logic there for handling all field types, and default value; so we won't replicate that here + * Indicate this special use by setting the last parameter to true so we only validate the dependingField on chackboxes and radio buttons (#462) + */ + if (dependingField.length && methods._required(dependingField, ["required"], 0, options, true) == undefined) { + /* We now know any of the depending fields has a value, + * so we can validate this field as per normal required code + */ + return methods._required(field, ["required"], 0, options); + } + } + }, + + _submitButtonClick: function (event) { + var button = $(this); + var form = button.closest('form, .validationEngineContainer'); + form.data("jqv_submitButton", button.attr("id")); + } + }; + + /** + * Plugin entry point. + * You may pass an action as a parameter or a list of options. + * if none, the init and attach methods are being called. + * Remember: if you pass options, the attached method is NOT called automatically + * + * @param {String} + * method (optional) action + */ + $.fn.validationEngine = function (method) { + + var form = $(this); + if (!form[0]) return form; // stop here if the form does not exist + + if (typeof (method) == 'string' && method.charAt(0) != '_' && methods[method]) { + + // make sure init is called once + if (method != "showPrompt" && method != "hide" && method != "hideAll") + methods.init.apply(form); + + return methods[method].apply(form, Array.prototype.slice.call(arguments, 1)); + } else if (typeof method == 'object' || !method) { + + // default constructor with or without arguments + methods.init.apply(form, arguments); + return methods.attach.apply(form); + } else { + $.error('Method ' + method + ' does not exist in jQuery.validationEngine'); + } + }; + + + + // LEAK GLOBAL OPTIONS + $.validationEngine = { + fieldIdCounter: 0, defaults: { + + // Name of the event triggering field validation + validationEventTrigger: "blur", + // Automatically scroll viewport to the first error + scroll: true, + // Focus on the first input + focusFirstField: true, + // Show prompts, set to false to disable prompts + showPrompts: true, + // Should we attempt to validate non-visible input fields contained in the form? (Useful in cases of tabbed containers, e.g. jQuery-UI tabs) + validateNonVisibleFields: false, + // ignore the validation for fields with this specific class (Useful in cases of tabbed containers AND hidden fields we don't want to validate) + ignoreFieldsWithClass: 'ignoreMe', + // Opening box position, possible locations are: topLeft, + // topRight, bottomLeft, centerRight, bottomRight, inline + // inline gets inserted after the validated field or into an element specified in data-prompt-target + promptPosition: "topRight", + bindMethod: "bind", + // internal, automatically set to true when it parse a _ajax rule + inlineAjax: false, + // if set to true, the form data is sent asynchronously via ajax to the form.action url (get) + ajaxFormValidation: false, + // The url to send the submit ajax validation (default to action) + ajaxFormValidationURL: false, + // HTTP method used for ajax validation + ajaxFormValidationMethod: 'get', + // Ajax form validation callback method: boolean onComplete(form, status, errors, options) + // retuns false if the form.submit event needs to be canceled. + onAjaxFormComplete: $.noop, + // called right before the ajax call, may return false to cancel + onBeforeAjaxFormValidation: $.noop, + // Stops form from submitting and execute function assiciated with it + onValidationComplete: false, + + // Used when you have a form fields too close and the errors messages are on top of other disturbing viewing messages + doNotShowAllErrosOnSubmit: false, + // Object where you store custom messages to override the default error messages + custom_error_messages: {}, + // true if you want to validate the input fields on blur event + binded: true, + // set to true if you want to validate the input fields on blur only if the field it's not empty + notEmpty: false, + // set to true, when the prompt arrow needs to be displayed + showArrow: true, + // set to false, determines if the prompt arrow should be displayed when validating + // checkboxes and radio buttons + showArrowOnRadioAndCheckbox: false, + // did one of the validation fail ? kept global to stop further ajax validations + isError: false, + // Limit how many displayed errors a field can have + maxErrorsPerField: false, + + // Caches field validation status, typically only bad status are created. + // the array is used during ajax form validation to detect issues early and prevent an expensive submit + ajaxValidCache: {}, + // Auto update prompt position after window resize + autoPositionUpdate: false, + + InvalidFields: [], + onFieldSuccess: false, + onFieldFailure: false, + onSuccess: false, + onFailure: false, + validateAttribute: "class", + addSuccessCssClassToField: "", + addFailureCssClassToField: "", + + // Auto-hide prompt + autoHidePrompt: false, + // Delay before auto-hide + autoHideDelay: 10000, + // Fade out duration while hiding the validations + fadeDuration: 300, + // Use Prettify select library + prettySelect: false, + // Add css class on prompt + addPromptClass: "", + // Custom ID uses prefix + usePrefix: "", + // Custom ID uses suffix + useSuffix: "", + // Only show one message per error prompt + showOneMessage: false + } + }; + $(function () { $.validationEngine.defaults.promptPosition = methods.isRTL() ? 'topLeft' : "topRight" }); +})(jQuery); diff --git a/src/assets/plugins/jQuery-Validation-Engine/js/languages/jquery.validationEngine-zh_CN.js b/src/assets/plugins/jQuery-Validation-Engine/js/languages/jquery.validationEngine-zh_CN.js new file mode 100644 index 0000000..9435674 --- /dev/null +++ b/src/assets/plugins/jQuery-Validation-Engine/js/languages/jquery.validationEngine-zh_CN.js @@ -0,0 +1,181 @@ +(function ($) { + $.fn.validationEngineLanguage = function () { + }; + $.validationEngineLanguage = { + newLang: function () { + $.validationEngineLanguage.allRules = { + "required": { // Add your regex rules here, you can take telephone as an example + "regex": "none", + "alertText": "* 此处不可空白", + "alertTextCheckboxMultiple": "* 请选择一个项目", + "alertTextCheckboxe": "* 您必须钩选此栏", + "alertTextDateRange": "* 日期范围不可空白" + }, + "requiredInFunction": { + "func": function (field, rules, i, options) { + return (field.val() == "test") ? true : false; + }, + "alertText": "* Field must equal test" + }, + "dateRange": { + "regex": "none", + "alertText": "* 无效的 ", + "alertText2": " 日期范围" + }, + "dateTimeRange": { + "regex": "none", + "alertText": "* 无效的 ", + "alertText2": " 时间范围" + }, + "minSize": { + "regex": "none", + "alertText": "* 最少 ", + "alertText2": " 个字符" + }, + "maxSize": { + "regex": "none", + "alertText": "* 最多 ", + "alertText2": " 个字符" + }, + "groupRequired": { + "regex": "none", + "alertText": "* 你必需选填其中一个栏位" + }, + "min": { + "regex": "none", + "alertText": "* 最小值為 " + }, + "max": { + "regex": "none", + "alertText": "* 最大值为 " + }, + "past": { + "regex": "none", + "alertText": "* 日期必需早于 " + }, + "future": { + "regex": "none", + "alertText": "* 日期必需晚于 " + }, + "maxCheckbox": { + "regex": "none", + "alertText": "* 最多选取 ", + "alertText2": " 个项目" + }, + "minCheckbox": { + "regex": "none", + "alertText": "* 请选择 ", + "alertText2": " 个项目" + }, + "equals": { + "regex": "none", + "alertText": "* 请输入与上面相同的密码" + }, + "creditCard": { + "regex": "none", + "alertText": "* 无效的信用卡号码" + }, + "phone": { + // credit: jquery.h5validate.js / orefalo + "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, + "alertText": "* 无效的电话号码" + }, + "email": { + // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ + "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, + "alertText": "* 邮件地址无效" + }, + "integer": { + "regex": /^[\-\+]?\d+$/, + "alertText": "* 不是有效的整数" + }, + "number": { + // Number, including positive, negative, and floating decimal. credit: orefalo + "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, + "alertText": "* 无效的数字" + }, + "date": { + "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, + "alertText": "* 无效的日期,格式必需为 YYYY-MM-DD" + }, + "ipv4": { + "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, + "alertText": "* 无效的 IP 地址" + }, + "url": { + "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, + "alertText": "* Invalid URL" + }, + "onlyNumberSp": { + "regex": /^[0-9\ ]+$/, + "alertText": "* 只能填数字" + }, + "onlyLetterSp": { + "regex": /^[a-zA-Z\ \']+$/, + "alertText": "* 只接受英文字母大小写" + }, + "onlyLetterAccentSp": { + "regex": /^[a-z\u00C0-\u017F\ ]+$/i, + "alertText": "* 只接受英文字母大小写" + }, + "onlyLetterNumber": { + "regex": /^[0-9a-zA-Z]+$/, + "alertText": "* 不接受特殊字符" + }, + // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings + "ajaxUserCall": { + "url": "ajaxValidateFieldUser", + // you may want to pass extra data on the ajax call + "extraData": "name=eric", + "alertText": "* 此名称已被其他人使用", + "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" + }, + "ajaxUserCallPhp": { + "url": "phpajax/ajaxValidateFieldUser.php", + // you may want to pass extra data on the ajax call + "extraData": "name=eric", + // if you provide an "alertTextOk", it will show as a green prompt when the field validates + "alertTextOk": "* 此帐号名称可以使用", + "alertText": "* 此名称已被其他人使用", + "alertTextLoad": "* 正在确认帐号名称是否有其他人使用,请稍等。" + }, + "ajaxNameCall": { + // remote json service location + "url": "ajaxValidateFieldName", + // error + "alertText": "* 此名称可以使用", + // if you provide an "alertTextOk", it will show as a green prompt when the field validates + "alertTextOk": "* 此名称已被其他人使用", + // speaks by itself + "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" + }, + "ajaxNameCallPhp": { + // remote json service location + "url": "phpajax/ajaxValidateFieldName.php", + // error + "alertText": "* 此名称已被其他人使用", + // speaks by itself + "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" + }, + "validate2fields": { + "alertText": "* 请输入 HELLO" + }, + //tls warning:homegrown not fielded + "dateFormat": { + "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, + "alertText": "* 无效的日期格式" + }, + //tls warning:homegrown not fielded + "dateTimeFormat": { + "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/, + "alertText": "* 无效的日期或时间格式", + "alertText2": "可接受的格式: ", + "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM 或 ", + "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" + } + }; + + } + }; + $.validationEngineLanguage.newLang(); +})(jQuery); diff --git a/src/components/header/index.vue b/src/components/header/index.vue index 26cbee0..eff7631 100644 --- a/src/components/header/index.vue +++ b/src/components/header/index.vue @@ -29,8 +29,7 @@

{{ username }} - 上次登录:{{ lastTime }} + 上次登录:{{ lastTime }}

@@ -69,7 +68,6 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/maintainer/index.vue b/src/components/maintainer/index.vue index bc102f6..4efb687 100644 --- a/src/components/maintainer/index.vue +++ b/src/components/maintainer/index.vue @@ -41,7 +41,8 @@