从接口中获取国富之星样式

This commit is contained in:
mengxiaolong
2021-01-19 15:32:42 +08:00
parent 172b4d0063
commit ce7d4dbdf6

View File

@@ -1,12 +1,13 @@
<!-- 头部用户信息 --> <!-- 头部用户信息 -->
<template> <template>
<div class="user-info flex p15 bg-head align-items-e"> <div class="user-info flex p15 bg-head align-items-e">
<div class="avatar"> <div class="avatar w40 h40">
<img class="w40 star" src="../../../assets/images/avatar-border.gif" /> <img class="w40 absolute-center" :src="avatarUrl" />
<img class="w40" src="../../../assets/images/bnf_avatar.png" /> <img v-if="isGfStar" class="w40 star absolute-center" :src="avatarBorderUrl" />
</div> </div>
<div class="add-list flex1 ml15"> <div class="add-list flex1 ml15">
<span class="fs16 font-bold name">{{ userInfo.encryptionName }}</span> <span class="fs16 font-bold name">{{ userInfo.encryptionName }}</span>
<img v-if="isGfStar" id="gf-star" class="ml2" :src="titleUrl" />
<div class="">工号 | {{ userInfo.encryptionJobNo }}</div> <div class="">工号 | {{ userInfo.encryptionJobNo }}</div>
</div> </div>
</div> </div>
@@ -14,12 +15,18 @@
<script> <script>
import { getAgentInfo } from '@/api/ebiz/my/my.js' import { getAgentInfo } from '@/api/ebiz/my/my.js'
import defaultAvatar from '@/assets/images/bnf_avatar.png'
import avatarBorderUrl from '@/assets/images/avatar-border.gif'
export default { export default {
name: 'UserInfoHeader', name: 'UserInfoHeader',
data() { data() {
return { return {
userInfo: '', // 代理人信息 userInfo: '', // 代理人信息
activeNames: ['1'] activeNames: ['1'],
avatarUrl: defaultAvatar,
avatarBorderUrl: avatarBorderUrl,
titleUrl: '',
isGfStar: false
} }
}, },
created() { created() {
@@ -41,6 +48,16 @@ export default {
this.$toast(res.resultMessage) this.$toast(res.resultMessage)
} }
} }
if (this.userInfo.agentHeadImgUrl) {
this.avatarUrl = this.userInfo.agentHeadImgUrl
}
if (this.userInfo.starForGFLabelImgUrl) {
this.titleUrl = this.userInfo.starForGFLabelImgUrl
}
if (this.userInfo.starForGFFrameUrl) {
this.avatarBorderUrl = this.userInfo.starForGFFrameUrl
}
this.isGfStar = this.userInfo.starForGFFlag === 'Y'
} }
}, },
components: {} components: {}
@@ -48,6 +65,13 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.absolute-center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.user-info { .user-info {
background-image: url('~@/assets/images/headerBg.png'); background-image: url('~@/assets/images/headerBg.png');
background-size: cover; background-size: cover;
@@ -58,7 +82,7 @@ export default {
position: relative; position: relative;
.star { .star {
position: absolute; position: absolute;
transform: scale(1.5); transform: translate(-50%, -50%) scale(1.6);
} }
} }
@@ -69,18 +93,12 @@ export default {
line-height: 22px; line-height: 22px;
.name { .name {
position: relative; position: relative;
vertical-align: middle;
} }
.name::after { #gf-star {
content: ' '; display: inline-block;
background-image: url('~@/assets/images/gf-star.gif'); max-width: 40px;
background-size: contain; vertical-align: top;
width: 88px;
height: 30px;
position: absolute;
transform-origin: 0 0;
transform: scale(0.5);
top: 0;
margin-left: 2px;
} }
} }
.font-bold { .font-bold {