抽奖奖品修改页面添加图片

This commit is contained in:
dy 2021-04-21 14:47:14 +08:00
parent bffdf6cd6c
commit 8e7280b07e
1 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,7 @@
<head>
<th:block th:include="include :: header('修改存储奖品的基础信息')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: jasny-bootstrap-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -37,6 +38,26 @@
<input name="PRIZEVALUE" th:field="*{PRIZEVALUE}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">背景图片:</label>
<div class="col-sm-8">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail" data-trigger="fileinput"
style="width: 200px; height: 150px;">
<img th:src="*{PRIZEIMG}">
</div>
<div>
<span class="btn btn-white btn-file"><span
class="fileinput-new">选择图片</span><span class="fileinput-exists">更改</span>
<input type="file" id="pic" name="actPageConfigGuide-bgImg"
onchange="syncPic(this)"></span>
<a href="#" class="btn btn-white fileinput-exists"
data-dismiss="fileinput">清除</a>
</div>
</div>
</div>
<input id="picval" type="hidden" name="PRIZEIMG" value="" th:field="*{PRIZEIMG}">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
@ -84,6 +105,7 @@
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: jasny-bootstrap-js"/>
<script th:inline="javascript">
var prefix = ctx + "activity/prize";
$("#form-info-edit").validate({
@ -107,6 +129,16 @@
minView: "month",
autoclose: true
});
function syncPic(val){
//传递值
var id = val.id;
var reader = new FileReader();
reader.onload = function (e) {
$("#"+id+"val").val(e.target.result);
}
reader.readAsDataURL(val.files[0]);
}
</script>
</body>
</html>