1
This commit is contained in:
@@ -35,11 +35,7 @@
|
||||
<!-- 按钮 -->
|
||||
<el-row justify="center">
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click.native.prevent="handleLogin"
|
||||
class="register-submit"
|
||||
style="width: 100%"
|
||||
<el-button type="primary" @click.native.prevent="orcidBind" class="register-submit" style="width: 100%"
|
||||
>bind</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
@@ -104,7 +100,7 @@
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click.native.prevent="handleRegister"
|
||||
@click.native.prevent="orcidRegister"
|
||||
class="register-submit"
|
||||
style="width: 100%"
|
||||
>bind</el-button
|
||||
@@ -124,12 +120,9 @@ export default {
|
||||
data: function () {
|
||||
return {
|
||||
account: localStorage.getItem('ms_username'),
|
||||
loading: false,
|
||||
code: this.$route.query.code,
|
||||
loading: true,
|
||||
has_user: true,
|
||||
query: {
|
||||
account: localStorage.getItem('ms_username'),
|
||||
code: this.$route.query.code
|
||||
},
|
||||
loginForm: {},
|
||||
registerForm: {},
|
||||
activeName: 'first',
|
||||
@@ -190,14 +183,51 @@ export default {
|
||||
methods: {
|
||||
initLinkOrcid() {
|
||||
this.$api
|
||||
.post('api/User/getUserForOrcid', this.query)
|
||||
.post('api/User/OrcidLogin', { code: this.code })
|
||||
.then((res) => {
|
||||
alert('okokok!!!!');
|
||||
if (res.data.user == null) {
|
||||
loginForm.orcid = res.data.orcid;
|
||||
registerForm.orcid = res.data.orcid;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message.success('login success');
|
||||
localStorage.setItem('ms_username', res.data.userinfo.account);
|
||||
if (res.data.user.type == 1 && res.data.user.is_reviewer) {
|
||||
localStorage.setItem('ms_userrole', 'reviewer');
|
||||
} else {
|
||||
localStorage.setItem('ms_userrole', res.data.user.type);
|
||||
}
|
||||
this.$router.push('/');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
},
|
||||
//绑定操作提交
|
||||
orcidBind() {
|
||||
this.$api
|
||||
.post('api/User/orcidBind', this.loginForm)
|
||||
.then((res) => {
|
||||
if (res.data.code == 1) {
|
||||
this.$message.error(res.data.msg);
|
||||
} else {
|
||||
this.$message.success('login success');
|
||||
localStorage.setItem('ms_username', res.data.userinfo.account);
|
||||
if (res.data.user.type == 1 && res.data.user.is_reviewer) {
|
||||
localStorage.setItem('ms_userrole', 'reviewer');
|
||||
} else {
|
||||
localStorage.setItem('ms_userrole', res.data.user.type);
|
||||
}
|
||||
this.$router.push('/');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
//注册提交
|
||||
orcidRegister() {}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user