新问题


在练习基于 Go 语言构建在线论坛(五):创建群组和主题功能实现的时候遇到了一些问题。

访问群组页面的时候,并没有出现回复框。其中views下的文件都是一致的。

这是handlers/thread.go

func ReadThread(writer http.ResponseWriter, request *http.Request) {
	vals := request.URL.Query()
	uuid := vals.Get("id")
	thread, err := models.ThreadByUUID(uuid)
	if err != nil {
		fmt.Println("Cannot read thread",err)
	} else {
		_, err := session(writer, request)
		if err != nil {
			generateHTML(writer, &thread, "layout", "navbar", "thread")
		} else {
			generateHTML(writer, &thread, "layout", "auth.navbar", "auth.thread")
		}
	}
}

这是创建群组页面的handlers\thread\NewThread.go

func NewThread(writer http.ResponseWriter, request *http.Request) {
	_, err := session(writer, request)
	if err != nil {
		http.Redirect(writer, request, "/login", 302)
	} else {
		generateHTML(writer, nil, "layout", "auth.navbar", "new.thread")
	}
}

这是new.thread.html

{{ define "content" }}

	<form role="form" action="/thread/create" method="post">
		<div class="lead">Start a new thread with the following topic</div>
		<div class="form-group">
			<textarea class="form-control" name="topic" id="topic" placeholder="Thread topic here" rows="4"></textarea>
			<br/>
			<br/>
			<button class="btn btn-lg btn-primary pull-right" type="submit">Start this thread</button>
		</div>
	</form>

{{ end }}

经过多次排查,还是找不到问题..


Vote Vote Cancel Collect Collect Cancel

<< 上一篇: 买过星球的还要付费99才能成为学院君订阅用户吗

>> 下一篇: laravel6 CSRF的一个bug,顶级域名可以通过,二级域名无法通过