优化列表页

pull/30/head
陶士涵 5 years ago
parent 6541df948f
commit add3f563ea

@ -0,0 +1,11 @@
package controller
import (
"github.com/taoshihan1991/imaptool/tmpl"
"net/http"
)
//聊天主界面
func ActionChatMain(w http.ResponseWriter, r *http.Request){
render:=tmpl.NewRender(w)
render.Display("chat_main",nil)
}

@ -20,10 +20,10 @@ func ActionFolder(w http.ResponseWriter, r *http.Request){
if currentPage == 0 {
currentPage = 1
}
render := new(tools.IndexData)
render := tmpl.NewFolderHtml(w)
render.CurrentPage = currentPage
render.Fid = fid
tmpl.RenderList(w, render)
render.Display("list",render)
}
//写信界面
func ActionWrite(w http.ResponseWriter, r *http.Request){

@ -39,6 +39,8 @@ func main() {
mux.HandleFunc("/setting_account", controller.SettingAccount)
//发送邮件接口
mux.HandleFunc("/send", controller.FolderSend)
//聊天界面
mux.HandleFunc("/chat_main", controller.ActionMain)
//监听端口
//http.ListenAndServe(":8080", nil)
//var myHandler http.Handler

@ -0,0 +1,15 @@
package tmpl
import "net/http"
type FolderHtml struct {
*CommonHtml
CurrentPage int
Fid string
}
func NewFolderHtml(w http.ResponseWriter)*FolderHtml{
obj:=new(FolderHtml)
parent:=NewRender(w)
obj.CommonHtml=parent
return obj
}

@ -1,16 +0,0 @@
package tmpl
import (
"github.com/taoshihan1991/imaptool/tools"
"html/template"
"net/http"
)
func RenderList(w http.ResponseWriter, render interface{}) {
header := tools.FileGetContent("html/header.html")
html := tools.FileGetContent("html/list.html")
t, _ := template.New("list").Parse(html)
render.(*tools.IndexData).Header=template.HTML(header)
t.Execute(w, render)
}
Loading…
Cancel
Save