// 图文导航·组件 var graphicNavPreviewHtml = '
'; graphicNavPreviewHtml += '
'; graphicNavPreviewHtml += ''; graphicNavPreviewHtml += '
'; graphicNavPreviewHtml += '
'; Vue.component("graphic-nav", { data: function () { return { id: "graphic_nav_" + get_math_rant(10), data: this.$parent.data, list: this.$parent.data.list, selectedTemplate : this.$parent.data.selectedTemplate } }, created: function () { if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods: { verify :function () { var res = { code: true, message: "" }; return res; }, }, template: graphicNavPreviewHtml }); /** * [图片导航的图片]·组件 */ var graphicNavListHtml = '
'; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
    '; graphicNavListHtml += '
  • '; graphicNavListHtml += '' graphicNavListHtml += '' graphicNavListHtml += '
  • '; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
    '; graphicNavListHtml += '
  • '; graphicNavListHtml += '' graphicNavListHtml += '' graphicNavListHtml += '
  • '; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += '

其他设置

'; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += ''; graphicNavListHtml += '
'; graphicNavListHtml += '
'; graphicNavListHtml += '
'; Vue.component("graphic-nav-list",{ data : function(){ return { data : this.$parent.data, showAddItem : true, list : this.$parent.data.list, scrollSettingList : [{ name : "固定", value : "fixed", max : 5 },{ name : "横向滚动", value : "horizontal-scroll", max : 20 }], scrollSetting : this.$parent.data.scrollSetting, imageScale : this.$parent.data.imageScale, padding : this.$parent.data.padding, selectedTemplate : this.$parent.data.selectedTemplate, maxTip : 5,//最大上传数量提示 selectedTemplateList : [{ name : '图片导航', value : 'imageNavigation', src : graphicNavResourcePath + "/graphic_nav/img/img.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/img_1.png" },{ name : '文字导航', value : 'textNavigation', src : graphicNavResourcePath + "/graphic_nav/img/font.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/font_1.png" }], showTypeList: [{ name : '一行三个', value : '3', src : graphicNavResourcePath + "/graphic_nav/img/three.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/three_1.png" }, { name : '一行四个', value : '4', src : graphicNavResourcePath + "/graphic_nav/img/four.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/four_1.png" }, { name : '一行五个', value : '5', src : graphicNavResourcePath + "/graphic_nav/img/five.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/five_1.png" }] }; }, created : function(){ this.changeShowAddItem(); if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, watch : { list : function(){ this.changeShowAddItem(); }, scrollSetting : function(){ //更新父级对象 this.$parent.data.scrollSetting = this.scrollSetting; //当前滚动方式切换到固定时,要检测当前集合是否超过最多限制max if(this.scrollSetting == this.scrollSettingList[0].value && this.list.length>this.scrollSettingList[0].max){ this.list.splice(5,this.scrollSettingList[0].max); } this.changeShowAddItem(); }, selectedTemplate : function(){ this.$parent.data.selectedTemplate = this.selectedTemplate; if(this.selectedTemplate == "imageNavigation"){ $(".draggable-element[data-index='" + this.data.index + "'] .graphic-navigation .graphic-nav-list>ul>li input[name='title']").removeAttr("style"); }else{ $(".draggable-element[data-index='" + this.data.index + "'] .graphic-navigation .graphic-nav-list>ul>li .error-msg").text("").hide(); } } }, methods : { //改变图文导航按钮的显示隐藏 changeShowAddItem : function(){ if(this.scrollSetting == this.scrollSettingList[0].value){ if(this.list.length >= this.scrollSettingList[0].max) this.showAddItem = false; else this.showAddItem = true; this.maxTip = this.scrollSettingList[0].max; }else if(this.scrollSetting == this.scrollSettingList[1].value){ if(this.list.length >= this.scrollSettingList[1].max) this.showAddItem = false; else this.showAddItem = true; this.maxTip = this.scrollSettingList[1].max; } }, //改变图片比例 changeImageScale : function(event){ var v = event.target.value; if(v != ""){ if(v > 0 && v <= 100){ this.imageScale = v; this.$parent.data.imageScale = this.imageScale;//更新父级对象 }else{ layer.msg("请输入合法数字1~100"); } }else{ layer.msg("请输入合法数字1~100"); } }, //改变上下边距 changePadding : function(event){ var v = event.target.value; if(v != ""){ if(v >= 0 && v <= 100){ this.padding = v; this.$parent.data.padding = this.padding;//更新父级对象 }else{ layer.msg("请输入合法数字0~100"); } }else{ layer.msg("请输入合法数字0~100"); } }, verify:function () { var res = { code : true, message : "" }; var _self = this; $(".draggable-element[data-index='" + this.data.index + "'] .graphic-navigation .graphic-nav-list .template-edit-wrap>ul>li").each(function(index){ if(_self.selectedTemplate == "imageNavigation"){ $(this).find("input[name='title']").removeAttr("style");//清空输入框的样式 //检测是否有未上传的图片 if(_self.list[index].imageUrl == ""){ res.code = false; res.message = "请选择一张图片"; $(this).find(".error-msg").text("请选择一张图片").show(); return res; }else{ $(this).find(".error-msg").text("").hide(); } }else{ if(_self.list[index].title == ""){ res.code = false; res.message = "请输入标题"; $(this).find("input[name='title']").attr("style","border-color:red !important;").focus(); $(this).find(".error-msg").text("请输入标题").show(); return res; }else{ $(this).find("input[name='title']").removeAttr("style"); $(this).find(".error-msg").text("").hide(); } } }); return res; } }, template : graphicNavListHtml }); var navRadiusHtml = '
'; navRadiusHtml += ''; navRadiusHtml += '
'; navRadiusHtml += ''; navRadiusHtml += ''; navRadiusHtml += '
'; navRadiusHtml += '
'; Vue.component("nav-radius",{ template : navRadiusHtml, data : function(){ return { data : this.$parent.data, navRadius: [ { text: "直角", value: "right-angle", src: graphicNavResourcePath + "/graphic_nav/img/right-angle.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/right-angle_1.png" }, { text: "圆角", value: "fillet", src: graphicNavResourcePath + "/graphic_nav/img/fillet.png", selectedSrc: graphicNavResourcePath + "/graphic_nav/img/fillet_1.png" } ], } }, created : function(){ if(!this.$parent.data.verify) this.$parent.data.verify = []; this.$parent.data.verify.push(this.verify);//加载验证方法 }, methods : { verify :function () { var res = {code: true, message: ""}; return res; }, }, });