You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/views/avatar/upload.js.erb

37 lines
2.0 KiB

6 years ago
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization'|| @source_type == 'Contest') %>
var imgSpan = $("img[nhname='avatar_image']");
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% elsif @is_direct == '1' && @source_type == 'UserAuthentication' %>
<% if @auth_type == "ID" %>
var imgSpan = $("#nh_source_id");
$("#upload_img_id_sign").val(1);
$("#choose_file").hide();
<% else %>
var imgSpan = $("#nh_source_pro");
$("#upload_img_pro_sign").val(1);
$("#choose_file").hide();
<% end %>
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
//imgSpan.parent().attr("href", imgSpan.attr('src')+".png");
imgSpan.parent().show();
$("#shili_link").attr("href", imgSpan.attr('src')+".png");
<% elsif @source_type == 'com_coop' || @source_type == 'edu_coop'%>
$("#show_img_url").val(<%= "#{@urlfile.to_s}"%>);
<% elsif @source_type == 'Platform' %>
$("#mirror_image_<%= @source_id %>").attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% elsif @source_type == 'Shixun' || @source_type == 'Subject' || @source_type == 'Competition' || @source_type == 'PortalImage' || @source_type == 'Career' || @source_type == 'School' || @source_type == 'SchoolImage' %>
notice_box("上传成功");
$("#object_upload_img_<%= @source_id %>").html("重新上传");
$("#shixun_image_show_<%= @source_id %>").attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}).show();
var image=$("#shixun_image_show_<%= @source_id %>");
var element = $("<a></a>").attr("href", image.attr('src')+".png");
image.wrap(element);
$(image).parent().colorbox({rel: 'nofollow', close: "关闭", returnFocus: false});
<% else %>
<% if @source_type=='User' %>
var imgSpan = jQuery('#nh_user_logo');
<% else %>
var imgSpan = jQuery('#avatar_image');
<% end %>
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% end %>