diff --git a/controller/folder.go b/controller/folder.go
index 7657c73..0cf08e7 100644
--- a/controller/folder.go
+++ b/controller/folder.go
@@ -25,6 +25,12 @@ func ActionFolder(w http.ResponseWriter, r *http.Request){
render.Fid = fid
tmpl.RenderList(w, render)
}
+//写信界面
+func ActionWrite(w http.ResponseWriter, r *http.Request){
+ render:=tmpl.NewRender(w)
+ render.SetLeft("mail_left")
+ render.Display("write",nil)
+}
//获取邮件夹接口
func FolderDir(w http.ResponseWriter, r *http.Request){
fid:=tools.GetUrlArg(r,"fid")
diff --git a/server.go b/server.go
index 76e291f..1cb3fc4 100644
--- a/server.go
+++ b/server.go
@@ -30,7 +30,7 @@ func main() {
//详情界面
http.HandleFunc("/view", view)
//写信界面
- http.HandleFunc("/write", write)
+ http.HandleFunc("/write", controller.ActionWrite)
//框架界面
http.HandleFunc("/main", controller.ActionMain)
//设置界面
@@ -74,12 +74,6 @@ func view(w http.ResponseWriter, r *http.Request) {
tmpl.RenderView(w, render)
}
-//写信界面
-func write(w http.ResponseWriter, r *http.Request) {
- render:=new(tmpl.CommonHtml)
- tmpl.RenderWrite(w, render)
-}
-
//邮件接口
func mail(w http.ResponseWriter, r *http.Request) {
diff --git a/static/html/mail_left.html b/static/html/mail_left.html
new file mode 100644
index 0000000..7e44a7f
--- /dev/null
+++ b/static/html/mail_left.html
@@ -0,0 +1,11 @@
+
+
+
+ 写信
+
+
+
+ <{v}>
+
+
\ No newline at end of file
diff --git a/static/html/write.html b/static/html/write.html
index 1d1c456..5624354 100644
--- a/static/html/write.html
+++ b/static/html/write.html
@@ -4,13 +4,7 @@
-
-
-
- <{v}>
-
-
+ {{.Left}}
diff --git a/tmpl/common.go b/tmpl/common.go
index c887509..1d2342b 100644
--- a/tmpl/common.go
+++ b/tmpl/common.go
@@ -31,6 +31,9 @@ func (obj *CommonHtml)SetBottom(file string){
obj.Bottom=template.HTML(str)
}
func (obj *CommonHtml)Display(file string,data interface{}){
+ if data==nil{
+ data=obj
+ }
main := tools.FileGetContent("html/"+file+".html")
t, _ := template.New(file).Parse(main)
t.Execute(obj.Rw, data)
diff --git a/tmpl/write.go b/tmpl/write.go
index cce2bb4..e693b3d 100644
--- a/tmpl/write.go
+++ b/tmpl/write.go
@@ -1,9 +1 @@
package tmpl
-
-import (
- "net/http"
-)
-func RenderWrite(w http.ResponseWriter, data interface{}) {
- render:=NewRender(w)
- render.Display("write",render)
-}