优化导航菜单项没配置文字不应显示、优化404页面、优化商品详情 分类 品牌 title 显示对应名称、优化后台头部 添加 admin_locale 等

This commit is contained in:
pushuo 2022-12-29 17:44:29 +08:00
parent c2b82b4bee
commit 3c6442d698
26 changed files with 174 additions and 156 deletions

View File

@ -301,6 +301,19 @@ function locale(): string
return Session::get('locale') ?? system_setting('base.locale');
}
/**
* 获取后台当前语言
*
* @return string
*/
function admin_locale(): string
{
if (is_admin()) {
return current_user()->locale;
}
return locale();
}
/**
* 货币格式化
*

View File

@ -18,6 +18,8 @@ class CategoryController extends Controller
{
$products = ProductRepo::getProductsByCategory($category->id);
$category->load('description');
$data = [
'category' => $category,
'products_format' => $products->jsonSerialize(),

View File

@ -8,10 +8,14 @@ use Illuminate\Contracts\View\View;
class NoData extends Component
{
public string $text;
public string $link;
public string $btn;
public function __construct(?string $text = '')
public function __construct(?string $text = '', ?string $link = '', ?string $btn = '')
{
$this->text = $text ?: trans('common.no_data');
$this->link = $link;
$this->btn = $btn;
}
public function render()

View File

@ -13,6 +13,11 @@
src: url('/fonts/poppins/Poppins-Regular.ttf');
}
@font-face {font-family: 'poppins';
src: url('/fonts/poppins/Poppins-Bold.ttf');
font-weight: bold;
}
@font-face {font-family: 'Poppins-Medium';
src: url('/fonts/poppins/Poppins-Medium.ttf');
}

View File

@ -42,12 +42,12 @@
padding: 0;
list-style: none;
> li {
html[lang="zh_cn"] &, html[lang="zh_hk"] &, html[lang="en"] & {
html[lang="zh_cn"] &, html[lang="zh_hk"] &, html[lang="en"] &, html[lang="ja"] & {
padding: 0 1rem;
}
@media screen and (max-width: 1200px) {
html[lang="zh_cn"] &, html[lang="zh_hk"] &, html[lang="en"] & {
html[lang="zh_cn"] &, html[lang="zh_hk"] &, html[lang="en"] &, html[lang="ja"] & {
padding: 0 .2rem;
}
}

View File

@ -3,7 +3,6 @@
<div class="header-left">
<div class="logo">
<a href=""><img src="{{ asset('image/logo.png') }}" class="img-fluid"></a>
{{-- <div class="text-center"><h5 class="mb-0">beike admin</h5></div> --}}
</div>
</div>
<div class="header-right">
@ -14,16 +13,13 @@
</ul>
<ul class="navbar navbar-right">
<li class="nav-item">
<a href="{{ admin_route('marketing.index') }}" class="nav-link"><i class="bi bi-gem"></i>&nbsp;@lang('admin/common.marketing')</a>
</li>
<li class="nav-item">
<a target="_blank" href="{{ shop_route('home.index') }}" class="nav-link"><i class="bi bi-send me-1"></i> @lang('admin/common.access_frontend')</a>
<a href="{{ admin_route('marketing.index') }}" class="nav-link"><i class="bi bi-gem text-primary"></i>&nbsp;@lang('admin/common.marketing')</a>
</li>
<li class="nav-item">
<div class="dropdown">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-bs-toggle="dropdown">{{ $admin_language['name'] }}</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuLink">
@foreach ($admin_languages as $language)
<li><a href="{{ admin_route('edit.locale', ['locale' => $language['code']]) }}" class="dropdown-item">{{ $language['name'] }}</a></li>
@endforeach
@ -33,12 +29,15 @@
<li class="nav-item me-3">
<div class="dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown">
{{-- <img src="http://dummyimage.com/100x100" class="avatar img-fluid rounded-circle me-1"> --}}
<span class="text-dark ml-2">{{ current_user()->name }}</span>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuLink">
<li><a href="{{ admin_route('logout.index') }}" class="dropdown-item"><i class="bi bi-box-arrow-left"></i> {{ __('common.sign_out') }}</a></li>
<li>
<a target="_blank" href="{{ shop_route('home.index') }}" class="dropdown-item"><i class="bi bi-send me-1"></i> @lang('admin/common.access_frontend')</a>
</li>
<li><hr class="dropdown-divider"></li>
<li><a href="{{ admin_route('logout.index') }}" class="dropdown-item"><i class="bi bi-box-arrow-left me-1"></i> {{ __('common.sign_out') }}</a></li>
</ul>
</div>
</li>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ locale() }}">
<html lang="{{ admin_locale() }}">
<head>
<meta charset="UTF-8">
@ -26,7 +26,7 @@
{{-- <x-analytics /> --}}
</head>
<body class="@yield('body-class') {{ locale() }}">
<body class="@yield('body-class') {{ admin_locale() }}">
<x-admin-header />
<div class="main-content">

View File

@ -20,6 +20,11 @@ body[class^="page-account-"] {
src: url('/fonts/poppins/Poppins-Regular.ttf');
}
@font-face {font-family: 'poppins';
src: url('/fonts/poppins/Poppins-Bold.ttf');
font-weight: bold;
}
@font-face {font-family: 'Poppins-Medium';
src: url('/fonts/poppins/Poppins-Medium.ttf');
}

View File

@ -166,7 +166,10 @@ body.page-product {
}
.peoduct-info {
h1 {
.product-name {
font-size: 1.5rem;
line-height: 1.4;
@media (max-width: 768px) {
font-size: 1.2rem;
}

View File

@ -71,6 +71,8 @@ return [
'created_at' => 'Erstellungszeit',
'updated_at' => 'geänderte Zeit',
'sort_order' => 'sortieren',
'error_page' => 'Die Daten, auf die Sie zugegriffen haben, existieren nicht oder wurden gelöscht~',
'error_page_btn' => 'Zurück zur vorherigen Seite',
'order' => [
'unpaid' => 'zu bezahlen',

View File

@ -72,6 +72,8 @@ return [
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'sort_order' => 'Sort Order',
'error_page' => 'The data you accessed does not exist or has been deleted~',
'error_page_btn' => 'Return to previous page',
'order' => [
'unpaid' => 'Unpaid',

View File

@ -71,6 +71,8 @@ return [
'created_at' => 'tiempo de creación',
'updated_at' => 'cambiar el tiempo',
'sort_order' => 'clasificar',
'error_page' => 'Los datos a los que accedió no existen o han sido eliminados~',
'error_page_btn' => 'Volver a la página anterior',
'order' => [
'unpaid' => 'A pagar',

View File

@ -71,6 +71,8 @@ return [
'created_at' => 'temps de creation',
'updated_at' => 'Changer l\'heure',
'sort_order' => 'trier',
'error_page' => 'Les données auxquelles vous avez accédé n\'existent pas ou ont été supprimées~',
'error_page_btn' => 'Retour à la page précédente',
'order' => [
'unpaid' => 'Être payé',

View File

@ -71,6 +71,8 @@ return [
'created_at' => 'tempo di creazione',
'updated_at' => 'Cambia l\'ora',
'sort_order' => 'ordinare',
'error_page' => 'I dati a cui hai effettuato l\'accesso non esistono o sono stati eliminati~',
'error_page_btn' => 'Torna alla pagina precedente',
'order' => [
'unpaid' => 'Essere pagato',

View File

@ -71,6 +71,8 @@ return [
'created_at' => '作成時間',
'updated_at' => '時間を変更する',
'sort_order' => '選別',
'error_page' => 'アクセスしたデータは存在しないか削除されています~',
'error_page_btn' => '前のページに戻る',
'order' => [
'unpaid' => '支払われる',

View File

@ -71,6 +71,8 @@ return [
'created_at' => 'время создания',
'updated_at' => 'измененное время',
'sort_order' => 'сортировать',
'error_page' => 'Данные, к которым вы обращались, не существуют или были удалены~',
'error_page_btn' => 'Вернуться на предыдущую страницу',
'order' => [
'unpaid' => 'подлежит оплате',

View File

@ -72,6 +72,8 @@ return [
'created_at' => '创建时间',
'updated_at' => '修改时间',
'sort_order' => '排序',
'error_page' => '您访问的数据不存在或已被删除~',
'error_page_btn' => '返回上一页',
'order' => [
'unpaid' => '待支付',

View File

@ -71,6 +71,8 @@ return [
'created_at' => '創建時間',
'updated_at' => '修改時間',
'sort_order' => '排序',
'error_page' => '您訪問的數據不存在或已被刪除~',
'error_page_btn' => '返回上一頁',
'order' => [
'unpaid' => '待支付',

View File

@ -1,5 +1,6 @@
@extends('layout.master')
@section('body-class', 'page-categories')
@section('title', $brand->name)
@section('content')
<div class="container">

View File

@ -1,5 +1,6 @@
@extends('layout.master')
@section('body-class', 'page-categories')
@section('title', system_setting('base.meta_title', 'BeikeShop开源好用的跨境电商系统 - BeikeShop官网') .' - '. $category->description->name)
@section('content')
<div class="container">

View File

@ -1,4 +1,7 @@
<div class="d-flex flex-column align-center align-items-center mb-4">
<img src="{{ asset('image/no-data.svg') }}" class="img-fluid wp-400">
<div class="text-secondary fs-4">{{ $text }}</div>
<div class="text-secondary fs-4 mb-3">{{ $text }}</div>
@if ($link)
<a href="{{ $link }}" class="btn btn-primary"><i class="bi bi-box-arrow-left"></i> {{ $btn }}</a>
@endif
</div>

View File

@ -1,5 +1,6 @@
@extends('errors::minimal')
@extends('errors.layout')
@section('title', __('common.error_page'))
@section('title', __('Not Found'))
@section('code', '404')
@section('message', __('Not Found'))
@section('content')
<x-shop-no-data text="{{ __('common.error_page') }}" link="javascript:history.go(-1)" btn="{{ __('common.error_page_btn') }}" />
@endsection

View File

@ -1,53 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title')</title>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title')</title>
<link rel="stylesheet" type="text/css" href="{{ asset('/build/beike/shop/default/css/bootstrap.css') }}">
</head>
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-weight: 100;
height: 100vh;
margin: 0;
}
<body class="page-400">
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title">
@yield('content')
</div>
</div>
</div>
</body>
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.content {
text-align: center;
}
.title {
font-size: 36px;
padding: 20px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title">
@yield('message')
</div>
</div>
</div>
</body>
</html>

View File

@ -1,6 +1,6 @@
@extends('layout.master')
@section('body-class', 'page-product')
@section('title', $product['name'])
@push('header')
<script src="{{ asset('vendor/vue/2.6.14/vue' . (!config('app.debug') ? '.min' : '') . '.js') }}"></script>
@ -51,7 +51,7 @@
<div class="col-12 col-lg-6">
<div class="peoduct-info">
<h1 class="mb-4">{{ $product['name'] }}</h1>
<h1 class="mb-4 product-name">{{ $product['name'] }}</h1>
<div class="price-wrap d-flex align-items-end">
<div class="new-price fs-1 lh-1 fw-bold me-2">@{{ product.price_format }}</div>
<div class="old-price text-muted text-decoration-line-through">@{{ product.origin_price_format }}</div>

View File

@ -1,52 +1,45 @@
<div class="accordion accordion-flush" id="menu-accordion">
@foreach ($menu_content as $key => $menu)
<div class="accordion-item">
<div class="nav-item-text">
<a class="nav-link"
target="{{ isset($menu['new_window']) && $menu['new_window'] ? '_blank' : '_self' }}"
href="{{ $menu['link'] ?? '' }}">
{{ $menu['name'] }}
@if (isset($menu['badge']) && $menu['badge']['name'])
<span class="badge"
style="background-color: {{ $menu['badge']['bg_color'] }}; color: {{ $menu['badge']['text_color'] }}; border-color: {{ $menu['badge']['bg_color'] }}">
@if ($menu['name'])
<div class="accordion-item">
<div class="nav-item-text">
<a class="nav-link" target="{{ isset($menu['new_window']) && $menu['new_window'] ? '_blank' : '_self' }}" href="{{ $menu['link'] ?? '' }}">
{{ $menu['name'] }}
@if (isset($menu['badge']) && $menu['badge']['name'])
<span class="badge" style="background-color: {{ $menu['badge']['bg_color'] }}; color: {{ $menu['badge']['text_color'] }}; border-color: {{ $menu['badge']['bg_color'] }}">
{{ $menu['badge']['name'] }}
</span>
@endif
</a>
@if (isset($menu['children_group']) && $menu['children_group'])
<span class="collapsed" data-bs-toggle="collapse" data-bs-target="#flush-menu-{{ $key }}"><i class="bi bi-chevron-down"></i></span>
@endif
</a>
</div>
@if (isset($menu['children_group']) && $menu['children_group'])
<span class="collapsed" data-bs-toggle="collapse" data-bs-target="#flush-menu-{{ $key }}"><i class="bi bi-chevron-down"></i></span>
@endif
</div>
@if (isset($menu['children_group']) && $menu['children_group'])
<div class="accordion-collapse collapse" id="flush-menu-{{ $key }}" data-bs-parent="#menu-accordion">
@forelse ($menu['children_group'] as $group)
<div class="children-group mb-3">
@if ($group['name'])
<div class="group-name">{{ $group['name'] }}</div>
<div class="children-group mb-3">
@if ($group['name'])
<div class="group-name">{{ $group['name'] }}</div>
@endif
@if ($group['type'] == 'image')
<a target="{{ isset($group['image']['link']['new_window']) && $group['image']['link']['new_window'] ? '_blank' : '_self' }}" href="{{ $group['image']['link'] }}"><img src="{{ $group['image']['image'] }}" class="img-fluid"></a>
@else
<ul class="nav flex-column ul-children">
@foreach ($group['children'] as $children)
@if (!is_array($children['link']['text']) && $children['link']['text'])
<li class="nav-item">
<a target="{{ isset($children['link']['new_window']) && $children['link']['new_window'] ? '_blank' : '_self' }}" class="nav-link px-0" href="{{ $children['link']['link'] }}">{{ $children['link']['text'] }}</a>
</li>
@endif
@if ($group['type'] == 'image')
<a
target="{{ isset($group['image']['link']['new_window']) && $group['image']['link']['new_window'] ? '_blank' : '_self' }}"
href="{{ $group['image']['link'] }}"><img src="{{ $group['image']['image'] }}"
class="img-fluid"></a>
@else
<ul class="nav flex-column ul-children">
@foreach ($group['children'] as $children)
@if (!is_array($children['link']['text']) && $children['link']['text'])
<li class="nav-item">
<a
target="{{ isset($children['link']['new_window']) && $children['link']['new_window'] ? '_blank' : '_self' }}"
class="nav-link px-0"
href="{{ $children['link']['link'] }}">{{ $children['link']['text'] }}</a>
</li>
@endif
@endforeach
</ul>
@endif
</div>
@endforeach
</ul>
@endif
</div>
@endforeach
</div>
@endif
@endif
</div>
@endif
@endforeach
</div>
</div>

View File

@ -1,57 +1,59 @@
<ul class="navbar-nav mx-auto">
@foreach ($menu_content as $menu)
<li
class="nav-item {{ isset($menu['children_group']) ? 'dropdown' : '' }} {{ isset($menu['isFull']) && $menu['isFull'] ? 'position-static' : '' }}">
<a class="nav-link fw-bold {{ isset($menu['children_group']) ? 'dropdown-toggle' : '' }}"
target="{{ isset($menu['new_window']) && $menu['new_window'] ? '_blank' : '_self' }}"
href="{{ $menu['link'] ?: 'javascript:void(0)' }}">
{{ $menu['name'] }}
@if (isset($menu['badge']) && $menu['badge']['name'])
<span class="badge"
style="background-color: {{ $menu['badge']['bg_color'] }}; color: {{ $menu['badge']['text_color'] }}; border-color: {{ $menu['badge']['bg_color'] }}">
{{ $menu['badge']['name'] }}
</span>
@endif
</a>
@if (isset($menu['children_group']) && $menu['children_group'])
<div class="dropdown-menu {{ $menu['isFull'] ? 'w-100' : '' }}"
style="min-width: {{ count($menu['children_group']) * 240 }}px">
<div class="card card-lg">
<div class="card-body">
<div class="container">
<div class="row">
@forelse ($menu['children_group'] as $group)
<div class="col-6 col-md">
@if ($group['name'])
<div class="mb-3 fw-bold group-name">{{ $group['name'] }}</div>
@endif
@if ($group['type'] == 'image')
<a
target="{{ isset($group['image']['link']['new_window']) && $group['image']['link']['new_window'] ? '_blank' : '_self' }}"
href="{{ $group['image']['link'] ?: 'javascript:void(0)' }}"><img src="{{ $group['image']['image'] }}"
class="img-fluid"></a>
@else
<ul class="nav flex-column ul-children">
@foreach ($group['children'] as $children)
@if (!is_array($children['link']['text']) && $children['link']['text'])
<li class="nav-item">
<a
target="{{ isset($children['link']['new_window']) && $children['link']['new_window'] ? '_blank' : '_self' }}"
class="nav-link px-0"
href="{{ $children['link']['link'] ?: 'javascript:void(0)' }}">{{ $children['link']['text'] }}</a>
</li>
@endif
@endforeach
</ul>
@endif
</div>
@endforeach
@if ($menu['name'])
<li
class="nav-item {{ isset($menu['children_group']) ? 'dropdown' : '' }} {{ isset($menu['isFull']) && $menu['isFull'] ? 'position-static' : '' }}">
<a class="nav-link fw-bold {{ isset($menu['children_group']) ? 'dropdown-toggle' : '' }}"
target="{{ isset($menu['new_window']) && $menu['new_window'] ? '_blank' : '_self' }}"
href="{{ $menu['link'] ?: 'javascript:void(0)' }}">
{{ $menu['name'] }}
@if (isset($menu['badge']) && $menu['badge']['name'])
<span class="badge"
style="background-color: {{ $menu['badge']['bg_color'] }}; color: {{ $menu['badge']['text_color'] }}; border-color: {{ $menu['badge']['bg_color'] }}">
{{ $menu['badge']['name'] }}
</span>
@endif
</a>
@if (isset($menu['children_group']) && $menu['children_group'])
<div class="dropdown-menu {{ $menu['isFull'] ? 'w-100' : '' }}"
style="min-width: {{ count($menu['children_group']) * 240 }}px">
<div class="card card-lg">
<div class="card-body">
<div class="container">
<div class="row">
@forelse ($menu['children_group'] as $group)
<div class="col-6 col-md">
@if ($group['name'])
<div class="mb-3 fw-bold group-name">{{ $group['name'] }}</div>
@endif
@if ($group['type'] == 'image')
<a
target="{{ isset($group['image']['link']['new_window']) && $group['image']['link']['new_window'] ? '_blank' : '_self' }}"
href="{{ $group['image']['link'] ?: 'javascript:void(0)' }}"><img src="{{ $group['image']['image'] }}"
class="img-fluid"></a>
@else
<ul class="nav flex-column ul-children">
@foreach ($group['children'] as $children)
@if (!is_array($children['link']['text']) && $children['link']['text'])
<li class="nav-item">
<a
target="{{ isset($children['link']['new_window']) && $children['link']['new_window'] ? '_blank' : '_self' }}"
class="nav-link px-0"
href="{{ $children['link']['link'] ?: 'javascript:void(0)' }}">{{ $children['link']['text'] }}</a>
</li>
@endif
@endforeach
</ul>
@endif
</div>
@endforeach
</div>
</div>
</div>
</div>
</div>
</div>
@endif
</li>
@endif
</li>
@endif
@endforeach
</ul>