1
This commit is contained in:
@@ -35,11 +35,7 @@
|
|||||||
<!-- 按钮 -->
|
<!-- 按钮 -->
|
||||||
<el-row justify="center">
|
<el-row justify="center">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button type="primary" @click.native.prevent="orcidBind" class="register-submit" style="width: 100%"
|
||||||
type="primary"
|
|
||||||
@click.native.prevent="handleLogin"
|
|
||||||
class="register-submit"
|
|
||||||
style="width: 100%"
|
|
||||||
>bind</el-button
|
>bind</el-button
|
||||||
>
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -104,7 +100,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click.native.prevent="handleRegister"
|
@click.native.prevent="orcidRegister"
|
||||||
class="register-submit"
|
class="register-submit"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>bind</el-button
|
>bind</el-button
|
||||||
@@ -124,12 +120,9 @@ export default {
|
|||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
account: localStorage.getItem('ms_username'),
|
account: localStorage.getItem('ms_username'),
|
||||||
loading: false,
|
code: this.$route.query.code,
|
||||||
|
loading: true,
|
||||||
has_user: true,
|
has_user: true,
|
||||||
query: {
|
|
||||||
account: localStorage.getItem('ms_username'),
|
|
||||||
code: this.$route.query.code
|
|
||||||
},
|
|
||||||
loginForm: {},
|
loginForm: {},
|
||||||
registerForm: {},
|
registerForm: {},
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
@@ -190,14 +183,51 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initLinkOrcid() {
|
initLinkOrcid() {
|
||||||
this.$api
|
this.$api
|
||||||
.post('api/User/getUserForOrcid', this.query)
|
.post('api/User/OrcidLogin', { code: this.code })
|
||||||
.then((res) => {
|
.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) => {
|
.catch((err) => {
|
||||||
console.log(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>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user