Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
chore: 发布 8.8优化前端
Browse files Browse the repository at this point in the history
  • Loading branch information
AGDholo committed Jul 27, 2019
1 parent d429ab1 commit 7407991
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 80 deletions.
5 changes: 4 additions & 1 deletion application/user/controller/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class Auth extends Controller
'UserAuthorize' => [
'except' => [
'create',
'save'
'save',
'index',
'read'
]
],
'GodAuthorize' => [
Expand Down Expand Up @@ -78,6 +80,7 @@ public function read($id)
$user = User::find($id);
$this->assign([
'user' => $user,
'session' => Session::get('user')
]);
return $this->fetch();
}
Expand Down
66 changes: 41 additions & 25 deletions resources/views/_layout/default.blade.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="">
<meta name="keywords" content="">
<title>@yield('title') -- ThinkPHP 入门教程</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/app.css">
</head>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="">
<meta name="keywords" content="">
<title>@yield('title') -- ThinkPHP 入门教程</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/app.css">
</head>

<body>
@include('_layout.header')
<div class="container">
@yield('content')
<body>
<div class="container mt-5">
<div class="row">
<div class="col">
@include('_layout.header')
</div>
<div class="col-6">
<ul class="list-group">
<li class="list-group-item">
<a onclick="window.history.go(-1); return false;" class="btn btn-light" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
@yield('title')
</li>
<li class="list-group-item">
@yield('content')
</li>
</ul>
</div>
<div class="col">
@include('_layout.footer')
</div>
</div>
@include('_layout.footer')
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<script src="/static/js/app.js"></script>
</body>
</div>


<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="/static/js/app.js"></script>
</body>

</html>
89 changes: 43 additions & 46 deletions resources/views/_layout/header.blade.php
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
<header>
<div>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">ThinkPHP 入门教程</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{{ url('welcome/index/home') }}">主页
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url('welcome/index/help') }}">帮助</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url('welcome/index/about') }}">关于</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url('user/auth/index') }}">所有用户</a>
</li>
</ul>
@if(session('user'))
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ session('user.name') }}
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="{{ url('user/auth/read', ['id' => session('user.id')]) }}">个人主页</a>
<a class="dropdown-item">
<form action="{{ url('user/session/delete', ['id' => session('user.id')]) }}" method="POST">
<nav class="nav flex-column">
<ul class="list-group list-group-flush">
<li class="list-group-item list-group-item-action">
<a class="nav-link" href="{{ url('welcome/index/home') }}">
主页
</a>
</li>
<li class="list-group-item list-group-item-action">
<a class="nav-link" href="{{ url('user/auth/index') }}">
所有用户
</a>
</li>
@if(session('user'))
<li class="list-group-item list-group-item-action">
<a class="nav-link" href="{{ url('user/auth/read', ['id' => session('user.id')]) }}">
个人资料
</a>
</li>
<li class="list-group-item list-group-item-action">
<div class="dropdown">
<a class="nav-link dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="">更多</a>

@php echo token() @endphp

<button class="btn btn-block" type="submit" name="button">退出</button>
</form>
</a>
</div>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item">
<form action="{{ url('user/session/delete', ['id' => session('user.id')]) }}" method="POST">
@php echo token() @endphp
<button class="btn btn-block" type="submit" name="button">退出</button>
</form>
</a>
</div>
@else
<a class="btn btn-outline-success my-2 my-sm-0" href="{{ url('user/auth/create') }}">注册</a>
<a class="btn btn-outline-success my-2 my-sm-0" href="{{ url('user/session/create') }}">登录</a>
@endif
</div>
</div>
</nav>
</div>
</li>
@else
<li class="list-group-item list-group-item-action">
<a class="nav-link" href="{{ url('user/auth/create') }}">
注册
</a>
</li>
<li class="list-group-item list-group-item-action">
<a class="nav-link" href="{{ url('user/session/create') }}">
登录
</a>
</li>
@endif
</ul>
</nav>
</header>
8 changes: 2 additions & 6 deletions resources/views/user/auth/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
@extends('_layout.default')
@section('title', '查看所有用户')
@section('content')
<div class="offset-md-2 col-md-8">
<h2 class="mb-4 text-center">
所有用户
</h2>

<div>
<div class="list-group list-group-flush">
@foreach ($users as $user)
<div class="list-group-item">
<a href="{{ url('user/auth/read', ['id' => $user->id]) }}">
{{ $user->name }}
</a>
@if ($god)
@if ($god && !$user->god)
<form action="{{ url('user/auth/delete', ['id' => $user->id]) }}" method="post" class="float-right">
@php echo token() @endphp
<input type="hidden" name="_method" value="DELETE">
Expand Down
13 changes: 11 additions & 2 deletions resources/views/user/auth/read.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@
<div class="col-md-offset-2 col-md-8">
<div class="panel panel-default mt-5">
<div class="panel-heading mb-3">
<h4>欢迎您 {{ $user->name }}</h4>
<a class="btn btn-primary" href="{{ url('user/auth/edit', ['id' => session('user.id')]) }}">编辑资料</a>
<h4>
@if(!is_null($session) && $session->id === $user->id)
<a class="btn btn-primary" href="{{ url('user/auth/edit', ['id' => session('user.id')]) }}">
编辑资料
</a>
欢迎您
@else
您正在查看
@endif
{{ $user->name }}
</h4>
</div>
</div>
</div>
Expand Down

0 comments on commit 7407991

Please sign in to comment.