generated from panliang/owl-admin-starter
balde
parent
eda3248af3
commit
9b3772c00f
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\PartyUser;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function login(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'username' => 'required',
|
||||
'password' => 'required'
|
||||
]);
|
||||
|
||||
$auth = $this->guard();
|
||||
$user = PartyUser::where('username', $request->input('username'))->first();
|
||||
if ($user) {
|
||||
$auth->login($user);
|
||||
return back()->with('flash_message', '登录成功');
|
||||
}
|
||||
|
||||
return back()->withErrors('用户名或密码错误');
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->guard()->logout();
|
||||
return back()->with('flash_message', '已退出');
|
||||
}
|
||||
|
||||
protected function guard()
|
||||
{
|
||||
return Auth::guard('web');
|
||||
}
|
||||
}
|
||||
|
|
@ -19,9 +19,12 @@ class RedirectIfAuthenticated
|
|||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
$redirects = [
|
||||
'web' => '/'
|
||||
];
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
return redirect(data_get($redirects, $guard, '/'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ return [
|
|||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
'provider' => 'party',
|
||||
],
|
||||
'api' => [
|
||||
'driver' => 'sanctum',
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 66 KiB |
|
|
@ -0,0 +1,111 @@
|
|||
@extends('layout')
|
||||
@section('title')
|
||||
{{ config('admin.name') }}
|
||||
@endsection
|
||||
@section('content')
|
||||
<div id="carousel" class="carousel slide">
|
||||
<div class="carousel-inner">
|
||||
<div class="carousel-item active">
|
||||
<img src="https://via.placeholder.com/800x300.png?text=1" class="d-block w-100" alt="..." width="100%" height="300">
|
||||
</div>
|
||||
<div class="carousel-item">
|
||||
<img src="https://via.placeholder.com/800x300.png?text=2" class="d-block w-100" alt="..." width="100%" height="300">
|
||||
</div>
|
||||
<div class="carousel-item">
|
||||
<img src="https://via.placeholder.com/800x300.png?text=3" class="d-block w-100" alt="..." width="100%" height="300">
|
||||
</div>
|
||||
</div>
|
||||
<button class="carousel-control-prev" type="button" data-bs-target="#carousel" data-bs-slide="prev" width="100%" height="300">
|
||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||
<span class="visually-hidden">Previous</span>
|
||||
</button>
|
||||
<button class="carousel-control-next" type="button" data-bs-target="#carousel" data-bs-slide="next">
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
<span class="visually-hidden">Next</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="container px-3 py-3">
|
||||
<div class="row g-2">
|
||||
<div class="feature col">
|
||||
<a href="#" class="feature-icon d-block">
|
||||
<img src="https://via.placeholder.com/600x300.png?text=4" alt="" width="100%" />
|
||||
</a>
|
||||
<h3 class="fs-2 mt-2 text-center">
|
||||
<a href="#">共性指标</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="feature col">
|
||||
<a href="#" class="feature-icon d-block">
|
||||
<img src="https://via.placeholder.com/600x300.png?text=5" alt="" width="100%" />
|
||||
</a>
|
||||
<h3 class="fs-2 mt-2 text-center">
|
||||
<a href="#">进阶指标</a>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container px-3 py-3">
|
||||
<div class="card bg-danger">
|
||||
<div class="card-header text-white">
|
||||
五星党员
|
||||
</div>
|
||||
<ol class="list-group list-group-flush list-group-numbered">
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<img src="https://via.placeholder.com/32x32.png?text=A" alt="" width="32" height="32" class="rounded-circle flex-shrink-0">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>姓名1</b>
|
||||
<small class="opacity-50 text-nowrap">党支部</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<img src="https://via.placeholder.com/32x32.png?text=A" alt="" width="32" height="32" class="rounded-circle flex-shrink-0">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>姓名2</b>
|
||||
<small class="opacity-50 text-nowrap">党支部</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<img src="https://via.placeholder.com/32x32.png?text=A" alt="" width="32" height="32" class="rounded-circle flex-shrink-0">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>姓名3</b>
|
||||
<small class="opacity-50 text-nowrap">党支部</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<img src="https://via.placeholder.com/32x32.png?text=A" alt="" width="32" height="32" class="rounded-circle flex-shrink-0">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>姓名4</b>
|
||||
<small class="opacity-50 text-nowrap">党支部</small>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container px-3 py-3">
|
||||
<div class="card bg-warning">
|
||||
<div class="card-header text-white">五星支部</div>
|
||||
<ol class="list-group list-group-flush list-group-numbered">
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>党支部1</b>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>党支部2</b>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>党支部2</b>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex gap-3 py-3">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<b>党支部2</b>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<!doctype html>
|
||||
<html lang="{{ str_replace('_', '-', config('app.locale')) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>@yield('title')</title>
|
||||
<link href="{{ url('bootstrap/bootstrap.min.css') }}" rel="stylesheet">
|
||||
@yield('style')
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar bg-dark border-bottom border-body" data-bs-theme="dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">{{ config('admin.name') }}</a>
|
||||
{{-- <ul class="nav nav-pills py-2">--}}
|
||||
{{-- <li class="nav-item"><a href="#" class="nav-link active" aria-current="page">Home</a></li>--}}
|
||||
{{-- <li class="nav-item"><a href="#" class="nav-link">Features</a></li>--}}
|
||||
{{-- <li class="nav-item"><a href="#" class="nav-link">Pricing</a></li>--}}
|
||||
{{-- <li class="nav-item"><a href="#" class="nav-link">FAQs</a></li>--}}
|
||||
{{-- </ul>--}}
|
||||
@if(auth('web')->check())
|
||||
<div class="flex-shrink-0 dropdown">
|
||||
<a href="#" class="d-block link-body-emphasis text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<img src="{{ auth('web')->user()->avatar }}" alt="{{ auth('web')->user()->name }}" width="32" height="32" class="rounded-circle">
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end">
|
||||
<li><a class="dropdown-item" href="{{ url('/profile') }}">个人中心</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="{{ url('/logout') }}">退出</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
<a href="{{ url('/login') }}" class="btn btn btn-outline-primary">登录</a>
|
||||
@endif
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@foreach($errors->all() as $error)
|
||||
<div class="alert alert-warning alert-dismissible" role="alert">
|
||||
{{ $error }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
@endforeach
|
||||
@yield('content')
|
||||
<div class="container">
|
||||
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
|
||||
<p class="col-md-4 mb-0 text-body-secondary">© 2023 Company, Inc</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{ url('bootstrap/bootstrap.bundle.min.js') }}"></script>
|
||||
@yield('script')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
@extends('layout')
|
||||
@section('style')
|
||||
<style>
|
||||
.form-login {
|
||||
max-width: 330px;
|
||||
padding: 1rem;
|
||||
}
|
||||
.form-login input[name="username"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.form-login input[name="password"] {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="form-login w-100 m-auto">
|
||||
<form action="{{ url('/login') }}" method="post">
|
||||
{{ csrf_field() }}
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="请输入用户名" required>
|
||||
<label for="username">用户名</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="请输入密码" required>
|
||||
<label for="password">密码</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-100 py-2">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
@extends('layout')
|
||||
@section('title')
|
||||
考核填报
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<form class="py-3" action="" method="post" enctype="multipart/form-data">
|
||||
<div class="mb-3 row">
|
||||
<label for="input-title" class="col-2 col-form-label">{{ __('user_score.title') }}</label>
|
||||
<div class="col-10">
|
||||
<input type="text" class="form-control" id="input-title" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="input-content" class="col-2 col-form-label">{{ __('user_score.content') }}</label>
|
||||
<div class="col-10">
|
||||
<textarea class="form-control" name="content" id="input-content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="input-images" class="col-2 col-form-label">{{ __('user_score.images') }}</label>
|
||||
<div class="col-10">
|
||||
<input type="file" class="form-control" id="input-images" name="images[]" multiple />
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="input-file" class="col-2 col-form-label">{{ __('user_score.file') }}</label>
|
||||
<div class="col-10">
|
||||
<input type="file" class="form-control" id="input-file" name="file" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-10 offset-2">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@extends('layout')
|
||||
@section('title')
|
||||
考核填报
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="list-group py-3">
|
||||
<a href="{{ url('score/add') }}" class="list-group-item">政治忠诚</a>
|
||||
<a href="{{ url('score/add') }}" class="list-group-item">政治忠诚</a>
|
||||
<a href="{{ url('score/add') }}" class="list-group-item">政治忠诚</a>
|
||||
<a href="{{ url('score/add') }}" class="list-group-item">政治忠诚</a>
|
||||
<a href="{{ url('score/add') }}" class="list-group-item">政治忠诚</a>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
@extends('layout')
|
||||
@section('title')
|
||||
个人中心
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="card my-3">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<img src="https://via.placeholder.com/64x64.png?A" alt="a" class="rounded-circle" width="48" height="48" />
|
||||
<b>姓名</b>
|
||||
</div>
|
||||
<span class="badge bg-danger rounded-pill">党支部</span>
|
||||
</div>
|
||||
<div class="list-group list-group-flush">
|
||||
<div class="list-group-item d-flex justify-content-center">
|
||||
<div id="echart" style="height: 250px;width: 330px;"></div>
|
||||
</div>
|
||||
<div class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<b>当前得星: 10</b>
|
||||
<span class="badge bg-danger rounded-pill">排名: 12</span>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<b>历史得星: 20</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-between">
|
||||
<a href="{{ url('score/select') }}" class="btn btn-primary">考核填报</a>
|
||||
<a href="" class="btn btn-secondary">意见反馈</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('script')
|
||||
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.4.3/echarts.js"></script>
|
||||
<script>
|
||||
var element = document.getElementById('echart');
|
||||
var chart = echarts.init(element);
|
||||
var option = {
|
||||
radar: {
|
||||
indicator: [
|
||||
{ name: '政治忠诚', max: 50 },
|
||||
{ name: '政治定力', max: 50 },
|
||||
{ name: '政治担当', max: 50 },
|
||||
{ name: '政治能力', max: 50 },
|
||||
{ name: '政治自律', max: 50 },
|
||||
]
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'radar',
|
||||
areaStyle: {
|
||||
opacity: 0.9
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: [33, 14, 28, 26, 42],
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
chart.setOption(option)
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -13,4 +13,14 @@ use Illuminate\Support\Facades\Route;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::redirect('/', '/admin');
|
||||
Route::view('/', 'index');
|
||||
|
||||
Route::view('/login', 'login')->middleware('guest:web');
|
||||
Route::post('/login', [\App\Http\Controllers\Web\AuthController::class, 'login']);
|
||||
Route::group(['middleware' => 'auth:web'], function () {
|
||||
Route::any('/logout', [\App\Http\Controllers\Web\AuthController::class, 'logout'])->middleware('auth:web');
|
||||
|
||||
Route::view('profile', 'user.profile');
|
||||
Route::view('score/select', 'score.select-category');
|
||||
Route::view('score/add', 'score.add');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue