json.type @type if @type == "image" #原始图片 json.orignal_picture do json.array! @orignal_picture do |pic| json.pic_url attachment_show_users_path(:file_name => pic, :path => @original_path) end end json.user_picture do json.array! @user_picture do |pic| json.pic_url attachment_show_users_path(:file_name => pic, :path => @user_path, :time => Time.now.to_i) end end json.answer_picture do json.array! @answer_picture do |pic| json.pic_url attachment_show_users_path(:file_name => pic, :path => @answer_path) end end elsif @type == "html" json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe elsif @type == "txt" json.contents @contents.html_safe elsif @type =="qrcode" json.qrcode_str @qrcode_str end