Commit a2374add authored by agping's avatar agping

1

parent 8258053c
......@@ -10,12 +10,37 @@
src="/resource/lib/ueditor/ueditor.config.js"></script>
<script language="javascript" type="text/javascript"
src="/resource/lib/ueditor/ueditor.all.min.js"></script>
<script type="text/plain" id="myEditor" style="width:760px;height:376px;">
555555
</script>
<script type="text/javascript" charset="utf-8" src="/resource/lib/ueditor/lang/zh-cn/zh-cn.js"></script>
<div>
<script type="text/plain" id="myEditor" style="width:760px;height:376px;">
</script>
</div>
<script type = "text/javascript" >
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>
</body>
......
......@@ -456,7 +456,7 @@
<div>
<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 type="text/javascript">
......
......@@ -19,6 +19,8 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
announcementdel_id:'',//文章id
is_add:1,//是否新增
switchUrl:'',
liu_iframe:'',
init: function () {
//初始化dot
$ ("body").append (template);
......@@ -30,6 +32,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
var _doc = $(document);
var _imgMaskObj = $('#img_mask_area'); //预览大图的mask
var _imgUploadLunbo = $('#xiangqing_pic_ul'); //详情页轮播图ul
//获取学院标签
user.getDistrict(function(){
_doc.on('input', '#district_id', function(){
......@@ -54,12 +57,11 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
$('#add_city_id').val('');
$('#add_city_id').val('');
$('#fujian_ul_add').html('');
var ue = UE.getEditor('myEditor');
ue.ready(function() {//编辑器初始化完成再赋值
ue.setContent(''); //赋值给UEditor
});
user.is_add = 1;
$('.is-add').html('发布开盘')
var iFrame2 = document.getElementById('ifram-kaipan');
iFrame2.contentWindow.postMessage('2','*');
$('#ifram-kaipan').attr('src',ServerHostImageLiu + '/index/test');
user.getDistrict();
user.switchUrl = '/index/addSquare';
});
......@@ -89,7 +91,15 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
});
$ (document).delegate ("#add_news", "click", function () {//新增文章
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(){
var _this = $(this);
......@@ -180,12 +190,8 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
_doc.on('click','.edit_modal_btn' ,function(e){//点击编辑
user.announcementdel_id = $ (this).attr ("data-id");
user.is_add = 0;
// $('.ifram-kaipan').attr('src', '/index/test?shop_id='+business.id);
$('#ifram-kaipan').attr('src', '/index/test');
// $('#ifram-kaipan').attr('src',ServerHostImageLiu + '/index/test');
$('#ifram-kaipan').attr('src',ServerHostImageLiu + '/index/test');
user.text_details();
// var html_ = $("#ifram-kaipan").contents().find("#liu").html();
});
......@@ -216,7 +222,14 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
// ue.ready(function() {//编辑器初始化完成再赋值
// 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'];
if(_data['cover_img']) {
$('#fujian_ul_add').html('<li><img title="点击查看大图" src="{0}" data-name="{1}" class="titleImg"/></li>'.stringFormatObj({
......@@ -315,7 +328,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
}
});
},
add_news: function() { //新增开盘 编辑开盘
add_news: function(con) { //新增开盘 编辑开盘
if ($('.titleImg')) {
var pic = $('.titleImg').attr("data-name");
}
......@@ -327,7 +340,7 @@ define (['doT', 'text!temp/opensquareList_template_tpl.html','ckfinder','ckfinde
_data.site_id = $("#add_city_id").val(); //商学院标签id
_data.district_id = $("#add_district_id").val(); //商学院标签id
_data.cover_img = pic; //封面图 剪切后的字符串
_data.content = UE.getEditor('myEditor').getContent();
_data.content = con;
$.ajax({
url: user.switchUrl,
type: 'POST',
......
......@@ -123,6 +123,8 @@ class Uploader
} else { //移动成功
$this->stateInfo = $this->stateMap[0];
}
}
/**
......
......@@ -8,7 +8,7 @@
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
"imageInsertAlign": "none", /* 插入的图片浮动方式 */
"imageUrlPrefix": "https://pre2.tonglianjituan.com", /* 图片访问路径前缀 */
"imageUrlPrefix": "", /* 图片访问路径前缀 */
"imagePathFormat": "/resource/lib/Attachments/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
/* {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