mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-21 02:56:38 +08:00
Merge branch 'main' into example
This commit is contained in:
commit
799ebcc714
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,6 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.2.4](https://github.com/soybeanjs/soybean-admin/compare/v1.2.3...v1.2.4) (2024-06-14)
|
||||||
|
|
||||||
|
### 🛠 Optimizations
|
||||||
|
|
||||||
|
- **projects**:
|
||||||
|
- optimize `setupAppVersionNotification` - by @soybeanjs [<samp>(b5a72)</samp>](https://github.com/soybeanjs/soybean-admin/commit/b5a723c)
|
||||||
|
- get buildTime with timezone 'Asia/Shanghai' - by @soybeanjs [<samp>(069fa)</samp>](https://github.com/soybeanjs/soybean-admin/commit/069fa8a)
|
||||||
|
|
||||||
|
### ❤️ Contributors
|
||||||
|
|
||||||
|
[](https://github.com/soybeanjs)
|
||||||
|
|
||||||
## [v1.2.3](https://github.com/soybeanjs/soybean-admin/compare/v1.2.2...v1.2.3) (2024-06-13)
|
## [v1.2.3](https://github.com/soybeanjs/soybean-admin/compare/v1.2.2...v1.2.3) (2024-06-13)
|
||||||
|
|
||||||
### 🐞 Bug Fixes
|
### 🐞 Bug Fixes
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export * from './proxy';
|
export * from './proxy';
|
||||||
|
export * from './time';
|
||||||
|
12
build/config/time.ts
Normal file
12
build/config/time.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import dayjs from 'dayjs';
|
||||||
|
import utc from 'dayjs/plugin/utc';
|
||||||
|
import timezone from 'dayjs/plugin/timezone';
|
||||||
|
|
||||||
|
export function getBuildTime() {
|
||||||
|
dayjs.extend(utc);
|
||||||
|
dayjs.extend(timezone);
|
||||||
|
|
||||||
|
const buildTime = dayjs.tz(Date.now(), 'Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
|
||||||
|
return buildTime;
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "soybean-admin",
|
"name": "soybean-admin",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
|
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Soybean",
|
"name": "Soybean",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/axios",
|
"name": "@sa/axios",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/color",
|
"name": "@sa/color",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/hooks",
|
"name": "@sa/hooks",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/materials",
|
"name": "@sa/materials",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/fetch",
|
"name": "@sa/fetch",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/scripts",
|
"name": "@sa/scripts",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"bin": {
|
"bin": {
|
||||||
"sa": "./bin.ts"
|
"sa": "./bin.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/uno-preset",
|
"name": "@sa/uno-preset",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sa/utils",
|
"name": "@sa/utils",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
},
|
},
|
||||||
|
@ -3,10 +3,18 @@ import { NButton } from 'naive-ui';
|
|||||||
import { $t } from '../locales';
|
import { $t } from '../locales';
|
||||||
|
|
||||||
export function setupAppVersionNotification() {
|
export function setupAppVersionNotification() {
|
||||||
|
let isShow = false;
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', async () => {
|
document.addEventListener('visibilitychange', async () => {
|
||||||
|
const preConditions = [!isShow, document.visibilityState === 'visible', !import.meta.env.DEV];
|
||||||
|
|
||||||
|
if (!preConditions.every(Boolean)) return;
|
||||||
|
|
||||||
const buildTime = await getHtmlBuildTime();
|
const buildTime = await getHtmlBuildTime();
|
||||||
|
|
||||||
if (!import.meta.env.DEV && buildTime !== BUILD_TIME && document.visibilityState === 'visible') {
|
if (buildTime !== BUILD_TIME) {
|
||||||
|
isShow = true;
|
||||||
|
|
||||||
const n = window.$notification?.create({
|
const n = window.$notification?.create({
|
||||||
title: $t('system.updateTitle'),
|
title: $t('system.updateTitle'),
|
||||||
content: $t('system.updateContent'),
|
content: $t('system.updateContent'),
|
||||||
@ -32,6 +40,9 @@ export function setupAppVersionNotification() {
|
|||||||
() => $t('system.updateConfirm')
|
() => $t('system.updateConfirm')
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
},
|
||||||
|
onClose() {
|
||||||
|
isShow = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import { URL, fileURLToPath } from 'node:url';
|
import { URL, fileURLToPath } from 'node:url';
|
||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import { setupVitePlugins } from './build/plugins';
|
import { setupVitePlugins } from './build/plugins';
|
||||||
import { createViteProxy } from './build/config';
|
import { createViteProxy, getBuildTime } from './build/config';
|
||||||
|
|
||||||
export default defineConfig(configEnv => {
|
export default defineConfig(configEnv => {
|
||||||
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta;
|
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta;
|
||||||
|
|
||||||
const buildTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
const buildTime = getBuildTime();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: viteEnv.VITE_BASE_URL,
|
base: viteEnv.VITE_BASE_URL,
|
||||||
|
Loading…
Reference in New Issue
Block a user