| | |
| | | } |
| | | }, |
| | | created () { |
| | | console.log('环境变量:') |
| | | console.log(process.env) |
| | | }, |
| | | watch: { |
| | | logo: function (val) { |
| | | let sessionLogoUrl = sessionStorage.getItem('logoUrl') |
| | | let sessionLogoUrl = localStorage.getItem('logoUrl') |
| | | if (this.productType === 'API_Fan') { |
| | | this.logoUrl = require('@/assets/logo-apifan.png') |
| | | } else if (val === 'none') { |
| | |
| | | } else if (sessionLogoUrl !== null) { |
| | | this.logoUrl = sessionLogoUrl |
| | | } |
| | | sessionStorage.setItem('logoUrl', this.logoUrl) |
| | | sessionStorage.setItem('backgroundColor', this.backgroundColor) |
| | | localStorage.setItem('logoUrl', this.logoUrl) |
| | | localStorage.setItem('backgroundColor', this.backgroundColor) |
| | | } |
| | | }, |
| | | mounted () { |
| | | let sessionLogoUrl = sessionStorage.getItem('logoUrl') |
| | | let sessionBackgroundColor = sessionStorage.getItem('backgroundColor') |
| | | let sessionLogoUrl = localStorage.getItem('logoUrl') |
| | | let sessionBackgroundColor = localStorage.getItem('backgroundColor') |
| | | if (sessionLogoUrl !== null) { |
| | | this.logoUrl = sessionLogoUrl |
| | | this.backgroundColor = sessionBackgroundColor |
| | | } |
| | | sessionStorage.setItem('backgroundColor', this.backgroundColor) |
| | | localStorage.setItem('backgroundColor', this.backgroundColor) |
| | | window.addEventListener('beforeunload', this.handleBeforeUnload) |
| | | }, |
| | | beforeDestroy () { |
| | |
| | | }, |
| | | methods: { |
| | | handleBeforeUnload: function () { |
| | | sessionStorage.setItem('logoUrl', this.logoUrl) |
| | | localStorage.setItem('logoUrl', this.logoUrl) |
| | | }, |
| | | logout: function () { |
| | | window.opener = null |
| | |
| | | // logoUrl: function () { |
| | | // console.log('this.logo') |
| | | // console.log(this.logo) |
| | | // let sessionLogoUrl = this.setLogo(sessionStorage.getItem('logoUrl')) |
| | | // let sessionLogoUrl = this.setLogo(localStorage.getItem('logoUrl')) |
| | | // if (this.productType === 'API_Fan') { |
| | | // return require('@/assets/logo-apifan.png') |
| | | // } else if (this.logo === 'none') { |
| | |
| | | // } else if (this.logo === null && sessionLogoUrl !== null) { |
| | | // return sessionLogoUrl |
| | | // } else { |
| | | // sessionStorage.setItem('logoUrl', this.logo) |
| | | // localStorage.setItem('logoUrl', this.logo) |
| | | // return this.logo |
| | | // } |
| | | // }, |
| | |
| | | import Cookies from 'js-cookie' |
| | | import userApi from '@/api/user' |
| | | import examPaperApi from '@/api/examPaper' |
| | | // initial state |
| | | const state = { |
| | | userName: Cookies.get('studentUserName'), |
| | |
| | | logo: null, |
| | | messageCount: 0, |
| | | memberToken: Cookies.get('memberTocken'), |
| | | langType: 'English', |
| | | // langType: localStorage.getItem('langType') || 'English', |
| | | langType: Cookies.get('langType') || 'English', |
| | | formDo: localStorage.getItem('formDo') && JSON.parse(localStorage.getItem('formDo')), |
| | | langFlag: true, |
| | | memberId: null |
| | | } |
| | |
| | | setMemberId (state, memberId) { |
| | | state.memberId = memberId |
| | | }, |
| | | |
| | | setFormDo (state, formDo) { |
| | | if (formDo) { |
| | | localStorage.setItem('formDo', JSON.stringify(formDo), { expires: 30 }) |
| | | } else { |
| | | localStorage.setItem('formDo', formDo, { expires: 30 }) |
| | | } |
| | | state.formDo = formDo |
| | | }, |
| | | getFormDo (state) { |
| | | // 如果不包含guide则重新获取 |
| | | if (!state.formDo || !Object.hasOwn(state.formDo, 'guide')) { |
| | | state.formDo = localStorage.getItem('formDo') && JSON.parse(localStorage.getItem('formDo')) |
| | | if (state.formDo && Object.hasOwn(state.formDo, 'guide')) { |
| | | return |
| | | } |
| | | if (!state.memberToken || !state.langType) { |
| | | return |
| | | } |
| | | examPaperApi.select(state.memberToken, state.langType).then(re => { |
| | | state.formDo = re.response |
| | | localStorage.setItem('formDo', JSON.stringify(state.formDo), { expires: 30 }) |
| | | }).catch(e => { |
| | | console.error('获取formDo失败', e) |
| | | }) |
| | | } |
| | | }, |
| | | setLangType (state, paraLangType) { |
| | | state.langType = paraLangType |
| | | if(paraLangType == 'Chinese'){ |
| | | Cookies.set('langType', paraLangType, { expires: 30 }) |
| | | if (paraLangType === 'Chinese') { |
| | | Cookies.set('language', 'zh', { expires: 30 }) |
| | | } else { |
| | | Cookies.set('language', 'en', { expires: 30 }) |
| | |
| | | let language = (navigator.language || navigator.browserLanguage).toLowerCase() |
| | | if (language === 'zh-cn') { |
| | | state.langType = 'Chinese' |
| | | console.log(language) |
| | | } else { |
| | | state.langType = 'English' |
| | | console.log(language) |
| | | } |
| | | }, |
| | | setLangFlag (state, paraLangFlag) { |
| | |
| | | import vue from 'vue' |
| | | |
| | | const request = function (loadtip, query) { |
| | | console.log(query.baseURL) |
| | | console.log(query.url) |
| | | let loading |
| | | if (loadtip) { |
| | | loading = vue.prototype.$loading({ |
| | |
| | | paramsInfo: {}, |
| | | parasInfos: [], |
| | | parasInfoIds: {}, |
| | | formDo: {}, |
| | | // formDo: {}, |
| | | submitDisable: false, |
| | | isStart: this.$route.query.isStart === 'true' |
| | | } |
| | | }, |
| | | created () { |
| | | const langType = localStorage.getItem('langType') |
| | | if (langType) { |
| | | const langType = this.$route.query.langType |
| | | if (langType && (langType === 'Chinese' || langType === 'English' || langType === 'Thai')) { |
| | | this.setLangType(langType) |
| | | } else { |
| | | localStorage.setItem('langType', this.langType) |
| | | } |
| | | }, |
| | | beforeDestroy () { |
| | | localStorage.removeItem('langType') |
| | | }, |
| | | beforeUpdate () { |
| | | }, |
| | |
| | | demographyApi.submitDemography(_this.memberToken, _this.langType, _this.parasInfos).then(function (result) { |
| | | if (result && result.code === 1) { |
| | | examPaperApi.select(_this.memberToken, _this.langType).then(re => { |
| | | _this.formDo = re.response |
| | | _this.setFormDo(re.response) |
| | | _this.setDoUrl(re.response.questionTemplateId) |
| | | if (_this.isStart) { |
| | | _this.$router.push({ path: '/exam/' + _this.doUrl }) |
| | | return |
| | | } |
| | | _this.$router.push({ path: '/guide/index', query: { formDo: _this.formDo } }); |
| | | // _this.$router.push({ path: '/guide/index', query: { formDo: _this.formDo } }) |
| | | _this.$router.push({ path: '/guide/index' }) |
| | | }).catch(e => { |
| | | _this.$message.error(_this.$t('noquestionMsg')) |
| | | }) |
| | |
| | | }, |
| | | ...mapMutations('user', ['setMemberTocken']), |
| | | ...mapMutations('exam', ['setDoUrl']), |
| | | ...mapMutations('user', ['setLangType']) |
| | | ...mapMutations('user', ['setLangType']), |
| | | ...mapMutations('user', ['setFormDo']) |
| | | }, |
| | | computed: { |
| | | ...mapState('user', { memberToken: state => state.memberToken }), |
| | |
| | | return { |
| | | langTypes: [], |
| | | langSelectValue: this.$route.query.langSelectValue, |
| | | fromDo: this.$route.query.fromDo, |
| | | // fromDo: this.$route.query.fromDo, |
| | | langWelcome: this.$t('langWelcomeChinese'), |
| | | langOption: this.$t('langOptionChinese'), |
| | | timer: null, |
| | |
| | | } |
| | | }, |
| | | created: function () { |
| | | |
| | | let _this = this |
| | | window.clearInterval(this.timer) |
| | | _this.getLangType() |
| | |
| | | submitLangOption: function () { |
| | | let _this = this |
| | | _this.setLangType(_this.langSelectValue) |
| | | _this.$router.push({ path: '/demography/fill/index', query: { demographyMenber: _this.memberToken, isStart: false } }) |
| | | _this.$router.push({ path: '/demography/fill/index', query: { demographyMenber: _this.memberToken, isStart: false, langType: _this.langSelectValue } }) |
| | | window.clearInterval(this.timer) |
| | | }, |
| | | getLangAndRportTemplateId () { |
| | |
| | | demographyApi.queryLangList(_this.memberToken, _this.reportTemplateId).then(function (result) { |
| | | if (result && result.code === 1) { |
| | | _this.langTypes = result.response |
| | | console.log("longTypes", _this.langTypes) |
| | | } |
| | | } |
| | | ).catch(e => { |
| | |
| | | _this.$message.error(_this.$t('noquestionMsg')) |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | ...mapMutations('user', ['setMemberTocken']), |
| | | ...mapMutations('user', ['setLangType']), |
| | |
| | | paramsInfo: {}, |
| | | parasInfos: [], |
| | | parasInfoIds: {}, |
| | | formDo: {}, |
| | | // formDo: {}, |
| | | reportTemplateType: null, |
| | | statusInfo: { '2': this.$t('statusInfo2'), '3': this.$t('statusInfo3'), '4': this.$t('statusInfo4') } |
| | | } |
| | | }, |
| | | created () { |
| | | // 清除本地存储的语言选项 |
| | | localStorage.removeItem('langType') |
| | | let _this = this |
| | | _this.getLangType() |
| | | // 记录登陆日志 |
| | |
| | | } else { |
| | | _this.setLogo(re.response.logoUrl) |
| | | } |
| | | console.log(re.response) |
| | | _this.setProductType(re.response.productType) |
| | | if (re.response.finish === 1) { |
| | | _this.$router.push({ path: '/exam/finish', query: { name: '', content: _this.$t('finishMsg'), tokenId: _this.paraMemberToken } }) |
| | |
| | | if (_this.doUrl === 'career_interests' || _this.doUrl === 'job') { |
| | | _this.$i18n.locale = 'zh' |
| | | _this.setLangType('Chinese') |
| | | _this.$router.push({ path: '/demography/fill/index', query: { demographyMenber: _this.memberToken, isStart: false } }) |
| | | _this.$router.push({ path: '/demography/fill/index', query: { demographyMenber: _this.memberToken, isStart: false, langType: 'Chinese' } }) |
| | | return |
| | | } |
| | | |
| | |
| | | let answered = re.response.examItemOrderAndContentList |
| | | if (answered === null) { |
| | | examPaperApi.select(_this.memberToken, _this.langType).then(re => { |
| | | _this.formDo = re.response |
| | | _this.setFormDo(re.response) |
| | | _this.setDoUrl(re.response.questionTemplateId) |
| | | _this.$router.push({ path: '/guide/index', query: { formDo: _this.formDo } }) |
| | | // _this.$router.push({ path: '/guide/index', query: { formDo: _this.formDo } }) |
| | | _this.$router.push({ path: '/guide/index' }) |
| | | }).catch(e => { |
| | | _this.$message.error(_this.$t('noquestionMsg')) |
| | | }) |
| | | } else { |
| | | // 否则清除fromDo |
| | | _this.$router.push({ path: '/exam/' + _this.doUrl }) |
| | | } |
| | | }).catch(e => { |
| | |
| | | ...mapMutations('user', ['setLangType']), |
| | | ...mapMutations('user', ['getLangType']), |
| | | ...mapMutations('user', ['setLogo']), |
| | | ...mapMutations('user', ['setFormDo']), |
| | | ...mapMutations('exam', ['setProductType']) |
| | | |
| | | }, |
| | |
| | | _this.ismobile = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(navigator.userAgent.toLowerCase()) |
| | | // 多语言 |
| | | _this.setLangFlag(false) |
| | | _this.form = this.$route.query.formDo |
| | | _this.form = undefined |
| | | if (_this.form !== {} && _this.form !== undefined) { |
| | | _this.formLoading = true |
| | | _this.remainTime = _this.form.suggestTime * 60 |
| | |
| | | |
| | | // 展示指导语 |
| | | if (_this.form.parts[0].signals.length !== 0) { |
| | | console.log('首题提示语') |
| | | _this.showNextGuide(_this.form.parts[0].signals[0], false) |
| | | } |
| | | } else { |
| | |
| | | ).catch(e => { |
| | | }) |
| | | } |
| | | console.log(' _this.partOrder:'+_this.partOrder) |
| | | }, |
| | | mounted () { |
| | | }, |
| | |
| | | } |
| | | this.answer.answerItems[_this.order].readOnly = true |
| | | let answerSubmit = _this.getSubmitAnswerValue(nowPartOrder) |
| | | console.log(answerSubmit) |
| | | // 已经答到了最后一题了,不用自动跳到下一题 |
| | | if (this.order + 1 > this.problemLength) { |
| | | this.submitDisable = false |
| | |
| | | <template> |
| | | <div> |
| | | <el-container class="app-item-contain"> |
| | | <div v-loading.fullscreen.lock="!formDo"> |
| | | <el-container class="app-item-contain" v-if="formDo"> |
| | | <el-main style="padding-top: 3%;"> |
| | | <el-form :model="form" ref="form" label-width="100%"> |
| | | <el-row :key="index" v-for="(titleItem,index) in titleItems"> |
| | |
| | | components: { QuestionEdit }, |
| | | data () { |
| | | return { |
| | | formDo: this.$route.query.formDo, |
| | | memberName: this.$route.query.formDo.memberName, |
| | | // formDo: this.$route.query.formDo, |
| | | memberName: '', |
| | | form: { |
| | | name: this.$route.query.formDo.name |
| | | name: '' |
| | | }, |
| | | itemOrder: 1, |
| | | itemSize: 3, |
| | |
| | | } |
| | | }, |
| | | created: function () { |
| | | this.getFormDo() |
| | | this.initQuestion() |
| | | }, |
| | | mounted () { |
| | |
| | | beforeDestroy () { |
| | | }, |
| | | watch: { |
| | | 'formDo': function (newVal, oldVal) { |
| | | this.initQuestion() |
| | | } |
| | | }, |
| | | methods: { |
| | | // 初始化题目 |
| | | initQuestion () { |
| | | this.memberName = this.formDo.memberName |
| | | this.form.name = this.formDo.name |
| | | this.titleItems = [ |
| | | { |
| | | questionItems: [] |
| | |
| | | doExam () { |
| | | let _this = this |
| | | examPaperApi.updateTestMemberStatus(_this.memberToken).then(re => { |
| | | _this.$router.push({ path: '/exam/' + _this.doUrl, query: { formDo: _this.$route.query.formDo } }) |
| | | _this.$router.push({ path: '/exam/' + _this.doUrl, query: { formDo: _this.formDo } }) |
| | | }).catch(re => { |
| | | _this.$message.error(re.message + ' 更新状态失败') |
| | | }) |
| | | } |
| | | }, |
| | | ...mapMutations('user', ['getFormDo']) |
| | | }, |
| | | computed: { |
| | | ...mapState('exam', { doUrl: state => state.doUrl }), |
| | | ...mapState('user', { memberToken: state => state.memberToken }) |
| | | ...mapState('user', { memberToken: state => state.memberToken }), |
| | | ...mapState('user', { formDo: state => state.formDo }) |
| | | } |
| | | } |
| | | </script> |
| | |
| | | _this.downDisable = true |
| | | // 设置下载路径 |
| | | _this.downUrl = '/api/exam/paper/download?fileName=' + re.msg + '&delete=false' |
| | | console.log(re) |
| | | } else { |
| | | console.log(re) |
| | | } |
| | | }) |
| | | |
| | |
| | | <template> |
| | | <div> |
| | | <el-container class="app-item-contain"> |
| | | <div v-loading.fullscreen.lock="!formDo"> |
| | | <el-container class="app-item-contain" v-if="formDo"> |
| | | <el-header class="align-center" style="height: 50px;padding: 1%;margin-top: 4%"> |
| | | <H2 v-html="$t('guide')" v-if="formDo.questionTemplateId !== 'job' || formDo.questionTemplateId !== 'values'"></H2> |
| | | </el-header> |
| | | <el-main style="padding-top:0%"> |
| | | <div v-html="formDo.guide"></div> |
| | | <div v-html="formDo.guide"> |
| | | </div> |
| | | <el-row class="do-align-center"> |
| | | <el-button v-if="formDo.questionTemplateId !== 'personality'" @click="doExam" type="primary" round>{{$t('startDo')}}</el-button> |
| | | <el-button v-if="formDo.questionTemplateId === 'job'" @click="openExplain" type="danger" round>{{$t('openJobDesc')}}</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | import { mapState, mapMutations } from 'vuex' |
| | | import examPaperApi from '@/api/examPaper' |
| | | export default { |
| | | data () { |
| | | return { |
| | | formDo: this.$route.query.formDo |
| | | // formDo: this.$route.query.formDo, |
| | | loading: false |
| | | } |
| | | }, |
| | | created () { |
| | | this.getFormDo() |
| | | }, |
| | | mounted () { |
| | | // 替换APIFan指导语中的变量 |
| | | if (this.formDo.productType === 'API_Fan') { |
| | | let guide = this.formDo.guide |
| | | guide = guide.replace('%%fullName%%', this.formDo.memberName) |
| | | guide = guide.replace('%%company%%', this.formDo.reportCompany) |
| | | this.formDo.guide = guide |
| | | } |
| | | // this.swapGuide() |
| | | }, |
| | | beforeDestroy () { |
| | | window.clearInterval(this.timer) |
| | | }, |
| | | watch: { |
| | | 'formDo': function (newVal, oldVal) { |
| | | this.loading = false |
| | | } |
| | | }, |
| | | methods: { |
| | | doExam: function () { |
| | |
| | | examPaperApi.updateTestMemberStatus(_this.memberToken).then(re => { |
| | | // LAQ特殊处理 |
| | | if (_this.formDo.name.indexOf('LAQ') !== -1) { |
| | | _this.$router.push({ path: '/exam/' + _this.formDo.questionTemplateId, query: { formDo: _this.$route.query.formDo } }) |
| | | // _this.$router.push({ path: '/exam/' + _this.formDo.questionTemplateId, query: { formDo: _this.formDo } }) |
| | | _this.$router.push({ path: '/exam/' + _this.formDo.questionTemplateId }) |
| | | } else { |
| | | _this.$router.push({ path: '/exam/' + _this.doUrl, query: { formDo: _this.$route.query.formDo } }) |
| | | // _this.$router.push({ path: '/exam/' + _this.doUrl, query: { formDo: _this.formDo } }) |
| | | _this.$router.push({ path: '/exam/' + _this.doUrl }) |
| | | } |
| | | }).catch(re => { |
| | | _this.$message.error(re.message + ' 更新状态失败') |
| | |
| | | // 打开练习页面 |
| | | openExercise: function () { |
| | | let _this = this |
| | | _this.$router.push({ path: '/exam/exercise', query: { formDo: _this.$route.query.formDo } }) |
| | | // _this.$router.push({ path: '/exam/exercise', query: { formDo: _this.formDo } }) |
| | | _this.$router.push({ path: '/exam/exercise' }) |
| | | }, |
| | | |
| | | // 替换guide的值 |
| | | swapGuide: function () { |
| | | // 替换APIFan指导语中的变量 |
| | | if (this.formDo.productType === 'API_Fan') { |
| | | let guide = this.formDo.guide |
| | | guide = guide.replace('%%fullName%%', this.formDo.memberName) |
| | | guide = guide.replace('%%company%%', this.formDo.reportCompany) |
| | | this.formDo.guide = guide |
| | | } |
| | | }, |
| | | |
| | | ...mapMutations('user', ['getLangType']), |
| | | ...mapMutations('user', ['getFormDo']) |
| | | }, |
| | | computed: { |
| | | ...mapState('exam', { doUrl: state => state.doUrl }), |
| | | ...mapState('user', { memberToken: state => state.memberToken }) |
| | | ...mapState('user', { memberToken: state => state.memberToken }), |
| | | ...mapState('user', { langType: state => state.langType }), |
| | | ...mapState('user', { formDo: state => state.formDo }) |
| | | } |
| | | } |
| | | </script> |
| | |
| | | }, |
| | | nextQuestion: function (nowPartOrder) { |
| | | let _this = this |
| | | let num = ++_this.order |
| | | let num = _this.order + 1 |
| | | // 跳到没有答的题目的段 |
| | | while (_this.isContentNotEmpty(num) && num !== _this.answer.answerItems.length - 1) { |
| | | num = ++_this.order |
| | | num = _this.order + 1 |
| | | this.getEmptySubjct(num) |
| | | } |
| | | this.determineWhetherIntelligenceTitle() |
| | |
| | | let _this = this |
| | | // 多语言 |
| | | _this.setLangFlag(false) |
| | | _this.form = this.$route.query.formDo |
| | | _this.form = undefined |
| | | if (_this.form !== {} && _this.form !== undefined) { |
| | | _this.formLoading = true |
| | | _this.remainTime = _this.form.suggestTime * 60 |
| | |
| | | } |
| | | }, |
| | | created: function () { |
| | | // this.getFormDo() |
| | | let _this = this |
| | | _this.ismobile = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(navigator.userAgent.toLowerCase()) |
| | | // 多语言 |
| | | _this.setLangFlag(false) |
| | | _this.form = this.$route.query.formDo |
| | | if (_this.form !== {} && _this.form !== undefined) { |
| | | _this.form = undefined |
| | | if (_this.form && _this.form !== {} && _this.form !== undefined) { |
| | | _this.formLoading = true |
| | | _this.remainTime = _this.form.suggestTime * 60 |
| | | _this.problemLength = _this.form.titleItems[0].questionItems.length - 1 |
| | |
| | | ).catch(e => { |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | mounted () { |
| | | }, |
| | |
| | | if (re.code === 1) { |
| | | // 特殊处理 LAQ测试包 MAQ+CAQ |
| | | if (_this.form.name.indexOf('LAQ') !== -1) { |
| | | console.log('答完题,看看要不要去CAQ1') |
| | | examPaperApi.select(_this.memberToken, _this.langType).then(re => { |
| | | _this.form = re.response |
| | | _this.$router.push({ path: '/guide/index', query: { formDo: _this.form } }) |
| | |
| | | return _this.form.titleItems[0].questionItems[_this.order].partOrder !== _this.form.titleItems[0].questionItems[_this.order - 1].partOrder |
| | | }, |
| | | ...mapMutations('user', ['setLangType']), |
| | | ...mapMutations('user', ['setLangFlag']) |
| | | ...mapMutations('user', ['setLangFlag']), |
| | | ...mapMutations('user', ['getFormDo']) |
| | | }, |
| | | computed: { |
| | | ...mapGetters('enumItem', ['enumFormat']), |
| | |
| | | ...mapState('user', { memberToken: state => state.memberToken }), |
| | | ...mapState('user', { langType: state => state.langType }), |
| | | ...mapState('user', { langFlag: state => state.langFlag }), |
| | | ...mapState('user', { formDo: state => state.formDo }), |
| | | ...mapState('exam', { doUrl: state => state.doUrl }) |
| | | } |
| | | } |