修复归档项目详情页签地址回写
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
- `isProjectArchived`
|
||||
- `isArchiveLockedTab(tab)`
|
||||
- `resolveAccessibleTab(tab)`
|
||||
- `syncRouteTab(tab)`
|
||||
|
||||
并将其应用到:
|
||||
|
||||
@@ -60,6 +61,7 @@
|
||||
- `initActiveTabFromRoute()` 的路由初始化校正
|
||||
- `handleMenuSelect()` 的点击拦截
|
||||
- 项目状态变化后的当前页签校正
|
||||
- 归档态命中受限页签时将地址栏 `tab` 自动回写为 `overview`
|
||||
|
||||
### 4. 子组件增加归档态只读保护
|
||||
|
||||
@@ -98,3 +100,4 @@
|
||||
- 列表会显示真实归档结果
|
||||
- 已归档项目详情页中无法点击“上传数据”“参数配置”
|
||||
- 即使访问旧链接,也会自动切到“结果总览”
|
||||
- 地址栏中的受限 `tab` 参数会同步被改写为 `overview`
|
||||
|
||||
@@ -32,6 +32,7 @@ node tests/unit/project-detail-tagging-polling.test.js
|
||||
- `project-detail-archive-tab-lock.test.js`
|
||||
- 已归档项目的上传数据与参数配置页签被锁定
|
||||
- 路由初始化会校正受限页签
|
||||
- 受限页签会把地址栏中的 `tab` 参数回写到 `overview`
|
||||
- `upload-data-disabled-cards.test.js`
|
||||
- 流水上传卡片在归档态和打标态都会置灰
|
||||
- `project-archive-readonly-guard.test.js`
|
||||
|
||||
@@ -131,6 +131,7 @@ export default {
|
||||
const accessibleTab = this.resolveAccessibleTab(this.activeTab);
|
||||
if (accessibleTab !== this.activeTab) {
|
||||
this.setActiveTab(accessibleTab);
|
||||
this.syncRouteTab(accessibleTab);
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -147,7 +148,11 @@ export default {
|
||||
const tab = (this.$route.query && this.$route.query.tab) || "";
|
||||
const validTabs = ["upload", "config", "overview", "special", "detail"];
|
||||
const targetTab = validTabs.includes(tab) ? tab : "upload";
|
||||
this.setActiveTab(this.resolveAccessibleTab(targetTab));
|
||||
const accessibleTab = this.resolveAccessibleTab(targetTab);
|
||||
this.setActiveTab(accessibleTab);
|
||||
if (accessibleTab !== targetTab) {
|
||||
this.syncRouteTab(accessibleTab);
|
||||
}
|
||||
},
|
||||
isArchiveLockedTab(tab) {
|
||||
return this.isProjectArchived && ["upload", "config"].includes(tab);
|
||||
@@ -169,6 +174,19 @@ export default {
|
||||
};
|
||||
this.currentComponent = componentMap[index] || "UploadData";
|
||||
},
|
||||
syncRouteTab(tab) {
|
||||
const currentTab = (this.$route.query && this.$route.query.tab) || "";
|
||||
if (currentTab === tab) {
|
||||
return;
|
||||
}
|
||||
this.$router.replace({
|
||||
path: this.$route.path,
|
||||
query: {
|
||||
...this.$route.query,
|
||||
tab,
|
||||
},
|
||||
});
|
||||
},
|
||||
/** 初始化页面数据 */
|
||||
initPageData() {
|
||||
return this.fetchProjectDetail();
|
||||
|
||||
@@ -30,6 +30,13 @@ assert(
|
||||
"详情页应在路由初始化时校正归档态不可访问页签"
|
||||
);
|
||||
|
||||
assert(
|
||||
/initActiveTabFromRoute\(\)\s*\{[\s\S]*?if\s*\(accessibleTab !== targetTab\)[\s\S]*?this\.syncRouteTab\(accessibleTab\)/.test(
|
||||
source
|
||||
),
|
||||
"归档态命中禁用页签时应同步将地址栏回写到可访问页签"
|
||||
);
|
||||
|
||||
assert(
|
||||
/handleMenuSelect\(index\)\s*\{[\s\S]*?if\s*\(this\.isArchiveLockedTab\(index\)\)\s*\{\s*return;\s*\}/.test(
|
||||
source
|
||||
|
||||
Reference in New Issue
Block a user