修复上传组件问题

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>
import store from '@/store';
import { notifyNotice } from '@/utils/notify';
export default {
name: 'MaintainerView',
data() {
@@ -99,7 +97,6 @@ export default {
};
},
created() {
notifyNotice();
this.getMenu();
this.username = store.getters.username;
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/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/js/bootstrap-datepicker.js'

View File

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

View File

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

View File

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