View

Code

  1. import { Component, HostListener, ElementRef } from '@angular/core';
  2. import { Adal4Service } from '../../adal/adal4.service';
  3.  
  4. export class UserProfile {
  5. name: string;
  6. roleName: string
  7. }
  8.  
  9. @Component({
  10. selector: 'avatar',
  11. templateUrl: './avatar.component.html',
  12. styleUrls: ['./avatar.component.css'],
  13. host: {
  14. 'class': 'fxs-topbar-avatarmenu fxs-avatarmenu'
  15. }
  16. })
  17.  
  18. export class AvatarComponent {
  19. currentUser: any;
  20. dropmenuIsOpen: boolean = false;
  21.  
  22. ngOnInit(): void {
  23. this.currentUser = this.service.userInfo;
  24. }
  25. constructor(
  26. private service: Adal4Service,
  27. private eRef: ElementRef) {
  28.  
  29. }
  30.  
  31. dropmenuOpen() {
  32. if (this.dropmenuIsOpen)
  33. this.dropmenuIsOpen = false;
  34. else {
  35. this.dropmenuIsOpen = true;
  36. }
  37. }
  38.  
  39. signOut() {
  40. this.service.logOut();
  41. }
  42.  
  43. @HostListener('document:click', ['$event'])
  44. clickout(event: Event) {
  45. if (this.eRef.nativeElement.contains(event.target)) {
  46. if (event.srcElement.id != 'avatarmenu') {
  47. this.dropmenuOpen();
  48. }
  49. } else {
  50. this.dropmenuIsOpen = false;
  51. }
  52. }
  53. }
  1. <div class="fxs-dropmenu" role="presentation" id="avatarmenu">
  2. <button title="" class="fxs-dropmenu-button fxs-menu-account fxs-popup-button" (click)="dropmenuOpen()" id="avatarmenu">
  3. <div title="" class="fxs-avatarmenu-header fxs-trim-hover" id="avatarmenu">
  4. <div class="fxs-avatarmenu-tenant-container" id="avatarmenu">
  5. <div class="fxs-avatarmenu-username" id="avatarmenu">
  6. {{currentUser.profile.unique_name}}
  7. </div>
  8. <div class="fxs-avatarmenu-tenant" id="avatarmenu">{{currentUser.profile.name}}</div>
  9. </div>
  10. <!--https://portal.azure.com/Content/static/MsPortalImpl/AvatarMenu/AvatarMenu_defaultAvatarSmall.png-->
  11. <img class="fxs-avatarmenu-tenant-image" alt="" src="/images/AvatarMenu_defaultAvatarSmall.png" id="avatarmenu">
  12. </div>
  13. </button>
  14. <div class="fxs-dropmenu-content fxs-text-link fxs-popup fxs-portal-bg-txt-br fxs-dropmenu-defaultWidth fxs-dropmenu-left" [class.fxs-dropmenu-hidden]="!dropmenuIsOpen" [class.fxs-dropmenu-is-open]="dropmenuIsOpen" id="0d73b1cf-e692-477e-b434-edecaa1f3004" role="menu" aria-hidden="false">
  15. <div class="fxs-avatarmenu-dropdown">
  16. <div class="fxs-avatarmenu-scrollviewer">
  17. <ul class="menu sub-menu">
  18. <li id="mi_246_profileInfo" class="menu-item profile-info-item" style="padding:15px">
  19. <span class="html">
  20. <img src="/images/AvatarMenu_defaultAvatarSmall.png" class="profile-image" alt="">
  21. <div class="profile-menu-name" title="{{currentUser.profile.name}}">{{currentUser.profile.name}}</div>
  22. <div class="profile-menu-unique-name" title="{{currentUser.profile.unique_name}}">{{currentUser.profile.unique_name}}</div>
  23. </span>
  24. </li>
  25. <li id="mi_258" class="menu-item menu-item-separator" role="separator" title="">
  26. <div class="separator"></div>
  27. </li>
  28. <li id="mi_260" class="menu-item cta" style="padding:10px" >
  29. <span class="menu-item-icon bowtie-icon bowtie-contact-card" aria-hidden="true">
  30. <svg viewBox="0 0 15 15" class="fxs-portal-svg" role="presentation" focusable="false" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="FxSymbol0-006" width="100%" height="100%"><g><title></title><path d="M8.883.942v1.586h3.118L6.314 8.214a.792.792 0 1 0 1.121 1.122l5.545-5.545v2.833h1.586V.942H8.883z"></path><path d="M12.01 6.064a.316.316 0 0 0-.344.068l-.946.946a.316.316 0 0 0-.092.223v3.746c0 .601-.489 1.09-1.09 1.09H3.272c-.601 0-1.09-.489-1.09-1.09V6.07c0-.601.489-1.09 1.09-1.09h4.762a.315.315 0 0 0 .223-.092l.946-.946a.316.316 0 0 0-.223-.539H3.272A2.67 2.67 0 0 0 .605 6.07v4.977a2.67 2.67 0 0 0 2.667 2.667h6.266a2.67 2.67 0 0 0 2.667-2.667V6.355a.319.319 0 0 0-.195-.291z"></path></g></svg>
  31. </span>
  32. <span class="text" role="button"><a href="https://sts.china-inv.cn/adfs/portal/updatepassword" target="_blank">修改密码</a></span>
  33. <span class="html"></span>
  34. </li>
  35. <li id="mi_260" class="menu-item cta" style="padding:10px;" (click)="signOut()">
  36. <span class="menu-item-icon bowtie-icon bowtie-contact-card" aria-hidden="true">
  37. <svg xmlns="http://www.w3.org/2000/svg" class="" role="presentation" aria-hidden="true" viewBox="0 0 15 15" focusable="false" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg">
  38. <g>
  39. <path d="M 12.133 3.033 a 0.995 0.995 0 1 0 -1.408 1.408 a 4.543 4.543 0 0 1 1.336 3.225 a 4.544 4.544 0 0 1 -1.336 3.225 A 4.547 4.547 0 0 1 7.5 12.227 a 4.54 4.54 0 0 1 -3.224 -1.336 A 4.544 4.544 0 0 1 2.94 7.666 a 4.543 4.543 0 0 1 1.336 -3.225 a 0.995 0.995 0 1 0 -1.408 -1.408 a 6.537 6.537 0 0 0 -1.92 4.633 a 6.535 6.535 0 0 0 1.92 4.633 A 6.537 6.537 0 0 0 7.5 14.218 h 0.004 a 6.53 6.53 0 0 0 4.628 -1.919 a 6.534 6.534 0 0 0 1.919 -4.633 a 6.534 6.534 0 0 0 -1.918 -4.633 Z M 7.5 8.662 c 0.55 0 0.996 -0.446 0.996 -0.996 V 1.655 a 0.996 0.996 0 0 0 -1.992 0 v 6.011 c 0 0.55 0.446 0.996 0.996 0.996 Z" />
  40. </g>
  41. </svg>
  42. </span>
  43. <span class="text" role="button" style="margin-left:20px">注销</span>
  44. <span class="html"></span>
  45. </li>
  46.  
  47. </ul>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  1. .sub-menu {
  2. font-size: 13px;
  3. z-index:;
  4. background: #fff;
  5. color: #5b5b5b;
  6. white-space: nowrap;
  7. z-index:;
  8. -webkit-box-shadow: 0 3px 3px rgba(160,160,160,.5);
  9. -moz-box-shadow: 0 3px 3px rgba(160,160,160,.5);
  10. box-shadow: 0 3px 3px rgba(160,160,160,.5);
  11. border-top:;
  12. border-left:;
  13. text-align: left;
  14. font-family: "Segoe UI VSS (Regular)","-apple-system",BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Helvetica,Ubuntu,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
  15. position: fixed;
  16. right: 65px;
  17. }
  18. .menu {
  19. border: 1px solid #c8c8c8;
  20. background-color: #fff;
  21. min-width: 250px;
  22. max-width: 400px;
  23. -moz-box-shadow: 3px 3px 3px rgba(160,160,160,.5);
  24. -webkit-box-shadow: 3px 3px 3px rgba(160,160,160,.5);
  25. box-shadow: 3px 3px 3px rgba(160,160,160,.5);
  26. }
  27.  
  28. .menu-item .profile-info-item {
  29. width: 250px;
  30. margin-bottom: 8px;
  31. text-decoration: none !important;
  32. }
  33. .html {
  34. font-size: 14px;
  35. }
  36.  
  37. .profile-image {
  38. width: 40px;
  39. height: 40px;
  40. border-radius: 50%;
  41. margin-right: 8px;
  42. float: left;
  43. }
  44.  
  45. .profile-menu-name {
  46. width: calc(100% - 50px);
  47. white-space: nowrap;
  48. overflow: hidden;
  49. text-overflow: ellipsis;
  50. }
  51.  
  52. .profile-menu-unique-name {
  53. font-size: 12px;
  54. width: calc(100% - 50px);
  55. white-space: nowrap;
  56. overflow: hidden;
  57. text-overflow: ellipsis;
  58. }
  59. .bowtie-icon {
  60. margin: 0 6px 0 0;
  61. height: 16px;
  62. width: 16px;
  63. vertical-align: bottom;
  64. }
  65.  
  66. .menu-item-separator {
  67. min-height:;
  68. border: none;
  69. padding: 4px 0;
  70. }
  71.  
  72. .separator {
  73. height: 1px;
  74. background-color: #c8c8c8;
  75. border-top: 1px solid transparent;
  76. cursor: default;
  77. }
  78. .menu-item .bowtie-icon {
  79. margin: 1px 10px 0 0;
  80. float: left;
  81. }
  82.  
  83. .text {
  84. display: inline-block;
  85. text-overflow: ellipsis;
  86. overflow: hidden;
  87. white-space: nowrap;
  88. width: 100%;
  89. }

【angular5项目积累总结】avatar组件的更多相关文章

  1. 【angular5项目积累总结】优秀组件以及应用实例

    1.手机端 图片预览组件 组件:sideshow 效果图:(预览图全屏 且可以左右移动)                  code: <div class="row ui-app-s ...

  2. 【angular5项目积累总结】breadcrumb面包屑组件

    view code <div class="fxs-breadcrumb-wrapper" aria-label="Navigation history" ...

  3. 【angular5项目积累总结】panel组件

    view code panel.component.css :host { display:flex; min-width:300px } panel.component.html <heade ...

  4. 【angular5项目积累总结】遇到的一些问题以及解决办法

    1.项目中字符串特别是\r\n,替换成br之后,在页面换行无法生效? 答:绑定元素 innerHTML. <div class="panel-body" [innerHTML ...

  5. 【angular5项目积累总结】消息订阅服务

    code import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; @Injectable ...

  6. 【angular5项目积累总结】文件上传

    <div class="form-group row"> <label class="col-sm-2 col-form-label"> ...

  7. 【angular5 项目积累总结】项目公共样式

    main.css @font-face { font-family: 'wf_segoe-ui_normal'; src: local('Segoe UI'),url('../fonts/segoe- ...

  8. 【angular5项目积累总结】侧栏菜单 navmenu

    View Code import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/co ...

  9. 【angular5项目积累总结】结合adal4实现http拦截器(token)

    import { Injectable } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRe ...

随机推荐

  1. C# 函数式编程及Monads.net库

    函数式编程中,一切皆为函数,这个函数一般不是类级别的,其可以保存在变量中,可以当做参数或返回值,是函数级别的抽象和重用,将函数作为可重用的基本模块,就像面向对象中一切皆为对象,把所有事物抽象为类,面向 ...

  2. EBS中 EXCEL 格式报表输出的公用API

    http://blog.itpub.net/10359218/viewspace-752601/ 最近的项目上写了一个公用的API,很久以前就用EXCEL发布过报表,但从没想过写API来简化...   ...

  3. Windows10卡顿,磁盘 内存占用100%或比较多

    1.关闭服务:Superfetch: 2.结束antimalware service executable进程,gpedit.msc下依次点击“计算机配置/管理模板/Windows组件/Windows ...

  4. 自动化构建工具gradle安装教程(使用sdkman安装)

    gradle是什么?(wiki解释) Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化建构工具.它使用一种基于Groovy的特定领域语言来声明项目设置,而不是传统的 ...

  5. 如何获取 docker 容器(container)的 ip 地址

    1. 进入容器内部后 cat /etc/hosts 会显示自己以及(– link)软连接的容器IP 2.使用命令 docker inspect --format '{{ .NetworkSetting ...

  6. Android开发教程 - 使用Data Binding Android Studio不能正常生成相关类/方法的解决办法

    本系列目录 使用Data Binding(一)介绍 使用Data Binding(二)集成与配置 使用Data Binding(三)在Activity中的使用 使用Data Binding(四)在Fr ...

  7. 修改windows远程默认端口

    修改windows远程默认端口 windows端口修改rdp 1 远程服务器运行窗口调出注册表编辑器 注册表编辑器regeidt 2 修改两个注册表 1,在注册表HKEY_LOCAL_MACHINE\ ...

  8. 基于iview的后台管理

    年前由于时间紧迫,原本使用iview技术开发后台管理系统的大神另有任务,我中途接手该项目,此前对于iview一无所知的我是一脸的懵逼,好在后台管理的整体框架大神已经搭建好了,而我之前对vue也有一定的 ...

  9. Django中安装搜索引擎方法。

    全文检索 全文检索不同于特定字段的模糊查询,使用全文检索的效率更高,并且能够对于中文进行分词处理. haystack:全文检索的框架,支持whoosh.solr.Xapian.Elasticsearc ...

  10. vue-cli2 构建速度优化

    对于使用 vue-cli 脚手架创建的前端项目,编译发布几乎是必需操作,有的编译只需要几秒钟,快如闪电,有的却需要好几分钟,慢如蜗牛.如果是线上进行热修复,那更是分秒必争,网页响应的速度直接影响了用户 ...