/**
|
* 初始化详情对话框
|
*/
|
var TbStartPageDlg = {
|
tbStartPageData : {}
|
};
|
var language=$("#language").val();
|
/**
|
* 清除数据
|
*/
|
TbStartPageDlg.clearData = function() {
|
this.tbStartPageData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TbStartPageDlg.set = function(key, val) {
|
this.tbStartPageData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TbStartPageDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TbStartPageDlg.close = function() {
|
parent.layer.close(window.parent.TStartPage.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TbStartPageDlg.collectData = function() {
|
this
|
.set('id')
|
.set('publisher')
|
.set('image')
|
.set('type')
|
.set('link')
|
.set('sort')
|
.set('createTime')
|
.set('updateTime');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TbStartPageDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
let usePort = $("#usePort").val()
|
let name = $("#name").val()
|
let time = $("#time").val()
|
let img = $("#image").val()
|
if($("#image").val() == null ||$("#image").val()=='' ){
|
if(language==1){
|
Feng.error("请上传图标")
|
}else if(language==2){
|
Feng.error("Please upload the icon")
|
}else {
|
Feng.error("Harap unggah ikon")
|
}
|
|
return false;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/TStartPage/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.TbBanner.table.refresh();
|
TbStartPageDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("usePort",usePort);
|
ajax.set("name",name);
|
ajax.set("time",time);
|
ajax.set("img",img);
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
TbStartPageDlg.editSubmit = function() {
|
this.clearData();
|
this.collectData();
|
let type = $("#usePort").val()
|
let name = $("#name").val()
|
let img = $("#image").val()
|
|
console.log(img)
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/TStartPage/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TStartPage.table.refresh();
|
TbStartPageDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("type",type);
|
ajax.set("name",name);
|
ajax.set("img",img);
|
ajax.start();
|
}
|
TbStartPageDlg.showLink = function(data) {
|
let a = $("#type").val()
|
if(a==2 || data ==2){
|
$("#link1").hide()
|
}else if(a==1){
|
$("#link1").show()
|
}
|
}
|
|
$(function() {
|
var avatarUp = new $WebUpload("image");
|
avatarUp.setUploadBarId("progressBar");
|
avatarUp.init();
|
|
let id= $("#id").val();
|
if (id!=null&&id!=""){
|
$("#type").val($("#s1_").val());
|
|
let s1_= $("#s1_").val();
|
$("#type").val(s1_);
|
}
|
|
TbStartPageDlg.showLink( $("#type").val())
|
});
|