parent
1ad43c45bd
commit
6cb51f5b70
@ -0,0 +1,9 @@
|
||||
<el-menu
|
||||
default-active=""
|
||||
mode="horizontal">
|
||||
<el-menu-item index="1" class="mainLogo" v-on:click="openUrl('/list')">GO-IMAP</el-menu-item>
|
||||
<el-menu-item index="2" v-on:click="openUrl('/list?fid='+fid)">收信<el-badge class="mark" :value="mailTotal" style="margin-bottom: 20px;"/>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="3" v-on:click="openUrl('/write')">写信</el-menu-item>
|
||||
<el-menu-item index="4" v-on:click="openUrl('/logout')">退出</el-menu-item>
|
||||
</el-menu>
|
@ -0,0 +1,27 @@
|
||||
package tmpl
|
||||
|
||||
import (
|
||||
"github.com/taoshihan1991/imaptool/tools"
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type CommonHtml struct{
|
||||
Header template.HTML
|
||||
Nav template.HTML
|
||||
Rw http.ResponseWriter
|
||||
}
|
||||
func NewRender(rw http.ResponseWriter)*CommonHtml{
|
||||
obj:=new(CommonHtml)
|
||||
obj.Rw=rw
|
||||
header := tools.FileGetContent("html/header.html")
|
||||
nav := tools.FileGetContent("html/nav.html")
|
||||
obj.Header=template.HTML(header)
|
||||
obj.Nav=template.HTML(nav)
|
||||
return obj
|
||||
}
|
||||
func (obj *CommonHtml)Display(file string,data interface{}){
|
||||
main := tools.FileGetContent("html/"+file+".html")
|
||||
t, _ := template.New(file).Parse(main)
|
||||
t.Execute(obj.Rw, data)
|
||||
}
|
@ -1,78 +1,16 @@
|
||||
package tmpl
|
||||
|
||||
import (
|
||||
"github.com/taoshihan1991/imaptool/tools"
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func RenderView(w http.ResponseWriter, render interface{}) {
|
||||
const html = `
|
||||
<!doctype html>
|
||||
<html lang="cn">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
|
||||
<meta name="generator" content="Jekyll v3.8.6">
|
||||
<title>邮箱IMAP-详情</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
||||
|
||||
<style>
|
||||
body{
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item active">邮件夹</li>
|
||||
{{ range $key, $value := .Folders}}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<a href="/list?fid={{$key}}">{{$key}}</a>
|
||||
{{if ne $value 0 }}<span class="badge badge-primary badge-pill">{{$value}}</span>{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<table class="table table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row" width="100">日期:</th>
|
||||
<td>{{.Date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">发件人:</th>
|
||||
<td>{{.From}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">收件人:</th>
|
||||
<td>{{.To}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">主题:</th>
|
||||
<td>{{.Subject}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">内容:</th>
|
||||
<td>
|
||||
{{.HtmlBody}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
html1 := tools.FileGetContent("html/view.html")
|
||||
t, _ := template.New("view").Parse(html1)
|
||||
t.Execute(w, render)
|
||||
type ViewHtml struct{
|
||||
CommonHtml
|
||||
Fid string
|
||||
Id uint32
|
||||
}
|
||||
func RenderView(w http.ResponseWriter, data interface{}) {
|
||||
render:=NewRender(w)
|
||||
data.(*ViewHtml).Nav=render.Nav
|
||||
data.(*ViewHtml).Header=render.Header
|
||||
render.Display("view",data)
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package tmpl
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
func RenderWrite(w http.ResponseWriter, data interface{}) {
|
||||
render:=NewRender(w)
|
||||
render.Display("write",render)
|
||||
}
|
Loading…
Reference in new issue