Commit a2374add authored by agping's avatar agping

1

parent 8258053c
...@@ -10,12 +10,37 @@ ...@@ -10,12 +10,37 @@
src="/resource/lib/ueditor/ueditor.config.js"></script> src="/resource/lib/ueditor/ueditor.config.js"></script>
<script language="javascript" type="text/javascript" <script language="javascript" type="text/javascript"
src="/resource/lib/ueditor/ueditor.all.min.js"></script> src="/resource/lib/ueditor/ueditor.all.min.js"></script>
<script type="text/plain" id="myEditor" style="width:760px;height:376px;"> <script type="text/javascript" charset="utf-8" src="/resource/lib/ueditor/lang/zh-cn/zh-cn.js"></script>
555555
</script> <div>
<script type="text/plain" id="myEditor" style="width:760px;height:376px;">
</script>
</div>
<script type = "text/javascript" > <script type = "text/javascript" >
var ue = UE.getEditor('myEditor'); var ue = UE.getEditor('myEditor');
//获取 父窗口的数据 编辑赋值
window.addEventListener('message', function (e) {
if(e.data*1 != 1 && e.data*1 != 2){
ue.setContent(e.data);
}
}, false);
//编辑 新增 提交内容
window.addEventListener('message', function (e) {
if(e.data*1 == 1){
window.parent.postMessage(ue.getContent(),'*');
}
}, false);
//新增 置空内容
window.addEventListener('message', function (e) {
if(e.data*1 == 2){
console.log(555)
ue.ready(function() {
ue.setContent('');
});
}
}, false);
</script> </script>
</body> </body>
......
...@@ -456,7 +456,7 @@ ...@@ -456,7 +456,7 @@
<div> <div>
<iframe id='ifram-kaipan' style="width: 782px;height: 402px;border: 0;"></iframe> <iframe id='ifram-kaipan' style="width: 782px;height: 402px;border: 0;"></iframe>
<!--加载编辑器的容器--> <!--加载编辑器的容器-->
<!-- <script type="text/plain" id="myEditor" style="width:716px;height:300px;"> <!--<script type="text/plain" id="myEditor" style="width:716px;height:300px;">
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -19,6 +19,8 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -19,6 +19,8 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
announcementdel_id:'',//文章id announcementdel_id:'',//文章id
is_add:1,//是否新增 is_add:1,//是否新增
switchUrl:'', switchUrl:'',
liu_iframe:'',
init: function () { init: function () {
//初始化dot //初始化dot
$ ("body").append (template); $ ("body").append (template);
...@@ -30,6 +32,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -30,6 +32,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
var _doc = $(document); var _doc = $(document);
var _imgMaskObj = $('#img_mask_area'); //预览大图的mask var _imgMaskObj = $('#img_mask_area'); //预览大图的mask
var _imgUploadLunbo = $('#xiangqing_pic_ul'); //详情页轮播图ul var _imgUploadLunbo = $('#xiangqing_pic_ul'); //详情页轮播图ul
//获取学院标签 //获取学院标签
user.getDistrict(function(){ user.getDistrict(function(){
_doc.on('input', '#district_id', function(){ _doc.on('input', '#district_id', function(){
...@@ -54,12 +57,11 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -54,12 +57,11 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
$('#add_city_id').val(''); $('#add_city_id').val('');
$('#add_city_id').val(''); $('#add_city_id').val('');
$('#fujian_ul_add').html(''); $('#fujian_ul_add').html('');
var ue = UE.getEditor('myEditor');
ue.ready(function() {//编辑器初始化完成再赋值
ue.setContent(''); //赋值给UEditor
});
user.is_add = 1; user.is_add = 1;
$('.is-add').html('发布开盘') $('.is-add').html('发布开盘')
var iFrame2 = document.getElementById('ifram-kaipan');
iFrame2.contentWindow.postMessage('2','*');
$('#ifram-kaipan').attr('src',ServerHostImageLiu + '/index/test');
user.getDistrict(); user.getDistrict();
user.switchUrl = '/index/addSquare'; user.switchUrl = '/index/addSquare';
}); });
...@@ -89,7 +91,15 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -89,7 +91,15 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
}); });
$ (document).delegate ("#add_news", "click", function () {//新增文章 $ (document).delegate ("#add_news", "click", function () {//新增文章
user.user_id = $ (this).attr ("data-id"); user.user_id = $ (this).attr ("data-id");
user.add_news(); // user.add_news();
var iFrame1 = document.getElementById('ifram-kaipan');
iFrame1.contentWindow.postMessage('1','*');
// window.addEventListener('message',function(e){
// user.add_news(e.data)
// },false);
window.onmessage = function(e){
user.add_news(e.data)
};
}); });
_doc.on('click', '.jian_class>ul>li', function(){ _doc.on('click', '.jian_class>ul>li', function(){
var _this = $(this); var _this = $(this);
...@@ -180,12 +190,8 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -180,12 +190,8 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
_doc.on('click','.edit_modal_btn' ,function(e){//点击编辑 _doc.on('click','.edit_modal_btn' ,function(e){//点击编辑
user.announcementdel_id = $ (this).attr ("data-id"); user.announcementdel_id = $ (this).attr ("data-id");
user.is_add = 0; user.is_add = 0;
// $('.ifram-kaipan').attr('src', '/index/test?shop_id='+business.id); $('#ifram-kaipan').attr('src',ServerHostImageLiu + '/index/test');
$('#ifram-kaipan').attr('src', '/index/test');
// $('#ifram-kaipan').attr('src',ServerHostImageLiu + '/index/test');
user.text_details(); user.text_details();
// var html_ = $("#ifram-kaipan").contents().find("#liu").html();
}); });
...@@ -216,6 +222,13 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -216,6 +222,13 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
// ue.ready(function() {//编辑器初始化完成再赋值 // ue.ready(function() {//编辑器初始化完成再赋值
// ue.setContent(data.data.content); //赋值给UEditor // ue.setContent(data.data.content); //赋值给UEditor
// }); // });
var iFrame = document.getElementById('ifram-kaipan')
//iframe加载完毕后再发送消息,否则子页面接收不到message
iFrame.onload = function(){
//iframe加载完立即发送一条消息
iFrame.contentWindow.postMessage(data.data.content,'*');
console.log(data.data.content);
}
var _data = data['data']; var _data = data['data'];
if(_data['cover_img']) { if(_data['cover_img']) {
...@@ -315,7 +328,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -315,7 +328,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
} }
}); });
}, },
add_news: function() { //新增开盘 编辑开盘 add_news: function(con) { //新增开盘 编辑开盘
if ($('.titleImg')) { if ($('.titleImg')) {
var pic = $('.titleImg').attr("data-name"); var pic = $('.titleImg').attr("data-name");
} }
...@@ -327,7 +340,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde ...@@ -327,7 +340,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
_data.site_id = $("#add_city_id").val(); //商学院标签id _data.site_id = $("#add_city_id").val(); //商学院标签id
_data.district_id = $("#add_district_id").val(); //商学院标签id _data.district_id = $("#add_district_id").val(); //商学院标签id
_data.cover_img = pic; //封面图 剪切后的字符串 _data.cover_img = pic; //封面图 剪切后的字符串
_data.content = UE.getEditor('myEditor').getContent(); _data.content = con;
$.ajax({ $.ajax({
url: user.switchUrl, url: user.switchUrl,
type: 'POST', type: 'POST',
......
...@@ -123,6 +123,8 @@ class Uploader ...@@ -123,6 +123,8 @@ class Uploader
} else { //移动成功 } else { //移动成功
$this->stateInfo = $this->stateMap[0]; $this->stateInfo = $this->stateMap[0];
} }
} }
/** /**
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"imageCompressEnable": true, /* 是否压缩图片,默认是true */ "imageCompressEnable": true, /* 是否压缩图片,默认是true */
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */ "imageCompressBorder": 1600, /* 图片压缩最长边限制 */
"imageInsertAlign": "none", /* 插入的图片浮动方式 */ "imageInsertAlign": "none", /* 插入的图片浮动方式 */
"imageUrlPrefix": "https://pre2.tonglianjituan.com", /* 图片访问路径前缀 */ "imageUrlPrefix": "", /* 图片访问路径前缀 */
"imagePathFormat": "/resource/lib/Attachments/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ "imagePathFormat": "/resource/lib/Attachments/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */ /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */ /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment