comp-manage.component.ts 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import { Component, OnInit} from '@angular/core';
  2. import { CompNavComponent } from '../comp-nav/comp-nav.component';
  3. import {DomSanitizer} from '@angular/platform-browser';
  4. import { RouterOutlet, Router } from '@angular/router';
  5. import { CommonCompModule } from '../../services/common.modules';
  6. import { MatIconRegistry, MatIconModule } from '@angular/material/icon';
  7. import { textbookServer } from '../../services/textbook';
  8. @Component({
  9. selector: 'app-comp-manage',
  10. standalone: true,
  11. imports: [CompNavComponent, RouterOutlet, CommonCompModule,MatIconModule],
  12. templateUrl: './comp-manage.component.html',
  13. styleUrls: ['./comp-manage.component.scss'],
  14. })
  15. export class CompManageComponent implements OnInit {
  16. MENU_ICON:string = `<svg width="18" height="20" viewBox="0 0 18 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  17. <path d="M18 2H4C3.46957 2 2.96086 2.21071 2.58579 2.58579C2.21071 2.96086 2 3.46957 2 4C2 4.53043 2.21071 5.03914 2.58579 5.41421C2.96086 5.78929 3.46957 6 4 6H18V19C18 19.2652 17.8946 19.5196 17.7071 19.7071C17.5196 19.8946 17.2652 20 17 20H4C2.93913 20 1.92172 19.5786 1.17157 18.8284C0.421427 18.0783 0 17.0609 0 16V4C0 2.93913 0.421427 1.92172 1.17157 1.17157C1.92172 0.421427 2.93913 0 4 0H17C17.2652 0 17.5196 0.105357 17.7071 0.292893C17.8946 0.48043 18 0.734783 18 1V2Z" fill="url(#paint0_linear_5_11023)"/>
  18. <defs>
  19. <linearGradient id="paint0_linear_5_11023" x1="9" y1="-2.21282e-07" x2="25.5" y2="40" gradientUnits="userSpaceOnUse">
  20. <stop stop-color="#E04860"/>
  21. <stop offset="1" stop-color="#E99306"/>
  22. </linearGradient>
  23. </defs>
  24. </svg>
  25. `
  26. optionsMap: any = {
  27. "国家级管理员":[
  28. {
  29. name:'教材管理',
  30. id:'1',
  31. child:[
  32. {
  33. name:'申报流程',
  34. path:"/nav-admin/manage/process",
  35. id:'1-1',
  36. },
  37. // {
  38. // name:'全部教材',
  39. // path:'/nav-admin/manage/textbook',
  40. // id:'1-2',
  41. // },
  42. ]
  43. },
  44. {
  45. name:'用户管理',
  46. id:'2',
  47. child:[
  48. {
  49. name:'用户列表',
  50. path:"/nav-admin/manage/user",
  51. id:'2-1',
  52. },
  53. {
  54. name:'申报单位管理',
  55. path:"/nav-admin/manage/role",
  56. id:'2-3',
  57. },
  58. ]
  59. },
  60. // {
  61. // name:'品牌化',
  62. // id:'3',
  63. // child:[
  64. // {
  65. // name:'登录框',
  66. // id:'3-1',
  67. // },
  68. // {
  69. // name:'消息设置',
  70. // id:'3-2',
  71. // },
  72. // ]
  73. // },
  74. // {
  75. // name:'字段管理',
  76. // id:'4',
  77. // },
  78. ],
  79. "工作联系人":[
  80. {
  81. name:'教材申报',
  82. id:'1',
  83. child:[
  84. {
  85. name:'申报流程',
  86. path:"/nav-province-contact/manage/process",
  87. id:'1-1',
  88. },
  89. // {
  90. // name:'全部教材',
  91. // path:'/nav-province-contact/manage/textbook',
  92. // id:'1-2',
  93. // },
  94. ]
  95. },
  96. {
  97. name:'用户管理',
  98. id:'2',
  99. child:[
  100. {
  101. name:'用户列表',
  102. path:"/nav-province-contact/manage/user",
  103. id:'2-1',
  104. },
  105. {
  106. name:'申报单位管理',
  107. path:"/nav-province-contact/manage/role",
  108. id:'2-3',
  109. },
  110. ]
  111. },
  112. ],
  113. "高校联系人":[
  114. // {
  115. // id:'1',
  116. // name:'教材申报',
  117. // child:[
  118. // {
  119. // id:'1-1',
  120. // name:'全部教材',
  121. // path:'/nav-province-school-contact/manage/textbook',
  122. // }
  123. // ]
  124. // },
  125. {
  126. id:'1',
  127. name:'用户管理',
  128. child:[
  129. {
  130. id:'1-1',
  131. name:'用户列表',
  132. path:'/nav-province-school-contact/manage/user',
  133. },
  134. {
  135. name:'申报单位管理',
  136. path:"/nav-province-school-contact/manage/role",
  137. id:'1-2',
  138. },
  139. ]
  140. },
  141. {
  142. name:'个人空间',
  143. id:'3',
  144. path: '/nav-province-school-contact/manage/space',
  145. },
  146. {
  147. name:'回收站',
  148. id:'4',
  149. path: '/nav-province-school-contact/manage/recycle',
  150. },
  151. ],
  152. "评审专家":[
  153. {
  154. name:'报送流程',
  155. id:'1',
  156. path: '/nav-review/home/apply',
  157. },
  158. {
  159. name:'个人信息',
  160. id:'2',
  161. path: '/nav-review/profile',
  162. },
  163. ],
  164. "个人":[
  165. {
  166. name: '个人空间',
  167. id: '1',
  168. path: '/nav-author/manage/space',
  169. },
  170. {
  171. name: '回收站',
  172. id: '2',
  173. path: '/nav-author/manage/recycle',
  174. // params: {
  175. // isDeleted: true,
  176. // },
  177. },
  178. ],
  179. }
  180. active: string = localStorage.getItem('active') || '1';
  181. isCollapsed:boolean = false;
  182. constructor(
  183. public router: Router,
  184. public tbookSer: textbookServer,
  185. public textbook:textbookServer,
  186. iconRegistry: MatIconRegistry,
  187. sanitizer: DomSanitizer
  188. ) {
  189. iconRegistry.addSvgIconLiteral('menu', sanitizer.bypassSecurityTrustHtml(this.MENU_ICON));
  190. }
  191. ngOnInit() {
  192. if(localStorage.getItem('active')) return
  193. if(this.optionsMap[this.tbookSer.profile.identity][0]?.child){
  194. this.active = '1-1'
  195. }else{
  196. this.active = '1'
  197. }
  198. }
  199. toggleCollapsed(): void {
  200. this.isCollapsed = !this.isCollapsed;
  201. }
  202. toUrl(child: any) {
  203. let cateid = child.id;
  204. this.active = cateid;
  205. localStorage.setItem('active', cateid);
  206. console.log(child);
  207. if (child.params) {
  208. this.router.navigate([child.path, child?.params]);
  209. } else {
  210. this.router.navigate([child.path]);
  211. }
  212. }
  213. }