78bbfd7eaff9b341c543c8c239cfe093.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <?php /*a:5:{s:67:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\article\article\create.php";i:1595820902;s:61:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\container.php";i:1595820902;s:62:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;s:64:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_footer.php";i:1595820902;}*/ ?>
  2. <!DOCTYPE html>
  3. <html lang="zh-CN">
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <?php if(empty($is_layui) || (($is_layui instanceof \think\Collection || $is_layui instanceof \think\Paginator ) && $is_layui->isEmpty())): ?>
  8. <link href="/system/frame/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
  9. <?php endif; ?>
  10. <link href="/static/plug/layui/css/layui.css" rel="stylesheet">
  11. <link href="/system/css/layui-admin.css" rel="stylesheet">
  12. <link href="/system/frame/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
  13. <link href="/system/frame/css/animate.min.css" rel="stylesheet">
  14. <link href="/system/frame/css/style.min.css?v=3.0.0" rel="stylesheet">
  15. <script src="/system/frame/js/jquery.min.js"></script>
  16. <script src="/system/frame/js/bootstrap.min.js"></script>
  17. <script src="/static/plug/layui/layui.all.js"></script>
  18. <script>
  19. $eb = parent._mpApi;
  20. window.controlle="<?php echo strtolower(trim(preg_replace("/[A-Z]/", "_\\0", app('request')->controller()), "_"));?>";
  21. window.module="<?php echo app('http')->getName();?>";
  22. </script>
  23. <title></title>
  24. <link href="/system/plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
  25. <link href="/system/module/wechat/news/css/style.css" type="text/css" rel="stylesheet">
  26. <link href="/system/frame/css/plugins/chosen/chosen.css" rel="stylesheet">
  27. <script type="text/javascript" src="/system/plug/umeditor/third-party/jquery.min.js"></script>
  28. <script type="text/javascript" src="/system/plug/umeditor/third-party/template.min.js"></script>
  29. <script type="text/javascript" charset="utf-8" src="/system/plug/umeditor/umeditor.config.js"></script>
  30. <script type="text/javascript" charset="utf-8" src="/system/plug/umeditor/umeditor.js"></script>
  31. <script src="/system/frame/js/ajaxfileupload.js"></script>
  32. <script src="/system/plug/validate/jquery.validate.js"></script>
  33. <script src="/system/frame/js/plugins/chosen/chosen.jquery.js"></script>
  34. <style>
  35. .wrapper-content {
  36. padding: 0 !important;
  37. }
  38. </style>
  39. <!--<script type="text/javascript" src="/static/plug/basket.js"></script>-->
  40. <script type="text/javascript" src="/static/plug/requirejs/require.js"></script>
  41. <?php /* <script type="text/javascript" src="/static/plug/requirejs/require-basket-load.js"></script> */ ?>
  42. <script>
  43. var hostname = location.hostname;
  44. if(location.port) hostname += ':' + location.port;
  45. requirejs.config({
  46. map: {
  47. '*': {
  48. 'css': '/static/plug/requirejs/require-css.js'
  49. }
  50. },
  51. shim:{
  52. 'iview':{
  53. deps:['css!iviewcss']
  54. },
  55. 'layer':{
  56. deps:['css!layercss']
  57. }
  58. },
  59. baseUrl:'//'+hostname+'/',
  60. paths: {
  61. 'static':'static',
  62. 'system':'system',
  63. 'vue':'static/plug/vue/dist/vue.min',
  64. 'axios':'static/plug/axios.min',
  65. 'iview':'static/plug/iview/dist/iview.min',
  66. 'iviewcss':'static/plug/iview/dist/styles/iview',
  67. 'lodash':'static/plug/lodash',
  68. 'layer':'static/plug/layer/layer',
  69. 'layercss':'static/plug/layer/theme/default/layer',
  70. 'jquery':'static/plug/jquery/jquery.min',
  71. 'moment':'static/plug/moment',
  72. 'sweetalert':'static/plug/sweetalert2/sweetalert2.all.min',
  73. 'formCreate':'/static/plug/form-create/form-create.min',
  74. },
  75. basket: {
  76. excludes:['system/js/index','system/util/mpVueComponent','system/util/mpVuePackage']
  77. // excludes:['system/util/mpFormBuilder','system/js/index','system/util/mpVueComponent','system/util/mpVuePackage']
  78. }
  79. });
  80. </script>
  81. <script type="text/javascript" src="/system/util/mpFrame.js"></script>
  82. </head>
  83. <body class="gray-bg">
  84. <div class="wrapper wrapper-content">
  85. <div class="row">
  86. <div class="col-sm-12 panel panel-default" >
  87. <div class="panel-body" style="padding: 30px">
  88. <form class="form-horizontal" id="signupForm">
  89. <div class="form-group">
  90. <div class="col-md-12">
  91. <div class="input-group">
  92. <span class="input-group-addon">标题</span>
  93. <input maxlength="64" placeholder="请在这里输入标题" name="title" class="layui-input" id="title" value="<?php echo htmlentities($news['title']); ?>">
  94. <input type="hidden" id="id" value="<?php echo htmlentities($news['id']); ?>">
  95. </div>
  96. </div>
  97. </div>
  98. <div class="form-group">
  99. <div class="col-md-12">
  100. <div class="input-group">
  101. <span class="input-group-addon">作者</span>
  102. <input maxlength="8" placeholder="请输入作者" name="author" class="layui-input" id="author" value="<?php echo htmlentities($news['author']); ?>">
  103. </div>
  104. </div>
  105. </div>
  106. <div class="form-group">
  107. <div class="col-md-12">
  108. <div class="input-group">
  109. <span class="input-group-addon">文章分类</span>
  110. <?php if(empty($all)){?>
  111. <select data-placeholder="请先添加文章分类" class="chosen-select" style="width:100%;" tabindex="4" name="type_id">
  112. <?php }else{ ?>
  113. <select data-placeholder="选择文章分类" class="chosen-select" style="width:100%;" tabindex="4" name="type_id" <?php if($select == '1'): ?>disabled="disabled"<?php endif; ?>>
  114. <?php }if(is_array($all) || $all instanceof \think\Collection || $all instanceof \think\Paginator): $k = 0; $__LIST__ = $all;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($k % 2 );++$k;if($key == $cid): ?>
  115. <option value="<?php echo htmlentities($key); ?>" selected hassubinfo="true" ><?php echo htmlentities($vo); ?></option>
  116. <?php elseif(in_array($key,$news['cid'])): ?>
  117. <option value="<?php echo htmlentities($key); ?>" selected hassubinfo="true" ><?php echo htmlentities($vo); ?></option>
  118. <?php else: ?>
  119. <option value="<?php echo htmlentities($key); ?>" hassubinfo="true" ><?php echo htmlentities($vo); ?></option>
  120. <?php endif; ?>
  121. <?php endforeach; endif; else: echo "" ;endif; ?>
  122. </select></div>
  123. </div>
  124. </div>
  125. <div class="form-group">
  126. <div class="col-md-12">
  127. <div class="form-control" style="height:auto">
  128. <label style="color:#ccc">图文封面大图片设置</label>
  129. <div class="row nowrap">
  130. <div class="col-xs-3" style="width:160px">
  131. <?php if($news['image_input']): ?>
  132. <div class="upload-image-box transition image_img" style="height: 80px;background-repeat:no-repeat;background-size:contain;background-image:url(<?php echo htmlentities($news['image_input']); ?>)">
  133. <input value="" type="hidden" name="local_url">
  134. </div>
  135. <?php else: ?>
  136. <div class="upload-image-box transition image_img" style="height: 80px;background-repeat:no-repeat;background-size:contain;background-image:url('/system/module/wechat/news/images/image.png')">
  137. <input value="" type="hidden" name="local_url">
  138. </div>
  139. <?php endif; ?>
  140. </div>
  141. <div class="col-xs-6">
  142. <input type="file" class="upload" name="image" style="display: none;" id="image" />
  143. <br>
  144. <a class="btn btn-sm add_image upload_span">上传图片</a>
  145. <br>
  146. <br>
  147. </div>
  148. </div>
  149. <input type="hidden" name="image" id="image_input" value="<?php echo htmlentities($news['image_input']); ?>"/>
  150. <p class="help-block" style="margin-top:10px;color:#ccc">封面大图片建议尺寸:900像素 * 500像素</p>
  151. </div>
  152. </div>
  153. </div>
  154. <div class="form-group">
  155. <div class="col-md-12">
  156. <label style="color:#aaa">文章简介</label>
  157. <textarea id="synopsis" name="synopsis" class="layui-input" style="height:80px;resize:none;line-height:20px;color:#333;"><?php echo htmlentities($news['synopsis']); ?></textarea>
  158. </div>
  159. </div>
  160. <div class="form-group">
  161. <div class="col-md-12">
  162. <label style="color:#aaa">文章内容</label>
  163. <textarea type="text/plain" id="myEditor" style="width:100%;"><?php echo htmlentities($news['content']); ?></textarea>
  164. </div>
  165. </div>
  166. <div class="form-group">
  167. <div class="col-md-12">
  168. <div class="col-md-6">
  169. <label style="color:#aaa">是否显示banner</label>
  170. <br/>
  171. <input type="radio" name="is_banner" class="layui-radio" value="0" <?php if($news['is_banner'] == '0'): ?>checked<?php endif; ?>>否
  172. <input type="radio" name="is_banner" class="layui-radio" value="1" <?php if($news['is_banner'] == '1'): ?>checked<?php endif; ?>>是
  173. </div>
  174. <div class="col-md-6">
  175. <label style="color:#aaa">是否显示热门</label>
  176. <br/>
  177. <input type="radio" name="is_hot" class="layui-radio" value="0" <?php if($news['is_hot'] == '0'): ?>checked<?php endif; ?>>否
  178. <input type="radio" name="is_hot" class="layui-radio" value="1" <?php if($news['is_hot'] == '1'): ?>checked<?php endif; ?>>是
  179. </div>
  180. </div>
  181. </div>
  182. <div class="form-group">
  183. <div class="col-md-12">
  184. <label style="display:block"><span style="color:#aaa;">原文链接<b>选填</b>,填写之后在图文左下方会出现此链接</span>
  185. <input maxlength="200" name="url" class="layui-input" id="url" value="<?php echo htmlentities($news['url']); ?>">
  186. </label>
  187. </div>
  188. </div>
  189. <div class="form-actions">
  190. <div class="row">
  191. <div class="col-md-offset-4 col-md-9">
  192. <button type="button" class="btn btn-w-m btn-info save_news">保存</button>
  193. </div>
  194. </div>
  195. </div>
  196. </form>
  197. </div>
  198. </div>
  199. </div>
  200. <script src="/system/js/layuiList.js"></script>
  201. <script>
  202. var editor = document.getElementById('myEditor');
  203. editor.style.height = '300px';
  204. window.UMEDITOR_CONFIG.toolbar = [
  205. // 加入一个 test
  206. 'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
  207. 'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
  208. '| justifyleft justifycenter justifyright justifyjustify |',
  209. 'link unlink | emotion selectimgs video | map',
  210. '| horizontal print preview fullscreen', 'drafts', 'formula'
  211. ];
  212. UM.registerUI('selectimgs',function(name){
  213. var me = this;
  214. var $btn = $.eduibutton({
  215. icon : 'image',
  216. click : function(){
  217. createFrame('选择图片','<?php echo Url('widget.images/index'); ?>?fodder=editor');
  218. },
  219. title: '选择图片'
  220. });
  221. this.addListener('selectionchange',function(){
  222. //切换为不可编辑时,把自己变灰
  223. var state = this.queryCommandState(name);
  224. $btn.edui().disabled(state == -1).active(state == 1)
  225. });
  226. return $btn;
  227. });
  228. //实例化编辑器
  229. var um = UM.getEditor('myEditor');
  230. /**
  231. * 获取编辑器内的内容
  232. * */
  233. function getContent() {
  234. return (UM.getEditor('myEditor').getContent());
  235. }
  236. function hasContent() {
  237. return (UM.getEditor('myEditor').hasContents());
  238. }
  239. function createFrame(title,src,opt){
  240. opt === undefined && (opt = {});
  241. return layer.open({
  242. type: 2,
  243. title:title,
  244. area: [(opt.w || 800)+'px', (opt.h || 550)+'px'],
  245. fixed: false, //不固定
  246. maxmin: true,
  247. moveOut:false,//true 可以拖出窗外 false 只能在窗内拖
  248. anim:5,//出场动画 isOutAnim bool 关闭动画
  249. offset:'auto',//['100px','100px'],//'auto',//初始位置 ['100px','100px'] t[ 上 左]
  250. shade:0,//遮罩
  251. resize:true,//是否允许拉伸
  252. content: src,//内容
  253. move:'.layui-layer-title'
  254. });
  255. }
  256. //选择图片
  257. function changeIMG(index,pic){
  258. $(".image_img").css('background-image',"url("+pic+")");
  259. $(".active").css('background-image',"url("+pic+")");
  260. $('#image_input').val(pic);
  261. }
  262. //选择图片插入到编辑器中
  263. function insertEditor(list){
  264. console.log(list);
  265. um.execCommand('insertimage', list);
  266. }
  267. /**
  268. * 上传图片
  269. * */
  270. $('.upload_span').on('click',function (e) {
  271. // $('.upload').trigger('click');
  272. createFrame('选择图片','<?php echo Url('widget.images/index'); ?>?fodder=image');
  273. })
  274. /**
  275. * 编辑器上传图片
  276. * */
  277. $('.edui-icon-image').on('click',function (e) {
  278. // $('.upload').trigger('click');
  279. createFrame('选择图片','<?php echo Url('widget.images/index'); ?>?fodder=image');
  280. })
  281. /**
  282. * 提交图文
  283. * */
  284. $('.save_news').on('click',function(){
  285. var list = {};
  286. list.title = $('#title').val();/* 标题 */
  287. list.author = $('#author').val();/* 作者 */
  288. list.image_input = $('#image_input').val();/* 图片 */
  289. list.content = getContent();/* 内容 */
  290. list.synopsis = $('#synopsis').val();/* 简介 */
  291. list.url = $('#url').val();/* 原文链接 */
  292. list.id = $('#id').val();/* 原文链接 */
  293. list.cid = $('.chosen-select').val();
  294. list.is_hot = $("input[name='is_hot']:checked").val();
  295. list.is_banner = $("input[name='is_banner']:checked").val();
  296. var Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
  297. var objExp=new RegExp(Expression);
  298. if(list.title == ''){
  299. $eb.message('error','请输入标题');
  300. return false;
  301. }
  302. if(list.author == ''){
  303. $eb.message('error','请输入作者');
  304. return false;
  305. }
  306. if(list.image_input == ''){
  307. $eb.message('error','请添加图片');
  308. return false;
  309. }
  310. if(list.content == ''){
  311. $eb.message('error','请输入内容');
  312. return false;
  313. }
  314. if(list.synopsis == ''){
  315. $eb.message('error','请输入简介');
  316. return false;
  317. }if(list.url != ''){
  318. if(objExp.test(list.url) != true){
  319. $eb.message('error','网址格式不正确!请重新输入');
  320. return false;
  321. }
  322. }
  323. var data = {};
  324. var index = layList.layer.load(1, {
  325. shade: [0.5,'#fff'] //0.1透明度的白色背景
  326. });;
  327. $.ajax({
  328. url:"<?php echo Url('add_new'); ?>",
  329. data:list,
  330. type:'post',
  331. dataType:'json',
  332. success:function(re){
  333. layer.close(index);
  334. if(re.code == 200){
  335. data[re.data] = list;
  336. $('.type-all>.active>.new-id').val(re.data);
  337. $eb.message('success',re.msg);
  338. location.reload();
  339. setTimeout(function (e) {
  340. parent.$(".J_iframe:visible")[0].contentWindow.location.reload();
  341. // parent.layer.close(parent.layer.getFrameIndex(window.name));
  342. },600)
  343. }else{
  344. $eb.message('error',re.msg);
  345. }
  346. },
  347. error:function () {
  348. layer.close(index);
  349. }
  350. })
  351. });
  352. $('.article-add ').on('click',function (e) {
  353. var num_div = $('.type-all').children('div').length;
  354. if(num_div > 7){
  355. $eb.message('error','一组图文消息最多可以添加8个');
  356. return false;
  357. }
  358. var url = "/system/module/wechat/news/images/image.png";
  359. html = '';
  360. html += '<div class="news-item transition active news-image" style=" margin-bottom: 20px;background-image:url('+url+')">'
  361. html += '<input type="hidden" name="new_id" value="" class="new-id">';
  362. html += '<span class="news-title del-news">x</span>';
  363. html += '</div>';
  364. $(this).siblings().removeClass("active");
  365. $(this).before(html);
  366. })
  367. $(document).on("click",".del-news",function(){
  368. $(this).parent().remove();
  369. })
  370. $(document).ready(function() {
  371. var config = {
  372. ".chosen-select": {},
  373. ".chosen-select-deselect": {allow_single_deselect: true},
  374. ".chosen-select-no-single": {disable_search_threshold: 10},
  375. ".chosen-select-no-results": {no_results_text: "沒有找到你要搜索的分类"},
  376. ".chosen-select-width": {width: "95%"}
  377. };
  378. for (var selector in config) {
  379. $(selector).chosen(config[selector])
  380. }
  381. })
  382. </script>
  383. </div>
  384. </body>
  385. </html>