Add plugin uninstall reminder

wip

Fix navigation responsiveness issues

brand ui

Fix delete attribute call error api

Optimize plugin when uninstall and check plugin is available for current version.

wip

Fix the loading error of the element language file in the homepage editor

Fix menu page category name getting error

Fix menu page category name getting error ++
This commit is contained in:
pushuo 2023-03-21 16:09:37 +08:00 committed by Edward Yang
parent b7195e2d01
commit b8889cb9c5
26 changed files with 92 additions and 42 deletions

View File

@ -26,10 +26,10 @@ class AttributeController extends Controller
{
try {
$attributes = AttributeRepo::getList();
$data = [
'attribute_list' => $attributes,
$data = [
'attribute_list' => $attributes,
'attribute_list_format' => AttributeResource::collection($attributes),
'attribute_group' => AttributeGroupRepo::getList(),
'attribute_group' => AttributeGroupRepo::getList(),
];
$data = hook_filter('admin.attribute.index.data', $data);
if ($request->expectsJson()) {

View File

@ -35,7 +35,7 @@ class AttributeGroupController extends Controller
{
try {
$requestData = json_decode($request->getContent(), true);
$item = AttributeGroupRepo::create($requestData);
$item = AttributeGroupRepo::create($requestData);
} catch (Exception $e) {
return json_fail($e->getMessage(), []);
}

View File

@ -59,7 +59,7 @@ class MarketingService
*/
public function getPlugin($pluginCode): mixed
{
$url = config('beike.api_url') . "/api/plugins/{$pluginCode}";
$url = config('beike.api_url') . "/api/plugins/{$pluginCode}?version=" . config('beike.version');
$plugin = $this->httpClient->get($url)->json();
if (empty($plugin)) {
throw new NotFoundHttpException('该插件不存在或已下架');

View File

@ -204,11 +204,11 @@ class OrderRepo
$shippingAddress->country_id = $shippingAddress->country->id ?? 0;
$paymentAddress->country = $paymentAddress->country->name ?? '';
$paymentAddress->country_id = $paymentAddress->country->id ?? 0;
$email = $customer->email;
$email = $customer->email;
} else {
$shippingAddress = new Address($current['guest_shipping_address'] ?? []);
$paymentAddress = new Address($current['guest_payment_address'] ?? []);
$email = $current['guest_shipping_address']['email'];
$email = $current['guest_shipping_address']['email'];
}
$shippingMethodCode = $current['shipping_method_code'] ?? '';

View File

@ -153,8 +153,13 @@ class PageCategoryRepo
* @param $page
* @return string
*/
public static function getName($page)
public static function getName($pageCategoryId)
{
return $page->description->title ?? '';
// 根据 pageCategoryId 获取 name判断是否存在
$pageCategory = PageCategory::query()->whereHas('description', function ($query) use ($pageCategoryId) {
$query->where('page_category_id', $pageCategoryId);
})->first();
return $pageCategory->description->title ?? '';
}
}

View File

@ -136,11 +136,13 @@ class Bootstrap
/**
* 修改订单状态机流程演示
*/
private function handlePaidOrder() {
private function handlePaidOrder()
{
add_hook_filter('service.state_machine.machines', function ($data) {
$data['machines']['unpaid']['paid'][] = function (){
$data['machines']['unpaid']['paid'][] = function () {
// 这里写订单由 unpaid 变为 paid 执行的逻辑
};
return $data;
}, 0);
}

View File

@ -15,7 +15,7 @@
<div class="tab-content w-max-1000" id="myTabContent">
@foreach (locales() as $locale)
<div class="tab-pane fade {{ $loop->first ? 'show active' : ''}}" id="{{ $locale['code'] }}-pane" role="tabpanel" aria-labelledby="{{ $locale['code'] }}">
<textarea rows="4" type="text" name="{{ $name }}[{{ $locale['code'] }}]" class="tinymce" placeholder="{{ $title }}">{{ $value[$locale['code']] }}</textarea>
<textarea rows="4" type="text" name="{{ $name }}[{{ $locale['code'] }}]" class="tinymce" placeholder="{{ $title }}">{{ $value[$locale['code']] ?? '' }}</textarea>
</div>
@endforeach
</div>

View File

@ -20,7 +20,7 @@
@hookwrapper('admin.header.vip')
<li class="nav-item vip-serve">
<a href="javascript:void(0)" class="nav-link">
<a href="{{ config('beike.api_url') }}/vip/subscription?domain={{ config('app.url') }}&developer_token={{ system_setting('base.developer_token') }}" target="_blank" class="nav-link">
<img src="/image/vip-icon.png" class="img-fluid">
<span class="vip-text ms-1">VIP</span>
<div class="expired-text text-danger ms-2" style="display: none">@lang('admin/common.expired_at')<span class="ms-0"></span></div>
@ -157,13 +157,13 @@
layer.close(updatePop)
});
$('.vip-serve').click(function(event) {
layer.open({
type: 2,
title: '',
area: ['840px', '80%'],
content: `${config.api_url}/api/vip_rights?domain=${config.app_url}&developer_token={{ system_setting('base.developer_token') }}`,
});
});
// $('.vip-serve').click(function(event) {
// layer.open({
// type: 2,
// title: '',
// area: ['840px', '80%'],
// content: `${config.api_url}/api/vip_rights?domain=${config.app_url}&developer_token={{ system_setting('base.developer_token') }}`,
// });
// });
</script>
@endpush

View File

@ -179,7 +179,7 @@
cancelButtonText: '{{__('common.cancel')}}',
type: 'warning'
}).then(() => {
$http.delete(`customers/{{ $attribute['id'] }}/addresses/${id}`).then((res) => {
$http.delete(`attributes/{{ $attribute['id'] }}/values/${id}`).then((res) => {
this.$message.success(res.message);
this.source.attributeValues.splice(index, 1)
})

View File

@ -20,6 +20,9 @@
<script src="{{ asset('vendor/tinymce/5.9.1/tinymce.min.js') }}"></script>
<script src="{{ asset('vendor/element-ui/2.15.6/js.js') }}"></script>
<link rel="stylesheet" href="{{ asset('vendor/element-ui/2.15.6/css.css') }}">
@if (locale() != 'zh_cn')
<script src="{{ asset('vendor/element-ui/language/' . locale() . '.js') }}"></script>
@endif
<link rel="stylesheet" type="text/css" href="{{ asset('/build/beike/admin/css/design.css') }}">
@stack('header')
<script>

View File

@ -43,18 +43,24 @@
</div>
<div class="mb-4">
@if ($data['downloadable'])
<button class="btn btn-primary btn-lg" @click="downloadPlugin"><i class="bi bi-cloud-arrow-down-fill"></i> {{ __('admin/marketing.download_plugin') }}</button>
<div class="mt-3 d-none download-help"><a href="{{ admin_route('plugins.index') }}" class=""><i class="bi bi-cursor-fill"></i> <span></span></a></div>
@if ($data['available'])
@if ($data['downloadable'])
<button class="btn btn-primary btn-lg" @click="downloadPlugin"><i class="bi bi-cloud-arrow-down-fill"></i> {{ __('admin/marketing.download_plugin') }}</button>
<div class="mt-3 d-none download-help"><a href="{{ admin_route('plugins.index') }}" class=""><i class="bi bi-cursor-fill"></i> <span></span></a></div>
@else
<div class="mb-2 fw-bold">{{ __('admin/marketing.select_pay') }}</div>
<div class="mb-4">
<el-radio-group v-model="payCode" size="small" class="radio-group">
<el-radio class="rounded-0 me-1" label="wechatpay" border><img src="{{ asset('image/wechat.png') }}" class="img-fluid"></el-radio>
<el-radio class="rounded-0" label="alipay" border><img src="{{ asset('image/alipay.png') }}" class="img-fluid"></el-radio>
</el-radio-group>
</div>
<button class="btn btn-primary btn-lg" @click="marketingBuy">{{ __('admin/marketing.btn_buy') }} ({{ $data['price_format'] }})</button>
@endif
@else
<div class="mb-2 fw-bold">{{ __('admin/marketing.select_pay') }}</div>
<div class="mb-4">
<el-radio-group v-model="payCode" size="small" class="radio-group">
<el-radio class="rounded-0 me-1" label="wechatpay" border><img src="{{ asset('image/wechat.png') }}" class="img-fluid"></el-radio>
<el-radio class="rounded-0" label="alipay" border><img src="{{ asset('image/alipay.png') }}" class="img-fluid"></el-radio>
</el-radio-group>
<div class="alert alert-warning" role="alert">
{!! __('admin/marketing.version_compatible_text') !!}
</div>
<button class="btn btn-primary btn-lg" @click="marketingBuy">{{ __('admin/marketing.btn_buy') }} ({{ $data['price_format'] }})</button>
@endif
</div>
</div>

View File

@ -84,11 +84,25 @@
},
installedPlugin(code, type, index) {
const self = this;
if (type == 'uninstall') {
layer.confirm('{{ __('admin/plugin.uninstall_hint') }}', {
title: "{{ __('common.text_hint') }}",
btn: ['{{ __('common.cancel') }}', '{{ __('common.confirm') }}'],
area: ['400px'],
btn2: () => {
this.installedPluginXhr(code, type, index);
}
})
return;
}
this.installedPluginXhr(code, type, index);
},
installedPluginXhr(code, type, index) {
$http.post(`plugins/${code}/${type}`).then((res) => {
layer.msg(res.message)
self.plugins[index].installed = type == 'install' ? true : false;
this.plugins[index].installed = type == 'install' ? true : false;
})
}
}

View File

@ -15,9 +15,17 @@
justify-content: center; // flex-end | center | space-between
box-shadow: 0 6px 18px rgba(0, 0, 0, .07);
margin-bottom: 10px;
height: 90px;
height: 120px;
overflow: hidden;
border: 1px solid transparent;
transition: all 0.3s ease-in-out;
>img {
&:hover {
box-shadow: 0 6px 18px rgba(0, 0, 0, .1);
border: 1px solid $primary;
}
> img {
max-height: 100%;
}
}

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'installieren',
'plugins_uninstall' => 'deinstallieren',
'to_enable' => 'To Enable',
'uninstall_hint' => 'Das Deinstallieren des Plug-ins löscht alle zugehörigen Daten des Plug-ins, möchten Sie es wirklich deinstallieren? ',
'plugin_list' => 'Plugin-Liste',
'plugin_code' => 'plugin-code',

View File

@ -34,4 +34,6 @@ return [
'pay_success_text' => 'The plug-in purchase is successful, click OK to refresh the page',
'ali_pay_success' => 'Payment completed? ',
'ali_pay_text' => 'Payment has been completed, please refresh the page',
'version_compatible_text' => 'This plugin is not compatible with the current system version, please upgrade to <a href="' .config('beike.api_url') . '/download" target="_blank">Latest Version</a>' ,
'to_update' => 'To Upgrade',
];

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'Install',
'plugins_uninstall' => 'Uninstall',
'to_enable' => 'To Enable',
'uninstall_hint' => 'Uninstalling the plug-in will delete all related data of the plug-in, are you sure you want to uninstall? ',
'plugin_list' => 'Plugin List',
'plugin_code' => 'Code',

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'Instalar',
'plugins_uninstall' => 'desinstalar',
'to_enable' => 'To Enable',
'uninstall_hint' => 'Desinstalar el complemento eliminará todos los datos relacionados con el complemento, ¿está seguro de que desea desinstalarlo? ',
'plugin_list' => 'Lista de complementos',
'plugin_code' => 'código de complemento',

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'installer',
'plugins_uninstall' => 'désinstaller',
'to_enable' => 'To Enable',
'uninstall_hint' => 'La désinstallation du plug-in supprimera toutes les données associées au plug-in, êtes-vous sûr de vouloir désinstaller ? ',
'plugin_list' => 'liste des plugins',
'plugin_code' => 'code du plugin',

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'installa',
'plugins_uninstall' => 'disinstalla',
'to_enable' => 'To Enable',
'uninstall_hint' => 'La disinstallazione del plug-in eliminerà tutti i relativi dati del plug-in, sei sicuro di voler disinstallare? ',
'plugin_list' => 'elenco dei plugin',
'plugin_code' => 'codice plugin',

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'インストール',
'plugins_uninstall' => 'アンインストール',
'to_enable' => '有効にする',
'uninstall_hint' => 'プラグインをアンインストールすると、プラグインに関連するすべてのデータが削除されます。本当にアンインストールしますか? ',
'plugin_list' => 'プラグイン リスト',
'plugin_code' => 'プラグインコード',

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => 'Установить',
'plugins_uninstall' => 'удалить',
'to_enable' => 'включить',
'uninstall_hint' => 'Удаление плагина приведет к удалению всех связанных с ним данных. Вы уверены, что хотите удалить? ',
'plugin_list' => 'Список плагинов',
'plugin_code' => 'код плагина',

View File

@ -34,4 +34,7 @@ return [
'pay_success_text' => '插件购买成功,点击确定刷新页面',
'ali_pay_success' => '已完成支付?',
'ali_pay_text' => '已完成支付,请刷新页面',
'ali_pay_text' => '已完成支付,请刷新页面',
'version_compatible_text' => '该插件不兼容当前系统版本,请升级到 <a href="' . config('beike.api_url') . '/download" target="_blank">最新版本</a>',
'to_update' => '去升级',
];

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => '安装',
'plugins_uninstall' => '卸载',
'to_enable' => '去启用',
'uninstall_hint' => '卸载插件会删除该插件的所有相关数据,确定要卸载吗?',
'plugin_list' => '插件设置',
'plugin_code' => '插件代码',

View File

@ -34,4 +34,6 @@ return [
'pay_success_text' => '插件購買成功,點擊確定刷新頁面',
'ali_pay_success' => '已完成支付? ',
'ali_pay_text' => '已完成支付,請刷新頁面',
'version_compatible_text' => '該插件不兼容當前系統版本,請升級到 <a href="' . config('beike.api_url') . '/download" target="_blank">最新版本</a>',
'to_update' => '去升級',
];

View File

@ -18,6 +18,7 @@ return [
'plugins_install' => '安裝',
'plugins_uninstall' => '卸載',
'to_enable' => '去啟用',
'uninstall_hint' => '卸載插件會刪除該插件的所有相關數據,確定要卸載嗎? ',
'plugin_list' => '插件設置',
'plugin_code' => '插件代碼',

View File

@ -76,9 +76,7 @@
</div>
@endhookwrapper
<div class="menu-wrap">
@if (!is_mobile())
@include('shared.menu-pc')
@endif
@include('shared.menu-pc')
</div>
<div class="right-btn">
<ul class="navbar-nav flex-row">
@ -151,9 +149,7 @@
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body mobile-menu-wrap">
@if (is_mobile())
@include('shared.menu-mobile')
@endif
@include('shared.menu-mobile')
</div>
</div>