yirenyishi
6 years ago
25 changed files with 331 additions and 52 deletions
@ -0,0 +1,12 @@ |
|||
package controllers |
|||
|
|||
import "github.com/astaxie/beego" |
|||
|
|||
type PageController struct { |
|||
beego.Controller |
|||
} |
|||
|
|||
// @router /iframe/blog [get]
|
|||
func (this *PageController) Blog() { |
|||
this.TplName = "iframe/blog.html" |
|||
} |
Binary file not shown.
@ -0,0 +1,9 @@ |
|||
package models |
|||
|
|||
import "time" |
|||
|
|||
type Category struct { |
|||
Id int64 |
|||
Title string |
|||
Ctime time.Time `orm:"auto_now_add;type(datetime)"` |
|||
} |
@ -0,0 +1,10 @@ |
|||
package models |
|||
|
|||
import "time" |
|||
|
|||
type NLabel struct { |
|||
Id int64 |
|||
Title string |
|||
UserId int64 |
|||
Ctime time.Time `orm:"auto_now_add;type(datetime)"` |
|||
} |
@ -0,0 +1,20 @@ |
|||
.blog-title{ |
|||
display: flex; |
|||
height: 50px; |
|||
line-height: 50px; |
|||
} |
|||
.blog-title input{ |
|||
flex: 1; |
|||
height: 44px; |
|||
border: 0; |
|||
} |
|||
|
|||
.blog-title button{ |
|||
height: 32px; |
|||
margin-top: 9px; |
|||
} |
|||
|
|||
.w-e-toolbar{ |
|||
height: 40px; |
|||
line-height: 30px; |
|||
} |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
@ -1,22 +1,43 @@ |
|||
{{define "nav"}} |
|||
<div class='nav-container'> |
|||
<div class="sui-navbar"> |
|||
<div class="navbar-inner"> |
|||
<a href="/" class="sui-brand">个人随笔</a> |
|||
<ul class="sui-nav"> |
|||
<li {{if .IsHome}}class="active"{{end}}><a href="/">首页</a></li> |
|||
<li {{if .IsNote}}class="active"{{end}}><a href="/note">笔记</a></li> |
|||
<li {{if .IsMap}}class="active"{{end}}><a href="/map">地图</a></li> |
|||
</ul> |
|||
<form class="sui-form sui-form pull-left"> |
|||
<input type="text" placeholder="宝贝/店铺名称..."> |
|||
<button class="sui-btn">搜索</button> |
|||
</form> |
|||
<ul class="sui-nav pull-right"> |
|||
<li><a href="#">个人中心</a></li> |
|||
<li><a href="#">帮助</a></li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
<nav class="navbar navbar-default"> |
|||
<div class="container-fluid"> |
|||
<div class="navbar-header"> |
|||
<a class="navbar-brand" href="/">个人随笔</a> |
|||
</div> |
|||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
|||
<ul class="nav navbar-nav"> |
|||
<li class="active"> |
|||
<a href="/" target="_blank">首页 </a> |
|||
</li> |
|||
<li> |
|||
<a href="/note" target="_blank">笔记</a> |
|||
</li> |
|||
<li> |
|||
<a href="/map" target="_blank">地图</a> |
|||
</li> |
|||
</ul> |
|||
<form class="navbar-form navbar-left" role="search"> |
|||
<div class="form-group"> |
|||
<input type="text" class="form-control" placeholder="Search"> |
|||
</div> |
|||
<button type="submit" class="btn btn-default">Submit</button> |
|||
</form> |
|||
<ul class="nav navbar-nav navbar-right"> |
|||
<li><a href="#">个人中心</a></li> |
|||
<li class="dropdown"> |
|||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a> |
|||
<ul class="dropdown-menu" role="menu"> |
|||
<li><a href="#">Action</a></li> |
|||
<li><a href="#">Another action</a></li> |
|||
<li><a href="#">Something else here</a></li> |
|||
<li class="divider"></li> |
|||
<li><a href="#">Separated link</a></li> |
|||
</ul> |
|||
</li> |
|||
</ul> |
|||
</div><!-- /.navbar-collapse --> |
|||
</div><!-- /.container-fluid --> |
|||
</nav> |
|||
</div> |
|||
{{end}} |
@ -0,0 +1,106 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<meta name="description" content="个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com"> |
|||
<meta name="keywords" |
|||
content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose"> |
|||
<link rel="stylesheet" href="//g.alicdn.com/sui/sui3/0.0.18/css/sui.min.css"> |
|||
<script type="text/javascript" src="//g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script> |
|||
<script type="text/javascript" src="//g.alicdn.com/sui/sui3/0.0.18/js/sui.min.js"></script> |
|||
<script type="text/javascript" src="/static/js/layer.js"></script> |
|||
<title>首页 - 个人随笔</title> |
|||
<style> |
|||
.common { |
|||
margin: 10px 0; |
|||
} |
|||
|
|||
.tag { |
|||
margin: 3px 0; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div style="margin: 5px 10px"> |
|||
<div class="common"> |
|||
<span>开发语言:</span> |
|||
<span> |
|||
<select class="form-control " style="width: 150px;display: inline-block;height: 32px" id="catory"> |
|||
<option>1</option> |
|||
<option>2</option> |
|||
<option>3</option> |
|||
<option>4</option> |
|||
<option>5</option> |
|||
</select> |
|||
</span> |
|||
</div> |
|||
<div class="common"> |
|||
<span style="flex: 1;height: 30px;line-height: 30px;">文章标签:</span> |
|||
<div class="tag-group tag-removable" data-toggle='tag' id="labels"> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="common"> |
|||
<span>添加标签:</span> |
|||
<input type="text" placeholder="输入标签" class="input-xfat" style="height: 26px;" id="lable"> |
|||
<button type="button" class="btn btn-primary" style="height: 26px;margin-top: -5px;" id="addBtn">添加</button> |
|||
</div> |
|||
<div class="common" style="text-align: center"> |
|||
<button type="button" class="btn btn-primary" id="saveBtn">首要</button> |
|||
<button type="button" class="btn btn-warning" id="cacelBtn">取消</button> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script> |
|||
$(function () { |
|||
if (parent.tobj.catory) { |
|||
$("#catory").val(parent.tobj.catory) |
|||
} |
|||
if (parent.tobj.labels) { |
|||
for (var i = 0; i < parent.tobj.labels.length; i++) { |
|||
var child = "<label class='tag tag-primary'>" + parent.tobj.labels[i] + "<a name='remove'><i class=\"iconfont icon-close\"></i></a> " |
|||
+ "<input type='checkbox' class='simple-tag' name='simple-tag-1' value='" + parent.tobj.labels[i] + "' checked='checked'/></label>" |
|||
$("#labels").append(child) |
|||
} |
|||
} |
|||
|
|||
$("#addBtn").click(function () { |
|||
var temp = $("#lable").val() |
|||
if (temp.trim().length != 0) { |
|||
if ($("#labels").children().length > 5) { |
|||
layer.msg('5个标签还不够', function () { |
|||
}); |
|||
return |
|||
} |
|||
var child = "<label class='tag tag-primary'>" + temp + "<a name='remove'><i class=\"iconfont icon-close\"></i></a> " |
|||
+ "<input type='checkbox' class='simple-tag' name='simple-tag-1' value='" + temp + "' checked='checked'/></label>" |
|||
$("#labels").append(child) |
|||
$("#lable").val("") |
|||
} |
|||
}) |
|||
|
|||
$("#saveBtn").click(function () { |
|||
parent.tobj.catory = $("#catory").val() |
|||
var tarr = [] |
|||
$.each($(".simple-tag"), function () { |
|||
tarr.push($(this).val()) |
|||
}); |
|||
parent.tobj.labels = tarr |
|||
console.log(tarr) |
|||
parent.saveBlog(function (flag) { |
|||
debugger |
|||
if (flag) { |
|||
var index = parent.layer.getFrameIndex(window.name); |
|||
parent.layer.close(index); |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
$("#cacelBtn").click(function () { |
|||
var index = parent.layer.getFrameIndex(window.name); |
|||
parent.layer.close(index); |
|||
}) |
|||
}) |
|||
</script> |
|||
</html> |
@ -0,0 +1,77 @@ |
|||
{{template "header"}} |
|||
<title>博客 - 个人随笔</title> |
|||
<link type="text/css" rel="styleSheet" href="/static/css/newblog.css"/> |
|||
<script src="//unpkg.com/wangeditor/release/wangEditor.min.js"></script> |
|||
{{/*<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>*/}} |
|||
</head> |
|||
<body> |
|||
<div class="root-container"> |
|||
<div class="blog-title"> |
|||
<input type="text" id="blog-title"> |
|||
<button type="button" id="newBtn" class="btn btn-danger" style="border-radius: 12px">发布文章</button> |
|||
</div> |
|||
<div id="editor" class="editor"> |
|||
|
|||
</div> |
|||
<div id="myModal" tabindex="-1" role="dialog" data-hasfoot="false" class="sui-modal hide fade"> |
|||
<div class="modal-dialog"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<button type="button" data-dismiss="modal" aria-hidden="true" class="sui-close">×</button> |
|||
<h4 id="myModalLabel" class="modal-title">Modal title</h4> |
|||
</div> |
|||
<div class="modal-body">我是内容body</div> |
|||
<div class="modal-footer"> |
|||
<button type="button" data-ok="modal" class="sui-btn btn-primary btn-large">可自定ok</button> |
|||
<button type="button" data-dismiss="modal" class="sui-btn btn-default btn-large">可自定dismiss</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script> |
|||
var E = window.wangEditor |
|||
var editor = new E('#editor') |
|||
editor.customConfig.uploadImgServer = '/upload' |
|||
// 或者 var editor = new E( document.getElementById('editor') ) |
|||
editor.create() |
|||
var tobj = {} |
|||
$(function () { |
|||
var height = document.documentElement.clientHeight |
|||
$(".w-e-text-container").height(height - 50 - 40 - 1); |
|||
$("#newBtn").click(function () { |
|||
var title = $("#blog-title").val(); |
|||
if (title.trim().length < 3) { |
|||
layer.msg('文章标题最少三个字', function () { |
|||
}); |
|||
return |
|||
} |
|||
tobj.title = $("#blog-title").val(); |
|||
if (editor.txt.text().trim().length == 0) { |
|||
layer.msg('文章内容不能为空哦', function () { |
|||
}); |
|||
return |
|||
} |
|||
tobj.blogHtml = editor.txt.html(); |
|||
layer.open({ |
|||
type: 2, |
|||
title: '发布文章', |
|||
shadeClose: true, |
|||
shade: 0.8, |
|||
area: ['420px', '280px'], |
|||
content: '/iframe/blog.html/' //iframe的url |
|||
}); |
|||
}) |
|||
}) |
|||
|
|||
function saveBlog(callback) { |
|||
$.post('/blog/new',tobj, |
|||
function (data) { |
|||
console.log(data) |
|||
debugger |
|||
callback(true) |
|||
},'json') |
|||
} |
|||
</script> |
|||
</html> |
Loading…
Reference in new issue