Browse Source

[新增]新增多角色跳转,完善下载逻辑

master
邵佳豪 4 years ago
parent
commit
03dd980e96
  1. 7
      src/app/is-login.service.ts
  2. 1
      src/app/pages/lockscreen/lockscreen.component.ts
  3. 1
      src/app/pages/login/login.component.ts
  4. 3
      src/app/ui/all-file/all-file.component.html
  5. 20
      src/app/ui/all-file/all-file.component.ts

7
src/app/is-login.service.ts

@ -29,7 +29,8 @@ export class IsLoginService {
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", e.fileName);
let fileName = e.fileName ? e.fileName : e.objectName.split('/')[e.objectName.split('/').length-1]
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
@ -67,9 +68,9 @@ export class IsLoginService {
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", e.fileName);
let fileName = e.fileName ? e.fileName : e.objectName.split('/')[e.objectName.split('/').length-1]
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
this.isDownloading = false //关闭下载进度条
this.downloadProgress = 0 //初始化进度条

1
src/app/pages/lockscreen/lockscreen.component.ts

@ -29,6 +29,7 @@ export class LockscreenComponent implements OnInit {
onSubmit(e){
let params = { roleType: this.roleType }
this.http.post('/api/Account/SignIn',e,{params}).subscribe((data:any)=>{
sessionStorage.setItem('userId',data.userId)
sessionStorage.setItem('username',e.name)
sessionStorage.setItem('expires',data.expires)
sessionStorage.setItem('realName',data.realName)

1
src/app/pages/login/login.component.ts

@ -29,6 +29,7 @@ export class LoginComponent implements OnInit {
onSubmit(e){
let params = { roleType: '0' }
this.http.post('/api/Account/SignIn',e,{params}).subscribe((data:any)=>{
sessionStorage.setItem('userId',data.userId)
sessionStorage.setItem('username',e.name)
sessionStorage.setItem('expires',data.expires)
sessionStorage.setItem('realName',data.realName)

3
src/app/ui/all-file/all-file.component.html

@ -149,6 +149,9 @@
<a (click)="openlearn()" [href]='aHrefUnsafeLearnFun()'> <mat-icon style="vertical-align: middle; font-size: 24px;">account_balance</mat-icon> 战术学习<span>进入</span></a>
</div>
<div class="openSystem" *ngIf="!selectedDataBank.includes('/')">
<a (click)="openmultirole()" [href]='aHrefUnsafeLearnFun2()'> <mat-icon style="vertical-align: middle; font-size: 24px;">account_balance</mat-icon> 多人电子沙盘推演系统<span>进入</span></a>
</div>
<div class="fixedBox" [hidden]="!uploadisLoading2">
<app-upload-files [thatFile]='this' #child></app-upload-files>
</div>

20
src/app/ui/all-file/all-file.component.ts

@ -94,7 +94,19 @@ export class AllFileComponent {
this.aHrefUnsafe = this.sanitizer.bypassSecurityTrustUrl(aHref);
return this.aHrefUnsafe
}
aHrefUnsafeLearnFun2(){
this.roleType = sessionStorage.getItem('roleType')
let username = sessionStorage.getItem('username')
let expires = sessionStorage.getItem('expires')
let realName = sessionStorage.getItem('realName')
let roleType = sessionStorage.getItem('roleType')
let token = sessionStorage.getItem('token')
let refreshToken = sessionStorage.getItem('refreshToken')
let userId = sessionStorage.getItem('userId')
let aHref = `ax2://startup?username=${username}&token=${token}&refreshToken=${refreshToken}&expires=${expires}&realname=${realName}&roleType=${roleType}&userId=${userId}`
this.aHrefUnsafe = this.sanitizer.bypassSecurityTrustUrl(aHref);
return this.aHrefUnsafe
}
//获得当前资料库的文件列表
getALLFileList(name){
this.selectedDataBank = name
@ -434,6 +446,11 @@ export class AllFileComponent {
let key = `allFiles/${this.selectedDataBank}/战术学习/`
this.downloadFile.handleData(key,"进入")
}
//记录多角色推演
openmultirole(){
let key = `allFiles/${this.selectedDataBank}/多角色推演/`
this.downloadFile.handleData(key,"进入")
}
//返回上一级目录
backTominTop(){
let topnum = this.gettoplist(this.selectedDataBank)
@ -934,7 +951,6 @@ export class AllFileComponent {
this.snackBar.open('文件夹不支持下载','确定',config)
}else{
this.http.get('/api/ObjectMetadata/drives/' + this.selectDownloadFile.key).subscribe(data=>{
// console.log(123,data)
this.download = data
this.downloadFile.download(this.download)
})

Loading…
Cancel
Save