后台版本更新提示

This commit is contained in:
pushuo 2023-02-03 18:16:41 +08:00 committed by Edward Yang
parent 7a142b7c6c
commit 72f7004cf2
14 changed files with 124 additions and 17 deletions

View File

@ -121,13 +121,18 @@
&.navbar-right {
> li {
html[lang="zh_cn"] &, html[lang="zh_hk"] &, html[lang="en"] & {
padding: 0 .5rem;
}
padding: 0 0.3rem !important;
a.nav-link {
padding: 0 10px;
}
&.update-btn a {
padding-top: 0.15rem;
padding-bottom: 0.15rem;
border-radius: 2px;
font-size: 12px;
}
}
}
}

View File

@ -3,7 +3,7 @@
* @link https://beikeshop.com
* @Author pu shuo <pushuo@guangda.work>
* @Date 2022-08-26 18:18:22
* @LastEditTime 2022-09-16 20:58:01
* @LastEditTime 2023-02-03 17:46:06
*/
import http from "../../../js/http";
@ -51,6 +51,8 @@ if (typeof Vue != 'undefined') {
}
$(document).ready(function ($) {
bk.setVersionUpdateTips();
$.ajaxSetup({
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
// beforeSend: function() { layer.load(2, {shade: [0.3,'#fff'] }); },

View File

@ -3,7 +3,7 @@
* @link https://beikeshop.com
* @Author pu shuo <pushuo@guangda.work>
* @Date 2022-08-22 18:32:26
* @LastEditTime 2023-02-03 10:12:59
* @LastEditTime 2023-02-03 17:50:57
*/
export default {
@ -100,5 +100,18 @@ export default {
}
return obj;
},
// 设置版本更新提示
setVersionUpdateTips() {
const version = JSON.parse(localStorage.getItem('beike_version'));
if (version && version.has_new_version) {
localStorage.setItem('version', process.env.VUE_APP_VERSION);
$('.new-version').text(version.latest);
$('.update-date').text(version.release_date);
$('.update-btn').show();
} else {
$('.update-btn').hide();
}
}
}

View File

@ -12,6 +12,9 @@
@endforeach
</ul>
<ul class="navbar navbar-right">
<li class="nav-item update-btn" style="display: none">
<a href="javascript:void(0)" class="btn btn-outline-primary btn-sm">@lang('admin/common.update_nav')</a>
</li>
<li class="nav-item">
<a href="{{ admin_route('marketing.index') }}" class="nav-link"><i class="bi bi-gem text-primary"></i>&nbsp;@lang('admin/common.marketing')</a>
</li>
@ -48,22 +51,17 @@
<div class="header-mobile d-lg-none">
<div class="header-mobile-wrap">
<div class="header-mobile-left">
<div class="mobile-open-menu"><i class="bi bi-list"></i></div>
</div>
<div class="logo">
<a href=""><img src="{{ asset('image/logo.png') }}" class="img-fluid"></a>
</div>
<div class="header-mobile-right">
<div class="mobile-to-front">
<a target="_blank" href="{{ shop_route('home.index') }}" class="nav-divnk"><i class="bi bi-send"></i></a>
</div>
</div>
</div>
</div>
@ -106,3 +104,35 @@
</div>
</div>
</div>
<div class="update-pop p-3" style="display: none">
<div class="mb-4 fs-5 fw-bold text-center">{{ __('admin/common.update_title') }}</div>
<div class="py-3 px-4 bg-light mx-3 lh-lg mb-4">
<div>{{ __('admin/common.update_new_version') }}<span class="new-version fs-5 fw-bold text-success"></span></div>
<div>{{ __('admin/common.update_old_version') }}<span class="fs-5">v{{ config('beike.version') }}</span></div>
<div>{{ __('admin/common.update_date') }}<span class="update-date fs-5"></span></div>
</div>
<div class="d-flex justify-content-center mb-3">
<button class="btn btn-outline-secondary me-3 ">{{ __('common.cancel') }}</button>
<a href="https://beikeshop.com/download" target="_blank" class="btn btn-primary">{{ __('admin/common.update_btn') }}</a>
</div>
</div>
@push('footer')
<script>
let updatePop = null;
$('.update-btn').click(function() {
updatePop = layer.open({
type: 1,
title: '{{ __('common.text_hint') }}',
area: ['400px'],
content: $('.update-pop'),
});
});
$('.update-pop .btn-outline-secondary').click(function() {
layer.close(updatePop)
});
</script>
@endpush

View File

@ -119,8 +119,6 @@
</div>
</div>
@endif
@endsection
@push('footer')
@ -283,14 +281,12 @@
beginAtZero: true,
grid: {
drawBorder: false,
// drawOnChartArea: false,
display: false
},
}
},
}
});
// console.log(ordersChart)
function upDate(chart, label, data) {
chart.data.labels = label;
@ -304,11 +300,18 @@
const day = $(this).data('type'); // 天数
const labels = eval(day).period;
const data = [eval(day).totals, eval(day).amounts];
// const labels = Array.from({length: day}, (v, k) => k + 1);
// const data = Array.from({length: day}, () => Math.floor(Math.random() * 123.7));
$(this).addClass('btn-info text-white').siblings().removeClass('btn-info text-white');
upDate(ordersChart, labels, data);
});
</script>
<script>
$.ajax({
url: 'https://beikeshop.com/api/version?version={{ config('beike.version') }}',
success: function(data) {
localStorage.setItem('beike_version', JSON.stringify(data));
bk.setVersionUpdateTips()
}
});
</script>
@endpush

View File

@ -71,4 +71,10 @@ return [
'customer_groups_index' => 'Kundengruppe',
'countries_index' => 'Landesverwaltung',
'zones_index' => 'Provinzverwaltung',
'update_nav' => 'aktualisieren',
'update_title' => 'Neue Version von BeikeShop suchen, jetzt aktualisieren',
'update_new_version' => 'neueste Version',
'update_old_version' => 'aktuelle Version',
'update_date' => 'Aktualisierungsdatum',
'update_btn' => 'zum Download gehen',
];

View File

@ -75,4 +75,10 @@ return [
'customer_groups_index' => 'Customer Groups',
'countries_index' => 'Countries',
'zones_index' => 'Zones',
'update_nav' => 'Update',
'update_title' => 'Find a new version of BeikeShop, whether to update now',
'update_new_version' => 'Latest version',
'update_old_version' => 'Current version',
'update_date' => 'Update date',
'update_btn' => 'Download',
];

View File

@ -71,4 +71,10 @@ return [
'customer_groups_index' => 'grupo de clientes',
'countries_index' => 'Administración del Estado',
'zones_index' => 'Gestión de provincia',
'update_nav' => 'actualizar',
'update_title' => 'Buscar una nueva versión de BeikeShop, ya sea para actualizar ahora',
'update_new_version' => 'última versión',
'update_old_version' => 'versión actual',
'update_date' => 'fecha de actualización',
'update_btn' => 'ir a descargar',
];

View File

@ -71,4 +71,10 @@ return [
'customer_groups_index' => 'groupe de clients',
'countries_index' => 'Gestion des pays',
'zones_index' => 'gestion des provinces',
'update_nav' => 'mettre à jour',
'update_title' => 'Trouver une nouvelle version de BeikeShop, si mettre à jour maintenant',
'update_new_version' => 'dernière version',
'update_old_version' => 'version actuelle',
'update_date' => 'date de mise à jour',
'update_btn' => 'aller au téléchargement',
];

View File

@ -71,4 +71,10 @@ return [
'customer_groups_index' => 'Gruppo di clienti',
'countries_index' => 'Gestione statale',
'zones_index' => 'Gestione provinciale',
'update_nav' => 'aggiorna',
'update_title' => 'Trova una nuova versione di BeikeShop, se aggiornare ora',
'update_new_version' => 'ultima versione',
'update_old_version' => 'versione corrente',
'update_date' => 'data di aggiornamento',
'update_btn' => 'vai al download',
];

View File

@ -71,4 +71,10 @@ return [
'customer_groups_index' => '顧客グループ',
'countries_index' => '国の管理',
'zones_index' => '州管理',
'update_nav' => 'アップデート',
'update_title' => 'BeikeShop の新しいバージョンを見つけて、今すぐ更新するかどうか',
'update_new_version' => '最新バージョン',
'update_old_version' => '現在のバージョン',
'update_date' => '更新日',
'update_btn' => 'ダウンロードする',
];

View File

@ -71,4 +71,10 @@ return [
'customer_groups_index' => 'группа клиентов',
'countries_index' => 'Государственное управление',
'zones_index' => 'Управление провинции',
'update_nav' => 'обновить',
'update_title' => 'Найти новую версию BeikeShop, обновить ли сейчас',
'update_new_version' => 'последняя версия',
'update_old_version' => 'текущая версия',
'update_date' => 'дата обновления',
'update_btn' => 'перейти к загрузке',
];

View File

@ -75,4 +75,10 @@ return [
'customer_groups_index' => '客户组',
'countries_index' => '国家管理',
'zones_index' => '省份管理',
'update_nav' => '更新',
'update_title' => '发现新的BeikeShop版本是否立即更新',
'update_new_version' => '最新版本',
'update_old_version' => '当前版本',
'update_date' => '更新日期',
'update_btn' => '前往下载',
];

View File

@ -73,4 +73,10 @@ return [
'customer_groups_index' => '客戶組',
'countries_index' => '國家管理',
'zones_index' => '省份管理',
'update_nav' => '更新',
'update_title' => '發現新的BeikeShop版本是否立即更新',
'update_new_version' => '最新版本',
'update_old_version' => '當前版本',
'update_date' => '更新日期',
'update_btn' => '前往下載',
];