• 富文本kindeditor


    <!-- 富文本编译器 -->
            <script type="text/javascript" src="static/editor/kindeditor-all-min.js"></script>
            <script type="text/javascript" src="static/editor/lang/zh-CN.js"></script>
    
    <script>
    editor.sync();
    </script>
    
    
    <textarea  name="articles_content" id="articles_content"  style="80%;height:500px;"></textarea>
    
    
    <script type="text/javascript">
          //富文本编译器
            KindEditor.ready(function(K) {
                    window.editor = K.create('#articles_content',{
                        items:[
                            'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                            'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                            'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                            'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                            'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
                            'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                            'anchor', 'link', 'unlink'
                           ],
                           uploadJson : '<%=basePath%>articles/saveArticlesPic',
                           allowFileManager : true
                    });
            })
            </script>
     @RequestMapping(value="/saveArticlesPic", method = RequestMethod.POST)
         @ResponseBody
          public Object saveArticlesPic(@RequestParam(required = false) MultipartFile imgFile,HttpSession session) throws Exception {
             String get32uuid = this.get32UUID();
                Map<String,Object> map = new HashMap<String,Object>();
             if (null != imgFile && !imgFile.isEmpty()) {
                    //上传到本地准备切图
                    String ffile = System.currentTimeMillis()+"";
                    String lFilePath = PathUtil.getClasspath() + Const.FILEPATHIMG +"goods/xc/articles/"+ ffile ; // 文件上传路径
                    Map<String, String> cutfileUp = FileUpload.cutfileUp(get32uuid, imgFile, lFilePath);
                    //上传到ftp服务器
                    String fileName = cutfileUp.get("fileName");
                    String filePath = "/static/public/goods/xc/articles"; // 文件上传路径
                    String ytPath = PathUtil.getClasspath() + Const.FILEPATHIMG +"goods/xc/articles";
                    Map<String, String> imgUrls = new FileUpload().goodsPICFileUp(cutfileUp,lFilePath ,filePath,ytPath); // 执行上传
                    ImageImage image = new ImageImage();
                    get32uuid = this.get32UUID();
                    image.setImage_id(get32uuid);
                    image.setImage_name(fileName);
                    image.setUrl(imgUrls.get("org"));
                    image.setL_url(imgUrls.get("b"));
                    image.setM_url(imgUrls.get("m"));
                    image.setS_url(imgUrls.get("s"));
                    image.setLast_modified(System.currentTimeMillis()/1000+"");
                    //ftpPath = imgUrls.get("org");
                    String bizuntcd = (String) session.getAttribute(Const.BIZUNTCD);
                    image.setBizuntcd(bizuntcd);
                    map.put("error", 0);
                    map.put("url", imgUrls.get("org"));
                } else {
                    System.out.println("上传失败");
                }
             return AppUtil.returnObject(new PageData(), map);
            }
  • 相关阅读:
    net.sf.ezmorph.bean.MorphDynaBean cannot be cast to java.util.Map
    oracle 导入excel
    【长文干货】浅析分布式系统
    35 个 Java 代码性能优化总结
    阿里巴巴Java开发手册-命名规约
    阿里巴巴Java开发手册-集合处理
    阿里巴巴Java开发手册-并发处理
    [NOI2016]国王饮水记
    python学习(二十一) Python 中的链式赋值
    python学习(二十) Python 中的比较:is 与 ==
  • 原文地址:https://www.cnblogs.com/yang1018/p/9698252.html
Copyright © 2020-2023  润新知