提交 4d1d99af 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 00bd469b
...@@ -39,7 +39,6 @@ export default class AppActionBar extends Vue { ...@@ -39,7 +39,6 @@ export default class AppActionBar extends Vue {
* @memberof AppActionBar * @memberof AppActionBar
*/ */
public handleClick($event: any) { public handleClick($event: any) {
console.log(this.items);
this.$emit("itemClick", $event); this.$emit("itemClick", $event);
} }
} }
......
...@@ -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.indexOf(name) > -1; return pattern.findIndex(item => item.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.historyPathList > 0"> <div class="ibiz-page-tag" v-if="appService.navHistory.metaList.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="(page, index) of $appService.navHistory.historyPathList"> <template v-for="(meta, index) of appService.navHistory.metaList">
<Tag ref="tagElement" :key="index" :class="isActive(page) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(page)" @on-close="onClose(page)"> <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])">
<div class="tag-text"> <div class="tag-text">
<div :title="getCaption(page.meta.caption, page.meta.info)" style="max-width: 300px;"> <div :title="getCaption(meta.caption, meta.info)" style="max-width: 300px;">
<i v-if="page.meta.iconCls && !Object.is(page.meta.iconCls, '')" :class="page.meta.iconCls"></i> <i v-if="meta.iconCls && !Object.is(meta.iconCls, '')" :class="meta.iconCls"></i>
<img v-else :src="page.meta.imgPath" class="text-icon" /> <img v-else :src="meta.imgPath" class="text-icon" />
&nbsp;{{getCaption(page.meta.caption, page.meta.info)}} &nbsp;{{getCaption(meta.caption, meta.info)}}
</div> </div>
</div> </div>
</Tag> </Tag>
...@@ -39,10 +39,13 @@ ...@@ -39,10 +39,13 @@
<script lang="ts"> <script lang="ts">
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';
@Component({}) @Component({})
export default class TabPageExp extends Vue { export default class TabPageExp extends Vue {
protected appService: AppService = new AppService();
@Provide() @Provide()
public styleLeft: number = 0; public styleLeft: number = 0;
...@@ -116,11 +119,7 @@ export default class TabPageExp extends Vue { ...@@ -116,11 +119,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public onClose(page: any) { public onClose(page: any) {
if (!page) { const appview = this.$store.getters['viewaction/getAppView'](this.appService.navHistory.viewTagMap.get(page.fullPath));
this.$appService.navHistory.remove(page);
this.gotoPage();
}
const appview = this.$store.getters['viewaction/getAppView'](page.viewtag);
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');
...@@ -128,15 +127,15 @@ export default class TabPageExp extends Vue { ...@@ -128,15 +127,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(page);
this.gotoPage(); this.gotoPage(page);
}, },
onCancel: () => { onCancel: () => {
} }
}); });
} else { } else {
this.$appService.navHistory.remove(page); this.appService.navHistory.remove(page);
this.gotoPage(); this.gotoPage(page);
} }
} }
...@@ -147,7 +146,7 @@ export default class TabPageExp extends Vue { ...@@ -147,7 +146,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public isClose() { public isClose() {
if (this.$appService.navHistory.historyList.length > 1) { if (this.appService.navHistory.historyList.length > 1) {
return true; return true;
} }
return false; return false;
...@@ -195,7 +194,7 @@ export default class TabPageExp extends Vue { ...@@ -195,7 +194,7 @@ export default class TabPageExp extends Vue {
if(this.$route.meta && (!Object.is(this.$route.meta.caption, caption))) { if(this.$route.meta && (!Object.is(this.$route.meta.caption, caption))) {
return; return;
} }
this.$store.commit("setCurPageCaption", { route: this.$route, caption: title, info: info }); this.appService.navHistory.setCaption({ route: this.$route, caption: title, info: info });
setTimeout(() => { setTimeout(() => {
this.moveToView(this.$route); this.moveToView(this.$route);
}, 1); }, 1);
...@@ -208,7 +207,7 @@ export default class TabPageExp extends Vue { ...@@ -208,7 +207,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public moveToView(page: any) { public moveToView(page: any) {
const pages: any[] = this.$appService.navHistory.historyList; const pages: any[] = this.appService.navHistory.historyList;
let leftWidth: number = 0; let leftWidth: number = 0;
this.$nextTick(() => { this.$nextTick(() => {
pages.forEach((page, index) => { pages.forEach((page, index) => {
...@@ -252,10 +251,10 @@ export default class TabPageExp extends Vue { ...@@ -252,10 +251,10 @@ export default class TabPageExp extends Vue {
*/ */
public doTagAction(name: string) { public doTagAction(name: string) {
if (Object.is(name, 'closeAll')) { if (Object.is(name, 'closeAll')) {
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(this.$route);
this.moveToView(this.$route); this.moveToView(this.$route);
} }
} }
......
...@@ -9,7 +9,6 @@ Vue.use(Router); ...@@ -9,7 +9,6 @@ Vue.use(Router);
const appService = new AppService(); const appService = new AppService();
const router = new Router({ const router = new Router({
routes: [ routes: [
{ {
......
import { SingletonMode } from '../../decorators/SingletonMode';
import { AppContextStoreBase } from './AppContextStoreBase'; import { AppContextStoreBase } from './AppContextStoreBase';
/** /**
...@@ -7,6 +8,7 @@ import { AppContextStoreBase } from './AppContextStoreBase'; ...@@ -7,6 +8,7 @@ import { AppContextStoreBase } from './AppContextStoreBase';
* @class AppContextStore * @class AppContextStore
* @extends {AppContextStoreBase} * @extends {AppContextStoreBase}
*/ */
@SingletonMode()
export class AppContextStore extends AppContextStoreBase { export class AppContextStore extends AppContextStoreBase {
} }
\ No newline at end of file
import { SingletonMode } from '../../decorators/SingletonMode';
import { AppNavHistoryBase } from './AppNavHistoryBase'; import { AppNavHistoryBase } from './AppNavHistoryBase';
/** /**
...@@ -7,6 +8,7 @@ import { AppNavHistoryBase } from './AppNavHistoryBase'; ...@@ -7,6 +8,7 @@ import { AppNavHistoryBase } from './AppNavHistoryBase';
* @class AppNavHistory * @class AppNavHistory
* @extends {AppNavHistoryBase} * @extends {AppNavHistoryBase}
*/ */
@SingletonMode()
export class AppNavHistory extends AppNavHistoryBase { export class AppNavHistory extends AppNavHistoryBase {
} }
\ No newline at end of file
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';
...@@ -33,6 +34,14 @@ export class AppNavHistoryBase { ...@@ -33,6 +34,14 @@ export class AppNavHistoryBase {
*/ */
public readonly historyList: any[] = []; public readonly historyList: any[] = [];
/**
* 参数列表
*
* @type {string[]}
* @memberof AppNavHistoryBase
*/
public readonly metaList: string[] = [];
/** /**
* 视图标识 * 视图标识
* *
...@@ -43,6 +52,9 @@ export class AppNavHistoryBase { ...@@ -43,6 +52,9 @@ export class AppNavHistoryBase {
/** /**
* 导航缓存,忽略判断的导航参数正则 * 导航缓存,忽略判断的导航参数正则
*
* @type {RegExp}
* @memberof AppNavHistoryBase
*/ */
public readonly navIgnoreParameters: RegExp = new RegExp(/(srftabactivate|srftreeexpactivate)/); public readonly navIgnoreParameters: RegExp = new RegExp(/(srftabactivate|srftreeexpactivate)/);
...@@ -95,7 +107,11 @@ export class AppNavHistoryBase { ...@@ -95,7 +107,11 @@ export class AppNavHistoryBase {
*/ */
public add(page: any): void { public add(page: any): void {
if (this.findHistoryIndex(page) === -1) { if (this.findHistoryIndex(page) === -1) {
if (this.uiStateService.layoutState.styleMode === 'DEFAULT' && page?.matched?.length === 1) {
return;
}
this.historyList.push(page); this.historyList.push(page);
this.metaList.push(Util.deepCopy(page.meta));
} }
} }
...@@ -109,6 +125,7 @@ export class AppNavHistoryBase { ...@@ -109,6 +125,7 @@ export class AppNavHistoryBase {
const i = this.findHistoryIndex(page); const i = this.findHistoryIndex(page);
if (i !== -1) { if (i !== -1) {
this.historyList.splice(i, 1); this.historyList.splice(i, 1);
this.metaList.splice(i, 1);
} }
} }
...@@ -119,6 +136,7 @@ export class AppNavHistoryBase { ...@@ -119,6 +136,7 @@ export class AppNavHistoryBase {
*/ */
public reset(): void { public reset(): void {
this.historyList.splice(0, this.historyList.length); this.historyList.splice(0, this.historyList.length);
this.metaList.splice(0, this.metaList.length);
} }
/** /**
...@@ -133,8 +151,8 @@ export class AppNavHistoryBase { ...@@ -133,8 +151,8 @@ export class AppNavHistoryBase {
if (i === -1) { if (i === -1) {
return false; return false;
} }
const page = this.historyList[i]; const meta = this.metaList[i];
Object.assign(page.meta, { caption, info }); Object.assign(meta, { caption, info });
return true; return true;
} }
...@@ -153,7 +171,6 @@ export class AppNavHistoryBase { ...@@ -153,7 +171,6 @@ export class AppNavHistoryBase {
} }
const page = this.historyList[i]; const page = this.historyList[i];
this.viewTagMap.set(page.fullPath, tag); this.viewTagMap.set(page.fullPath, tag);
console.log(this.viewTagMap);
return true; return true;
} }
...@@ -167,8 +184,12 @@ export class AppNavHistoryBase { ...@@ -167,8 +184,12 @@ export class AppNavHistoryBase {
const i = this.findHistoryIndex(page); const i = this.findHistoryIndex(page);
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);
} }
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册