提交 752f3075 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 3d57cefb
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
}, },
matches(pattern, name) { matches(pattern, name) {
if (Array.isArray(pattern)) { if (Array.isArray(pattern)) {
return pattern.findIndex(item => item.fullPath === name) !== -1; return pattern.findIndex(item => item.to.fullPath === name) !== -1;
} else if (typeof pattern === 'string') { } else if (typeof pattern === 'string') {
return pattern.split(',').indexOf(name) > -1; return pattern.split(',').indexOf(name) > -1;
} else if (this.isRegExp(pattern)) { } else if (this.isRegExp(pattern)) {
......
<template> <template>
<div class="ibiz-page-tag" v-if="appService.navHistory.metaList.length > 0"> <div class="ibiz-page-tag" v-if="appService.navHistory.historyList.length > 0">
<div class="move-btn move-left" @click="leftMove"> <div class="move-btn move-left" @click="leftMove">
<icon type="ios-arrow-back" /> <icon type="ios-arrow-back" />
</div> </div>
<div ref="scrollBody" class="tags-body"> <div ref="scrollBody" class="tags-body">
<div ref="scrollChild" class="tags-container" :style="{left: styleLeft + 'px'}"> <div ref="scrollChild" class="tags-container" :style="{left: styleLeft + 'px'}">
<transition-group name="tags-transition"> <transition-group name="tags-transition">
<template v-for="(meta, index) of appService.navHistory.metaList"> <template v-for="(item, index) of appService.navHistory.historyList">
<Tag ref="tagElement" :key="index" :class="isActive(appService.navHistory.historyList[index]) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(appService.navHistory.historyList[index])" @on-close="onClose(appService.navHistory.historyList[index])"> <Tag ref="tagElement" :key="index" :class="isActive(item) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(item)" @on-close="onClose(item)">
<div class="tag-text"> <div class="tag-text">
<div :title="getCaption(meta.caption, meta.info)" style="max-width: 300px;"> <div :title="getCaption(item.meta.caption, item.meta.info)" style="max-width: 300px;">
<i v-if="meta.iconCls && !Object.is(meta.iconCls, '')" :class="meta.iconCls"></i> <i v-if="item.meta.iconCls && !Object.is(item.meta.iconCls, '')" :class="item.meta.iconCls"></i>
<img v-else :src="meta.imgPath" class="text-icon" /> <img v-else :src="item.meta.imgPath" class="text-icon" />
&nbsp;{{getCaption(meta.caption, meta.info)}} &nbsp;{{getCaption(item.meta.caption, item.meta.info)}}
</div> </div>
</div> </div>
</Tag> </Tag>
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
import { Vue, Component, Provide, Prop, Watch } from 'vue-property-decorator'; import { Vue, Component, Provide, Prop, Watch } from 'vue-property-decorator';
import { Environment } from '../../environments/environment'; import { Environment } from '../../environments/environment';
import { AppService } from '../../studio-core/service/app-service/AppService'; import { AppService } from '../../studio-core/service/app-service/AppService';
import { HistoryItem } from '../../studio-core/service/app-nav-history/AppNavHistoryBase';
@Component({}) @Component({})
export default class TabPageExp extends Vue { export default class TabPageExp extends Vue {
...@@ -101,12 +102,12 @@ export default class TabPageExp extends Vue { ...@@ -101,12 +102,12 @@ export default class TabPageExp extends Vue {
/** /**
* 是否选中 * 是否选中
* *
* @param {*} page * @param {HistoryItem} item
* @returns {boolean} * @returns {boolean}
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public isActive(page: any): boolean { public isActive(item: HistoryItem): boolean {
if (Object.is(page.fullPath, this.$route.fullPath)) { if (Object.is(item.to.fullPath, this.$route.fullPath)) {
return true; return true;
} }
return false; return false;
...@@ -115,11 +116,11 @@ export default class TabPageExp extends Vue { ...@@ -115,11 +116,11 @@ export default class TabPageExp extends Vue {
/** /**
* 关闭 * 关闭
* *
* @param {*} page * @param {HistoryItem} item
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public onClose(page: any) { public onClose(item: HistoryItem) {
const appview = this.$store.getters['viewaction/getAppView'](this.appService.navHistory.viewTagMap.get(page.fullPath)); const appview = this.$store.getters['viewaction/getAppView'](item.tag);
if (appview && appview.viewdatachange) { if (appview && appview.viewdatachange) {
const title: any = this.$t('app.tabpage.sureclosetip.title'); const title: any = this.$t('app.tabpage.sureclosetip.title');
const content: any = this.$t('app.tabpage.sureclosetip.content'); const content: any = this.$t('app.tabpage.sureclosetip.content');
...@@ -127,15 +128,15 @@ export default class TabPageExp extends Vue { ...@@ -127,15 +128,15 @@ export default class TabPageExp extends Vue {
title: title, title: title,
content: content, content: content,
onOk: () => { onOk: () => {
this.appService.navHistory.remove(page); this.appService.navHistory.remove(item);
this.gotoPage(page); this.gotoPage(item.to);
}, },
onCancel: () => { onCancel: () => {
} }
}); });
} else { } else {
this.appService.navHistory.remove(page); this.appService.navHistory.remove(item);
this.gotoPage(page); this.gotoPage(item.to);
} }
} }
...@@ -155,11 +156,11 @@ export default class TabPageExp extends Vue { ...@@ -155,11 +156,11 @@ export default class TabPageExp extends Vue {
/** /**
* 切换分页 * 切换分页
* *
* @param {*} page * @param {*} item
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public changePage(page: any) { public changePage(item: HistoryItem) {
this.gotoPage(page); this.gotoPage(item.to);
} }
/** /**
...@@ -254,7 +255,7 @@ export default class TabPageExp extends Vue { ...@@ -254,7 +255,7 @@ export default class TabPageExp extends Vue {
this.appService.navHistory.reset(); this.appService.navHistory.reset();
this.gotoPage(); this.gotoPage();
} else if (Object.is(name, 'closeOther')) { } else if (Object.is(name, 'closeOther')) {
this.appService.navHistory.removeOther(this.$route); this.appService.navHistory.removeOther({ to: this.$route });
this.moveToView(this.$route); this.moveToView(this.$route);
} }
} }
......
...@@ -62,21 +62,6 @@ export default class CampaignServiceBase extends EntityService { ...@@ -62,21 +62,6 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
let campaigncampaignsData:any = []; let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any); campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
...@@ -107,6 +92,21 @@ export default class CampaignServiceBase extends EntityService { ...@@ -107,6 +92,21 @@ export default class CampaignServiceBase extends EntityService {
} }
} }
masterData.campaignlists = campaignlistsData; masterData.campaignlists = campaignlistsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -116,9 +116,9 @@ export default class CampaignServiceBase extends EntityService { ...@@ -116,9 +116,9 @@ export default class CampaignServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/campaigns`,data,isloading); let res:any = await Http.getInstance().post(`/campaigns`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(tempContext.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
...@@ -133,21 +133,6 @@ export default class CampaignServiceBase extends EntityService { ...@@ -133,21 +133,6 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
let campaigncampaignsData:any = []; let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any); campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
...@@ -178,11 +163,26 @@ export default class CampaignServiceBase extends EntityService { ...@@ -178,11 +163,26 @@ export default class CampaignServiceBase extends EntityService {
} }
} }
masterData.campaignlists = campaignlistsData; masterData.campaignlists = campaignlistsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/campaigns/${context.campaign}`,data,isloading); let res:any = await Http.getInstance().put(`/campaigns/${context.campaign}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
...@@ -210,9 +210,9 @@ export default class CampaignServiceBase extends EntityService { ...@@ -210,9 +210,9 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading); let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
...@@ -228,9 +228,9 @@ export default class CampaignServiceBase extends EntityService { ...@@ -228,9 +228,9 @@ export default class CampaignServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading); let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading);
res.data.campaign = data.campaign; res.data.campaign = data.campaign;
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
...@@ -258,21 +258,6 @@ export default class CampaignServiceBase extends EntityService { ...@@ -258,21 +258,6 @@ export default class CampaignServiceBase extends EntityService {
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
let campaigncampaignsData:any = []; let campaigncampaignsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns'),'undefined')){
campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any); campaigncampaignsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaigncampaigns') as any);
...@@ -303,11 +288,26 @@ export default class CampaignServiceBase extends EntityService { ...@@ -303,11 +288,26 @@ export default class CampaignServiceBase extends EntityService {
} }
} }
masterData.campaignlists = campaignlistsData; masterData.campaignlists = campaignlistsData;
let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(leadsData && leadsData.length && leadsData.length > 0){
leadsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.leadid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.leads = leadsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/campaigns/${context.campaign}/save`,data,isloading); let res:any = await Http.getInstance().post(`/campaigns/${context.campaign}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
return res; return res;
} }
......
...@@ -2,6 +2,43 @@ import { Util } from '@/utils'; ...@@ -2,6 +2,43 @@ import { Util } from '@/utils';
import { AppContextStore } from '../app-context-store/AppContextStore'; import { AppContextStore } from '../app-context-store/AppContextStore';
import { UIStateService } from '../UIStateService'; import { UIStateService } from '../UIStateService';
/**
* 历史记录项
*
* @export
* @interface HistoryItem
*/
export interface HistoryItem {
/**
* 路由信息
*
* @type {*}
* @memberof HistoryItem
*/
to?: any;
/**
* 参数信息
*
* @type {*}
* @memberof HistoryItem
*/
meta?: any;
/**
* 视图标识
*
* @type {string}
* @memberof HistoryItem
*/
tag?: string;
/**
* 上下文
*
* @type {*}
* @memberof HistoryItem
*/
context?: any;
}
/** /**
* 应用导航记录基类 * 应用导航记录基类
* *
...@@ -29,26 +66,10 @@ export class AppNavHistoryBase { ...@@ -29,26 +66,10 @@ export class AppNavHistoryBase {
/** /**
* 路由记录缓存 * 路由记录缓存
* *
* @type {any[]} * @type {HistoryItem[]}
* @memberof AppNavHistoryBase * @memberof AppNavHistoryBase
*/ */
public readonly historyList: any[] = []; public readonly historyList: HistoryItem[] = [];
/**
* 参数列表
*
* @type {string[]}
* @memberof AppNavHistoryBase
*/
public readonly metaList: string[] = [];
/**
* 视图标识
*
* @type {Map<string, string>}
* @memberof AppNavHistoryBase
*/
public readonly viewTagMap: Map<string, string> = new Map();
/** /**
* 导航缓存,忽略判断的导航参数正则 * 导航缓存,忽略判断的导航参数正则
...@@ -72,10 +93,11 @@ export class AppNavHistoryBase { ...@@ -72,10 +93,11 @@ export class AppNavHistoryBase {
return -1; return -1;
} }
return list.findIndex((item: any) => { return list.findIndex((item: any) => {
const to = item.to;
// 基本路径是否一致 // 基本路径是否一致
if (Object.is(item.path, page.path)) { if (Object.is(to.path, page.path)) {
// 历史路径是否存在参数 // 历史路径是否存在参数
if (this.uiStateService.layoutState.styleMode === 'STYLE2' && item.query) { if (this.uiStateService.layoutState.styleMode === 'STYLE2' && to.query) {
let judge: boolean = true; let judge: boolean = true;
// 新路径是否存在参数 // 新路径是否存在参数
if (page.query) { if (page.query) {
...@@ -84,7 +106,7 @@ export class AppNavHistoryBase { ...@@ -84,7 +106,7 @@ export class AppNavHistoryBase {
if (this.navIgnoreParameters.test(`|${key}|`)) { if (this.navIgnoreParameters.test(`|${key}|`)) {
continue; continue;
} }
if (item.query[key] === undefined || item.query[key] === null) { if (to.query[key] === undefined || to.query[key] === null) {
judge = false; judge = false;
} }
} }
...@@ -102,30 +124,31 @@ export class AppNavHistoryBase { ...@@ -102,30 +124,31 @@ export class AppNavHistoryBase {
/** /**
* 添加视图缓存 * 添加视图缓存
* *
* @param {*} page 当前路由信息 * @param {*} to 当前路由信息
* @memberof AppNavHistoryBase * @memberof AppNavHistoryBase
*/ */
public add(page: any): void { public add(to: any): void {
if (this.findHistoryIndex(page) === -1) { if (this.findHistoryIndex(to) === -1) {
if (this.uiStateService.layoutState.styleMode === 'DEFAULT' && page?.matched?.length === 1) { if (this.uiStateService.layoutState.styleMode === 'DEFAULT' && to?.matched?.length === 1) {
return; return;
} }
this.historyList.push(page); this.historyList.push({
this.metaList.push(Util.deepCopy(page.meta)); to,
meta: Util.deepCopy(to.meta)
});
} }
} }
/** /**
* 删除视图缓存 * 删除视图缓存
* *
* @param {*} page * @param {HistoryItem} item
* @memberof AppNavHistoryBase * @memberof AppNavHistoryBase
*/ */
public remove(page: any): void { public remove(item: HistoryItem): void {
const i = this.findHistoryIndex(page); const i = this.findHistoryIndex(item.to);
if (i !== -1) { if (i !== -1) {
this.historyList.splice(i, 1); this.historyList.splice(i, 1);
this.metaList.splice(i, 1);
} }
} }
...@@ -137,7 +160,6 @@ export class AppNavHistoryBase { ...@@ -137,7 +160,6 @@ export class AppNavHistoryBase {
*/ */
public reset(num: number = 0): void { public reset(num: number = 0): void {
this.historyList.splice(num, this.historyList.length); this.historyList.splice(num, this.historyList.length);
this.metaList.splice(num, this.metaList.length);
} }
/** /**
...@@ -152,8 +174,8 @@ export class AppNavHistoryBase { ...@@ -152,8 +174,8 @@ export class AppNavHistoryBase {
if (i === -1) { if (i === -1) {
return false; return false;
} }
const meta = this.metaList[i]; const item = this.historyList[i];
Object.assign(meta, { caption, info }); Object.assign(item.meta, { caption, info });
return true; return true;
} }
...@@ -170,26 +192,23 @@ export class AppNavHistoryBase { ...@@ -170,26 +192,23 @@ export class AppNavHistoryBase {
if (i === -1) { if (i === -1) {
return false; return false;
} }
const page = this.historyList[i]; const item = this.historyList[i];
this.viewTagMap.set(page.fullPath, tag); item.tag = tag;
return true; return true;
} }
/** /**
* 删除其他缓存 * 删除其他缓存
* *
* @param {*} page * @param {HistoryItem} item
* @memberof AppNavHistoryBase * @memberof AppNavHistoryBase
*/ */
public removeOther(page: any): void { public removeOther(item: HistoryItem): void {
const i = this.findHistoryIndex(page); const i = this.findHistoryIndex(item.to);
if (i !== -1) { if (i !== -1) {
const page = this.historyList[i]; const page = this.historyList[i];
const meta = this.metaList[i];
this.historyList.splice(0, this.historyList.length); this.historyList.splice(0, this.historyList.length);
this.metaList.splice(0, this.metaList.length);
this.historyList.push(page); this.historyList.push(page);
this.metaList.push(meta);
} }
} }
...@@ -200,7 +219,6 @@ export class AppNavHistoryBase { ...@@ -200,7 +219,6 @@ export class AppNavHistoryBase {
*/ */
public pop(): void { public pop(): void {
this.historyList.pop(); this.historyList.pop();
this.metaList.pop();
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册