|
|
@@ -82,6 +82,17 @@
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="div1">
|
|
|
<form class="form-horizontal m" id="form-magnet-edit" th:object="${wxMagnet}">
|
|
|
<input type="hidden" name="magnetId" th:field="*{magnetId}">
|
|
|
+
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label"><span style="color: red; ">*</span>磁贴应用类型:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <select name="magnetType" id="sel_magnetType" class="form-control m-b"
|
|
|
+ th:with="type=${@dict.getType('sys_magnet_type')}"
|
|
|
+ onchange="javascript:magnetTypeChange()">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{magnetType}"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label"><span style="color: red; ">*</span>磁贴名称:</label>
|
|
|
<div class="col-sm-8">
|
|
|
@@ -89,14 +100,13 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label"><span style="color: red; ">*</span>请求地址:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
- <input id="url" name="url" class="form-control" type="text" th:field="*{url}" required>
|
|
|
+ <label class="col-sm-3 control-label"><span style="color: red; ">*</span>显示排序:</label>
|
|
|
+ <div class="col-sm-8" >
|
|
|
+ <input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">磁贴尺寸:</label>
|
|
|
+ <label class="col-sm-3 control-label"><span style="color: red; ">*</span>磁贴尺寸:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<select name="magnetSize" id="sel_magnetSize" class="form-control m-b"
|
|
|
th:with="type=${@dict.getType('wx_magnet_size')}" onchange="javascript:sizeChange()">
|
|
|
@@ -104,21 +114,32 @@
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label"><span style="color: red; ">*</span>显示排序:</label>
|
|
|
- <div class="col-sm-8" >
|
|
|
- <input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
|
|
|
+ <div class="form-group" style="display: none;">
|
|
|
+ <label class="col-sm-3 control-label"><span style="color: red; ">*</span>请求地址:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input id="url" name="url" class="form-control" type="text" th:field="*{url}" required>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">背景图片:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<input id="input_bgUrl" name="bgUrl" th:field="*{bgUrl}" type="hidden"/>
|
|
|
- <div class="thumbnail slideshow_span" id="div-bgUrl" onclick="javascript:bgUpload()">
|
|
|
- <img th:src="@{*{bgUrl}}" style="width;100%;height:100%;">
|
|
|
+ <div class="thumbnail slideshow_span" id="div-bgUrl" onclick="javascript:bgUpload('bg')">
|
|
|
+ <img th:src="@{*{bgUrl}}" style="width:100%;height:100%;">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-group" style="display: none;">
|
|
|
+ <label class="col-sm-3 control-label">小程序二维码:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input id="input_appletQrUrl" name="appletQrUrl" th:field="*{appletQrUrl}" type="hidden"/>
|
|
|
+ <div class="thumbnail slideshow_span bg-sm" id="div-appletQrUrl" onclick="javascript:bgUpload('qr')">
|
|
|
+ <img th:src="@{*{appletQrUrl}}" style="width:100%;height:100%;">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">菜单状态:</label>
|
|
|
<div class="col-sm-8">
|
|
|
@@ -149,7 +170,8 @@
|
|
|
<a href="javascript:void(0)" class="upload-img"> <label for="avatar">选择图片</label> </a>
|
|
|
<input type="file" class="" name="avatar" id="avatar" accept="image/*"/>
|
|
|
</div>
|
|
|
- <input type="button" onclick="upBg()" class="btn-info Btnsty_peyton" value="上传" />
|
|
|
+ <input type="button" id="submitbuttonBg" onclick="upBg()" class="btn-info Btnsty_peyton" value="上传" />
|
|
|
+ <input type="button" id="submitbuttonQr" onclick="upQr()" class="btn-info Btnsty_peyton" value="上传" />
|
|
|
<input type="button" onclick="back()" class="btn-info Btnsty_peyton " value="返回" />
|
|
|
</div>
|
|
|
|
|
|
@@ -160,12 +182,27 @@
|
|
|
var prefix = ctx + "wxportal/magnet";
|
|
|
var cropper;
|
|
|
var size = "S";
|
|
|
+ var magnet_type = "0";
|
|
|
var options = {
|
|
|
thumbBox: '.thumbBox_'+size,
|
|
|
spinner: '.spinner',
|
|
|
imgSrc: ctx + 'img/profile.jpg'
|
|
|
}
|
|
|
$(function() {
|
|
|
+ var magnetType = $("#sel_magnetType").val();
|
|
|
+ var $appletQrUrl = $("#input_appletQrUrl").parents(".form-group");
|
|
|
+ var $url = $("#url").parents(".form-group");
|
|
|
+ if(magnetType == "0"){
|
|
|
+ $url.removeAttr('disabled');
|
|
|
+ $url.show();
|
|
|
+ $appletQrUrl.attr('disabled', 'disabled');
|
|
|
+ $appletQrUrl.hide();
|
|
|
+ } else if (magnetType == "1"){
|
|
|
+ $appletQrUrl.removeAttr('disabled');
|
|
|
+ $appletQrUrl.show();
|
|
|
+ $url.attr('disabled', 'disabled');
|
|
|
+ $url.hide();
|
|
|
+ }
|
|
|
$("#form-magnet-edit").validate({
|
|
|
onkeyup: false,
|
|
|
rules: {
|
|
|
@@ -242,14 +279,22 @@
|
|
|
}
|
|
|
|
|
|
/*上传背景图片*/
|
|
|
- function bgUpload() {
|
|
|
+ function bgUpload(value) {
|
|
|
+ var imgUrl = null;
|
|
|
+ if(value == 'bg'){
|
|
|
+ $("#submitbuttonQr").hide();
|
|
|
+ $("#submitbuttonBg").show();
|
|
|
+ imgUrl =$("#input_bgUrl").val();
|
|
|
+ } else if (value == 'qr'){
|
|
|
+ $("#submitbuttonBg").hide();
|
|
|
+ $("#submitbuttonQr").show();
|
|
|
+ imgUrl =$("#input_appletQrUrl").val();
|
|
|
+ }
|
|
|
$("#div1").hide();
|
|
|
$("#div2").show();
|
|
|
- var imgUrl =$("#input_bgUrl").val();
|
|
|
+
|
|
|
if(imgUrl==null||imgUrl==''){
|
|
|
imgUrl = ctx + 'img/profile.jpg';
|
|
|
- }else{
|
|
|
- imgUrl = ctx+$("#input_bgUrl").val();
|
|
|
}
|
|
|
options = {
|
|
|
thumbBox: '.thumbBox_'+size,
|
|
|
@@ -272,7 +317,7 @@
|
|
|
success: function(result) {
|
|
|
if(result.code==0){
|
|
|
$("#input_bgUrl").val(result.data.fileName);
|
|
|
- $("#div-bgUrl").html("<img src='"+result.data.url+"' style='width;100%;height:100%;'>");
|
|
|
+ $("#div-bgUrl").html("<img src='"+result.data.url+"' style='width:100%;height:100%;'>");
|
|
|
$("#div1").show();
|
|
|
$("#div2").hide();
|
|
|
}else{
|
|
|
@@ -284,7 +329,31 @@
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ function upQr() {
|
|
|
+ var img = cropper.getBlob();
|
|
|
+ var formdata = new FormData();
|
|
|
+ formdata.append("file", img);
|
|
|
+ $.ajax({
|
|
|
+ url: ctx + "common/upload",
|
|
|
+ data: formdata,
|
|
|
+ type: "post",
|
|
|
+ processData: false,
|
|
|
+ contentType: false,
|
|
|
+ success: function(result) {
|
|
|
+ if(result.code==0){
|
|
|
+ $("#input_appletQrUrl").val(result.data.fileName);
|
|
|
+ $("#div-appletQrUrl").html("<img src='"+result.data.url+"' style='width:100%;height:100%;'>");
|
|
|
+ $("#div1").show();
|
|
|
+ $("#div2").hide();
|
|
|
+ }else{
|
|
|
+ $("#div1").show();
|
|
|
+ $("#div2").hide();
|
|
|
+ $.modal.alertWarning(result.msg);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
function sizeChange(){
|
|
|
size = $("#sel_magnetSize").val();
|
|
|
$("#div-bgUrl").removeClass("bg-sm");
|
|
|
@@ -309,6 +378,26 @@
|
|
|
$("#thumbBox").addClass("thumbBox_S");
|
|
|
}
|
|
|
}
|
|
|
+ function magnetTypeChange(){
|
|
|
+ magnet_type = $("#sel_magnetType").val();
|
|
|
+ var $appletQrUrl = $("#input_appletQrUrl").parents(".form-group");
|
|
|
+ var $url = $("#url").parents(".form-group");
|
|
|
+ if(magnet_type == "0"){
|
|
|
+ $appletQrUrl.attr('disabled', 'disabled');
|
|
|
+ $appletQrUrl.hide();
|
|
|
+ $("#input_appletQrUrl").val("");
|
|
|
+
|
|
|
+ $url.removeAttr('disabled');
|
|
|
+ $url.show();
|
|
|
+ }else if(magnet_type == "1"){
|
|
|
+ $("#imageBox").addClass("imageBox imageBox_S");
|
|
|
+ $("#thumbBox").addClass("thumbBox_S");
|
|
|
+ $appletQrUrl.removeAttr('disabled');
|
|
|
+ $appletQrUrl.show();
|
|
|
+ $url.attr('disabled', 'disabled');
|
|
|
+ $url.hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
</script>
|
|
|
</body>
|