app-user-info.tsx 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
import { Vue, Component } from 'vue-property-decorator';
import './app-user-info.less';

/**
 * 用户信息展示
 *
 * @export
 * @class AppUserInfo
 * @extends {Vue}
 */
@Component({})
export class AppUserInfo extends Vue {

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    /**
     * 用户名 
     *
     * @memberof AppUserInfo
     */
    public username = "埃";

    /**
     * vue  生命周期
     *
     * @memberof AppUserInfo
     */
    public mounted() {
        if(this.$store.getters.getAppData()){
            if(this.$store.getters.getAppData().context && this.$store.getters.getAppData().context.srfusername){
              let _username = this.$store.getters.getAppData().context.srfusername;
              this.username = _username.substr(0,1).toUpperCase();
            }
        }
    }

35 36 37 38 39 40 41 42 43
    /**
     * 绘制用户信息内容
     *
     * @returns {*}
     * @memberof AppUserInfo
     */
    public render(): any {
        return <div class="crm-app-user-info">
            <div class="user-head-sculpture">
44
                {this.username}
45 46 47 48 49 50 51 52
            </div>
            <span>
                <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAUCAYAAACqJ5zlAAAAN0lEQVQoU2PsmLzCk5Hh/0wGBgaG/wyM6Yydk5c/+s/AIAsSYGRgeIwpgKEFpBQZMJIhMIzcAQAhOjo7JEcKTQAAAABJRU5ErkJggg=="></img>
            </span>
        </div>;
    }

}