优化后台分类 品牌 商品 多语言

This commit is contained in:
pushuo 2022-08-31 09:02:26 +08:00
parent f636ffc08d
commit 26983bcf8c
9 changed files with 218 additions and 50 deletions

142
public/vendor/element-ui/language/en.js vendored Normal file
View File

@ -0,0 +1,142 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('element/locale/en', ['module', 'exports'], factory);
} else if (typeof exports !== "undefined") {
factory(module, exports);
} else {
var mod = {
exports: {}
};
factory(mod, mod.exports);
global.ELEMENT.lang = global.ELEMENT.lang || {};
global.ELEMENT.lang.en = mod.exports;
}
})(this, function (module, exports) {
'use strict';
exports.__esModule = true;
exports.default = {
el: {
colorpicker: {
confirm: 'OK',
clear: 'Clear'
},
datepicker: {
now: 'Now',
today: 'Today',
cancel: 'Cancel',
clear: 'Clear',
confirm: 'OK',
selectDate: 'Select date',
selectTime: 'Select time',
startDate: 'Start Date',
startTime: 'Start Time',
endDate: 'End Date',
endTime: 'End Time',
prevYear: 'Previous Year',
nextYear: 'Next Year',
prevMonth: 'Previous Month',
nextMonth: 'Next Month',
year: '',
month1: 'January',
month2: 'February',
month3: 'March',
month4: 'April',
month5: 'May',
month6: 'June',
month7: 'July',
month8: 'August',
month9: 'September',
month10: 'October',
month11: 'November',
month12: 'December',
week: 'week',
weeks: {
sun: 'Sun',
mon: 'Mon',
tue: 'Tue',
wed: 'Wed',
thu: 'Thu',
fri: 'Fri',
sat: 'Sat'
},
months: {
jan: 'Jan',
feb: 'Feb',
mar: 'Mar',
apr: 'Apr',
may: 'May',
jun: 'Jun',
jul: 'Jul',
aug: 'Aug',
sep: 'Sep',
oct: 'Oct',
nov: 'Nov',
dec: 'Dec'
}
},
select: {
loading: 'Loading',
noMatch: 'No matching data',
noData: 'No data',
placeholder: 'Select'
},
cascader: {
noMatch: 'No matching data',
loading: 'Loading',
placeholder: 'Select',
noData: 'No data'
},
pagination: {
goto: 'Go to',
pagesize: '/page',
total: 'Total {total}',
pageClassifier: ''
},
messagebox: {
title: 'Message',
confirm: 'OK',
cancel: 'Cancel',
error: 'Illegal input'
},
upload: {
deleteTip: 'press delete to remove',
delete: 'Delete',
preview: 'Preview',
continue: 'Continue'
},
table: {
emptyText: 'No Data',
confirmFilter: 'Confirm',
resetFilter: 'Reset',
clearFilter: 'All',
sumText: 'Sum'
},
tree: {
emptyText: 'No Data'
},
transfer: {
noMatch: 'No matching data',
noData: 'No data',
titles: ['List 1', 'List 2'], // to be translated
filterPlaceholder: 'Enter keyword', // to be translated
noCheckedFormat: '{total} items', // to be translated
hasCheckedFormat: '{checked}/{total} checked' // to be translated
},
image: {
error: 'FAILED'
},
pageHeader: {
title: 'Back' // to be translated
},
popconfirm: {
confirmButtonText: 'Yes',
cancelButtonText: 'No'
},
empty: {
description: 'No Data'
}
}
};
module.exports = exports['default'];
});

View File

@ -1,44 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<base href="{{ $admin_base_url }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="asset" content="{{ asset('/') }}">
<meta name="editor_language" content="{{ locale() }}">
<script src="{{ asset('vendor/vue/2.7/vue.js') }}"></script>
<script src="{{ asset('vendor/element-ui/2.6.2/js.js') }}"></script>
<script src="{{ asset('vendor/jquery/jquery-3.6.0.min.js') }}"></script>
<script src="{{ asset('vendor/layer/3.5.1/layer.js') }}"></script>
<script src="{{ asset('vendor/bootstrap/5.1.3/js/bootstrap.bundle.min.js') }}"></script>
<link href="{{ mix('/build/beike/admin/css/bootstrap.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('vendor/element-ui/2.6.2/css.css') }}">
<link href="{{ mix('build/beike/admin/css/app.css') }}" rel="stylesheet">
<script src="{{ mix('build/beike/admin/js/app.js') }}"></script>
<title>BeikeShop - @yield('title')</title>
@stack('header')
{{-- <x-analytics /> --}}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<base href="{{ $admin_base_url }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="asset" content="{{ asset('/') }}">
<meta name="editor_language" content="{{ locale() }}">
<script src="{{ asset('vendor/vue/2.7/vue.js') }}"></script>
<script src="{{ asset('vendor/element-ui/2.6.2/js.js') }}"></script>
<script src="{{ asset('vendor/jquery/jquery-3.6.0.min.js') }}"></script>
<script src="{{ asset('vendor/layer/3.5.1/layer.js') }}"></script>
<script src="{{ asset('vendor/bootstrap/5.1.3/js/bootstrap.bundle.min.js') }}"></script>
<link href="{{ mix('/build/beike/admin/css/bootstrap.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('vendor/element-ui/2.6.2/css.css') }}">
@if (locale() != 'zh_cn')
<script src="{{ asset('vendor/element-ui/language/' . locale() . '.js') }}"></script>
@endif
<link href="{{ mix('build/beike/admin/css/app.css') }}" rel="stylesheet">
<script src="{{ mix('build/beike/admin/js/app.js') }}"></script>
<title>BeikeShop - @yield('title')</title>
@stack('header')
{{-- <x-analytics /> --}}
</head>
<body class="@yield('body-class')">
<!-- <div style="height: 80px; background: white;"></div> -->
<!-- <div style="height: 80px; background: white;"></div> -->
<x-admin-header/>
<x-admin-header />
<div class="main-content">
<aside class="sidebar navbar-expand-xs border-radius-xl">
<x-admin-sidebar/>
</aside>
<div id="content">
<div class="page-title-box py-1 d-flex align-items-center justify-content-between">
<h5 class="page-title">@yield('title')</h5>
@yield('page-title-right')
</div>
<div class="container-fluid p-0">
@yield('content')
<div class="main-content">
<aside class="sidebar navbar-expand-xs border-radius-xl">
<x-admin-sidebar />
</aside>
<div id="content">
<div class="page-title-box py-1 d-flex align-items-center justify-content-between">
<h5 class="page-title">@yield('title')</h5>
@yield('page-title-right')
</div>
<div class="container-fluid p-0">
@yield('content')
</div>
</div>
</div>
</div>
@stack('footer')
<script>
@if (locale() != 'zh_cn')
ELEMENT.locale(ELEMENT.lang['{{ locale() }}'])
@endif
</script>
@stack('footer')
</body>
</html>

View File

@ -144,7 +144,7 @@
this.$refs[form].validate((valid) => {
if (!valid) {
this.$message.error('请检查表单是否填写正确');
this.$message.error('{{ __('common.error_form') }}');
return;
}
@ -163,9 +163,9 @@
deleteItem(id, index) {
const self = this;
this.$confirm('确定要删除品牌吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('{{ __('common.error_form') }}', '{{ __('common.text_hint') }}', {
confirmButtonText: '{{ __('common.confirm') }}',
cancelButtonText: '{{ __('common.cancel') }}',
type: 'warning'
}).then(() => {
$http.delete('brands/' + id).then((res) => {

View File

@ -1,10 +1,10 @@
@extends('admin::layouts.master')
@section('title', '分类管理')
@section('title', __('admin/common.category'))
@section('content')
<div id="category-app" class="card">
<div class="card-header">编辑分类</div>
<div class="card-header">{{ __('admin/category.edit_category') }}</div>
<div class="card-body">
<form class="needs-validation" novalidate action="{{ admin_route($category->id ? 'categories.update' : 'categories.store', $category) }}"
method="POST">
@ -16,17 +16,17 @@
<x-admin-alert type="success" msg="{{ session('success') }}" class="mt-4"/>
@endif
<x-admin-form-input-locale name="descriptions.*.name" title="名称" :value="$descriptions" :required="true" />
<x-admin-form-input-locale name="descriptions.*.content" title="内容" :value="$descriptions" />
<x-admin-form-input-locale name="descriptions.*.name" title="{{ __('common.name') }}" :value="$descriptions" :required="true" />
<x-admin-form-input-locale name="descriptions.*.content" title="{{ __('admin/builder.modules_content') }}" :value="$descriptions" />
{{-- <x-admin-form-select title="上级分类" name="parent_id" :value="old('parent_id', $category->parent_id ?? 0)" :options="$categories->toArray()" key="id" label="name" /> --}}
<x-admin::form.row title="上级分类">
<x-admin::form.row title="{{ __('admin/category.upper_category') }}">
@php
$_parent_id = old('parent_id', $category->parent_id ?? 0);
@endphp
<select name="parent_id" id="" class="form-control short wp-400">
<option value="0">--请选择--</option>
<option value="0">--{{ __('common.please_choose') }}--</option>
@foreach ($categories as $_category)
<option value="{{ $_category->id }}" {{ $_parent_id == $_category->id ? 'selected' : '' }}>
{{ $_category->name }}
@ -35,10 +35,10 @@
</select>
</x-admin::form.row>
<x-admin-form-switch title="状态" name="active" :value="old('active', $category->active ?? 1)" />
<x-admin-form-switch title="{{ __('common.status') }}" name="active" :value="old('active', $category->active ?? 1)" />
<x-admin::form.row>
<button type="submit" class="btn btn-primary mt-3">保存</button>
<button type="submit" class="btn btn-primary mt-3">{{ __('common.save') }}</button>
</x-admin::form.row>
</form>

View File

@ -242,7 +242,7 @@
},
batchDelete() {
this.$confirm('确认要批量删除选中的商品吗?', '删除商品', {
this.$confirm('{{ __('admin/product.confirm_batch_product') }}', '{{ __('common.text_hint') }}', {
type: 'warning'
}).then(() => {
$http.delete('products/delete', {
@ -255,7 +255,7 @@
},
batchActive(type) {
this.$confirm('确认要批量修改选中的商品的状态吗?', '修改状态', {
this.$confirm('{{ __('admin/product.confirm_batch_status') }}', '{{ __('common.text_hint') }}', {
type: 'warning'
}).then(() => {
$http.post('products/status', {
@ -281,7 +281,7 @@
deleteProduct: function(index) {
const product = this.product.data[index];
this.$confirm('确认要删除商品吗?', '删除商品', {
this.$confirm('{{ __('common.confirm_delete') }}', '{{ __('common.text_hint') }}', {
type: 'warning'
}).then(() => {
$http.delete('products/' + product.id).then((res) => {
@ -293,7 +293,7 @@
restoreProduct: function(index) {
const product = this.product.data[index];
this.$confirm('确认要恢复选中的商品吗?', '恢复商品', {
this.$confirm('{{ __('admin/product.confirm_batch_restore') }}', '{{ __('common.text_hint') }}', {
type: 'warning'
}).then(() => {
$http.put('products/restore', {
@ -305,7 +305,7 @@
},
clearRestore() {
this.$confirm('确认要清空回收站吗?', '提示', {
this.$confirm('{{ __('admin/product.confirm_delete_restore') }}', '{{ __('common.text_hint') }}', {
type: 'warning'
}).then(() => {
$http.post('products/trashed/clear').then((res) => {

View File

@ -11,6 +11,8 @@
return [
'index' => 'Category',
'edit_category' => 'Edit Category',
'upper_category' => 'Upper Category',
'categories_index' => 'Index',
'categories_create' => 'Create',

View File

@ -37,4 +37,9 @@ return [
'add_variable_value' => 'Add Specification Value',
'add_variable_image' => 'Add Spec Image',
'default_main_product' => 'Default main product',
'confirm_batch_product' => 'Are you sure you want to delete the selected products in batches? ',
'confirm_batch_status' => 'Confirm to modify the status of the selected products in batches? ',
'confirm_batch_restore' => 'Confirm to restore the selected product? ',
'confirm_delete_restore' => 'Are you sure you want to empty the recycle bin? ',
];

View File

@ -11,6 +11,8 @@
return [
'index' => '分类',
'edit_category' => '编辑分类',
'upper_category' => '上级分类',
'categories_index' => '分类列表',
'categories_create' => '创建分类',

View File

@ -38,4 +38,9 @@ return [
'add_variable_value' => '添加规格值',
'add_variable_image' => '添加规格图片',
'default_main_product' => '默认主商品',
'confirm_batch_product' => '确认要批量删除选中的商品吗?',
'confirm_batch_status' => '确认要批量修改选中的商品的状态吗?',
'confirm_batch_restore' => '确认要恢复选中的商品吗?',
'confirm_delete_restore' => '确认要清空回收站吗?',
];