优化修改个人信息和页尾配置

This commit is contained in:
pushuo 2022-08-10 20:30:06 +08:00
parent c93b3cf643
commit 944b50969b
11 changed files with 77 additions and 64 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
/node_modules
/public/hot
/public/storage
/public/upload/avatar
/storage/*.key
/vendor
.env

View File

@ -1,11 +1,4 @@
<?php
/*
* @copyright 2022 opencart.cn - All Rights Reserved.
* @link https://www.guangdawangluo.com
* @Author PS <pushuo@opencart.cn>
* @Date 2022-08-10 15:05:22
* @LastEditTime 2022-08-10 15:17:43
*/
/**
* AccountController.php
*

View File

@ -25,7 +25,7 @@ class EditRequest extends FormRequest
{
return [
'name' => 'required',
'email' => 'required|email:rfc,dns|unique:customers,email',
// 'email' => 'required|email:rfc,dns|unique:customers,email',
];
}

View File

@ -12,6 +12,7 @@ use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
use Beike\Shop\View\Components\AccountSidebar;
use Beike\Shop\View\Components\Alert;
class ShopServiceProvider extends ServiceProvider
{
@ -83,6 +84,7 @@ class ShopServiceProvider extends ServiceProvider
{
$this->loadViewComponentsAs('shop', [
'sidebar' => AccountSidebar::class,
'alert' => Alert::class,
]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Beike\Shop\View\Components;
use Illuminate\View\Component;
class Alert extends Component
{
public string $type;
public string $msg;
public function __construct(string $type, string $msg)
{
$this->type = $type;
$this->msg = $msg;
}
public function render()
{
return view('components.alert');
}
}

View File

@ -618,11 +618,6 @@ footer .footer-content a {
footer .footer-content a:hover {
color: #fd560f;
}
@media (min-width: 768px) {
footer .footer-content .footer-content-left {
width: 76%;
}
}
footer .footer-content .logo {
max-width: 150px;
margin-bottom: 20px;

View File

@ -81,7 +81,7 @@
</div>
</el-collapse-item>
@for ($i = 1; $i <= 3; $i++)
<el-collapse-item title="链接栏{{ $i }}" name="top_link{{ $i }}">
<el-collapse-item title="链接栏{{ $i }}" name="footer-content-link{{ $i }}">
<div class="module-edit-group">
<div class="module-edit-title">配置标题</div>
<text-i18n v-model="form.content.link{{ $i }}.title"></text-i18n>
@ -97,7 +97,7 @@
<el-tooltip class="icon-rank" effect="dark" content="拖动排序" placement="left">
<i class="el-icon-rank"></i>
</el-tooltip>
<link-selector :hide-types="['product', 'category']" :show-text="true" v-model="form.content.link{{ $i }}.links[index]"></link-selector>
<link-selector :hide-types="['product', 'category', 'brand']" :show-text="true" v-model="form.content.link{{ $i }}.links[index]"></link-selector>
<div class="remove-item" @click="removeLink('link{{ $i }}', index)"><i class="iconfont">&#xe63a;</i></div>
</div>
</draggable>
@ -106,7 +106,7 @@
</el-collapse-item>
@endfor
<el-collapse-item title="联系我们" name="top_contact">
<el-collapse-item title="联系我们" name="footer-content-contact">
<div class="module-edit-group">
<div class="module-edit-title">联系电话</div>
<el-input placeholder="联系电话" size="small" v-model="form.content.contact.telephone"></el-input>
@ -121,7 +121,7 @@
</div>
</el-collapse-item>
<el-collapse-item title="版权/图片" name="bottom_copyright">
<el-collapse-item title="版权/图片" name="footer-bottom">
<div class="module-edit-group">
<div class="module-edit-title">版权设置</div>
<rich-text-i18n v-model="form.bottom.copyright"></rich-text-i18n>

View File

@ -50,12 +50,6 @@ footer {
}
}
.footer-content-left {
@media (min-width: 768px) {
width: 76%;
}
}
.logo {
max-width: 150px;
margin-bottom: 20px;

View File

@ -31,7 +31,7 @@
{{ method_field('put') }}
@if (session('success'))
@include('shared.form-msg', ['msg' => session('success')])
<x-shop-alert type="success" msg="{{ session('success') }}" class="mt-4"/>
@endif
<div class="bg-light rounded-3 p-4 mb-4" style="background: #f6f9fc;">
@ -40,7 +40,8 @@
<div class="ps-3">
<label class="btn btn-light shadow-sm bg-body mb-2" data-toggle="tooltip" title="Change your avatar">
<i class="bi bi-arrow-repeat"></i> 修改头像
<input type="file" class="d-none" id="update-btn" name="avatar" accept="image/*">
<input type="file" class="d-none" id="update-btn" name="" accept="image/*">
<input type="hidden" id="avatar-input" name="avatar" value="{{ $customer->avatar }}">
</label>
<div class="p mb-0 fs-ms text-muted">上传JPG或PNG图片。建议300 x 300</div>
</div>
@ -49,16 +50,18 @@
<div class="row gx-4 gy-3">
<div class="col-sm-6">
<label class="form-label">名称</label>
<input class="form-control" type="text" name="name" value="{{ $customer->name }}">
<input class="form-control {{ $errors->has('name') ? 'is-invalid' : '' }}" type="text" name="name" value="{{ old('name', $customer->name ?? '') }}">
@if ($errors->has('name'))
<span class="invalid-feedback" role="alert">{{ $errors->first('name') }}</span>
@endif
</div>
<div class="col-sm-6">
<label class="form-label">邮箱</label>
<input class="form-control" type="email" name="email" value="{{ $customer->email }}">
<input class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}" type="email" name="email" value="{{ old('name', $customer->email ?? '') }}">
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">{{ $errors->first('email') }}</span>
@endif
</div>
{{-- <div class="col-sm-6">
<label class="form-label">密码</label>
<input class="form-control" type="password" placeholder="留空则保持原密码不变" name="password" value="">
</div> --}}
<div class="col-12 mt-4">
<button class="btn btn-primary mt-sm-0" type="submit">提交</button>
</div>
@ -148,14 +151,15 @@
height: 200,
});
initialAvatarURL = avatar.src;
avatar.src = canvas.toDataURL();
// avatar.src = canvas.toDataURL();
canvas.toBlob(function (blob) {
var formData = new FormData();
formData.append('file', blob, 'avatar.png');
formData.append('type', 'avatar');
$http.post('{{ shop_route('file.store') }}', formData).then(res => {
console.log(res);
$('#avatar').attr('src', res.data.url);
$('#avatar-input').val(res.data.value)
})
});
}

View File

@ -0,0 +1,5 @@
<div class="alert alert-success alert-dismissible">
<i class="bi bi-check-circle-fill"></i>
{{ $msg }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

View File

@ -22,44 +22,41 @@
<div class="container">
<div class="footer-content">
<div class="row">
<div class="col-12 col-md-4">
<div class="col-12 col-md-3">
<div class="footer-content-left">
<div class="logo"><a href="http://"><img
src="{{ image_origin($footer_content['content']['intro']['logo']) }}" class="img-fluid"></a></div>
<div class="text">{!! $footer_content['content']['intro']['text'][$locale] ?? '' !!}</div>
</div>
</div>
<div class="col-lg-8">
<div class="row">
@for ($i = 1; $i <= 3; $i++)
@php
$link = $footer_content['content']['link' . $i];
@endphp
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">{{ $link['title'][$locale] }}</h6>
<ul class="list-unstyled">
@foreach ($link['links'] as $item)
<li><a href="{{ type_route($item['type'], $item['value']) }}"
@if (isset($item['new_window']) && $item['new_window']) target="_blank" @endif>{{ $item['text'][$locale] }}</a></li>
@endforeach
</ul>
</div>
@endfor
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">联系我们</h6>
<ul class="list-unstyled">
@if ($footer_content['content']['contact']['email'])
<li>{{ $footer_content['content']['contact']['email'] }}</li>
@endif
@if ($footer_content['content']['contact']['telephone'])
<li>{{ $footer_content['content']['contact']['telephone'] }}</li>
@endif
@if ($footer_content['content']['contact']['address'])
<li>{{ $footer_content['content']['contact']['address'] }}</li>
@endif
</ul>
</div>
@for ($i = 1; $i <= 3; $i++)
@php
$link = $footer_content['content']['link' . $i];
@endphp
<div class="col-6 col-sm footer-content-link{{ $i }}">
<h6 class="text-uppercase text-dark mb-3">{{ $link['title'][$locale] }}</h6>
<ul class="list-unstyled">
@foreach ($link['links'] as $item)
<li><a href="{{ type_route($item['type'], $item['value']) }}"
@if (isset($item['new_window']) && $item['new_window']) target="_blank" @endif>{{ $item['text'][$locale] }}</a></li>
@endforeach
</ul>
</div>
@endfor
<div class="col-12 col-md-3 footer-content-contact">
<h6 class="text-uppercase text-dark mb-3">联系我们</h6>
<ul class="list-unstyled">
@if ($footer_content['content']['contact']['email'])
<li><i class="bi bi-envelope-fill"></i> {{ $footer_content['content']['contact']['email'] }}</li>
@endif
@if ($footer_content['content']['contact']['telephone'])
<li><i class="bi bi-telephone-fill"></i> {{ $footer_content['content']['contact']['telephone'] }}</li>
@endif
@if ($footer_content['content']['contact']['address'])
<li><i class="bi bi-geo-alt-fill"></i> {{ $footer_content['content']['contact']['address'] }}</li>
@endif
</ul>
</div>
</div>
</div>