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

修改跳转不同的购买页

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