我认为我的语法有问题,但我无法找到它。我试图登录,但总是有404页。
这是router / router.go:
beego.Router("/", &controllers.AccController{},"get:Home")
beego.Router("/acc/login", &controllers.AccController{}, "get,post:Post")
beego.Router("/acc/signup", &controllers.AccController{}, "get,post:Add")
beego.Router("/acc/home", &controllers.AccController{}, "get:Home")
和controllers / acc.go:
func (acc *AccController) Post() {
username := acc.Input().Get("Username")
password := acc.Input().Get("Password")
if username=="" || password=="" {
acc.Data["err"] = "Please fill the form and then click submit!"
acc.TplName = "acc/login.tpl"
} else {
u := &models.Users{Username:username}
ok,user := u.Login(username,password)
if ok {
acc.SetSession("webpro", user)
//Find the contents of the corresponding permissions here
acc.Ctx.Redirect(302, "/acc/home")
} else {
acc.Data["err"] = "Wrong username or password!"
acc.TplName = "acc/login.tpl"
}
}
这是views / acc / login.tpl:
<body class="login-img3-body">
<div class="container">
<form class="login-form" action="/login" method="POST">
<div class="login-wrap">
<p class="login-img"><i class="icon_lock_alt"></i></p>
<div class="input-group">
<span class="input-group-addon"><i class="icon_profile"></i></span>
<input type="text" class="form-control" placeholder="Username" value="{{.Users.Username}}" autofocus>
</div>
<div class="input-group">
<span class="input-group-addon"><i class="icon_key_alt"></i></span>
<input type="password" class="form-control" placeholder="Password" value="{{.Users.Password}}">
</div>
<label class="checkbox">
<input type="checkbox" value="remember-me"> Remember me
<span class="pull-right"> <a href="#"> Forgot Password?</a></span>
</label>
<button class="btn btn-primary btn-lg btn-block" type="submit">Login</button>
<button class="btn btn-info btn-lg btn-block" type="submit">Signup</button>
</div>
</form>
</div>
</body>
我是新手,如果我错了,请纠正我。
答案 0 :(得分:0)
1。将Web访问权限更改为localhost:8080 / acc / login
2.更改pubspec.yaml
到cd ios
cd ..
pod deintegrate
flutter clean
flutter pub cache repair
flutter pub get
cd ios
Pod install
Pod repo update
为我工作!