This commit is contained in:
wangjinlei
2021-06-24 10:28:52 +08:00
parent f1d5ae1d76
commit b7d1ef35e2
8 changed files with 147 additions and 29 deletions

View File

@@ -7,8 +7,8 @@ import qs from 'qs'
// axios全局配置
axios.defaults.timeout = 10000 // 超时时间
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' // 配置请求头
// axios.defaults.baseURL = 'http://www.tougao.com/'
axios.defaults.baseURL = '/'
axios.defaults.baseURL = 'http://www.tougao.com/'
// axios.defaults.baseURL = '/'
// 添加响应拦截器,统一处理服务器响应和异常
axios.interceptors.response.use(

BIN
src/assets/img/orcid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
src/assets/img/orcno.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View File

@@ -25,19 +25,22 @@
</div>
<!-- 全屏显示 -->
<div class="btn-fullscreen" @click="handleFullScreen">
<el-tooltip
effect="dark"
:content="fullscreen?$t('system.noscreen'):$t('system.screen')"
placement="bottom"
>
<el-tooltip effect="dark" :content="fullscreen ? $t('system.noscreen') : $t('system.screen')" placement="bottom">
<i class="el-icon-rank"></i>
</el-tooltip>
</div>
<!-- 消息中心 -->
<!-- 用户头像 -->
<div class="user-avator">
<!-- <img src="../../assets/img/img.jpg" /> -->
<div class="user-avator" @click="skip_link()" v-if="hasorcie">
<el-tooltip class="item" effect="light" content="Link to Orcid" placement="bottom-end">
<img src="../../assets/img/orcid.png" />
</el-tooltip>
</div>
<div class="user-avator" @click="skip_check()" v-else>
<el-tooltip class="item" effect="light" content="Connect to ORCID" placement="bottom-end">
<img src="../../assets/img/orcno.png" />
</el-tooltip>
</div>
<!-- 用户名下拉菜单 -->
<el-dropdown class="user-name" trigger="click" @command="handleCommand">
@@ -62,12 +65,19 @@ export default {
fullscreen: false,
name: 'unknown user',
message: 2,
hasorcie: false,
orcid: '',
orcidLink:
'https://orcid.org/oauth/authorize?client_id=APP-PKF0BGRP6DWM6FUB&response_type=code&scope=/authenticate&redirect_uri=https://submission.tmrjournals.com/orcidLink',
langArr: [
{ value: 'zh', label: '中文' },
{ value: 'en', label: 'English' }
]
};
},
created() {
this.initORCID();
},
computed: {
username() {
let username = localStorage.getItem('ms_username');
@@ -100,6 +110,18 @@ export default {
this.collapse = !this.collapse;
bus.$emit('collapse', this.collapse);
},
//判断orcid
initORCID() {
this.$api
.post('api/user/checkOrcid', { account: localStorage.getItem('ms_username') })
.then((res) => {
this.hasorcie = res.userinfo.orcid == '' ? false : true;
this.orcid = res.userinfo.orcid;
})
.catch((err) => {
console.log(err);
});
},
// 全屏事件
handleFullScreen() {
let element = document.documentElement;
@@ -131,6 +153,12 @@ export default {
chengelang(commond) {
localStorage.setItem('langs', commond);
this.$router.go(0);
},
skip_link() {
location.href = 'https://orcid.org/'+this.orcid;
},
skip_check(){
location.href = this.orcidLink;
}
},
mounted() {
@@ -214,9 +242,8 @@ export default {
}
.user-avator img {
display: block;
width: 40px;
height: 40px;
border-radius: 50%;
width: 20px;
height: 20px;
}
.el-dropdown-link {
color: #fff;

View File

@@ -1,8 +1,8 @@
<script>
const baseUrl = '/';
const mediaUrl = 'http://api.tmrjournals.com/public/';
// const mediaUrl = 'http://www.tougao.com/';
// const baseUrl = 'http://www.tougao.com/';
// const baseUrl = '/';
// const mediaUrl = 'http://api.tmrjournals.com/public/';
const mediaUrl = 'http://www.tougao.com/';
const baseUrl = 'http://www.tougao.com/';
export default {
baseUrl,
mediaUrl

View File

@@ -0,0 +1,86 @@
<template>
<div class="login-wrap" v-loading="loading">
<div class="ms_link" v-if="has_user"></div>
<div class="ms-login" v-else>
<div class="ms-title">User Register</div>
<el-form class="ms-content" :rules="registerRules" ref="registerForm" :model="registerForm" label-width="0">
<!-- 用户名 -->
<el-form-item prop="username">
<el-input size="small" v-model="registerForm.username" auto-complete="off" placeholder="username">
<i slot="prefix" class="el-icon-user"></i>
</el-input>
</el-form-item>
<!-- 密码 -->
<el-form-item prop="password">
<el-input size="small" v-model="registerForm.password" auto-complete="off" placeholder="password" show-password>
<i slot="prefix" class="el-icon-lock"></i>
</el-input>
</el-form-item>
<!-- 姓名 -->
<el-form-item prop="name">
<el-input size="small" v-model="registerForm.name" auto-complete="off" placeholder="realname">
<i slot="prefix" class="el-icon-edit-outline"></i>
</el-input>
</el-form-item>
<!-- 手机 -->
<el-form-item prop="phone">
<el-input size="small" v-model="registerForm.phone" auto-complete="off" placeholder="phone">
<i slot="prefix" class="el-icon-mobile-phone" />
</el-input>
</el-form-item>
<!-- 邮件 -->
<el-form-item prop="email">
<el-input size="small" v-model="registerForm.email" auto-complete="off" placeholder="email">
<i slot="prefix" class="el-icon-message"></i>
</el-input>
</el-form-item>
<!-- 按钮 -->
<el-row type="flex" justify="center">
<el-col :span="6">
<el-form-item>
<el-button size="small" type="primary" @click.native.prevent="handleRegister" class="register-submit"
>bind</el-button
>
</el-form-item>
</el-col>
<el-col :span="14"></el-col>
<el-col :span="4"> </el-col>
</el-row>
</el-form>
</div>
</div>
</template>
<script>
export default {
data: function () {
return {
account: localStorage.getItem('ms_username'),
loading: true,
has_user: false,
query: {
account: localStorage.getItem('ms_username'),
code: this.$route.query.code
}
};
},
created: function () {
this.initLinkOrcid();
},
methods: {
//推送记录信息
initLinkOrcid() {
this.$message.success(this.query.account);
// this.$api
// .post('api/User/getUserForOrcid', this.query)
// .then((res) => {
// alert('okokok!!!!');
// })
// .catch((err) => {
// console.log(err);
// });
}
}
};
</script>

View File

@@ -31,7 +31,7 @@ router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} | Traditional Medicine Research`;
const role = localStorage.getItem('ms_username');
const userrole = localStorage.getItem('ms_userrole');
if (!role && to.path!='/register'&&to.path!=='/submission'&&to.path!=='/img'&& to.path !=='/reviewer'&&to.path !=='/thanks' &&to.path !== '/login'&&to.path.search(/retrieve/i)<0 ) {
if (!role && to.path!='/register'&&to.path!=='/submission'&&to.path!=='/orcidLink'&&to.path!=='/img'&& to.path !=='/reviewer'&&to.path !=='/thanks' &&to.path !== '/login'&&to.path.search(/retrieve/i)<0 ) {
next('/login');
// } else if (to.meta.permission) {
// // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已

View File

@@ -216,6 +216,11 @@ export default new Router({
component:()=>import('../components/page/reviewer.vue'),
meta:{title:'reviewer'}
},
{
path:'/orcidLink',
component:()=>import('../components/page/orcidLink.vue'),
meta:{title:'orcidLink'}
},
{
path:'/thanks',
component:()=>import('../components/page/thanks.vue'),