cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title></title>
[#include "/business/pages/include/static.html" /]
</head>
<body class="edit_txt_body">
 
<script type="text/javascript">
$(function() {
           //增加onchange事件;
            var dateHtml=['<tr name="validHtml">',
                '<th align="right"><label class="required">宽:</label></th>',
                ' <td><input type="text" value="${info.titleimage_width}" class="input-text" name="titleimage_width" id="titleimage_width"></input>',
                ' <div id="titleimage_widthTip" style="width:100px;"></div>',
                '</td>',
                '</tr>',
                '<tr name="valid">',
                '<th align="right"><label class="required">高:</label></th>',
                ' <td><input type="text" value="${info.titleimage_height}" class="input-text" name="titleimage_height" id="titleimage_height"></input>',
                ' <div id="titleimage_heightTip" style="width:100px;"></div>',
                ' </tr>'];
            $("#thumbnail").change(function(){
                
               var value = $("#thumbnail").val();
                var trObj = $('#datatypeTr');
                $("[name=validHtml]").remove();
                $("[name=valid]").remove();
                if(2==value||3==value){
                    trObj.after(dateHtml.join(''));
                }
            });
            [#if info.ID??]
                var value = '${info.THUMBNAIL}';
                var trObj = $('#datatypeTr');
                $("[name=validHtml]").remove();
                $("[name=valid]").remove();
                if(2==value||3==value){
                    trObj.after(dateHtml.join(''));
                    $("#titleimage_width").val('${info.TITLEIMAGE_WIDTH}');
                    $("#titleimage_height").val('${info.TITLEIMAGE_HEIGHT}');
                }
            [/#if]
            $.formValidator.initConfig({formID:"myform",onError:function(msg){alert(msg)},onSuccess:function(){
                document.getElementById("myform").target = window.top.openDialog("1","操作",
                         {},
                         {"width":40,"height":40},[{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
               
                return true;
            }});
            
            
            $("#category_name").formValidator({empty:false,onShow:"请填写分类名称",onFocus:"分类名称不能为空!"})
                    .inputValidator({min:1,max:50,onError:"分类名称长度不能超过50个字符!"})
                    .ajaxValidator({
                dataType : "html",   
                async : true,     
                data:"id=${info.ID}",
                url : "${base}/business/pages/cms/page/checkClassifyName.html",
                success : function(data){    
                    if( data == 1 ) return true;
                    if( data == 0 ) return false;
                    return false;
                },
                buttons: $("#dosubmit"),
                error: function(jqXHR, textStatus, errorThrown){alert("服务器没有返回数据,可能服务器忙,请重试"+errorThrown);},
                onError : "该分类名称已存在,请更换",
                onWait : "正在对分类名称进行校验,请稍候..."  
            });
            
            $("#ordernum").formValidator({empty:false,onFocus:"请输入顺序号"})
            .inputValidator({min:1,max:2,onError:"顺序号必须为1到2位数字"})
            .regexValidator({regExp:"intege", dataType:"enum", onError:"顺序号必须为1到2位数字"});
            
            $("#titleimage").formValidator({empty:false,onShow:"请选择",onFocus:"不能为空!"})
            .inputValidator({min:1,onError:"请选择!"});
            
            $("#content").formValidator({empty:false,onShow:"请选择",onFocus:"不能为空!"})
            .inputValidator({min:1,onError:"请选择!"});
             
             $("#summary").formValidator({empty:false,onShow:"请选择",onFocus:"不能为空!"})
            .inputValidator({min:1,onError:"请选择!"});
            
            $("#thumbnail").formValidator({empty:false,onShow:"请选择",onFocus:"不能为空!"})
            .inputValidator({min:1,onError:"请选择!"});
});
 
</script>
 
<div class="edit_txt">
    <form action="saveClassify.html" method="post"  id="myform" name="myform" >
         <input type="hidden" name="up_id" value="${info.UP_ID}" />
         <input type="hidden" name="id" value="${info.ID}" />
         <table class="edit_layout" width="99%">
                <tr><th ><label class="required" >分类名称:</label></th>
                    <td><input class="general" type="text" name="category_name" id="category_name" value="${info.CATEGORY_NAME}"/>
                    <div id="category_nameTip" style="display:inline-block;width:180px;"></div>
                    </td>
                </tr>
                
                
                <tr><th><label class="required">显示顺序:</label></th>
                    <td ><input class="general" type="text" name="ordernum"  id="ordernum"  value="${info.ORDERNUM}"/>
                    <div id="ordernumTip" style="display:inline-block;width:180px;"></div>
                    </td>
                </tr>
                <tr>
                    <th ><label class="required">标题图片:</label></th>
                    <td>
                    <select id="titleimage" name="titleimage" style="width:180px;" class="general">
                        <option value="">请选择</option>
                        <option value="1" [#if info.titleimage==1]selected[/#if]>是</option> 
                        <option value="2" [#if info.titleimage==2]selected[/#if]>否</option>  
                    </select> 
                    <div id="titleimageTip" style="display:inline-block;width:150px;"></div>
                    </td>
                </tr>
                <tr>
                    <th ><label class="required">内容:</label></th>
                    <td>
                    <select id="content" name="content" style="width:180px;" class="general">
                        <option value="">请选择</option>
                        <option value="1" [#if info.content==1]selected[/#if]>是</option> 
                        <option value="2" [#if info.content==2]selected[/#if]>否</option>  
                    </select> 
                    <div id="contentTip" style="display:inline-block;width:180px;"></div>
                    </td>
                </tr>
                <tr>
                    <th ><label class="required">摘要:</label></th>
                    <td>
                    <select id="summary" name="summary" style="width:180px;" class="general">
                        <option value="">请选择</option>
                        <option value="1" [#if info.summary==1]selected[/#if]>是</option> 
                        <option value="2" [#if info.summary==2]selected[/#if]>否</option>  
                    </select> 
                    <div id="summaryTip" style="display:inline-block;width:180px;"></div>
                    </td>
                </tr>
                <tr id="datatypeTr">
                    <th ><label class="required">缩略图:</label></th>
                    <td>
                        <select id="thumbnail" name="thumbnail" style="width:180px;" class="general">
                            <option value="">请选择</option>
                            <option value="1" [#if info.thumbnail==1]selected[/#if]>不启用</option> 
                            <option value="2" [#if info.thumbnail==2]selected[/#if]>等比</option> 
                            <option value="3" [#if info.thumbnail==3]selected[/#if]>强制</option> 
                        </select> 
                        <div id="thumbnailTip" style="display:inline-block;width:180px;"></div>
                    </td>
                      </tr>
                      <tr>
                    <th><label >备注:</label></th>
                    <td>
                        <textarea cols="10" class="general" style="width:90%; height:90px;" rows="4" name="note" id="note">
                        </textarea>
                    </td>
                </tr>
                 
            </table>
     </form>
</div>
 
 
 
<script type="text/javascript">
function onDialogBtnClick(btnID, dialogID, config){
        if(btnID == "btnSure"){
             var value = $("#thumbnail").val();
                if(2==value||3==value){
                    var max= $.trim($("#titleimage_width").val());
                    var min= $.trim($('#titleimage_height').val());
                    if(max==''||min==''){
                        window.top.popupTips("宽和高不能为空");
                        return false;
                    }
                    var reg=/^\d*$/;
                    if(!reg.test(max)||!reg.test(min)){
                       window.top.popupTips("宽和高必须是数字");
                        return false;
                    }
                }
            $("#myform").submit();
        }
    }
 
</script>
 
 
</body>
</html>