修复上传组件问题

This commit is contained in:
liaozetao
2023-09-27 17:51:32 +08:00
parent dadc1a4859
commit 87dc9b0470
6 changed files with 1303 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -80,8 +80,6 @@
<script> <script>
import store from '@/store'; import store from '@/store';
import { notifyNotice } from '@/utils/notify';
export default { export default {
name: 'MaintainerView', name: 'MaintainerView',
data() { data() {
@@ -99,7 +97,6 @@ export default {
}; };
}, },
created() { created() {
notifyNotice();
this.getMenu(); this.getMenu();
this.username = store.getters.username; this.username = store.getters.username;
this.avatar = store.getters.avatar; this.avatar = store.getters.avatar;

View File

@@ -21,6 +21,8 @@ import 'bootstrap-table/dist/bootstrap-table.js'
import 'bootstrap-table/dist/locale/bootstrap-table-zh-CN.js' import 'bootstrap-table/dist/locale/bootstrap-table-zh-CN.js'
import 'bootstrap-table/dist/extensions/editable/bootstrap-table-editable.js' import 'bootstrap-table/dist/extensions/editable/bootstrap-table-editable.js'
import '@/assets/plugins/jquery/jquery.form.js'
import '@/assets/plugins/bootstrap-datepicker/css/datepicker3.css' import '@/assets/plugins/bootstrap-datepicker/css/datepicker3.css'
import '@/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js' import '@/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js'

View File

@@ -13,9 +13,9 @@ jQuery.extend({
createUploadIframe: function (id, uri) { createUploadIframe: function (id, uri) {
//create frame //create frame
var frameId = 'jUploadFrame' + id; var frameId = 'jUploadFrame' + id;
var io;
if (window.ActiveXObject) { if (window.ActiveXObject) {
io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
if (typeof uri == 'boolean') { if (typeof uri == 'boolean') {
io.src = 'javascript:false'; io.src = 'javascript:false';
} }
@@ -59,6 +59,7 @@ jQuery.extend({
s = jQuery.extend({}, jQuery.ajaxSettings, s); s = jQuery.extend({}, jQuery.ajaxSettings, s);
var id = s.fileElementId; var id = s.fileElementId;
var form = jQuery.createUploadForm(id, s.fileElementId); var form = jQuery.createUploadForm(id, s.fileElementId);
var io = jQuery.createUploadIframe(id, s.secureuri);
var frameId = 'jUploadFrame' + id; var frameId = 'jUploadFrame' + id;
var formId = 'jUploadForm' + id; var formId = 'jUploadForm' + id;
// Watch for a new set of requests // Watch for a new set of requests
@@ -72,7 +73,7 @@ jQuery.extend({
jQuery.event.trigger("ajaxSend", [xml, s]); jQuery.event.trigger("ajaxSend", [xml, s]);
// Wait for a response to come back // Wait for a response to come back
var uploadCallback = function (isTimeout) { var uploadCallback = function (isTimeout) {
var io = document.getElementById(frameId); io = document.getElementById(frameId);
try { try {
if (io.contentWindow) { if (io.contentWindow) {
xml.responseText = io.contentWindow.document.body ? io.contentWindow.document.body.innerHTML : null; xml.responseText = io.contentWindow.document.body ? io.contentWindow.document.body.innerHTML : null;
@@ -145,6 +146,7 @@ jQuery.extend({
}, s.timeout); }, s.timeout);
} }
try { try {
// var io = $('#' + frameId);
form = $('#' + formId); form = $('#' + formId);
$(form).attr('action', s.url); $(form).attr('action', s.url);
$(form).attr('method', 'POST'); $(form).attr('method', 'POST');
@@ -173,23 +175,32 @@ jQuery.extend({
uploadHttpData: function (r, type) { uploadHttpData: function (r, type) {
var data = !type; var data = !type;
data = type == "xml" || data ? r.responseXML : r.responseText; data = type == "xml" || data ? r.responseXML : r.responseText;
console.log(data);
// If the type is "script", eval it in global context // If the type is "script", eval it in global context
if (type == "script") if (type == "script")
jQuery.globalEval(data); jQuery.globalEval(data);
// Get the JavaScript object, if JSON is used. // Get the JavaScript object, if JSON is used.
if (type == "json") if (type == "json")
data = r.responseText; data = r.responseText;
var temp;
var start = data.indexOf(">"); var start = data.indexOf(">");
if (start != -1) { if (start != -1) {
var end = data.indexOf("<", start + 1); let end = data.indexOf("<", start + 1);
if (end != -1) { if (end != -1) {
data = data.substring(start + 1, end); temp = data.substring(start + 1, end);
} }
} }
if (!temp) {
start = data.indexOf("{");
temp = data.substring(start, data.lastIndexOf("}") + 1);
}
data = temp;
eval("data = " + data); eval("data = " + data);
// evaluate scripts within html // evaluate scripts within html
if (type == "html") if (type == "html")
jQuery("<div>").html(data).evalScripts(); jQuery("<div>").html(data).evalScripts();
//alert($('param', data).each(function(){alert($(this).attr('value'));}));
return data; return data;
} }
}) })

View File

@@ -25,7 +25,9 @@ $.ajaxSetup({
console.log(xhr); console.log(xhr);
}, },
complete: function(xhr) { complete: function(xhr) {
userLogout(xhr.getResponseHeader(global.NEED_LOGOUT)); if (xhr && typeof(xhr.getResponseHeader) == 'function') {
userLogout(xhr.getResponseHeader(global.NEED_LOGOUT));
}
} }
}); });

View File

@@ -142,7 +142,6 @@ function getAfterMin(date) {
return date; return date;
} }
ComboboxHelper.build('/admin/monsterKind/getAll.action', '#monsterKindId', "0");
//ComboboxHelper.build(null, '#monsterStatus'); //ComboboxHelper.build(null, '#monsterStatus');
//ComboboxHelper.build(null, '#notifyType'); //ComboboxHelper.build(null, '#notifyType');
export default { export default {
@@ -158,6 +157,7 @@ export default {
methods: { methods: {
initData() { initData() {
$(function () { $(function () {
ComboboxHelper.build('/admin/monsterKind/getAll.action', '#monsterKindId', "0");
$('#table').bootstrapTable('destroy'); $('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({ $('#table').bootstrapTable({
columns: [ columns: [