var gt = new Gettext({ 'domain': 'gmtjs' });
|
|
// 选择邮件模板
|
function onChangeMailTemp(tempInfo, isChange) {
|
var mailTempSelObj = document.getElementById("MailTemp");
|
var tempIndex = mailTempSelObj.selectedIndex - 1;
|
// if (tempIndex < 0) {
|
// return;
|
// }
|
//alert(JSON.stringify(tempInfo));
|
var tempItems = 0;
|
if (tempIndex >= 0) {
|
var curTemp = tempInfo[tempIndex];
|
if (isChange) {
|
// alert("切换邮件模板: " + mailTempSelObj.options[mailTempSelObj.selectedIndex].text);
|
}
|
|
tempItems = curTemp.Items.length;
|
document.getElementById("MailTempName").value = curTemp.Name;
|
document.getElementById("EndDate").value = sumDateByDays(curTemp.EndDays);
|
document.getElementById("Title").value = curTemp.Title;
|
document.getElementById("Text").value = curTemp.Text;
|
document.getElementById("Gold").value = curTemp.Gold;
|
document.getElementById("GoldPaper").value = curTemp.GoldPaper;
|
document.getElementById("Silver").value = curTemp.Silver;
|
|
if (document.getElementById("pack_type").value == "GMT_AddEntireCompensation") {
|
document.getElementById("PlayerLV").value = curTemp.PlayerLV;
|
document.getElementById("LimitLVType").value = curTemp.LimitLVType + "";
|
document.getElementById("CheckState").value = curTemp.CheckState + "";
|
}
|
} else {
|
document.getElementById("MailTempName").value = "";
|
document.getElementById("EndDate").value = sumDateByDays(7);
|
document.getElementById("Title").value = "";
|
document.getElementById("Text").value = "";
|
document.getElementById("Gold").value = 0;
|
document.getElementById("GoldPaper").value = 0;
|
document.getElementById("Silver").value = 0;
|
|
if (document.getElementById("pack_type").value == "GMT_AddEntireCompensation") {
|
document.getElementById("PlayerLV").value = 30;
|
document.getElementById("LimitLVType").value = "0";
|
document.getElementById("CheckState").value = "1";
|
}
|
}
|
|
// 修改物品 compensationitem.js 中的
|
var itemdiff = tempItems - itemNumArray.length
|
while (itemdiff > 0) {
|
AddItemHtml();
|
itemdiff -= 1;
|
}
|
while (itemdiff < 0) {
|
DelItemHtml(itemNumArray[itemNumArray.length - 1]);
|
itemdiff += 1;
|
}
|
for (let index = 0; index < tempItems; index++) {
|
const itemInfo = curTemp.Items[index];
|
const itemNum = itemNumArray[index];
|
document.getElementById("ItemID" + itemNum).value = itemInfo[0];
|
document.getElementById("ItemCnt" + itemNum).value = itemInfo[1];
|
document.getElementById("IsBind" + itemNum).value = itemInfo[2] + "";
|
onItemIDChange(itemNum, itemInfo[0]);
|
}
|
}
|
|
function sumDateByDays(days) {
|
var date = new Date();
|
date.setDate(date.getDate() + days);
|
var month = date.getMonth() + 1;
|
var day = date.getDate();
|
return date.format("yyyy-MM-dd")
|
// return date.getFullYear() + '-' + month + '-' + day;
|
}
|
|
// 保存修改模板
|
function onSaveMailTemp(formName) {
|
var mailTempSelObj = document.getElementById("MailTemp");
|
var tempIndex = mailTempSelObj.selectedIndex - 1;
|
if (tempIndex < 0) {
|
alert(gt.gettext("需选中指定邮件模板后操作"));
|
return false;
|
}
|
if (document.getElementById("MailTempName").value == "") {
|
alert(gt.gettext("模板名称不能为空"));
|
return false;
|
}
|
var curForm = document.forms[0];
|
curForm.action = "CompensationTempMgr.php";
|
curForm.submit();
|
return true;
|
}
|
|
// 删除模板
|
function onDelMailTemp() {
|
var mailTempSelObj = document.getElementById("MailTemp");
|
var tempIndex = mailTempSelObj.selectedIndex - 1;
|
if (tempIndex < 0) {
|
alert(gt.gettext("需选中指定邮件模板后操作"));
|
return false;
|
}
|
if (!confirm(gt.gettext("确定删除邮件模板") + ": " + mailTempSelObj.options[mailTempSelObj.selectedIndex].text)) {
|
return false;
|
}
|
var curForm = document.forms[0];
|
curForm.action = "CompensationTempMgr.php";
|
curForm.submit();
|
return true;
|
}
|
|
// 保存为新模板
|
function onSaveNewMailTemp() {
|
if (document.getElementById("MailTempName").value == "") {
|
alert(gt.gettext("模板名称不能为空"));
|
return false;
|
}
|
var curForm = document.forms[0];
|
curForm.action = "CompensationTempMgr.php";
|
curForm.submit();
|
return true;
|
}
|