|
|
|
@ -173,6 +173,9 @@ import NavHeader from '@/components/common/header'; |
|
|
|
|
import Footer from '@/components/common/footer'; |
|
|
|
|
import {getUserTimeMoneyDto} from '@/api/yyyf'; |
|
|
|
|
import {getLeftPrice} from '@/api/currency.js'; |
|
|
|
|
import {submit, reStart} from '@/api/yyyf'; |
|
|
|
|
import {logOut} from '@/api/user'; |
|
|
|
|
import {signUp, signIn} from '@/api/user'; |
|
|
|
|
export default { |
|
|
|
|
name: 'entry', |
|
|
|
|
data() { |
|
|
|
@ -180,6 +183,12 @@ export default { |
|
|
|
|
activeName: 'BTC', |
|
|
|
|
userTimeMoneyDto: {}, |
|
|
|
|
tatolPrice: 0, |
|
|
|
|
//0 考试 1 练习 2 不计分 |
|
|
|
|
reqType: 2, |
|
|
|
|
//剩余时间 |
|
|
|
|
remainingTime: 0, |
|
|
|
|
//防止重复提交 |
|
|
|
|
isSubmit: false, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -187,9 +196,180 @@ export default { |
|
|
|
|
Footer, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getUserTimeMoneyDtoMethod(){ |
|
|
|
|
let ths=this; |
|
|
|
|
getUserTimeMoneyDto().then(res => { |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
ths.userTimeMoneyDto = res.data.data; |
|
|
|
|
this.getUSDTPrie(); |
|
|
|
|
} else { |
|
|
|
|
ths.$message.warning({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
onClose: function() { |
|
|
|
|
ths.closeWindow(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
login(params) { |
|
|
|
|
signIn(params).then(res => { |
|
|
|
|
// console.log(res); |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
//判断是否保存自动登录 |
|
|
|
|
// if( this.checked === true ){ |
|
|
|
|
// Cookie.set('phoneNum',num) |
|
|
|
|
// Cookie.set('password',pass) |
|
|
|
|
// } |
|
|
|
|
//保存登录的token到cookie |
|
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
|
localStorage.setItem('token', res.data.data.token); |
|
|
|
|
//重复提交标识 |
|
|
|
|
localStorage.setItem('isSubmit', JSON.stringify(false)); |
|
|
|
|
//保存登录的用户信息到cookie |
|
|
|
|
// Cookie.set('userData', res.data.data); |
|
|
|
|
localStorage.setItem('userData', JSON.stringify(res.data.data)); |
|
|
|
|
// console.log(JSON.parse(localStorage.getItem('userData'))); |
|
|
|
|
|
|
|
|
|
// 保存userID的信息到cookie |
|
|
|
|
// Cookie.set('userID', res.data.data.id); |
|
|
|
|
localStorage.setItem('userID', res.data.data.id); |
|
|
|
|
|
|
|
|
|
// 保存邀请码信息 |
|
|
|
|
localStorage.setItem('invitationCode', res.data.data.invitationCode); |
|
|
|
|
this.isSubmit = false; |
|
|
|
|
location.href = '/entry'; |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning(res.data.msg); |
|
|
|
|
this.isSubmit = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
closeWindow: function() { |
|
|
|
|
if ( |
|
|
|
|
navigator.userAgent.indexOf('Firefox') != -1 || |
|
|
|
|
navigator.userAgent.indexOf('Chrome') != -1 |
|
|
|
|
) { |
|
|
|
|
window.location.href = 'about:blank'; |
|
|
|
|
window.close(); |
|
|
|
|
} else { |
|
|
|
|
window.opener = null; |
|
|
|
|
window.open('', '_self'); |
|
|
|
|
window.close(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
sign(params) { |
|
|
|
|
signUp(params).then(res => { |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
this.login({ |
|
|
|
|
tel: params.tel, |
|
|
|
|
password: params.password, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning(res.data.msg); |
|
|
|
|
this.isSubmit = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
exit(params) { |
|
|
|
|
logOut().then(res => { |
|
|
|
|
if (res.data.code === 200 || res.data.code === 202) { |
|
|
|
|
// Cookie.set('userData', ''); |
|
|
|
|
localStorage.setItem('userData', ''); |
|
|
|
|
localStorage.removeItem('userpass'); |
|
|
|
|
localStorage.removeItem('userdate'); |
|
|
|
|
localStorage.removeItem('nowPassNOValue'); |
|
|
|
|
if (params == undefined) { |
|
|
|
|
//window.location.href = '/'; |
|
|
|
|
this.closeWindow(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// let pathName = window.location.pathname.split('/')[1]; |
|
|
|
|
// console.log(pathName); |
|
|
|
|
//判断是否从个人中心页面退出登录 |
|
|
|
|
// if (pathName === 'personal') { |
|
|
|
|
// window.location.href = '/login'; |
|
|
|
|
// } else { |
|
|
|
|
// window.location.href = this.perUrl; |
|
|
|
|
// } |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning(res.data.msg); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
goIndex() { |
|
|
|
|
window.open('/', '_blank'); |
|
|
|
|
}, |
|
|
|
|
submitExam: function() { |
|
|
|
|
debugger; |
|
|
|
|
let self = this; |
|
|
|
|
//防止重复提交 |
|
|
|
|
if (!self.isSubmit) { |
|
|
|
|
self.isSubmit = true; |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
submit().then(res => { |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
this.$message.success({ |
|
|
|
|
message: '提交成功', |
|
|
|
|
onClose: function() { |
|
|
|
|
if (self.reqType == 0) { |
|
|
|
|
self.closeWindow(); |
|
|
|
|
} else { |
|
|
|
|
localStorage.setItem('isSubmit', JSON.stringify(true)); |
|
|
|
|
self.isSubmit = false; |
|
|
|
|
} |
|
|
|
|
self.getUserTimeMoneyDtoMethod(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
onClose: function() { |
|
|
|
|
self.closeWindow(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
reStartTest: function() { |
|
|
|
|
let self = this; |
|
|
|
|
//防止重复提交 |
|
|
|
|
if (!self.isSubmit) { |
|
|
|
|
this.isSubmit = true; |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//退出当前用户 |
|
|
|
|
this.exit(1); |
|
|
|
|
reStart().then(res => { |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
this.$message.success({ |
|
|
|
|
message: '重新开始成功', |
|
|
|
|
onClose: function() { |
|
|
|
|
let signParams = { |
|
|
|
|
tel: res.data.data.tel, |
|
|
|
|
nickName: res.data.data.nickName, |
|
|
|
|
code: res.data.data.code, |
|
|
|
|
password: res.data.data.password, |
|
|
|
|
internationalCode: null, |
|
|
|
|
invitationCode: '', |
|
|
|
|
}; |
|
|
|
|
self.sign(signParams); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
onClose: function() { |
|
|
|
|
self.closeWindow(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
getUSDTPrie() { |
|
|
|
|
getLeftPrice().then(res => { |
|
|
|
|
this.USDTPrie = res.data.data; |
|
|
|
@ -250,19 +430,23 @@ export default { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
getUserTimeMoneyDto().then(res => { |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
this.userTimeMoneyDto = res.data.data; |
|
|
|
|
this.getUSDTPrie(); |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
onClose: function() { |
|
|
|
|
this.closeWindow(); |
|
|
|
|
let ths=this; |
|
|
|
|
ths.getUserTimeMoneyDtoMethod(); |
|
|
|
|
let yyyfToken = localStorage.getItem('yyyfToken'); |
|
|
|
|
this.isSubmit = localStorage.getItem('isSubmit') == 'true' ? true : false; |
|
|
|
|
if (yyyfToken == '' || yyyfToken == undefined) { |
|
|
|
|
this.$alert('未从以渔有方登录,点击确定关闭浏览器', '提示', { |
|
|
|
|
type: 'error', |
|
|
|
|
showClose: false, |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
confirmButtonClass: 'btn-self-style', |
|
|
|
|
callback: () => { |
|
|
|
|
ths.closeWindow(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
ths.reqType = localStorage.getItem('reqType'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|