fix(新手引导): 完成新手引导后,取消自动弹出功能介绍页面;修复再次引导时,引导步骤错乱.

This commit is contained in:
lan-yonghui 2023-04-11 20:53:15 +08:00 committed by fit2-zhao
parent 2cfb6105ff
commit 901f745928
3 changed files with 13 additions and 10 deletions

View File

@ -29,8 +29,8 @@ export default {
};
},
mounted() {
this.$refs.introduction.resVisible = localStorage.getItem("introduction") !== 'false' &&
(localStorage.getItem("guide") === '1' || localStorage.getItem("step") > 1);
this.$refs.introduction.resVisible = localStorage.getItem("introduction") && localStorage.getItem("introduction")
!== 'false' && (localStorage.getItem("guide") === 'true' || localStorage.getItem("step") > 1);
this.checkStep()
},
methods: {
@ -40,7 +40,8 @@ export default {
this.$refs.introduction.openNext();
break;
case "guidance":
localStorage.setItem("guide", 0)
localStorage.setItem("resetGuide", 'true')
localStorage.setItem("guide", 'false')
localStorage.removeItem('step')
if(this.$route.path.includes('project')){
this.$router.push('/project/home')
@ -59,15 +60,15 @@ export default {
checkStep(){
getSideTask().then(res=> {
if (res.data.length > 0 && res.data[0].guideStep) {
let localStep = localStorage.getItem("step") ? localStorage.getItem("step") : res.data[0].guideStep
localStorage.setItem('step', localStep)
localStorage.setItem('step', res.data[0].guideStep)
localStorage.setItem("noviceStatus", res.data[0].status)
} else {
localStorage.setItem('guide','0')
localStorage.setItem('guide','false')
}
let microApps = JSON.parse(sessionStorage.getItem("micro_apps"));
if(localStorage.getItem("guide") === '0' && microApps && microApps['project']) {
let step = localStorage.getItem("step") ? localStorage.getItem("step") : "1"
if(localStorage.getItem("guide") === 'false' && microApps && microApps['project']) {
let step = localStorage.getItem("step") && localStorage.getItem("resetGuide") !== 'true' ?
localStorage.getItem("step") : "1"
localStorage.setItem("step", step)
if(step !== '3'){

View File

@ -457,13 +457,14 @@ export function goSkip(_this) {
}
export function gotoCancel(_this, cancel) {
localStorage.setItem('resetGuide', 'false')
if (cancel) {
_this.cancel()
} else {
_this.complete()
}
saveStep().then(res => {
localStorage.setItem('guide', '1')
localStorage.setItem('guide', 'true')
}).catch(error => {
// 错误的信息
this.$error({
@ -475,6 +476,7 @@ export function gotoCancel(_this, cancel) {
// 上一步,下一步
export function gotoNext(_this, path, step) {
_this.next()
localStorage.setItem('resetGuide', 'false')
localStorage.setItem('step', step)
if (path) {
this.$router.push(path)

View File

@ -170,7 +170,7 @@ export default {
},
mounted() {
this.$refs.introduction.resVisible = false
if(localStorage.getItem("step") === '3') {
if(localStorage.getItem("guide") === 'false' && localStorage.getItem("step") === '3') {
this.initStep()
}
},