提交 6bfa8e14 authored 作者: lihuihui's avatar lihuihui

修改跳转不同的购买页

上级 61854b14
...@@ -184,7 +184,7 @@ export default { ...@@ -184,7 +184,7 @@ export default {
methods: { methods: {
goVip() { goVip() {
this.$router.push({ this.$router.push({
path: '/pay' path: '/payPage'
}) })
}, },
goAbilityExam() { goAbilityExam() {
......
...@@ -179,7 +179,10 @@ export default { ...@@ -179,7 +179,10 @@ export default {
on: { on: {
init() { init() {
setTimeout(() => { setTimeout(() => {
_this.$route.query.id !== undefined && _this.cardChange(_this.$route.query.id)
_this.setCurrentCollect() _this.setCurrentCollect()
_this.scrollDom()
_this.getIsSign()
}, 500) }, 500)
}, },
slideChangeTransitionStart: function() { slideChangeTransitionStart: function() {
...@@ -296,7 +299,6 @@ export default { ...@@ -296,7 +299,6 @@ export default {
this.collect.currentPages = true this.collect.currentPages = true
this.setCollect(true) this.setCollect(true)
}) })
// console.log(this.questionsData.questions)
}, },
setCollect(state) { setCollect(state) {
this.questionsData.questions.map(item => { this.questionsData.questions.map(item => {
...@@ -322,54 +324,41 @@ export default { ...@@ -322,54 +324,41 @@ export default {
}, },
// 页面初始化 // 页面初始化
answerInit() { answerInit() {
Toast.loading({ Toast.loading({ message: '加载中...', duration: 5000 })
message: '加载中...',
duration: 5000
})
if (this.$route.query.id === undefined) { if (this.$route.query.id === undefined) {
this.swiper.slideTo(0, 1000, false)
clearInterval(this.initTime) clearInterval(this.initTime)
this.initTime = setInterval(() => { this.initTime = setInterval(() => {
this.examSubmit(0) this.examSubmit(0)
}, 3000) }, 3000)
if (this.$route.query.tag_id !== undefined) { if (this.$route.query.tag_id !== undefined) {
Exam.getExam(this.requestParam, decodeURIComponent(this.requestParam.papersUrl)).then(res => { Exam.getExam(this.requestParam, decodeURIComponent(this.requestParam.papersUrl)).then(res => {
if (parseInt(res.status) === 1 || parseInt(res.status) === 2) { parseInt(res.status) === 1 || parseInt(res.status) === 2
this.requestParam.is_create = 1 ? this.requestParam.is_create = 1
} else { : this.requestParam.is_create = 0
this.requestParam.is_create = 0
}
this.initData() this.initData()
}) })
} else { } else {
this.initData() this.initData()
} }
} else { return false
}
this.examEnd() this.examEnd()
this.initData(0) this.initData(0)
}
setTimeout(() => {
this.getIsSign()
}, 500)
}, },
getIsSign() { getIsSign() {
const _this = this const currentSlides = this.swiper.slides[this.swiper.activeIndex]
if (_this.swiper.slides[_this.swiper.activeIndex].attributes['data-dId']) { if (currentSlides.attributes['data-dId']) {
const itemDid = _this.swiper.slides[_this.swiper.activeIndex].attributes['data-dId'].nodeValue const itemDid = currentSlides.attributes['data-dId'].nodeValue
const itemCid = _this.swiper.slides[_this.swiper.activeIndex].attributes['data-cId'].nodeValue const itemCid = currentSlides.attributes['data-cId'].nodeValue
if (_this.requestData[itemCid]) { if (this.requestData[itemCid]) {
if (_this.requestData[itemCid][itemDid]) { this.requestData[itemCid][itemDid]
if (_this.requestData[itemCid][itemDid].sign) { ? this.requestData[itemCid][itemDid].sign
_this.signText = '已标记' ? this.signText = '已标记'
} else { : this.signText = '标记'
_this.signText = '标记' : this.signText = '标记'
} return false
} else {
_this.signText = '标记'
}
} else {
_this.signText = '标记'
} }
this.signText = '标记'
} }
}, },
async submitShowPop(n) { async submitShowPop(n) {
...@@ -452,47 +441,33 @@ export default { ...@@ -452,47 +441,33 @@ export default {
const itemCid = this.swiper.slides[this.swiper.activeIndex].attributes['data-cId'].nodeValue const itemCid = this.swiper.slides[this.swiper.activeIndex].attributes['data-cId'].nodeValue
const on = () => { const on = () => {
this.signText = '已标记' this.signText = '已标记'
Toast({ Toast({ duration: 500, message: '已完成标记' })
duration: 500,
message: '已完成标记'
})
this.clickStatus = Date.parse(new Date()) this.clickStatus = Date.parse(new Date())
} }
const off = () => { const off = () => {
this.signText = '标记' this.signText = '标记'
Toast({ Toast({ duration: 500, message: '已取消标记' })
duration: 500,
message: '已取消标记'
})
this.clickStatus = Date.parse(new Date()) this.clickStatus = Date.parse(new Date())
} }
if (!this.requestData[itemCid]) { if (!this.requestData[itemCid]) {
this.requestData[itemCid] = { this.requestData[itemCid] = {
[itemDid]: { [itemDid]: { sign: true, answer: [], opaVal: [] }
sign: true,
answer: [],
opaVal: []
}
} }
on() on()
return false return false
} }
if (!this.requestData[itemCid][itemDid]) { if (!this.requestData[itemCid][itemDid]) {
this.requestData[itemCid][itemDid] = { this.requestData[itemCid][itemDid] = { sign: true, answer: [], opaVal: [] }
sign: true,
answer: [],
opaVal: []
}
on() on()
} else { return false
}
if (this.requestData[itemCid][itemDid].sign) { if (this.requestData[itemCid][itemDid].sign) {
this.requestData[itemCid][itemDid].sign = false this.requestData[itemCid][itemDid].sign = false
off() off()
} else { return false
}
this.requestData[itemCid][itemDid].sign = true this.requestData[itemCid][itemDid].sign = true
on() on()
}
}
}, },
// 时间倒计时 // 时间倒计时
setClock(time) { setClock(time) {
...@@ -523,7 +498,6 @@ export default { ...@@ -523,7 +498,6 @@ export default {
this.remainingTime = this.secondToDate(sec) this.remainingTime = this.secondToDate(sec)
} }
this.questionsData.sheet.duration++ this.questionsData.sheet.duration++
// this.questionsData.sheet.duration += parseInt(this.questionsData.sheet.duration)
}, 1000) }, 1000)
}, },
secondToDate(result) { secondToDate(result) {
...@@ -636,7 +610,6 @@ export default { ...@@ -636,7 +610,6 @@ export default {
} }
cData.opaVal2 = opaArr.toString().replace(new RegExp(',', 'g'), '') cData.opaVal2 = opaArr.toString().replace(new RegExp(',', 'g'), '')
}) })
// this.clickStatus = Date.parse(new Date())
this.$forceUpdate() this.$forceUpdate()
}, },
// 页面过高局部滚动 // 页面过高局部滚动
...@@ -644,13 +617,7 @@ export default { ...@@ -644,13 +617,7 @@ export default {
const topViewH = document.getElementById('top-view').offsetHeight const topViewH = document.getElementById('top-view').offsetHeight
const clientHeight = document.documentElement.clientHeight const clientHeight = document.documentElement.clientHeight
const bottomView = document.getElementById('bottom-view') const bottomView = document.getElementById('bottom-view')
// const domH = this.swiper.slides[this.swiper.activeIndex].clientHeight
bottomView.style.height = (clientHeight - topViewH) + 'px' bottomView.style.height = (clientHeight - topViewH) + 'px'
// if (domH - 50 >= (clientHeight - topViewH)) {
// this.classHide = true
// } else {
// this.classHide = false
// }
}, },
initData(n) { initData(n) {
const param = this.requestParam const param = this.requestParam
...@@ -658,34 +625,23 @@ export default { ...@@ -658,34 +625,23 @@ export default {
param.user_id = window.localStorage.userId param.user_id = window.localStorage.userId
} }
Exam.getExam(param, decodeURIComponent(this.requestParam.papersUrl)).then(res => { Exam.getExam(param, decodeURIComponent(this.requestParam.papersUrl)).then(res => {
Toast.clear()
const times = this.$route.query.id === undefined ? res.sheet.remainingTime ? res.sheet.remainingTime : res.sheet.duration : res.sheet.duration const times = this.$route.query.id === undefined ? res.sheet.remainingTime ? res.sheet.remainingTime : res.sheet.duration : res.sheet.duration
if (this.$route.query.id === -1 || this.$route.query.id === '-1') { parseInt(this.$route.query.id) === -1 ? this.errorQuestion(res) : this.questionsData = res
this.errorQuestion(res)
} else {
this.questionsData = res
}
this.questionCount = res.sheet.question_count this.questionCount = res.sheet.question_count
window.localStorage.userId = res.user_id window.localStorage.userId = res.user_id
this.remainingTime = this.secondToDate(times) this.remainingTime = this.secondToDate(times)
Toast.clear()
if (this.$route.query.id === undefined) { if (this.$route.query.id === undefined) {
this.setClock(times) this.setClock(times)
} }
setTimeout(() => { this.currentNum === this.questionsData.sheet.question_count
this.sildesHeightCount() ? this.nextBtnShow = false
this.examSubmit(0) : this.nextBtnShow = true
this.scrollDom()
}, 1000)
setTimeout(() => {
this.$route.query.id !== undefined && this.cardChange(this.$route.query.id)
}, 500)
this.currentNum === this.questionsData.sheet.question_count ? this.nextBtnShow = false : this.nextBtnShow = true
if (res.answers !== null) { if (res.answers !== null) {
if (res.answers.answerPage !== undefined && this.$route.query.id === undefined && res.answers.answerPage !== this.questionsData.sheet.question_count) { if (res.answers.answerPage !== undefined && this.$route.query.id === undefined && res.answers.answerPage !== this.questionsData.sheet.question_count) {
setTimeout(() => { setTimeout(() => {
this.currentNum = res.answers.answerPage + 1 this.currentNum = res.answers.answerPage + 1
this.swiper.slideTo(res.answers.answerPage, 0, false) this.swiper.slideTo(res.answers.answerPage, 0, false)
// this.setCurrentCollect()
this.currentNum === this.questionsData.sheet.question_count ? this.nextBtnShow = false : this.nextBtnShow = true this.currentNum === this.questionsData.sheet.question_count ? this.nextBtnShow = false : this.nextBtnShow = true
}, 100) }, 100)
} }
...@@ -698,9 +654,6 @@ export default { ...@@ -698,9 +654,6 @@ export default {
this.requestData = datas this.requestData = datas
this.requestData2 = Object.keys(datas).length this.requestData2 = Object.keys(datas).length
} else { } else {
// setTimeout(() => {
// this.setCurrentCollect()
// }, 300)
this.requestData = {} this.requestData = {}
this.requestData2 = 0 this.requestData2 = 0
} }
...@@ -715,7 +668,6 @@ export default { ...@@ -715,7 +668,6 @@ export default {
this.questionsData.questions.find(item => { this.questionsData.questions.find(item => {
if (item.id === itemCid) { if (item.id === itemCid) {
const currentItem = item.question_list.find(i => { return i.id === itemDid }) const currentItem = item.question_list.find(i => { return i.id === itemDid })
// this.currentCollect = currentItem.is_collection
this.collect.currentPages = currentItem.is_collection this.collect.currentPages = currentItem.is_collection
this.collect.currentId = itemDid this.collect.currentId = itemDid
this.collect.currentIdParent = itemCid this.collect.currentIdParent = itemCid
......
...@@ -130,13 +130,14 @@ export default { ...@@ -130,13 +130,14 @@ export default {
}) })
}, },
setRole() { setRole() {
if (this.$store.state.isVip) {
const param = { const param = {
type: 2 type: 2
} }
api.setRole({ role: this.roleChange }).then(res => { api.setRole({ role: this.roleChange }).then(res => {
if (res.code === 0) { if (res.code === 0) {
api.getExamStatus(param).then(res => { api.getExamStatus(param).then(res => {
if (res.status === '0' || res.status === 0 || res.status === '3' || res.status === 3) { if (parseInt(res.status) === 0 || parseInt(res.status === 3)) {
this.isExamPop = true this.isExamPop = true
} else { } else {
this.goAbilityExam(1) this.goAbilityExam(1)
...@@ -144,7 +145,16 @@ export default { ...@@ -144,7 +145,16 @@ export default {
}) })
} }
}) })
return false
} }
this.$router.push({
path: '/payPage'
})
}
},
beforeMount() {
// 检测是否是付费用户
this.$store.dispatch('checkIsVip')
} }
} }
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论