Files
irc_web/src/views/trials/trials-myinfo/index.vue
T
wangxiaoshuang 7363b0049d
continuous-integration/drone/push Build is passing
新增、编辑角色
2024-12-25 11:23:00 +08:00

222 lines
5.1 KiB
Vue

<template>
<div class="trial-myinfo">
<el-menu
:default-active="activeIndex"
@select="handleSelect"
class="el-menu-demo"
style="width: 200px"
>
<el-menu-item index="1">{{
$t('trials:trials-myinfo:menuTitle:mine')
}}</el-menu-item>
<el-menu-item index="2">{{
$t('trials:trials-myinfo:menuTitle:account')
}}</el-menu-item>
<el-menu-item index="3">{{
$t('trials:trials-myinfo:menuTitle:loginLog')
}}</el-menu-item>
<div
index="4"
@click="handleSelect('4')"
class="el-menu-item"
v-if="hasPermi(['role:ir'])"
>
{{ $t('trials:trials-myinfo:menuTitle:resume') }}
</div>
</el-menu>
<div class="contentBox">
<mine
:user="user"
:userTypeOptions="userTypeOptions"
v-if="activeIndex === '1'"
@getUserInfo="getUserInfo"
/>
<account
:user="user"
@getUserInfo="getUserInfo"
:IsCanConnectInternet="IsCanConnectInternet"
v-if="activeIndex === '2'"
/>
<login-log v-if="activeIndex === '3'" :id="userId" :isMine="true" />
</div>
</div>
</template>
<script>
import mine from './mine.vue'
import account from './account.vue'
import loginLog from '@/views/trials/trials-panel/trial-summary/login-log'
import { getUserTypeList, getUser, useUserIDGetDoctorID } from '@/api/admin.js'
import store from '@/store'
import { mapGetters } from 'vuex'
export default {
name: 'TrialsMyinfo',
components: { mine, account, 'login-log': loginLog },
data() {
return {
activeIndex: '1',
userTypeOptions: [],
user: {},
IsCanConnectInternet: true, // 是否可以链接互联网
open: null,
}
},
computed: {
...mapGetters(['userId', 'userName']),
},
mounted() {
this.getUserInfo()
this.getUserTypeList()
},
methods: {
async handleSelect(index) {
if (index === '4') {
if (this.open) {
this.open.close()
}
let id = await this.useUserIDGetDoctorID()
const routeData = this.$router.resolve({
path: `/curriculumVitae?Id=${id}&&lang=${this.$i18n.locale}`,
})
this.open = window.open(routeData.href, '_blank')
} else {
this.activeIndex = index
}
},
async useUserIDGetDoctorID() {
try {
let res = await useUserIDGetDoctorID({
UserID: this.$store.state.user.userId,
})
if (res.IsSuccess) {
return res.Result.DoctorID
}
return false
} catch (err) {
return false
console.log(err)
}
},
getUserInfo() {
const loading = this.$loading({
fullscreen: false,
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.07)',
})
getUser()
.then(async (res) => {
this.user = res.Result
/* eslint-disable */
zzSessionStorage.setItem('Name', this.user.FullName)
await store.dispatch('user/updateInfo')
loading.close()
})
.catch(() => {
loading.close()
})
},
getUserTypeList() {
getUserTypeList().then((res) => {
if (res.IsSuccess) {
this.userTypeOptions = res.Result
}
})
},
},
}
</script>
<style lang="scss">
.trial-myinfo {
flex: 1;
overflow: auto;
display: flex;
flex-direction: row;
justify-content: space-around;
.contentBox {
width: calc(100% - 220px);
background-color: #fff;
padding: 0 20px;
height: 100%;
overflow: auto;
// padding-bottom: 50px;
}
.trial-myinfo-head {
position: absolute;
top: 40px;
left: 20px;
font-size: 14px;
}
.trial-myinfo-left {
overflow: auto;
background: #fff;
// width: calc(50% - 9px);
// margin: 6px 0;
height: 100%;
// padding-bottom: 50px;
.trial-myinfo-left-top {
width: 70%;
padding-top: 100px;
position: relative;
// margin: 0 auto;
margin-bottom: 10px;
.trial-myinfo-body {
width: 160px;
height: 160px;
border-radius: 50%;
background: #428bca;
display: flex;
justify-content: center;
align-items: center;
margin-left: 30px;
div {
color: #fff;
font-size: 30px;
}
}
}
}
.saveBtn {
position: absolute;
right: -10px;
top: 2px;
transform: translateX(100%);
}
.trial-info-btn {
position: absolute;
bottom: -60px;
left: 10px;
min-width: 97px;
}
.trial-myinfo-left-bottom {
width: 40%;
padding-top: 100px;
position: relative;
// margin: 0 auto;
}
.trial-myinfo-right {
overflow: auto;
background: #fff;
// width: calc(50% - 9px);
// margin: 6px 0;
height: 100%;
.sendCode {
position: absolute;
right: -10px;
top: 50%;
transform: translate(100%, -50%);
}
.trial-myinfo-right-box {
width: 40%;
padding-top: 100px;
position: relative;
// margin: 0 auto;
}
}
}
</style>