You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.1 KiB
66 lines
2.1 KiB
<template>
|
|
<div class="portrait-style">
|
|
<a-avatar slot="avatar" :src="imgUrl"></a-avatar>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
/**
|
|
* 头像组件
|
|
* src
|
|
*/
|
|
import interConfig from '../api/commonInter';
|
|
import {Avatar} from 'ant-design-vue';
|
|
import StaticParams from '../../../global-llibs/staticParams';
|
|
export default{
|
|
data(){
|
|
return {
|
|
imgUrl: this.$store.state.userStore.portraitUrl,
|
|
}
|
|
},
|
|
props: ['personId'],
|
|
created() {
|
|
if(!this.imgUrl || this.imgUrl === "") {
|
|
this.getImgSrc(this.$props.personId)
|
|
}
|
|
},
|
|
methods: {
|
|
getImgSrc: function (personId) {
|
|
if (personId && personId != '') {
|
|
this.InterfaceConfig.callInterface([{
|
|
url: interConfig.getPersonTxByYw.url,
|
|
params: {
|
|
person_id: personId,
|
|
identity_id: 5,
|
|
},
|
|
method: interConfig.getPersonTxByYw.method,
|
|
isTestLogin: interConfig.getPersonTxByYw.isTestLogin,
|
|
}], (result) => {
|
|
let resData = result[0].data;
|
|
if (result[0].status === 200) {
|
|
if (resData.success === true) {
|
|
this.imgUrl = StaticParams.getThumbUrl(resData.file_id + "." + resData.extension, 100, 100, 100);
|
|
this.$store.commit('userStore/setPortraitUrl', this.imgUrl);
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
personId: function (newVal) {
|
|
this.getImgSrc(newVal)
|
|
}
|
|
},
|
|
components: {
|
|
AAvatar: Avatar
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.portrait-style {
|
|
.ant-avatar {
|
|
width: 36px;
|
|
height: 36px;
|
|
}
|
|
}
|
|
</style> |