...
|
...
|
@@ -9,6 +9,14 @@ var ENMA = { |
|
|
1: "图片",
|
|
|
2: "视频",
|
|
|
3: "文本"
|
|
|
},
|
|
|
dia:{
|
|
|
1:"img",
|
|
|
2:"video",
|
|
|
3:"wenZi"
|
|
|
},
|
|
|
bucket:{
|
|
|
bucket:"goodsimg"
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -27,7 +35,7 @@ var g = new common.grid({ |
|
|
}, {
|
|
|
display: "内容",
|
|
|
render: function(item) {
|
|
|
item.orderBy == item.__index;
|
|
|
item.orderBy = (item.__index+1);
|
|
|
if (item.isDefault == 1) {
|
|
|
return '<input type="file" name="coverImg" id="coverImg" value="' + item.attachUrl + '" placeholder="封面图" required/>';
|
|
|
} else {
|
...
|
...
|
@@ -36,7 +44,7 @@ var g = new common.grid({ |
|
|
} else if (item.attachType == 2) {
|
|
|
return "<video src='" + item.attachUrl + "' controls></video>";
|
|
|
} else {
|
|
|
return item.attachUrl;
|
|
|
return item.intro;
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -61,7 +69,7 @@ g.__rows = __ac ? JSON.parse(__ac) : [{ |
|
|
}];
|
|
|
|
|
|
g.init(g.__rows);
|
|
|
var e1 = new common.edit('#baseTable');
|
|
|
var e1 = new common.edit('#baseTable',ENMA.bucket);
|
|
|
e1.on("callback", function(obj) {
|
|
|
if (obj.key == "file_onComplete_coverImg") {
|
|
|
g.__rows[0].attachUrl = obj.data;
|
...
|
...
|
@@ -76,7 +84,7 @@ $(window).on('beforeunload', function() { |
|
|
}
|
|
|
});
|
|
|
//初始化form表单
|
|
|
var e = new common.edit('#editor-group');
|
|
|
var e = new common.edit('#editor-group',ENMA.bucket);
|
|
|
|
|
|
|
|
|
e.on("validate", function() {
|
...
|
...
|
@@ -84,12 +92,42 @@ e.on("validate", function() { |
|
|
batchNo: $('#batchNo').val(),
|
|
|
id: $("#id").val()
|
|
|
};
|
|
|
return common.util.__ajax({
|
|
|
url: '/limit/checkBatch',
|
|
|
async: true,
|
|
|
var _m="批次号接口接口异常";
|
|
|
common.util.__ajax({
|
|
|
url: '/limit/getLimitCodeByBatchNo',
|
|
|
async: false,
|
|
|
data: param
|
|
|
}, null, true);
|
|
|
}, function(res){
|
|
|
console.log(res);
|
|
|
if(res.data){
|
|
|
_m="";
|
|
|
}else{
|
|
|
_m="批次号不存在";
|
|
|
}
|
|
|
}, true);
|
|
|
if(_m){
|
|
|
return _m;
|
|
|
}else{
|
|
|
common.util.__ajax({
|
|
|
url: '/limit/checkBatch',
|
|
|
async: false,
|
|
|
data: param
|
|
|
}, function(res){
|
|
|
console.log(res);
|
|
|
if(res.data){
|
|
|
_m="";
|
|
|
}else{
|
|
|
_m=res.message;
|
|
|
}
|
|
|
}, true);
|
|
|
|
|
|
if(_m){
|
|
|
return _m;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
///limit/getLimitCodeByBatchNo
|
|
|
|
|
|
|
|
|
e.on("validate", function() {
|
|
|
if (!g.__rows[0].attachUrl) {
|
...
|
...
|
@@ -102,27 +140,41 @@ e.on("validate", function() { |
|
|
if (limitProductType == 2) {
|
|
|
if (activityId == "") {
|
|
|
return "请填写排队限购ID";
|
|
|
} else {
|
|
|
var exists = false;
|
|
|
common.util.__ajax2({
|
|
|
url: '/limit/DrawlineActivityRest/checkActivityIdExists',
|
|
|
async: false,
|
|
|
data: {
|
|
|
activityId: activityId
|
|
|
}else{
|
|
|
var _m="排队限购ID接口异常";
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/DrawlineActivityRest/checkActivityIdExists',
|
|
|
async:false,
|
|
|
data:{activityId:activityId}
|
|
|
},function(res){
|
|
|
if(res.data.exists){//true
|
|
|
_m="";
|
|
|
}else{
|
|
|
_m="排队限购ID不存在";
|
|
|
}
|
|
|
}, function(res) {
|
|
|
if (res.code == 200) {
|
|
|
if (res.data.exists) {
|
|
|
exists = true;
|
|
|
},true);
|
|
|
if(_m){
|
|
|
return _m;
|
|
|
}else{
|
|
|
///limit/checkActivityIdNoExist
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/checkActivityIdNoExist',
|
|
|
async:false,
|
|
|
data:{activityId:activityId,id: $("#id").val()}
|
|
|
},function(res){
|
|
|
console.log("checkActivityIdNoExist",res);
|
|
|
if(res.data){//true
|
|
|
_m="";
|
|
|
}else{
|
|
|
_m="排队限购ID"+activityId+"已被关联";
|
|
|
}
|
|
|
},true);
|
|
|
|
|
|
if(_m){
|
|
|
return _m;
|
|
|
}
|
|
|
return true;
|
|
|
});
|
|
|
if (!exists) {
|
|
|
return "排队限购ID不存在";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
e.on("validate", function() {
|
...
|
...
|
@@ -132,13 +184,6 @@ e.on("validate", function() { |
|
|
}
|
|
|
});
|
|
|
|
|
|
e.on("validate", function() {
|
|
|
var limitProductType = $("#limitProductType").val();
|
|
|
var activityId = $.trim($("#activityId").val());
|
|
|
if (limitProductType == 2 && activityId == "") {
|
|
|
return "请填写排队限购ID";
|
|
|
}
|
|
|
});
|
|
|
|
|
|
function orderByIsRequired(val) {
|
|
|
if (val == 1) {
|
...
|
...
|
@@ -195,12 +240,9 @@ $('.limit-add-btn').click(function(option) { |
|
|
// type = $('#limit-add-form').attr('type');
|
|
|
|
|
|
var Bll = {
|
|
|
imgVideo: function(title, item, index) {
|
|
|
if (item.attachType == 2 || item.__attachType == 2) {
|
|
|
item.extend = "mp4"
|
|
|
};
|
|
|
img: function(title, item, index) {
|
|
|
common.dialog.confirm(title, common.util.__template($("#picDialogTemp").html(), item), function() {
|
|
|
var _html = $.trim($("#imgVideoText").val());
|
|
|
var _html = $.trim($("#imgText").val());
|
|
|
|
|
|
if (_html) {
|
|
|
if (item.attachType) {
|
...
|
...
|
@@ -209,7 +251,7 @@ var Bll = { |
|
|
} else {
|
|
|
//添加
|
|
|
g.__rows.push({
|
|
|
"attachType": item.__attachType,
|
|
|
"attachType":1,
|
|
|
"attachUrl": _html,
|
|
|
"isDefault": 0,
|
|
|
"attachName": $("#attachName").val()
|
...
|
...
|
@@ -220,27 +262,67 @@ var Bll = { |
|
|
e1.init();
|
|
|
}
|
|
|
});
|
|
|
var a = new common.edit("#upload-wrapper");
|
|
|
var a = new common.edit("#upload-wrapper",ENMA.bucket);
|
|
|
a.on("callback", function(obj) {
|
|
|
if (obj.key == "file_onComplete_imgVideo") {
|
|
|
$("#imgVideoText").val(obj.data);
|
|
|
if (obj.key == "file_onComplete_imgfile") {
|
|
|
$("#imgText").val(obj.data);
|
|
|
}
|
|
|
});
|
|
|
a.init();
|
|
|
},
|
|
|
video:function(title, item, index){
|
|
|
common.dialog.confirm(title, common.util.__template($("#vidioDialogTemp").html(), item), function() {
|
|
|
var _html = $.trim($("#videoText").val());
|
|
|
var _html1 = $.trim($("#imgText").val());
|
|
|
if (_html&&_html1) {
|
|
|
if (item.attachType) {
|
|
|
//修改
|
|
|
g.__rows[index].attachUrl = _html;
|
|
|
g.__rows[index].intro = _html1;
|
|
|
} else {
|
|
|
//添加
|
|
|
g.__rows.push({
|
|
|
"attachType": 2,
|
|
|
"attachUrl": _html,
|
|
|
"intro":_html1,
|
|
|
"isDefault": 0,
|
|
|
"attachName": $("#attachName").val()
|
|
|
});
|
|
|
}
|
|
|
|
|
|
g.reload();
|
|
|
e1.init();
|
|
|
}
|
|
|
});
|
|
|
var a1 = new common.edit("#upload-wrapper1",ENMA.bucket);
|
|
|
a1.on("callback", function(obj) {
|
|
|
if (obj.key == "file_onComplete_videofile") {
|
|
|
$("#videoText").val(obj.data);
|
|
|
}
|
|
|
});
|
|
|
a1.init();
|
|
|
var a2 = new common.edit("#upload-wrapper2",ENMA.bucket);
|
|
|
a2.on("callback", function(obj) {
|
|
|
console.log(obj);
|
|
|
if (obj.key == "file_onComplete_imgfile") {
|
|
|
$("#imgText").val(obj.data);
|
|
|
}
|
|
|
});
|
|
|
a2.init();
|
|
|
},
|
|
|
wenZi: function(title, item, index) {
|
|
|
common.dialog.confirm(title, common.util.__template('<textarea id="text-editor">{attachUrl}</textarea>', item), function() {
|
|
|
common.dialog.confirm(title, common.util.__template('<textarea id="text-editor">{intro}</textarea>', item), function() {
|
|
|
var _html = $.trim($("#text-editor").val());
|
|
|
|
|
|
if (_html) {
|
|
|
if (item.attachType) {
|
|
|
//修改
|
|
|
g.__rows[index].attachUrl = _html;
|
|
|
g.__rows[index].intro = _html;
|
|
|
} else {
|
|
|
//添加
|
|
|
g.__rows.push({
|
|
|
"attachType": 3,
|
|
|
"attachUrl": _html,
|
|
|
"intro": _html,
|
|
|
"isDefault": 0
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -259,17 +341,11 @@ $('body').on('click', '#textDialog', function() { |
|
|
return false;
|
|
|
});
|
|
|
$('body').on('click', '#picDialog', function() {
|
|
|
Bll.imgVideo("添加图片", {
|
|
|
name: "图片",
|
|
|
__attachType: 1
|
|
|
});
|
|
|
Bll.img("添加图片",{});
|
|
|
return false;
|
|
|
});
|
|
|
$('body').on('click', '#videoDialog', function() {
|
|
|
Bll.imgVideo("添加视频", {
|
|
|
name: "视频",
|
|
|
__attachType: 2
|
|
|
});
|
|
|
Bll.video("添加视频",{});
|
|
|
return false;
|
|
|
});
|
|
|
//删除
|
...
|
...
|
@@ -282,5 +358,5 @@ $('body').on('click', ".delete", function() { |
|
|
//修改
|
|
|
$('body').on('click', ".edit", function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
Bll[item.attachType == 3 ? "wenZi" : "imgVideo"]("修改" + ENMA.attachType[item.attachType], item, $(this).data("index"));
|
|
|
Bll[ENMA.dia[item.attachType]]("修改" + ENMA.attachType[item.attachType], item, $(this).data("index"));
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|