新增装扮商城支持mp4限制第二banner不能输入空格

This commit is contained in:
dragon
2024-11-20 11:23:57 +08:00
parent 223311f321
commit 59a2461f73
2 changed files with 104 additions and 3 deletions

View File

@@ -197,6 +197,8 @@
class="form-control"
name="skipUri"
id="skipUrlContent"
onkeydown="return event.key !== ' '"
oninput="this.value = this.value.replace(/\s+/g, '')"
/>
</div>
</div>
@@ -460,6 +462,8 @@
class="form-control"
name="skipUri"
id="addSkipUrlContent"
onkeydown="return event.key !== ' '"
oninput="this.value = this.value.replace(/\s+/g, '')"
/>
</div>
</div>
@@ -733,7 +737,6 @@ export default {
// }
// }
// }
function initTable() {
$("#table").bootstrapTable({
columns: [
@@ -1520,7 +1523,7 @@ export default {
margin-right: 10px;
margin-left: 5px;
}
.text{
.text {
font-size: 20px;
margin-top: 20px;
color: rgb(173, 53, 53);

View File

@@ -200,7 +200,7 @@
type="file"
id="addUploadIconPic"
name="uploadFile"
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg,.mp4"
/>
<button class="btn btn-success" type="button" id="uploadBtn">
上传
@@ -209,6 +209,39 @@
<a href="javascript:void(0)" id="removeIconPic">清除</a>
</div>
</div>
<div class="form-group">
<label for="effectType" class="col-sm-4 control-label"
>装扮动效图片类型:</label
>
<div class="col-sm-6">
<select
name="effectType"
id="effectType"
data-btn-class="btn-warning"
class="form-control"
>
<option value="0">图片</option>
<option value="1">MP4</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">装扮动效图片:</label>
<div class="col-sm-6">
<img src="" id="addIconPicUrl2" style="height: 44px" alt="" />
<input
type="file"
id="addEffect"
name="uploadFile"
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg,.mp4"
/>
<button class="btn btn-success" type="button" id="uploadBtn2">
上传
</button>
<input type="hidden" id="effect" name="effect" class="form-control" />
<a href="javascript:void(0)" id="removeIconPic2">清除</a>
</div>
</div>
<div class="form-group">
<label for="status" class="col-sm-4 control-label"
>装扮状态:</label
@@ -399,6 +432,24 @@ export default {
}
},
},
{
field: "effect",
title: "装扮动效图片",
align: "middle",
valign: "middle",
width: "5%",
formatter: function (val, row, index) {
if (val) {
return (
"<img style='max-width: 200px;max-height: 200px' src='" +
val +
"'>"
);
} else {
return "-";
}
},
},
{
field: "type",
title: "装扮类型",
@@ -429,6 +480,21 @@ export default {
}
},
},
{
field: "effectType",
title: "装扮动效图片类型",
align: "middle",
width: "5%",
formatter: function (val) {
if (val === 0) {
return "图片";
} else if (val === 1) {
return "无效MP4";
} else {
return "-";
}
},
},
{
field: "createTime",
title: "添加时间",
@@ -571,8 +637,11 @@ export default {
$("#addForm #tr_modal_name").val(name);
}
$("#addIconPicUrl").attr("src", row.pic);
$("#addIconPicUrl2").attr("src", row.effect);
$("#addForm #pic").val(row.pic);
$("#addForm #effect").val(row.effect);
$("#addForm #status").val(row.status);
$("#addForm #effectType").val(row.effectType);
//分区
let partitionFlag = row.partitionFlag;
if ((partitionFlag & 1) != 0) {
@@ -610,12 +679,35 @@ export default {
};
$("#addForm").ajaxSubmit(options);
});
$("#uploadBtn2").on("click", function () {
var options = {
type: "post",
url: "/admin/upload/img",
dataType: "json",
success: function (json) {
if (json.path) {
$("#effect").val(json.path);
$("#addIconPicUrl2").attr("src", json.path);
} else {
$("#tipMsg").text(json.msg);
$("#tipModal").modal("show");
}
},
};
$("#addForm").ajaxSubmit(options);
});
$("#removeIconPic").on("click", function () {
$("#addIconPicUrl").attr("src", "");
$("#addUploadIconPic").val("");
$("#iconPic").val("");
});
$("#removeIconPic2").on("click", function () {
$("#addIconPicUrl2").attr("src", "");
$("#addEffect").val("");
$("#effect").val("");
$("#iconPic").val("");
});
//打开新增页面
$("#btnAdd").on("click", function () {
@@ -626,6 +718,7 @@ export default {
//保存
$("#button-save").on("click", function () {
var pic = $("#pic").val();
var effect = $("#effect").val();
var name = $("#modal_name").val();
var arName = $("#ar_modal_name").val();
var enName = $("#en_modal_name").val();
@@ -815,9 +908,14 @@ export default {
function cleanModal() {
$("#id").val("");
$("#addIconPicUrl").attr("src", "");
$("#addIconPicUrl2").attr("src", "");
$("#addUploadIconPic").val("");
$("#addEffect").val("");
$("#effect").val("");
$("#pic").val("");
$("#effect").val("");
$("#status").val("");
$("#effectType").val("");
$("#modal_type").val("");
$("#modal_name").val("");
$('input[name="partitionFlag"]').each(function () {