90 lines
2.4 KiB
JavaScript
90 lines
2.4 KiB
JavaScript
|
$(function () {
|
|||
|
var sninfo;
|
|||
|
var refreshInfo = function () {
|
|||
|
var lbl = $("#regInfo").removeClass().addClass("label label-normal");
|
|||
|
|
|||
|
if (sninfo.type === "NRML" || sninfo.type === 'PART') {
|
|||
|
lbl.addClass("label-success");
|
|||
|
} else if (sninfo.type === "GROP") {
|
|||
|
lbl.addClass("label-info");
|
|||
|
} else if (sninfo.type === "DONT") {
|
|||
|
lbl.addClass("label-primary");
|
|||
|
}
|
|||
|
lbl.html("注册给:" + sninfo.name + "," + sninfo.typeDesc);
|
|||
|
};
|
|||
|
|
|||
|
message.sendAction("getSnInfo", null, function (reg) {
|
|||
|
sninfo = reg;
|
|||
|
|
|||
|
if (!sninfo || sninfo.result !== 0) {
|
|||
|
sninfo = { result: 0, type: "NRML", typeDesc: "正式版", name: "行将回家的游子们" };
|
|||
|
}
|
|||
|
|
|||
|
refreshInfo();
|
|||
|
});
|
|||
|
message.sendAction("getVersionInfo", null, function (info) {
|
|||
|
$("#versionInfo").html("v" + info.curVersion);
|
|||
|
if (info.updateInfo && info.updateInfo.version && info.updateInfo.hasUpdate) {
|
|||
|
$("#updatesFound").show().find("strong").html(info.updateInfo.version).end().find("a").attr("href", info.updateInfo.url || "http://www.fishlee.net/soft/44/download.html");
|
|||
|
} else {
|
|||
|
$("#updatesFound").hide();
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
$("#btnReg").click(function () {
|
|||
|
var key = $.trim($("#txtsn").val());
|
|||
|
if (!key) {
|
|||
|
alert("请输入密钥哦");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
message.sendAction("setSnInfo", key, function (reg) {
|
|||
|
if (!reg || reg.result !== 0) {
|
|||
|
alert((reg && reg.msg) || "未知错误");
|
|||
|
} else {
|
|||
|
sninfo = reg;
|
|||
|
refreshInfo();
|
|||
|
|
|||
|
$("#reg").modal("hide");
|
|||
|
alert("注册成功!\n\n注册给:" + reg.name + "\n版 本:" + reg.typeDesc);
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
|
|||
|
$(function() {
|
|||
|
var refreshSysConfig = function () {
|
|||
|
$("input[data-sysconfigkey], select[data-sysconfigkey]").each(function () {
|
|||
|
var ele = this;
|
|||
|
var $ele = $(this);
|
|||
|
var type = ele.type;
|
|||
|
var key = ele.dataset.sysconfigkey;
|
|||
|
|
|||
|
var profile = sysConfig;
|
|||
|
var propertyvalue = profile[key];
|
|||
|
if (typeof propertyvalue == 'boolean') {
|
|||
|
if (type == "radio") {
|
|||
|
$("input[name=" + ele.name + "][value=" + (propertyvalue ? 1 : 0) + "]")[0].checked = true;
|
|||
|
} else if (type == "checkbox") {
|
|||
|
ele.checked = propertyvalue;
|
|||
|
} else {
|
|||
|
$ele.val(propertyvalue ? "1" : "0");
|
|||
|
}
|
|||
|
} else {
|
|||
|
$ele.val(propertyvalue);
|
|||
|
}
|
|||
|
});
|
|||
|
};
|
|||
|
|
|||
|
$(document).on("sysConfigUpdated", function () {
|
|||
|
refreshSysConfig();
|
|||
|
});
|
|||
|
if (sysConfig)
|
|||
|
refreshSysConfig();
|
|||
|
|
|||
|
$("#chkEnableAutoCaptcha").change(function () {
|
|||
|
message.sendAction("setUserConfig", { enableAutoCaptcha: this.checked });
|
|||
|
});
|
|||
|
|
|||
|
});
|