Commit 3bdfcb80 authored by wudizhanche1000's avatar wudizhanche1000

添加卸载

parent 6c86bc5d
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</div> </div>
<div *ngIf="isInstalled"> <div *ngIf="isInstalled">
<button (click)="startApp(routingService.app)" type="button" class="btn btn-primary">运行</button> <button (click)="startApp(routingService.app)" type="button" class="btn btn-primary">运行</button>
<button type="button" class="btn btn-secondary">设置</button> <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#settings-modal">设置</button>
<button (click)="openDir(routingService.app)" type="button" class="btn btn-secondary">游览本地文件</button> <button (click)="openDir(routingService.app)" type="button" class="btn btn-secondary">游览本地文件</button>
<button type="button" class="btn btn-secondary">联机</button> <button type="button" class="btn btn-secondary">联机</button>
</div> </div>
...@@ -65,12 +65,22 @@ ...@@ -65,12 +65,22 @@
<td>{{'app.' + mod.id + '.name' | translate}}</td> <td>{{'app.' + mod.id + '.name' | translate}}</td>
<td>{{mod.type}}</td> <td>{{mod.type}}</td>
<td *ngIf="checkInstall(mod.id)"> <td *ngIf="checkInstall(mod.id)">
<button type="button" class="btn btn-danger btn-sm">卸载</button></td> <button type="button" class="btn btn-danger btn-sm">卸载</button>
</td>
<td *ngIf="!checkInstall(mod.id)"> <td *ngIf="!checkInstall(mod.id)">
<button *ngIf="!appsService.getDownloadInfo(mod.id)" (click)="install(mod.id)" type="button" class="btn btn-primary btn-sm">安装</button> <button *ngIf="!appsService.getDownloadInfo(mod.id)" (click)="install(mod.id)" type="button"
<progress *ngIf="appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'active'" class="progress progress-striped progress-animated" value="{{appsService.getDownloadInfo(mod.id).progress}}" max="100"></progress> class="btn btn-primary btn-sm">安装
<div *ngIf="appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'wait'">等待安装...</div> </button>
<div *ngIf="appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'install'">正在安装...</div> <progress
*ngIf="appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'active'"
class="progress progress-striped progress-animated"
value="{{appsService.getDownloadInfo(mod.id).progress}}" max="100"></progress>
<div *ngIf="appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'wait'">
等待安装...
</div>
<div *ngIf="appsService.getDownloadInfo(mod.id) && appsService.getDownloadInfo(mod.id).status === 'install'">
正在安装...
</div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -84,13 +94,60 @@ ...@@ -84,13 +94,60 @@
{{appsService.tarQueue | json}} {{appsService.tarQueue | json}}
{{appsService.waitInstallQueue | json}} {{appsService.waitInstallQueue | json}}
</pre> </pre>
<button (click)="appsService.doTar()" >DOTAR</button> <button (click)="appsService.doTar()">DOTAR</button>
<div class="modal fade" id="settings-modal" tabindex="-1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{'settings'|translate}}</h4>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#general">
{{'general'|translate}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#updates">
{{'updates'|translate}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#local-files">
{{'local files'|translate}}
</a>
</li>
</ul>
</div>
<div class="modal-body">
<div class="tab-content">
<div id="general" role="tabpanel" class="tab-pane fade active">
</div>
<div id="updates" role="tabpanel" class="tab-pane fade">
</div>
<div id="local-files" role="tabpanel" class="tab-pane fade">
<button type="button" (click)="uninstall()">
{{'uninstall'|translate}}
</button>
</div>
</div>
</div>
<div>
</div>
</div>
</div>
</div>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="install-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" <div class="modal fade" id="install-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true"> aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<form class="modal-content" (ngSubmit)="installSubmit(theForm)" #theForm="ngForm"> <form id="install-form" class="modal-content" (ngSubmit)="installSubmit(theForm)" #theForm="ngForm">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
...@@ -103,7 +160,8 @@ ...@@ -103,7 +160,8 @@
<h4>安装位置</h4> <h4>安装位置</h4>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<input type="text" [(ngModel)]="appsService.installConfig.installDir" name="installDir" class="form-control" placeholder="安装位置"> <input type="text" [(ngModel)]="appsService.installConfig.installDir" name="installDir"
class="form-control" placeholder="安装位置">
<span class="input-group-btn"> <span class="input-group-btn">
<button (click)="selectDir()" class="btn btn-secondary" type="button">浏览</button> <button (click)="selectDir()" class="btn btn-secondary" type="button">浏览</button>
</span> </span>
...@@ -112,7 +170,8 @@ ...@@ -112,7 +170,8 @@
<h4>快捷方式</h4> <h4>快捷方式</h4>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" [(ngModel)]="appsService.installConfig.shortcut.application" name="application"> <input type="checkbox" [(ngModel)]="appsService.installConfig.shortcut.application"
name="application">
创建应用程序快捷方式 创建应用程序快捷方式
</label> </label>
</div> </div>
...@@ -133,10 +192,12 @@ ...@@ -133,10 +192,12 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="submit" [disabled]="!theForm.form.valid" class="btn btn-primary">安装</button> <button id="submit" type="submit" [disabled]="!theForm.form.valid" class="btn btn-primary">安装</button>
</div> </div>
<!-- <!--
--> -->
</form> </form>
</div> </div>
</div> </div>
...@@ -5,7 +5,6 @@ import {App} from "./app"; ...@@ -5,7 +5,6 @@ import {App} from "./app";
declare var process; declare var process;
declare var $; declare var $;
@Component({ @Component({
selector: 'app-detail', selector: 'app-detail',
templateUrl: 'app/app-detail.component.html', templateUrl: 'app/app-detail.component.html',
...@@ -105,13 +104,18 @@ export class AppDetailComponent { ...@@ -105,13 +104,18 @@ export class AppDetailComponent {
install(id) { install(id) {
let uri = this.appsService.searchApp(id).download[process.platform]; let uri = this.appsService.searchApp(id).download[process.platform];
console.log(process.platform); $('#install-modal').modal('hide');
if (uri) { if (uri) {
this.appsService.download(id, uri); this.appsService.download(id, uri);
} else { } else {
console.log("lost download uri!"); console.log("lost download uri!");
}
} }
uninstall(id: string) {
id = this.currentApp.id;
this.appsService.uninstall(id);
} }
...@@ -123,8 +127,6 @@ export class AppDetailComponent { ...@@ -123,8 +127,6 @@ export class AppDetailComponent {
this.install(mod); this.install(mod);
} }
} }
$("#install-modal").modal("hide");
} }
selectDir() { selectDir() {
......
This diff is collapsed.
{ {
"library": "游戏", "library": "游戏",
"community": "社区" "community": "社区",
"settings": "设置",
"uninstall": "卸载",
"general":"常规",
"updates":"更新",
"local files":"本地文件"
} }
...@@ -94,7 +94,7 @@ function createAria2c() { ...@@ -94,7 +94,7 @@ function createAria2c() {
let aria2c = child_process.spawn(aria2c_path, ['--enable-rpc', '--rpc-allow-origin-all', "--continue", "--split=10", "--min-split-size=1M", "--max-connection-per-server=10"]); let aria2c = child_process.spawn(aria2c_path, ['--enable-rpc', '--rpc-allow-origin-all', "--continue", "--split=10", "--min-split-size=1M", "--max-connection-per-server=10"]);
aria2c.on('data', (data)=> { aria2c.on('data', (data)=> {
console.log(data); console.log(data);
}) });
return aria2c; return aria2c;
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs', 'rxjs': 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate/bundles/ng2-translate.js', 'ng2-translate': 'node_modules/ng2-translate/bundles/ng2-translate.js',
"os":''
}; };
// packages tells the System loader how to load when no filename and/or no extension // packages tells the System loader how to load when no filename and/or no extension
var packages = { var packages = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment