Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

add.htm 35KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="overflow-y: scroll;">
  3. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  4. <div id="append_parent"></div>
  5. <div id="ajaxwaitid"></div>
  6. <div class="page min-hg-c-10">
  7. <form class="form-horizontal" id="post_form" action="{:url('ZczsPosition/add')}" method="post">
  8. <div class="ncap-form-default">
  9. <dl class="row">
  10. <dt class="tit"> <label for="title"><em>*</em>证书名称</label> </dt>
  11. <dd class="opt">
  12. <input type="text" name="title" id="title" onkeyup="DetectionTitleRepeat(this);" class="input-txt" autocomplete="off">
  13. <span class="err"></span>
  14. <p class="notic2 red" id="title_tips"></p>
  15. </dd>
  16. </dl>
  17. <dl class="row" style="display:block;">
  18. <dt class="tit">
  19. <label for="type">选择级别</label>
  20. </dt>
  21. <dd class="opt">
  22. <!--<label class="curpoin"><input type="radio" id="type{$field1.id}" name="type" value="{$field1.id}" onclick="TypeSwitch({$field1.id});">{$field1.name}</label>
  23. -->
  24. <?php
  25. /*
  26. * {eyou:foreach name='$pro_list' item='field1'}
  27. <option value="{$field1.id}" {eq name="$Request.param.type" value="$field1.id"}selected{/eq}>{$field1.name}</option>
  28. {/eyou:foreach}
  29. */
  30. ?>
  31. <select name="type2" class="select" id="selectTest" style="margin:0px 5px;height:30px;">
  32. {eyou:foreach name='$pos_list' item='field1'}
  33. <option value="{$field1.id}" {eq name="$pid" value="$field1.id"}selected{/eq}>{$field1.name}</option>
  34. {/eyou:foreach}
  35. </select>
  36. {eyou:notempty name='$pos_list2' /}
  37. <select name="type" class="select" id="selectTest2" style="margin:0px 5px;height:30px;">
  38. {eyou:foreach name='$pos_list2' item='field1'}
  39. <option value="{$field1.id}" {eq name="$pid" value="$field1.id"}selected{/eq}>{$field1.name}</option>
  40. {/eyou:foreach}
  41. </select>
  42. {eyou:else /}
  43. <span>请先添加二级分类</span>
  44. <input type="hidden" name="type" value="">
  45. {/eyou:notempty}
  46. <script>
  47. $(function(){
  48. $("#selectTest").change(function(e){
  49. console.log($(this).val());
  50. var v = $(this).val();
  51. if(v == 1){
  52. //$('#citychoose').show();
  53. }else{
  54. //$('#citychoose').hide();
  55. }
  56. //ajax
  57. $.ajax({
  58. type:'POST',
  59. url:"{:url('ZczsPosition/getType', ['_ajax'=>1])}",
  60. data:{
  61. id: $(this).val()
  62. ,_ajax:1
  63. },
  64. success:function(res){
  65. $('#selectTest2').html(res.data);
  66. }
  67. });
  68. });
  69. });
  70. </script>
  71. <span class="err"></span>
  72. <p class="notic"></p>
  73. </dd>
  74. </dl>
  75. <dl class="row" id="citychoose" style="display: none;">
  76. <dt class="tit"> <label for="title"><em>*</em>地区选择</label> </dt>
  77. <dd class="opt">
  78. <!---checked-->
  79. {eyou:foreach name='$pro_list' item='field1'}
  80. <input type="checkbox" name="map[]" value="{$field1.id}" id="category{$field1.id}"/>{$field1.name}
  81. {/eyou:foreach}
  82. <span class="err"></span>
  83. <p class="notic2 red" id="title_tips"></p>
  84. </dd>
  85. </dl>
  86. <dl class="row 1615775137_dl" style="display: none;" id="1615775137_1">
  87. <dt class="tit"> <label>主题背景</label> </dt>
  88. <dd class="opt">
  89. <div class="tab-pane" id="tab_imgupload">
  90. <table class="table table-bordered">
  91. <tbody>
  92. <tr>
  93. <td >
  94. <div class="sort-list">
  95. <div class="images_upload">
  96. </div>
  97. </div>
  98. <a href="javascript:void(0);" onClick="GetUploadify(30,'','allimg','imgupload_call_back');" class="img-upload b-img-upload mb15" title="点击上传">
  99. <div class="y-line"></div>
  100. <div class="x-line"></div>
  101. </a>
  102. </td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. </div>
  107. <!-- 上传图片显示的样板 start -->
  108. <div class="images_upload_tpl none">
  109. <div class="images_upload ic">
  110. <div class="ic">
  111. <div class='upimg' title="拖动修改排序" onmouseover="upimgMouseover(this);" onmouseout="upimgMouseout(this);">
  112. <div class='icaction' style="display: none">
  113. <span class="load_images" onclick="">
  114. <a href="javascript:void(0);" style="color: white">
  115. <i class='fa fa-search-plus'></i>大图
  116. </a>
  117. </span>
  118. <span class="load_images" onclick="">
  119. <i class='fa fa-file-text-o'></i>信息
  120. </span>
  121. </div>
  122. <div class='cover-bg' style="display: none"></div>
  123. <img src="__STATIC__/admin/images/add-button.jpg"/>
  124. <a class="delect" href="javascript:void(0);" title="删除"></a>
  125. </div>
  126. <div class="load_input" data-showOrHide="hide">
  127. <input type="hidden"/>
  128. <span class="span_input"> <input type="hidden"/> </span>
  129. <textarea placeholder="请输入标题..." style="height: 28px;"></textarea>
  130. <textarea placeholder="请输入链接网址..." style="height: 28px;"></textarea>
  131. <textarea placeholder="广告注释:支持HTML代码" style="height: 64px;"></textarea>
  132. <div class="operation">
  133. <a href="javascript:void(0)">&nbsp;&nbsp;</a>
  134. <a href="javascript:void(0)">&nbsp;&nbsp;</a>
  135. <a style="width: 32%;" href="javascript:void(0);">&nbsp;&nbsp;</a>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <!-- 上传图片显示的样板 end -->
  142. </dd>
  143. </dl>
  144. <dl class="row 1615775137_dl" style="display: none;" id="1615775137_2">
  145. <dt class="tit"> <label for="type">广告内容</label> </dt>
  146. <dd class="opt">
  147. <input type="text" name="video_litpic" id="video_litpic" class="input-txt">
  148. <input type="file" id="courseware_file" data-type='local' onchange="upload_video_litpic_1615775137(this)" style="display: none;">
  149. {eq name="$WeappOpen.qny_open" value="1"}
  150. &nbsp;<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>
  151. {/eq}
  152. {eq name="$WeappOpen.oss_open" value="1"}
  153. &nbsp;<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>
  154. {/eq}
  155. {eq name="$WeappOpen.cos_open" value="1"}
  156. &nbsp;<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>
  157. {/eq}
  158. &nbsp;<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>
  159. <input type="hidden" id="OpenPreviewVideoUrl" value="{:url('ZczsPosition/open_preview_video')}">
  160. &nbsp;<a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="PreviewVideo" onclick="OpenPreviewVideo();">预览</a>
  161. </dd>
  162. </dl>
  163. <dl class="row 1615775137_dl" style="display: none;" id="1615775137_3">
  164. <dt class="tit"> <label for="type">广告内容</label> </dt>
  165. <dd class="opt">
  166. <textarea rows="5" cols="60" id="html_intro" name="html_intro" style="height: 200px;"></textarea>
  167. <span class="err"></span>
  168. <p class="notic"></p>
  169. </dd>
  170. </dl>
  171. <dl class="row">
  172. <dt class="tit">
  173. <label>备注信息</label>
  174. </dt>
  175. <dd class="opt">
  176. <textarea rows="5" cols="60" id="intro" name="intro" style="height:60px;"></textarea>
  177. <span class="err"></span>
  178. <p class="notic"></p>
  179. </dd>
  180. </dl>
  181. <div class="bot"><a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
  182. </div>
  183. </form>
  184. </div>
  185. <script type="text/javascript">
  186. var SelectedType = 1;
  187. $(function() {
  188. // 新增时,广告类型默认选中图片类型
  189. $('#type1').prop('checked', 'checked');
  190. // 新增时,默认显示图片上传
  191. //$('#1615775137_1').show();
  192. // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
  193. VideoLitpicValue('#video_litpic');
  194. });
  195. // 切换广告类型
  196. function TypeSwitch(typeValue) {
  197. // 隐藏全部类型内容
  198. $('.1615775137_dl').hide();
  199. // 显示指定类型内容
  200. $('#1615775137_'+typeValue).show();
  201. // 切换类型后设置为当前切换的类型
  202. SelectedType = typeValue;
  203. // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
  204. VideoLitpicValue('#video_litpic');
  205. }
  206. // 多媒体类型 && 广告内容不为空 则执行显示 否则 执行隐藏
  207. function VideoLitpicValue(obj) {
  208. // 获取广告内容(多媒体为播放链接)
  209. // var video_litpic = $(obj).val();
  210. // 判断隐藏/显示预览按钮if (2 == SelectedType && video_litpic)
  211. if (2 == SelectedType) {
  212. $('#PreviewVideo').show();
  213. } else {
  214. $('#PreviewVideo').hide();
  215. }
  216. }
  217. // 打开预览视频
  218. function OpenPreviewVideo() {
  219. // 获取视频链接
  220. var video_litpic = $('#video_litpic').val();
  221. if (video_litpic == '') {
  222. $('#video_litpic').focus();
  223. showErrorMsg('请先上传视频');
  224. return false;
  225. }
  226. /* 视频链接后缀验证处理 */
  227. var fileExt = video_litpic.substr(video_litpic.lastIndexOf('.')).toLowerCase();
  228. var fileExt = judgeExt(fileExt);
  229. if (fileExt == -1) {
  230. $('#video_litpic').focus();
  231. showErrorMsg('不支持的视频格式,可在附件设置中修改');
  232. return false;
  233. }
  234. /* END */
  235. /* 视频链接是否存在斜杠处理 */
  236. var fileInfo = video_litpic.lastIndexOf('/');
  237. if (fileInfo == -1) {
  238. $('#video_litpic').focus();
  239. showErrorMsg('视频链接不完整,无法正常预览');
  240. return false;
  241. }
  242. /* END */
  243. // 打开视频播放
  244. $.ajax({
  245. type : 'post',
  246. url : $('#OpenPreviewVideoUrl').val(),
  247. data : {video_litpic: video_litpic},
  248. dataType : 'json',
  249. success : function(res) {
  250. if (1 == res.code) {
  251. var PreviewVideo = "<video style='width:100%; height:100%;' src='"+res.url+"' controls preload='auto' oncontextmenu='return fase' autoplay></video>";
  252. layer.open({
  253. type: 1,
  254. title: false,
  255. fixed: true, //不固定
  256. shadeClose: false,
  257. shade: layer_shade,
  258. area: ['80%', '80%'],
  259. content: PreviewVideo
  260. });
  261. } else {
  262. showErrorMsg(res.msg);
  263. }
  264. },
  265. error: function(e) {
  266. showErrorAlert(e.responseText);
  267. }
  268. });
  269. }
  270. // 上传媒体文件
  271. function upload_video_litpic_1615775137(e) {
  272. var data_type = $(e).attr('data-type');
  273. if ('qiniu' == data_type) {
  274. // 七牛云上传
  275. upload_video_litpic_qiniu(e);
  276. } else if ('oss' == data_type) {
  277. // OSS上传
  278. upload_video_litpic_oss(e);
  279. } else if ('cos' == data_type) {
  280. // COS上传
  281. upload_video_litpic_cos(e);
  282. } else {
  283. // 本地上传
  284. upload_video_litpic_local(e);
  285. }
  286. }
  287. // 七牛云上传
  288. function upload_video_litpic_qiniu(e) {
  289. // 获取文件路径名
  290. var file = $(e)[0].files[0];
  291. // 验证上传格式
  292. var fileName = file.name;
  293. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  294. var ext = judgeExt(fileExt);
  295. if (ext == -1) {
  296. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  297. return false;
  298. }
  299. // 验证上传大小
  300. var size = "{$upload_max_filesize}";
  301. if (file.size > size) {
  302. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  303. return false;
  304. }
  305. // 执行上传
  306. layer_loading('上传本地');
  307. $.ajax({
  308. type: 'POST',
  309. url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
  310. data: {_ajax: 1},
  311. dataType: "JSON",
  312. success: function(res1) {
  313. if (1 == res1.code) {
  314. var token = res1.data.token;
  315. var formData = new FormData();
  316. formData.append('file', file);
  317. formData.append('token', token);
  318. fileName = res1.data.filePath + fileExt;
  319. formData.append('key', fileName);
  320. $.ajax({
  321. url: res1.data.uphost,
  322. type: 'POST',
  323. dataType: 'JSON',
  324. data: formData,
  325. timeout: 1200000,
  326. cache: false,
  327. processData: false,
  328. contentType: false,
  329. xhr: function () {
  330. myXhr = $.ajaxSettings.xhr();
  331. if (myXhr.upload) {
  332. myXhr.upload.addEventListener('progress', function(e){
  333. var curr = e.loaded;
  334. var total = e.total;
  335. process = parseInt(curr / total * 100);
  336. $("#upload_video_litpic_qiniu").text('上传中...'+process+"%");
  337. });
  338. }
  339. return myXhr;
  340. },
  341. success: function(res2) {
  342. layer.closeAll();
  343. $("#upload_video_litpic_qiniu").text('上传成功');
  344. setTimeout(function() {
  345. $('#upload_video_litpic_qiniu').text('七牛云上传');
  346. }, 2000);
  347. var video_url = res1.data.domain + "/" + res2.key;
  348. $("#video_litpic").val(video_url);
  349. },
  350. error: function(e) {
  351. layer.closeAll();
  352. showErrorMsg(e.responseText);
  353. return false;
  354. }
  355. });
  356. } else {
  357. layer.closeAll();
  358. showErrorMsg(res1.msg);
  359. }
  360. },
  361. error: function(e) {
  362. layer.closeAll();
  363. showErrorMsg(e.responseText);
  364. }
  365. });
  366. }
  367. // 阿里云OSS上传
  368. function upload_video_litpic_oss(e) {
  369. // 获取文件路径名
  370. var file = $(e)[0].files[0];
  371. // 验证上传格式
  372. var fileName = file.name;
  373. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  374. var ext = judgeExt(fileExt);
  375. if (ext == -1) {
  376. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  377. return false;
  378. }
  379. // 验证上传大小
  380. var size = "{$upload_max_filesize}";
  381. if (file.size > size) {
  382. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  383. return false;
  384. }
  385. // 执行上传
  386. layer_loading('上传阿里云OSS');
  387. $.ajax({
  388. type: 'POST',
  389. url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
  390. data: {_ajax: 1},
  391. dataType: "JSON",
  392. success: function(res1){
  393. if (1 == res1.code){
  394. fileName = res1.data.filePath + fileExt;
  395. //组装发送数据
  396. var request = new FormData();
  397. request.append("OSSAccessKeyId",res1.data.accessid);
  398. request.append("policy",res1.data.policy);
  399. request.append("Signature",res1.data.signature);
  400. request.append("key",fileName);
  401. request.append("success_action_status",201);
  402. request.append('file', file);
  403. $.ajax({
  404. url : res1.data.host,
  405. data : request,
  406. processData: false,
  407. cache: false,
  408. contentType: false,
  409. dataType: 'xml',
  410. type : 'post',
  411. xhr: function () {
  412. myXhr = $.ajaxSettings.xhr();
  413. if (myXhr.upload) {
  414. myXhr.upload.addEventListener('progress', function(e){
  415. var curr = e.loaded;
  416. var total = e.total;
  417. var process = parseInt(curr / total * 100);
  418. $("#upload_video_litpic_oss").text('上传中...'+process+"%");
  419. });
  420. }
  421. return myXhr;
  422. },
  423. success : function(data) {
  424. layer.closeAll();
  425. var res = $(data).find('PostResponse');
  426. if (res) {
  427. var key = res.find('Key').text();
  428. $("#upload_video_litpic_oss").text('上传成功');
  429. setTimeout(function() {
  430. $('#upload_video_litpic_oss').text('oss上传');
  431. }, 2000);
  432. var video_url = res1.data.domain + "/" + key;
  433. $("#video_litpic").val(video_url);
  434. } else {
  435. $("#upload_video_litpic_oss").text('上传失败');
  436. setTimeout(function() {
  437. $('#upload_video_litpic_oss').text('oss上传');
  438. }, 2000);
  439. }
  440. },
  441. error : function(e) {
  442. layer.closeAll();
  443. console.log(e.responseText);
  444. }
  445. });
  446. } else {
  447. layer.closeAll();
  448. showErrorMsg(res1.msg);
  449. }
  450. },
  451. error: function(e) {
  452. layer.closeAll();
  453. showErrorMsg(e.responseText);
  454. }
  455. });
  456. }
  457. // 腾讯云COS上传
  458. function upload_video_litpic_cos(e) {
  459. // 获取文件路径名
  460. var file = $(e)[0].files[0];
  461. // 验证上传格式
  462. var fileName = file.name;
  463. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  464. var ext = judgeExt(fileExt);
  465. if (ext == -1) {
  466. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  467. return false;
  468. }
  469. // 验证上传大小
  470. var size = "{$upload_max_filesize}";
  471. if (file.size > size) {
  472. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  473. return false;
  474. }
  475. // 上传参数
  476. var formData = new FormData();
  477. formData.append('file', file);
  478. formData.append('file_ext', fileExt);
  479. // 执行上传
  480. $.ajax({
  481. type: 'post',
  482. url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
  483. data: formData,
  484. contentType: false,
  485. processData: false,
  486. dataType: 'json',
  487. xhr: function () {
  488. myXhr = $.ajaxSettings.xhr();
  489. if (myXhr.upload) {
  490. myXhr.upload.addEventListener('progress', function(e){
  491. var curr = e.loaded;
  492. var total = e.total;
  493. process = parseInt(curr / total * 100);
  494. if (100 == process) {
  495. process = 99;
  496. layer_loading('上传腾讯云');
  497. }
  498. $("#upload_video_litpic_cos").text('上传中...'+process+"%");
  499. });
  500. }
  501. return myXhr;
  502. },
  503. success: function(res) {
  504. layer.closeAll();
  505. if (1 == res.code) {
  506. $("#video_litpic").val(res.data.url);
  507. $("#upload_video_litpic_cos").text('上传成功');
  508. } else {
  509. $("#upload_video_litpic_cos").text('上传失败');
  510. }
  511. setTimeout(function() {
  512. $('#upload_video_litpic_cos').text('cos上传');
  513. }, 2000);
  514. },
  515. error: function(e) {
  516. layer.closeAll();
  517. showErrorMsg(e.responseText);
  518. }
  519. });
  520. }
  521. // 本地上传
  522. function upload_video_litpic_local(e) {
  523. // 获取文件路径名
  524. var file = $(e)[0].files[0];
  525. // 验证上传格式
  526. var fileName = file.name;
  527. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  528. var ext = judgeExt(fileExt);
  529. if (ext == -1) {
  530. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  531. return false;
  532. }
  533. // 验证上传大小
  534. var size = "{$upload_max_filesize}";
  535. if (file.size > size) {
  536. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  537. return false;
  538. }
  539. // 定义上传数据
  540. var formData = new FormData();
  541. formData.append('file', file);
  542. // 执行上传
  543. layer_loading('上传本地');
  544. $.ajax({
  545. type: 'post',
  546. url : "{:url('Ueditor/upVideo', ['savepath'=>'media'])}",
  547. data: formData,
  548. contentType: false,
  549. processData: false,
  550. dataType: 'json',
  551. xhr: function () {
  552. myXhr = $.ajaxSettings.xhr();
  553. if (myXhr.upload) {
  554. myXhr.upload.addEventListener('progress', function(e){
  555. var curr = e.loaded;
  556. var total = e.total;
  557. process = parseInt(curr / total * 100);
  558. $("#upload_video_litpic_local").html('上传中...'+process+"%");
  559. });
  560. }
  561. return myXhr;
  562. },
  563. success: function (res) {
  564. layer.closeAll();
  565. $("#upload_video_litpic_local").html('上传成功');
  566. setTimeout(function() {
  567. $('#upload_video_litpic_local').html('本地上传');
  568. }, 2000);
  569. if ("SUCCESS" == res.state) {
  570. $("#video_litpic").val(res.url);
  571. } else {
  572. showErrorMsg(res.msg);
  573. }
  574. }
  575. });
  576. }
  577. // 验证格式
  578. function judgeExt(ext) {
  579. var type = "{$media_type}";
  580. var extArr = [];
  581. extArr = type.split("|");
  582. var ext = ext.replace(".","");
  583. return extArr.indexOf(ext);
  584. }
  585. </script>
  586. <script type="text/javascript">
  587. var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  588. // 勾选新窗口打开链接
  589. function CheckedTarget(t){
  590. if ($(t).is(':checked')) {
  591. $(t).parent().find('input[name="img_target[]"]').val(1);
  592. }else{
  593. $(t).parent().find('input[name="img_target[]"]').val(0);
  594. }
  595. }
  596. // 鼠标事件,加载查看大图和更新图片
  597. function upimgMouseover(obj)
  598. {
  599. $(obj).find('div.icaction').show();
  600. $(obj).find('div.cover-bg').show();
  601. }
  602. function upimgMouseout(obj)
  603. {
  604. $(obj).find('div.icaction').hide();
  605. $(obj).find('div.cover-bg').hide();
  606. }
  607. // 检测广告名称是否存在重复
  608. function DetectionTitleRepeat(obj) {
  609. // 当前广告ID
  610. var id = 0;
  611. // 传入的广告名称
  612. var title = $(obj).val();
  613. // 执行检测
  614. $.ajax({
  615. type: 'post',
  616. url : "{:url('ZczsPosition/detection_title_repeat', ['_ajax'=>1])}",
  617. data: {id: id, title: title},
  618. dataType: 'json',
  619. success: function(res) {
  620. if (0 == res.code) {
  621. $('#title_tips').show().html(res.msg);
  622. } else {
  623. $('#title_tips').hide().html('');
  624. }
  625. },
  626. error: function(e){
  627. layer.closeAll();
  628. showErrorAlert(e.responseText);
  629. }
  630. });
  631. }
  632. // 判断输入框是否为空
  633. function checkForm(){
  634. if($('input[name=title]').val() == ''){
  635. layer.msg('名称不能为空!', {icon: 2,time: 1000});
  636. return false;
  637. }
  638. if($('input[name=type]').val() == ''){
  639. layer.msg('分类不能为空,请添加二级分类!', {icon: 2,time: 1000});
  640. return false;
  641. }
  642. /*if($('#selectTest').val() == '1'){
  643. var checkedValues = [];
  644. $('#post_form input[type=checkbox]:checked').each(function() {
  645. checkedValues.push($(this).val());
  646. });
  647. console.log(checkedValues); // 打印选中的checkbox值
  648. if(checkedValues.length > 0){
  649. }else{
  650. layer.msg('请选择地区!', {icon: 2,time: 1000});
  651. return false;
  652. }
  653. }*/
  654. //打印
  655. /*console.log($('#post_form').serialize());
  656. return false;*/
  657. layer_loading('正在处理');
  658. $.ajax({
  659. type : 'post',
  660. url : "{:url('ZczsPosition/add', ['_ajax'=>1])}",
  661. data : $('#post_form').serialize(),
  662. dataType : 'json',
  663. success : function(res) {
  664. layer.closeAll();
  665. if (1 == res.code) {
  666. var _parent = parent;
  667. _parent.layer.close(parentObj);
  668. _parent.layer.msg(res.msg, {icon: 1, shade: layer_shade, time: 1000}, function() {
  669. _parent.window.location.reload();
  670. });
  671. } else {
  672. showErrorMsg(res.msg);
  673. }
  674. },
  675. error: function(e) {
  676. layer.closeAll();
  677. showErrorAlert(e.responseText);
  678. }
  679. });
  680. }
  681. // 显示信息输入框
  682. function ShowInput(id) {
  683. var obj = $("#"+id+"_ShowInput");
  684. var showOrHide = obj.attr('data-showOrHide');
  685. if ('hide' == showOrHide) {
  686. obj.show().attr('data-showOrHide', 'show');
  687. } else {
  688. obj.hide().attr('data-showOrHide', 'hide');
  689. }
  690. }
  691. // 隐藏信息输入
  692. function HideInput(id) {
  693. $("#"+id+"_ShowInput").hide().attr('data-showOrHide', 'hide');
  694. }
  695. // 上传图集相册回调函数
  696. function imgupload_call_back(paths){
  697. var last_div = $(".images_upload_tpl").html();
  698. var inputs = $('.span_input input');
  699. var timestamp = 0;
  700. for (var i=0; i<paths.length; i++){
  701. // 生成新的时间戳
  702. timestamp = (new Date()).getTime();
  703. // 插入一个 新图片
  704. $(".images_upload:eq(0)").before(last_div);
  705. // 处理他的链接地址
  706. $(".images_upload:eq(0)").find('span:eq(0)').attr('onclick',"Images('"+paths[i]+"', 900, 600);");
  707. // 处理信息显示隐藏按钮
  708. $(".images_upload:eq(0)").find('span:eq(1)').attr('onclick', "ShowInput('"+timestamp+"');");
  709. // 处理他的图片路径
  710. $(".images_upload:eq(0)").find('img').attr('src',paths[i]);
  711. // 处理删除按钮
  712. $(".images_upload:eq(0)").find('a:eq(1)').attr('onclick', "ClearPicArr(this, '"+paths[i]+"', 0);");
  713. // 处理图片信息框ID
  714. $(".images_upload:eq(0)").find('.load_input:eq(0)').attr('id', timestamp+'_ShowInput');
  715. // 处理图片路径及隐藏域
  716. if (inputs.length > '0') {
  717. // 修改隐藏域,提交ID隐藏域
  718. $(".images_upload:eq(0)").find('input:eq(0)').attr('name','img_id[]').attr('value','');
  719. // 修改隐藏域,提交图片隐藏域
  720. $(".span_input:eq(0)").find('input:eq(0)').attr('name','img_litpic[]').attr('value',paths[i]);
  721. // 提交标题
  722. $(".images_upload:eq(0)").find('textarea:eq(0)').attr('name','img_title[]');
  723. // 提交跳转链接
  724. $(".images_upload:eq(0)").find('textarea:eq(1)').attr('name','img_links[]');
  725. // 处理内容描述
  726. $(".images_upload:eq(0)").find('textarea:eq(2)').attr('name','img_intro[]');
  727. // 提交新窗口选项
  728. $(".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>");
  729. // 处理收回按钮
  730. $(".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>');
  731. }
  732. }
  733. }
  734. // 上传之后删除组图input
  735. function ClearPicArr(obj,path)
  736. {
  737. $(obj).parent().parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
  738. $.ajax({
  739. type:'POST',
  740. url:"{:url('Uploadimgnew/delupload')}",
  741. data:{action:"del", filename:path, _ajax:1},
  742. success:function(){}
  743. });
  744. }
  745. // 代码调用js
  746. function copyToClipBoard(id) {
  747. 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";
  748. var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 ad 调用:</dd>'
  749. contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:80px;">' + adstr + '}</textarea>'
  750. contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将对应标签代码复制并粘贴到对应模板文件中!</dd></dl></div>'
  751. layer.open({
  752. title: '代码调用',
  753. type: 1,
  754. shade: layer_shade,
  755. skin: 'layui-layer-demo',
  756. area: ['480px', '240px'], //宽高
  757. content: contentdiv
  758. });
  759. }
  760. // 图集相册的拖动排序相关 js
  761. $( ".sort-list" ).sortable({
  762. start: function( event, ui) {
  763. }
  764. ,stop: function( event, ui ) {
  765. }
  766. });
  767. //因为他们要拖动,所以尽量设置他们的文字不能选择。
  768. // $( ".sort-list" ).disableSelection();
  769. </script>
  770. {include file="public/footer" /}