diff --git a/app/index/controller/Login.php b/app/index/controller/Login.php new file mode 100644 index 0000000..24af75a --- /dev/null +++ b/app/index/controller/Login.php @@ -0,0 +1,88 @@ +assign('cid', false); + return $this->fetch(); + } + + /** + * 验证登录 + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function verify() + { + list($account, $pwd, $verify) = Util::postMore(['account', 'pwd', 'verify'], null, true); + if (empty($account) || empty($pwd)) return app("json")->fail("账号、密码和验证码不能为空!"); + // 验证码验证 + if (!captcha_check($verify)) return app("json")->fail("验证码不正确!"); + // 验证登录 + if (!userModel::login($account, $pwd)) return app("json")->fail("登录失败!"); + return app("json")->success("登录成功!"); + } + + /** + * 注册 + * @return string + * @throws \Exception + */ + public function register() + { + return $this->fetch(); + } + + /** + * 忘记密码 + * @return string + * @throws \Exception + */ + public function forget() + { + return $this->fetch(); + } + + /** + * 退出登陆 + * @return mixed + * @throws \Exception + */ + public function logout() + { + $res = userModel::clearLoginInfo(); + + if ($res) { + $this->success('留言成功'); + } else { + $this->error('留言失败'); + } + } + + /** + * 验证码 + * @return \think\Response + */ + public function captcha() + { + ob_clean(); + return captcha(); + } +} \ No newline at end of file diff --git a/public/template/default/pc/img/login_backgroud.jpg b/public/template/default/pc/img/login_backgroud.jpg new file mode 100644 index 0000000..30be30c Binary files /dev/null and b/public/template/default/pc/img/login_backgroud.jpg differ diff --git a/public/template/default/pc/login/login.html b/public/template/default/pc/login/login.html new file mode 100644 index 0000000..d0a615a --- /dev/null +++ b/public/template/default/pc/login/login.html @@ -0,0 +1,115 @@ + + + + {:web_config("title")} + + + {include file="public/head" /} + + + + + +
+ {include file="public/header" /} +
+ +
+
+ +
+
+ + {include file="public/footer"/} +
+ + diff --git a/public/template/default/pc/public/header.html b/public/template/default/pc/public/header.html index 1dc7fab..0e61186 100644 --- a/public/template/default/pc/public/header.html +++ b/public/template/default/pc/public/header.html @@ -118,7 +118,7 @@ - +