Browse Source

Merge remote-tracking branch 'origin/master'

layui
yirenyishi 6 years ago
parent
commit
0832d7bdd5
  1. 25
      README.md
  2. 8
      controllers/BlogController.go
  3. 4
      controllers/PageController.go
  4. 1
      controllers/UserController.go
  5. 8
      filter/Security.go
  6. 2
      models/DataInit.go
  7. 4
      service/BlogService.go
  8. 2
      service/CommentService.go
  9. 6
      static/css/me.css
  10. BIN
      static/img/2.png
  11. BIN
      static/img/redalipay.png
  12. BIN
      static/img/snow.png
  13. 2
      views/T.footer.tpl
  14. 7
      views/T.header.tpl
  15. 10
      views/T.nav.tpl
  16. 5
      views/blog.html
  17. 6
      views/blogs.html
  18. 4
      views/editblog.html
  19. 6
      views/iframe/blog.html
  20. 6
      views/iframe/note.html
  21. 6
      views/iframe/user.html
  22. 13
      views/index.html
  23. 6
      views/login.html
  24. 6
      views/map.html
  25. 6
      views/newblog.html
  26. 6
      views/note.html
  27. 6
      views/regist.html
  28. 339
      views/snow.html
  29. 6
      views/ublogs.html
  30. 4
      views/uinfo.html
  31. 6
      views/ulike.html
  32. 4
      views/unote.html
  33. 13
      views/us.html
  34. 7
      views/user.html

25
README.md

@ -1,4 +1,23 @@
>bash
[点击预览效果](https://www.aiprose.com/) https://www.aiprose.com
· 项目源码: 点击查看
· 项目框架:
golang 1.11
beego:1.7.2 [beego官网](beego官网)
阿里UI: [sui3官网](http://sui3.taobao.org/)
富文本编辑器: [wangeditor官网](http://www.wangeditor.com/)
数据库: mysql(5.5.60-MariaDB)
·项目搭建步骤:
* 安装配置golang 最新版本 (开发最好安装一下bee)
* go get github.com/astaxie/beego
@ -6,4 +25,6 @@
* go get github.com/go-sql-driver/mysql
* go get github.com/olivere/elastic
* go get github.com/olivere/elastic
* windows环境需要安装gcc [gcc下载地址](http://tdm-gcc.tdragon.net/download)

8
controllers/BlogController.go

@ -114,11 +114,13 @@ func (this *BlogController) Get() {
this.Data["UserId"] = this.GetSession("userid")
this.Data["HeadImg"] = this.GetSession("headimg")
this.Data["NickName"] = this.GetSession("nickname")
this.Data["UserId"] = this.GetSession("userid")
this.Data["IsLogin"] = this.GetSession("nickname") != nil
this.Data["IsDDesc"] = true
this.TplName = "blog.html"
service.CountBrows(blog.UserId)
service.EditBlogBrows(id)
if this.Ctx.Input.GetData("refresh") != true {
service.CountBrows(blog.UserId)
service.EditBlogBrows(id)
}
return
}

4
controllers/PageController.go

@ -56,6 +56,10 @@ func (this *PageController) IframeNote() {
// @router /us
func (this *PageController) UsPage() {
this.Data["IsUs"] = true
this.Data["UserId"] = this.GetSession("userid")
this.Data["HeadImg"] = this.GetSession("headimg")
this.Data["NickName"] = this.GetSession("nickname")
this.Data["IsLogin"] = this.GetSession("nickname") != nil
this.TplName = "us.html"
}

1
controllers/UserController.go

@ -44,6 +44,7 @@ func (this *UserController) UserInfo() {
this.Data["HeadImg"] = this.GetSession("headimg")
this.Data["NickName"] = this.GetSession("nickname")
this.Data["IsLogin"] = this.GetSession("nickname") != nil
this.Data["IsDDesc"] = true
this.TplName = "user.html"
return
}

8
filter/Security.go

@ -6,8 +6,14 @@ import (
)
var FilterAdmin = func(ctx *context.Context) {
url := ctx.Input.URL()
url := ctx.Input.URI()
refer := ctx.Input.Refer()
logs.Info(url)
//logs.Info(refer)
//logs.Info("https://www.aiprose.com"+url)
if "https://www.aiprose.com"+url == refer {
ctx.Input.SetData("refresh", true)
}
//beego.Informational(url)
//if url != "/login"{
// ctx.Redirect(302, "/login")

2
models/DataInit.go

@ -23,6 +23,6 @@ func RegistDB() {
//orm.RegisterDriver(_SQLITE3_DRIVER,orm.DRSqlite)
//orm.RegisterDataBase("default",_SQLITE3_DRIVER,_DB_NAME,10)
orm.RegisterModel(new(Attachment),new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment))
orm.RegisterModel(new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment))
orm.RegisterDataBase("default", "mysql", "root:booszy@tcp(127.0.0.1:3306)/beeblog?charset=utf8&loc=Local", 30)
}

4
service/BlogService.go

@ -156,7 +156,7 @@ func SaveBlog(blog *models.Blog, strs []string) error {
func EditBlog(blog *models.Blog, strs []string) error {
o := orm.NewOrm()
o.Begin()
id, eror := o.Update(blog)
_, eror := o.Update(blog)
if eror != nil {
o.Rollback()
return eror
@ -165,7 +165,7 @@ func EditBlog(blog *models.Blog, strs []string) error {
if strs != nil && len(strs) > 0 {
nlabels := make([]*models.NLabel, len(strs))
for i := 0; i < len(strs); i++ {
nlabels[i] = &models.NLabel{Title: strs[i], BlogId: id, UserId: blog.UserId}
nlabels[i] = &models.NLabel{Title: strs[i], BlogId: blog.Id, UserId: blog.UserId}
}
if _, err := o.InsertMulti(len(nlabels), nlabels); err != nil {
o.Rollback()

2
service/CommentService.go

@ -9,7 +9,7 @@ import (
func FindCommentByBlog(bid int64) ([]*models.Comment, error) {
var comms []*models.Comment
o := orm.NewOrm()
_, err := o.QueryTable(&models.Comment{}).Filter("Pid", 0).OrderBy("-Ctime").All(&comms)
_, err := o.QueryTable(&models.Comment{}).Filter("Pid", 0).Filter("BlogId",bid).OrderBy("-Ctime").All(&comms)
if err != nil {
return nil, err
}

6
static/css/me.css

@ -65,6 +65,12 @@
height: 110px;
padding: 0 4%;
}
.me-blog-footer{
height: 110px;
padding: 0 4%;
margin-left: 290px;
}
.info-header{
flex: 1;
}

BIN
static/img/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

BIN
static/img/redalipay.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
static/img/snow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

2
views/T.footer.tpl

@ -8,7 +8,7 @@
</div>
<div class="footer-friend">
<span>© 2018
<a href="https://www.aiprose.com/">个人随笔</a> </span>
<a href="https://www.aiprose.com/">云悦</a> </span>
<a href="https://www.aiprose.com/">aiprose.com</a>
<span>版权所有&nbsp;&nbsp;&nbsp; ICP证:</span>
<a href="http://www.miitbeian.gov.cn/" target="_blank">陕ICP备18016846号</a>

7
views/T.header.tpl

@ -4,10 +4,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
{{if .IsDDesc }}
{{else}}
<meta name="description" content="云悦,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
{{end}}
<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="//g.alicdn.com/sui/sui3/0.0.18/js/sui.min.js"></script>*/}}
<script type="text/javascript" src="/static/js/sui.js"></script>
<script type="text/javascript" src="/static/js/layer.js"></script>
<link type="text/css" rel="styleSheet" href="/static/css/common.css"/>

10
views/T.nav.tpl

@ -3,7 +3,7 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">个人随笔</a>
<a class="navbar-brand" href="/"> 云悦 </a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
@ -11,16 +11,16 @@
<a href="/">首页 </a>
</li>
<li {{if .IsBlog}} class="active" {{end}}>
<a href="/blogs" target="_blank">博客 </a>
<a href="/blogs">博客 </a>
</li>
<li>
<a href="/note" target="_blank">笔记</a>
</li>
<li {{if .IsMap}} class="active" {{end}}>
<a href="/map" target="_blank">地图</a>
<a href="/map">地图</a>
</li>
<li {{if .IsUs}} class="active" {{end}}>
<a href="/us" target="_blank">关于我们</a>
<a href="/us">福利</a>
</li>
</ul>
{{/*<form class="navbar-form navbar-left" role="search">*/}}
@ -44,7 +44,7 @@
<ul class="dropdown-menu" role="menu">
<li><a href="/me/blog">个人中心</a></li>
<li><a href="/note" target="_blank">我的笔记</a></li>
<li><a href="/u/{{.UserId}}" target="_blank">我的首页</a></li>
<li><a href="/u/{{.UserId}}">我的首页</a></li>
<li class="divider"></li>
<li><a href="/logout">安全退出</a></li>
</ul>

5
views/blog.html

@ -1,6 +1,7 @@
{{template "header"}}
{{template "header" .}}
<meta name="keywords" content="{{.Blog.Title}}">
<title>{{.Blog.Title}} - 个人随笔</title>
<meta name="description" content="{{.Blog.Title}}">
<title>{{.Blog.Title}} - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/blog.css"/>
</head>
<body>

6
views/blogs.html

@ -1,6 +1,6 @@
{{template "header"}}
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>博客列表 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>博客列表 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/blogs.css"/>
</head>
<body>

4
views/editblog.html

@ -1,6 +1,6 @@
{{template "header"}}
{{template "header" .}}
<meta name="keywords" content="{{.Blog.Title}}">
<title>{{.Blog.Title}} - 个人随笔</title>
<title>{{.Blog.Title}} - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/newblog.css"/>
<script src="/static/js/wangEditor.min.js"></script>
</head>

6
views/iframe/blog.html

@ -3,15 +3,15 @@
<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="description" content="云悦,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="keywords"
content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
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="/static/js/aljquery.js"></script>*/}}
<script type="text/javascript" src="/static/js/sui.js"></script>
<script type="text/javascript" src="/static/js/layer.js"></script>
<title>首页 - 个人随笔</title>
<title>发布博客 - 云悦</title>
<style>
.common {
margin: 10px 0;

6
views/iframe/note.html

@ -3,15 +3,15 @@
<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="description" content="云悦,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="keywords"
content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
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="/static/js/aljquery.js"></script>*/}}
<script type="text/javascript" src="/static/js/sui.js"></script>
<script type="text/javascript" src="/static/js/layer.js"></script>
<title>首页 - 个人随笔</title>
<title>发布笔记 - 云悦</title>
<style>
.common {
margin: 15px 0;

6
views/iframe/user.html

@ -3,15 +3,15 @@
<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="description" content="云悦,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="keywords"
content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
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="/static/js/aljquery.js"></script>*/}}
<script type="text/javascript" src="/static/js/sui.js"></script>
<script type="text/javascript" src="/static/js/layer.js"></script>
<title>首页 - 个人随笔</title>
<title>首页 - 云悦</title>
<style>
.common {
margin: 0 0 3px 0;

13
views/index.html

@ -1,14 +1,17 @@
{{template "header"}}
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>首页 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>云悦· IT技术博客</title>
<link type="text/css" rel="styleSheet" href="/static/css/index.css"/>
</head>
<body>
{{template "nav" .}}
<div class="jumbotron" style="margin-top: 41px;padding-left: 50px;margin-bottom: 10px">
<h1>Hello, world!</h1>
<p>个人随笔2.0(golang)版本正式上线</p>
<p><a class="btn btn-primary btn-lg" href="/us" role="button">Learn more</a></p>
<p>云悦 2.0(golang)版本正式上线</p>
<p>
<a class="btn btn-primary btn-lg" href="/us" role="button">Learn more</a>
<a class="btn btn-primary btn-lg" href="/blog/new" target="_blank" role="button">写文章</a>
</p>
</div>
<div style="margin: 0 5%" class="blog-root">
<div style="display: flex">

6
views/login.html

@ -1,6 +1,6 @@
{{template "header"}}
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>登录 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>登录 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/login.css"/>
</head>
<body>

6
views/map.html

@ -1,6 +1,6 @@
{{template "header"}}
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>谷歌影像图 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>谷歌影像图 - 云悦</title>
<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.10&key=74c9586333eaf8d6191c576cf59739fa"></script>
<script src="https://webapi.amap.com/ui/1.0/main.js"></script>

6
views/newblog.html

@ -1,6 +1,6 @@
{{template "header"}}
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
<title>发布博客 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
<title>发布博客 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/newblog.css"/>
<script src="/static/js/wangEditor.min.js"></script>
</head>

6
views/note.html

@ -3,12 +3,12 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content="个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="description" content="云悦,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="keywords"
content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,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>*/}}
<title>我的笔记 - 个人随笔</title>
<title>我的笔记 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/menu-reset.css"/>
<link type="text/css" rel="styleSheet" href="/static/css/notemenu.css"/>
<link type="text/css" rel="styleSheet" href="/static/css/menunav.css"/>

6
views/regist.html

@ -1,6 +1,6 @@
{{template "header"}}
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>注册 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>注册 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/login.css"/>
</head>
<body>

339
views/snow.html

@ -0,0 +1,339 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
html, body {
margin: 0;
height: 100%;
background-size: cover;
background-position: center center;
overflow: hidden;
}
</style>
</head>
<body onload="draw();" style="background-image: url(https://jllsly.com/wallpapers/snow-night-wallpapers-high-quality-resolution-Is-Cool-Wallpapers-1.jpg);">
</body>
<script src="https://johnson2heng.github.io/three.js-demo/lib/three.js"></script>
<script src="https://johnson2heng.github.io/three.js-demo/lib/js/controls/OrbitControls.js"></script>
<script src="https://johnson2heng.github.io/three.js-demo/lib/js/libs/stats.min.js"></script>
<script src="https://johnson2heng.github.io/three.js-demo/lib/js/libs/dat.gui.min.js"></script>
<script src="https://cdn.bootcss.com/lodash.js/4.17.11/lodash.min.js"></script>
<script src="//cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/gsap/latest/TweenMax.min.js"></script>
<script>
//https://www.overdriveonline.com/wp-content/uploads/sites/8/2013/01/Truck-at-night-in-snow.jpg
//https://ateachinglifedotcom.files.wordpress.com/2016/12/snow-at-night.jpg
//https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/H0MA-uKSipsekm5s/magical-winter-night-in-the-snow-covered-pine-forest-realistic-3d-animation_bcgk90me1g_thumbnail-full01.png
//https://i.pinimg.com/originals/18/03/c9/1803c9683d2a6acb5f827114015a51c8.jpg
//https://travelingorion.files.wordpress.com/2017/02/img_6666.jpg
//https://jllsly.com/wallpapers/snow-night-wallpaper-desktop-Is-Cool-Wallpapers-1.jpg
//https://juegosrev.com/wp-content/uploads/2017/06/Winter-Night-Wallpapers-Gallery-88-Plus-PIC-WPW504471.jpg
//https://jllsly.com/wallpapers/snow-night-wallpapers-high-quality-resolution-Is-Cool-Wallpapers-1.jpg
setInterval(function(){
if (location.hash.length > 2) {
document.body.style.backgroundImage = "url("+ location.hash.substr(1) + ")";
}
}, 1000)
var renderer, camera;
var swidth,sheight, swidth_2;
var rotateRatio = 0.04;
var wind = {x:0, z:0, y:0, ratio:0.45};
let windChangeStep = function(key){
TweenMax.to(
wind,
_.random(1.6, 2.5, true),
{
[key]:_.random(-1, 1, true) * wind.ratio,
ease: Power2.easeInOut,
onComplete:function(){
windChangeStep(key)
}
}
)
}
windChangeStep("x");
windChangeStep("z");
windChangeStep("y");
var getVelocity = function(){
return {
y:_.random(-0.2, -0.05, true) * 1.4,
x:_.random(-0.1, 0.2, true) * 0.01,
z:_.random(-0.1, 0.2, true) * 0.01,
angle:_.random(-Math.PI/2, Math.PI/2, true)
}
}
function clacSize(){
swidth = window.innerWidth * 0.05;
sheight = window.innerHeight * 0.05;
swidth_2 = swidth * swidth;
}
$(window).on("resize", e=>{
_.throttle(e=>{
clacSize();
}, 300)
});
clacSize();
$(document).on("mousemove", e=>{
let {screenX, screenY} = e;
// wind.x = (screenX - innerWidth * 0.5)/innerWidth/2 * 1.2;
// wind.z = (screenY - innerHeight * 0.5)/innerHeight/2 * 1.2;
});
function initRender() {
renderer = new THREE.WebGLRenderer({antialias: true, alpha:true});
// renderer.setClearColor(new THREE.Color(0x222222)); //设置背景颜色
renderer.setClearColor(0x000000, 0.2); //设置背景颜色
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
}
function initCamera() {
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 12, swidth * 2);
camera.position.set(0, 0, swidth * 0.75);
camera.lookAt(new THREE.Vector3(0, 30, 0));
}
function initScene() {
scene = new THREE.Scene();
}
var light;
function initLight() {
scene.add(new THREE.AmbientLight(0x404040));
light = new THREE.DirectionalLight(0xffffff);
light.position.set(1, 1, 1);
scene.add(light);
}
function initModel() {
//轴辅助 (每一个轴的长度)
var object = new THREE.AxesHelper(500);
// scene.add(object);
}
//初始化性能插件
var stats;
function initStats() {
stats = new Stats();
document.body.appendChild(stats.dom);
}
//用户交互插件 鼠标左键按住旋转,右键按住平移,滚轮缩放
var controls;
function initControls() {
controls = new THREE.OrbitControls(camera, renderer.domElement);
// controls = new THREE.TrackballControls(camera, renderer.domElement);
// 如果使用animate方法时,将此函数删除
//controls.addEventListener( 'change', render );
// 使动画循环使用时阻尼或自转 意思是否有惯性
controls.enableDamping = true;
//动态阻尼系数 就是鼠标拖拽旋转灵敏度
//controls.dampingFactor = 0.25;
//是否可以缩放
controls.enableZoom = true;
//是否自动旋转
controls.autoRotate = false;
//设置相机距离原点的最远距离
controls.minDistance = 20;
//设置相机距离原点的最远距离
controls.maxDistance = 10000;
//是否开启右键拖拽
controls.enablePan = true;
}
//生成gui设置配置项
var gui;
var cloud;
function initGui() {
//声明一个保存需求修改的相关数据的对象
gui = {
"size": 0.9,
"transparent": true,
"opacity": 1,
"vertexColors": true,
"color": 0xffffff,
"sizeAttenuation": true,
"rotateSystem": false,
redraw: function () {
if (cloud) {
scene.remove(cloud);
}
createParticles(gui.size, gui.transparent, gui.opacity, gui.vertexColors, gui.sizeAttenuation, gui.color);
//设置是否自动旋转
controls.autoRotate = gui.rotateSystem;
}
};
// var datGui = new dat.GUI();
// //将设置属性添加到gui当中,gui.add(对象,属性,最小值,最大值)gui.add(controls, 'size', 0, 10).onChange(controls.redraw);
// datGui.add(gui, 'size', 0.1, 10).onChange(gui.redraw);
// datGui.add(gui, 'transparent').onChange(gui.redraw);
// datGui.add(gui, 'opacity', 0, 1).onChange(gui.redraw);
// datGui.add(gui, 'vertexColors').onChange(gui.redraw);
// datGui.addColor(gui, 'color').onChange(gui.redraw);
// datGui.add(gui, 'sizeAttenuation').onChange(gui.redraw);
// datGui.add(gui, 'rotateSystem').onChange(gui.redraw);
gui.redraw();
}
//生成粒子的方法
function createParticles(size, transparent, opacity, vertexColors, sizeAttenuation, color) {
var texture = new THREE.TextureLoader().load("/static/img/snow.png");
//存放粒子数据的网格
var geom = new THREE.Geometry();
//样式化粒子的THREE.PointCloudMaterial材质
var material = new THREE.PointsMaterial({
size,
transparent,
opacity,
vertexColors,
sizeAttenuation,
color,
depthTest: false, //设置解决透明度有问题的情况
map: texture,
});
for (var i = 0; i < 16000; i++) {
//添加顶点的坐标
var particle = new THREE.Vector3(0,0,0);
resetParticle(particle);
var v = getVelocity();
particle.velocityY = v.y;
particle.velocityX = v.x;
particle.velocityZ = v.z;
particle.ang = v.angle;
geom.vertices.push(particle);
var color = new THREE.Color(0xffffff);
//.setHSL ( h, s, l ) h — 色调值在0.0和1.0之间 s — 饱和值在0.0和1.0之间 l — 亮度值在0.0和1.0之间。 使用HSL设置颜色。
//随机当前每个粒子的亮度
//color.setHSL(color.getHSL().h, color.getHSL().s, Math.random() * color.getHSL().l);
geom.colors.push(color);
}
//生成模型,添加到场景当中
cloud = new THREE.Points(geom, material);
cloud.verticesNeedUpdate = true;
scene.add(cloud);
}
function resetParticle(particle){
particle.y = _.random(-sheight, sheight, true);
particle.x = _.random(-swidth, swidth , true);
particle.z = _.random(-swidth, swidth , true);
}
function render() {
//产生雨滴动画效果
var vertices = cloud.geometry.vertices;
vertices.forEach(function (v, i) {
v.ang+=0.05;
let a = Math.atan(v.z/v.x);
if(v.x<0){
a = a + Math.PI;
}
let r = Math.pow(v.x*v.x + v.z*v.z, 0.5);
a = a + rotateRatio * Math.pow(1 - r/swidth, 3);
//漩涡
v.x = Math.cos(a) * r;
v.z = Math.sin(a) * r;
//速度
v.y = v.y + v.velocityY;
v.x = v.x + v.velocityX + Math.cos(v.ang) * 0.09 ;
v.z = v.z + v.velocityZ + Math.sin(v.ang) * 0.09 ;
//风
v.y = v.y + wind.y * 0.5;
v.x = v.x + wind.x;
v.z = v.z + wind.z;
if (v.y <= -sheight){
v.y = sheight;
}else if (v.x < -swidth) {
v.x = swidth
}else if (v.x > swidth) {
v.x = -swidth;
}else if (v.z < -swidth) {
v.z = swidth
}else if (v.z > swidth) {
v.z = -swidth;
}
});
//设置实时更新网格的顶点信息
cloud.geometry.verticesNeedUpdate = true;
renderer.render(scene, camera);
}
//窗口变动触发的函数
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
render();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function animate() {
//更新控制器
controls.update();
render();
//更新性能插件
stats.update();
requestAnimationFrame(animate);
}
function draw() {
initRender();
initScene();
initCamera();
initLight();
initModel();
initControls();
initStats();
initGui();
animate();
window.onresize = onWindowResize;
}
</script>
</html>

6
views/ublogs.html

@ -1,5 +1,5 @@
{{template "header"}}
<title>博客 - 个人随笔</title>
{{template "header" .}}
<title>博客 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/me.css"/>
</head>
<body>
@ -49,7 +49,7 @@
</nav>
</div>
</div>
<div class="me-footer">
<div class="me-blog-footer">
{{template "footer"}}
</div>
</div>

4
views/uinfo.html

@ -1,5 +1,5 @@
{{template "header"}}
<title>博客 - 个人随笔</title>
{{template "header" .}}
<title>我的资料 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/me.css"/>
<script type="text/javascript" src="/static/js/upload.js"></script>
</head>

6
views/ulike.html

@ -1,5 +1,5 @@
{{template "header"}}
<title>博客 - 个人随笔</title>
{{template "header" .}}
<title>博客 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/me.css"/>
</head>
<body>
@ -48,7 +48,7 @@
</nav>
</div>
</div>
<div class="me-footer">
<div class="me-blog-footer">
{{template "footer"}}
</div>
</div>

4
views/unote.html

@ -1,5 +1,5 @@
{{template "header"}}
<title>博客 - 个人随笔</title>
{{template "header" .}}
<title>博客 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/me.css"/>
</head>
<body>

13
views/us.html

@ -1,13 +1,13 @@
{{template "header"}}
<meta name="keywords" content="关于我们,源码下载,程序部署步骤,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>关于我们 - 个人随笔</title>
{{template "header" .}}
<meta name="keywords" content="福利,源码下载,程序部署步骤,云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>福利 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/us.css"/>
</head>
<body>
{{template "nav" .}}
<div class="jumbotron" style="margin-top: 41px;padding-left: 50px;margin-bottom: 10px">
<h1>Hello, world!</h1>
<p>个人随笔2.0(golang)版本正式上线</p>
<p>云悦 2.0(golang)版本正式上线</p>
</div>
<div class="us-root">
<div style="width: 450px">
@ -29,8 +29,9 @@
</div>
</div>
<div style="flex: 1">
<img src="/static/img/alipay.png" alt="" width="320">
<img src="/static/img/weixin.png" alt="" width="320">
<img src="/static/img/alipay.png" alt="" width="320" height="361">
<img src="/static/img/weixin.png" alt="" width="320" height="361">
<img src="/static/img/redalipay.png" alt="" height="360">
</div>
</div>
<div style="margin: 30px 5% 0 5%">

7
views/user.html

@ -1,7 +1,8 @@
{{template "header"}}
{{template "header" .}}
<meta name="keywords"
content="{{.User.NickName}},{{.User.NickName}}主页,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>【{{.User.NickName}}】个人主页 - 个人随笔</title>
content="{{.User.NickName}}主页,云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<meta name="description" content="【{{.User.NickName}}】个人主页 - 云悦,{{.User.DescInfo}}">
<title>【{{.User.NickName}}】个人主页 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/u.css"/>
</head>
<body>

Loading…
Cancel
Save