修复bug

This commit is contained in:
zwgczx committed 2026-04-14 10:44:41 +08:00
1 parent aa67a66047
commit ce682c3679
7 files changed
+178 -54

No files matched your search

+7 -10
View File
@@ -19,7 +19,6 @@ import {
import { collectActiveProjectSessionLocks, initProjectSessionLock } from '@/lib/projectSessionLock'
import { listenProjectDeleted, listenResetAll } from '@/lib/projectEvents'
import { listProjects, type ProjectMeta } from '@/lib/projectRegistry'
import { closePage } from './lib/utils'
const tabStore = useTabStore()
const { t } = useI18n()
@@ -113,12 +112,7 @@ const startCloseCountdown = () => {
closeCountdown.value -= 1
if (closeCountdown.value <= 0) {
clearCloseCountdown()
try {
closePage()
} catch {
// 部分浏览器会阻止关闭,保留阻断页。
}
backToHome()
}
}, 1000)
}
@@ -137,6 +131,10 @@ const createProjectAndOpen = () => {
openProjectInNewTab(DEFAULT_PROJECT_ID, { newProject: true })
}
const backToHome = () => {
window.location.href = buildProjectUrl(DEFAULT_PROJECT_ID, { forceHome: true })
}
const syncRouteRequestFlags = () => {
try {
const url = new URL(window.location.href)
@@ -306,9 +304,8 @@ onBeforeUnmount(() => {
<button
type="button"
class="rounded-md border border-slate-300 bg-white px-3 py-2 text-sm text-slate-700"
:class="isConflictProjectOpen('default') ? 'cursor-not-allowed opacity-60' : 'cursor-pointer hover:bg-slate-100'"
:disabled="isConflictProjectOpen('default')"
@click="openProjectInNewTab('default')"
:class="'cursor-pointer hover:bg-slate-100'"
@click="backToHome"
>
{{ t('app.projectConflict.openDefault') }}
</button>
@@ -654,10 +654,10 @@ onBeforeUnmount(() => {
class="inline-flex cursor-pointer items-center justify-center rounded-2xl border border-slate-300/60 bg-white/55 px-5 py-2 text-base font-semibold text-slate-700 shadow-[0_8px_24px_rgba(15,23,42,0.06)] backdrop-blur-sm underline decoration-slate-300 underline-offset-4 transition hover:border-slate-400/70 hover:bg-white/70 hover:text-slate-900 hover:decoration-slate-500"
@click="openDisclaimerPage"
>
免责声明:跳转到免责声明页面
{{ t('home.disclaimer.link') }}
</button>
<p class="mt-2 text-xs leading-5 text-slate-500">
本计算工具由众为工程咨询有限公司提供免费技术支持
{{ t('home.disclaimer.supportText') }}
</p>
</div>
</div>
+5 -1
View File
@@ -14,7 +14,7 @@ export const enUS = {
countdown: 'This page will try to close automatically in {seconds} seconds. You can open another project in a new tab first.',
opened: '(Opened)',
lastEdited: 'Last edited: {time}',
openDefault: 'Open Default Project',
openDefault: 'Back to Home',
createAndOpen: 'Create and Open'
}
},
@@ -37,6 +37,10 @@ export const enUS = {
pickFile: 'Choose File',
pickExisting: 'Choose Existing'
},
disclaimer: {
link: 'Disclaimer: Go to disclaimer page',
supportText: 'This calculator is provided with free technical support by Zhongwei Engineering Consulting Co., Ltd.'
},
dialog: {
newProject: 'New Project',
chooseIndustryDesc: 'Choose an industry and enter project calculation directly.',
+5 -1
View File
@@ -14,7 +14,7 @@ export const zhCN = {
countdown: '本页将在 {seconds} 秒后自动尝试关闭。你也可以先在新标签页打开其他项目。',
opened: '(已打开)',
lastEdited: '最后编辑:{time}',
openDefault: '打开默认项目',
openDefault: '返回首页',
createAndOpen: '新建项目并打开'
}
},
@@ -37,6 +37,10 @@ export const zhCN = {
pickFile: '选择文件',
pickExisting: '选择已有项目'
},
disclaimer: {
link: '免责声明:跳转到免责声明页面',
supportText: '本计算工具由众为工程咨询有限公司提供免费技术支持'
},
dialog: {
newProject: '新建项目',
chooseIndustryDesc: '选择工程行业后,直接进入项目计算页面。',
+1 -1
View File
@@ -171,7 +171,7 @@ export const buildProjectUrl = (
projectIdRaw: string,
options?: { newProject?: boolean; openProjectDialog?: boolean; forceHome?: boolean }
) => {
try {
try {
const url = new URL(window.location.href)
url.searchParams.set(PROJECT_ID_QUERY_KEY, normalizeProjectId(projectIdRaw))
if (options?.newProject) {
+6 -2
View File
@@ -27,6 +27,7 @@ import './style.css'
import { i18n } from '@/i18n'
import { ensureProjectIdInUrl, getProjectDbName } from '@/lib/workspace'
import { listProjects } from '@/lib/projectRegistry'
import { collectActiveProjectSessionLocks } from '@/lib/projectSessionLock'
LicenseManager.setLicenseKey(
'[v3][RELEASE][0102]_NDg2Njc4MzY3MDgzNw==16d78ca762fb5d2ff740aed081e2af7b'
@@ -54,11 +55,14 @@ const AG_GRID_MODULES = [
const pickBootstrapProjectId = () => {
try {
const url = new URL(window.location.href)
const explicit = String(url.searchParams.get('projectId') || '').trim()
if (explicit) return ensureProjectIdInUrl()
const projects = listProjects()
if (projects.length > 0) {
const lastEdited = projects[0]
const openedProjectIds = collectActiveProjectSessionLocks(projects.map(project => project.id))
const availableProjects = projects.filter(project => !openedProjectIds.has(project.id))
if (availableProjects.length > 0) {
const lastEdited = availableProjects[0]
url.searchParams.set('projectId', lastEdited.id)
window.history.replaceState({}, '', `${url.pathname}${url.search}${url.hash}`)
}