提交 d0876984 authored 作者: pengxiaohui's avatar pengxiaohui

fix: 进入用户研究页先判断用户是否选取了案例

上级 5b1b656d
...@@ -98,24 +98,35 @@ export default { ...@@ -98,24 +98,35 @@ export default {
} }
}, },
created() { created() {
console.log(this.$store.state.case)
this.init() this.init()
this.status = this.$route.query.type || '0' this.status = this.$route.query.type || '0'
}, },
methods: { methods: {
init() { init() {
Promise.all([this.fetchQuestions(), this.fetchGetReport()]).then(res => { if (!(this.$store.state.case && this.$store.state.case.id)) {
// 组装数据 this.$alert('请先选择完成产品分析案例选择,再进行用户分析', {
const questions = res[0] confirmButtonText: '重新开始',
const selection = res[1].answer.options showClose: false,
if (selection.length > 0 && this.status !== '3') { callback: action => {
this.status = '1' this.$route.push('/home')
} }
this.initQuestions(questions, selection) })
this.score = res[1].answer.score } else {
this.handleChoiceSelect() Promise.all([this.fetchQuestions(), this.fetchGetReport()]).then(res => {
}).catch(err => { // 组装数据
console.log(err) const questions = res[0]
}) const selection = res[1].answer.options
if (selection.length > 0 && this.status !== '3') {
this.status = '1'
}
this.initQuestions(questions, selection)
this.score = res[1].answer.score
this.handleChoiceSelect()
}).catch(err => {
console.log(err)
})
}
}, },
handlePrev() { handlePrev() {
this.current.index-- this.current.index--
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论