Files
jiang13-forum/templates/profile/view.tmpl
freefire 204e7fdb32 feat: SSR 内容门控与积分钱包/签到抽奖
闭合积分解锁经济闭环:锁定壳与 unlock,以及 profile 钱包流水与每日签到/抽奖 PRG。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-29 06:20:12 +08:00

127 lines
5.0 KiB
Cheetah
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{define "profile/view"}}
{{template "base/head" .}}
{{template "base/navbar" .}}
<main class="j13-main j13-profile">
<h1>个人中心</h1>
{{template "base/alert" .}}
<p class="j13-muted">
<a href="{{.PublicURL}}">查看公开主页</a>
· <a href="/favorites">我的收藏</a>
</p>
<ul class="j13-admin-stats">
<li><strong>{{.PostCount}}</strong><span>帖子</span></li>
<li><strong>{{.CommentCount}}</strong><span>评论</span></li>
<li><strong>{{.FavoriteCount}}</strong><span>收藏</span></li>
<li><strong>{{.LikeReceived}}</strong><span>获赞</span></li>
<li><strong>{{.Points}}</strong><span>积分</span></li>
</ul>
<section class="j13-profile__wallet" id="wallet">
<h2>积分钱包</h2>
<p class="j13-profile__balance">当前余额 <strong>{{.Points}}</strong> 积分</p>
<div class="j13-profile__daily">
<div class="j13-profile__daily-card">
<h3>每日签到</h3>
{{if .CheckIn.CheckedIn}}
<p class="j13-muted">今日已签到 · 连续 {{.CheckIn.Streak}} 天 · 获得 {{.CheckIn.TodayPoints}} 积分</p>
<button type="button" class="j13-btn" disabled>已签到</button>
{{else}}
<p class="j13-muted">连续将至 {{.CheckIn.Streak}} 天 · 预计可得 {{.CheckIn.TodayPoints}} 积分(基础 5连签 +1封顶 15</p>
<form method="post" action="/profile/checkin" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<button type="submit" class="j13-btn">签到</button>
</form>
{{end}}
</div>
<div class="j13-profile__daily-card">
<h3>每日抽奖</h3>
{{if .Lottery.Drawn}}
<p class="j13-muted">今日已抽 · 结果 {{.Lottery.Points}} 积分</p>
<button type="button" class="j13-btn" disabled>已抽奖</button>
{{else}}
<p class="j13-muted">每日一次 · 成本 {{.Lottery.Cost}} · 奖池 0/2/5/10/20</p>
<form method="post" action="/profile/lottery" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<button type="submit" class="j13-btn">抽奖</button>
</form>
{{end}}
</div>
</div>
<h3 class="j13-profile__ledger-title">最近流水</h3>
{{if .Ledger}}
<table class="j13-profile__ledger">
<thead>
<tr><th>时间</th><th>事由</th><th>变动</th><th>余额</th></tr>
</thead>
<tbody>
{{range .Ledger}}
<tr>
<td>{{.CreatedAt}}</td>
<td>{{.ReasonLabel}}{{if .Note}} <span class="j13-muted">{{.Note}}</span>{{end}}</td>
<td class="{{if gt .Delta 0}}j13-delta--pos{{else if lt .Delta 0}}j13-delta--neg{{end}}">{{if gt .Delta 0}}+{{end}}{{.Delta}}</td>
<td>{{.Balance}}</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<p class="j13-muted">暂无积分流水</p>
{{end}}
</section>
<section class="j13-profile__card">
<h2>账号</h2>
<p>用户名 <strong>{{.Username}}</strong></p>
<p class="j13-muted">邮箱 {{.Email}}</p>
<p class="j13-muted">等级 Lv.{{.Level}} · 经验 {{.Exp}}</p>
{{if .Avatar}}
<p><img class="j13-avatar" src="{{.Avatar}}" alt="头像"/></p>
{{end}}
</section>
<section>
<h2>头像</h2>
<form method="post" action="/profile/avatar" enctype="multipart/form-data" class="j13-form j13-admin-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<label>图片(最大 {{.AvatarMaxMB}} MB
<input type="file" name="avatar" accept="image/*" required/>
</label>
<button type="submit">上传头像</button>
</form>
</section>
<section>
<h2>昵称</h2>
<form method="post" action="/profile/nickname" class="j13-form j13-admin-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<label>昵称 <input name="nickname" value="{{.Nickname}}" maxlength="32" required/></label>
<button type="submit">保存昵称</button>
</form>
</section>
<section>
<h2>签名</h2>
<form method="post" action="/profile/signature" class="j13-form j13-admin-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<label>签名
<textarea name="signature" rows="3" maxlength="{{.SignatureMax}}">{{.Signature}}</textarea>
</label>
<button type="submit">保存签名</button>
</form>
</section>
<section>
<h2>修改密码</h2>
<form method="post" action="/profile/password" class="j13-form j13-admin-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<label>当前密码 <input type="password" name="old_password" required autocomplete="current-password"/></label>
<label>新密码 <input type="password" name="new_password" required minlength="6" autocomplete="new-password"/></label>
<label>确认新密码 <input type="password" name="new_password2" required minlength="6" autocomplete="new-password"/></label>
<button type="submit">更新密码</button>
</form>
</section>
</main>
{{template "base/footer" .}}
{{end}}