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
00440da2
Commit
00440da2
authored
Sep 09, 2016
by
h3remi7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add download (todo hide model)
parent
c8512fac
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
22 deletions
+73
-22
app/app-detail.component.html
app/app-detail.component.html
+13
-8
app/app-detail.component.ts
app/app-detail.component.ts
+17
-2
app/apps.component.ts
app/apps.component.ts
+3
-0
app/apps.service.ts
app/apps.service.ts
+35
-7
apps.json
apps.json
+5
-5
No files found.
app/app-detail.component.html
View file @
00440da2
...
@@ -7,7 +7,10 @@
...
@@ -7,7 +7,10 @@
<button
type=
"button"
class=
"btn btn-secondary"
>
正版代购
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
正版代购
</button>
</div>
</div>
<div
*ngIf=
"appsService.getDownloadInfo(routingService.app)"
>
<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>
<progress
*ngIf=
"appsService.getDownloadInfo(routingService.app).status === 'active'"
class=
"progress progress-striped progress-animated"
value=
"{{appsService.getDownloadInfo(routingService.app).progress}}"
max=
"100"
>
</progress>
</div>
</div>
</div>
</div>
<div
*ngIf=
"isInstalled"
>
<div
*ngIf=
"isInstalled"
>
...
@@ -73,13 +76,14 @@
...
@@ -73,13 +76,14 @@
<
!==
DEBUG
--
>
<
!==
DEBUG
--
>
<pre
class=
"debug"
>
<pre
class=
"debug"
>
{{appsService.downloadsInfo | json}}
{{appsService.downloadsInfo | json}}
{{appsService.installConfig | json}}
</pre>
</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"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-dialog"
role=
"document"
>
<form
class=
"modal-content"
(ngSubmit)=
"install
()
"
>
<form
class=
"modal-content"
(ngSubmit)=
"install
Submit(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"
>
×
</span>
<span
aria-hidden=
"true"
>
×
</span>
...
@@ -92,7 +96,7 @@
...
@@ -92,7 +96,7 @@
<h4>
安装位置
</h4>
<h4>
安装位置
</h4>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<input
type=
"text"
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
class=
"btn btn-secondary"
type=
"button"
>
浏览
</button>
<button
class=
"btn btn-secondary"
type=
"button"
>
浏览
</button>
</span>
</span>
...
@@ -101,20 +105,20 @@
...
@@ -101,20 +105,20 @@
<h4>
快捷方式
</h4>
<h4>
快捷方式
</h4>
<div
class=
"checkbox"
>
<div
class=
"checkbox"
>
<label>
<label>
<input
type=
"checkbox"
(ngModel)=
"shortcut.
application"
>
<input
type=
"checkbox"
[(ngModel)]=
"appsService.installConfig.shortcut.application"
name=
"
application"
>
创建应用程序快捷方式
创建应用程序快捷方式
</label>
</label>
</div>
</div>
<div
class=
"checkbox"
>
<div
class=
"checkbox"
>
<label>
<label>
<input
type=
"checkbox"
(ngModel)=
"shortcut.
desktop"
>
<input
type=
"checkbox"
[(ngModel)]=
"appsService.installConfig.shortcut.desktop"
name=
"
desktop"
>
创建桌面快捷方式
创建桌面快捷方式
</label>
</label>
</div>
</div>
<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)]=
"
model
"
name=
"{{mod.id}}"
<input
type=
"checkbox"
[(ngModel)]=
"
appsService.installConfig.mods[mod.id]
"
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>
...
@@ -122,9 +126,10 @@
...
@@ -122,9 +126,10 @@
</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=
"
button
"
class=
"btn btn-primary"
>
安装
</button>
<button
type=
"
submit"
[disabled]=
"!theForm.form.valid
"
class=
"btn btn-primary"
>
安装
</button>
</div>
</div>
<pre>
{{model}}
</pre>
<!--
-->
</form>
</form>
</div>
</div>
</div>
</div>
app/app-detail.component.ts
View file @
00440da2
...
@@ -108,11 +108,26 @@ export class AppDetailComponent {
...
@@ -108,11 +108,26 @@ export class AppDetailComponent {
let
uri
=
this
.
searchApp
(
id
).
download
;
let
uri
=
this
.
searchApp
(
id
).
download
;
if
(
uri
)
{
if
(
uri
)
{
this
.
appsService
.
download
(
id
,
uri
);
this
.
appsService
.
download
(
id
,
uri
);
}
else
{
console
.
log
(
"
lost download uri!
"
);
}
}
}
}
installSubmit
(
theForm
)
{
console
.
log
(
theForm
);
this
.
install
(
this
.
routingService
.
app
);
for
(
let
mod
in
this
.
appsService
.
installConfig
.
mods
)
{
if
(
this
.
appsService
.
installConfig
.
mods
[
mod
])
{
this
.
install
(
mod
);
}
}
model
;
//TODO tar file
}
}
}
app/apps.component.ts
View file @
00440da2
...
@@ -39,6 +39,9 @@ export class AppsComponent {
...
@@ -39,6 +39,9 @@ export class AppsComponent {
selectApp
(
id
)
{
selectApp
(
id
)
{
this
.
routingService
.
app
=
id
;
this
.
routingService
.
app
=
id
;
this
.
appsService
.
createInstllConfig
(
id
);
}
}
}
}
app/apps.service.ts
View file @
00440da2
...
@@ -5,13 +5,15 @@ import {App} from "./app";
...
@@ -5,13 +5,15 @@ import {App} from "./app";
import
{
AppLocal
}
from
"
./app-local
"
;
import
{
AppLocal
}
from
"
./app-local
"
;
import
{
TranslateService
}
from
"
ng2-translate
"
;
import
{
TranslateService
}
from
"
ng2-translate
"
;
declare
var
process
;
@
Injectable
()
@
Injectable
()
export
class
AppsService
{
export
class
AppsService
{
constructor
(
private
http
:
Http
,
private
translate
:
TranslateService
)
{
constructor
(
private
http
:
Http
,
private
translate
:
TranslateService
)
{
let
loop
=
setInterval
(()
=>
{
let
loop
=
setInterval
(()
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
console
.
log
(
'
res:
'
,
res
);
//
console.log('res:', res);
if
(
res
)
{
if
(
res
)
{
res
.
map
((
v
)
=>
{
res
.
map
((
v
)
=>
{
let
index
=
this
.
downloadsInfo
.
findIndex
((
info
)
=>
{
let
index
=
this
.
downloadsInfo
.
findIndex
((
info
)
=>
{
...
@@ -75,8 +77,8 @@ export class AppsService {
...
@@ -75,8 +77,8 @@ export class AppsService {
});
});
};
};
this
.
_aria2
.
onmessage
=
(
m
)
=>
{
this
.
_aria2
.
onmessage
=
(
m
)
=>
{
console
.
log
(
'
IN:
'
,
m
);
//
console.log('IN:', m);
console
.
log
(
'
download infoi:
'
,
this
.
downloadsInfo
);
//
console.log('download infoi:', this.downloadsInfo);
}
}
}
}
...
@@ -136,11 +138,11 @@ export class AppsService {
...
@@ -136,11 +138,11 @@ export class AppsService {
}
}
download
(
id
,
uri
)
{
download
(
id
,
uri
)
{
console
.
log
(
id
);
//
console.log(id);
console
.
log
(
uri
);
//
console.log(uri);
let
tmp_gid
;
let
tmp_gid
;
let
i
=
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
});
let
i
=
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
});
console
.
log
(
i
);
//
console.log(i);
if
(
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
})
!==
-
1
)
{
if
(
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
})
!==
-
1
)
{
console
.
log
(
"
this app downloading
"
)
console
.
log
(
"
this app downloading
"
)
...
@@ -149,7 +151,7 @@ export class AppsService {
...
@@ -149,7 +151,7 @@ export class AppsService {
if
(
error
)
{
if
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
}
}
console
.
log
(
gid
);
//
console.log(gid);
this
.
downloadsInfo
.
push
({
"
id
"
:
id
,
"
gid
"
:
gid
,
"
status
"
:
"
active
"
,
"
progress
"
:
0
});
this
.
downloadsInfo
.
push
({
"
id
"
:
id
,
"
gid
"
:
gid
,
"
status
"
:
"
active
"
,
"
progress
"
:
0
});
});
});
}
}
...
@@ -165,7 +167,33 @@ export class AppsService {
...
@@ -165,7 +167,33 @@ export class AppsService {
});
});
return
info
;
return
info
;
}
installConfig
;
createInstllConfig
(
id
)
{
let
app
=
this
.
data
.
find
((
app
)
=>
{
return
app
.
id
==
id
;});
let
platform
=
process
.
platform
;
let
mods
=
{};
if
(
app
.
references
[
platform
])
{
app
.
references
[
platform
].
map
((
mod
)
=>
{
mods
[
mod
.
id
]
=
false
;
});
}
let
tmp
=
{
installDir
:
__dirname
,
shortcut
:
{
desktop
:
false
,
application
:
false
},
mods
:
mods
};
//console.log(tmp);
this
.
installConfig
=
tmp
;
return
tmp
;
}
}
...
...
apps.json
View file @
00440da2
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
"references"
:
{
"references"
:
{
"darwin"
:
[
"darwin"
:
[
{
{
"id"
:
"th
105
"
,
"id"
:
"th
06
"
,
"type"
:
"optional"
"type"
:
"optional"
},
},
{
{
...
@@ -135,13 +135,13 @@
...
@@ -135,13 +135,13 @@
"locales"
:
[
"locales"
:
[
"zh-CN"
"zh-CN"
],
],
"download"
:
""
,
"download"
:
"
http://thief.mycard.moe/metalinks/th12.meta4
"
,
"news"
:
[],
"news"
:
[],
"tags"
:
[
"tags"
:
[
"STG"
"STG"
],
],
"local"
:
{
"local"
:
{
"path"
:
"
/foo/bar
"
,
"path"
:
""
,
"version"
:
"10.3"
"version"
:
"10.3"
}
}
},
},
...
@@ -170,7 +170,7 @@
...
@@ -170,7 +170,7 @@
"locales"
:
[
"locales"
:
[
"zh-CN"
"zh-CN"
],
],
"download"
:
""
,
"download"
:
"
http://thief.mycard.moe/metalinks/th11.meta4
"
,
"news"
:
[],
"news"
:
[],
"tags"
:
[
"tags"
:
[
"STG"
"STG"
...
@@ -205,7 +205,7 @@
...
@@ -205,7 +205,7 @@
"locales"
:
[
"locales"
:
[
"zh-CN"
"zh-CN"
],
],
"download"
:
""
,
"download"
:
"
http://thief.mycard.moe/metalinks/th10.meta4
"
,
"news"
:
[
"news"
:
[
{
{
"title"
:
"News Title"
,
"title"
:
"News Title"
,
...
...
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