修复礼物编辑回显
This commit is contained in:
@@ -18,7 +18,7 @@ export default {
|
||||
setDef: function (idstr, defval) {
|
||||
for (let i = 0, len = $(idstr + ' option').length; i < len; i++) {
|
||||
let $option = $(idstr + ' option:eq(' + i + ')');
|
||||
if ($option.val() == defval) {
|
||||
if ($option && $option.val() == defval) {
|
||||
$option.prop('selected', true);
|
||||
} else {
|
||||
$option.prop('selected', false);
|
||||
|
@@ -211,14 +211,14 @@
|
||||
<div class="form-group" v-if="gift.subGiftType == 1">
|
||||
<label for="baseGiftId" class="col-sm-3 control-label">需要的基础解锁礼物</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="baseGiftId" id="baseGiftId" data-btn-class="btn-warning" class="form-control">
|
||||
<select name="baseGiftId" id="baseGiftId" data-btn-class="btn-warning" class="form-control" v-model="gift.baseGiftId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" v-if="gift.subGiftType == 1">
|
||||
<label for="unlockNum" class="col-sm-3 control-label">需要的该基础礼物个数</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" name="unlockNum" id="unlockNum" min="1">
|
||||
<input type="number" class="form-control" name="unlockNum" id="unlockNum" min="1" v-model="gift.unlockNum">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -227,7 +227,7 @@
|
||||
<div class="form-group">
|
||||
<label for="sendDressType" class="col-sm-3 control-label">送礼者获得装扮类型</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="sendDressType" id="sendDressType" data-btn-class="btn-warning" class="form-control" @change="changeDressType('send')">
|
||||
<select name="sendDressType" id="sendDressType" data-btn-class="btn-warning" class="form-control" @change="changeDressType('send')" v-model="gift.sendDressType">
|
||||
<option value="">无</option>
|
||||
<option value="HEADWEAR">头像装饰</option>
|
||||
<option value="CHATBUBBLE">气泡装饰</option>
|
||||
@@ -246,13 +246,13 @@
|
||||
<div class="form-group">
|
||||
<label for="sendDressTime" class="col-sm-3 control-label">送礼者获得装扮时长</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" name="sendDressTime" id="sendDressTime" min="1">
|
||||
<input type="number" class="form-control" name="sendDressTime" id="sendDressTime" min="1" v-model="gift.sendDressTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="receiveDressType" class="col-sm-3 control-label">收礼者获得装扮类型</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="receiveDressType" id="receiveDressType" data-btn-class="btn-warning" class="form-control" @change="changeDressType('receive')">
|
||||
<select name="receiveDressType" id="receiveDressType" data-btn-class="btn-warning" class="form-control" @change="changeDressType('receive')" v-model="gift.receiveDressType">
|
||||
<option value="">无</option>
|
||||
<option value="HEADWEAR">头像装饰</option>
|
||||
<option value="CHATBUBBLE">气泡装饰</option>
|
||||
@@ -271,15 +271,15 @@
|
||||
<div class="form-group">
|
||||
<label for="receiveDressTime" class="col-sm-3 control-label">收礼者获得装扮时长</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" name="receiveDressTime" id="receiveDressTime" min="1">
|
||||
<input type="number" class="form-control" name="receiveDressTime" id="receiveDressTime" min="1" v-model="gift.receiveDressTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="dressBanner" class="col-sm-3 control-label">礼物介绍banner</label>
|
||||
<div class="col-sm-8">
|
||||
<img src="" id="dressBannerImage" style="width:250px;height:90px;" alt="">
|
||||
<img :src="gift.dressBanner" id="dressBannerImage" style="width:250px;height:90px;" alt="">
|
||||
<input type="file" id="dressBannerFile" name="uploadFile"/>
|
||||
<input type="hidden" id="dressBanner" name="dressBanner" class="form-control validate[required]" />
|
||||
<input type="hidden" id="dressBanner" name="dressBanner" class="form-control" v-model="gift.dressBanner"/>
|
||||
<span class="btn col-sm-4" id="dressBannerUploadInfo" style="color:red;"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -292,7 +292,7 @@
|
||||
<div class="form-group">
|
||||
<label for="bannerSkipUrl" class="col-sm-3 control-label">礼物介绍banner跳转</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="bannerSkipUrl" id="bannerSkipUrl">
|
||||
<input type="text" class="form-control" name="bannerSkipUrl" id="bannerSkipUrl" v-model="gift.bannerSkipUrl">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -696,6 +696,16 @@ export default {
|
||||
giftId: null,
|
||||
giftType: 2,
|
||||
subGiftType: 0,
|
||||
baseGiftId: null,
|
||||
unlockNum: 0,
|
||||
sendDressType: '',
|
||||
sendDressId: null,
|
||||
sendDressTime: 0,
|
||||
receiveDressType: '',
|
||||
receiveDressId: null,
|
||||
receiveDressTime: 0,
|
||||
dressBanner: '',
|
||||
bannerSkipUrl: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -742,7 +752,9 @@ export default {
|
||||
methods: {
|
||||
changeDressType(type) {
|
||||
let options = [];
|
||||
let dressType = $('#' + type + 'DressType').val();
|
||||
console.log(type);
|
||||
let dressType = this.gift[type + 'DressType'];
|
||||
console.log(dressType);
|
||||
if (dressType == 'NAMEPLATE') {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
@@ -822,8 +834,10 @@ export default {
|
||||
}
|
||||
let $dressId = $('#' + type + 'DressId');
|
||||
let dressId = $('#' + type + 'DressIdBak').val();
|
||||
console.log(dressId);
|
||||
$dressId.children().remove();
|
||||
console.log(options);
|
||||
setTimeout(() => {
|
||||
if (options.length > 0) {
|
||||
for (let j = 0; j < options.length; j++) {
|
||||
var option = options[j];
|
||||
@@ -839,6 +853,8 @@ export default {
|
||||
}
|
||||
ComboboxHelper.build(options, '#' + type + 'DressId', dressId);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
},
|
||||
giftUnlockList() {
|
||||
getGiftUnlockList().then(res => {
|
||||
@@ -849,7 +865,7 @@ export default {
|
||||
value: e.giftId,
|
||||
};
|
||||
});
|
||||
ComboboxHelper.setDef(lockGifts, '#baseGiftId', null);
|
||||
ComboboxHelper.build(lockGifts, '#baseGiftId', null);
|
||||
});
|
||||
},
|
||||
levelList() {
|
||||
@@ -1134,6 +1150,8 @@ export default {
|
||||
$this.gift.giftId = null;
|
||||
$this.gift.giftType = 2;
|
||||
$this.gift.subGiftType = 0;
|
||||
$this.gift.sendDressType = '';
|
||||
$this.gift.receiveDressType = '';
|
||||
$("#giftForm")[0].reset();
|
||||
$('#picUrl').val('');
|
||||
$('#picImage').attr("src", '');
|
||||
@@ -1428,6 +1446,7 @@ export default {
|
||||
url: "/admin/gift/get.action",
|
||||
data: { id: id },
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (json) {
|
||||
let entity = json.entity;
|
||||
if (json.roomFreeGiftConfig) {
|
||||
@@ -1438,6 +1457,18 @@ export default {
|
||||
$("#resetTimeCron").val(json.roomFreeGiftConfig.resetTimeCron);
|
||||
}
|
||||
if (json.entity) {
|
||||
$this.gift.giftId = entity.giftId;
|
||||
$this.gift.giftType = entity.giftType;
|
||||
$this.gift.subGiftType = entity.subGiftType;
|
||||
$this.gift.baseGiftId = entity.baseGiftId;
|
||||
$this.gift.sendDressType = entity.sendDressType;
|
||||
$this.gift.sendDressId = entity.sendDressId;
|
||||
$this.gift.sendDressTime = entity.sendDressTime;
|
||||
$this.gift.receiveDressType = entity.receiveDressType;
|
||||
$this.gift.receiveDressId = entity.receiveDressId;
|
||||
$this.gift.receiveDressTime = entity.receiveDressTime;
|
||||
$this.gift.dressBanner = entity.dressBanner;
|
||||
$this.gift.bannerSkipUrl = entity.bannerSkipUrl;
|
||||
$("#giftId").val(json.entity.giftId);
|
||||
$("#giftName").val(json.entity.giftName);
|
||||
$("#goldPrice").val(json.entity.goldPrice);
|
||||
@@ -1532,9 +1563,6 @@ export default {
|
||||
$('#subGiftType').val(entity.subGiftType);
|
||||
$('#baseGiftId').val(entity.baseGiftId);
|
||||
$('#unlockNum').val(entity.unlockNum);
|
||||
$this.gift.giftId = entity.giftId;
|
||||
$this.gift.giftType = entity.giftType;
|
||||
$this.gift.subGiftType = entity.subGiftType;
|
||||
$('#sendDressType').val(entity.sendDressType);
|
||||
$('#sendDressId').val(entity.sendDressId);
|
||||
$('#sendDressTime').val(entity.sendDressTime);
|
||||
@@ -1549,9 +1577,19 @@ export default {
|
||||
} else {
|
||||
$("#dressBannerUploadInfo").html('未上传');
|
||||
}
|
||||
$("#giftTagFile").val('');
|
||||
$('#giftTag').val(entity.giftTag);
|
||||
$('#giftTagImage').attr("src", entity.giftTag);
|
||||
if (entity.giftTag != null && entity.giftTag != 'undefined' && entity.giftTag != '') {
|
||||
$("#giftTagUploadInfo").html('已上传');
|
||||
} else {
|
||||
$("#giftTagUploadInfo").html('未上传');
|
||||
}
|
||||
$('#bannerSkipUrl').val(entity.bannerSkipUrl);
|
||||
$('#sendDressIdBak').val(entity.sendDressId);
|
||||
$('#receiveDressIdBak').val(entity.receiveDressId);
|
||||
// 打开编辑弹窗
|
||||
$("#giftModal").modal('show');
|
||||
if (entity.giftType == 16) {
|
||||
$('#giftType').attr('disabled', 'disabled');
|
||||
$('#subGiftType').attr('disabled', 'disabled');
|
||||
@@ -1561,8 +1599,6 @@ export default {
|
||||
$this.changeDressType('send');
|
||||
$this.changeDressType('receive');
|
||||
}
|
||||
// 打开编辑弹窗
|
||||
$("#giftModal").modal('show');
|
||||
} else {
|
||||
$("#tipMsg").text("获取菜单信息出错");
|
||||
$("#tipModal").modal('show');
|
||||
|
Reference in New Issue
Block a user