123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867 |
- {include file="public/layout" /}
-
- <body class="bodystyle" style="overflow-y: scroll;">
- <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div class="page min-hg-c-10">
- <form class="form-horizontal" id="post_form" action="{:url('ZczsPosition/add')}" method="post">
- <div class="ncap-form-default">
- <dl class="row">
- <dt class="tit"> <label for="title"><em>*</em>证书名称</label> </dt>
- <dd class="opt">
- <input type="text" name="title" id="title" onkeyup="DetectionTitleRepeat(this);" class="input-txt" autocomplete="off">
- <span class="err"></span>
- <p class="notic2 red" id="title_tips"></p>
- </dd>
- </dl>
-
- <dl class="row" style="display:block;">
- <dt class="tit">
- <label for="type">选择级别</label>
- </dt>
- <dd class="opt">
-
-
- <!--<label class="curpoin"><input type="radio" id="type{$field1.id}" name="type" value="{$field1.id}" onclick="TypeSwitch({$field1.id});">{$field1.name}</label>
- -->
-
- <?php
- /*
- * {eyou:foreach name='$pro_list' item='field1'}
- <option value="{$field1.id}" {eq name="$Request.param.type" value="$field1.id"}selected{/eq}>{$field1.name}</option>
- {/eyou:foreach}
- */
- ?>
- <select name="type2" class="select" id="selectTest" style="margin:0px 5px;height:30px;">
- {eyou:foreach name='$pos_list' item='field1'}
- <option value="{$field1.id}" {eq name="$pid" value="$field1.id"}selected{/eq}>{$field1.name}</option>
- {/eyou:foreach}
- </select>
-
- {eyou:notempty name='$pos_list2' /}
- <select name="type" class="select" id="selectTest2" style="margin:0px 5px;height:30px;">
- {eyou:foreach name='$pos_list2' item='field1'}
- <option value="{$field1.id}" {eq name="$pid" value="$field1.id"}selected{/eq}>{$field1.name}</option>
- {/eyou:foreach}
- </select>
- {eyou:else /}
- <span>请先添加二级分类</span>
- <input type="hidden" name="type" value="">
- {/eyou:notempty}
-
-
- <script>
- $(function(){
- $("#selectTest").change(function(e){
- console.log($(this).val());
- var v = $(this).val();
- if(v == 1){
- //$('#citychoose').show();
- }else{
- //$('#citychoose').hide();
- }
-
- //ajax
- $.ajax({
- type:'POST',
- url:"{:url('ZczsPosition/getType', ['_ajax'=>1])}",
- data:{
- id: $(this).val()
- ,_ajax:1
- },
- success:function(res){
- $('#selectTest2').html(res.data);
- }
- });
-
- });
- });
- </script>
-
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
-
- <dl class="row" id="citychoose" style="display: block;">
- <dt class="tit"> <label for="title"><em>*</em>绑定学历</label> </dt>
- <dd class="opt">
-
- <select name="bdxl" class="select" id="selectTest2" style="margin:0px 5px;height:30px;">
- <?php
- /*<option value="{$field1.id}" {eq name="$pid" value="$field1.id"}selected{/eq}>{$field1.name}</option>*/
- ?>
- <option value="0">选择学历</option>
- <option value="1">中专</option>
- <option value="2">高技</option>
- <option value="3">大专</option>
- <option value="4">本科</option>
- <option value="5">硕士</option>
- <option value="6">博士</option>
- </select>
-
- <span class="err"></span>
- <p class="notic2 red" id="title_tips"></p>
- </dd>
- </dl>
-
-
- <dl class="row" id="citychoose" style="display: none;">
- <dt class="tit"> <label for="title"><em>*</em>地区选择</label> </dt>
- <dd class="opt">
-
- <!---checked-->
- {eyou:foreach name='$pro_list' item='field1'}
- <input type="checkbox" name="map[]" value="{$field1.id}" id="category{$field1.id}"/>{$field1.name}
- {/eyou:foreach}
-
- <span class="err"></span>
- <p class="notic2 red" id="title_tips"></p>
- </dd>
- </dl>
-
-
- <dl class="row 1615775137_dl" style="display: none;" id="1615775137_1">
- <dt class="tit"> <label>主题背景</label> </dt>
- <dd class="opt">
- <div class="tab-pane" id="tab_imgupload">
- <table class="table table-bordered">
- <tbody>
- <tr>
- <td >
- <div class="sort-list">
- <div class="images_upload">
- </div>
- </div>
- <a href="javascript:void(0);" onClick="GetUploadify(30,'','allimg','imgupload_call_back');" class="img-upload b-img-upload mb15" title="点击上传">
- <div class="y-line"></div>
- <div class="x-line"></div>
- </a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- 上传图片显示的样板 start -->
- <div class="images_upload_tpl none">
- <div class="images_upload ic">
- <div class="ic">
- <div class='upimg' title="拖动修改排序" onmouseover="upimgMouseover(this);" onmouseout="upimgMouseout(this);">
- <div class='icaction' style="display: none">
- <span class="load_images" onclick="">
- <a href="javascript:void(0);" style="color: white">
- <i class='fa fa-search-plus'></i>大图
- </a>
- </span>
- <span class="load_images" onclick="">
- <i class='fa fa-file-text-o'></i>信息
- </span>
- </div>
- <div class='cover-bg' style="display: none"></div>
- <img src="__STATIC__/admin/images/add-button.jpg"/>
- <a class="delect" href="javascript:void(0);" title="删除"></a>
- </div>
-
- <div class="load_input" data-showOrHide="hide">
- <input type="hidden"/>
- <span class="span_input"> <input type="hidden"/> </span>
- <textarea placeholder="请输入标题..." style="height: 28px;"></textarea>
- <textarea placeholder="请输入链接网址..." style="height: 28px;"></textarea>
- <textarea placeholder="广告注释:支持HTML代码" style="height: 64px;"></textarea>
- <div class="operation">
- <a href="javascript:void(0)"> </a>
- <a href="javascript:void(0)"> </a>
- <a style="width: 32%;" href="javascript:void(0);"> </a>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 上传图片显示的样板 end -->
- </dd>
- </dl>
-
- <dl class="row 1615775137_dl" style="display: none;" id="1615775137_2">
- <dt class="tit"> <label for="type">广告内容</label> </dt>
- <dd class="opt">
- <input type="text" name="video_litpic" id="video_litpic" class="input-txt">
- <input type="file" id="courseware_file" data-type='local' onchange="upload_video_litpic_1615775137(this)" style="display: none;">
- {eq name="$WeappOpen.qny_open" value="1"}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_qiniu" onclick="$('#courseware_file').attr('data-type', 'qiniu').trigger('click');">七牛云上传</a>
- {/eq}
- {eq name="$WeappOpen.oss_open" value="1"}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_oss" onclick="$('#courseware_file').attr('data-type', 'oss').trigger('click');">oss上传</a>
- {/eq}
- {eq name="$WeappOpen.cos_open" value="1"}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_video_litpic_cos" onclick="$('#courseware_file').attr('data-type', 'cos').trigger('click');">cos上传</a>
- {/eq}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green " id="upload_video_litpic_local" onclick="$('#courseware_file').attr('data-type', 'local').trigger('click');">本地上传</a>
- <input type="hidden" id="OpenPreviewVideoUrl" value="{:url('ZczsPosition/open_preview_video')}">
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="PreviewVideo" onclick="OpenPreviewVideo();">预览</a>
- </dd>
- </dl>
-
- <dl class="row 1615775137_dl" style="display: none;" id="1615775137_3">
- <dt class="tit"> <label for="type">广告内容</label> </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="html_intro" name="html_intro" style="height: 200px;"></textarea>
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
-
- <dl class="row">
- <dt class="tit">
- <label>备注信息</label>
- </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="intro" name="intro" style="height:60px;"></textarea>
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
-
- <div class="bot"><a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
- </div>
- </form>
- </div>
-
- <script type="text/javascript">
- var SelectedType = 1;
- $(function() {
- // 新增时,广告类型默认选中图片类型
- $('#type1').prop('checked', 'checked');
- // 新增时,默认显示图片上传
-
- //$('#1615775137_1').show();
-
- // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
- VideoLitpicValue('#video_litpic');
- });
-
- // 切换广告类型
- function TypeSwitch(typeValue) {
- // 隐藏全部类型内容
- $('.1615775137_dl').hide();
- // 显示指定类型内容
- $('#1615775137_'+typeValue).show();
- // 切换类型后设置为当前切换的类型
- SelectedType = typeValue;
- // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
- VideoLitpicValue('#video_litpic');
- }
-
- // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
- function VideoLitpicValue(obj) {
- // 获取广告内容(多媒体为播放链接)
- // var video_litpic = $(obj).val();
- // 判断隐藏/显示预览按钮if (2 == SelectedType && video_litpic)
- if (2 == SelectedType) {
- $('#PreviewVideo').show();
- } else {
- $('#PreviewVideo').hide();
- }
- }
-
- // 打开预览视频
- function OpenPreviewVideo() {
- // 获取视频链接
- var video_litpic = $('#video_litpic').val();
- if (video_litpic == '') {
- $('#video_litpic').focus();
- showErrorMsg('请先上传视频');
- return false;
- }
-
- /* 视频链接后缀验证处理 */
- var fileExt = video_litpic.substr(video_litpic.lastIndexOf('.')).toLowerCase();
- var fileExt = judgeExt(fileExt);
- if (fileExt == -1) {
- $('#video_litpic').focus();
- showErrorMsg('不支持的视频格式,可在附件设置中修改');
- return false;
- }
- /* END */
-
- /* 视频链接是否存在斜杠处理 */
- var fileInfo = video_litpic.lastIndexOf('/');
- if (fileInfo == -1) {
- $('#video_litpic').focus();
- showErrorMsg('视频链接不完整,无法正常预览');
- return false;
- }
- /* END */
-
- // 打开视频播放
- $.ajax({
- type : 'post',
- url : $('#OpenPreviewVideoUrl').val(),
- data : {video_litpic: video_litpic},
- dataType : 'json',
- success : function(res) {
- if (1 == res.code) {
- var PreviewVideo = "<video style='width:100%; height:100%;' src='"+res.url+"' controls preload='auto' oncontextmenu='return fase' autoplay></video>";
- layer.open({
- type: 1,
- title: false,
- fixed: true, //不固定
- shadeClose: false,
- shade: layer_shade,
- area: ['80%', '80%'],
- content: PreviewVideo
- });
- } else {
- showErrorMsg(res.msg);
- }
- },
- error: function(e) {
- showErrorAlert(e.responseText);
- }
- });
- }
-
- // 上传媒体文件
- function upload_video_litpic_1615775137(e) {
- var data_type = $(e).attr('data-type');
- if ('qiniu' == data_type) {
- // 七牛云上传
- upload_video_litpic_qiniu(e);
- } else if ('oss' == data_type) {
- // OSS上传
- upload_video_litpic_oss(e);
- } else if ('cos' == data_type) {
- // COS上传
- upload_video_litpic_cos(e);
- } else {
- // 本地上传
- upload_video_litpic_local(e);
- }
- }
-
- // 七牛云上传
- function upload_video_litpic_qiniu(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext == -1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 执行上传
- layer_loading('上传本地');
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1) {
- if (1 == res1.code) {
- var token = res1.data.token;
- var formData = new FormData();
- formData.append('file', file);
- formData.append('token', token);
-
- fileName = res1.data.filePath + fileExt;
- formData.append('key', fileName);
- $.ajax({
- url: res1.data.uphost,
- type: 'POST',
- dataType: 'JSON',
- data: formData,
- timeout: 1200000,
- cache: false,
- processData: false,
- contentType: false,
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#upload_video_litpic_qiniu").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res2) {
- layer.closeAll();
- $("#upload_video_litpic_qiniu").text('上传成功');
- setTimeout(function() {
- $('#upload_video_litpic_qiniu').text('七牛云上传');
- }, 2000);
- var video_url = res1.data.domain + "/" + res2.key;
- $("#video_litpic").val(video_url);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- return false;
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 阿里云OSS上传
- function upload_video_litpic_oss(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext == -1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 执行上传
- layer_loading('上传阿里云OSS');
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- fileName = res1.data.filePath + fileExt;
- //组装发送数据
- var request = new FormData();
- request.append("OSSAccessKeyId",res1.data.accessid);
- request.append("policy",res1.data.policy);
- request.append("Signature",res1.data.signature);
- request.append("key",fileName);
- request.append("success_action_status",201);
- request.append('file', file);
-
- $.ajax({
- url : res1.data.host,
- data : request,
- processData: false,
- cache: false,
- contentType: false,
- dataType: 'xml',
- type : 'post',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- $("#upload_video_litpic_oss").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success : function(data) {
- layer.closeAll();
- var res = $(data).find('PostResponse');
- if (res) {
- var key = res.find('Key').text();
- $("#upload_video_litpic_oss").text('上传成功');
- setTimeout(function() {
- $('#upload_video_litpic_oss').text('oss上传');
- }, 2000);
- var video_url = res1.data.domain + "/" + key;
- $("#video_litpic").val(video_url);
- } else {
- $("#upload_video_litpic_oss").text('上传失败');
- setTimeout(function() {
- $('#upload_video_litpic_oss').text('oss上传');
- }, 2000);
- }
- },
- error : function(e) {
- layer.closeAll();
- console.log(e.responseText);
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 腾讯云COS上传
- function upload_video_litpic_cos(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext == -1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 上传参数
- var formData = new FormData();
- formData.append('file', file);
- formData.append('file_ext', fileExt);
-
- // 执行上传
- $.ajax({
- type: 'post',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- if (100 == process) {
- process = 99;
- layer_loading('上传腾讯云');
- }
- $("#upload_video_litpic_cos").text('上传中...'+process+"%");
-
- });
- }
- return myXhr;
- },
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- $("#video_litpic").val(res.data.url);
- $("#upload_video_litpic_cos").text('上传成功');
- } else {
- $("#upload_video_litpic_cos").text('上传失败');
- }
- setTimeout(function() {
- $('#upload_video_litpic_cos').text('cos上传');
- }, 2000);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 本地上传
- function upload_video_litpic_local(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext == -1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 定义上传数据
- var formData = new FormData();
- formData.append('file', file);
-
- // 执行上传
- layer_loading('上传本地');
- $.ajax({
- type: 'post',
- url : "{:url('Ueditor/upVideo', ['savepath'=>'media'])}",
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#upload_video_litpic_local").html('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function (res) {
- layer.closeAll();
- $("#upload_video_litpic_local").html('上传成功');
- setTimeout(function() {
- $('#upload_video_litpic_local').html('本地上传');
- }, 2000);
- if ("SUCCESS" == res.state) {
- $("#video_litpic").val(res.url);
- } else {
- showErrorMsg(res.msg);
- }
- }
- });
- }
-
- // 验证格式
- function judgeExt(ext) {
- var type = "{$media_type}";
- var extArr = [];
- extArr = type.split("|");
- var ext = ext.replace(".","");
- return extArr.indexOf(ext);
- }
- </script>
-
- <script type="text/javascript">
- var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- // 勾选新窗口打开链接
- function CheckedTarget(t){
- if ($(t).is(':checked')) {
- $(t).parent().find('input[name="img_target[]"]').val(1);
- }else{
- $(t).parent().find('input[name="img_target[]"]').val(0);
- }
- }
- // 鼠标事件,加载查看大图和更新图片
- function upimgMouseover(obj)
- {
- $(obj).find('div.icaction').show();
- $(obj).find('div.cover-bg').show();
- }
- function upimgMouseout(obj)
- {
- $(obj).find('div.icaction').hide();
- $(obj).find('div.cover-bg').hide();
- }
-
- // 检测广告名称是否存在重复
- function DetectionTitleRepeat(obj) {
- // 当前广告ID
- var id = 0;
- // 传入的广告名称
- var title = $(obj).val();
- // 执行检测
- $.ajax({
- type: 'post',
- url : "{:url('ZczsPosition/detection_title_repeat', ['_ajax'=>1])}",
- data: {id: id, title: title},
- dataType: 'json',
- success: function(res) {
- if (0 == res.code) {
- $('#title_tips').show().html(res.msg);
- } else {
- $('#title_tips').hide().html('');
- }
- },
- error: function(e){
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
-
- // 判断输入框是否为空
- function checkForm(){
- if($('input[name=title]').val() == ''){
- layer.msg('名称不能为空!', {icon: 2,time: 1000});
- return false;
- }
-
- if($('input[name=type]').val() == ''){
- layer.msg('分类不能为空,请添加二级分类!', {icon: 2,time: 1000});
- return false;
- }
-
- /*if($('#selectTest').val() == '1'){
- var checkedValues = [];
- $('#post_form input[type=checkbox]:checked').each(function() {
- checkedValues.push($(this).val());
- });
- console.log(checkedValues); // 打印选中的checkbox值
- if(checkedValues.length > 0){
-
- }else{
- layer.msg('请选择地区!', {icon: 2,time: 1000});
- return false;
- }
- }*/
-
-
- //打印
- /*console.log($('#post_form').serialize());
- return false;*/
-
-
- layer_loading('正在处理');
- $.ajax({
- type : 'post',
- url : "{:url('ZczsPosition/add', ['_ajax'=>1])}",
- data : $('#post_form').serialize(),
- dataType : 'json',
- success : function(res) {
- layer.closeAll();
- if (1 == res.code) {
- var _parent = parent;
- _parent.layer.close(parentObj);
- _parent.layer.msg(res.msg, {icon: 1, shade: layer_shade, time: 1000}, function() {
- _parent.window.location.reload();
- });
- } else {
- showErrorMsg(res.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
-
- // 显示信息输入框
- function ShowInput(id) {
- var obj = $("#"+id+"_ShowInput");
- var showOrHide = obj.attr('data-showOrHide');
- if ('hide' == showOrHide) {
- obj.show().attr('data-showOrHide', 'show');
- } else {
- obj.hide().attr('data-showOrHide', 'hide');
- }
- }
-
- // 隐藏信息输入
- function HideInput(id) {
- $("#"+id+"_ShowInput").hide().attr('data-showOrHide', 'hide');
- }
-
- // 上传图集相册回调函数
- function imgupload_call_back(paths){
- var last_div = $(".images_upload_tpl").html();
- var inputs = $('.span_input input');
- var timestamp = 0;
-
- for (var i=0; i<paths.length; i++){
- // 生成新的时间戳
- timestamp = (new Date()).getTime();
- // 插入一个 新图片
- $(".images_upload:eq(0)").before(last_div);
- // 处理他的链接地址
- $(".images_upload:eq(0)").find('span:eq(0)').attr('onclick',"Images('"+paths[i]+"', 900, 600);");
- // 处理信息显示隐藏按钮
- $(".images_upload:eq(0)").find('span:eq(1)').attr('onclick', "ShowInput('"+timestamp+"');");
- // 处理他的图片路径
- $(".images_upload:eq(0)").find('img').attr('src',paths[i]);
- // 处理删除按钮
- $(".images_upload:eq(0)").find('a:eq(1)').attr('onclick', "ClearPicArr(this, '"+paths[i]+"', 0);");
- // 处理图片信息框ID
- $(".images_upload:eq(0)").find('.load_input:eq(0)').attr('id', timestamp+'_ShowInput');
-
- // 处理图片路径及隐藏域
- if (inputs.length > '0') {
- // 修改隐藏域,提交ID隐藏域
- $(".images_upload:eq(0)").find('input:eq(0)').attr('name','img_id[]').attr('value','');
- // 修改隐藏域,提交图片隐藏域
- $(".span_input:eq(0)").find('input:eq(0)').attr('name','img_litpic[]').attr('value',paths[i]);
- // 提交标题
- $(".images_upload:eq(0)").find('textarea:eq(0)').attr('name','img_title[]');
- // 提交跳转链接
- $(".images_upload:eq(0)").find('textarea:eq(1)').attr('name','img_links[]');
- // 处理内容描述
- $(".images_upload:eq(0)").find('textarea:eq(2)').attr('name','img_intro[]');
- // 提交新窗口选项
- $(".images_upload:eq(0)").find('div.operation a:eq(0)').html("<label><input type='checkbox' title='在新窗口打开' onclick='CheckedTarget(this)'/>新窗口<input type='hidden' name='img_target[]' value='0'></label>");
- // 处理收回按钮
- $(".images_upload:eq(0)").find('div.operation a:eq(2)').attr('onclick', "HideInput('"+timestamp+"');").attr('title', "收回").html('<i style="font-size:16px;" class="fa fa-angle-double-up"></i>');
- }
- }
- }
-
- // 上传之后删除组图input
- function ClearPicArr(obj,path)
- {
- $(obj).parent().parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
- $.ajax({
- type:'POST',
- url:"{:url('Uploadimgnew/delupload')}",
- data:{action:"del", filename:path, _ajax:1},
- success:function(){}
- });
- }
-
- // 代码调用js
- function copyToClipBoard(id) {
- var adstr = "{eyou:ad aid='" + id + "'}\r\n <a href='{$"+"field.links}' {$"+"field.target}><img src='{$"+"field.litpic}' alt='{$"+"field.title}' /></a>\r\n{/eyou:ad";
- var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 ad 调用:</dd>'
- contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:80px;">' + adstr + '}</textarea>'
- contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将对应标签代码复制并粘贴到对应模板文件中!</dd></dl></div>'
- layer.open({
- title: '代码调用',
- type: 1,
- shade: layer_shade,
- skin: 'layui-layer-demo',
- area: ['480px', '240px'], //宽高
- content: contentdiv
- });
- }
-
- // 图集相册的拖动排序相关 js
- $( ".sort-list" ).sortable({
- start: function( event, ui) {
-
- }
- ,stop: function( event, ui ) {
-
- }
- });
- //因为他们要拖动,所以尽量设置他们的文字不能选择。
- // $( ".sort-list" ).disableSelection();
- </script>
-
- {include file="public/footer" /}
|