/*** Created by A.J on 2020/6/7.*/$(document).ready(function(){$('#signaturemethod').on('change',function(){if($(this).val() == 'certificate'){$('#certificate').removeClass('d-none');$('#publickey').addClass('d-none');}else if($(this).val() == 'publickey'){$('#publickey').removeClass('d-none');$('#certificate').addClass('d-none');}});$('#applicationpublickey').on('change',function(){var fileName = $(this).val();$(this).next('.custom-file-label').html(fileName);$.uploadcertificate("applicationpublickey");});$('#alipaypublickey').on('change',function(){var fileName = $(this).val();$(this).next('.custom-file-label').html(fileName);$.uploadcertificate("alipaypublickey");});$('#alipayroot').on('change',function(){var fileName = $(this).val();$(this).next('.custom-file-label').html(fileName);$.uploadcertificate("alipayroot");});if($('#applicationpublickeyname').val() != "" && $('#applicationpublickeypath').val() != ""){$("#applicationpublickeydiv").html($("#zhengshutu").html() + $('#applicationpublickeyname').val());}if($('#alipaypublickeyname').val() != "" && $('#alipaypublickeypath').val() != ""){$("#alipaypublickeydiv").html($("#zhengshutu").html() + $('#alipaypublickeyname').val());}if($('#alipayrootname').val() != "" && $('#alipayrootpath').val() != ""){$("#alipayrootdiv").html($("#zhengshutu").html() + $('#alipayrootname').val());}$.extend({"uploadcertificate": function(which){$("#certificateModal").modal();$('#'+which).upload("uploadcertificate", {file: which,verification:$("#verification").text()}, function(data) {if(typeof data == "string"){data = JSON.parse(data);}$('#certificateModal').modal('hide');if(data.result == "ok"){$("#"+which+"name").val(data.name);$("#"+which+"path").val(data.path);$("#"+which+"div").html($("#zhengshutu").html() + data.name);}else{$.alert({title: $('#chucuo').text(),content: data.message,buttons: {confirm: {text: $('#queding').text(),btnClass: 'btn-info',keys: ['enter']}}});}});}});});