Skip to content

Commit 0c1ebaa

Browse files
author
张晨曦
committed
Merge branch 'dev-1.2.0_k8s' of https://10.30.90.89:39999/luban/dataspherestudio into dev-1.2.0_k8s
2 parents 0ad4382 + c831e21 commit 0c1ebaa

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

web/src/dss/module/footer/guide.vue

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<div class="guide-box-title">常见问题</div>
6969
<ul class="guide-questions">
7070
<li v-for="q in guide.questions" :key="q.title">
71-
<a @click="changeToLibraryDetail(q)">{{ q.title }}</a>
71+
<a @click="changeQuestionToLibraryDetail(q)">{{ q.title }}</a>
7272
</li>
7373
</ul>
7474
</div>
@@ -232,32 +232,40 @@ export default {
232232
},
233233
changeToLibraryHome() {
234234
this.currentMode = "home";
235-
// 当前元素不等于history最后一个元素,就可以进入队列
236-
if (this.lastHistory.mode !== "home") {
237-
// history队列a b c d e, 如果当前在c,此时有元素进入队列,那么d e会被remove
238-
this.history = this.history.slice(0, this.currentIndex + 1).concat({ mode: "home", data: {} });
239-
this.currentIndex = this.currentIndex + 1;
240-
}
235+
// history队列a b c d e, 如果当前在c,此时有元素进入队列,那么d e会被remove
236+
this.history = this.history.slice(0, this.currentIndex + 1).concat({ mode: "home", data: {} });
237+
this.currentIndex = this.currentIndex + 1;
241238
},
242-
changeToLibraryDetail(chapter) {
239+
changeQuestionToLibraryDetail(chapter) {
243240
this.currentTab = "library";
244241
this.currentMode = "detail";
245242
this.currentDoc = chapter;
246-
// 当前元素不等于history最后一个元素,就可以进入队列
247-
if (this.lastHistory.data.id !== chapter.id) {
243+
// 点击学习tab的问题跳到知识库,然后再次点击同一问题,history不变,currentIndex不变;
244+
if (this.lastHistory.data.id == chapter.id && this.isLast && !this.isFirst) {
245+
// 内容相同且currentIndex是最后一个且不是第一个,无须重复展示
246+
} else {
248247
// history队列a b c d e, 如果当前在c,此时有元素进入队列,那么d e会被remove
249248
this.history = this.history.slice(0, this.currentIndex + 1).concat({ mode: "detail", data: chapter });
250249
this.currentIndex = this.currentIndex + 1;
251250
}
252251
},
252+
changeToLibraryDetail(chapter) {
253+
this.currentTab = "library";
254+
this.currentMode = "detail";
255+
this.currentDoc = chapter;
256+
// 点击某一文档内置链接,然后点返回,再次点击同一链接,此时currentIndex应该变化,history也最好更新;
257+
// history队列a b c d e, 如果当前在c,此时有元素进入队列,那么d e会被remove
258+
this.history = this.history.slice(0, this.currentIndex + 1).concat({ mode: "detail", data: chapter });
259+
this.currentIndex = this.currentIndex + 1;
260+
},
253261
changeToLibrarySearch() {
254262
if (!this.keyword || !this.keyword.trim()) {
255263
return;
256264
}
257-
this.currentMode = "search";
258265
if (this.lastHistory.mode == "search" && this.lastHistory.data.keyword == this.keyword.trim()) {
259266
// 最后一条历史记录是search且keyword没有变化,不处理
260267
} else {
268+
this.currentMode = "search";
261269
// history队列a b c d e, 如果当前在c,此时有元素进入队列,那么d e会被remove
262270
this.history = this.history.slice(0, this.currentIndex + 1).concat({ mode: "search", data: { keyword: this.keyword } });
263271
this.currentIndex = this.currentIndex + 1;
@@ -304,12 +312,13 @@ export default {
304312
};
305313
},
306314
changeDocument(type) {
307-
if (type == "prev" && this.currentIndex == 0) {
315+
if (type == "prev" && this.isFirst) {
308316
return;
309317
}
310-
if (type == "next" && this.currentIndex == this.history.length - 1) {
318+
if (type == "next" && this.isLast) {
311319
return;
312320
}
321+
this.loading = false;
313322
if (type == "prev") {
314323
this.currentIndex = this.currentIndex - 1;
315324
} else if (type == "next") {

0 commit comments

Comments
 (0)