Compare commits
7 Commits
7dafb62a97
...
defb971d62
Author | SHA1 | Date | |
---|---|---|---|
defb971d62 | |||
a469cd3bac | |||
cff04fbcd8 | |||
b0aeb5260d | |||
87753e987d | |||
c406baeac5 | |||
265a0f4790 |
|
@ -18,7 +18,7 @@
|
|||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Nette\Schema\ValidationException;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class Link extends Controller
|
||||
{
|
||||
|
@ -30,37 +30,51 @@ public function __construct()
|
|||
$this->data = $data->data;
|
||||
}
|
||||
|
||||
protected function viewLink(Request $request): Factory|View|Application
|
||||
{
|
||||
$this->data['webSubTitle'] = '友链';
|
||||
$this->GetFriendsLink($this->data);
|
||||
return view('function.link',$this->data);
|
||||
}
|
||||
|
||||
protected function viewMakeFriend(): Factory|View|Application
|
||||
{
|
||||
$this->data['webSubTitle'] = '添加友链';
|
||||
return view('function.make-friend',$this->data);
|
||||
}
|
||||
|
||||
public function apiCustomAdd(Request $request): JsonResponse
|
||||
{
|
||||
/** @var array $returnData Json的 return 返回值 */
|
||||
/** @var Validator $dataCheck 数据判断 */
|
||||
/** @var array $errorInfo 错误信息 */
|
||||
/** @var array $errorSingle 输出单个错误信息 */
|
||||
// 检查数据
|
||||
try {
|
||||
$request->validate([
|
||||
'userEmail' => 'required|email',
|
||||
'userServerHost' => 'required|string',
|
||||
'userBlog' => 'required|string',
|
||||
'userUrl' => 'required|string',
|
||||
'userDescription' => 'required|string',
|
||||
'userIcon' => 'required|string',
|
||||
'checkRssJudge' => 'boolean',
|
||||
'userRss' => 'string',
|
||||
'userLocation' => 'required|int',
|
||||
'userSelColor' => 'required|int',
|
||||
'userRemark' => 'required|string',
|
||||
]);
|
||||
$dataCheck = Validator::make($request->all(), [
|
||||
'userEmail' => 'required|email',
|
||||
'userServerHost' => 'required|string',
|
||||
'userBlog' => 'required|string',
|
||||
'userUrl' => 'required|regex:#[a-zA-z]+://[^\s]*#',
|
||||
'userDescription' => 'required|string',
|
||||
'userIcon' => 'required|regex:#[a-zA-z]+://[^\s]*#',
|
||||
'checkRssJudge' => 'boolean',
|
||||
'userRss' => 'string|regex:#[a-zA-z]+://[^\s]*#',
|
||||
'userLocation' => 'required|int',
|
||||
'userSelColor' => 'required|int',
|
||||
'userRemark' => 'required|string',
|
||||
]);
|
||||
|
||||
// 检查发现错误
|
||||
if ($dataCheck->fails()) {
|
||||
$errorType = array_keys($dataCheck->failed());
|
||||
$i = 0;
|
||||
foreach ($dataCheck->failed() as $valueData) {
|
||||
$errorInfo[$errorType[$i]] = array_keys($valueData);
|
||||
if ($i == 0) {
|
||||
$errorSingle = [
|
||||
'info' => $errorType[$i],
|
||||
'need' => $errorInfo[$errorType[$i]],
|
||||
];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$returnData = [
|
||||
'output' => 'DataFormatError',
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => '输入内容有错误',
|
||||
'errorSingle' => $errorSingle,
|
||||
'error' => $errorInfo,
|
||||
],
|
||||
];
|
||||
} else {
|
||||
// 检查数据
|
||||
if (empty($request->checkRssJudge)) {
|
||||
$request->checkRssJudge = 0;
|
||||
|
@ -69,9 +83,9 @@ public function apiCustomAdd(Request $request): JsonResponse
|
|||
// 根据数据库检查邮箱用户是否已存在
|
||||
$resultBlog = DB::table('blog_link')
|
||||
->where([
|
||||
['blogOwnEmail','=',$request->userEmail,'or'],
|
||||
['blogName','=',$request->userBlog,'or'],
|
||||
['blogUrl','=',$request->userUrl,'or']
|
||||
['blogOwnEmail', '=', $request->userEmail, 'or'],
|
||||
['blogName', '=', $request->userBlog, 'or'],
|
||||
['blogUrl', '=', $request->userUrl, 'or']
|
||||
])->get()->toArray();
|
||||
|
||||
if (empty($resultBlog)) {
|
||||
|
@ -91,11 +105,11 @@ public function apiCustomAdd(Request $request): JsonResponse
|
|||
]);
|
||||
if ($insertData) {
|
||||
// 邮件发送系统
|
||||
Mail::send('mail.link-custom-add',$request->toArray(),function (Message $mail) {
|
||||
Mail::send('mail.link-custom-add', $request->toArray(), function (Message $mail) {
|
||||
global $request;
|
||||
$mail->from(env('MAIL_USERNAME'),env('APP_NAME'));
|
||||
$mail->from(env('MAIL_USERNAME'), env('APP_NAME'));
|
||||
$mail->to($request->userEmail);
|
||||
$mail->subject(env('APP_NAME').'-友链等待审核通知');
|
||||
$mail->subject(env('APP_NAME') . '-友链等待审核通知');
|
||||
});
|
||||
// 消息成功通知
|
||||
$returnData = [
|
||||
|
@ -115,24 +129,48 @@ public function apiCustomAdd(Request $request): JsonResponse
|
|||
],
|
||||
];
|
||||
}
|
||||
} catch (ValidationException $exception) {
|
||||
$errors = $exception->validator->errors();
|
||||
$returnData = [
|
||||
'output' => 'DataFormatError',
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => '输入内容有错误',
|
||||
'error' => $errors,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return Response::json($returnData,$returnData['code']);
|
||||
return Response::json($returnData, $returnData['code']);
|
||||
}
|
||||
|
||||
protected function viewLink(Request $request): Factory|View|Application
|
||||
{
|
||||
$this->data['webSubTitle'] = '友链';
|
||||
$this->GetFriendsLink($this->data);
|
||||
return view('function.link', $this->data);
|
||||
}
|
||||
|
||||
private function GetFriendsLink(array &$data): void
|
||||
{
|
||||
$data['blogLink'] = DB::table('blog_link')->whereNotIn('blog_link.blogLocation',[0])->get()->toArray();
|
||||
$data['blogLink'] = DB::table('blog_link')->whereNotIn('blog_link.blogLocation', [0])->get()->toArray();
|
||||
$data['blogSort'] = DB::table('blog_sort')->orderBy('blog_sort.sort')->get()->toArray();
|
||||
}
|
||||
|
||||
protected function viewMakeFriend(): Factory|View|Application
|
||||
{
|
||||
$this->data['webSubTitle'] = '添加友链';
|
||||
$this->data['blogColor'] = DB::table('blog_color')
|
||||
->orderBy('id')
|
||||
->get()
|
||||
->toArray();
|
||||
$this->data['blogSort'] = DB::table('blog_sort')
|
||||
->orderBy('sort')
|
||||
->get()
|
||||
->toArray();
|
||||
return view('function.make-friend', $this->data);
|
||||
}
|
||||
|
||||
protected function viewEditFriend(): Factory|View|Application
|
||||
{
|
||||
$this->data['webSubTitle'] = '修改友链';
|
||||
|
||||
return view('function.edit-friend', $this->data);
|
||||
}
|
||||
|
||||
protected function viewSearchFriends(): Factory|View|Application
|
||||
{
|
||||
$this->data['webSubTitle'] = '查询列表';
|
||||
return view('function.edit-search', $this->data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ri
|
|||
<div>
|
||||
<button type="submit"
|
||||
class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||
onclick="user_change()">
|
||||
onclick="buttonLogin()">
|
||||
登录
|
||||
</button>
|
||||
</div>
|
||||
|
@ -63,22 +63,22 @@ class="font-semibold leading-6 text-indigo-600 hover:text-indigo-500">点击注
|
|||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<script src="{{ asset('js/jquery.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function user_change() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
method: "POST",
|
||||
data: $('#FormData').serialize(),
|
||||
url: '{{ route('api.auth.login') }}',
|
||||
dataType: "json",
|
||||
success: function (returnData) {
|
||||
if (returnData.output === "Success") {
|
||||
window.location.href = '{{ route('home') }}'
|
||||
} else {
|
||||
window.alert("错误!")
|
||||
}
|
||||
function buttonLogin() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
method: "POST",
|
||||
data: $('#FormData').serialize(),
|
||||
url: '{{ route('api.auth.login') }}',
|
||||
dataType: "json",
|
||||
success: function (returnData) {
|
||||
if (returnData.output === "Success") {
|
||||
window.location.href = '{{ route('home') }}'
|
||||
} else {
|
||||
window.alert("错误!")
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{!! $webFooter !!}
|
||||
</html>
|
||||
|
|
|
@ -49,7 +49,7 @@ class="w-16 h-16 p-1 rounded-full ring-2 ring-gray-300 dark:ring-gray-500 me-2 s
|
|||
|
||||
<div data-dial-init class="fixed right-6 bottom-6 group">
|
||||
<div id="speed-dial-menu-square" class="flex flex-col items-center hidden mb-4 space-y-2">
|
||||
<a href="{{ route('function.make-friend') }}" type="button" data-tooltip-target="tooltip-print" data-tooltip-placement="left" class="flex justify-center items-center w-[52px] h-[52px] text-gray-500 hover:text-gray-900 bg-red-100 rounded-lg border border-gray-200 dark:border-gray-600 shadow-sm dark:hover:text-white dark:text-gray-400 hover:bg-red-200 dark:bg-gray-700 dark:hover:bg-gray-600 focus:ring-4 focus:ring-gray-300 focus:outline-none dark:focus:ring-gray-400">
|
||||
<a href="{{ route('account.friend.link') }}" type="button" data-tooltip-target="tooltip-print" data-tooltip-placement="left" class="flex justify-center items-center w-[52px] h-[52px] text-gray-500 hover:text-gray-900 bg-red-100 rounded-lg border border-gray-200 dark:border-gray-600 shadow-sm dark:hover:text-white dark:text-gray-400 hover:bg-red-200 dark:bg-gray-700 dark:hover:bg-gray-600 focus:ring-4 focus:ring-gray-300 focus:outline-none dark:focus:ring-gray-400">
|
||||
<i class="bi bi-trash3"></i>
|
||||
<span class="sr-only">删除友链</span>
|
||||
</a>
|
||||
|
@ -57,7 +57,7 @@ class="w-16 h-16 p-1 rounded-full ring-2 ring-gray-300 dark:ring-gray-500 me-2 s
|
|||
删除
|
||||
<div class="tooltip-arrow" data-popper-arrow></div>
|
||||
</div>
|
||||
<a href="{{ route('function.make-friend') }}" type="button" data-tooltip-target="tooltip-download" data-tooltip-placement="left" class="flex justify-center items-center w-[52px] h-[52px] text-gray-500 hover:text-gray-900 bg-white rounded-lg border border-gray-200 dark:border-gray-600 shadow-sm dark:hover:text-white dark:text-gray-400 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 focus:ring-4 focus:ring-gray-300 focus:outline-none dark:focus:ring-gray-400">
|
||||
<a href="{{ route('function.edit-search') }}" type="button" data-tooltip-target="tooltip-download" data-tooltip-placement="left" class="flex justify-center items-center w-[52px] h-[52px] text-gray-500 hover:text-gray-900 bg-white rounded-lg border border-gray-200 dark:border-gray-600 shadow-sm dark:hover:text-white dark:text-gray-400 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 focus:ring-4 focus:ring-gray-300 focus:outline-none dark:focus:ring-gray-400">
|
||||
<i class="bi bi-pencil"></i>
|
||||
<span class="sr-only">修改友链</span>
|
||||
</a>
|
||||
|
|
|
@ -23,7 +23,7 @@ class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translat
|
|||
<div class="mx-auto my-10 max-w-4xl py-8 sm:py-16 lg:py-16">
|
||||
<a href="{{ route('function.link') }}" type="button" class="text-white mb-5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-3 py-2 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"><i class="bi bi-box-arrow-left me-1"></i> 返回友链</a>
|
||||
<div class="w-full p-4 bg-white border border-gray-200 rounded-lg shadow-lg sm:p-8 dark:bg-gray-800 dark:border-gray-700">
|
||||
<form>
|
||||
<form id="FormData" action="#" onsubmit="return false" method="POST">
|
||||
<div class="grid gap-6 mb-6 md:grid-cols-2">
|
||||
<div>
|
||||
<label for="userEmail" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">博主邮箱 <span class="text-red-700">*</span></label>
|
||||
|
@ -102,7 +102,7 @@ class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translat
|
|||
<div class="mb-6 grid grid-cols-1 md:grid-cols-3 items-end">
|
||||
<div class="col-span-1 mb-3 md:mb-0">
|
||||
<label class="relative inline-flex">
|
||||
<input type="checkbox" id="checkRssJudge" value="1" class="sr-only peer">
|
||||
<input type="checkbox" id="checkRssJudge" name="checkRssJudge" value="1" class="sr-only peer">
|
||||
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"></div>
|
||||
<span class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">我的博客拥有 RSS 地址</span>
|
||||
</label>
|
||||
|
@ -126,12 +126,15 @@ class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translat
|
|||
<div class="grid gap-6 mb-6 md:grid-cols-2">
|
||||
<div>
|
||||
<label for="userLocation" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">期望板块 <span class="text-red-700">*</span></label>
|
||||
<select id="userLocation" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option selected>请选择一个板块</option>
|
||||
<option value="US">United States</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="DE">Germany</option>
|
||||
<select id="userLocation" name="userLocation" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option>请选择一个板块</option>
|
||||
@if(empty($blogSort[0]))
|
||||
<option>站长没有设置可用板块呢</option>
|
||||
@else
|
||||
@foreach($blogSort as $blogValue)
|
||||
<option value="{{ $blogValue->id }}">{!! $blogValue->title !!}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -149,23 +152,35 @@ class="w-16 h-16 p-1 rounded-full ring-2 ring-gray-300 dark:ring-gray-500 me-2 s
|
|||
</div>
|
||||
<div class="tooltip-arrow" data-popper-arrow></div>
|
||||
</div>
|
||||
<select id="userSelColor" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option selected>请选择一个颜色</option>
|
||||
<option value="US">United States</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="DE">Germany</option>
|
||||
<select id="userSelColor" name="userSelColor" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option>请选择一个颜色</option>
|
||||
@if(empty($blogColor[0]))
|
||||
<option>站长没有设置可用颜色呢</option>
|
||||
@else
|
||||
@foreach($blogColor as $blogValue)
|
||||
<option value="{{ $blogValue->id }}">{!! $blogValue->comment !!}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="userRemark" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">留言备注</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
||||
<i class="bi bi-chat-left-text"></i>
|
||||
</div>
|
||||
<input type="text" name="userRemark" id="userRemark" placeholder="多多关照哦~" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
</div>
|
||||
</div>
|
||||
<hr class="h-px my-8 bg-gray-200 border-0 dark:bg-gray-700">
|
||||
<div class="flex items-start mb-6">
|
||||
<div class="flex items-center h-5">
|
||||
<input id="remember" type="checkbox" value="" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" required>
|
||||
<input id="remember" type="checkbox" value="1" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" required>
|
||||
</div>
|
||||
<label for="remember" class="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">我满足 <a href="#" class="text-blue-600 hover:underline dark:text-blue-500">《凌中的锋雨-友链申请要求》</a></label>
|
||||
</div>
|
||||
<button type="submit" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"><i class="bi bi-send me-1"></i>发送申请</button>
|
||||
<button onclick="buttonSubmit()" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"><i class="bi bi-send me-1"></i>发送申请</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -180,6 +195,38 @@ class="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate
|
|||
@include('modules.footer')
|
||||
</div>
|
||||
</div>
|
||||
<!-- Toast -->
|
||||
<div id="toast" class="z-[9999] fixed top-5 left-5 hidden items-center w-full max-w-xs p-4 space-x-4 text-gray-500 bg-white divide-x divide-gray-200 rounded-lg shadow dark:text-gray-400 dark:divide-gray-700 space-x dark:bg-gray-800" role="alert">
|
||||
<div class="pl-4 text-sm font-normal">
|
||||
<span id="toast-icon" class="pe-1"><i class="bi bi-info-circle text-blue-500"></i></span>
|
||||
<span id="toast-info">Message sent successfully.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toast-interactive" class="z-[9999] fixed top-5 left-5 hidden w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:bg-gray-800 dark:text-gray-400" role="alert">
|
||||
<div class="flex">
|
||||
<div class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 bg-blue-100 rounded-lg dark:text-blue-300 dark:bg-blue-900">
|
||||
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z" clip-rule="evenodd"></path></svg>
|
||||
<span class="sr-only">Refresh icon</span>
|
||||
</div>
|
||||
<div class="ml-3 text-sm font-normal">
|
||||
<span class="mb-1 text-sm font-semibold text-gray-900 dark:text-white">友链已登记</span>
|
||||
<div class="mb-2 text-sm font-normal">已经存有该博客(博客名字、博客地址、博主邮箱不得重复),请确认您没有输入错误吗?<span class="text-red-500">(如果想修改已登记博客,请使用在友链登记邮箱进行注册/登录进行修改)</span></div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div>
|
||||
<a href="{{ route('login') }}" class="inline-flex justify-center w-full px-2 py-1.5 text-xs font-medium text-center text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-500 dark:hover:bg-blue-600 dark:focus:ring-blue-800">登录</a>
|
||||
</div>
|
||||
<div>
|
||||
<a id="edit-friend" href="{{ route('function.edit-friend') }}" class="inline-flex justify-center w-full px-2 py-1.5 text-xs font-medium text-center text-gray-900 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:bg-gray-600 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-700 dark:focus:ring-gray-700">检索</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700" data-dismiss-target="#toast-interactive" aria-label="Close">
|
||||
<span class="sr-only">Close</span>
|
||||
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<script src="{{ asset('js/jquery.js') }}"></script>
|
||||
|
@ -203,6 +250,78 @@ class="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate
|
|||
});
|
||||
})
|
||||
|
||||
|
||||
function buttonSubmit() {
|
||||
if ($('#remember').prop('checked')) {
|
||||
ajax();
|
||||
} else {
|
||||
Toast.toggle('请您确认知情友链申请要求','<i class="bi bi-check-circle text-green-500"></i>');
|
||||
}
|
||||
}
|
||||
|
||||
class Toast {
|
||||
static toggle(data,icon) {
|
||||
this.set(data,icon);
|
||||
$('#toast').fadeIn(300);
|
||||
setTimeout(function () {
|
||||
$('#toast').fadeOut(300);
|
||||
}, 3000);
|
||||
}
|
||||
static set(data,icon) {
|
||||
$('#toast-icon').html(icon);
|
||||
$('#toast-info').text(data);
|
||||
}
|
||||
}
|
||||
|
||||
class Enum {
|
||||
static userEmail = '用户邮箱';
|
||||
static userServerHost = '服务商';
|
||||
static userBlog = '博客名字';
|
||||
static userUrl = '博客地址';
|
||||
static userDescription = '博客描述';
|
||||
static userIcon = '图片地址';
|
||||
static checkRssJudge = 'RSS选项';
|
||||
static userRss = 'RSS地址';
|
||||
static userLocation = '所属位置';
|
||||
static userSelColor = '选择颜色';
|
||||
static userRemark = '留言备注';
|
||||
}
|
||||
|
||||
function ajax() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
method: "POST",
|
||||
data: $('#FormData').serialize(),
|
||||
url: '{{ route('api.link.custom.add') }}',
|
||||
dataType: "json",
|
||||
success: function (returnData) {
|
||||
if (returnData.output === "Success") {
|
||||
Toast.toggle('友链申请成功','<i class="bi bi-check-circle text-green-500"></i>');
|
||||
location.href = '{{ route('home') }}'
|
||||
} else {
|
||||
Toast('未知错误','<i class="bi bi-x-circle text-red-500"></i>');
|
||||
}
|
||||
},
|
||||
error: function (returnData) {
|
||||
Toast.set('其他错误','<i class="bi bi-x-circle text-red-500"></i>');
|
||||
if (returnData.responseJSON.output === 'DataFormatError') {
|
||||
for (let key in Enum) {
|
||||
if (returnData.responseJSON.data.errorSingle.info === key) {
|
||||
Toast.toggle(Enum[key]+'错误,注意格式','<i class="bi bi-x-circle text-red-500"></i>');
|
||||
}
|
||||
}
|
||||
} else if (returnData.responseJSON.output === "AlreadyUser") {
|
||||
$('#toast-interactive').fadeIn(300);
|
||||
$('#edit-friend').attr('href',"{{ route('function.edit-search') }}?searchName="+$('#userBlog').val()+"&searchUrl="+$('#userUrl').val());
|
||||
setTimeout(function () {
|
||||
$('#toast-interactive').fadeOut(300);
|
||||
}, 10000);
|
||||
} else {
|
||||
Toast.toggle('未知错误','<i class="bi bi-x-circle text-red-500"></i>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{!! $webFooter !!}
|
||||
</html>
|
||||
|
|
|
@ -43,6 +43,6 @@
|
|||
|
||||
});
|
||||
Route::prefix('custom')->group(function () {
|
||||
Route::post('add',[Link::class,'apiCustomAdd']);
|
||||
Route::post('add',[Link::class,'apiCustomAdd'])->name('api.link.custom.add');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
Route::prefix('function')->group(function () {
|
||||
Route::get('link',[UserLink::class, 'viewLink'])->name('function.link');
|
||||
Route::get('make-friend',[UserLink::class, 'viewMakeFriend'])->name('function.make-friend');
|
||||
Route::get('edit-search',[UserLink::class, 'viewSearchFriends'])->name('function.edit-search');
|
||||
Route::get('edit-friend',[UserLink::class, 'viewEditFriend'])->name('function.edit-friend');
|
||||
Route::get('sponsor',function () {
|
||||
return view('function.sponsor');
|
||||
})->name('function.sponsor');
|
||||
|
@ -39,6 +41,13 @@
|
|||
})->name('function.music');
|
||||
});
|
||||
|
||||
Route::prefix('account')->middleware('auth')->group(function () {
|
||||
Route::prefix('friend')->group(function () {
|
||||
Route::get('link')->name('account.friend.link');
|
||||
Route::get('edit')->name('account.friend.edit');
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('console')->middleware('auth')->group(function () {
|
||||
Route::get('dashboard', [Dashboard::class,'ViewDashboard'])->name('console.dashboard');
|
||||
Route::prefix('friends-link')->group(function () {
|
||||
|
|
Loading…
Reference in New Issue
Block a user