Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
c8512fac
Commit
c8512fac
authored
Sep 09, 2016
by
h3remi7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mods download
parent
9dcfbadf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
27 deletions
+72
-27
app/app-detail.component.html
app/app-detail.component.html
+17
-8
app/app-detail.component.ts
app/app-detail.component.ts
+3
-0
app/apps.service.ts
app/apps.service.ts
+50
-18
app/mycard.module.ts
app/mycard.module.ts
+2
-1
No files found.
app/app-detail.component.html
View file @
c8512fac
<h1>
{{'app.' + currentApp.id + '.name' | translate}}
</h1>
<h1>
{{'app.' + currentApp.id + '.name' | translate}}
</h1>
<h2>
{{appsService._aa}}
</h2>
<h2>
{{appsService._aa}}
</h2>
<div
*ngIf=
"!isInstalled"
>
<div
*ngIf=
"!isInstalled"
>
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
data-target=
"#install-modal"
>
安装
</button>
<div
*ngIf=
"!appsService.getDownloadInfo(routingService.app)"
>
<button
type=
"button"
class=
"btn btn-secondary"
>
导入
</button>
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
data-target=
"#install-modal"
>
安装
</button>
<button
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
*ngIf=
"appsService.getDownloadInfo(routingService.app)"
>
<progress
*ngIf=
"appsService.getDownloadInfo(routingService.app).status === 'active'"
class=
"progress progress-striped progress-animated"
value=
"{{appsService.getDownloadInfo(mod.id).progress}}"
max=
"100"
></progress>
</div>
</div>
</div>
<div
*ngIf=
"isInstalled"
>
<div
*ngIf=
"isInstalled"
>
<button
type=
"button"
class=
"btn btn-primary"
>
运行
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
运行
</button>
...
@@ -57,16 +62,19 @@
...
@@ -57,16 +62,19 @@
<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
(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"
class=
"btn btn-primary btn-sm"
>
安装
</button>
<progress
class=
"progress progress-striped progress-animated"
value=
"25"
max=
"100"
></progress>
<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>
{{appsService.getDownloadStatus(mod.id) | json}}
{{appsService.downloads_info | json}}
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
</div>
</div>
<
!==
DEBUG
--
>
<pre
class=
"debug"
>
{{appsService.downloadsInfo | json}}
</pre>
<!-- 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"
>
...
@@ -106,7 +114,7 @@
...
@@ -106,7 +114,7 @@
<h4>
附加内容
</h4>
<h4>
附加内容
</h4>
<div
*ngFor=
"let mod of currentApp.references[platform]"
>
<div
*ngFor=
"let mod of currentApp.references[platform]"
>
<label>
<label>
<input
type=
"checkbox"
(ngModel)=
"__todo__
"
<input
type=
"checkbox"
[(ngModel)]=
"model"
name=
"{{mod.id}}
"
[disabled]=
"['dependency', 'runtime'].includes(mod.type)"
>
[disabled]=
"['dependency', 'runtime'].includes(mod.type)"
>
{{searchApp(mod.id).name[searchApp(mod.id).locales[0]]}}
{{searchApp(mod.id).name[searchApp(mod.id).locales[0]]}}
</label>
</label>
...
@@ -116,6 +124,7 @@
...
@@ -116,6 +124,7 @@
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
取消
</button>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
取消
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
安装
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
安装
</button>
</div>
</div>
<pre>
{{model}}
</pre>
</form>
</form>
</div>
</div>
</div>
</div>
app/app-detail.component.ts
View file @
c8512fac
...
@@ -33,6 +33,7 @@ export class AppDetailComponent {
...
@@ -33,6 +33,7 @@ export class AppDetailComponent {
return
this
.
checkInstall
(
this
.
routingService
.
app
);
return
this
.
checkInstall
(
this
.
routingService
.
app
);
}
}
_news
;
_news
;
get
news
()
{
get
news
()
{
if
(
this
.
currentApp
)
{
if
(
this
.
currentApp
)
{
...
@@ -112,4 +113,6 @@ export class AppDetailComponent {
...
@@ -112,4 +113,6 @@ export class AppDetailComponent {
}
}
model
;
}
}
app/apps.service.ts
View file @
c8512fac
...
@@ -12,7 +12,18 @@ export class AppsService {
...
@@ -12,7 +12,18 @@ export class AppsService {
let
loop
=
setInterval
(()
=>
{
let
loop
=
setInterval
(()
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
console
.
log
(
'
res:
'
,
res
);
console
.
log
(
'
res:
'
,
res
);
this
.
downloadsInfo
=
res
;
if
(
res
)
{
res
.
map
((
v
)
=>
{
let
index
=
this
.
downloadsInfo
.
findIndex
((
info
)
=>
{
return
info
.
gid
==
v
.
gid
;
});
this
.
downloadsInfo
[
index
].
progress
=
(
v
.
completedLength
/
v
.
totalLength
)
*
100
;
});
}
//this.downloadsInfo = res;
})
})
},
1000
);
},
1000
);
...
@@ -25,7 +36,9 @@ export class AppsService {
...
@@ -25,7 +36,9 @@ export class AppsService {
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
data
:
App
[];
data
:
App
[];
downloadsInfo
=
{};
//[{"id": "th01", "gid": "aria2gid", "status": "active/install/complete/wait", "progress": "0-100"}]
downloadsInfo
=
[];
aria2IsOpen
=
false
;
aria2IsOpen
=
false
;
...
@@ -45,12 +58,21 @@ export class AppsService {
...
@@ -45,12 +58,21 @@ export class AppsService {
};
};
this
.
_aria2
.
onDownloadComplete
=
(
response
)
=>
{
this
.
_aria2
.
onDownloadComplete
=
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
//aria2.tellStatus(tmp_gid, (err, res)=>{
this
.
aria2
.
tellStatus
(
response
.
gid
,
(
err
,
res
)
=>
{
// if(res.followedBy) {
console
.
log
(
res
);
// this.downloadsInfo[id] = res.followedBy[0];
let
index
=
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
gid
==
res
.
gid
});
// }
if
(
index
!==
-
1
)
{
// console.log(res);
if
(
res
.
followedBy
)
{
//});
this
.
downloadsInfo
[
index
].
gid
=
res
.
followedBy
[
0
];
this
.
downloadsInfo
[
index
].
progress
=
0
;
}
else
{
this
.
downloadsInfo
[
index
].
status
=
"
wait
"
;
}
}
else
{
console
.
log
(
"
cannot found download info!
"
);
}
});
};
};
this
.
_aria2
.
onmessage
=
(
m
)
=>
{
this
.
_aria2
.
onmessage
=
(
m
)
=>
{
console
.
log
(
'
IN:
'
,
m
);
console
.
log
(
'
IN:
'
,
m
);
...
@@ -117,20 +139,30 @@ export class AppsService {
...
@@ -117,20 +139,30 @@ export class AppsService {
console
.
log
(
id
);
console
.
log
(
id
);
console
.
log
(
uri
);
console
.
log
(
uri
);
let
tmp_gid
;
let
tmp_gid
;
this
.
aria2
.
addUri
([
uri
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
let
i
=
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
});
if
(
error
)
{
console
.
log
(
i
);
console
.
error
(
error
);
if
(
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
})
!==
-
1
)
{
}
console
.
log
(
"
this app downloading
"
)
console
.
log
(
gid
);
tmp_gid
=
gid
;
}
else
{
});
this
.
aria2
.
addUri
([
uri
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
if
(
error
)
{
console
.
error
(
error
);
}
console
.
log
(
gid
);
this
.
downloadsInfo
.
push
({
"
id
"
:
id
,
"
gid
"
:
gid
,
"
status
"
:
"
active
"
,
"
progress
"
:
0
});
});
}
}
getDownloadStatus
(
id
)
{
let
info
=
{};
}
getDownloadInfo
(
id
)
{
let
info
;
info
=
this
.
downloadsInfo
.
find
((
v
)
=>
{
return
v
.
id
==
id
;
});
return
info
;
return
info
;
...
...
app/mycard.module.ts
View file @
c8512fac
import
{
NgModule
,
NO_ERRORS_SCHEMA
}
from
'
@angular/core
'
;
import
{
NgModule
,
NO_ERRORS_SCHEMA
}
from
'
@angular/core
'
;
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
;
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
;
import
{
FormsModule
}
from
'
@angular/forms
'
;
import
{
HttpModule
}
from
'
@angular/http
'
;
import
{
HttpModule
}
from
'
@angular/http
'
;
import
{
MyCardComponent
}
from
'
./mycard.component
'
;
import
{
MyCardComponent
}
from
'
./mycard.component
'
;
...
@@ -18,7 +19,7 @@ import {AppsService} from './apps.service';
...
@@ -18,7 +19,7 @@ import {AppsService} from './apps.service';
import
{
TranslateModule
}
from
'
ng2-translate/ng2-translate
'
;
import
{
TranslateModule
}
from
'
ng2-translate/ng2-translate
'
;
@
NgModule
({
@
NgModule
({
imports
:
[
BrowserModule
,
HttpModule
,
TranslateModule
.
forRoot
()],
imports
:
[
BrowserModule
,
FormsModule
,
HttpModule
,
TranslateModule
.
forRoot
()],
declarations
:
[
MyCardComponent
,
LoginComponent
,
StoreComponent
,
LobbyComponent
,
CommunityComponent
,
AppsComponent
,
AppDetailComponent
,
RosterComponent
,
CandyComponent
],
declarations
:
[
MyCardComponent
,
LoginComponent
,
StoreComponent
,
LobbyComponent
,
CommunityComponent
,
AppsComponent
,
AppDetailComponent
,
RosterComponent
,
CandyComponent
],
bootstrap
:
[
MyCardComponent
],
bootstrap
:
[
MyCardComponent
],
providers
:
[
RoutingService
,
AppsService
],
providers
:
[
RoutingService
,
AppsService
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment