Commit 3f42f449 by 肖康

x

parent 15e7e49c
...@@ -3,13 +3,40 @@ var tag={ ...@@ -3,13 +3,40 @@ var tag={
hbisAct:0,//是否画布区域 hbisAct:0,//是否画布区域
isClick:0, isClick:0,
init:function(){ init:function(){
tag.editUi();
if($("#templateid").val()){
//编辑
tag.getInfo();
}else{
//新增
tag.editUi();
}
tag.handle(); tag.handle();
}, },
getInfo:function(){
$.ajax({
url : '/ajax/getTemplateDetail?t_id='+$("#templateid").val(),
type: 'get',
success: function(resp) {
if (resp.err_code == 0) {
$(".designName").val(resp.data.template_name)
var abobj=eval('('+resp.data.template_extend.attribute+')');
$(".tag-border").val(abobj.lableBorder);
$(".tag-bgm").val(abobj.lableBg);
$(".tag-size").val(abobj.lableSize);
$(".edit-box").html(resp.data.template_extend.html);
tag.editUi();
}
},
error: function(err) {
console.log(err)
}
})
},
editUi:function(){ editUi:function(){
$("body").attr("onselectstart","return false"); $("body").attr("onselectstart","return false");
// 基本实例化: // 基本实例化:
$('#colorpicker').colorpicker(); $('#colorpicker').colorpicker();
//编辑画布渲染样式 //编辑画布渲染样式
var gezilist=$(".tag-size").val().split("*"); var gezilist=$(".tag-size").val().split("*");
...@@ -359,27 +386,30 @@ var tag={ ...@@ -359,27 +386,30 @@ var tag={
$(".edit-con .huabuitem").removeClass("act"); $(".edit-con .huabuitem").removeClass("act");
$(".edit-con").removeClass("init-border"); $(".edit-con").removeClass("init-border");
obj.htmlp=String($(".edit-box").html()); obj.htmlp=String($(".edit-box").html());
obj.designName=$(".designName").val() obj.designName=$(".designName").val();
$.ajax({ if($("#templateid").val()){
url : '/ajax/add_template', obj.t_id =$("#templateid").val()
type: 'post', }
data: obj, $.ajax({
success: function(resp) { url : '/ajax/add_template',
if (resp.err_code == 0) { type: 'post',
layer.msg("提交成功",{time:2000}); data: obj,
setTimeout(function(){ success: function(resp) {
window.location.href="/web/labelList" if (resp.err_code == 0) {
},2000) layer.msg("提交成功",{time:2000});
setTimeout(function(){
}else{ window.location.href="/web/labelList"
layer.msg(resp.err_msg,{time:2000}); },2000)
tag.editUi();
}else{
layer.msg(resp.err_msg,{time:2000});
tag.editUi();
}
},
error: function(err) {
console.log(err)
} }
}, })
error: function(err) {
console.log(err)
}
})
}) })
......
<input type="hidden" id="templateid" value='{{Request::input("t_id")}}'/>
<div class="tag-content"> <div class="tag-content">
<div class="tag-tools"> <div class="tag-tools">
<div class="tips">请拖动此处标签制作工具到下方编辑区域编辑!</div> <div class="tips">请拖动此处标签制作工具到下方编辑区域编辑!</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment