实践课程的二维码图片

dev_auth
cxt 5 years ago
parent 04943a2b2c
commit 3ad763d600

@ -41,12 +41,18 @@ $(document).on('turbolinks:load', function () {
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
if(data.suffix == '_qrcode'){
var $imageElement = $('.subject-weapp-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
} else {
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
}
});
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.subject-list-container').on('click', doElement, function () {

@ -7,12 +7,13 @@
<th width="8%">技术体系</th>
<th width="8%">等级体系</th>
<th width="8%">封面</th>
<th width="8%">二维码图片</th>
<th width="7%">创建者</th>
<th width="10%">单位</th>
<th width="8%">开课人数</th>
<th width="6%">开课人数</th>
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_subjects_path) %></th>
<th width="7%">状态</th>
<th width="15%">操作</th>
<th width="9%">操作</th>
</tr>
</thead>
<tbody>
@ -33,6 +34,13 @@
<%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %>
<%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td class="subject-setting-qrcode-image">
<% codeImageExists = Util::FileManage.exists?(subject, '_qrcode') %>
<% imageUrl = codeImageExists ? Util::FileManage.source_disk_file_url(subject, '_qrcode') : '' %>
<%= image_tag(imageUrl, width: 60, height: 40, class: "preview-image subject-weapp-image-#{subject.id}", data: { toggle: 'tooltip', title: '点击预览' }, style: codeImageExists ? '' : 'display:none') %>
<%= raw '<br/>' if codeImageExists %>
<%= javascript_void_link codeImageExists ? '重新上传' : '上传图片', class: 'action upload-subject-qrcode-image-action', data: { source_id: subject.id, source_type: 'Subject', suffix: '_qrcode', toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td><%= subject.user.real_name %></td>
<td><%= subject.user.school_name %></td>
<td><%= subject.student_count %></td>

@ -1,3 +1,4 @@
json.qrcode_img Util::FileManage.exists?(@subject, '_qrcode') ? Util::FileManage.source_disk_file_url(@subject, '_qrcode') : nil
json.members @members do |member|
json.partial! 'subject_member', locals: { user: member.user }

Loading…
Cancel
Save