Files
journal_com/js/contribu.js
wangjinlei 6e7ee3dd44 begin
2023-05-18 09:42:12 +08:00

930 lines
32 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 登录
function contribu_login() {
// 获取地址栏信息
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
var Spe_id = getQueryString('special_id'); //客座id
$(".spa_").text('');
var add_mess = {};
add_mess.username = $('#username_').val();
add_mess.password = $('#password_').val();
$("input[type='text']").blur(function () {
if ($(this).is("#username_")) {
if ($("#username_").val() != "") {
$(".spa1").text("");
}
}
})
$("input[type='password']").blur(function () {
if ($(this).is("#password_")) {
if ($("#password_").val() != "") {
$(".spa2").text("");
}
}
})
var S_Dan = '0';
if ($("#username_").val() == "") {
$(".spa1").text('Please fill in username');
S_Dan = '1';
}
if ($("#password_").val() == "") {
$(".spa2").text('Please fill in password');
S_Dan = '1';
}
if (S_Dan == '1') {
ShowDanger("Incomplete information");
} else {
$(".sub_guest").addClass("disable");
setTimeout(function () {
$(".sub_guest").removeClass("disable");
}, 2000);
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/checkLogin',
data: add_mess,
success: function (result) {
if (result.code == 0) {
$.cookie('username', result.userinfo.account, {expires: 3})
// $.cookie('password', result.userinfo.password, {expires: 3})
$.cookie('user_id', result.userinfo.user_id, {expires: 3})
ShowSuccess("Successful login");
setTimeout(function () {
window.location.href = 'contribu_list.html?J_num=' + Jour_num + '&&special_id=' + Spe_id;
}, 1500);
} else {
ShowDanger("Fail login");
}
},
error: function () {
ShowDanger("error");
}
})
}
}
// 注册
function contribu_regist() {
$(".spa").text('');
var regust_mess = {};
regust_mess.username = $('#username').val();
regust_mess.password = $('#password').val();
regust_mess.realname = $('#realname').val();
regust_mess.phone = $('#phone').val();
regust_mess.email = $('#email').val();
$("input[type='text']").blur(function () {
if ($(this).is("#username")) {
if ($("#username").val() != "") {
$(".spa3").text("");
}
}
// if($(this).is("#realname")){
// if($("#realname").val()!="") {$(".spa5").text("");}
// }
// if($(this).is("#phone")){
// if($("#phone").val()!="") {$(".spa6").text("");}
// }
if ($(this).is("#email")) {
if ($("#email").val() != "") {
$(".spa7").text("");
}
}
})
$("input[type='password']").blur(function () {
if ($(this).is("#password")) {
if ($("#password").val() != "") {
$(".spa4").text("");
}
}
})
var S_Dan = '0';
if ($("#username").val() == "") {
$(".spa3").text('Please fill in username');
S_Dan = '1';
}
if (!(/^(\w){6,}$/.test($("#password").val())) || $("#password").val() == "") {
$(".spa4").text('Not less than six digits password');
S_Dan = '1';
}
// if ($("#realname").val() == "") {
// $(".spa5").text('Please fill in realname');
// S_Dan = '1';
// }
// if (!(/^1[0-9]{10}$/.test($("#phone").val()))||$("#phone").val() == ""){
// $(".spa6").text('Please fill in correct format phone');
// S_Dan = '1';
// }
if (!(/^[A-Za-z0-9_\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test($("#email").val())) || $("#email").val() == "") {
$(".spa7").text('Please fill in correct format email');
S_Dan = '1';
}
if (S_Dan == '1') {
ShowDanger("Incomplete information");
} else {
$(".sub_guest").addClass("disable");
setTimeout(function () {
$(".sub_guest").removeClass("disable");
}, 2000);
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/register',
data: regust_mess,
success: function (result) {
if (result.account != undefined) {
ShowSuccess("Register successfully");
setTimeout(function () {
window.location.reload();
}, 1500);
} else {
ShowDanger(result);
// ShowDanger("Request fail");
}
},
error: function () {
ShowDanger("error");
}
})
}
}
function contribu_list() {
// 获取地址栏信息
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
var Spe_id = getQueryString('special_id'); //客座id
// 退出登录
$('.contbu_list .contb_user a').click(function () {
window.location.href = 'contribu_login.html?J_num=' + Jour_num + '&&special_id=' + Spe_id;
$.cookie('username', '', {expires: -1});
// $.cookie('password', '', { expires: -1 });
$.cookie('user_id', '', {expires: -1});
})
// 判断是否有身份
if ($.cookie("username") != undefined && $.cookie("user_id") != undefined) {
} else {
window.location.href = 'contribu_login.html?J_num=' + Jour_num + '&&special_id=' + Spe_id;
}
var spe = ''
$.ajax({
type: 'post', url: apiUrl + 'subscribe/Special/getSpecialDetail',
data: {'journal_special_id': Spe_id},
success: function (result) {
if (result.code == 0) {
localStorage.setItem("special_time", result.data.special.deadline);
}
},
error: function () {
ShowDanger("error");
}
})
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/getArticles',
data: {'special_id': Spe_id, 'user_id': $.cookie('user_id')},
success: function (result) {
if (result.code == 0) {
var arr = result.data.articles.articles;
var str = "";
for (var i = 0; i < arr.length; i++) {
if (arr[i].type == 'A') {
arr[i].type = 'Article'
}
if (arr[i].type == 'B') {
arr[i].type = 'Review'
}
if (arr[i].type == 'C') {
arr[i].type = 'Case report'
}
if (arr[i].type == 'M') {
arr[i].type = 'Meta-analysis'
}
if (arr[i].type == 'P') {
arr[i].type = 'Research proposal'
}
if (arr[i].type == 'N') {
arr[i].type = 'News'
}
if (arr[i].type == 'T') {
arr[i].type = 'Comment'
}
if (arr[i].type == 'O') {
arr[i].type = 'Others'
}
if (Jour_num == '22') {
str += '<li><div><div class="ct_type">' + arr[i].type + '</div>' +
'<div style="float: right">' + formatTimeToDate4(arr[i].ctime * 1000) + '</div><br clear="both"></div>' +
'<p>' + arr[i].title + '<a href="https://submission.tmrjournals.com/" class="rgb_color" target="_blank">' +
'<i class="fa fa-hand-o-right"></i>&nbsp;投稿系统</a></p></li>'
}
str += '<li><div><div class="ct_type">' + arr[i].type + '</div>' +
'<div style="float: right">' + formatTimeToDate4(arr[i].ctime * 1000) + '</div><br clear="both"></div>' +
'<p>' + arr[i].title + '<a href="https://submission.tmrjournals.com/" class="rgb_color" target="_blank">' +
'<i class="fa fa-hand-o-right"></i>&nbsp;Submission System</a></p></li>'
}
$('.contbu_listcon').html(str);
$('.contbu_listcon .ct_type').css('background-color', localStorage.Journals_color);
if (Jour_num == '22') {
var l_t = '<div class="gue_system"><a target="_blank">提交文件</a></div>';
} else {
var l_t = '<div class="gue_system"><a target="_blank">Submit Article</a></div>';
}
$('.contbu_list .contbu_listcon').append(l_t);
$('.contbu_listcon .gue_system a').css('background-color', localStorage.Journals_color);
// if(Date.parse(new Date(localStorage.special_time)) < Date.parse(new Date())){
// $('.contbu_listcon .gue_system a').css({'background-color':'#b7b7b7','pointer-events':'none','cursor': 'not-allowed'});
// $('.contbu_listcon .gue_system a').after('<br><span style="background-color: #fff;color: #bbb">(The time has expired)</span>')
// }
$('.contbu_listcon .gue_system a').click(function () {
// 判断是否有身份
if ($.cookie("username") != undefined && $.cookie("user_id") != undefined) {
window.open('contribu_form.html?J_num=' + Jour_num + '&&special_id=' + Spe_id);
} else {
window.open('contribu_login.html?J_num=' + Jour_num + '&&special_id=' + Spe_id);
}
})
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
});
}
function contbu_submit() {
// 获取地址栏信息
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
var Spe_id = getQueryString('special_id'); //客座id
$('.my_file>div').css('background-color', localStorage.Journals_color);
// 退出登录
$('.contbu_submit .contb_user a').click(function () {
window.location.href = 'contribu_login.html?J_num=' + Jour_num + '&&special_id=' + Spe_id;
$.cookie('username', '', {expires: -1});
// $.cookie('password', '', { expires: -1 });
$.cookie('user_id', '', {expires: -1});
})
// 判断是否有身份
if ($.cookie("username") != undefined && $.cookie("user_id") != undefined) {
} else {
window.location.href = 'contribu_login.html?J_num=' + Jour_num + '&&special_id=' + Spe_id;
}
// 文章领域中英文
if (Jour_num == '22') {
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/getMajor',
success: function (result) {
if (result.code == 0) {
var arr = result.data;
var str = "";
for (var i = 0; i < arr.length; i++) {
str += '<option value="' + arr[i].major_id + '">' + arr[i].title + ' ' + arr[i].ctitle + '</option>'
}
$("select[name='major']").html(str);
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
});
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/majorChild',
data: {'majorid': '1'},
success: function (result) {
if (result.code == 0) {
var arr = result.data;
var str = "";
for (var i = 0; i < arr.length; i++) {
str += '<option value="' + arr[i].major_id + '">' + arr[i].title + ' ' + arr[i].ctitle + '</option>'
}
$("select[name='cmajor']").html(str);
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
} else {
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/getMajor',
success: function (result) {
if (result.code == 0) {
var arr = result.data;
var str = "";
for (var i = 0; i < arr.length; i++) {
str += '<option value="' + arr[i].major_id + '">' + arr[i].title + '</option>'
}
$("select[name='major']").html(str);
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
});
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/majorChild',
data: {'majorid': '1'},
success: function (result) {
if (result.code == 0) {
var arr = result.data;
var str = "";
for (var i = 0; i < arr.length; i++) {
str += '<option value="' + arr[i].major_id + '">' + arr[i].title + '</option>'
}
$("select[name='cmajor']").html(str);
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
}
title_country();
}
function title_country() {
if (Jour_num == '22') {
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/getCountrys',
success: function (result) {
var str = "";
for (var i = 0; i < result.length; i++) {
str += '<option value="' + result[i].en_name + '">' + result[i].en_name + ' ' + result[i].zh_name + '</option>'
}
$("select[name='country']").html(str);
},
error: function () {
ShowDanger("error");
}
})
} else {
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/getCountrys',
success: function (result) {
var str = "";
for (var i = 0; i < result.length; i++) {
str += '<option value="' + result[i].en_name + '">' + result[i].en_name + '</option>'
}
$("select[name='country']").html(str);
},
error: function () {
ShowDanger("error");
}
})
}
}
// 级联菜单
$("select[name='major']").change(function () {
var major_val = $(this).find("option:selected").val()
if (Jour_num == '22') {
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/majorChild',
data: {'majorid': major_val},
success: function (result) {
if (result.code == 0) {
var arr = result.data;
var str = "";
for (var i = 0; i < arr.length; i++) {
str += '<option value="' + arr[i].major_id + '">' + arr[i].title + ' ' + arr[i].ctitle + '</option>'
}
$("select[name='cmajor']").html(str);
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
} else {
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/majorChild',
data: {'majorid': major_val},
success: function (result) {
if (result.code == 0) {
var arr = result.data;
var str = "";
for (var i = 0; i < arr.length; i++) {
str += '<option value="' + arr[i].major_id + '">' + arr[i].title + '</option>'
}
$("select[name='cmajor']").html(str);
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
}
})
// 协议遮罩层
$(".res_pon").click(function () {
$("#mask").css("height", $(document).height());
$("#mask").css("width", $(document).width());
$("#mask").show();
$(".tanchu").fadeIn();
});
$("#mask").click(function () {
$("#mask").hide();
$(".tanchu").fadeOut();
});
$(".close").click(function () {
$("#mask").hide();
$(".tanchu").fadeOut();
});
// 作者添加
$('.author_add').click(function () {
if (Jour_num == '22') {
var form_author = '<form><h3><b>作者 <b class="author_num">1</b></b>' +
'<a class="author_delete">- 删除</a></h3>' +
'<label>姓名: <b>*</b></label><input type="text" name="firstname" style="width: 180px"/>' +
'<input type="text" name="lastname" style="width: 180px"/><span class="spa"></span><br>' +
'<label style="width: 120px"></label><span>第一作者 </span>' +
'<input type="checkbox" name="isSuper" value="1" style="margin-left: 10px"><br>' +
'<label style="width: 120px"></label><span>通讯作者 </span>' +
'<input type="checkbox" name="isReport" value="1" style="margin-left: 10px"><br>\n' +
'<label>邮箱: <b>*</b></label><input type="text" name="email"/><span class="spa"></span><br>\n' +
'<label>单位: <b>*</b></label><input type="text" name="company"/><span class="spa"></span><br>\n' +
'<label>部门: </label><input type="text" name="department"/><span class="spa"></span><br>\n' +
'<label>职称: </label><select name="title">' +
'<option value="Prof.">教授</option><option value="Associate Prof.">副教授</option>' +
'<option value="Assistant Prof.">助理教授</option><option value="Ph.D.">博士</option>' +
'<option value="Others">其他</option></select><br><label>国家: </label>' +
'<select name="country"></select></form>'
} else {
var form_author = '<form><h3><b>Author <b class="author_num">1</b></b>' +
'<a class="author_delete">- delete</a></h3>' +
'<label>Name: <b>*</b></label><input type="text" name="firstname" style="width: 180px"/>' +
'<input type="text" name="lastname" style="width: 180px"/><span class="spa"></span><br>' +
'<label style="width: 120px"></label><span>First author </span>' +
'<input type="checkbox" name="isSuper" value="1" style="margin-left: 10px"><br>' +
'<label style="width: 120px"></label><span>Corresponding author </span>' +
'<input type="checkbox" name="isReport" value="1" style="margin-left: 10px"><br>\n' +
'<label>E-mail: <b>*</b></label><input type="text" name="email"/><span class="spa"></span><br>\n' +
'<label>Institution: <b>*</b></label><input type="text" name="company"/><span class="spa"></span><br>\n' +
'<label>Department: </label><input type="text" name="department"/><span class="spa"></span><br>\n' +
'<label>Title: </label><select name="title">' +
'<option value="Prof.">Prof.</option><option value="Associate Prof.">Associate Prof.</option>' +
'<option value="Assistant Prof.">Assistant Prof.</option><option value="Ph.D.">Ph.D.</option>' +
'<option value="Others">Others</option></select><br><label>Country: </label>' +
'<select name="country"></select></form>'
}
$('.ctb_author').append(form_author);
for (var i = 0; i < $(".author_num").length; i++) {
$('.author_num').eq(i).html(i + 1);
}
title_country();
$('.author_delete').click(function () {
$(this).parents('form').remove();
for (var i = 0; i < $(".author_num").length; i++) {
$('.author_num').eq(i).html(i + 1);
}
})
$("input[name='isReport']").unbind("click");
$("input[name='isReport']").click(function () {
if (this.checked == true) {
$(this).after('<input type="text" name="address" style="width: 210px" placeholder="Please enter address"/>')
} else {
$(this).next('input').remove()
}
})
})
// 删除作者
$('.author_delete').click(function () {
$(this).parents('form').remove();
for (var i = 0; i < $(".author_num").length; i++) {
$('.author_num').eq(i).html(i + 1);
}
})
// 通讯作者点击添加
$("input[name='isReport']").click(function sadfasd() {
if (this.checked == true) {
$(this).after('<input type="text" name="address" style="width: 210px" placeholder="Please enter address"/>')
} else {
$(this).next('input').remove()
}
})
// 文章类型点击添加
$("select[name='type']").change(function () {
if ($(this).find("option:selected").val() == "A") {
$(this).parent('div').after('<div style="margin: 5px 0 10px 40px" class="Approval">\n' +
' <input type="checkbox" name="approval" style="margin-left: 10px"><span>Ethical Approval </span>\n' +
' </div>')
} else {
$(this).parents('div').next('.Approval').remove()
}
})
// 点击提交信息
function contribu_form() {
// 获取地址栏信息
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
var JourSpe_id = ''; //期刊id
var Spe_id = getQueryString('special_id'); //客座id
var Spe_title = ''; //客座名称
$.ajax({
type: 'post', url: apiUrl + 'subscribe/Special/getSpecialDetail',
data: {'journal_special_id': Spe_id},
async: false,
success: function (result) {
if (result.code == 0) {
Spe_title = result.data.special.title
JourSpe_id = result.data.journal.issn
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
$(".spa").text('');
var mess_add = {};
var ary = []
for (var i = 0; i < $("form").length; i++) {
var yy = $("form").eq(i).serializeArray()
var pp = {}
for (var j = 0; j < yy.length; j++) {
var tt = yy[j].name;
pp[tt] = yy[j].value;
}
if (pp['isReport'] == undefined) {
pp['isReport'] = false
} else {
pp['isReport'] = true
}
if (pp['isSuper'] == undefined) {
pp['isSuper'] = false
} else {
pp['isSuper'] = true
}
if (pp['address'] == undefined) {
pp['address'] = ''
}
ary.push(pp);
}
var file_list_1 = $('#filename_1 li').attr('id');
if (file_list_1 == undefined) {
file_list_1 = ""
}
var file_list_2 = $('#filename_2 li').attr('id');
if (file_list_2 == undefined) {
file_list_2 = ""
}
// var file_list_3 = $('#filename_3 li').attr('id');
// if (file_list_3 == undefined) {
// file_list_3 = ""
// }
var file_list_4 = $('#filename_4 li').attr('id');
if (file_list_4 == undefined) {
file_list_4 = ""
}
mess_add.authorList = ary;
mess_add.username = $.cookie('username');
mess_add.special_id = Spe_id;
mess_add.special_title = Spe_title;
mess_add.journal_issn = JourSpe_id;
mess_add.title = $('#title').val();
mess_add.major = $("select[name='major']").find("option:selected").val();
mess_add.cmajor = $("select[name='cmajor']").find("option:selected").val();
mess_add.approval = $("input[name='approval']").is(":checked");
mess_add.type = $('#type').val();
mess_add.abstrart = $('#abstrart').val();
mess_add.keyWords = $('#keyword').val();
mess_add.fund = $('#fund').val();
mess_add.coverLetter = file_list_1;
mess_add.picturesAndTables = file_list_2;
// mess_add.totalpage = file_list_3;
mess_add.manuscirpt = file_list_4;
var S_Dan = '0';
if ($("#title").val() == "") {
$(".spa1").text('Please fill in title');
S_Dan = '1';
}
if ($("#abstrart").val() == "") {
$(".spa3").text('Please fill in abstrart');
S_Dan = '1';
}
if ($("#keyword").val() == "") {
$(".spa4").text('Please fill in keyword');
S_Dan = '1';
}
if ($("input[name='have']:checked").val() == undefined) {
$(".spa5").text('Please tick');
S_Dan = '1';
}
$("input[name='firstname']").each(function (j, item) {
if ($("input[name='firstname']").eq(j).val() == "") {
$("input[name='lastname']").eq(j).next('.spa').text('Please fill in name')
S_Dan = '1';
}
});
$("input[name='lastname']").each(function (j, item) {
if ($("input[name='lastname']").eq(j).val() == "") {
$("input[name='lastname']").eq(j).next('.spa').text('Please fill in name')
S_Dan = '1';
}
});
$("input[name='email']").each(function (j, item) {
if ($("input[name='email']").eq(j).val() == "") {
$("input[name='email']").eq(j).next('.spa').text('Please fill in email')
S_Dan = '1';
}
});
$("input[name='company']").each(function (j, item) {
if ($("input[name='company']").eq(j).val() == "") {
$("input[name='company']").eq(j).next('.spa').text('Please fill in Institution')
S_Dan = '1';
}
});
$('.f_c_tishi').css('display', 'none');
var abc = 0
$("input[name='isSuper']").each(function (j, item) {
if ($("input[name='isSuper']").eq(j).is(':checked') == true) {
abc += 1
}
});
if (abc == '0') {
$('.f_c_tishi').css('display', 'block');
S_Dan = '1';
}
var def = 0
$("input[name='isReport']").each(function (j, item) {
if ($("input[name='isReport']").eq(j).is(':checked') == true) {
def += 1
}
});
if (def == '0') {
$('.f_c_tishi').css('display', 'block');
S_Dan = '1';
}
$("input[name='address']").each(function (j, item) {
if ($("input[name='address']").eq(j).val() == "") {
$("input[name='address']").eq(j).next('.spa').text('Please fill in corresponding')
S_Dan = '1';
}
});
if ($('#filename_1 li').attr('id') != undefined) {
mess_add.coverLetter = 'coverLetter/' + file_list_1;
}
if ($('#filename_2 li').attr('id') != undefined) {
mess_add.picturesAndTables = 'picturesAndTables/' + file_list_2;
}
// if ($('#filename_3 li').attr('id') == undefined) {
// $(".spa7").text('Please upload');
// S_Dan = '1';
// } else {
// mess_add.totalpage = 'totalpage/' + file_list_3;
// }
if ($('#filename_4 li').attr('id') == undefined) {
$(".spa6").text('Please upload');
S_Dan = '1';
} else {
mess_add.manuscirpt = 'manuscirpt/' + file_list_4;
}
if (S_Dan == '1') {
ShowDanger("Incomplete information");
} else {
$(".sub_guest").addClass("disable");
ShowSubmit("Uploading");
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/addArticle',
data: mess_add,
success: function (result) {
if (result.code == 0) {
setTimeout(function () {
// window.location.href = 'contribu_list.html?J_num=' + Jour_num + '&&special_id=' + Spe_id;
window.location.href = 'contribu_success.html?J_num=' + Jour_num;
}, 1500);
} else {
ShowDanger("请求失败!");
$(".sub_guest").removeClass("disable");
$('#tir').fadeOut(500)
}
},
error: function () {
ShowDanger("error");
$(".sub_guest").removeClass("disable");
$('#tir').fadeOut(500)
}
})
}
}
// 上传附件
function up_file_1() {
$("#ch_file_1").click();
}
$("#ch_file_1").on("change", function () {
//jquery获取input file文件名
var awj = $("#ch_file_1")[0].files;
var wj_f = "";
var formData = new FormData();
formData.append("coverLetter", awj[0]);
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/up_file/type/coverLetter',
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function (result) {
if (result.code == 0) {
wj_f = '<li id="' + result.upurl + '"><p>' + result.upurl + '</p><i class="fa fa-trash del_file" ></i></li>';
$("#filename_1").html(wj_f);
} else {
ShowDanger("请求失败!");
}
del_wj();
}
})
});
function up_file_2() {
$("#ch_file_2").click();
}
$("#ch_file_2").on("change", function () {
//jquery获取input file文件名
var awj = $("#ch_file_2")[0].files;
var wj_f = "";
var formData = new FormData();
formData.append("picturesAndTables", awj[0]);
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/up_file/type/picturesAndTables',
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function (result) {
if (result.code == 0) {
wj_f = '<li id="' + result.upurl + '"><p>' + result.upurl + '</p><i class="fa fa-trash del_file" ></i></li>';
$("#filename_2").html(wj_f);
} else {
ShowDanger("请求失败!");
}
del_wj();
}
})
});
// function up_file_3() {
// $("#ch_file_3").click();
// }
// $("#ch_file_3").on("change", function () {
// //jquery获取input file文件名
// var awj = $("#ch_file_3")[0].files;
// var wj_f = "";
// var formData = new FormData();
// formData.append("totalpage", awj[0]);
// $.ajax({
// type: 'post', url: apiUrlTG + 'special/Special/up_file/type/totalpage',
// data: formData,
// processData: false,
// contentType: false,
// dataType: "json",
// success: function (result) {
// if (result.code == 0) {
// wj_f = '<li id="' + result.upurl + '"><p>' + result.upurl + '</p><i class="fa fa-trash del_file" ></i></li>';
// $("#filename_3").html(wj_f);
// } else {
// ShowDanger("请求失败!");
// }
// del_wj();
// }
// })
// });
function up_file_4() {
$("#ch_file_4").click();
}
$("#ch_file_4").on("change", function () {
//jquery获取input file文件名
var awj = $("#ch_file_4")[0].files;
var wj_f = "";
var formData = new FormData();
formData.append("manuscirpt", awj[0]);
$.ajax({
type: 'post', url: apiUrlTG + 'special/Special/up_file/type/manuscirpt',
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function (result) {
if (result.code == 0) {
wj_f = '<li id="' + result.upurl + '"><p>' + result.upurl + '</p><i class="fa fa-trash del_file" ></i></li>';
$("#filename_4").html(wj_f);
} else {
ShowDanger("请求失败!");
}
del_wj();
}
})
});
function del_wj() {
$('.del_file').on('click', function () {
$(this).parent('li').remove();
})
}