This commit is contained in:
徐哼唧L
2022-12-09 16:18:12 +08:00
parent dc4d87a990
commit 5ed3073b6e
130 changed files with 41608 additions and 2013 deletions

View File

@@ -0,0 +1,747 @@
<template>
<div>
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item>
<i class="el-icon-coordinate"></i>
<router-link :to="{path:'/partyList'}">
<span class="top_dao"> User List</span>
</router-link>
>> User Role
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="container" v-loading="loading" element-loading-text="Loading..."
element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
<div class="s_rol">
<h3>
User information
<el-button @click="handleMessage" type="primary" icon="el-icon-edit" size="mini" round>Edit message
</el-button>
</h3>
<p class="rol_mess">
<font>Account :</font>{{userMessage.account}}
</p>
<p class="rol_mess">
<font>Email :</font>{{userMessage.email}}
</p>
<p class="rol_mess" v-if="userMessage.company!=''">
<font>Affiliations :</font>{{userMessage.company}}
</p>
<p class="rol_mess">
<font>English name :</font>{{userMessage.realname}}
</p>
<p class="rol_mess" v-if="userMessage.localname!=''">
<font>Local language name :</font>{{userMessage.localname}}
</p>
</div>
<div class="s_rol">
<h3>
Index
</h3>
<p class="rol_mess">
<font>WOS Index :</font>
<span v-html="colorIndex(userMessage.wos_index,userMessage.wos_time)"></span>
<b class="el-icon-edit pencil" @click="handleIndex(1)"></b>
</p>
<p class="rol_mess">
<font>Google Index :</font>
<span v-html="colorIndex(userMessage.google_index,userMessage.google_time)"></span>
<b class="el-icon-edit pencil" @click="handleIndex(2)" v-if="userMessage.g_author==''"></b>
<b class="el-icon-refresh-right pencil" @click="freshIndex" v-if="userMessage.g_author!=''"></b>
</p>
<p class="rol_mess" v-if="this.userrole == 0">
<img src="../../assets/img/browser.png" alt=""
style="width: 20px;vertical-align: sub;margin-right: 5px;">
<font>Google account :</font>
<b class="el-icon-check" v-if="userMessage.g_author!=''"
style="font-size: 20px;font-weight: bold;color: #2a9916;"></b>
<a v-if="userMessage.g_website!=''" :href="userMessage.g_website" class="webLink">Personal
homepage</a>
<el-button @click="handleIndex(3)" type="warning" icon="el-icon-link" size="mini" round
style="margin: 0 0 0 10px;padding: 5px 12px;" v-if="userMessage.g_author==''">binding
</el-button>
</p>
<p v-if="geogleList.length!=0&&bankVisible" style="margin:30px 0 20px 0;font-weight: bold;">Please
select one and press the
OK button.</p>
<div v-for="item in geogleList"
:class="IndexForm.g_author == item.author_id?'gugeList gu_col':'gugeList'" @click="choseGego(item)"
v-if="bankVisible">
<p style="font-weight: bold;letter-spacing: -0.5px;">{{item.name}}</p>
<p>
<font>Email :</font>{{item.email}}
</p>
<p>
<font>Affiliations :</font>{{item.affiliations}}
</p>
<p><a :href="item.link" target="_blank">{{item.link}}</a></p>
<i class="kuangGeo"></i>
<b class="el-icon-check"></b>
</div>
<div style="text-align: right;" v-if="geogleList.length!=0&&bankVisible">
<el-button @click="bankVisible = false">Cancel</el-button>
<el-button type="primary" @click="saveIndex(IndexForm)">OK</el-button>
</div>
<p v-if="geogleList.length==0&&bankVisible" style="text-align: center;color: #999;">No corresponding
data</p>
</div>
<div class="s_rol">
<h3>
User role
<el-button @click="handleAddGuest" type="primary" icon="el-icon-plus" size="mini" round>Add User
Role</el-button>
</h3>
<p class="rol_art" v-if="this.role_author==1">
<b>Author</b>
</p>
<p class="rol_art" v-if="this.role_editor==1">
<b>Editor</b>
</p>
<p class="rol_art" v-if="this.role_chief==1">
<b>Editor-in-Chief</b>
</p>
<p class="rol_art" v-if="this.role_reviewer==1">
<b>Reviewer</b>
</p>
<p class="rol_art" v-if="this.role_board==1">
<b>Editorial Board Member</b>
</p>
<p class="rol_art" v-if="this.role_yboard==1">
<b>Young Scientist Member</b>
</p>
<p class="rol_art" v-if="this.role_special==1">
<b>
Guest Editor
</b>
<font v-for="item in userMessage.specials">
{{item.journal_title}}
<font style="margin: 0 10px;">>></font>
{{item.title}}
</font>
</p>
</div>
</div>
<!-- 编辑信息弹出框 -->
<el-dialog title="Edit personal message" :visible.sync="messageVisible" width="700px">
<el-form ref="mes_Form" :model="MessForm" :rules="rules" label-width="170px">
<el-form-item label="Account :" prop="account">
{{MessForm.account}}
</el-form-item>
<el-form-item label="Email :" prop="email">
{{MessForm.email}}
</el-form-item>
<el-form-item label="English name :" prop="realname">
<el-input v-model="MessForm.realname"></el-input>
<br>
<p class="zhujie_name">
(Will be used for certificate, website, etc. in TMR Publishing Group Products.<br>
Check
<a href="https://www.tmrjournals.cn/afoor_text.html?&footer_id=50" target="_blank">Privacy
Policy</a>)
</p>
</el-form-item>
<el-form-item label="Local language name :" prop="localname">
<el-input v-model="MessForm.localname"></el-input>
<br>
<p class="zhujie_name">
(Just be used for view for users themselves and editors. <br>
Check
<a href="https://www.tmrjournals.cn/afoor_text.html?&footer_id=50" target="_blank">Privacy
Policy</a>)
</p>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="messageVisible = false">Cancel</el-button>
<el-button type="primary" @click="saveMessage(MessForm)">OK</el-button>
</span>
</el-dialog>
<!-- H指数弹出框 -->
<el-dialog title="Edit personal index" :visible.sync="indexVisible" width="600px">
<el-form ref="index_Form" :model="IndexForm" :rules="rules" label-width="170px">
<el-form-item label="Account :" prop="account">
{{IndexForm.account}}
</el-form-item>
<el-form-item v-if="IndexForm.number==1">
<span slot="label">
WOS H index ({{this.now_year}}) :
</span>
<el-input v-model="IndexForm.wos_index"></el-input>
</el-form-item>
<el-form-item v-if="IndexForm.number==2">
<span slot="label">
Google H index ({{this.now_year}}) :
</span>
<el-input v-model="IndexForm.google_index"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="indexVisible = false">Cancel</el-button>
<el-button type="primary" @click="saveIndex(IndexForm)">OK</el-button>
</span>
</el-dialog>
<!-- 添加身份 -->
<el-dialog title="Add User Role" :visible.sync="guestVisible" width="550px">
<el-form ref="guestTab" :model="addRoleForm" :rules="rules" label-width="130px">
<el-form-item label="User Role :" prop="role_type">
<el-select v-model="addRoleForm.role_type" @change="chan_role">
<el-option v-for="item in df_role" :label="item.title" :key="item.type" :value="item.type">
</el-option>
</el-select>
</el-form-item>
<!-- 客座专刊 -->
<el-form-item label="Journal :" prop="issn_id" v-if="addRoleForm.role_type=='special'">
<el-select v-model="addRoleForm.issn_id" @change="chan_jour">
<el-option v-for="item in df_jour" :label="item.title" :key="item.issn" :value="item.issn">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="Guest Journal :" prop="special_id" v-if="addRoleForm.role_type=='special'">
<el-select v-model="addRoleForm.special_id" style="width: 360px;">
<el-option v-for="item in df_guest" :label="item.title" :key="item.journal_special_id"
:value="item.journal_special_id"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="guestVisible = false">Cancel</el-button>
<el-button type="primary" @click="saveGuest">Save</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
loading: false,
userrole: localStorage.getItem('U_status'),
mediaUrl: this.Common.mediaUrl,
role_id: this.$route.query.id,
MessForm: {},
IndexForm: {
wos_index: '',
google_index: '',
},
geogleList: [],
messageVisible: false,
indexVisible: false,
bankVisible: false,
now_year: 0,
df_jour: [],
df_guest: [],
df_role: [
// {
// title: 'Author',
// type: 'author',
// }, {
// title: 'Editor',
// type: 'editor',
// }, {
// title: 'Editor-in-Chief',
// type: 'chief',
// }, {
// title: 'Reviewer',
// type: 'reviewer',
// }, {
// title: 'Editorial Board Member',
// type: 'board',
// }, {
// title: 'Young Scientist Member',
// type: 'yboard',
// },
{
title: 'Guest Editor',
type: 'special',
}
],
role_author: 0,
role_editor: 0,
role_chief: 0,
role_reviewer: 0,
role_board: 0,
role_yboard: 0,
role_special: 0,
userMessage: {},
addRoleForm: {
user_id: this.$route.query.id,
role_type: '',
issn_id: '',
special_id: ''
},
guestVisible: false,
rules: {
role_type: [{
required: true,
message: 'Please select a role',
trigger: 'blur'
}],
issn_id: [{
required: true,
message: 'Please select a journal',
trigger: 'blur'
}],
special_id: [{
required: true,
message: 'Please select a guest',
trigger: 'blur'
}],
realname: [{
required: true,
message: 'Please input realname',
trigger: 'blur'
}],
}
};
},
mounted() {
},
created() {
this.getDate()
},
methods: {
// 获取数据
getDate() {
this.loading = true
this.now_year = new Date().getFullYear()
this.$api
.post('api/User/getUserDetail', {
'user_id': this.$route.query.id
})
.then(res => {
if (res.code == 0) {
this.userMessage = res.data.user;
this.role_author = 0;
this.role_editor = 0;
this.role_chief = 0;
this.role_reviewer = 0;
this.role_board = 0;
this.role_yboard = 0;
this.role_special = 0;
let shenfen = this.userMessage.roles
for (let i = 0; i < shenfen.length; i++) {
if (shenfen[i] == 'author') {
this.role_author = 1
} else if (shenfen[i] == 'editor') {
this.role_editor = 1
} else if (shenfen[i] == 'chief') {
this.role_chief = 1
} else if (shenfen[i] == 'reviewer') {
this.role_reviewer = 1
} else if (shenfen[i] == 'board') {
this.role_board = 1
} else if (shenfen[i] == 'yboard') {
this.role_yboard = 1
} else if (shenfen[i] == 'special') {
this.role_special = 1
}
}
this.loading = false
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
this.$api
.post('api/Chief/getJournalsByEditor', {
'user_id': localStorage.getItem('U_id')
})
.then(res => {
if (res.code == 0) {
this.df_jour = res.data.journals;
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
},
// 个人信息修改
handleMessage() {
// this.$router.push({
// path: 'partyRoleEdit',
// query: {
// id: this.userMessage.user_id
// }
// });
this.messageVisible = true
this.MessForm = JSON.parse(JSON.stringify(this.userMessage))
},
// 保存个人信息
saveMessage() {
this.$api
.post('api/User/editUserMsg', this.MessForm)
.then(res => {
if (res.code == 0) {
this.$message.success('Successfully modified personal information');
this.messageVisible = false
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
},
// 刷新H指数
freshIndex() {
this.$api
.post('api/User/googleGetIndex', this.userMessage)
.then(res => {
if (res.code == 0) {
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
},
// 个人指数修改
handleIndex(e) {
this.IndexForm = JSON.parse(JSON.stringify(this.userMessage))
this.IndexForm.number = e
if (e == 3) {
this.loading = true
this.$api
.post('api/User/googleGetAuthor', this.IndexForm)
.then(res => {
if (res.code == 0) {
this.geogleList = res.data.authors
this.bankVisible = true
this.loading = false
} else {
this.$message.error(res.msg);
this.loading = false
}
})
.catch(err => {
this.$message.error(err);
this.loading = false
});
} else {
this.indexVisible = true
}
},
// 保存个人信息
saveIndex() {
let link_geo = ''
if (this.IndexForm.number == 3) {
if (this.IndexForm.g_author == '') {
this.$message.error('Please select one!');
return
}
link_geo = 'api/User/googleBindAuthor'
} else {
link_geo = 'api/User/editUserMsg'
}
this.$api
.post(link_geo, this.IndexForm)
.then(res => {
if (res.code == 0) {
this.$message.success('Successfully modified personal index');
this.indexVisible = false;
this.bankVisible = false;
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
},
// 选择谷歌账号
choseGego(e) {
this.IndexForm.g_author = e.author_id
this.IndexForm.g_website = e.link
},
// 指数颜色
colorIndex(num, time) {
if (time != 0) {
let date = new Date(parseInt(time * 1000));
let Y = date.getFullYear() + '-';
let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) + '-' : date.getMonth() + 1 + '-';
let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
let H = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
let U = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
time = Y + M + D;
}
let str = '';
if (num < 10) {
str = '<b style="color:#cb160a">' + num +
'</b><span style="color:#aaa;font-size:14px;margin-left:5px;"> (' + time +
')</span>'
} else if (num < 15) {
str = '<b style="color:#cbb504">' + num +
'</b><span style="color:#aaa;font-size:14px;margin-left:5px;"> (' + time +
')</span>'
} else {
str = '<b style="color:#0cbc15">' + num +
'</b><span style="color:#aaa;font-size:14px;margin-left:5px;"> (' + time +
')</span>'
}
if (time == 0) {
str =
'<b style="color:#aaa;">0 </b><span style="color:#aaa;font-size:14px;margin-left:5px;">(No time)</span>'
}
return str;
},
// 下拉身份
chan_role() {
},
// 下拉期刊客座
chan_jour() {
this.addRoleForm.special_id = ''
this.$api
.post('api/Special/getSpecialByIssn', {
'journal_issn': this.addRoleForm.issn_id
})
.then(res => {
if (res.code == 0) {
this.df_guest = res.data.specials;
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
},
// 客座弹出框
handleAddGuest() {
this.guestVisible = true
},
// 添加客座身份
saveGuest() {
this.$refs.guestTab.validate((valid) => {
if (valid) {
this.$api
.post('api/User/addUserRole', this.addRoleForm)
.then(res => {
if (res.code == 0) {
this.guestVisible = false
this.getDate()
this.$refs.guestTab.resetFields()
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
} else {
this.$message.error('error submit!!');
return false;
}
});
},
},
computed: {
},
watch: {
}
};
</script>
<style scoped>
.container {
padding: 0;
}
.top_dao:hover {
text-decoration: underline;
cursor: pointer;
}
.s_rol {
padding: 30px 30px 20px 30px;
}
.s_rol:nth-child(2n) {
background-color: #f7fcff;
}
.s_rol>h3 {
margin: 0 0 25px 0;
letter-spacing: -0.5px;
font-size: 18px;
}
.s_rol>h3>button {
margin: 0 0 0 25px;
padding: 5px 12px;
}
.s_rol>h3>button:hover {
text-decoration: underline;
}
.s_rol>p.rol_mess {
margin-bottom: 15px;
font-size: 16px;
padding: 0 0 0 10px;
}
.s_rol>p.rol_mess>font {
color: #666;
margin-right: 10px;
}
.s_rol>p.rol_mess>.pencil {
color: #006699;
margin-left: 15px;
font-weight: bold;
cursor: pointer;
}
.s_rol>p.rol_art {
margin-bottom: 30px;
padding: 0 10px 30px 10px;
border-bottom: 1px solid #eee;
}
.s_rol>p.rol_art>b {
display: block;
font-size: 16px;
color: #006699;
letter-spacing: -0.5px;
}
.s_rol>p.rol_art>font {
display: block;
margin: 15px 0 0 10px;
font-size: 14px;
color: #333;
}
.s_rol>p.rol_art>font:nth-child(2) {
margin-top: 25px;
}
.s_rol>p.rol_art>span {
display: block;
color: #666;
font-size: 14px;
margin: 15px 0 0 10px;
}
.webLink {
color: #2a9916;
margin-left: 10px;
cursor: pointer;
}
.webLink:hover {
text-decoration: underline;
}
.gugeList {
font-size: 14px;
border: 2px dashed #eee;
cursor: pointer;
margin-bottom: 20px;
padding: 10px 30px 10px 15px;
position: relative;
}
.gugeList:hover {
background-color: #fdfdfd;
}
.gugeList>p {
margin-bottom: 5px;
line-height: 20px;
}
.gugeList>p>font {
margin-right: 5px;
color: #999;
}
.gugeList>p>a {
color: #006699;
}
.gugeList>p>a:hover {
text-decoration: underline;
}
.gugeList>b {
display: none;
}
.gugeList>.kuangGeo {
display: block;
position: absolute;
width: 15px;
height: 15px;
border: 2px solid #eee;
top: 10px;
right: 10px;
}
.gugeList.gu_col {
border: 2px solid #006699;
background-color: #ebf4f9;
position: relative;
}
.gugeList.gu_col>b {
display: block;
position: absolute;
top: 5px;
right: 5px;
color: #069;
font-weight: 700;
font-size: 25px;
}
.zhujie_name {
font-size: 12px;
line-height: 20px;
margin-top: 6px;
color: #999;
}
.zhujie_name a {
color: #006699;
font-weight: bold;
letter-spacing: -0.5px;
}
.zhujie_name a:hover {
text-decoration: underline;
}
</style>