1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-23 08:26:40 +08:00
2019-12-13 00:10:10 +08:00

29 lines
791 B
Plaintext

<script>
layui.use(['jquery', 'upload'], function () {
var $ = layui.jquery;
var layer = layui.layer;
var upload = layui.upload;
upload.render({
elem: '#choose-cover',
url: '/admin/storage/cover/img/upload',
accept: 'images',
acceptMime: 'image/*',
before: function () {
layer.load();
},
done: function (res, index, upload) {
$('#cover-img').attr('src', res.data.src);
$('input[name=cover]').val(res.data.src);
layer.closeAll('loading');
},
error: function (index, upload) {
layer.msg('上传文件失败', {icon: 2});
}
});
});
</script>