mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-11-30 02:37:57 +08:00
feat: keep queryParams stay in page
This commit is contained in:
parent
54a8e6d46c
commit
baad3038cb
@ -1,144 +1 @@
|
|||||||
{
|
{"$schema":"./node_modules/@angular/cli/lib/config/schema.json","cli":{"analytics":false,"defaultCollection":"@angular-eslint/schematics"},"version":1,"newProjectRoot":"projects","projects":{"eoapi":{"root":"","i18n":{"sourceLocale":{"code":"en"},"locales":{"zh":{"translation":"src/locale/messages.zh.xlf"}}},"sourceRoot":"src","projectType":"application","schematics":{"@schematics/angular:application":{"strict":true}},"architect":{"build":{"builder":"@angular-builders/custom-webpack:browser","options":{"localize":true,"aot":true,"outputPath":"dist","index":"src/index.html","main":"src/main.ts","tsConfig":"src/tsconfig.app.json","polyfills":"src/polyfills.ts","assets":["src/icon.ico","src/assets",{"glob":"**/*","input":"../../../node_modules/monaco-editor/min/vs","output":"/assets/vs/"}],"styles":[{"input":"src/assets/theme/classic_forest.scss","bundleName":"classic_forest","inject":false},"src/assets/theme/antd.less","src/styles.scss","src/assets/font/iconfont.css","src/ng1/index.css"],"scripts":["src/ng1/lib/angular/angular.js","src/ng1/app.module.js","src/ng1/component/select-default.js","src/ng1/component/sort-and-filter.js","src/ng1/component/auto-complete.js","src/ng1/component/list-block.js","src/ng1/directive/get-dom-length.directive.js","src/ng1/directive/drop-down-menu.directive.js","src/ng1/directive/sort.directive.js","src/ng1/directive/drop-change-space.directive.js","src/ng1/directive/inner-html.directive.js","src/ng1/directive/insert-html.directive.js","src/ng1/directive/copy-common.directive.js","src/assets/libs/protocolcheck.js"],"customWebpackConfig":{"path":"./angular.webpack.js","replaceDuplicatePlugins":true},"allowedCommonJsDependencies":["brace","qs","rxjs"]},"configurations":{"dev":{"optimization":false,"outputHashing":"none","sourceMap":true,"namedChunks":false,"localize":false,"extractLicenses":true,"vendorChunk":false,"buildOptimizer":false,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.dev.ts"}]},"devCn":{"optimization":false,"outputHashing":"none","sourceMap":true,"namedChunks":false,"localize":["zh"],"extractLicenses":true,"vendorChunk":false,"buildOptimizer":false,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.dev.ts"}]},"production":{"optimization":true,"outputHashing":"all","sourceMap":false,"namedChunks":false,"extractLicenses":true,"vendorChunk":false,"buildOptimizer":true,"fileReplacements":[{"replace":"src/environments/environment.ts","with":"src/environments/environment.prod.ts"}]}}},"serve":{"builder":"@angular-builders/custom-webpack:dev-server","options":{"browserTarget":"eoapi:build"},"configurations":{"dev":{"browserTarget":"eoapi:build:dev"},"devCn":{"browserTarget":"eoapi:build:devCn"},"production":{"browserTarget":"eoapi:build:production"}}},"extract-i18n":{"builder":"@angular-devkit/build-angular:extract-i18n","options":{"browserTarget":"eoapi:build"}},"test":{"builder":"@angular-builders/custom-webpack:karma","options":{"main":"src/test.ts","polyfills":"src/polyfills-test.ts","tsConfig":"src/tsconfig.spec.json","karmaConfig":"src/karma.conf.js","scripts":[],"styles":["src/styles.scss"],"assets":["src/assets"],"customWebpackConfig":{"path":"./angular.webpack.js","replaceDuplicatePlugins":true}}},"lint":{"builder":"@angular-eslint/builder:lint","options":{"lintFilePatterns":["src/**/*.ts","src/**/*.html"]}}}},"eoapi-e2e":{"root":"e2e","projectType":"application","architect":{"lint":{"builder":"@angular-eslint/builder:lint","options":{"lintFilePatterns":["e2e/**/*.ts"]}}}}},"defaultProject":"eoapi","schematics":{"@schematics/angular:component":{"prefix":"eo","style":"scss"},"@schematics/angular:directive":{"prefix":"eo"}}}
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"cli": { "analytics": false, "defaultCollection": "@angular-eslint/schematics" },
|
|
||||||
"version": 1,
|
|
||||||
"newProjectRoot": "projects",
|
|
||||||
"projects": {
|
|
||||||
"eoapi": {
|
|
||||||
"root": "",
|
|
||||||
"i18n": {
|
|
||||||
"sourceLocale": { "code": "en", "baseHref": "" },
|
|
||||||
"locales": { "zh": { "translation": "src/locale/messages.zh.xlf", "baseHref": "" } }
|
|
||||||
},
|
|
||||||
"sourceRoot": "src",
|
|
||||||
"projectType": "application",
|
|
||||||
"schematics": { "@schematics/angular:application": { "strict": true } },
|
|
||||||
"architect": {
|
|
||||||
"build": {
|
|
||||||
"builder": "@angular-builders/custom-webpack:browser",
|
|
||||||
"options": {
|
|
||||||
"localize": true,
|
|
||||||
"aot": true,
|
|
||||||
"outputPath": "dist",
|
|
||||||
"index": "src/index.html",
|
|
||||||
"main": "src/main.ts",
|
|
||||||
"tsConfig": "src/tsconfig.app.json",
|
|
||||||
"polyfills": "src/polyfills.ts",
|
|
||||||
"assets": [
|
|
||||||
"src/icon.ico",
|
|
||||||
"src/assets",
|
|
||||||
{ "glob": "**/*", "input": "../../../node_modules/monaco-editor/min/vs", "output": "/assets/vs/" }
|
|
||||||
],
|
|
||||||
"styles": [
|
|
||||||
{ "input": "src/assets/theme/classic_forest.scss", "bundleName": "classic_forest", "inject": false },
|
|
||||||
"src/assets/theme/antd.less",
|
|
||||||
"src/styles.scss",
|
|
||||||
"src/assets/font/iconfont.css",
|
|
||||||
"src/ng1/index.css"
|
|
||||||
],
|
|
||||||
"scripts": [
|
|
||||||
"src/ng1/lib/angular/angular.js",
|
|
||||||
"src/ng1/app.module.js",
|
|
||||||
"src/ng1/component/select-default.js",
|
|
||||||
"src/ng1/component/sort-and-filter.js",
|
|
||||||
"src/ng1/component/auto-complete.js",
|
|
||||||
"src/ng1/component/list-block.js",
|
|
||||||
"src/ng1/directive/get-dom-length.directive.js",
|
|
||||||
"src/ng1/directive/drop-down-menu.directive.js",
|
|
||||||
"src/ng1/directive/sort.directive.js",
|
|
||||||
"src/ng1/directive/drop-change-space.directive.js",
|
|
||||||
"src/ng1/directive/inner-html.directive.js",
|
|
||||||
"src/ng1/directive/insert-html.directive.js",
|
|
||||||
"src/ng1/directive/copy-common.directive.js",
|
|
||||||
"src/assets/libs/protocolcheck.js"
|
|
||||||
],
|
|
||||||
"customWebpackConfig": { "path": "./angular.webpack.js", "replaceDuplicatePlugins": true },
|
|
||||||
"allowedCommonJsDependencies": ["brace", "qs", "rxjs"]
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"dev": {
|
|
||||||
"optimization": false,
|
|
||||||
"outputHashing": "none",
|
|
||||||
"sourceMap": true,
|
|
||||||
"namedChunks": false,
|
|
||||||
"localize": false,
|
|
||||||
"extractLicenses": true,
|
|
||||||
"vendorChunk": false,
|
|
||||||
"buildOptimizer": false,
|
|
||||||
"fileReplacements": [
|
|
||||||
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.dev.ts" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"devCn": {
|
|
||||||
"optimization": false,
|
|
||||||
"outputHashing": "none",
|
|
||||||
"sourceMap": true,
|
|
||||||
"namedChunks": false,
|
|
||||||
"localize": ["zh"],
|
|
||||||
"extractLicenses": true,
|
|
||||||
"vendorChunk": false,
|
|
||||||
"buildOptimizer": false,
|
|
||||||
"fileReplacements": [
|
|
||||||
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.dev.ts" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"optimization": true,
|
|
||||||
"outputHashing": "all",
|
|
||||||
"sourceMap": false,
|
|
||||||
"namedChunks": false,
|
|
||||||
"extractLicenses": true,
|
|
||||||
"vendorChunk": false,
|
|
||||||
"buildOptimizer": true,
|
|
||||||
"fileReplacements": [
|
|
||||||
{ "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"serve": {
|
|
||||||
"builder": "@angular-builders/custom-webpack:dev-server",
|
|
||||||
"options": { "browserTarget": "eoapi:build" },
|
|
||||||
"configurations": {
|
|
||||||
"dev": { "browserTarget": "eoapi:build:dev" },
|
|
||||||
"devCn": { "browserTarget": "eoapi:build:devCn" },
|
|
||||||
"production": { "browserTarget": "eoapi:build:production" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extract-i18n": {
|
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
||||||
"options": { "browserTarget": "eoapi:build" }
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"builder": "@angular-builders/custom-webpack:karma",
|
|
||||||
"options": {
|
|
||||||
"main": "src/test.ts",
|
|
||||||
"polyfills": "src/polyfills-test.ts",
|
|
||||||
"tsConfig": "src/tsconfig.spec.json",
|
|
||||||
"karmaConfig": "src/karma.conf.js",
|
|
||||||
"scripts": [],
|
|
||||||
"styles": ["src/styles.scss"],
|
|
||||||
"assets": ["src/assets"],
|
|
||||||
"customWebpackConfig": { "path": "./angular.webpack.js", "replaceDuplicatePlugins": true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": {
|
|
||||||
"builder": "@angular-eslint/builder:lint",
|
|
||||||
"options": { "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"eoapi-e2e": {
|
|
||||||
"root": "e2e",
|
|
||||||
"projectType": "application",
|
|
||||||
"architect": {
|
|
||||||
"lint": { "builder": "@angular-eslint/builder:lint", "options": { "lintFilePatterns": ["e2e/**/*.ts"] } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultProject": "eoapi",
|
|
||||||
"schematics": {
|
|
||||||
"@schematics/angular:component": { "prefix": "eo", "style": "scss" },
|
|
||||||
"@schematics/angular:directive": { "prefix": "eo" }
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,10 @@ const routes: Routes = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes, { useHash: true })],
|
imports: [
|
||||||
|
//electron user hash to keep router after page refresh
|
||||||
|
RouterModule.forRoot(routes, { useHash: !!(window && window.process && window.process.type) ? true : false }),
|
||||||
|
],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
})
|
})
|
||||||
export class AppRoutingModule {}
|
export class AppRoutingModule {}
|
||||||
|
@ -256,6 +256,13 @@ export class ApiTabService {
|
|||||||
}
|
}
|
||||||
handleDataBeforeCache(tabsByID) {
|
handleDataBeforeCache(tabsByID) {
|
||||||
Object.values(tabsByID).forEach((val: TabItem) => {
|
Object.values(tabsByID).forEach((val: TabItem) => {
|
||||||
|
//Delete gio key
|
||||||
|
if (val.params) {
|
||||||
|
['utm_campaign', 'utm_content', 'utm_source'].forEach((keyName) => {
|
||||||
|
delete val.params[keyName];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Cancel cache testResult
|
||||||
if (val.module === 'test' && val.content?.test?.testResult) {
|
if (val.module === 'test' && val.content?.test?.testResult) {
|
||||||
val.content.test.testResult = {
|
val.content.test.testResult = {
|
||||||
request: {},
|
request: {},
|
||||||
|
@ -106,8 +106,9 @@ export class ApiTestComponent implements OnInit, OnDestroy {
|
|||||||
) {
|
) {
|
||||||
//Select demo api when first open Eoapi
|
//Select demo api when first open Eoapi
|
||||||
if (!window.localStorage.getItem('local_TabCache')) {
|
if (!window.localStorage.getItem('local_TabCache')) {
|
||||||
|
const utm = new URLSearchParams(window.location.search);
|
||||||
this.router.navigate(['/home/api/http/test'], {
|
this.router.navigate(['/home/api/http/test'], {
|
||||||
queryParams: { pageID: Date.now(), uuid: 1 },
|
queryParams: { pageID: Date.now(), uuid: 1, ...Object.fromEntries(utm) },
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const testBtn = document.getElementById('btn-test');
|
const testBtn = document.getElementById('btn-test');
|
||||||
|
@ -4,7 +4,6 @@ import { ApiTabStorageService } from 'eo/workbench/browser/src/app/pages/api/tab
|
|||||||
import { TabItem, TabOperate } from 'eo/workbench/browser/src/app/pages/api/tab/tab.model';
|
import { TabItem, TabOperate } from 'eo/workbench/browser/src/app/pages/api/tab/tab.model';
|
||||||
import { MessageService } from 'eo/workbench/browser/src/app/shared/services/message';
|
import { MessageService } from 'eo/workbench/browser/src/app/shared/services/message';
|
||||||
import { EoMessageService } from 'eo/workbench/browser/src/app/eoui/message/eo-message.service';
|
import { EoMessageService } from 'eo/workbench/browser/src/app/eoui/message/eo-message.service';
|
||||||
import { ModalService } from 'eo/workbench/browser/src/app/shared/services/modal.service';
|
|
||||||
import { eoDeepCopy } from 'eo/workbench/browser/src/app/utils/index.utils';
|
import { eoDeepCopy } from 'eo/workbench/browser/src/app/utils/index.utils';
|
||||||
/**
|
/**
|
||||||
* Api tab service operate tabs array add/replace/close...
|
* Api tab service operate tabs array add/replace/close...
|
||||||
@ -25,8 +24,7 @@ export class ApiTabOperateService {
|
|||||||
private tabStorage: ApiTabStorageService,
|
private tabStorage: ApiTabStorageService,
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private message: EoMessageService,
|
private message: EoMessageService
|
||||||
private modal: ModalService
|
|
||||||
) {}
|
) {}
|
||||||
//Init tab info
|
//Init tab info
|
||||||
//Maybe from tab cache info or router url
|
//Maybe from tab cache info or router url
|
||||||
@ -88,7 +86,10 @@ export class ApiTabOperateService {
|
|||||||
* @returns tabItem
|
* @returns tabItem
|
||||||
*/
|
*/
|
||||||
newDefaultTab(path?) {
|
newDefaultTab(path?) {
|
||||||
const tabItem = Object.assign({}, eoDeepCopy(this.BASIC_TABS.find(val=>val.pathname===path)||this.BASIC_TABS[0]));
|
const tabItem = Object.assign(
|
||||||
|
{},
|
||||||
|
eoDeepCopy(this.BASIC_TABS.find((val) => val.pathname === path) || this.BASIC_TABS[0])
|
||||||
|
);
|
||||||
tabItem.params = {};
|
tabItem.params = {};
|
||||||
tabItem.uuid = tabItem.params.pageID = Date.now();
|
tabItem.uuid = tabItem.params.pageID = Date.now();
|
||||||
Object.assign(tabItem, { isLoading: false });
|
Object.assign(tabItem, { isLoading: false });
|
||||||
|
Loading…
Reference in New Issue
Block a user