Skip to content

Commit

Permalink
重构前后端
Browse files Browse the repository at this point in the history
  • Loading branch information
BapiGso committed Jan 9, 2024
1 parent cba9e03 commit 10a7d07
Show file tree
Hide file tree
Showing 70 changed files with 9,709 additions and 1,110 deletions.
4 changes: 3 additions & 1 deletion assets/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
## 该目录用于映射到网站的/assets路径
## 该目录用于映射到网站的/assets路径

### 14px
1 change: 0 additions & 1 deletion assets/blog/404.template
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@
</div>
</article>
</body>
</html>
2 changes: 0 additions & 2 deletions assets/blog/comment.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
<button id="submit" type="submit">发表评论</button>
</fieldset>
</form>


<div class="comments-area" id="comments">
{{ if ne (len .SortComments) 0 }}
<h2>评论列表</h2>
Expand Down
20 changes: 12 additions & 8 deletions assets/blog/css/Diaspora.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion assets/blog/index-container.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{with index .PostArr 0}}
{{with index .Contents 0}}
<div id="mark">
<div class="layer" data-depth="0.4">
<img id="cover" crossorigin="anonymous" src="/usr/uploads/cover/1.webp" alt="illustration">
</div>
</div>

<!--todo blur glass-->
<div id="vibrant">
<svg viewBox="0 0 2880 1620" height="100%" preserveAspectRatio="xMaxYMax slice">
<polygon opacity="0.7" points="2000,1620 0,1620 0,0 600,0 "/>
Expand Down
45 changes: 30 additions & 15 deletions assets/blog/index-primary.template
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
{{range slice .PostArr 1}}
{{range $idx, $val := (slice .Contents 1) }}
{{if eq $val.Type "post"}}
<div class="post">
<a data-id="{{ .Cid }}" href="/archives/{{.Cid}}" title="{{.Title}}">
<img class="cover" width="680" height="440" src="/usr/uploads{{.GetCoverList}}" alt="illustration">
<a data-id="{{ $val.Cid }}" href="/archives/{{$val.Cid}}" title="{{$val.Title}}">
<img class="cover" width="680" height="440" src="/usr/uploads{{(index $.Fields $idx).StrValue}}" alt="illustration">
</a>
<div class="else">
<p>{{ .UnixToStr }}</p>
<h3><a data-id="{{ .Cid }}" class="posttitle" href="/archives/{{ .Cid }}">{{ .Title }}</a></h3>
<p>{{ $val.UnixToStr }}</p>
<h3><a data-id="{{ .Cid }}" class="posttitle" href="/archives/{{ $val.Cid }}">{{ $val.Title }}</a></h3>
<div class="abstract">
<p>{{- .MDSub -}}...</p>
<p>{{- $val.MDSub -}}...</p>
</div>
<div class="here">
<span class="icon-letter"></span>
<p>{{ .MDCount }}</p>
<p>{{ $val.MDCount }}</p>
<span class="icon-view"></span>
<p>{{ .Views }}</p>
<p>{{ $val.Views }}</p>
<span class="icon-like"></span>
<p>{{ .Likes }}</p>
<p>{{ $val.Likes }}</p>
</div>
</div>
</div>
{{- end }}
{{if ne .HaveNext 0}}
<div id="pager">
<a href="/page/{{.HaveNext}}" data-url="/page/{{.HaveNext}}" class="more">加载更多</a>
</div>
{{end}}
{{end}}
{{end}}
{{if ge (len .Contents) 5}}
{{if eq (index .Contents 5).Type "post"}}
<div id="pager">
<a href="/page/2" class="more">加载更多</a>
</div>
<script>
// 获取当前页面URL
const url = window.location.pathname;
// 正则匹配提取页码
const pageMatch = url.match(/\/page\/(\d+)/);

// 拼接新的链接
const newUrl = `/page/${pageMatch}`;

document.querySelector('.more').href = newUrl;
</script>
{{end}}
{{end}}
11 changes: 6 additions & 5 deletions assets/blog/index.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<body>
<div class="nav">
<ul id="menu-menu" class="menu">
{{ range .PageArr }}
<li class="{{.Slug}}">
<a href="/{{.Slug}}" class="pagelist">{{.Title}}</a>
</li>
{{ range .Contents }}
{{if eq .Type "page"}}
<li class="{{.Slug}}">
<a href="/{{.Slug}}" class="pagelist">{{.Title}}</a>
</li>
{{end}}
{{ end }}
</ul>
<p>&copy; 2020 <a href="/">晓梦</a>. Power By <a rel="external nofollow" href="https://github.com/BapiGso/smoe">smoe</a>.
Expand Down Expand Up @@ -39,4 +41,3 @@
}
</script>
</body>
</html>
60 changes: 24 additions & 36 deletions assets/blog/page-bangumi.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,10 @@
</header>

<article class="page" >
<div class="content">
<div class="bangumi">
<h2><strong>看过</strong></h2>
<ul>
{{range index .Data 2}}
<h2><strong>看过</strong></h2>
<ul>
{{range index .Data 2}}
{{with .Subject}}
<li>
<a href="" target="_blank">
<img alt="{{if .NameCn}}{{.NameCn}}{{else}}{{.Name}}{{end}}{{.NameCn}}" class="cover" src="{{with .Images}}{{.Medium}}{{end}}">
</a>
<p>{{if .NameCn}}{{.NameCn}}{{else}}{{.Name}}{{end}}</p>
</li>
{{end}}
{{end}}
</ul>
</div>
<div class="bangumi">
<h2><strong>想看</strong></h2>
<ul>
{{range index .Data 1}}
{{with .Subject}}
<li>
<figure>
<img alt="{{.Name}}" class="cover" src="{{with .Images}}{{.Small}}{{end}}">
Expand All @@ -37,24 +20,29 @@
<h6>{{if .NameCn}}{{.NameCn}}{{else}}{{.Name}}{{end}}</h6>
<p>{{.Score}}/10</p>
</section>
<section>
<time>{{.Date}}</time>
<span>
{{range $k ,$v := .Tags }}
{{if le $k 2}}
{{.Name}}
{{end}}
{{end}}
</span>
</section>
</figcaption>
</li>
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}
{{end}}
</ul>
<h2><strong>想看</strong></h2>
<ul>
{{range index .Data 1}}
{{with .Subject}}
<li>
<figure>
<img alt="{{.Name}}" class="cover" src="{{with .Images}}{{.Small}}{{end}}">
</figure>
<figcaption>
<section>
<h6>{{if .NameCn}}{{.NameCn}}{{else}}{{.Name}}{{end}}</h6>
<p>{{.Score}}/10</p>
</section>
</figcaption>
</li>
{{end}}
{{end}}
</ul>
</article>
{{template "footer.template"}}
</body>
</html>
22 changes: 10 additions & 12 deletions assets/blog/page-timeline.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,20 @@
</header>
<article class="page" >
<div class="content">
{{range .SortContents}}
<h2><strong>{{.Year}} 年 </strong></h2>
<ul>
{{range .YData}}
<li><span><strong>{{.Mon}} 月</strong></span>
{{$DateTmp := "2006年01月02日"}}
{{range .Contents}}
{{if ne (slice .UnixFormat 0 4) (slice $DateTmp 0 4)}}
<h2><strong>{{slice .UnixFormat 0 4}} 年 </strong></h2>
{{end}}
{{if ne (slice .UnixFormat 0 9) (slice $DateTmp 0 9)}}
<span><b>&nbsp {{slice .UnixFormat 7 9 }} 月</b></span>
{{$DateTmp = .UnixFormat}}
{{end}}
<ul>
{{range .MData}}
<li><a href="https://smoe.cc/archives/{{.Cid}}/">{{.Title}}</a></li>
{{end}}
<li><a href="/archives/{{.Cid}}/">{{.Title}}</a></li>
</ul>
</li>
{{end}}
</ul>
{{end}}
</div>
</article>
{{template "footer.template"}}
</body>
</html>
6 changes: 3 additions & 3 deletions assets/blog/page.template
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{template "header.template" (index .PageArr 0).Title}}
{{template "header.template" (index .Contents 0).Title}}
<body>
<header id="top">
<nav class="components">
<a class="logo-min" href="javascript:history.back()"></a>
</nav>
</header>

{{with index .PageArr 0}}
{{with index .Contents 0}}
<article data-id="{{.Cid}}" class="page">
<div class="content">
{{.MD2HTML}}
Expand All @@ -17,4 +17,4 @@

{{template "footer.template"}}
</body>
</html>

10 changes: 3 additions & 7 deletions assets/blog/post.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{template "header.template" (index .PostArr 0).Title}}
{{template "header.template" (index .Contents 0).Title}}
<body>
<header id="top">
<nav class="components">
Expand All @@ -9,7 +9,7 @@
<path class="right"/>
</svg>
</button>
<h3 class="subtitle">{{if ( index .PostArr 0)}}{{( index .PostArr 0).Title}}{{end}}</h3>
<h3 class="subtitle">{{with ( index .Contents 0)}}{{.Title}}{{end}}</h3>
<div class="like-icon">
<a class="likeThis" href="javascript:" id="like-">
<span class="icon-like"></span>
Expand All @@ -26,7 +26,7 @@
</header>
{{/*todo 灯箱*/}}

{{with index .PostArr 0}}
{{with index .Contents 0}}
<article data-id="{{.Cid}}">
<h1 class="title">{{.Title}}</h1>
<div class="stuff">
Expand All @@ -45,8 +45,4 @@
{{end}}
{{template "comment.template" .}}
{{template "footer.template"}}
<script>
console.log(123)
</script>
</body>
</html>
Binary file removed assets/design/butterfly (2).png
Binary file not shown.
Binary file modified assets/design/推门1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/design/推门2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/design/推门3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/design/推门4.png
Binary file not shown.
Binary file removed assets/design/草图.png
Binary file not shown.
1 change: 1 addition & 0 deletions assets/new-admin/admin-header.template
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
</style>
<script type="module" crossorigin src="/assets/new-admin/js/sky.js"></script>
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
{{/* <link rel="stylesheet" href="/assets/new-admin/css/tufte.min.css">*/}}

{{block "custom-head" .}}{{end}}

Expand Down
Loading

0 comments on commit 10a7d07

Please sign in to comment.