wxshow_add.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. {extend name="public/layout" /} {block name="title"}素材库{/block} {block name="body"}
  2. <!--<link rel="stylesheet" href="__LAYUI__/common.css" media="all">-->
  3. <style type="text/css">
  4. html,
  5. body {
  6. display: block;
  7. width: 100%;
  8. background-color: #fff;
  9. }
  10. .layui-fluid {
  11. display: block;
  12. border-radius: 5px;
  13. background-color: #ffffff;
  14. padding: 15px 30px;
  15. }
  16. .layui-icon{font-size:18px !important;line-height: 38px;}
  17. .layui-tab {
  18. padding: 15px;
  19. height: 100%;
  20. }
  21. .layui-table-view .layui-table th,
  22. .layui-table-view .layui-table td {
  23. text-align: center;
  24. border-color: #B6CADE;
  25. }
  26. .layui-table thead tr,
  27. .layui-table-header {
  28. background-color: #D8E6F1;
  29. }
  30. .input-indent-box {
  31. display: inline;
  32. width: 80%;
  33. }
  34. .input-indent-box-small {
  35. display: inline;
  36. width: 20%;
  37. }
  38. .adding {
  39. cursor: pointer;
  40. }
  41. .upload-img .area i {
  42. font-size: 50px;
  43. color: #009688;
  44. }
  45. .evi-block {
  46. float: left;
  47. margin-right: 10px;
  48. }
  49. /*///*/
  50. .imageDiv {
  51. display: inline-block;
  52. width: 140px;
  53. height: 125px;
  54. -webkit-box-sizing: border-box;
  55. -moz-box-sizing: border-box;
  56. box-sizing: border-box;
  57. border: 1px dashed darkgray;
  58. background: #f8f8f8;
  59. position: relative;
  60. overflow: hidden;
  61. margin-right: 10px;
  62. }
  63. .addImages {
  64. display: inline-block;
  65. width: 140px;
  66. height: 125px;
  67. -webkit-box-sizing: border-box;
  68. -moz-box-sizing: border-box;
  69. box-sizing: border-box;
  70. border: 1px dashed darkgray;
  71. background: #f8f8f8;
  72. position: relative;
  73. overflow: hidden;
  74. }
  75. .text-detail {
  76. margin-top: 40px;
  77. text-align: center;
  78. }
  79. .text-detail>span {
  80. font-size: 40px;
  81. }
  82. .imageDiv div {
  83. width: 100%;
  84. height: 100%;
  85. position: absolute;
  86. top: 0px;
  87. background-color: #e6e6e600;
  88. }
  89. .imageDiv div i {
  90. display: none;
  91. font-size: 31px;
  92. position: absolute;
  93. top: 37%;
  94. left: 40%;
  95. }
  96. .imageDiv div:hover {
  97. background-color: #e6e6e680;
  98. }
  99. .imageDiv div:hover i {
  100. display: block;
  101. cursor: pointer;
  102. }
  103. .rotate180 {
  104. -webkit-transform: rotate(180deg);
  105. transform: rotate(180deg);
  106. }
  107. .layui-edge.rotate180 {
  108. margin-top: -9px;
  109. }
  110. .layui-input-inline.input-longer-inline {
  111. width: 290px;
  112. }
  113. .goback {
  114. float: right;
  115. }
  116. .goback a {
  117. color: #269efb;
  118. }
  119. .goback i {
  120. position: relative !important;
  121. }
  122. @media screen and (max-width: 450px){
  123. .layui-form-item{
  124. position: relative;
  125. }
  126. .layui-form-item .layui-input-inline {
  127. padding-right: 40px !important;
  128. }
  129. .adding {
  130. position: absolute;
  131. right: 10px;
  132. top: 0;
  133. }
  134. }
  135. input:disabled, input[disabled]{
  136. color: black;
  137. opacity: 1;
  138. -webkit-text-fill-color:black;
  139. -webkit-opacity:1;
  140. }
  141. .imgs{
  142. width: 89%;
  143. float:left;
  144. margin-top: -1%;
  145. margin-left: -1%;
  146. }
  147. .labels{
  148. display:block;
  149. float:left;
  150. /* margin-left: 1.5%;*/
  151. height: 4%;
  152. }
  153. .layui-btn-primary {
  154. color: #249EFB;
  155. border: 1px solid #249EFB;
  156. }
  157. .layui-btn-primary:hover {
  158. background-color: #E3F7FF;
  159. color: #249EFB;
  160. }
  161. .layui-border-btn,.layui-border-btn:hover {
  162. background-color: #fff;
  163. color: #249EFB;
  164. border: 1px solid #249EFB;
  165. }
  166. .layui-card-body {
  167. padding: 10px 0px 0px;
  168. }
  169. </style>
  170. <body>
  171. <div class="layui-fluid">
  172. <div class="layui-card">
  173. <div class="layui-card-header ">
  174. <div class="layui-form-item">
  175. <div class="layui-inline wzh_ays-inline">
  176. <strong>朋友圈</strong>
  177. </div>
  178. <!--<div class="goback">
  179. <a href="{:url('material/wxshowlisting')}"><i class="layui-icon layui-icon-return"></i>
  180. <span>返回列表</span>
  181. </a>
  182. </div>-->
  183. </div>
  184. </div>
  185. <div class="layui-card-body">
  186. <form class="layui-form" id="admin" enctype="multipart/form-data" lay-filter="wxshow-form">
  187. <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
  188. <input id="category_name" type="hidden" value="dailyWechatArticle" />
  189. <div class="layui-form-item">
  190. <label class="layui-form-label"><span style="color: red;">*</span>内容</label>
  191. <div class="layui-input-inline input-longer-inline" style="width: 70%;">
  192. <textarea name="content" lay-verify="required" id="content" cols="6" autocomplete="off" class="layui-textarea"></textarea>
  193. </div>
  194. </div>
  195. <div class="layui-form-item">
  196. <label class="layui-form-label"><span style="color: red;"></span></label>
  197. <div class="layui-input-inline input-longer-inline">
  198. <input type="radio" name="type" value="1" title="视频" lay-filter="type"/>
  199. <input type="radio" name="type" value="2" title="图片" lay-filter="type" checked/>
  200. <!-- <input type="radio" name="type" value="3" title="文字" lay-filter="type" /> -->
  201. </div>
  202. </div>
  203. <div class="layui-form-item video layui-hide">
  204. <label class="layui-form-label">视频</label>
  205. <div class="layui-input-inline" style="width: 290px;display: block;" id="container">
  206. <a class="layui-btn btn layui-border-btn" id="selectfiles" href="javascript:void(0);">选择视频</a>
  207. <a class="layui-btn btn layui-border-btn" id="postfiles" href="javascript:void(0);">开始上传</a>
  208. <div id="ossfile"></div>
  209. <div id="symbshowed"></div>
  210. <div class="layui-form-mid layui-word-aux" style="color: red!important;margin-left:10px;">注:选择视频并上传,限制100M内</div>
  211. <!--报错信息返回展示-->
  212. <pre id="console"></pre>
  213. <input type="hidden" value="" id="fileuri">
  214. <!--上传到OSS哪个文件下,在这里定义 -->
  215. <input type="hidden" value="dailyWechatArticle" id="wechat_label_name">
  216. </div>
  217. </div>
  218. <div class="layui-form-item img">
  219. <label class="layui-form-label labels">配图片</label>
  220. <div class="imgs" style="width:80%;margin-left: 5px;">
  221. <div class="picDiv" id="draggable" style="margin: 20px 0px;">
  222. <div class="addImages" id="img">
  223. <div class="text-detail">
  224. <span>+</span>
  225. <p>选择单、多图</p>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. <div class="layui-form-item imgTips">
  232. <label class="layui-form-label labels"></label>
  233. <div><i style="color: red;margin-right: 5px;"></i>建议上传图片宽高比例1:1,图片大小不超过1M</div>
  234. </div>
  235. <!-- <div class="layui-form-item wxtext layui-hide">-->
  236. <!-- <label class="layui-form-label">标题<span style="color: red;">*</span></label>-->
  237. <!-- <div class="layui-input-inline">-->
  238. <!-- <input type="text" id="texttitle" class="layui-input inputBox" value="" autocomplete="off"/>-->
  239. <!-- </div>-->
  240. <!-- </div>-->
  241. <div class="layui-form-item">
  242. <label class="layui-form-label"><i style="color:red;">*</i>分类</label>
  243. <div class="layui-input-inline">
  244. <div class="layui-unselect layui-form-select">
  245. <div class="layui-select-title wechatlabel-ele-group select_wechatlabel_input">
  246. <input type="text" lay-verify="required" id="select_wechatlabel" class="layui-input layui-unselect wechatlabel-ele-group" readonly="readonly" value="" data-selectedid="" placeholder="请选择分类" autocomplete="off" />
  247. <i class="layui-edge wechatlabel-ele-group" id="wechatlabel_arrow"></i>
  248. </div>
  249. <dl class="layui-anim layui-anim-upbit wechatlabel-ele-group" id="dropdown_wechatlabel">
  250. <dd class="topselectbtn wechatlabel-ele-group" data-ref="addwechatlabel"> + 添加分类 + </dd>
  251. {volist name="Wechatlabel" id="vo"}
  252. <dd class="wechatlabel_option wechatlabel-ele-group" data-id="{$vo.id}"> {$vo.label_name}</dd>
  253. {/volist}
  254. </dl>
  255. </div>
  256. <!-- <select name="label" lay-filter="label">-->
  257. <!-- <option value="">请选择</option>-->
  258. <!-- {volist name="Wechatlabel" id="v"}-->
  259. <!-- <option value="{$v.id}">{$v.label_name}</option>-->
  260. <!-- {/volist}-->
  261. <!-- </select>-->
  262. </div>
  263. <i class="layui-icon layui-icon-add-circle adding" style="font-size: 32px" id="wechat-label-add"></i>
  264. </div>
  265. <!-- <div class="layui-form-item" id="text">
  266. <label class="layui-form-label"><i style="color:red;">*</i>内容</label>
  267. <div class="layui-input-block">
  268. <textarea name="content" lay-verify="required" id="content" cols="6" rows="10" autocomplete="off" class="layui-textarea"></textarea>
  269. </div>
  270. </div> -->
  271. <div class="layui-form-item">
  272. <label class="layui-form-label">展示时间</label>
  273. <div class="layui-input-inline">
  274. <input type="text" name="show_date" id="show_date" class="layui-input">
  275. </div>
  276. </div>
  277. <div class="layui-form-item">
  278. <label class="layui-form-label">继续添加</label>
  279. <div class="layui-input-block">
  280. <input type="checkbox" name="adding" title="" lay-skin="primary" {if condition="$adding eq 1"}checked{/if}>
  281. </div>
  282. </div>
  283. <div class="layui-form-item ">
  284. <input type="button" class="layui-btn btn layui-btn-primary" style="margin-left:12%;" lay-submit lay-filter="dailyWechatArticle-submit" id="dailyWechatArticle-submit" value="确认添加">
  285. </div>
  286. </div>
  287. </form>
  288. </div>
  289. </div>
  290. </div>
  291. </body>
  292. {/block} {block name="js"}
  293. <script type="text/javascript" src="__STATIC__/js/plupload/js/plupload.full.min.js"></script>
  294. <script type="text/javascript" src="__STATIC__/js/plupload/ossupload.js"></script>
  295. <script type="text/javascript" src="__STATIC__/js/Sortable.js"></script>
  296. <script src="https://gosspublic.alicdn.com/aliyun-oss-sdk-6.3.1.min.js" async></script>
  297. <script>
  298. layui.config({
  299. base: '__LAYUI__/' //静态资源所在路径
  300. ,
  301. urlbase: '/sys'
  302. }).extend({
  303. index: 'lib/index' //主入口模块
  304. }).use(['index', 'table', 'layedit', 'element', 'upload', 'laydate'], function() {
  305. var $ = layui.$,
  306. element = layui.element,
  307. upload = layui.upload,
  308. form = layui.form,
  309. laydate = layui.laydate,
  310. files;
  311. //每日发圈添加
  312. form.on('submit(dailyWechatArticle-submit)', function(obj) {
  313. var index = parent.layer.getFrameIndex(window.name);
  314. var formData = new FormData(obj.form);
  315. formData.append('label', $('#select_wechatlabel').data('selectedid'));
  316. //限制加载框
  317. var sd = layer.load(1, {
  318. shade: [0.8, '#FFFFFF']
  319. });
  320. //监听分类,去除图片或视频
  321. var radio = $('input:radio:checked').val();
  322. if(radio == 1) {
  323. formData.delete('article_image');
  324. formData.append('video_url', $('#fileuri').val());
  325. } else if(radio == 2) {
  326. formData.delete('video_url');
  327. formData.delete('article_image');
  328. if (typeof(files) == "undefined" || JSON.stringify(files)=="{}") {
  329. // layer.close(sd);
  330. // layer.msg('请至少选择一张图片', {
  331. // anim: 6
  332. // });
  333. // return false;
  334. }
  335. // for(i in files) {
  336. // formData.append('article_image[]', files[i]);
  337. // }
  338. let el = document.querySelector('#draggable').children;
  339. for (let i = 0; i < el.length; i++) {
  340. if (el[i].className === 'imageDiv') {
  341. formData.append('article_image[]', files[el[i].dataset.id]['imglink']);
  342. }
  343. }
  344. } else {
  345. formData.delete('video_url');
  346. formData.delete('article_image');
  347. formData.append('article_image', '');
  348. }
  349. // 单击之后提交按钮不可选,防止重复提交
  350. var DISABLED = 'layui-btn-disabled';
  351. var target = '#dailyWechatArticle-submit';
  352. $(target).addClass(DISABLED);
  353. $(target).attr('disabled', 'disabled');
  354. $.ajax({
  355. url: '{:url("material/apiwxadding")}',
  356. type: 'post',
  357. data: formData,
  358. dataType: 'json',
  359. processData: false,
  360. contentType: false,
  361. success: function(res) {
  362. $(target).removeClass(DISABLED);
  363. $(target).removeAttr('disabled');
  364. layer.close(sd);
  365. if(res.code === 0) {
  366. layer.msg(res.msg, {
  367. anim: 0,time: 400
  368. }, function() {
  369. var adding = $("input[name='adding']").is(":checked");
  370. if (adding) {
  371. // window.location.reload();
  372. location.href = "{:url('material/wxshow_add')}?adding=1";
  373. } else {
  374. var index = parent.layer.getFrameIndex(window.name);
  375. parent.layer.close(index);
  376. parent.layui.table.reload('wxshow-table');//店面后台
  377. parent.layui.table.reload('wxshow-add-table');//集团后台
  378. }
  379. });
  380. } else {
  381. layer.msg(res.msg, {
  382. anim: 6,time: 400
  383. });
  384. }
  385. },
  386. error : function(e){
  387. $(target).removeClass(DISABLED);
  388. $(target).removeAttr('disabled');
  389. }
  390. });
  391. return false;
  392. });
  393. setTimeout(() => {
  394. let el = document.querySelector('#draggable');
  395. new Sortable(el, {
  396. animation: 150,
  397. ghostClass: 'blue-background-class',
  398. filter: ".addImages", // 过滤器,不需要进行拖动的元素
  399. // 结束拖拽
  400. onEnd: function (/**Event*/evt) {
  401. var itemEl = evt.item; // dragged HTMLElement
  402. evt.to; // target list
  403. evt.from; // previous list
  404. evt.oldIndex; // element's old index within old parent
  405. evt.newIndex; // element's new index within new parent
  406. evt.clone // the clone element
  407. evt.pullMode; // when item is in another sortable: `"clone"` if cloning, `true` if moving
  408. },
  409. });
  410. },800)
  411. $('.layui-tab-content').on('click', function(e) {
  412. // console.log(e.target);
  413. if(!$(e.target).hasClass('wechatlabel-ele-group')) {
  414. $('#dropdown_wechatlabel').hide();
  415. $('#wechatlabel_arrow').removeClass('rotate180');
  416. }
  417. });
  418. ///////
  419. $('.select_wechatlabel_input').on('click', function() {
  420. $('#dropdown_wechatlabel').toggle();
  421. $('#wechatlabel_arrow').toggleClass('rotate180');
  422. });
  423. ////////
  424. $(".wechatlabel_option").on('click', function() {
  425. var wechatlabel_name = $(this).text();
  426. var wechatlabel_id = $(this).data('id');
  427. var select_wechatlabel = $("#select_wechatlabel");
  428. select_wechatlabel.val(wechatlabel_name);
  429. select_wechatlabel.data('selectedid', wechatlabel_id);
  430. select_wechatlabel.click();
  431. });
  432. ///
  433. $('.topselectbtn').on('click', function() {
  434. console.log($(this).data('ref'));
  435. var gonnado = $(this).data('ref');
  436. if(gonnado == 'addwechatlabel') {
  437. addwechatlabel();
  438. $('#select_wechatlabel').click();
  439. }
  440. });
  441. ////
  442. //发圈分类添加
  443. $('#wechat-label-add').on('click', function() {
  444. addwechatlabel();
  445. });
  446. var addwechatlabel = function() {
  447. layer.prompt({
  448. title: ['发圈分类添加', 'color:#333333;background-color:#D8E6F1;'],
  449. }, function(value, index, elem) {
  450. var value = $.trim(value);
  451. if(value == '') {
  452. layer.msg('请输入分类名称', {
  453. anim: 6,time: 400
  454. });
  455. return false;
  456. }
  457. if(value.length > 6) {
  458. layer.msg('分类名称超长', {
  459. anim: 6,time: 400
  460. });
  461. return false;
  462. }
  463. $.post('{:url("material/add_wechat_label")}', {
  464. value: value
  465. }, function(res) {
  466. if(res.code == 0) {
  467. var dd_ele = document.createElement("dd");
  468. dd_ele.classList.add('wechatlabel_option');
  469. dd_ele.classList.add('wechatlabel-ele-group');
  470. dd_ele.setAttribute('data-id', res.data.id);
  471. dd_ele.innerHTML = ' ' + res.data.name;
  472. dd_ele.addEventListener('click', function() {
  473. var wechatlabel_name = $(this).text();
  474. var wechatlabel_id = $(this).data('id');
  475. var select_wechatlabel = $("#select_wechatlabel");
  476. select_wechatlabel.val(wechatlabel_name);
  477. select_wechatlabel.data('selectedid', wechatlabel_id);
  478. select_wechatlabel.click();
  479. });
  480. var targetEle = document.getElementById('dropdown_wechatlabel');
  481. targetEle.appendChild(dd_ele);
  482. var select_wechatlabel = $("#select_wechatlabel");
  483. select_wechatlabel.val(res.data.name);
  484. select_wechatlabel.attr('data-selectedid', res.data.id);
  485. layer.close(index);
  486. } else {
  487. layer.msg(res.msg, {
  488. anim: 6,time: 400
  489. });
  490. }
  491. });
  492. });
  493. }
  494. $('.upload-img-btn').on('click', function() {
  495. layer.open({
  496. title: ['图文添加', 'color:#333333;background-color:#D8E6F1;'],
  497. type: 2,
  498. content: '{:url("material/evidenceadd")}',
  499. resize: false,
  500. area: ['80%', '80%']
  501. });
  502. });
  503. //案例封面图
  504. upload.render({
  505. elem: '#anlicoverimg',
  506. accept: 'images',
  507. url: '/upload/',
  508. exts: 'jpg|png|bmp|jpeg|JPG|PNG|BMP|JPEG',
  509. field: 'cover_img',
  510. size: 1 * 1024,
  511. auto: false,
  512. choose: function(obj) {
  513. files = obj.pushFile();
  514. length = $('.imageDiv').length;
  515. obj.preview(function(index, file, result) {
  516. length++;
  517. if(length > 9) {
  518. if(length == 10) layer.msg('限制九张图片以下');
  519. delete files[index];
  520. } else {
  521. $('#anlicoverimg').html('<div class="imageDiv" data-id="' + index + '"><img src="' + result + '" alt="' + file.name + '" class="layui-upload-img" width="100%" height="100%"><div><i class="layui-icon layui-icon-delete"></i></div></div>');
  522. }
  523. });
  524. }
  525. });
  526. //多图片上传
  527. upload.render({
  528. elem: '#img',
  529. accept: 'images',
  530. url: '/upload/',
  531. exts: 'jpg|png|bmp|jpeg|JPG|PNG|BMP|JPEG',
  532. field: 'article_image',
  533. size: 5 * 1024,
  534. auto: false,
  535. multiple: true,
  536. choose: function(obj) {
  537. files = obj.pushFile();
  538. length = $('.imageDiv').length;
  539. obj.preview(function(index, file, result) {
  540. length++;
  541. if(length > 9) {
  542. if(length == 10) layer.msg('限制九张图片以下');
  543. delete files[index];
  544. } else {
  545. ossuploadimg(file).then(f => {
  546. files[index]['imglink'] = f;
  547. $('.picDiv').prepend('<div class="imageDiv" data-id="' + index + '"><img src="' + result + '" alt="' + file.name + '" class="layui-upload-img" width="100%" height="100%"><div><i class="layui-icon layui-icon-delete" prop="del"></i> <i class="layui-icon layui-icon-search" prop="view" data-image="'+result+'" style="margin-left:25px;"></i></div></div>');
  548. })
  549. }
  550. });
  551. }
  552. });
  553. function ossuploadimg(file) {
  554. return new Promise((resolve,reject) => {
  555. var client = new OSS({
  556. region: "oss-cn-hangzhou",
  557. accessKeyId: "LTAI5tHjWupJSCAycy2yVbQZ",
  558. accessKeySecret: "eNFicm77Cfq3u7ZnQyw1urFmFNpf3w",
  559. bucket: "zyzswzh",
  560. secure: true
  561. });
  562. var date = new Date().getTime();
  563. var objectName = 'crm/' + date + "/" + Date.now() + ".jpeg";
  564. client.put(objectName, file).then(function (result) {
  565. resolve(result.name);
  566. }).catch(function (error) {
  567. reject(error)
  568. });
  569. })
  570. }
  571. upload.render({
  572. elem: '#evidence_imgs',
  573. accept: 'images',
  574. url: '/upload/',
  575. exts: 'jpg|png|bmp|jpeg|JPG|PNG|BMP|JPEG',
  576. field: 'evidence_image',
  577. size: 5 * 1024,
  578. auto: false,
  579. multiple: true,
  580. choose: function(obj) {
  581. files = obj.pushFile();
  582. length = $('.imageDiv').length;
  583. obj.preview(function(index, file, result) {
  584. length++;
  585. if(length > 9) {
  586. if(length == 10) layer.msg('限制九张图片以下');
  587. delete files[index];
  588. } else {
  589. $('.picDiv').prepend('<div class="imageDiv" data-id="' + index + '"><img src="' + result + '" alt="' + file.name + '" class="layui-upload-img" width="100%" height="100%"><div><i class="layui-icon layui-icon-delete"></i></div></div>');
  590. }
  591. });
  592. }
  593. });
  594. form.on('radio(type)', function(data) {
  595. if(data.value == 1) {
  596. $('.video').removeClass('layui-hide');
  597. $('.img').addClass('layui-hide');
  598. $('.imgTips').addClass('layui-hide');
  599. // $('.wxtext').addClass('layui-hide');
  600. } else if(data.value == 2) {
  601. $('.img').removeClass('layui-hide');
  602. $('.imgTips').removeClass('layui-hide');
  603. $('.video').addClass('layui-hide');
  604. // $('.wxtext').addClass('layui-hide');
  605. } else {
  606. // $('.wxtext').removeClass('layui-hide');
  607. $('.video').addClass('layui-hide');
  608. $('.img').addClass('layui-hide');
  609. $('.imgTips').addClass('layui-hide');
  610. }
  611. });
  612. $('.picDiv').on('click', 'i', function(e) {
  613. var that = this;
  614. if (e.target.attributes[1].nodeValue === 'view') {
  615. layer.photos({ photos: {"data": [{"src": e.target.attributes[2].nodeValue}]} ,closeBtn:true});
  616. } else {
  617. layer.confirm('确定删除该图片么?',{title:['信息', 'color:#333333;background-color:#D8E6F1;'],}, function(index) {
  618. var imgDiv = $(that).closest('.imageDiv');
  619. if(id = imgDiv.data('id')) {
  620. delete files[id];
  621. }
  622. imgDiv.remove();
  623. layer.close(index);
  624. });
  625. }
  626. });
  627. laydate.render({
  628. elem: '#show_date' //指定元素
  629. });
  630. });
  631. </script>
  632. {/block}