<template>
|
<div>
|
</div>
|
</template>
|
|
<script>
|
import demographyApi from '@/api/demography'
|
import { mapMutations, mapState } from 'vuex'
|
import examPaperApi from '@/api/examPaper'
|
export default {
|
// components: { QuestionEdit },
|
data () {
|
return {
|
demographyMenber: { data: [] },
|
paraMemberToken: this.$route.params.memberToken,
|
productId: 0,
|
paramsInfo: {},
|
parasInfos: [],
|
parasInfoIds: {},
|
formDo: {},
|
statusInfo: { '2': this.$t('statusInfo2'), '3': this.$t('statusInfo3'), '4': this.$t('statusInfo4') }
|
}
|
},
|
created () {
|
let _this = this
|
_this.getLangType()
|
// 记录登陆日志
|
examPaperApi.recordLogininfor(_this.paraMemberToken).then(re => {
|
}).catch(e => {
|
})
|
// 已经答完了不能答题
|
examPaperApi.selectTokenId(_this.paraMemberToken).then(re => {
|
if (re.response.finish === 1) {
|
_this.$router.push({ path: '/exam/finish', query: { name: '', content: _this.$t('finishMsg'), tokenId: _this.paraMemberToken } })
|
} else if (re.response.status !== '1') {
|
_this.$router.push({ path: '/exam/exception', query: { name: '', content: _this.statusInfo[re.response.status] } })
|
} else {
|
// _this.doUrl = re.response.doUrl
|
_this.setMemberTocken(_this.paraMemberToken)
|
_this.setDoUrl(re.response.doUrl)
|
_this.setReportTemplateId(re.response.reportTemplateId)
|
_this.queryCreate()
|
}
|
}).catch(e => {
|
})
|
},
|
methods: {
|
queryCreate: function () {
|
// 先查询人口学是否已经填完
|
let _this = this
|
demographyApi.queryDemographyParamInfo(_this.paraMemberToken).then(
|
reParam => {
|
if (reParam.code !== 1) {
|
// 职业兴趣报告特殊化处理 只有中文
|
if(_this.doUrl === 'career_interests') {
|
_this.$i18n.locale = 'zh'
|
_this.setLangType('Chinese')
|
_this.$router.push({ path: '/demography/fill/index', query: { demographyMenber: _this.memberToken, isStart: false } })
|
return
|
}
|
|
// 先选择密码
|
_this.$router.push({ path: '/demography/fill/langOption', query: { langSelectValue: _this.langType } })
|
_this.setMemberTocken(_this.paraMemberToken)
|
return
|
}
|
if (reParam.response[0].langType === 'Chinese') {
|
this.$i18n.locale = 'zh'
|
_this.setLangType('Chinese')
|
} else {
|
_this.setLangType('English')
|
this.$i18n.locale = 'en'
|
}
|
_this.setMemberId(reParam.response[0].memberId)
|
// 判断如果是在第一题,那么就展示指导语
|
examPaperApi.selectTokenId(_this.memberToken).then(re => {
|
let answered = re.response.examItemOrderAndContentList
|
if (answered === null) {
|
examPaperApi.select(_this.memberToken, _this.langType).then(re => {
|
_this.formDo = re.response
|
_this.setDoUrl(re.response.questionTemplateId)
|
_this.$router.push({ path: '/guide/index', query: { formDo: _this.formDo } })
|
}).catch(e => {
|
_this.$message.error(_this.$t('noquestionMsg'))
|
})
|
} else {
|
_this.$router.push({ path: '/exam/' + _this.doUrl })
|
}
|
}).catch(e => {
|
})
|
}
|
).catch(e => {
|
})
|
},
|
...mapMutations('user', ['setMemberTocken']),
|
...mapMutations('user', ['setMemberId']),
|
...mapMutations('exam', ['setDoUrl']),
|
...mapMutations('exam', ['setReportTemplateId']),
|
...mapMutations('user', ['setLangType']),
|
...mapMutations('user', ['getLangType'])
|
},
|
computed: {
|
...mapState('user', { memberToken: state => state.memberToken }),
|
...mapState('user', { memberId: state => state.memberId }),
|
...mapState('exam', { doUrl: state => state.doUrl }),
|
...mapState('exam', { reportTemplateId: state => state.reportTemplateId }),
|
...mapState('user', { langType: state => state.langType })
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.demography {
|
width: 90%;
|
margin: 0 auto;
|
margin-top: 5%;
|
}
|
|
.align-center {
|
text-align: center
|
}
|
</style>
|