|
@@ -108,18 +108,17 @@ export default {
|
|
|
return route.path === this.$route.path;
|
|
|
},
|
|
|
syncTagViewAndSaveForm() {
|
|
|
- const keys = this.$store.state.tagsView.visitedViews.map(
|
|
|
- (item) => {
|
|
|
- // (item)
|
|
|
- return item.path}
|
|
|
- );
|
|
|
+ const keys = this.$store.state.tagsView.visitedViews.map((item) => {
|
|
|
+ // (item)
|
|
|
+ return item.path;
|
|
|
+ });
|
|
|
const searchs = new Searchs();
|
|
|
const allSearch = searchs.getSearchs();
|
|
|
|
|
|
const sks = Object.keys(allSearch);
|
|
|
let route = this.$route;
|
|
|
for (const item of sks) {
|
|
|
- if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
|
|
|
+ if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
|
|
|
searchs.removeByKey(item);
|
|
|
}
|
|
|
|
|
@@ -160,24 +159,44 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- closeSelectedTag(view) {
|
|
|
- activeKey = "1";
|
|
|
+ async closeSelectedTag(view) {
|
|
|
|
|
|
- const searchs = new Searchs();
|
|
|
- searchs.remove(this.$route.path);
|
|
|
- this.$store
|
|
|
- .dispatch("delVisitedViews", { ...view, dontNeedSave: true })
|
|
|
- .then((views) => {
|
|
|
+ activeKey = "1";
|
|
|
+ //
|
|
|
+ if (this.$route.meta.nogo) {
|
|
|
+ try {
|
|
|
+ let views = await this.$store.getters.views;
|
|
|
if (this.isActive(view)) {
|
|
|
- const latestView = views.slice(-1)[0];
|
|
|
+
|
|
|
+ const latestView = views[views.length -2];
|
|
|
+ console.log(views)
|
|
|
if (latestView) {
|
|
|
this.$router.push(latestView.fullPath);
|
|
|
} else {
|
|
|
- let firstMenuUrl = localStorage.getItem('firstMenuUrl')
|
|
|
- this.$router.push(firstMenuUrl || '/');
|
|
|
+ let firstMenuUrl = localStorage.getItem("firstMenuUrl");
|
|
|
+ this.$router.push(firstMenuUrl || "/");
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const searchs = new Searchs();
|
|
|
+ searchs.remove(this.$route.path);
|
|
|
+ this.$store
|
|
|
+ .dispatch("delVisitedViews", { ...view, dontNeedSave: true })
|
|
|
+ .then((views) => {
|
|
|
+ if (this.isActive(view)) {
|
|
|
+ const latestView = views.slice(-1)[0];
|
|
|
+ if (latestView) {
|
|
|
+ this.$router.push(latestView.fullPath);
|
|
|
+ } else {
|
|
|
+ let firstMenuUrl = localStorage.getItem("firstMenuUrl");
|
|
|
+ this.$router.push(firstMenuUrl || "/");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
closeOthersTags() {
|
|
|
this.$router.push(this.selectedTag.path);
|
|
@@ -195,19 +214,19 @@ export default {
|
|
|
// this.selectedTag = tag;
|
|
|
// this.left = e.clientX;
|
|
|
// this.top = e.clientY - 55;
|
|
|
- const menuMinWidth = 105
|
|
|
- const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
|
|
|
- const offsetWidth = this.$el.offsetWidth // container width
|
|
|
- const maxLeft = offsetWidth - menuMinWidth // left boundary
|
|
|
- const left = e.clientX - offsetLeft + 15 // 15: margin right
|
|
|
+ const menuMinWidth = 105;
|
|
|
+ const offsetLeft = this.$el.getBoundingClientRect().left; // container margin left
|
|
|
+ const offsetWidth = this.$el.offsetWidth; // container width
|
|
|
+ const maxLeft = offsetWidth - menuMinWidth; // left boundary
|
|
|
+ const left = e.clientX - offsetLeft + 15; // 15: margin right
|
|
|
if (left > maxLeft) {
|
|
|
- this.left = maxLeft
|
|
|
+ this.left = maxLeft;
|
|
|
} else {
|
|
|
- this.left = left
|
|
|
+ this.left = left;
|
|
|
}
|
|
|
this.top = e.clientY - 55;
|
|
|
- this.visible = true
|
|
|
- this.selectedTag = tag
|
|
|
+ this.visible = true;
|
|
|
+ this.selectedTag = tag;
|
|
|
},
|
|
|
closeMenu() {
|
|
|
this.visible = false;
|
|
@@ -219,7 +238,6 @@ export default {
|
|
|
const searchs = new Searchs();
|
|
|
let keyName = "";
|
|
|
|
|
|
-
|
|
|
for (const key in searchs.searchs) {
|
|
|
if (Object.hasOwnProperty.call(searchs.searchs, key)) {
|
|
|
const item = searchs.searchs[key];
|