Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

add.htm 38KB

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