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

View File

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

View File

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