|
@@ -22,8 +22,8 @@
|
|
|
|
|
|
#dialog {
|
|
|
position: fixed;
|
|
|
- height: 400px;
|
|
|
- width: 800px;
|
|
|
+ height: 300px;
|
|
|
+ width: 600px;
|
|
|
background: #FFFFFF;
|
|
|
z-index: 5;
|
|
|
left: 30%;
|
|
@@ -32,15 +32,6 @@
|
|
|
display: none;
|
|
|
}
|
|
|
|
|
|
- #showImg {
|
|
|
- height: 160px;
|
|
|
- width: 160px;
|
|
|
- position: absolute;
|
|
|
- border: 0.5px solid gainsboro;
|
|
|
- bottom: 80px;
|
|
|
- left: 35%;
|
|
|
- }
|
|
|
-
|
|
|
#cancel {
|
|
|
border: 0px none #FFECEC;
|
|
|
background: #999999;
|
|
@@ -68,85 +59,12 @@
|
|
|
#insert:hover {
|
|
|
background: #CB474D;
|
|
|
}
|
|
|
-
|
|
|
- #online {
|
|
|
- width: 100%;
|
|
|
- height: 224px;
|
|
|
- padding: 10px 0 0 0;
|
|
|
- }
|
|
|
-
|
|
|
- #online #imageList {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- overflow-x: hidden;
|
|
|
- overflow-y: auto;
|
|
|
- position: relative;
|
|
|
- margin-left: 20px;
|
|
|
- }
|
|
|
-
|
|
|
- #online ul {
|
|
|
- display: block;
|
|
|
- list-style: none;
|
|
|
- margin: 0;
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
-
|
|
|
- #online li {
|
|
|
- float: left;
|
|
|
- display: block;
|
|
|
- list-style: none;
|
|
|
- padding: 0;
|
|
|
- width: 113px;
|
|
|
- height: 113px;
|
|
|
- margin: 0 0 9px 9px;
|
|
|
- background-color: #eee;
|
|
|
- overflow: hidden;
|
|
|
- cursor: pointer;
|
|
|
- position: relative;
|
|
|
- }
|
|
|
-
|
|
|
- #online li img {
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
-
|
|
|
- #online li .icon {
|
|
|
- cursor: pointer;
|
|
|
- width: 113px;
|
|
|
- height: 113px;
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- z-index: 2;
|
|
|
- border: 0;
|
|
|
- background-repeat: no-repeat;
|
|
|
- }
|
|
|
-
|
|
|
- #online li .icon:hover {
|
|
|
- width: 107px;
|
|
|
- height: 107px;
|
|
|
- border: 3px solid #1094fa;
|
|
|
- }
|
|
|
-
|
|
|
- #online li.selected .icon {
|
|
|
- background-image: url(/static/images/success.png);
|
|
|
- background-image: url(images/success.gif)\9;
|
|
|
- background-position: 75px 75px;
|
|
|
- }
|
|
|
-
|
|
|
- #online li.clearFloat {
|
|
|
- float: none;
|
|
|
- clear: both;
|
|
|
- display: block;
|
|
|
- width: 0;
|
|
|
- height: 0;
|
|
|
- margin: 0;
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
</style>
|
|
|
|
|
|
<article class="cl pd-20">
|
|
|
<form action="{:url('save')}" method="post" class="form form-horizontal" id="form-save">
|
|
|
<input type="hidden" name="id" value="{$data['id']}">
|
|
|
+ <input type="hidden" name="cjid" value="{$data['cjid']}">
|
|
|
<input type="hidden" name="content_type" value="{$data['content_type']}">
|
|
|
<div class="row cl">
|
|
|
<label class="form-label col-xs-4 col-sm-2">
|
|
@@ -288,97 +206,12 @@
|
|
|
<img src="/static/images/X.png" style="height: 25px;width: 25px;position: absolute;right: 10px;top: 10px;cursor: pointer;"
|
|
|
onclick="f_cancel()" />
|
|
|
</div>
|
|
|
-
|
|
|
- <div id="tab-img" class="HuiTab" style="margin-top: 40px;">
|
|
|
- <div class="tabBar clearfix">
|
|
|
- <span>本地上传</span>
|
|
|
- <span>网络文件上传</span>
|
|
|
- <a onclick="onlinepicture(1)"><span>服务器图片选择</span></a>
|
|
|
- </div>
|
|
|
- <div class="tabCon">
|
|
|
- <div class="step1 active" style="margin-left:30px;">
|
|
|
- <form id="form-uploadimg" method="post" action="" enctype="multipart/form-data">
|
|
|
- <div class="row cl" style="margin-top:20px;">
|
|
|
- <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片要求: </label>
|
|
|
- <div class="formControls col-xs-8 col-sm-8">
|
|
|
- 格式 jpg,png,gif,jpeg,webp; 大小不超过4M.
|
|
|
- </div>
|
|
|
- <div class="col-3"> </div>
|
|
|
- </div>
|
|
|
- <div class="row cl">
|
|
|
- <label class="form-label col-xs-2 col-sm-2">
|
|
|
- <span class="c-red">*</span>本地上传:</label>
|
|
|
- <div class="formControls col-xs-4 col-sm-4">
|
|
|
- <input type="file" class="input-text" name="upload_file" id="upload_file">
|
|
|
- </div>
|
|
|
- <div class="formControls col-xs-2 col-sm-2">
|
|
|
- <button class="btn btn-primary radius" type="button" onCLick="uploadImg()">上传</button>
|
|
|
- </div>
|
|
|
- <div style="width: 200px;height: 200px;">
|
|
|
- <img id="view-picture" src="/static/images/upload_picture.png" alt="图片"
|
|
|
- title="图片" style="max-width: 200px;max-height: 200px;">
|
|
|
- </div>
|
|
|
- <div class="col-3"> </div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <!-- 本地上传end -->
|
|
|
- </div>
|
|
|
- <div class="tabCon">
|
|
|
- <div class="step2" style="margin-left:30px;">
|
|
|
- <form id="form-uploadurlimg" method="post" action="" enctype="multipart/form-data">
|
|
|
- <div class="row cl" style="margin-top:20px;">
|
|
|
- <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片要求: </label>
|
|
|
- <div class="formControls col-xs-8 col-sm-8">
|
|
|
- 格式 jpg,png,gif,jpeg,webp; 大小不超过4M.
|
|
|
- </div>
|
|
|
- <div class="col-3"> </div>
|
|
|
- </div>
|
|
|
- <div class="row cl" style="margin-top:20px;">
|
|
|
- <label class="form-label col-xs-2 col-sm-2">
|
|
|
- <span class="c-red">*</span>图片地址:</label>
|
|
|
- <div class="formControls col-xs-8 col-sm-8">
|
|
|
- <input type="text" class="input-text" name="url_file" id="url_file">
|
|
|
- </div>
|
|
|
- <div class="formControls col-xs-2 col-sm-2">
|
|
|
- <button class="btn btn-primary radius" type="button" onCLick="uploadUrlImg()">确定</button>
|
|
|
- </div>
|
|
|
- <div style="width: 200px;height: 200px;">
|
|
|
- <img id="view-picture-url" src="/static/images/upload_picture.png" alt="图片"
|
|
|
- title="图片" style="max-width: 200px;max-height: 200px;">
|
|
|
- </div>
|
|
|
- <div class="col-3"> </div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <!-- 网络图片 -->
|
|
|
- </div>
|
|
|
- <!-- 在线图片 -->
|
|
|
- <div class="tabCon">
|
|
|
- <form id="form-uploadonlineimg" method="post" action="" enctype="multipart/form-data">
|
|
|
- <div class="row cl" style="margin-top:20px;" id="online">
|
|
|
- <div id="imageList">
|
|
|
- <ul class="list">
|
|
|
- <!-- <li>
|
|
|
- <img width="170" height="113" src="/storage/20220223/d5cc488e71c58bb072debe45ed06c6ad.jpg?noCache=1634567323"
|
|
|
- _src="/storage/20220223/d5cc488e71c58bb072debe45ed06c6ad.jpg">
|
|
|
- <span class="icon"></span>
|
|
|
- </li>
|
|
|
- -->
|
|
|
- <li class="clearFloat"></li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="row cl">
|
|
|
- <label class="form-label col-xs-2 col-sm-2">
|
|
|
- <span class="c-red">*</span>图片地址:</label>
|
|
|
- <div class="formControls col-xs-8 col-sm-8">
|
|
|
- <input type="text" class="input-text" name="online_file" id="online_file">
|
|
|
- </div>
|
|
|
- <div class="col-3"> </div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
+ <div class="row cl" style="margin-top:40px;">
|
|
|
+ <div style="width: 160px;height: 160px;margin: 0 auto;display: table-cell;vertical-align: middle;text-align: center;">
|
|
|
+ <img id="view-picture" src="/static/images/upload_picture.png" alt="图片"
|
|
|
+ title="图片" style="max-width: 120px;max-height: 120px;" onclick="addPicture()">
|
|
|
</div>
|
|
|
+ <input type="text" class="input-text" name="picture" id="picture" value="">
|
|
|
</div>
|
|
|
<div style="position: absolute;bottom: 1px;width: 100%;height: 40px;border-top: 1px solid gray;">
|
|
|
<button id="cancel" onclick="f_cancel()">取消</button>
|
|
@@ -395,40 +228,27 @@
|
|
|
<script type="text/javascript" src="/static/plugins/jquery.validation/1.14.0/validate-methods.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
- jQuery.Huitab = function (tabBar, tabCon, class_name, tabEvent, i) {
|
|
|
- var $tab_menu = $(tabBar);
|
|
|
- // 初始化操作
|
|
|
- $tab_menu.removeClass(class_name);
|
|
|
- $(tabBar).eq(i).addClass(class_name);
|
|
|
- $(tabCon).hide();
|
|
|
- $(tabCon).eq(i).show();
|
|
|
-
|
|
|
- $tab_menu.bind(tabEvent, function () {
|
|
|
- $tab_menu.removeClass(class_name);
|
|
|
- $(this).addClass(class_name);
|
|
|
- var index = $tab_menu.index(this);
|
|
|
- $(tabCon).hide();
|
|
|
- $(tabCon).eq(index).show()
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
var editor = ace.edit('mdeditor');//编辑框
|
|
|
|
|
|
editor.setTheme('ace/theme/chrome');
|
|
|
editor.getSession().setMode('ace/mode/markdown');
|
|
|
editor.renderer.setShowPrintMargin(false);
|
|
|
|
|
|
+ //左侧插入,用户插入一些特定方法
|
|
|
+ function insertText(val) {
|
|
|
+ editor.insert(val); //光标位置插入
|
|
|
+ }
|
|
|
+
|
|
|
//添加标题图
|
|
|
function addTitlePic() {
|
|
|
- layer.open({
|
|
|
- type: 2,
|
|
|
- area: ['700px', '500px'],
|
|
|
- fix: false, //不固定
|
|
|
- maxmin: true,
|
|
|
- shade: 0.4,
|
|
|
- title: '添加标题图',
|
|
|
- content: '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"titlepic"])}'
|
|
|
- });
|
|
|
+ let url = '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"titlepic","infoid"=>$data.id,"cjid"=>$data.cjid])}'
|
|
|
+ layer_show('添加标题图', url, 800, 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 上传图片
|
|
|
+ function addPicture() {
|
|
|
+ let url = '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"picture","infoid"=>$data.id,"cjid"=>$data.cjid])}'
|
|
|
+ layer_show('插入图片', url, 800, 500);
|
|
|
}
|
|
|
|
|
|
//插入图片弹窗取消
|
|
@@ -439,139 +259,20 @@
|
|
|
function showDialog() {
|
|
|
$('#dialog').show();
|
|
|
}
|
|
|
-
|
|
|
- //左侧插入,用户插入一些特定方法
|
|
|
- function insertText(val) {
|
|
|
- editor.insert(val); //光标位置插入
|
|
|
- }
|
|
|
-
|
|
|
- // 文档图片插入地址
|
|
|
- var imgUrl = "";
|
|
|
-
|
|
|
+
|
|
|
//插入图片
|
|
|
function insert() {
|
|
|
$('#dialog').hide();
|
|
|
- insertText('')
|
|
|
- }
|
|
|
|
|
|
- //上传图片到服务器,返回图片地址
|
|
|
- function uploadFile() {
|
|
|
- imgUrl = 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white.png';
|
|
|
- $('#showImg').attr('src', 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white.png');
|
|
|
- }
|
|
|
-
|
|
|
- //本地上传图片
|
|
|
- function uploadImg() {
|
|
|
- if ($("#upload_file").val() == '') {
|
|
|
- layer.msg("请选择要上传的文件", {
|
|
|
- icon: 6,
|
|
|
- time: 1000
|
|
|
- });
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- var formData = new FormData($("#form-uploadimg")[0]);
|
|
|
- $.ajax({
|
|
|
- url: '{:url("file_manager/uploadimg")}',
|
|
|
- type: 'POST',
|
|
|
- async: true,
|
|
|
- cache: false,
|
|
|
- data: formData,
|
|
|
- processData: false,
|
|
|
- contentType: false,
|
|
|
- dataType: "json",
|
|
|
- success: function (res) {
|
|
|
- if (res.code == 0) {
|
|
|
- console.log(res);
|
|
|
- imgUrl = res.picture_url + res.picname;
|
|
|
- $("#view-picture").attr('src', imgUrl);
|
|
|
- } else {
|
|
|
- layer.msg(res.msg, {
|
|
|
- icon: 5,
|
|
|
- time: 1000
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 网络图片
|
|
|
- function uploadUrlImg() {
|
|
|
- if ($("#url_file").val() == '') {
|
|
|
- layer.msg("请选择要上传的地址", {
|
|
|
- icon: 6,
|
|
|
- time: 1000
|
|
|
- });
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- var formData = new FormData($("#form-uploadurlimg")[0]);
|
|
|
- $.ajax({
|
|
|
- url: '{:url("file_manager/uploadurlimg")}',
|
|
|
- type: 'POST',
|
|
|
- async: true,
|
|
|
- cache: false,
|
|
|
- data: formData,
|
|
|
- processData: false,
|
|
|
- contentType: false,
|
|
|
- dataType: "json",
|
|
|
- success: function (res) {
|
|
|
- if (res.code == 0) {
|
|
|
- console.log(res);
|
|
|
- imgUrl = res.picture_url + res.picname;
|
|
|
- $("#view-picture-url").attr('src', imgUrl);
|
|
|
- } else {
|
|
|
- layer.msg(res.msg, {
|
|
|
- icon: 5,
|
|
|
- time: 1000
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ // 文档图片插入地址
|
|
|
+ var imgUrl = $("#picture").val();
|
|
|
+
|
|
|
+ insertText('')
|
|
|
|
|
|
- // 获取服务器图片
|
|
|
- function onlinepicture(page) {
|
|
|
- var data = { "page": page };
|
|
|
- $.ajax({
|
|
|
- url: '{:url("file_manager/onlineimg")}',
|
|
|
- type: 'GET',
|
|
|
- async: true,
|
|
|
- cache: false,
|
|
|
- data: 'page=' + page,
|
|
|
- processData: false,
|
|
|
- contentType: false,
|
|
|
- dataType: "json",
|
|
|
- success: function (res) {
|
|
|
- if (res.code == 0) {
|
|
|
- html_str = "";
|
|
|
- res.list.forEach(element => {
|
|
|
- html_str += '<li><img width="170" height="113" src="' + element.url + '?noCache=' + element.mtime + '"';
|
|
|
- html_str += '_src="' + element.url + '">';
|
|
|
- html_str += '<span class="icon"></span></li>';
|
|
|
- });
|
|
|
- $('ul.list').prepend(html_str);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ $("#picture").val('');
|
|
|
+ $("#view-picture").attr('src', '/static/images/upload_picture.png');
|
|
|
}
|
|
|
|
|
|
- $(function () {
|
|
|
- $.Huitab("#tab-img .tabBar span", "#tab-img .tabCon", "current", "click", "0");
|
|
|
- $(document).on("click", "#online li", function () {
|
|
|
- $("#online li").removeClass('selected');
|
|
|
-
|
|
|
- $(this).addClass('selected');
|
|
|
-
|
|
|
- imgUrl = $(this).children('img').attr('_src');
|
|
|
-
|
|
|
- $("#online_file").val(imgUrl);
|
|
|
- })
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
function validator(params) {
|
|
|
return $("#form-save").validate({
|
|
|
debug: true,
|