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

global.js 71KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331
  1. var layer_shade = [0.7, '#fafafa'];
  2. //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
  3. window.UEDITOR_HOME_URL = __root_dir__+"/public/plugins/Ueditor/";
  4. // PC端编辑器工具
  5. var ueditor_toolbars = [[
  6. 'fullscreen', 'source', '|', 'undo', 'redo', '|',
  7. 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'selectall', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|',
  8. 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
  9. 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
  10. 'directionalityltr', 'directionalityrtl', 'indent', '|',
  11. 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
  12. 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
  13. 'simpleupload', 'insertimage', 'emotion', 'insertvideo', 'attachment', 'map', 'insertframe', 'insertcode', '|',
  14. 'horizontal', 'spechars', '|',
  15. 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
  16. 'preview', 'searchreplace', 'drafts'
  17. ]];
  18. // 手机端编辑器工具 previewmobile
  19. var ueditor_toolbars_ey_m = [[
  20. 'fullscreen', 'source', '|', 'removeformat' , 'undo', 'redo', '|',
  21. 'fontsize', 'forecolor', 'bold', 'italic', 'underline', '|',
  22. 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
  23. 'lineheight', 'simpleupload', 'insertimage', 'link', 'unlink', 'anchor', '|',
  24. 'insertvideo'
  25. ]];
  26. var layer_tips; // 全局提示框的对象
  27. var ey_unknown_error = '未知错误,无法继续!';
  28. if (!__seo_pseudo__) {
  29. var __seo_pseudo__ = 1;
  30. }
  31. /*
  32. 作用:监听输入框字符显示
  33. 使用说明
  34. 1. 在输入框HTML加入代码( class="keywordsTextarea" onkeyup="monitorInputStr();" onkeypress="monitorInputStr();" )
  35. 2. 在显示文案处加入代码( <p class="none" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</p> )
  36. 3. 如果是在编辑页使用请对上面的P标题做隐藏判断,无内容时隐藏文案( {empty name='变量名'}none{/empty} )
  37. */
  38. $(document).ready(function() {
  39. // 页面渲染结束后执行
  40. monitorInputStr();
  41. });
  42. function monitorInputStr() {
  43. if ($('.keywordsTextarea').length) {
  44. var keywordsTextarea = $('.keywordsTextarea').val();
  45. if (keywordsTextarea) {
  46. if ($('#beenWritten').length) $('#beenWritten').show();
  47. if ($('#beenWrittenStr').length) $('#beenWrittenStr').html(parseInt(keywordsTextarea.length));
  48. } else {
  49. if ($('#beenWritten').length) $('#beenWritten').hide();
  50. }
  51. }
  52. }
  53. $(function(){
  54. auto_notic_pic_tips();
  55. auto_notic_tips();
  56. auto_notic_tipss();
  57. auto_notic_tipsu();
  58. /**
  59. * 自动小提示
  60. */
  61. function auto_notic_pic_tips()
  62. {
  63. var html = '<a class="ui_tips" href="javascript:void(0);" onmouseover="layer_tips = layer.tips($(this).parent().find(\'p.notic-pic\').html(), this, {time:100000, skin:\'layer-tips-img\'});" onmouseout="layer.close(layer_tips);">提示</a>';
  64. $.each($('dd.opt > p.notic-pic'), function(index, item){
  65. if ($(item).html() != '') {
  66. $(item).before(html);
  67. }
  68. });
  69. }
  70. function auto_notic_tips()
  71. {
  72. var html = '<a class="ui_tips" href="javascript:void(0);" onmouseover="layer_tips = layer.tips($(this).parent().find(\'p.notic\').html(), this, {time:100000});" onmouseout="layer.close(layer_tips);">提示</a>';
  73. $.each($('dd.opt p.notic'), function(index, item){
  74. if ($(item).html() != '') {
  75. $(item).before(html);
  76. }
  77. });
  78. }
  79. function auto_notic_tipss()
  80. {
  81. var html = '<a class="ui_tips" href="javascript:void(0);" onmouseover="layer_tips = layer.tips($(this).parent().find(\'p.notic\').html(), this, {time:100000});" onmouseout="layer.close(layer_tips);">提示</a>';
  82. $.each($('dt.tit p.notic'), function(index, item){
  83. if ($(item).html() != '') {
  84. $(item).before(html);
  85. }
  86. });
  87. }
  88. function auto_notic_tipsu()
  89. {
  90. var html = '<a class="ui_tips" href="javascript:void(0);" onmouseover="layer_tips = layer.tips($(this).parent().find(\'p.notic\').html(), this, {time:100000});" onmouseout="layer.close(layer_tips);">提示</a>';
  91. $.each($('.ivu-form-item-content p.notic'), function(index, item){
  92. if ($(item).html() != '') {
  93. $(item).before(html);
  94. }
  95. });
  96. }
  97. /*TAG标签选中与取消处理*/
  98. $('.TagIndex1591690114').click(function() {
  99. if ($(this).html() && $(this).data('id')) {
  100. /*读取原有数据*/
  101. var id = $(this).data('id');
  102. var tag = $(this).html();
  103. var tagOldSelectID = $('#TagOldSelectID').val();
  104. var tagOldSelectTag = $('#TagOldSelectTag').val();
  105. /*END*/
  106. if (tagOldSelectID) {
  107. /*处理原有数据*/
  108. var tagOldSelectNew = tagOldSelectID.split(',');
  109. var index = $.inArray(String(id), tagOldSelectNew);
  110. if (index == -1) {
  111. /*追加新数据*/
  112. tagOldSelectID += ',' + id;
  113. tagOldSelectTag += ',' + tag;
  114. /*END*/
  115. } else {
  116. /*删除原有数据*/
  117. tagOldSelectNew.splice(index, 1);
  118. tagOldSelectID = tagOldSelectNew.join(',');
  119. tagOldSelectTag = tagOldSelectTag.split(',');
  120. tagOldSelectTag.splice(index, 1);
  121. tagOldSelectTag = tagOldSelectTag.join(',');
  122. /*END*/
  123. }
  124. /*END*/
  125. } else {
  126. /*追加新数据*/
  127. tagOldSelectID = id;
  128. tagOldSelectTag = tag;
  129. /*END*/
  130. }
  131. $('#TagOldSelectID, #NewTagOldSelectID').val(tagOldSelectID);
  132. $('#TagOldSelectTag, #NewTagOldSelectTag, #tags').val(tagOldSelectTag);
  133. }
  134. });
  135. /*END*/
  136. });
  137. /*TAG标签代码*/
  138. /*打开ATG快捷选择列表*/
  139. function TagListSelect1591784354(obj) {
  140. var url = eyou_basefile + "?m="+module_name+"&c=Tags&a=tag_list&lang=" + __lang__;
  141. //iframe窗
  142. layer.open({
  143. type: 2,
  144. title: 'TAG标签选择',
  145. fixed: true, //不固定
  146. shadeClose: false,
  147. shade: layer_shade,
  148. maxmin: false, //开启最大化最小化按钮
  149. area: ['500px', '400px'],
  150. content: url,
  151. cancel: function () {
  152. $('#TagOldSelectID').val($('#NewTagOldSelectID').val());
  153. $('#TagOldSelectTag').val($('#NewTagOldSelectTag').val());
  154. }
  155. });
  156. }
  157. /*通过TAGID删除对应数据*/
  158. function UseTagIDDel1591784354(obj) {
  159. // 获取已选中的tag标签ID
  160. var tagOldSelectID = $('#TagOldSelectID').val();
  161. // 获取已选中的tag标签Tag
  162. var tagOldSelectTag = $('#TagOldSelectTag').val();
  163. // 获取当前点击的tag标签ID
  164. var id = $(obj).attr('data-id');
  165. if (tagOldSelectID) {
  166. // 将字符串转成数组,判断tag标签ID是否已存在
  167. var tagOldSelectID = tagOldSelectID.split(',');
  168. // 将字符串转成数组,判断tag标签ID是否已存在
  169. var tagOldSelectTag = tagOldSelectTag.split(',');
  170. // 是否存在,存在则返回下标
  171. var index = $.inArray(String(id), tagOldSelectID);
  172. // 若存在则执行
  173. if (index != -1) {
  174. // 删除指定tag的ID
  175. tagOldSelectID.splice(index, 1);
  176. // 将数组转成字符串
  177. tagOldSelectID = tagOldSelectID.join(',');
  178. // 赋值给已选中的tag标签ID隐藏域
  179. $('#TagOldSelectID, #NewTagOldSelectID').val(tagOldSelectID);
  180. // 删除指定tag的名称
  181. tagOldSelectTag.splice(index, 1);
  182. // 将数组转成字符串
  183. tagOldSelectTag = tagOldSelectTag.join(',');
  184. // 赋值给已选中的tag标签名称隐藏域
  185. $('#tags').show().val(tagOldSelectTag).hide();
  186. $('#TagOldSelectTag, #NewTagOldSelectTag').val(tagOldSelectTag);
  187. }
  188. }
  189. // 删除自身
  190. $(obj).parent().remove();
  191. }
  192. /*END*/
  193. /*通过TAG名称删除对应数据*/
  194. function UseTagNameDel1591784354(obj) {
  195. //区分是文章的TAG标签还是网站web_keywords
  196. var web_keywords_1607062084 = $('#web_keywords_1607062084').val();
  197. if ('web_keywords' == web_keywords_1607062084) {
  198. // 获取当前点击的关键词
  199. var words = $(obj).val();
  200. // 获取已填写的关键词字符串
  201. var web_keywords = $('#web_keywords').val();
  202. // 将字符串转成数组,判断当前点击的关键词是否已存在
  203. var arr = web_keywords.split(',');
  204. // 是否存在,存在则返回下标
  205. var index = $.inArray(String(words), arr);
  206. if (index != -1) {
  207. // 删除指定下标的元素
  208. arr.splice(index, 1);
  209. // 将数组转成字符串
  210. web_keywords = arr.join(',');
  211. // 赋值给已选中的关键词输入框
  212. $('#web_keywords').val(web_keywords);
  213. }
  214. } else {
  215. // 获取已选中的tag标签ID
  216. var tagOldSelectID = $('#TagOldSelectID').val();
  217. // 获取已选中的tag标签Tag
  218. var tagOldSelectTag = $('#TagOldSelectTag').val();
  219. // 获取当前点击的tag标签Tag
  220. var Tag = $(obj).val();
  221. if (tagOldSelectID && tagOldSelectTag) {
  222. // 将字符串转成数组,判断tag标签ID是否已存在
  223. var tagOldSelectID = tagOldSelectID.split(',');
  224. // 将字符串转成数组,判断tag标签ID是否已存在
  225. var tagOldSelectTag = tagOldSelectTag.split(',');
  226. // 是否存在,存在则返回下标
  227. var index = $.inArray(String(Tag), tagOldSelectTag);
  228. // 若存在则执行
  229. if (index != -1) {
  230. // 删除指定tag的ID
  231. tagOldSelectID.splice(index, 1);
  232. // 将数组转成字符串
  233. tagOldSelectID = tagOldSelectID.join(',');
  234. // 赋值给已选中的tag标签ID隐藏域
  235. $('#TagOldSelectID, #NewTagOldSelectID').val(tagOldSelectID);
  236. // 删除指定tag的名称
  237. tagOldSelectTag.splice(index, 1);
  238. // 将数组转成字符串
  239. tagOldSelectTag = tagOldSelectTag.join(',');
  240. // 赋值给已选中的tag标签名称隐藏域
  241. $('#tags').show().val(tagOldSelectTag).hide();
  242. $('#TagOldSelectTag, #NewTagOldSelectTag').val(tagOldSelectTag);
  243. }
  244. }
  245. }
  246. // 删除自身
  247. $(obj).parent().remove();
  248. }
  249. /*END*/
  250. /**
  251. * 批量复制
  252. */
  253. function func_batch_copy(obj, name)
  254. {
  255. var a = [];
  256. var k = 0;
  257. aids = '';
  258. $('input[name^='+name+']').each(function(i,o){
  259. if($(o).is(':checked')){
  260. a.push($(o).val());
  261. if (k > 0) {
  262. aids += ',';
  263. }
  264. aids += $(o).val();
  265. k++;
  266. }
  267. })
  268. if(a.length == 0){
  269. layer.alert('请至少选择一项', {
  270. shade: layer_shade,
  271. area: ['480px', '190px'],
  272. move: false,
  273. title: '提示',
  274. btnAlign:'r',
  275. closeBtn: 3,
  276. success: function () {
  277. $(".layui-layer-content").css('text-align', 'left');
  278. }
  279. });
  280. return;
  281. }
  282. var url = $(obj).attr('data-url');
  283. //iframe窗
  284. layer.open({
  285. type: 2,
  286. title: '批量复制',
  287. fixed: true, //不固定
  288. shadeClose: false,
  289. shade: layer_shade,
  290. closeBtn: 3,
  291. maxmin: false, //开启最大化最小化按钮
  292. area: ['450px', '300px'],
  293. content: url
  294. });
  295. }
  296. /**
  297. * 批量删除提交
  298. */
  299. function batch_del(obj, name) {
  300. var url = $(obj).attr('data-url');
  301. var a = [];
  302. $('input[name^='+name+']').each(function(i,o){
  303. if($(o).is(':checked')){
  304. a.push($(o).val());
  305. }
  306. })
  307. if(a.length == 0){
  308. layer.alert('请至少选择一项', {
  309. shade: layer_shade,
  310. area: ['480px', '190px'],
  311. move: false,
  312. title: '提示',
  313. btnAlign:'r',
  314. closeBtn: 3,
  315. success: function () {
  316. $(".layui-layer-content").css('text-align', 'left');
  317. }
  318. });
  319. return;
  320. }
  321. var deltype = $(obj).attr('data-deltype');
  322. if ('pseudo' == deltype) {
  323. batch_del_pseudo(obj, a);
  324. } else {
  325. title = '确定批量删除?';
  326. btn = ['确定', '取消']; //按钮
  327. // 删除按钮
  328. layer.confirm(title, {
  329. shade: layer_shade,
  330. area: ['480px', '190px'],
  331. move: false,
  332. title: '提示',
  333. btnAlign:'r',
  334. closeBtn: 3,
  335. btn: btn, //按钮
  336. success: function () {
  337. $(".layui-layer-content").css('text-align', 'left');
  338. }
  339. }, function () {
  340. layer_loading('正在处理');
  341. $.ajax({
  342. type: "POST",
  343. url: url,
  344. data: {del_id:a, thorough:1,_ajax:1},
  345. dataType: 'json',
  346. success: function (data) {
  347. layer.closeAll();
  348. if(data.code == 1){
  349. layer.msg(data.msg, {icon: 1});
  350. //window.location.reload();
  351. /* 生成静态页面代码 */
  352. var slice_start = url.indexOf('m=admin&c=');
  353. slice_start = parseInt(slice_start) + 10;
  354. var slice_end = url.indexOf('&a=');
  355. var ctl_name = url.slice(slice_start,slice_end);
  356. $.ajax({
  357. url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=upHtml&lang="+__lang__,
  358. type:'POST',
  359. dataType:'json',
  360. data: {del_ids:a,ctl_name:ctl_name,_ajax:1},
  361. success:function(data){
  362. window.location.reload();
  363. },
  364. error: function(){
  365. window.location.reload();
  366. }
  367. });
  368. /* end */
  369. // layer.alert(data.msg, {
  370. // icon: 1,
  371. // closeBtn: 0
  372. // }, function(){
  373. // window.location.reload();
  374. // });
  375. }else{
  376. showErrorAlert(data.msg);
  377. }
  378. },
  379. error:function(e){
  380. layer.closeAll();
  381. showErrorAlert(e.responseText);
  382. }
  383. });
  384. }, function (index) {
  385. layer.closeAll(index);
  386. });
  387. }
  388. }
  389. /**
  390. * 批量删除-针对临时存放在回收站的数据
  391. */
  392. function batch_del_pseudo(obj, a) {
  393. var url = $(obj).attr('data-url');
  394. // 删除按钮
  395. layer.confirm('将批量删除文档至回收站', {
  396. shade: layer_shade,
  397. area: ['480px', '190px'],
  398. move: false,
  399. title: '提示',
  400. btnAlign:'r',
  401. closeBtn: 3,
  402. btn: ['确定', '取消'] ,//按钮
  403. success: function () {
  404. $(".layui-layer-content").css('text-align', 'left');
  405. }
  406. }, function () {
  407. layer_loading('正在处理');
  408. $.ajax({
  409. type: "POST",
  410. url: url,
  411. data: {del_id:a, _ajax:1},
  412. dataType: 'json',
  413. success: function (data) {
  414. layer.closeAll();
  415. if(data.code == 1){
  416. layer.msg(data.msg, {icon: 1});
  417. /* 生成静态页面代码 */
  418. var slice_start = url.indexOf('m=admin&c=');
  419. slice_start = parseInt(slice_start) + 10;
  420. var slice_end = url.indexOf('&a=');
  421. var ctl_name = url.slice(slice_start,slice_end);
  422. $.ajax({
  423. url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=upHtml&lang="+__lang__,
  424. type:'POST',
  425. dataType:'json',
  426. data: {del_ids:a,ctl_name:ctl_name,_ajax:1},
  427. success:function(data){
  428. window.location.reload();
  429. },
  430. error: function(){
  431. window.location.reload();
  432. }
  433. });
  434. /* end */
  435. }else{
  436. showErrorAlert(data.msg);
  437. }
  438. },
  439. error:function(e){
  440. layer.closeAll();
  441. showErrorAlert(e.responseText);
  442. }
  443. });
  444. }, function (index) {
  445. layer.closeAll(index);
  446. });
  447. }
  448. /**
  449. * 单个删除
  450. */
  451. function delfun(obj) {
  452. var url = $(obj).attr('data-url');
  453. var deltype = $(obj).attr('data-deltype');
  454. if ('pseudo' == deltype) {
  455. delfun_pseudo(obj);
  456. } else {
  457. var msg = $(obj).attr('data-msg');
  458. if (msg == '' || msg === undefined || msg === 'undefined') {
  459. msg = '确定删除?';
  460. }
  461. btn = ['确定', '取消']; //按钮
  462. layer.confirm(msg, {
  463. shade: layer_shade,
  464. area: ['480px', '190px'],
  465. move: false,
  466. title: '提示',
  467. btnAlign:'r',
  468. closeBtn: 3,
  469. btn: btn, //按钮
  470. success: function () {
  471. $(".layui-layer-content").css('text-align', 'left');
  472. }
  473. }, function(){
  474. // 确定
  475. layer_loading('正在处理');
  476. $.ajax({
  477. type : 'POST',
  478. url : url,
  479. data : {del_id:$(obj).attr('data-id'),thorough:1, _ajax:1},
  480. dataType : 'json',
  481. success : function(res){
  482. layer.closeAll();
  483. if(res.code == 1){
  484. var ctl = ey_getUrlParam('c', url);
  485. var act = ey_getUrlParam('a', url);
  486. // 更新sitemap.xml地图
  487. update_sitemap(ctl, act);
  488. layer.msg(res.msg, {icon: 1, time:1500}, function(){
  489. window.location.reload();
  490. });
  491. /* 生成静态页面代码 */
  492. /*if (2 == __seo_pseudo__) {
  493. $.ajax({
  494. url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=upHtml&lang="+__lang__,
  495. type:'POST',
  496. dataType:'json',
  497. data: {del_ids:$(obj).attr('data-id'),ctl_name:ctl,_ajax:1},
  498. success:function(res){
  499. window.location.reload();
  500. },
  501. error: function(){
  502. window.location.reload();
  503. }
  504. });
  505. }*/
  506. /* end */
  507. }else{
  508. showErrorAlert(res.msg);
  509. }
  510. },
  511. error:function(e){
  512. layer.closeAll();
  513. showErrorAlert(e.responseText);
  514. }
  515. })
  516. }, function(index){
  517. layer.close(index);
  518. return false;// 取消
  519. }
  520. );
  521. }
  522. }
  523. /**
  524. * 单个删除-针对临时存放在回收站的数据
  525. */
  526. function delfun_pseudo(obj) {
  527. var url = $(obj).attr('data-url');
  528. layer.confirm('确定删除至回收站?', {
  529. shade: layer_shade,
  530. area: ['480px', '190px'],
  531. move: false,
  532. title: '提示',
  533. btnAlign:'r',
  534. closeBtn: 3,
  535. btn: ['确定', '取消'] ,//按钮
  536. success: function () {
  537. $(".layui-layer-content").css('text-align', 'left');
  538. }
  539. }, function(){
  540. // 确定
  541. layer_loading('正在处理');
  542. $.ajax({
  543. type : 'POST',
  544. url : url,
  545. data : {del_id:$(obj).attr('data-id'), _ajax:1},
  546. dataType : 'json',
  547. success : function(data){
  548. layer.closeAll();
  549. if(data.code == 1){
  550. var ctl = ey_getUrlParam('c', url);
  551. var act = ey_getUrlParam('a', url);
  552. // 更新sitemap.xml地图
  553. update_sitemap(ctl, act);
  554. layer.msg(data.msg, {icon: 1, time:1500}, function(){
  555. window.location.reload();
  556. });
  557. /* 生成静态页面代码 */
  558. /*if (2 == __seo_pseudo__) {
  559. $.ajax({
  560. url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=upHtml&lang="+__lang__,
  561. type:'POST',
  562. dataType:'json',
  563. data: {del_ids:$(obj).attr('data-id'),ctl_name:ctl,_ajax:1},
  564. success:function(data){
  565. window.location.reload();
  566. },
  567. error: function(){
  568. window.location.reload();
  569. }
  570. });
  571. }*/
  572. /* end */
  573. }else{
  574. showErrorAlert(data.msg);
  575. }
  576. },
  577. error:function(e){
  578. layer.closeAll();
  579. showErrorAlert(e.responseText);
  580. }
  581. })
  582. }, function(index){
  583. layer.close(index);
  584. }
  585. );
  586. }
  587. /**
  588. * 批量属性操作
  589. */
  590. function batch_attr(obj, name, title)
  591. {
  592. var a = [];
  593. var k = 0;
  594. var aids = '';
  595. $('input[name^='+name+']').each(function(i,o){
  596. if($(o).is(':checked')){
  597. a.push($(o).val());
  598. if (k > 0) {
  599. aids += ',';
  600. }
  601. aids += $(o).val();
  602. k++;
  603. }
  604. })
  605. if(a.length == 0){
  606. layer.alert('请至少选择一项', {
  607. shade: layer_shade,
  608. area: ['480px', '190px'],
  609. move: false,
  610. title: '提示',
  611. btnAlign:'r',
  612. closeBtn: 3,
  613. success: function () {
  614. $(".layui-layer-content").css('text-align', 'left');
  615. }
  616. });
  617. return;
  618. }
  619. var url = $(obj).attr('data-url');
  620. //iframe窗
  621. layer.open({
  622. type: 2,
  623. title: title,
  624. fixed: true, //不固定
  625. shadeClose: false,
  626. shade: layer_shade,
  627. maxmin: false, //开启最大化最小化按钮
  628. area: ['390px', '250px'],
  629. content: url,
  630. success: function(layero, index){
  631. var body = layer.getChildFrame('body', index);
  632. body.find('input[name=aids]').val(aids);
  633. }
  634. });
  635. }
  636. /**
  637. * 全选
  638. */
  639. function selectAll(name,obj){
  640. $('input[name*='+name+']').prop('checked', $(obj).checked);
  641. }
  642. /**
  643. * 远程/本地上传图片切换
  644. */
  645. function clickRemote(obj, id)
  646. {
  647. try {
  648. if ($(obj).is(':checked')) {
  649. $('#'+id+'_remote').show();
  650. $('.div_'+id+'_local').hide();
  651. if ($("input[name="+id+"_remote]").val().length > 0) {
  652. $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
  653. } else {
  654. $("input[name=is_litpic]").attr('checked', false); // 自动取消属性[图片]
  655. }
  656. } else {
  657. $('.div_'+id+'_local').show();
  658. $('#'+id+'_remote').hide();
  659. if ($("input[name="+id+"_local]").val().length > 0) {
  660. $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
  661. } else {
  662. $("input[name=is_litpic]").attr('checked', false); // 自动取消属性[图片]
  663. }
  664. }
  665. }catch(e){}
  666. }
  667. /**
  668. * 监听远程图片文本框的按键输入事件
  669. */
  670. function keyupRemote(obj, id)
  671. {
  672. try {
  673. var value = $(obj).val();
  674. if (value != '') {
  675. $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
  676. } else {
  677. $("input[name=is_litpic]").attr('checked', false); // 自动取消属性[图片]
  678. }
  679. }catch(e){}
  680. }
  681. /**
  682. * 批量移动操作
  683. */
  684. function batch_move(obj, name) {
  685. var url = $(obj).attr('data-url');
  686. var a = [];
  687. $('input[name^='+name+']').each(function(i,o){
  688. if($(o).is(':checked')){
  689. a.push($(o).val());
  690. }
  691. })
  692. if(a.length == 0){
  693. layer.alert('请至少选择一项', {
  694. shade: layer_shade,
  695. area: ['480px', '190px'],
  696. move: false,
  697. title: '提示',
  698. btnAlign:'r',
  699. closeBtn: 3,
  700. success: function () {
  701. $(".layui-layer-content").css('text-align', 'left');
  702. }
  703. });
  704. return;
  705. }
  706. // 删除按钮
  707. layer.confirm('确定批量移动?', {
  708. shade: layer_shade,
  709. area: ['480px', '190px'],
  710. move: false,
  711. title: '提示',
  712. btnAlign:'r',
  713. closeBtn: 3,
  714. btn: ['确定', '取消'] ,//按钮
  715. success: function () {
  716. $(".layui-layer-content").css('text-align', 'left');
  717. }
  718. }, function () {
  719. layer_loading('正在处理');
  720. $.ajax({
  721. type: "POST",
  722. url: url,
  723. data: {move_id:a, _ajax:1},
  724. dataType: 'json',
  725. success: function (data) {
  726. layer.closeAll();
  727. if(data.status == 1){
  728. layer.msg(data.msg, {icon: 1});
  729. window.location.reload();
  730. }else{
  731. showErrorAlert(data.msg);
  732. }
  733. },
  734. error:function(e){
  735. layer.closeAll();
  736. showErrorAlert(e.responseText);
  737. }
  738. });
  739. }, function (index) {
  740. layer.closeAll(index);
  741. });
  742. }
  743. /**
  744. * 输入为空检查
  745. * @param name '#id' '.id' (name模式直接写名称)
  746. * @param type 类型 0 默认是id或者class方式 1 name='X'模式
  747. */
  748. function is_empty(name,type){
  749. if(type == 1){
  750. if($('input[name="'+name+'"]').val() == ''){
  751. return true;
  752. }
  753. }else{
  754. if($(name).val() == ''){
  755. return true;
  756. }
  757. }
  758. return false;
  759. }
  760. /**
  761. * 邮箱格式判断
  762. * @param str
  763. */
  764. function checkEmail(str){
  765. var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
  766. if(reg.test(str)){
  767. return true;
  768. }else{
  769. return false;
  770. }
  771. }
  772. /**
  773. * 手机号码格式判断
  774. * @param tel
  775. * @returns {boolean}
  776. */
  777. function checkMobile(tel) {
  778. var reg = /(^1[0-9]{10}$)/;
  779. if (reg.test(tel)) {
  780. return true;
  781. }else{
  782. return false;
  783. };
  784. }
  785. /*
  786. * 上传图片 后台专用
  787. * @access public
  788. * @null int 一次上传图片张图
  789. * @elementid string 上传成功后返回路径插入指定ID元素内
  790. * @path string 指定上传保存文件夹,默认存在public/upload/temp/目录
  791. * @callback string 回调函数(单张图片返回保存路径字符串,多张则为路径数组 )
  792. */
  793. var layer_GetUploadify;
  794. function GetUploadify(num,elementid,path,callback,url)
  795. {
  796. if (!url) url = GetUploadify_url;
  797. var is_water = 1;
  798. if ('water' == url) {
  799. is_water = 0;
  800. url = GetUploadify_url;
  801. }
  802. if (url.indexOf('?') > -1) {
  803. url += '&';
  804. } else {
  805. url += '?';
  806. }
  807. // 新版上传图片框的转折点
  808. if (url.indexOf('&c=Uploadimgnew&a=') != -1) {
  809. if (0 == is_water) url = 'water';
  810. GetUploadimgnew(num,elementid,path,callback,url);
  811. return false;
  812. }
  813. if (layer_GetUploadify){
  814. layer.close(layer_GetUploadify);
  815. }
  816. if (num > 0) {
  817. var width = '85%';
  818. var height = '85%';
  819. if ('adminlogo' == path || 'loginlogo' == path || 'loginbgimg' == path) { // 上传后台logo
  820. width = '50%';
  821. height = '66%';
  822. }
  823. var upurl = url+'num='+num+'&input='+elementid+'&path='+path+'&func='+callback+'&is_water='+is_water;
  824. layer_GetUploadify = layer.open({
  825. type: 2,
  826. title: '上传图片',
  827. shadeClose: false,
  828. shade: layer_shade,
  829. maxmin: true, //开启最大化最小化按钮
  830. area: [width, height],
  831. content: upurl
  832. });
  833. } else {
  834. showErrorAlert('允许上传0张图片!');
  835. return false;
  836. }
  837. }
  838. /*
  839. * 新版分组的上传图片 后台专用
  840. * @access public
  841. * @null int 一次上传图片张图
  842. * @elementid string 上传成功后返回路径插入指定ID元素内
  843. * @path string 指定上传保存文件夹,默认存在public/upload/temp/目录
  844. * @callback string 回调函数(单张图片返回保存路径字符串,多张则为路径数组 )
  845. */
  846. function GetUploadimgnew(num,elementid,path,callback,url)
  847. {
  848. if (layer_GetUploadify){
  849. top.layer.close(layer_GetUploadify);
  850. }
  851. if (num > 0) {
  852. if (!url) url = GetUploadify_url;
  853. var is_water = 1;
  854. if ('water' == url) {
  855. is_water = 0;
  856. url = GetUploadify_url;
  857. }
  858. if (url.indexOf('?') > -1) {
  859. url += '&';
  860. } else {
  861. url += '?';
  862. }
  863. var width = '1000px';
  864. var height = '620px';
  865. $.cookie("img_id_upload", ""); // 清除选中的图片
  866. var upurl = url+'num='+num+'&input='+elementid+'&path='+path+'&func='+callback+'&is_water='+is_water;
  867. if (0 == is_water) {
  868. //不需要上传第三方
  869. upurl += '&unneed_syn=1'
  870. }
  871. layer_GetUploadify = top.layer.open({
  872. id: 'layer_GetUploadimgnew',
  873. type: 2,
  874. title: ['上传图片','font-size: 16px;border-bottom: unset;background-color: unset;'],
  875. shadeClose: false,
  876. shade: layer_shade,
  877. maxmin: false, //开启最大化最小化按钮
  878. area: [width, height],
  879. content: upurl,
  880. success: function(layero, index) {
  881. var clientHeight = document.documentElement.clientHeight;
  882. if (clientHeight < 612) {
  883. layer.style(index, {
  884. width: width,
  885. height: 'unset',
  886. maxHeight: height,
  887. top: '0',
  888. });
  889. var iframe_height = $('#layer_GetUploadimgnew iframe[name^=layui-layer-iframe]').height();
  890. iframe_height = (612 - 43) - (612 - clientHeight);
  891. $('#layer_GetUploadimgnew iframe[name^=layui-layer-iframe]').css('height', iframe_height+'px');
  892. } else {
  893. layer.style(index, {
  894. width: width,
  895. height: 'unset',
  896. maxHeight: height
  897. });
  898. }
  899. },
  900. end: function() {
  901. // $.cookie("img_id_upload", ""); // 清除选中的图片
  902. }
  903. });
  904. } else {
  905. top.layer.alert('允许上传0张图片!', {icon: 2, title: false, closeBtn: false});
  906. return false;
  907. }
  908. }
  909. /*
  910. * 上传图片 在弹出窗里的上传图片
  911. * @access public
  912. * @null int 一次上传图片张图
  913. * @elementid string 上传成功后返回路径插入指定ID元素内
  914. * @path string 指定上传保存文件夹,默认存在public/upload/temp/目录
  915. * @callback string 回调函数(单张图片返回保存路径字符串,多张则为路径数组 )
  916. */
  917. var layer_GetUploadifyFrame;
  918. function GetUploadifyFrame(num,elementid,path,callback,url)
  919. {
  920. if (layer_GetUploadifyFrame){
  921. layer.close(layer_GetUploadifyFrame);
  922. }
  923. if (!url) url = GetUploadify_url;
  924. if (num > 0) {
  925. if (url.indexOf('?') > -1) {
  926. url += '&';
  927. } else {
  928. url += '?';
  929. }
  930. var upurl = url + 'num='+num+'&input='+elementid+'&path='+path+'&func='+callback;
  931. layer_GetUploadifyFrame = layer.open({
  932. type: 2,
  933. title: '上传图片',
  934. shadeClose: false,
  935. shade: layer_shade,
  936. maxmin: true, //开启最大化最小化按钮
  937. area: ['85%', '85%'],
  938. content: upurl
  939. });
  940. } else {
  941. showErrorAlert('允许上传0张图片!');
  942. return false;
  943. }
  944. }
  945. /*
  946. * 上传图片 后台(图片新闻)专用
  947. * @access public
  948. * @null int 一次上传图片张图
  949. * @elementid string 上传成功后返回路径插入指定ID元素内
  950. * @path string 指定上传保存文件夹,默认存在public/upload/temp/目录
  951. * @callback string 回调函数(单张图片返回保存路径字符串,多张则为路径数组 )
  952. */
  953. function GetUploadifyProduct(id,num,elementid,path,callback)
  954. {
  955. var upurl = eyou_basefile + '?m='+module_name+'&c=Uploadify&a=upload_product&aid='+id+'&num='+num+'&input='+elementid+'&path='+path+'&func='+callback;
  956. layer.open({
  957. type: 2,
  958. title: '上传图片',
  959. shade: layer_shade,
  960. shadeClose: true,
  961. shade: false,
  962. maxmin: true, //开启最大化最小化按钮
  963. area: ['50%', '60%'],
  964. content: upurl
  965. });
  966. }
  967. // 获取活动剩余天数 小时 分钟
  968. //倒计时js代码精确到时分秒,使用方法:注意 var EndTime= new Date('2013/05/1 10:00:00'); //截止时间 这一句,特别是 '2013/05/1 10:00:00' 这个js日期格式一定要注意,否则在IE6、7下工作计算不正确哦。
  969. //js代码如下:
  970. function GetRTime(end_time){
  971. // var EndTime= new Date('2016/05/1 10:00:00'); //截止时间 前端路上 http://www.51xuediannao.com/qd63/
  972. var EndTime= new Date(end_time); //截止时间 前端路上 http://www.51xuediannao.com/qd63/
  973. var NowTime = new Date();
  974. var t =EndTime.getTime() - NowTime.getTime();
  975. /*var d=Math.floor(t/1000/60/60/24);
  976. t-=d*(1000*60*60*24);
  977. var h=Math.floor(t/1000/60/60);
  978. t-=h*60*60*1000;
  979. var m=Math.floor(t/1000/60);
  980. t-=m*60*1000;
  981. var s=Math.floor(t/1000);*/
  982. var d=Math.floor(t/1000/60/60/24);
  983. var h=Math.floor(t/1000/60/60%24);
  984. var m=Math.floor(t/1000/60%60);
  985. var s=Math.floor(t/1000%60);
  986. if(s >= 0)
  987. return d + '天' + h + '小时' + m + '分' +s+'秒';
  988. }
  989. /**
  990. * 获取多级联动
  991. */
  992. function get_select_options(t,next){
  993. var parent_id = $(t).val();
  994. var url = $(t).attr('data-url');
  995. if(!parent_id > 0 || url == ''){
  996. return;
  997. }
  998. url = url + '?pid='+ parent_id;
  999. $.ajax({
  1000. type : "GET",
  1001. url : url,
  1002. data : {_ajax:1},
  1003. error: function(e) {
  1004. alert(e.responseText);
  1005. return;
  1006. },
  1007. success: function(v) {
  1008. $('#'+next).html(v);
  1009. }
  1010. });
  1011. }
  1012. // 读取 cookie
  1013. function getCookie(c_name)
  1014. {
  1015. if (document.cookie.length>0)
  1016. {
  1017. c_start = document.cookie.indexOf(c_name + "=")
  1018. if (c_start!=-1)
  1019. {
  1020. c_start=c_start + c_name.length+1
  1021. c_end=document.cookie.indexOf(";",c_start)
  1022. if (c_end==-1) c_end=document.cookie.length
  1023. return unescape(document.cookie.substring(c_start,c_end))
  1024. }
  1025. }
  1026. return "";
  1027. }
  1028. function setCookies(name, value, time)
  1029. {
  1030. var cookieString = name + "=" + escape(value) + ";";
  1031. if (time != 0) {
  1032. var Times = new Date();
  1033. Times.setTime(Times.getTime() + time);
  1034. cookieString += "expires="+Times.toGMTString()+";"
  1035. }
  1036. document.cookie = cookieString+"path=/";
  1037. }
  1038. function delCookie(name){
  1039. var exp=new Date();
  1040. exp.setTime(exp.getTime()-1);
  1041. var cval=getCookie(name);
  1042. if(cval!=null){
  1043. document.cookie=name+"="+cval+";expires="+exp.toGMTString() +"path=/";
  1044. }
  1045. }
  1046. function layConfirm(msg , callback){
  1047. layer.confirm(msg, {
  1048. shade: layer_shade,
  1049. area: ['480px', '190px'],
  1050. move: false,
  1051. title: '提示',
  1052. btnAlign:'r',
  1053. closeBtn: 3,
  1054. }, function(){
  1055. callback();
  1056. layer.closeAll();
  1057. }, function(index){
  1058. layer.close(index);
  1059. return false;// 取消
  1060. }
  1061. );
  1062. }
  1063. function isMobile(){
  1064. return "yes";
  1065. }
  1066. // 判断是否手机浏览器
  1067. function isMobileBrowser()
  1068. {
  1069. var sUserAgent = navigator.userAgent.toLowerCase();
  1070. var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  1071. var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  1072. var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  1073. var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  1074. var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  1075. var bIsAndroid = sUserAgent.match(/android/i) == "android";
  1076. var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  1077. var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  1078. if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM ){
  1079. return true;
  1080. }else
  1081. return false;
  1082. }
  1083. function getCookieByName(name) {
  1084. var start = document.cookie.indexOf(name + "=");
  1085. var len = start + name.length + 1;
  1086. if ((!start) && (name != document.cookie.substring(0, name.length))) {
  1087. return null;
  1088. }
  1089. if (start == -1)
  1090. return null;
  1091. var end = document.cookie.indexOf(';', len);
  1092. if (end == -1)
  1093. end = document.cookie.length;
  1094. return unescape(document.cookie.substring(len, end));
  1095. }
  1096. function showSuccessMsg(msg, time, callback){
  1097. if (!time && time != 0) {
  1098. time = 2000;
  1099. }
  1100. layer.msg(msg, {icon: 1, time: time}, function(){
  1101. if (typeof callback !== 'undefined') {
  1102. callback();
  1103. }
  1104. });
  1105. }
  1106. function showErrorMsg(msg, time, callback){
  1107. if (!time && time != 0) {
  1108. time = 2000;
  1109. }
  1110. layer.msg(msg, {icon: 2, time: time}, function(){
  1111. if (typeof callback !== 'undefined') {
  1112. callback();
  1113. }
  1114. });
  1115. }
  1116. function showSuccessAlert(msg, callback){
  1117. layer.alert(msg, {icon: 1, title: false, closeBtn: false}, function(index){
  1118. if (typeof callback === 'undefined') {
  1119. layer.close(index);
  1120. } else {
  1121. callback();
  1122. }
  1123. });
  1124. }
  1125. function showErrorAlert(msg, icon, callback){
  1126. if (!icon && icon != 0) {
  1127. icon = 2;
  1128. }
  1129. layer.alert(msg, {icon: icon, title: false, closeBtn: false}, function(index){
  1130. if (typeof callback === 'undefined') {
  1131. layer.close(index);
  1132. } else {
  1133. callback();
  1134. }
  1135. });
  1136. }
  1137. function showConfirm(msg, options, callback){
  1138. var btn = (typeof options.btn === 'undefined') ? ['确定', '取消'] : options.btn;
  1139. var area = (typeof options.area === 'undefined') ? ['480px', '190px'] : options.area;
  1140. layer.confirm(msg, {
  1141. shade: layer_shade,
  1142. area: area,
  1143. move: false,
  1144. title: '提示',
  1145. btnAlign:'r',
  1146. closeBtn: 3,
  1147. btn: btn ,//按钮
  1148. success: function () {
  1149. $(".layui-layer-content").css('text-align', 'left');
  1150. }
  1151. }, function () {
  1152. callback();
  1153. }, function (index) {
  1154. layer.close(index);
  1155. });
  1156. }
  1157. //关闭页面
  1158. function CloseWebPage(){
  1159. if (navigator.userAgent.indexOf("MSIE") > 0) {
  1160. if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
  1161. window.opener = null;
  1162. window.close();
  1163. } else {
  1164. window.open('', '_top');
  1165. window.top.close();
  1166. }
  1167. }
  1168. else if (navigator.userAgent.indexOf("Firefox") > -1 || navigator.userAgent.indexOf("Chrome") > -1) {
  1169. window.location.href = 'about:blank';
  1170. } else {
  1171. window.opener = null;
  1172. window.open('', '_self', '');
  1173. window.close();
  1174. }
  1175. }
  1176. function getHsonLength(json){
  1177. var jsonLength=0;
  1178. for (var i in json) {
  1179. jsonLength++;
  1180. }
  1181. return jsonLength;
  1182. }
  1183. // post提交之前,切换编辑器从【源代码】到【设计】视图
  1184. function ueditorHandle()
  1185. {
  1186. try {
  1187. var funcStr = "";
  1188. $('textarea[class*="ckeditor"]').each(function(index, item){
  1189. var func = $(item).data('func');
  1190. if (undefined != func && func) {
  1191. funcStr += func+"();";
  1192. }
  1193. });
  1194. eval(funcStr);
  1195. }catch(e){}
  1196. }
  1197. /**
  1198. * 封装的加载层
  1199. */
  1200. function layer_loading(msg){
  1201. try {
  1202. ueditorHandle(); // post提交之前,切换编辑器从【源代码】到【设计】视图
  1203. }catch(e){}
  1204. msg += '...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请勿刷新页面';
  1205. // msg += '<style>.layui-layer-msg{z-index: 19891016!important;border: 0px!important;}</style>';
  1206. var loading = layer.msg(msg,
  1207. {
  1208. icon: 1,
  1209. time: 3600000, //1小时后后自动关闭
  1210. shade: [0.2] //0.1透明度的白色背景
  1211. });
  1212. //loading层
  1213. var index = layer.load(3, {
  1214. shade: [0.1,'#fff'] //0.1透明度的白色背景
  1215. });
  1216. return loading;
  1217. }
  1218. /**
  1219. * 父窗口 - 封装的加载层
  1220. */
  1221. function parent_layer_loading(msg){
  1222. var loading = parent.layer.msg(
  1223. msg+'...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请勿刷新页面',
  1224. {
  1225. icon: 1,
  1226. time: 3600000, //1小时后后自动关闭
  1227. shade: [0.2] //0.1透明度的白色背景
  1228. });
  1229. //loading层
  1230. var index = parent.layer.load(3, {
  1231. shade: [0.1,'#fff'] //0.1透明度的白色背景
  1232. });
  1233. return loading;
  1234. }
  1235. function tipsText(){
  1236. $('.ui-text').each(function(){
  1237. var _this = $(this);
  1238. var elm = _this.find('.ui-input');
  1239. var txtElm = _this.find('.ui-textTips');
  1240. var maxNum = _this.find('.ui-input').attr('data-num') || 500;
  1241. // changeNum(elm,txtElm,maxNum,_this);
  1242. if(!$.support.leadingWhitespace){
  1243. _this.find('textarea').on('keyup',function(){
  1244. changeNum(elm,txtElm,maxNum,_this);
  1245. });
  1246. _this.find('input').on('keyup',function(){
  1247. changeNum(elm,txtElm,maxNum,_this);
  1248. });
  1249. } else {
  1250. _this.on('input',function(){
  1251. changeNum(elm,txtElm,maxNum,_this);
  1252. });
  1253. }
  1254. });
  1255. }
  1256. //获取文字输出字数,可以遍历使用
  1257. //txtElm动态改变的dom,maxNum获取data-num值默认为120个字,ps数字为最大字数*2
  1258. function changeNum(elm,txtElm,maxNum,_this) {
  1259. //汉字的个数
  1260. //var str = (elm.val().replace(/\w/g, "")).length;
  1261. //非汉字的个数
  1262. //var abcnum = elm.val().length - str;
  1263. var bigtxtElm = _this.find('.ui-big-text');
  1264. total = elm.val().length;
  1265. if(total <= maxNum ){
  1266. texts = maxNum - total;
  1267. txtElm.html('还可以输入<em>'+texts+'</em>个字符');
  1268. if (bigtxtElm) {
  1269. bigtxtElm.hide();
  1270. }
  1271. }else{
  1272. texts = total - maxNum ;
  1273. txtElm.html('已超出<em class="error">'+texts+'</em>个字符');
  1274. if (bigtxtElm) {
  1275. bigtxtElm.show();
  1276. }
  1277. }
  1278. return ;
  1279. }
  1280. // 查看大图
  1281. function Images(links, max_width, max_height){
  1282. var img = "<img src='"+links+"'/>";
  1283. $(img).load(function() {
  1284. width = this.width;
  1285. height = this.height;
  1286. if (this.width > max_width) {
  1287. width = max_width + 'px';
  1288. height = 'auto';
  1289. }
  1290. if (this.height > max_height) {
  1291. width = 'auto';
  1292. height = max_height + 'px';
  1293. }
  1294. // if (width > height) {
  1295. // if (width > max_width) {
  1296. // width = max_width;
  1297. // }
  1298. // width += 'px';
  1299. // } else {
  1300. // width = 'auto';
  1301. // }
  1302. // if (width < height) {
  1303. // if (height > max_height) {
  1304. // height = max_height;
  1305. // }
  1306. // height += 'px';
  1307. // } else {
  1308. // height = 'auto';
  1309. // }
  1310. var links_img = "<style type='text/css'>.layui-layer-content{overflow-y: hidden!important;}</style><img style='width:"+width+";height:"+height+";' src="+links+">";
  1311. layer.open({
  1312. type: 1,
  1313. title: false,
  1314. area: [width, height],
  1315. skin: 'layui-layer-nobg', //没有背景色
  1316. content: links_img
  1317. });
  1318. });
  1319. }
  1320. function gourl(url)
  1321. {
  1322. window.location.href = url;
  1323. }
  1324. // 百度自动推送
  1325. function push_zzbaidu(url, type)
  1326. {
  1327. if (url != '') {
  1328. $.ajax({
  1329. url:__root_dir__+"/index.php?m=api&c=Ajax&a=push_zzbaidu&lang="+__lang__,
  1330. type:'POST',
  1331. dataType:'json',
  1332. data:{"url":url,"type":type,"_ajax":1},
  1333. success:function(res){
  1334. console.log(res.msg);
  1335. },
  1336. error: function(e){
  1337. console.log(e);
  1338. }
  1339. });
  1340. }
  1341. }
  1342. // 百度小程序 API 提交 (自动推送)
  1343. function push_bdminipro(aid, type)
  1344. {
  1345. $.ajax({
  1346. url:__root_dir__+"/index.php?m=api&c=Ajax&a=push_bdminipro&lang="+__lang__,
  1347. type:'POST',
  1348. dataType:'json',
  1349. data:{"aid":aid,"type":type,"_ajax":1},
  1350. success:function(res){
  1351. console.log(res.msg);
  1352. },
  1353. error: function(e){
  1354. console.log(e);
  1355. }
  1356. });
  1357. }
  1358. // 更新sitemap.xml地图
  1359. function update_sitemap(controller, action)
  1360. {
  1361. $.ajax({
  1362. url:__root_dir__+"/index.php?m=admin&c=Ajax&a=update_sitemap&lang="+__lang__,
  1363. type:'POST',
  1364. dataType:'json',
  1365. data:{"controller":controller,"action":action,"_ajax":1},
  1366. success:function(res){
  1367. console.log(res.msg);
  1368. },
  1369. error: function(e){
  1370. console.log(e);
  1371. }
  1372. });
  1373. }
  1374. //在iframe内打开易优官网的页面
  1375. function click_to_eyou_1575506523(url,title,width,height) {
  1376. //iframe窗
  1377. if (!width) width = '80%';
  1378. if (!height) height = '80%';
  1379. layer.open({
  1380. type: 2,
  1381. title: title,
  1382. fixed: true, //不固定
  1383. shadeClose: false,
  1384. shade: layer_shade,
  1385. maxmin: false, //开启最大化最小化按钮
  1386. area: [width, height],
  1387. content: url
  1388. });
  1389. }
  1390. //在iframe内打开页面操作
  1391. function openFullframe(obj,title,width,height,offset) {
  1392. //iframe窗
  1393. var url = '';
  1394. if (typeof(obj) == 'string' && obj.indexOf("?m=admin&c=") != -1) {
  1395. url = obj;
  1396. } else {
  1397. url = $(obj).data('href');
  1398. }
  1399. if (!width) width = '80%';
  1400. if (!height) height = '80%';
  1401. if (!offset) offset = 'auto';
  1402. var anim = 0;
  1403. var shade = layer_shade;
  1404. if ('r' == offset) {
  1405. shade = layer_shade;
  1406. anim = 5;
  1407. }
  1408. var iframes = layer.open({
  1409. type: 2,
  1410. title: title,
  1411. fixed: true, //不固定
  1412. shadeClose: false,
  1413. shade: shade,
  1414. offset: offset,
  1415. // maxmin: true, //开启最大化最小化按钮
  1416. area: [width, height],
  1417. anim: anim,
  1418. content: url,
  1419. cancel: function(index, layero){
  1420. if (typeof(obj) == 'object') {
  1421. var callback = $(obj).data('cancel_callback');
  1422. if (callback != '' && callback != undefined && callback != 'undefined') {
  1423. eval(callback+'();');
  1424. }
  1425. }
  1426. },
  1427. end: function(){
  1428. if (typeof(obj) == 'object') {
  1429. var callback = $(obj).data('end_callback');
  1430. if (callback != '' && callback != undefined && callback != 'undefined') {
  1431. eval(callback+'();');
  1432. } else {
  1433. if (1 == $(obj).data('closereload')) window.location.reload();
  1434. }
  1435. }
  1436. },
  1437. success: function(layero, index){
  1438. if ('r' == offset) {
  1439. $('.layui-layer-shade').hide();
  1440. // $('.layui-layer-shade').click(function(){
  1441. // layer.close(index);
  1442. // });
  1443. }
  1444. }
  1445. });
  1446. if ('r' == offset) {
  1447. $('.layui-layer-shade').hide();
  1448. }
  1449. if (width == '100%' && height == '100%') {
  1450. layer.full(iframes);
  1451. }
  1452. }
  1453. //在iframe内打开页面操作
  1454. function parent_openFullframe(obj,title,width,height) {
  1455. //iframe窗
  1456. var url = '';
  1457. if (typeof(obj) == 'string' && obj.indexOf("?m=admin&c=") != -1) {
  1458. url = obj;
  1459. } else {
  1460. url = $(obj).data('href');
  1461. }
  1462. if (!width) width = '80%';
  1463. if (!height) height = '80%';
  1464. var iframes = parent.layer.open({
  1465. type: 2,
  1466. title: title,
  1467. fixed: true, //不固定
  1468. shadeClose: false,
  1469. shade: layer_shade,
  1470. // maxmin: true, //开启最大化最小化按钮
  1471. area: [width, height],
  1472. content: url,
  1473. end: function() {
  1474. if (typeof(obj) == 'object') {
  1475. if (1 == $(obj).data('closereload')) parent.window.location.reload();
  1476. }
  1477. }
  1478. });
  1479. if (width == '100%' && height == '100%') {
  1480. layer.full(iframes);
  1481. }
  1482. }
  1483. //在iframe内打开页面操作
  1484. function openHelpframe(obj,title,width,height,offset) {
  1485. //iframe窗
  1486. var url = '';
  1487. if (typeof(obj) == 'string' && obj.indexOf("?m=admin&c=") != -1) {
  1488. url = obj;
  1489. } else {
  1490. url = $(obj).data('href');
  1491. }
  1492. var tab_index = 0;
  1493. $('.item-title .tab-base').find('.tab').each(function(){
  1494. var className = $(this).attr('class');
  1495. if (className.indexOf('current') > -1) {
  1496. tab_index = $(this).data('index');
  1497. }
  1498. });
  1499. if (tab_index > 0){
  1500. url += "&tab_index="+tab_index;
  1501. }
  1502. if (!width) width = '80%';
  1503. if (!height) height = '80%';
  1504. if (!offset) offset = 'auto';
  1505. var anim = 0;
  1506. var shade = layer_shade;
  1507. if ('r' == offset) {
  1508. shade = layer_shade;
  1509. anim = 5;
  1510. }
  1511. help_iframes = layer.open({
  1512. type: 2,
  1513. title: title,
  1514. fixed: true, //不固定
  1515. shadeClose: false,
  1516. shade: shade,
  1517. offset: offset,
  1518. closeBtn: 3,
  1519. // maxmin: true, //开启最大化最小化按钮
  1520. area: [width, height],
  1521. anim: anim,
  1522. content: url,
  1523. end: function() {
  1524. if (typeof(obj) == 'object') {
  1525. if (1 == $(obj).data('closereload')) window.location.reload();
  1526. }
  1527. },
  1528. success: function(layero, index){
  1529. if ('r' == offset) {
  1530. $('.layui-layer-shade').hide();
  1531. // $('.layui-layer-shade').click(function(){
  1532. // layer.close(index);
  1533. // });
  1534. }
  1535. }
  1536. });
  1537. if ('r' == offset) {
  1538. $('.layui-layer-shade').hide();
  1539. }
  1540. if (width == '100%' && height == '100%') {
  1541. layer.full(help_iframes);
  1542. }
  1543. }
  1544. /**
  1545. * 选择每页数量进行检索
  1546. * @param {[type]} obj [description]
  1547. * @return {[type]} [description]
  1548. */
  1549. function ey_selectPagesize(obj)
  1550. {
  1551. layer_loading('正在处理');
  1552. var pagesize = $(obj).val();
  1553. var thisURL = ey_updateUrlParam('pagesize', pagesize);
  1554. thisURL = thisURL.replace(/&p=\d+/, '&p=1');
  1555. window.location.href = thisURL;
  1556. }
  1557. /**
  1558. * 添加 或者 修改 url中参数的值
  1559. * @param {[type]} name [description]
  1560. * @param {[type]} val [description]
  1561. */
  1562. function ey_updateUrlParam(name, val) {
  1563. var thisURL = document.location.href;
  1564. // 如果 url中包含这个参数 则修改
  1565. if (thisURL.indexOf(name+'=') > 0) {
  1566. var v = ey_getUrlParam(name);
  1567. if (v != null) {
  1568. // 是否包含参数
  1569. thisURL = thisURL.replace(name + '=' + v, name + '=' + val);
  1570. }
  1571. else {
  1572. thisURL = thisURL.replace(name + '=', name + '=' + val);
  1573. }
  1574. } // 不包含这个参数 则添加
  1575. else {
  1576. if (thisURL.indexOf("?") > 0) {
  1577. thisURL = thisURL + "&" + name + "=" + val;
  1578. }
  1579. else {
  1580. thisURL = thisURL + "?" + name + "=" + val;
  1581. }
  1582. }
  1583. return thisURL;
  1584. };
  1585. function ajax_system_1610425892()
  1586. {
  1587. setTimeout(function(){
  1588. $.ajax({
  1589. type : 'get',
  1590. url : eyou_basefile + "?m="+module_name+"&c=Encodes&a=ajax_system_1610425892&lang=" + __lang__,
  1591. data : {_ajax:1},
  1592. dataType : 'json',
  1593. success : function(res){}
  1594. });
  1595. },5000);
  1596. }
  1597. /**
  1598. * 获取url参数值的方法
  1599. * @param {[type]} name [description]
  1600. * @return {[type]} [description]
  1601. */
  1602. function ey_getUrlParam(name, url)
  1603. {
  1604. if (!url) {
  1605. url = window.location.search;
  1606. }
  1607. var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  1608. var r = url.substr(1).match(reg);
  1609. if (r!=null) return unescape(r[2]); return null;
  1610. }
  1611. function tags_list_1610411887(obj)
  1612. {
  1613. layer.closeAll();
  1614. $('#often_tags').hide();
  1615. var url = eyou_basefile + "?m="+module_name+"&c=Tags&a=index&source=archives&lang=" + __lang__;
  1616. //iframe窗
  1617. var iframes = layer.open({
  1618. type: 2,
  1619. shade: layer_shade,
  1620. title: 'TAG标签管理',
  1621. fixed: true, //不固定
  1622. shadeClose: false,
  1623. area: ['100%', '100%'],
  1624. content: url
  1625. });
  1626. layer.full(iframes);
  1627. }
  1628. function get_common_tagindex(obj)
  1629. {
  1630. var val = $(obj).val();
  1631. $('#often_tags').hide();
  1632. $('#often_tags_input').hide();
  1633. $('#tag_loading').show();
  1634. $.ajax({
  1635. type : 'post',
  1636. url : eyou_basefile + "?m="+module_name+"&c=Tags&a=get_common_list&is_click=1&lang=" + __lang__,
  1637. data : {tags:val, _ajax:1},
  1638. dataType : 'json',
  1639. success : function(res){
  1640. $('#tag_loading').hide();
  1641. if(res.code == 1){
  1642. if (res.data.html) {
  1643. $('#often_tags').html(res.data.html).show();
  1644. }
  1645. }else{
  1646. showErrorMsg(res.msg);
  1647. }
  1648. },
  1649. error: function(e){
  1650. layer.closeAll();
  1651. $('#tag_loading').hide();
  1652. showErrorAlert(e.responseText);
  1653. }
  1654. });
  1655. }
  1656. function get_common_tagindex_input(obj)
  1657. {
  1658. var val = $(obj).val();
  1659. $('#tags_click_count').val(0);
  1660. $('#often_tags_input').hide();
  1661. $.ajax({
  1662. type : 'post',
  1663. url : eyou_basefile + "?m="+module_name+"&c=Tags&a=get_common_list&lang=" + __lang__,
  1664. data : {tags:val,type:1, _ajax:1},
  1665. dataType : 'json',
  1666. success : function(res){
  1667. if(res.code == 1){
  1668. if (res.data.html) {
  1669. $('#often_tags_input').html(res.data.html).show();
  1670. }
  1671. }else{
  1672. showErrorMsg(res.msg);
  1673. }
  1674. },
  1675. error: function(e){
  1676. layer.closeAll();
  1677. showErrorAlert(e.responseText);
  1678. }
  1679. });
  1680. }
  1681. function selectArchivesTag(obj)
  1682. {
  1683. event.stopPropagation();
  1684. var newTag = $.trim($(obj).html());
  1685. var tags = $.trim($('#tags').val());
  1686. if (tags != '') {
  1687. tags = tags.replace(/,/ig, ',');
  1688. tagsList = tags.split(',');
  1689. } else {
  1690. tagsList = new Array();
  1691. }
  1692. if (-1 < $.inArray(newTag, tagsList)) {
  1693. tagsList.splice($.inArray(newTag, tagsList), 1);
  1694. $(obj).removeClass('cur');
  1695. } else {
  1696. tagsList.push(newTag);
  1697. $(obj).addClass('cur');
  1698. }
  1699. tags = tagsList.join(',');
  1700. $('#tags').val(tags);
  1701. var opt = $(obj).parent().data('opt');
  1702. if ('add' == opt) {
  1703. $('#seo_keywords').val(tags);
  1704. }
  1705. }
  1706. function selectArchivesTagInput(obj)
  1707. {
  1708. event.stopPropagation();
  1709. var newTag = $.trim($(obj).html());
  1710. var tags = $.trim($('#tags').val());
  1711. var count = $('#tags_click_count').val();
  1712. if (tags != '') {
  1713. tags = tags.replace(/,/ig, ',');
  1714. tagsList = tags.split(',');
  1715. } else {
  1716. tagsList = new Array();
  1717. }
  1718. if (-1 < $.inArray(newTag, tagsList)) {
  1719. tagsList.splice($.inArray(newTag, tagsList), 1);
  1720. $(obj).removeClass('cur');
  1721. } else {
  1722. if(0 == count){
  1723. tagsList.splice(tagsList.length-1,1);
  1724. $(obj).removeClass('cur');
  1725. }
  1726. tagsList.push(newTag);
  1727. $(obj).addClass('cur');
  1728. $('#tags_click_count').val(count+1)
  1729. }
  1730. tags = tagsList.join(',');
  1731. $('#tags').val(tags);
  1732. }
  1733. /**
  1734. * 检测文档的自定义文件名
  1735. * @return {[type]} [description]
  1736. */
  1737. function ajax_check_htmlfilename()
  1738. {
  1739. var flag = false;
  1740. var aid = $('input[name=aid]').val();
  1741. var typeid = $('select[name=typeid]').val();
  1742. var htmlfilename = $.trim($('input[name=htmlfilename]').val());
  1743. if (htmlfilename == '') {
  1744. return true;
  1745. }
  1746. $.ajax({
  1747. url : eyou_basefile + "?m="+module_name+"&c=Archives&a=ajax_check_htmlfilename&lang=" + __lang__,
  1748. type: 'POST',
  1749. async: false,
  1750. dataType: 'JSON',
  1751. data: {htmlfilename: htmlfilename, aid: aid, typeid:typeid, _ajax:1},
  1752. success: function(res){
  1753. if(res.code == 1){
  1754. flag = true;
  1755. }
  1756. },
  1757. error: function(e){
  1758. showErrorAlert(e.responseText);
  1759. }
  1760. });
  1761. return flag;
  1762. }
  1763. function check_title_repeat(obj,aid) {
  1764. var title = $(obj).val();
  1765. if (title){
  1766. $.ajax({
  1767. type: "POST",
  1768. url : eyou_basefile + "?m="+module_name+"&c=Archives&a=check_title_repeat&lang=" + __lang__,
  1769. data: {title:title,aid:aid, _ajax:1},
  1770. dataType: 'json',
  1771. success: function (data) {
  1772. if(data.code == 0){
  1773. layer.tips(data.msg, '#title',{
  1774. tips: [2, '#F5F5F5'],
  1775. area: ['300px', 'auto'],
  1776. time: 0
  1777. });
  1778. }else {
  1779. layer.closeAll();
  1780. }
  1781. },
  1782. error:function(){
  1783. }
  1784. });
  1785. }else{
  1786. layer.closeAll();
  1787. }
  1788. }
  1789. function set_author(value)
  1790. {
  1791. layer.prompt({
  1792. title:'设置作者默认名称',
  1793. shade: layer_shade,
  1794. btnAlign:'r',
  1795. closeBtn: 3,
  1796. value: value
  1797. },
  1798. function(val, index){
  1799. $.ajax({
  1800. url: eyou_basefile + "?m=admin&c=Admin&a=ajax_setfield&_ajax=1",
  1801. type: 'POST',
  1802. dataType: 'JSON',
  1803. data: {field:'pen_name',value:val},
  1804. success: function(res){
  1805. if (res.code == 1) {
  1806. $('#author').val(val);
  1807. layer.msg(res.msg, {icon: 1, time:1000});
  1808. } else {
  1809. showErrorMsg(res.msg);
  1810. return false;
  1811. }
  1812. },
  1813. error: function(e){
  1814. showErrorMsg(e.responseText);
  1815. return false;
  1816. }
  1817. });
  1818. layer.close(index);
  1819. }
  1820. );
  1821. }
  1822. //自动远程图片本地化/自动清除非本站链接 type = 'type' 是栏目 ,否则是内容
  1823. function editor_auto_210607(type) {
  1824. return true;
  1825. /*
  1826. if (!type) type = '';
  1827. var editor_remote_img_local = 0;
  1828. var editor_img_clear_link = 0;
  1829. if ($('#editor_remote_img_local').attr('checked')) {
  1830. editor_remote_img_local = 1;
  1831. }
  1832. if ($('#editor_img_clear_link').attr('checked')) {
  1833. editor_img_clear_link = 1;
  1834. }
  1835. if (1 == editor_remote_img_local || 1 == editor_img_clear_link) {
  1836. var editor_addonFieldExt = $('#editor_addonFieldExt').val();
  1837. if (editor_addonFieldExt) {
  1838. var arr = editor_addonFieldExt.split(',');
  1839. $.each(arr, function (index, value) {
  1840. if ('type' == type){
  1841. //栏目
  1842. eval('ajax_auto_editor_addonField_'+value+'('+editor_remote_img_local+','+editor_img_clear_link+');');
  1843. } else{
  1844. //内容
  1845. eval('ajax_auto_editor_addonFieldExt_'+value+'('+editor_remote_img_local+','+editor_img_clear_link+');');
  1846. }
  1847. });
  1848. }
  1849. }
  1850. */
  1851. }
  1852. //手动远程图片本地化 value = 1/手动清除非本站链接 value = 2
  1853. function editor_handle_210607(val,type) {
  1854. return true;
  1855. /*
  1856. if (!val) val = 0;
  1857. if (!type) type = '';
  1858. var editor_remote_img_local = 0;
  1859. var editor_img_clear_link = 0;
  1860. if (1 == val) {
  1861. editor_remote_img_local = 1;
  1862. }
  1863. if (2 == val) {
  1864. editor_img_clear_link = 1;
  1865. }
  1866. if (1 == editor_remote_img_local || 1 == editor_img_clear_link) {
  1867. var editor_addonFieldExt = $('#editor_addonFieldExt').val();
  1868. if (editor_addonFieldExt) {
  1869. var arr = editor_addonFieldExt.split(',');
  1870. $.each(arr, function (index, value) {
  1871. if ('type' == type){
  1872. //栏目
  1873. eval('ajax_auto_editor_addonField_'+value+'('+editor_remote_img_local+','+editor_img_clear_link+');');
  1874. } else{
  1875. //内容
  1876. eval('ajax_auto_editor_addonFieldExt_'+value+'('+editor_remote_img_local+','+editor_img_clear_link+');');
  1877. }
  1878. });
  1879. }
  1880. }
  1881. */
  1882. }
  1883. //城市分站 - 自动获取二级城市列表
  1884. function set_city_list(cityid, siteid) {
  1885. var pid = $("#province_id").val();
  1886. $.ajax({
  1887. url: eyou_basefile + "?m=admin&c=Citysite&a=ajax_get_region&_ajax=1",
  1888. type: 'POST',
  1889. dataType: 'JSON',
  1890. async: false,
  1891. data: {pid:pid,level:2,siteid:siteid},
  1892. success: function(res){
  1893. if (res.code === 1){
  1894. if (1 == res.data.isempty) {
  1895. $("#city_id").hide();
  1896. } else {
  1897. $("#city_id").show();
  1898. }
  1899. $("#city_id").empty();
  1900. $("#city_id").prepend(res.msg);
  1901. if (cityid > 0) {
  1902. $("#city_id").val(cityid);
  1903. }
  1904. $('#area_id').hide().val(0);
  1905. }
  1906. },
  1907. error: function(e){
  1908. showErrorMsg(e.responseText);
  1909. return false;
  1910. }
  1911. });
  1912. var catid = $('#typeid').val();
  1913. var aid = $('#aid_val').val();
  1914. $.ajax({
  1915. url: eyou_basefile + "?m=admin&c=Archives&a=getTag&_ajax=1",
  1916. type: 'POST',
  1917. dataType: 'JSON',
  1918. async: false,
  1919. data: {pid:pid,level:2,siteid:siteid,catid:catid,aid:aid},
  1920. success: function(res){
  1921. if (res.code === 0){
  1922. $("#catchoose666").empty();
  1923. $("#catchoose666").prepend(res.data);
  1924. }else{
  1925. if(catid != 825 && catid != 126 && catid != 125){
  1926. alert("获取标签错误,请重新选择区域!");
  1927. }
  1928. }
  1929. },
  1930. error: function(e){
  1931. showErrorMsg(e.responseText);
  1932. return false;
  1933. }
  1934. });
  1935. }
  1936. //城市分站 - 自动获取三级乡镇列表
  1937. function set_area_list(areaid) {
  1938. var pid = $("#city_id").val();
  1939. $.ajax({
  1940. url: eyou_basefile + "?m=admin&c=Citysite&a=ajax_get_region&_ajax=1",
  1941. type: 'POST',
  1942. dataType: 'JSON',
  1943. async: false,
  1944. data: {pid:pid,level:3},
  1945. success: function(res){
  1946. if (res.code === 1){
  1947. if (1 == res.data.isempty) {
  1948. $("#area_id").hide();
  1949. } else {
  1950. $("#area_id").show();
  1951. }
  1952. $("#area_id").empty();
  1953. $("#area_id").prepend(res.msg);
  1954. if (areaid > 0) {
  1955. $("#area_id").val(areaid);
  1956. }
  1957. }
  1958. },
  1959. error: function(e){
  1960. showErrorMsg(e.responseText);
  1961. return false;
  1962. }
  1963. });
  1964. }
  1965. /**
  1966. * 判断URL是否合法http(s)
  1967. * @param {[type]} URL [description]
  1968. * @return {[type]} [description]
  1969. */
  1970. function checkURL(URL) {
  1971. var str = URL,
  1972. Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/,
  1973. objExp = new RegExp(Expression);
  1974. if(objExp.test(str) == true) {
  1975. return true
  1976. } else {
  1977. return false
  1978. }
  1979. }
  1980. /**
  1981. * 选择副栏目
  1982. * @param {[type]} obj [description]
  1983. * @return {[type]} [description]
  1984. */
  1985. function select_stypeid(obj)
  1986. {
  1987. var stypeid = $('#stypeid').val();
  1988. var channel = $(obj).data('channel');
  1989. var catid = $(obj).data('catid');
  1990. var typeid = $('select[name=typeid]').val();
  1991. var iframes = layer.open({
  1992. type: 2,
  1993. title: '选择副栏目',
  1994. fixed: true, //不固定
  1995. shadeClose: false,
  1996. shade: layer_shade,
  1997. // maxmin: true, //开启最大化最小化按钮
  1998. area: ['750px', '550px'],
  1999. btn: ['确定', '关闭'],
  2000. content: eyou_basefile+"?m=admin&c=Archives&a=ajax_get_stypeid_list&channel="+channel+"&stypeid="+stypeid+"&catid="+catid+"&typeid="+typeid+"&lang="+__lang__,
  2001. yes: function(index, layero) {
  2002. var body = layer.getChildFrame('body', index);
  2003. var stypeid = body.find('#post_stypeid').val();
  2004. var stypename = body.find('#post_stypename').val();
  2005. layer.close(index);
  2006. $('#stypeid').val(stypeid);
  2007. $('#stypeid_txt').html(stypename);
  2008. //刷新关联 产品
  2009. }
  2010. });
  2011. }
  2012. /*------------------------------------来源 start-------------------------------*/
  2013. $(function(){
  2014. $("body").click(function(){
  2015. $('.origin-hot-list').hide();
  2016. });
  2017. });
  2018. var origin_1598602098 = '';
  2019. function search_origin_mouseover(th)
  2020. {
  2021. $('#search_keywords_list_origin').show();
  2022. try{
  2023. clearTimeout(origin_1598602098);
  2024. }catch(e){}
  2025. }
  2026. function search_origin_mouseout(th)
  2027. {
  2028. var setFunc = $("#search_keywords_list_origin").hide();
  2029. origin_1598602098 = setTimeout('"'+setFunc+'"',1000);
  2030. }
  2031. function searchOrigin(th) {
  2032. $.ajax({
  2033. type: "POST",
  2034. url: eyou_basefile+"?m=admin&c=Archives&a=search_origin&lang="+__lang__,
  2035. data: {keyword:'', _ajax:1},
  2036. dataType: 'json',
  2037. cache: false,
  2038. success: function (res) {
  2039. if(res.code == 1){
  2040. if (res.data.length > 0) {
  2041. var html='';
  2042. res.data.forEach(function(i,e) {
  2043. var e_num = e+1;
  2044. html += '<a href="javascript:void(0);" onclick="search_origin_sname(this);" onmouseover="search_origin_mouseover(this);" onmouseout="search_origin_mouseout(this);" data-sname="'+i+'" style="cursor: pointer;">';
  2045. html += '<div class="number c'+e_num+'">'+e_num+'</div>';
  2046. html += '<div class="hottxt">'+i+'</div>';
  2047. html += '</a>';
  2048. });
  2049. $('#search_keywords_list_origin').html(html).show();
  2050. } else {
  2051. $('#search_keywords_list_origin').hide();
  2052. }
  2053. } else {
  2054. $('#search_keywords_list_origin').hide();
  2055. }
  2056. }
  2057. });
  2058. }
  2059. function search_origin_sname(th) {
  2060. var sname = $(th).attr('data-sname');
  2061. $("#origin").val(sname);
  2062. }
  2063. function set_originlist()
  2064. {
  2065. var value = $('#system_originlist_str').val();
  2066. layer.prompt({
  2067. title:'来源管理',
  2068. shade: layer_shade,
  2069. formType: 2,
  2070. btnAlign:'r',
  2071. closeBtn: 3,
  2072. placeholder: '一行代表一个来源值',
  2073. value: value,
  2074. },
  2075. function(val, index){
  2076. $.ajax({
  2077. url: eyou_basefile + "?m=admin&c=Archives&a=ajax_set_originlist&_ajax=1",
  2078. type: 'POST',
  2079. dataType: 'JSON',
  2080. data: {origin:val},
  2081. success: function(res){
  2082. if (res.code == 1) {
  2083. $('#system_originlist_str').val(res.data.originlist_str);
  2084. layer.msg(res.msg, {icon: 1, time:1000});
  2085. } else {
  2086. showErrorMsg(res.msg);
  2087. return false;
  2088. }
  2089. },
  2090. error: function(e){
  2091. showErrorMsg(e.responseText);
  2092. return false;
  2093. }
  2094. });
  2095. layer.close(index);
  2096. }
  2097. );
  2098. }
  2099. /*------------------------------------来源 end-------------------------------*/
  2100. /*----------------------------------密保问题答案验证 start--------------------*/
  2101. /**
  2102. * 是否已验证了答案
  2103. * @return {[type]} [description]
  2104. */
  2105. function ajax_isverify_answer()
  2106. {
  2107. var flag = false;
  2108. var ask_open_old = 0;
  2109. if (typeof __security_ask_open__ !== 'undefined' && __security_ask_open__ > 0) {
  2110. ask_open_old = __security_ask_open__;
  2111. }
  2112. var ask_open = $('input[name=security_ask_open]:checked').val();
  2113. if (1 == ask_open_old && ask_open_old != ask_open) { // 关闭验证密保答案
  2114. } else { // 开启不做验证
  2115. return true;
  2116. }
  2117. $.ajax({
  2118. url : eyou_basefile + "?m="+module_name+"&c=Security&a=ajax_isverify_answer&lang=" + __lang__,
  2119. type: 'POST',
  2120. async: false,
  2121. dataType: 'JSON',
  2122. data: {_ajax:1},
  2123. success: function(res){
  2124. if(res.code == 1){
  2125. flag = true;
  2126. }
  2127. },
  2128. error: function(e){
  2129. showErrorAlert(e.responseText);
  2130. }
  2131. });
  2132. return flag;
  2133. }
  2134. function autoload_security()
  2135. {
  2136. var security_ask = $('#security_ask_old').val();
  2137. layer.prompt({
  2138. title: '密保问题',
  2139. id: 'layerid_1645598368',
  2140. btn: ['确定'],
  2141. shade: layer_shade,
  2142. closeBtn: 3,
  2143. success: function(layero, index) {
  2144. var before_str = "<div style='margin: -8px 0px 10px 0px;color: red;font-weight: bold;'>"+security_ask+"</div>";
  2145. $("#layerid_1645598368").prepend(before_str);
  2146. $("#layerid_1645598368").find('input').attr('placeholder', '请录入密保答案!');
  2147. $("#layerid_1645598368").find('input').bind('keydown', function(event) {
  2148. if (event.keyCode == 13) {
  2149. security_answer_verify($(this).val());
  2150. }
  2151. });
  2152. },
  2153. btn2: function(index, layero){
  2154. return false;
  2155. }
  2156. }, function(value, index) {
  2157. security_answer_verify(value);
  2158. });
  2159. }
  2160. function security_answer_verify(answer)
  2161. {
  2162. $.ajax({
  2163. type : 'post',
  2164. url : eyou_basefile + "?m="+module_name+"&c=Security&a=ajax_answer_verify&_ajax=1&lang=" + __lang__,
  2165. data : {answer:answer},
  2166. dataType : 'json',
  2167. success : function(res){
  2168. if (res.code == 1) {
  2169. layer.closeAll();
  2170. try{
  2171. security_ask_submitForm();
  2172. }catch(e){}
  2173. }else{
  2174. $('#layerid_1645598368').find('input[type=text]').focus();
  2175. layer.msg(res.msg, {time: 1000});
  2176. }
  2177. },
  2178. error: function(e) {
  2179. showErrorAlert(e.responseText);
  2180. }
  2181. });
  2182. }
  2183. /*----------------------------------密保问题答案验证 end--------------------*/