설명 없음
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.

choose2.htm 31KB

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