chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />  
<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
<style>
* {margin: 0 ;padding: 0;}
body,div{ margin: 0 ;padding: 0;}
</style>
<title>后台管理</title>
</head>
<body class="body_ifm">
<div class="infoboxp">
<div class="admin_new_tip">
<a href="javascript:;" class="admin_new_tip_close"></a>
<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
<div class="admin_new_tip_list_cont">
<div class="admin_new_tip_list">添加广告时,请正确选择类型。广告形式(联盟广告、图片和flash)等个性化设置。</div>
</div>
</div>
<div class="clear"></div>
  <div class="tag_box mt10">
 
  <iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe> 
  <form name="myform" target="supportiframe" action="index.php?m=advertise&c=ad_saveadd" method="post" encType="multipart/form-data" onsubmit="return checkform();" class="layui-form">
    <table width="100%" class="table_form">
       <tr >  
       <tbody>
          <th bgcolor="#f0f6fb" colspan="2" ><span class="admin_bold">{yun:}if is_array($info){/yun}更新广告{yun:}else{/yun}添加广告{yun:}/if{/yun}</span></th>
            </tbody>
            </tr >
      <tr >
        <th width="200">广告名称:</th>
        <td>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <div class="layui-input-inline">
                   <input class="input-text" id="ad_name" value="{yun:}$info.ad_name{/yun}" name="ad_name" size="30">
                   <input type="checkbox" name="target" value="2" {yun:}if $info.target!=1{/yun}checked{yun:}/if{/yun} title="新窗口打开">
                 </div>
               </div>
            </div>
        </td>
      </tr>
 
         <tr>
        <th width="200">广告所属分类:</th>
        <td>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <div class="layui-input-inline">
                   <select name="class_id" lay-filter="" id="class_id_val">
                      <option value="">请选择</option>
                      {yun:}foreach from=$class item=v{/yun}
                      <option value="{yun:}$v.id{/yun}" {yun:}if $info.class_id==$v.id{/yun}selected{yun:}/if{/yun}>{yun:}$v.class_name{/yun}</option>
                      {yun:}/foreach{/yun}
                    </select>
                 </div>
               </div>
            </div>
        </td>
      </tr> 
      <tr class="admin_table_trbg">
        <th width="200">广告是否启用:</th>
        <td>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <div class="layui-input-inline">
                   <input name='is_open' value='1' type='radio' {yun:}if $info.is_open == '1'{/yun}checked{yun:}/if{/yun} title="启用"/>
                   <input name='is_open' value='0' type='radio' {yun:}if $info.is_open == '0'{/yun}checked{yun:}/if{/yun} title="关闭"/>
                 </div>
               </div>
            </div>
        </td>
      </tr>
      <tr>
        <th width="200">排序:</th>
        <td>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <div class="layui-input-inline">
                   <input class="input-text" type="text" id="sort" value="{yun:}$info.sort{/yun}" name="sort" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')"/>
                 </div>
                 <div class="layui-form-mid layui-word-aux">越大越在前</div>
               </div>
            </div></td>
      </tr>
      <tr class="admin_table_trbg">
        <th width="200">广告有效期:</th>
        <td>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <div class="layui-input-inline">
                   <input class="layui-input input-text" type="text" id="ad_time_start" size="30" value="{yun:}$info.time_start{/yun}" name="ad_time_start" placeholder="生效时间" style="width:100px;"/>
                 </div>
                 <div class="layui-input-inline">
                   <input class="layui-input input-text" type="text" id="ad_time_end" size="30" value="{yun:}$info.time_end{/yun}" name="ad_time_end" placeholder="结束时间" style="width:100px;"/>
                 </div>
               </div>
            </div>
          </td>
      </tr>
        <tr>
            <th width="200">备注:</th>
            <td><textarea cols="50" rows="3" name="remark"  class="admin_comdit_textarea">{yun:}$info.remark{/yun}</textarea></td>
        </tr>
         <tr>
        <th width="200">广告类型:</th>
        <td colspan="2">
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <input type="radio" id="word_ad" name="ad_type" lay-filter="ad_type" value="word" {yun:}if $info.ad_type=="word"{/yun}checked{yun:}/if{/yun} title="文字广告">
                 <input value="pic" type="radio" id="pic_ad" lay-filter="ad_type" name="ad_type" {yun:}if $info.ad_type=="pic"{/yun}checked{yun:}/if{/yun} title="图片广告">
                 <input type="radio" value="flash" id="flash_ad" lay-filter="ad_type" name="ad_type" {yun:}if $info.ad_type=="flash"{/yun}checked{yun:}/if{/yun} title="FLASH广告">
                 <input type="radio" value="lianmeng" id="lianmeng_ad" lay-filter="ad_type" name="ad_type" {yun:}if $info.ad_type=="lianmeng"{/yun}checked{yun:}/if{/yun} title="联盟广告">
               </div>
            </div>
          </td>
      </tr>
      <tr> 
      <td class="admin_table_trbg" colspan="2" style="padding:0; background:none">
      <table width="100%" id="word" style="display:none">
        <tr class="admin_table_trbg">
           <th width="200" >文字信息:</th>
        <td ><input class='input-text' id="word_info" name='word_info' value='{yun:}$info.word_info{/yun}'></td>
      </tr>
      <tr>
        <th>文字链接:</th>
        <td><input class='input-text' id="word_url" name='word_url' value='{yun:}$info.word_url{/yun}'><span class="admin_web_tip">外部链接请加上“http://”</span></td>
      </tr>
      </table>
       </td>
      </tr>
      <tr>
      <td colspan="2" style="padding:0; background:none">
      <table id="pic" style="display:none;" width="100%">
      <tr class="admin_table_trbg">
        <th width="200" >图片地址:</th>
        <td  id='typeid'>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <input class='input-text' type='text' id='upload_url' name='pic_url' value='{yun:}$info.pic_url_n{/yun}'>
                 <div id="pic_div" class="yun_file_box_gg" style="display:none;">
                     <button type="button" class="yun_bth_pic noupload" lay-data="{imgid: 'imgicon',parentid:'imgparent'}">上传图片</button>
                     <input type="hidden" id="laynoupload" value="1"/>
                 </div>
                 
                 <input id='upload' lay-filter="upload" checked type='radio' name='upload' title="远程地址" value="upload">
                 <input id='upload_pic' lay-filter="upload" type='radio' name='upload' title="本地上传" value="upload_pic">
               </div>
            </div>
          </td>
      </tr>
      <tr class="{yun:}if $info.pic_url{/yun} {yun:}else{/yun}none{yun:}/if{/yun}" id="imgparent">
        <th width="200">图片:</th>
        <td><img id="imgicon" src="{yun:}$info.pic_url_n{/yun}" width="200"></td>
      </tr>
      <tr>
        <th width="200">图片链接:</th>
        <td><input class='input-text' id="pic_src" name='pic_src' value='{yun:}$info.pic_src{/yun}' ><span class="admin_web_tip">外部链接请加上“http://”</span></td>
      </tr>
      <tr class="admin_table_trbg">
        <th width="200">图片描述:</th>
        <td><input class='input-text' id="pic_content" name='pic_content' value='{yun:}$info.pic_content{/yun}' ><span class="admin_web_tip">例如:公司名称或图片介绍,可留空</span></td>
      </tr>
      <tr>
        <th width="200">图片宽度:</th>
        <td><input class='input-text' id="pic_width" size='8'onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" name='pic_width' value='{yun:}$info.pic_width{/yun}' style="width:90px;"> px(像素) </td>
      </tr>
      <tr>
        <th width="200">图片高度:</th>
        <td><input class='input-text' id="pic_height" size='8' onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" name='pic_height' value='{yun:}$info.pic_height{/yun}' style="width:90px;"> px(像素)</td>
      </tr>
       </table>
       <table id="flash" style="display:none;" width="100%">
           <tr class="admin_table_trbg">
            <th width="200">FLASH地址:</th>
            <td id='flashid'>
            <div class="layui-form-item">
              <div class="layui-input-block">
                 <input class='input-text' id="flash_url"  name='flash_url' value='{yun:}$info.flash_url{/yun}'>
                 <div id="flash_div" class="yun_file_box" style="display:none;">
                    上传falsh
                    <input  type="file" size="45" id='upload_flash_url' name='flash_url' class="yun_file_bth" >
                 </div>
                 <input type='radio' id='flash'  lay-filter="flash" checked name='flash' title="远程地址" value="flash">
                 <input type='radio' id='upload_flash'  lay-filter="flash" name='flash' title="本地上传" value="upload_flash">
               </div>
            </div>
             </td>
          </tr>
          <tr>
              <th >FLASH宽度:</th>
            <td><input class='input-text' id="flash_width" name='flash_width' value='{yun:}$info.flash_width{/yun}'> px(像素)
            </td>
      </tr>
                <tr>
              <th >FLASH高度:</th>
            <td><input class='input-text' id="flash_height" name='flash_height' value='{yun:}$info.flash_height{/yun}'> px(像素)</td> 
      </tr>
      </table>
      <table id="lianmeng" style="display:none;" width="100%">
           <tr class="admin_table_trbg">
            <th width="200">联盟广告代码:</th>
            <td id='lianmengid'>
            <textarea class="admin_comdit_textarea" cols="50" rows="3" id="lianmeng_url"  name='lianmeng_url'>{yun:}$info.lianmeng_url{/yun}</textarea>
             </td>
          </tr>
      </table>
      </td>
      </tr>
      {yun:}if is_array($info){/yun}
      <input type="hidden" name="id" value="{yun:}$info.id{/yun}">
      {yun:}/if{/yun}
      <tr class="admin_table_trbg">
      <td align="left">&nbsp;</td>
        <td align="left" >
        <input type="hidden" name="pytoken" value="{yun:}$pytoken{/yun}">
        <input class="layui-btn layui-btn-normal" type="submit" name="submit" value="&nbsp;提  交&nbsp;" />
        <input class="layui-btn layui-btn-normal" type="reset" name="reset" value="&nbsp;重 置 &nbsp;" /></td>
      </tr>
    </table>
  </form>
</div>
</div>
<script>
 
    layui.use(['layer', 'form','laydate'], function(){
        var layer = layui.layer
        ,form = layui.form
        ,laydate = layui.laydate
        ,$ = layui.$;
    
        laydate.render({
            elem: '#ad_time_start'
            // ,range:'~'
        });
    
        if('{yun:}$info.ad_type{/yun}'){
            $("#{yun:}$info.ad_type{/yun}").show();
        }
        
        laydate.render({
            elem: '#ad_time_end'
            // ,range:'~'
        });
        
        form.on('radio(ad_type)', function(data){
            var type = data.value;  
            if(type=="word"){
                $("#word").show();
                $("#pic").hide();
                $("#flash").hide();
                $("#lianmeng").hide();
            }else if(type=="pic"){
                $("#word").hide();
                $("#pic").show();
                $("#flash").hide();
                $("#lianmeng").hide();
            }else if(type=="flash"){
                $("#word").hide();
                $("#pic").hide();
                $("#flash").show();
                $("#lianmeng").hide();
            }else if(type=="lianmeng"){
                $("#word").hide();
                $("#pic").hide();
                $("#flash").hide();
                $("#lianmeng").show();
            }
            
            form.render();
        });
        
        form.on('radio(upload)', function(data){
            var type = data.value;  
            if(type=="upload"){
                $("input[name=upload]").removeAttr('checked');
                $("input[name=pic_url]").removeAttr('name');
                $("#upload").attr('checked');
                $("#upload_url").attr('name','ad_url');
                $("#pic_div").hide();
                $("#upload_url").show();
            }else if(type=="upload_pic"){
                $("input[name=upload]").removeAttr('checked');
                $("input[name=pic_url]").removeAttr('name');
                $("#upload_pic").attr('checked');
                $("#upload_pic_url").attr('name','ad_url');
                $("#pic_div").show();
                $("#upload_url").hide();
            }
            
            form.render();
        });
        
        form.on('radio(flash)', function(data){
            var type = data.value;  
            if(type=="flash"){
                $("input[name=flash]").removeAttr('checked');
                $("input[name=flash_url]").removeAttr('name');
                $("#flash").attr('checked');
                $("#flash_url").attr('name','flash_url');
                $("#flash_div").hide();
                $("#flash_url").show();
            }else if(type=="upload_flash"){
                $("input[name=flash]").removeAttr('checked');
                $("input[name=flash_url]").removeAttr('name');
                $("#upload_flash").attr('checked');
                $("#upload_flash_url").attr('name','flash_url');
                $("#flash_div").show();
                $("#flash_url").hide();
            }
            
            form.render();
        });
    
});    
    function checkform(){
        if($("#ad_name").val()==""){ 
            parent.layer.msg('广告名称不能为空!', 2,8);
            return false;
        }
        if($("#ad_time_start").val()==""){ 
            parent.layer.msg('请填写广告生效时间!', 2,8);
            return false;
        }
 
          if($("#ad_time_end").val()==""){ 
            parent.layer.msg('请填写广告结束时间!', 2,8);
            return false;
          }
 
        var item = $('input[name="ad_type"]:checked').val();
        
        if(!item){
             parent.layer.msg('请选择一种广告类型!', 2,8); return false;
        }else{ 
            if(item=="word"&&$("input[name=word_info]").val()==""){
                parent.layer.msg('请填写文字信息!', 2,8); return false;
            }
        }
        loadlayer();
    }
    
    
var weburl = '{yun:}$config.sy_weburl{/yun}';
</script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui.upload.js?v={yun:}$config.cachecode{/yun}" type='text/javascript'></script> 
</body>
</html>