news.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. var delFiles = []; //用于删除图片
  2. var filesContainer= {}; //存储最终要上传的图片
  3. var files ; //存储选择图片的数量
  4. var fContainer= {}; //用于传父级传变量,格式 parent.fContainer
  5. var depositImg =[];//用于存放弹窗图片
  6. layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
  7. var form = layui.form,
  8. // layer = parent.layer === undefined ? layui.layer : top.layer,
  9. layer = layui.layer,
  10. $ = layui.jquery,
  11. laydate = layui.laydate,
  12. laytpl = layui.laytpl,
  13. table = layui.table,
  14. layedit = layui.layedit
  15. ,upload = layui.upload;
  16. var tableIds = 'newsList';
  17. //楼盘列表
  18. var tableIns = table.render({
  19. elem: '#'+tableIds,
  20. url : '/news/newsform',
  21. cellMinWidth : 95,
  22. method:'post',
  23. page : true,
  24. height : 600,
  25. limit : 20,
  26. id:'tablerReload',
  27. cols : [[
  28. {type: "checkbox", width:50},
  29. {type:'numbers'},
  30. {field: 'id', title: 'ID', width:80, align:"center",sort: true},
  31. {field: 'subject', title: '标题',align:'center',templet:function(d){
  32. return '<a href="http://www.yigouf.com/news/details/'+d.id+'/" target="_blank">'+d.subject+'</a>'
  33. }},
  34. {field: 'house_name', title: '楼盘',width:100, align:'center'},
  35. {field: 'city_name', title: '区域',width:100, align:'center'},
  36. {field: 'news_name', title: '栏目',width:120, align:'center'},
  37. {field: 'clicks', title: '点击数',width:100, edit: 'text',align:'center',clicks: true,templet:"#clicksBox"},
  38. {field: 'true_click', title: '真实点击数',width:120, align:'center',sort: true},
  39. {field: 'create_at', title: '添加时间',width:120, event:'sortData', align:'center',sort: true},
  40. {field: 'state', title: '审核',width:75, event:'housesNews', align:'center',templet:function (d) {
  41. if(d.state === 'N'){
  42. return '<input type="checkbox" value="'+d.id+'" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="|">'
  43. } else {
  44. return '<input type="checkbox" checked value="'+d.id+'" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="|">'
  45. }
  46. }},
  47. {field: 'author', title: '作者',width:100, align:'center'},
  48. {title: '操作', width:100, templet:'#housesListBar',fixed:"right",align:"center"}
  49. ]]
  50. });
  51. table.reload('tablerReload'); //重新加载
  52. // 日期
  53. laydate.render({
  54. elem: '#EventDate'
  55. });
  56. laydate.render({
  57. elem: '#ModificationDate'
  58. });
  59. //表格头部操作菜单
  60. var $ = layui.$, active = {
  61. addData: function(){ //获取选中数据
  62. var index = layui.layer.open({
  63. title : "添加资讯",
  64. type : 2,
  65. area:['80%','100%'],
  66. maxmin: true,
  67. content : "/news/add",
  68. })
  69. layui.layer.full(index);
  70. //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
  71. $(window).on("resize",function(){
  72. layui.layer.full(index);
  73. })
  74. },
  75. reload:function () {
  76. var form = pfgs_serialize($('form'));
  77. var name = '';
  78. var id = '';
  79. var author = '';
  80. if(form.input_house == 'name'){
  81. name = form.input_house_text;
  82. } else if(form.input_house == 'id'){
  83. id = form.input_house_text;
  84. } else if(form.input_house == 'author'){
  85. author = form.input_house_text;
  86. }
  87. table.reload('tablerReload',{
  88. where:{
  89. sort:form.input_sort,
  90. id:id,
  91. name:name,
  92. author:author,
  93. news:form.input_news,
  94. city:form.input_city
  95. }
  96. })
  97. },batch_sync:function () {
  98. var checkStatus = table.checkStatus('tablerReload');
  99. if(typeof checkStatus.data[0] == 'object'){
  100. var nid = '';
  101. $.each(checkStatus.data,function (key,val) {
  102. nid += val.id +',';
  103. })
  104. var index = layui.layer.open({
  105. title : "批量操作",
  106. type : 2,
  107. area:['50%','100%'],
  108. maxmin: true,
  109. content : "/news/batchsync?nid="+nid,
  110. })
  111. return false;
  112. }
  113. layer.msg('请选择需要同步的资讯');
  114. }
  115. };
  116. //同步资料
  117. form.on('submit(batch_sync_submit)',function (data) {
  118. var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
  119. $.ajax({
  120. cache : true,
  121. type : "post",
  122. url : "/news/confirmsync",
  123. data : data.field, // 你的formid
  124. success : function(data) {
  125. if (data.code == 200) {
  126. layer.msg(data.msg);
  127. parent.layui.table.reload('tablerReload');
  128. TableClose();
  129. } else if(data.code == 300){
  130. layer.msg(data.msg)
  131. }
  132. }
  133. });
  134. return false;
  135. })
  136. //监听指定开关
  137. form.on('switch(switchTest)', function(data){
  138. layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
  139. $.post('/house/housesortedit',{id:data.value,examineid:1},function (data) {
  140. if(data.code == 200)
  141. {
  142. layer.msg(data.msg);
  143. table.reload('tablerReload');
  144. } else if(data.code == 300 ) {
  145. layer.msg(data.msg);
  146. }
  147. })
  148. },function (aa) {
  149. table.reload('tablerReload'); //重新加载
  150. })
  151. });
  152. $('.demoTable .layui-btn').on('click', function(){
  153. var type = $(this).data('type');
  154. active[type] ? active[type].call(this) : '';
  155. });
  156. /* 列表操作 edit 修改后执行 2018.7.24*/
  157. table.on('edit('+tableIds+')', function(obj){
  158. var data = obj.data;
  159. $.post('/news/editclicks',{id:data.id,type:'clicks',clicks:data.clicks},function (data) {
  160. if(data.code == 200)
  161. {
  162. layer.msg(data.msg);
  163. // obj.update({
  164. // sort: data.sort
  165. // });
  166. // TableClose();
  167. } else if(data.code == 300 ) {
  168. layer.msg(data.msg);
  169. }
  170. })
  171. })
  172. // if(obj.event === 'clicksData'){
  173. // layer.prompt({
  174. // formType: 2
  175. // ,title: '点击数'
  176. // ,value: data.clicks
  177. // }, function(value, index){
  178. // $.post('/news/editclicks',{id:data.id,type:'clicks',clicks:value},function (data) {
  179. // layer.msg(data.msg);
  180. // layer.close(index);
  181. // table.reload('tablerReload');
  182. // })
  183. // });
  184. // } else
  185. //表格右边操作栏目
  186. table.on('tool('+tableIds+')', function(obj){
  187. var data = obj.data;
  188. if(obj.event === 'del'){ //删除操作
  189. layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
  190. $.post('/news/newsdel',{id:data.id},function (data) {
  191. if(data.code == 200)
  192. {
  193. layer.msg(data.msg);
  194. table.reload('tablerReload');
  195. } else if(data.code == 300 ) {
  196. layer.msg(data.msg);
  197. }
  198. })
  199. })
  200. } else if(obj.event === 'edit'){ //编辑操作
  201. var index = layui.layer.open({
  202. title : "编辑资讯",
  203. type : 2,
  204. area:['','100%'],
  205. maxmin: true,
  206. content : "/news/newsedit?id="+data.id
  207. })
  208. layui.layer.full(index);
  209. //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
  210. $(window).on("resize",function(){
  211. layui.layer.full(index);
  212. })
  213. }else if(obj.event === 'sortData'){ //修改排序
  214. layer.prompt({
  215. formType: 2
  216. ,title: '修改'
  217. ,value: data.sort
  218. }, function(value, index){
  219. $.post('/house/housesortedit',{id:data.id,sort:value},function (data) {
  220. if(data.code == 200)
  221. {
  222. layer.msg(data.msg);
  223. layer.close(index);
  224. obj.update({
  225. sort: value
  226. });
  227. // TableClose();
  228. } else if(data.code == 300 ) {
  229. layer.msg(data.msg);
  230. }
  231. })
  232. });
  233. }
  234. });
  235. //监听指定开关
  236. form.on('switch(switchTest)', function(data){
  237. layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
  238. $.post('/news/newsviewcontrol',{id:data.value},function (data) {
  239. if(data.code == 200)
  240. {
  241. layer.msg(data.msg);
  242. table.reload('tablerReload');
  243. } else if(data.code == 300 ) {
  244. layer.msg(data.msg);
  245. }
  246. })
  247. },function (aa) {
  248. table.reload('tablerReload');
  249. })
  250. });
  251. //添加and修改图片
  252. upload.render({
  253. elem: '#upload_edit',
  254. url: '/news/newseditform'
  255. ,data:{token:csrfToken}
  256. ,multiple: true
  257. ,number:3
  258. ,auto:false
  259. ,size:1000 //限制上传图片的大小,单位为KB
  260. ,exts: 'png|jpg|jpeg' //只允许上传压缩文件
  261. ,bindAction:'#addcity'
  262. ,choose: function(obj){
  263. //将每次选择的文件追加到文件队列
  264. files = obj.pushFile();
  265. //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9)
  266. obj.preview(function(index, file, result){
  267. depositImg.push({src:result,data:file});
  268. filesContainer[index] = file;
  269. $('#popup_1_imgBox').append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img delIdentification="'+index+'" src="'+ result +'" alt="'+ file.name +'"></div>');
  270. });
  271. }
  272. });
  273. layer.photos({
  274. photos: '#demo2'
  275. ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  276. });
  277. // 正文上传事件
  278. $('#popup_2').on('click','.layui-upload-img',function(){
  279. // 处理选中与取消
  280. $(this).find('.layui_w_triangle').toggle('30',function(){
  281. $(this).parent().attr('data-id','pitch')
  282. if($(this).is(":hidden")){
  283. $(this).parent().removeAttr('data-id');
  284. var _fsrc = $(this).parents('.layui-upload-img').find('img.pitch_img').attr('src');
  285. for(i in depositImg){
  286. if(depositImg[i] == _fsrc){
  287. depositImg.splice(i, 1); //取消选择时,从数组中删除
  288. }
  289. }
  290. }else{
  291. $(this).parent().attr('data-id','pitch')
  292. var _fsrc = $(this).parents('.layui-upload-img').find('img.pitch_img').attr('src');
  293. depositImg.push(_fsrc); //选中的图片,把src地址存入数组
  294. }
  295. });
  296. })
  297. // 封面图功能
  298. $('.upload_box').on('click',function(){
  299. var txtData = UE.getEditor('editor_content').getContent();
  300. var imgReg = /<img.*?(?:>|\/>)/gi; //匹配图片(g表示匹配所有结果i表示区分大小写)
  301. var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i; //匹配src属性
  302. var txtImg = txtData.match(imgReg);
  303. var index = layer.open({
  304. type: 2,
  305. title:'选择封面',
  306. skin: 'layui-layer-rim', //加上边框
  307. area: ['650px', '500px'], //宽高
  308. content : "/news/popup",
  309. success: function(layero, index){
  310. var poupBody = layer.getChildFrame('body', index); //获取当前弹窗的doc
  311. for(i in txtImg){
  312. var _src = txtImg[i].match(srcReg)[0];
  313. poupBody.find('#popup_2').append('<div class="layui-upload-img"><div class="layui_w_triangle"><img src="/static/images/triangle.png" alt="" /></div><img class="pitch_img" '+_src+'/></div>');
  314. }
  315. }
  316. })
  317. })
  318. $('#layui_confirm').on('click',function(){
  319. var doc = $('#demo2', window.parent.document); //JQ获取弹窗父层doc
  320. var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
  321. if(depositImg.length > 3){
  322. layer.msg('封面图只能选择3张!!',{time:1000,shade:0.5})
  323. return false;
  324. }
  325. var _leng = doc.find('.layui-upload-img').length;
  326. if(_leng < 3){
  327. for(i in depositImg){
  328. if(typeof depositImg[i] == "object"){
  329. doc.append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img src="'+ depositImg[i].src +'" ></div>');
  330. parent.fContainer[i]=depositImg[i].data
  331. }else{
  332. doc.append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img src="'+ depositImg[i] +'" ></div>')
  333. parent.fContainer[i]=depositImg[i];
  334. }
  335. }
  336. }else if(_leng >3){
  337. layer.msg('封面图只能选择3张!!',{time:1000,shade:0.5})
  338. }
  339. parent.layer.close(index); //关闭iframe页面
  340. })
  341. delImg ("popup_1_imgBox","delimg"); // 删除图片
  342. layer.photos({
  343. photos: '#demo2'
  344. ,closeBtn: 1
  345. ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  346. });
  347. //添加
  348. form.on('submit(tijiao)',function (data) {
  349. var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
  350. var formData = new FormData($( "#signupForm" )[0]);
  351. for(i in fContainer){
  352. formData.append('img[]',fContainer[i]);
  353. }
  354. $.ajax({
  355. cache : true,
  356. type : "post",
  357. url : "/news/addform",
  358. data : formData, // 你的formid
  359. // async : false, //async 默认为true异步,修改为false为同步,
  360. contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
  361. processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
  362. error : function(request) {
  363. layer.close(index);
  364. layer.alert("网络超时");
  365. },
  366. success : function(data) {
  367. if (data.code == 200) {
  368. layer.msg(data.msg);
  369. parent.layui.table.reload('tablerReload');
  370. TableClose();
  371. } else if(data.code == 300){
  372. layer.msg(data.msg)
  373. layer.msg(ReturnInfo(data.data),{icon:5});
  374. }
  375. }
  376. });
  377. return false;
  378. })
  379. // 大图复选框监听事件
  380. form.on('checkbox(thumb_size)', function(data){
  381. // console.log(data.elem.checked); //是否被选中,true或者false
  382. // console.log(data.elem)
  383. if(data.elem.checked){
  384. $('.xm_xcxqTc_button[name="thumb_size"]').val('2')
  385. }else{
  386. $('.xm_xcxqTc_button[name="thumb_size"]').val('1');
  387. }
  388. });
  389. // 水印复选框监听事件
  390. // form.on('checkbox(thumb_watermark)', function(data){
  391. // console.log(data.elem.checked); //是否被选中,true或者false
  392. // });
  393. //修改
  394. form.on('submit(edit)',function (data) {
  395. var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
  396. var formData = new FormData($( "#signupForm" )[0]);
  397. // $.each(filesContainer,function (k,v) {
  398. // if(v != null){
  399. // formData.append('img[]',v);
  400. // }
  401. // })
  402. for(i in fContainer){
  403. formData.append('img[]',fContainer[i]);
  404. }
  405. //需要删除的图片
  406. if(delFiles.length > 0){
  407. $.each(delFiles,function (k,v) {
  408. formData.append('delimg[]',v);
  409. })
  410. }
  411. // 修改大图后把数据提交
  412. formData.append('thumb_size',$('.xm_xcxqTc_button[name="thumb_size"]').val());
  413. $.ajax({
  414. cache : true,
  415. type : "post",
  416. url : "/news/newseditform",
  417. data : formData, // 你的formid
  418. contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
  419. processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
  420. error : function(request) {
  421. layer.close(index); //关闭数据提交信息
  422. layer.alert("网络超时");
  423. },
  424. success : function(data) {
  425. if (data.code == 200) {
  426. layer.msg(data.msg);
  427. parent.layui.table.reload('tablerReload');
  428. TableClose();
  429. } else {
  430. layer.msg(data.msg)
  431. layer.msg(ReturnInfo(data.data),{icon:5});
  432. }
  433. }
  434. });
  435. return false;
  436. })
  437. //批量删除
  438. form.on('submit(del_alls_news)',function (data) {
  439. var checkStatus = table.checkStatus('tablerReload');
  440. if(typeof checkStatus.data[0] == 'object'){
  441. layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
  442. var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
  443. var formdat = new FormData();
  444. $.each(checkStatus.data,function (key,val) {
  445. formdat.append('id[]',val.id);
  446. })
  447. $.ajax({
  448. cache : true,
  449. type : "post",
  450. url : "/news/newsdel",
  451. data : formdat, // 你的formid
  452. contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
  453. processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
  454. error : function(request) {
  455. layer.close(index); //关闭数据提交信息
  456. layer.alert("网络超时");
  457. },
  458. success : function(data) {
  459. if (data.code == 200) {
  460. layer.msg(data.msg);
  461. table.reload('tablerReload')
  462. } else {
  463. layer.msg(data.msg);
  464. }
  465. }
  466. });
  467. })
  468. return false;
  469. }
  470. layer.msg('请选择需要删除的资讯',{icon:5});
  471. return false;
  472. })
  473. //检测关键词
  474. form.on('submit(check_words)',function (data) {
  475. var content=UE.getEditor('editor_content').getContentTxt();
  476. var centhtml = UE.getEditor('editor_content').getContent();
  477. $.ajax({
  478. //cache : false,
  479. type : "post",
  480. url : "/sensitivewords/checkword",
  481. data:{content:content}, // 你的formid
  482. //contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
  483. //processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
  484. error : function(request) {
  485. layer.close(index);
  486. layer.alert("网络超时");
  487. },
  488. success : function(data) {
  489. if(data.data!=null){
  490. var index=layer.open({
  491. type: 1,
  492. // skin: 'layui-layer-rim', //加上边框
  493. title:'违禁词信息',
  494. area: ['420px', '240px'], //宽高
  495. content: '<div style="color:red;">'+data.data+'</div>'
  496. });
  497. for(var i=0;i<data.data.length;i++){
  498. centhtml = centhtml.replace(data.data[i],"<span style='color: rgb(255, 0, 0);'>"+data.data[i]+"</span>");
  499. }
  500. UE.getEditor('editor_content').setContent(centhtml);
  501. layer.msg(data.msg)
  502. }else{
  503. layer.msg(data.msg)
  504. }
  505. }
  506. });
  507. return false;
  508. })
  509. });
  510. //删除图片
  511. $('#demo2').on("click","#delimg",function () {
  512. var name = $(this).next().attr("imgname");
  513. var delIdentification = $(this).next().attr("delIdentification");
  514. if(typeof(delIdentification) != 'undefined'){
  515. delete filesContainer[delIdentification];
  516. delete files[delIdentification] ;
  517. }
  518. if(typeof(name) != 'undefined'){
  519. delFiles.push(name);
  520. }
  521. $(this).parent().remove();
  522. })
  523. function RestrictImgNum() {
  524. var imgNum = $('.layui-w-img').children('img').length;
  525. if(imgNum >3 || imgNum== 3){
  526. return false;
  527. }
  528. }
  529. $(function(){
  530. // 动态添加批量删除按钮
  531. var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
  532. + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_news">批量删除</a>'
  533. + '</div>'
  534. $('.layui-form').append(_btn)
  535. })
  536. //判断是否需要编辑,需要才加载
  537. var verdict = $('#editor_content').html();
  538. if(typeof verdict == "string"){
  539. var ue = UE.getEditor('editor_content'); //编辑器
  540. }
  541. // 选择封面图弹窗选择项卡
  542. $('.layui-tab-title .site-demo-active').on('click', function(){
  543. $(this).addClass('layui-this').siblings().removeClass('layui-this');
  544. var lay_id = $(this).attr('lay-id');
  545. $('.layui-tab-item').removeClass('layui-show')
  546. $('.layui-tab-content #'+lay_id).addClass('layui-show')
  547. });
  548. // 弹窗本地选择图片删除功能
  549. function delImg (oid,delId){
  550. $('#' +oid).on("click","#"+delId,function () {
  551. var name = $(this).next().attr("imgname");
  552. var delIdentification = $(this).next().attr("delIdentification");
  553. if(typeof(delIdentification) != 'undefined'){
  554. delete filesContainer[delIdentification];
  555. delete files[delIdentification] ;
  556. }
  557. if(typeof(name) != 'undefined'){
  558. delFiles.push(name);
  559. }
  560. var _ksrc = $(this).parents('.layui-upload-img').find('img').attr('src');
  561. for(i in depositImg){
  562. if(typeof depositImg[i] == "object"){
  563. if(depositImg[i].src == _ksrc){
  564. depositImg.splice(i, 1); //取消选择时,从数组中删除
  565. }
  566. }else if(depositImg[i] == _ksrc){
  567. depositImg.splice(i, 1); //取消选择时,从数组中删除
  568. }
  569. }
  570. $(this).parent().remove();
  571. })
  572. }