You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

341 lines
10 KiB

/**
* Created by Administrator on 2016/11/28.
*/
$("#titleWrite").click(function () {
$("#left-content").css("display", "block")
if ($("#write").css("display") == "none") {
$("#write").show();
$("#send").hide()
}
$(".container").css("width", "1170px");
$("div[lay-id=send]").remove();
});
$("#send").css("display", "none");
$("#titleSend").click(function () {
$("#left-content").css("display", "none");
if ($("#send").css("display") == "none") {
$("#send").show();
$("#write").hide()
}
$(".container").css("width", "1600px");
$("#send").find(".row").remove();
$(function () {
var args = initPage('已发送');
setuptChartTable_new(0);
});
});
$("#titleReview").click(function () {
$("#left-content").css("display", "none");
if ($("#send").css("display") == "none") {
$("#send").show();
$("#write").hide()
}
$(".container").css("width", "1600px");
$("#send").find(".row").remove();
$(function () {
var args = initPage('待审核');
setuptChartTable_new(-1);
});
});
function itemCost(){
var cn = 0;
var jp = 0;
var kr = 0;
$("div[data-id='itemdiv']").each(function (i, e) {
debugger
var itemid = $(e).find("select[data-id='itemid']").select().val();
var itemnum = $(e).find("input[data-id='itemnum']").val();
if (itemid == "0" || itemnum == "") {
return true; //结束本次循环
}
if (itemid == '-1') {
return true;
}
if(itemid != '0' && itemnum == '0') {
return true;
}
if (itemCostList != null) {
for (let [key, value] of Object.entries(itemCostList)) {
if (value.itemId == itemid) {
cn += value.cn * itemnum;
kr += value.kr * itemnum;
jp += value.jp * itemnum;
}
}
}
});
return [cn,kr,jp];
}
$("#content").on("input propertychange", function () {
//$("#btn").removeAttr("disabled")
});
function send() {
debugger;
var sub_data = {};
sub_data.name = $('#name').val().toLocaleLowerCase();
start = $('#timeLimit_start').val();
end = $('#timeLimit_end').val();
if (start == "" || start == null) {
alert("请设置发送时间");
return;
}
if (end == "" || end == null) {
alert("请设置发送时间");
return;
}
sub_data.timeLimit = start + "#" + end;
sub_data.versionParam = $('#versionParam').val();
sub_data.playerCreateTime = $('#playerCreateTime').val();
sub_data.token = checkCookie();
sub_data.uuid = uuid;
sub_data.isSendToAll = $('input[name="isSendToAll"]:checked').val();
sub_data.isReview = $('input[name="isReview"]:checked').val();
var flag = false;
var Isverification = true;
sub_data.areaNameList = areaList;
sub_data.customRealmStr = customRealmlist;
sub_data.timeParamStr = startListTime + '#' + endListTime;
//多语言
sub_data.contentList = [];
$("div[data-id=contentdiv]").each(function (i, e) {
var language = $(e).find("select[data-id='language']").val();
var title = $(e).find("input[data-id='title']").val();
var content = $(e).find("textarea[data-id='content']").val();
var senderName = $(e).find("input[data-id='senderName']").val();
if (sub_data.contentList.findIndex(f => f.language == language) != -1) {
Isverification = false;
alert(language + "语言重复了!");
return false;
}
sub_data.contentList.push({
title: title,
language: language,
content: content,
senderName: senderName
});
});
if (!Isverification) {
return;
}
//支持的服务器
var _realmlist = realmlistSelect?.getValue('value');
_realmlist.sort((a, b) => a - b);
sub_data.realmlist = _realmlist.join(',');
if((sub_data.areaNameList.length > 0 || sub_data.customRealmStr) && sub_data.realmlist == '0') {
sub_data.realmlist = ''
}
//道具
sub_data.itemstr = "";
$("div[data-id='itemdiv']").each(function (i, e) {
debugger
var itemid = $(e).find("select[data-id='itemid']").select().val();
var itemnum = $(e).find("input[data-id='itemnum']").val();
if (itemid == "0" || itemnum == "") {
return true; //结束本次循环
}
if (itemid == '-1') {
return true;
}
if(itemid != '0' && itemnum == '0') {
flag = true;
}
if (i == 0) {
sub_data.itemstr += `${itemid}|${itemnum}`;
} else {
sub_data.itemstr += `#${itemid}|${itemnum}`;
}
});
//武器
sub_data.equipStr = "";
$("div[data-id='equipdiv']").each(function (i, e) {
debugger
var equipid = $(e).find("select[data-id='equipid']").select().val();
var equipnum = $(e).find("input[data-id='equipnum']").val();
if (equipid == "0" || equipnum == "") {
return true; //结束本次循环
}
if (equipid == '-1') {
return true;
}
if(equipid != '0' && equipnum == '0') {
flag = true;
}
if (i == 0) {
sub_data.equipStr += `${equipid}|${equipnum}`;
} else {
sub_data.equipStr += `#${equipid}|${equipnum}`;
}
});
//货币
var greaterTwo = 0
sub_data.curstr = "";
// $("div[data-id='curdiv']").each(function (i, e) {
// var curid = $(e).find("[data-id='curid']").val();
// var curnum = $(e).find("input[data-id='curnum']").val();
// if (curid == "0" || curnum == "") {
// return true; //结束本次循环
// }
// if (curid == "2") {
// greaterTwo += Number(curnum)
// }
// if(curid != '0' && curnum == '0') {
// flag = true;
// }
// if (i == 0) {
// sub_data.curstr += `${curid}|${curnum}`;
// } else {
// sub_data.curstr += `#${curid}|${curnum}`;
// }
// });
// if(greaterTwo > 100000) {
// layer.msg('钻石数量不能大于100000');
// return;
// }
//自定义
sub_data.customItemStr = "";
// $("div[data-id='customItemDiv']").each(function (i, e) {
// var curtype = $(e).find("select[data-id='customItemType']").select().val();
// var curid = $(e).find("select[data-id='customItemId']").select().val();
// var curnum = $(e).find("input[data-id='customItemNum']").val();
// if (curtype == "0" ||curtype == "" || curid == "0" || curid == "" || curnum == "0"|| curnum == "") {
// return true; //结束本次循环
// }
// if (i == 0) {
// sub_data.customItemStr += `${curtype}|${curid}|${curnum}`;
// } else {
// sub_data.customItemStr += `#${curtype}|${curid}|${curnum}`;
// }
// });
//
$("div[data-id='skindiv']").each(function (i, e) {
var curtype = '4';
var curid = $(e).find("[data-id='skinid']").val();
var curnum = $(e).find("input[data-id='skinnum']").val();
if (curid == "0" || curnum == "") {
return true; //结束本次循环
}
if (sub_data.customItemStr == '') {
sub_data.customItemStr += `${curtype}|${curid}|${curnum}`;
} else {
sub_data.customItemStr += `#${curtype}|${curid}|${curnum}`;
}
});
$("div[data-id='gemdiv']").each(function (i, e) {
var curtype = '5';
debugger
var curid = $(e).find("[data-id='gemid']").val();
var curnum = $(e).find("input[data-id='gemnum']").val();
if (curid == "0" || curnum == "") {
return true; //结束本次循环
}
if (sub_data.customItemStr == '') {
sub_data.customItemStr += `${curtype}|${curid}|${curnum}`;
} else {
sub_data.customItemStr += `#${curtype}|${curid}|${curnum}`;
}
});
$.ajax({
url: Page.SvrIp + "/api/send_email?token=" + cookie.get("token"),
type: 'post',
//contentType: 'application/json',
data: JSON.stringify(sub_data),
beforeSend: function () {
/*$("#waite-send").css("display","block");*/
},
complete: function (data) {
/*$("#waite-send").css("display","none");*/
},
success: function (data) {
if (data.ret == 3) {
alert(data.msg);
}
else if (data.ret == 0) {
sessionStorage.setItem('uuid', Guid.NewGuid().ToString());
uuid = sessionStorage.getItem('uuid');
location.reload();
alert(data.msg);
} else {
alert(data.msg)
}
},
error: function (data) {
alert("连接失败或正在发送中,请等待")
}
});
}
$("#btn").click(function () {
var name = $('#name').val().toLocaleLowerCase();
if (name == "") {
alert("收件人不能为空");
$('#name').focus();
return false
}
//if (name == "all" || name == "android" || name == "ios") {
if ($('#timeLimit_start').val() == '' || $('#timeLimit_start').val() == '0') {
alert("请填写正确有效时长");
return false
}
if ($('#timeLimit_end').val() == '' || $('#timeLimit_end').val() == '0') {
alert("请填写正确有效时长");
return false
}
// }
if ($('input[data-id="title"]').val() == "") {
alert("标题不能为空")
return false
}
if ($('textarea[data-id="content"]').val() == "") {
alert("内容不能为空")
return false
}
let costList = itemCost();
debugger;
let tips = "";
if((costList[0]+costList[1]+costList[2])>0){
tips='该邮件所携带的奖励价值:'+costList[0]+"人名币,约"+costList[1]+"韩元,约"+costList[2]+"日元";
}
layer.confirm(tips+"\r\n 确定要发送嘛?", function(index){
send();
layer.close(index);
},function(){
console.dir("close send mail")
});
});
// $("#sure").click(function () {
// send();
// });