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
1d10647c
Commit
1d10647c
authored
Sep 06, 2016
by
h3remi7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use new data struct
parent
e4378b8c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
47 deletions
+136
-47
app/app-detail.component.html
app/app-detail.component.html
+3
-3
app/app-detail.component.ts
app/app-detail.component.ts
+28
-11
app/app.ts
app/app.ts
+18
-0
app/apps.component.html
app/apps.component.html
+1
-1
app/apps.component.ts
app/apps.component.ts
+2
-10
app/apps.service.ts
app/apps.service.ts
+10
-13
apps.json
apps.json
+74
-9
No files found.
app/app-detail.component.html
View file @
1d10647c
<h1>
{{name
()
}}
</h1>
<h1>
{{name}}
</h1>
<div
*ngIf=
"!isInstalled
()
"
>
<div
*ngIf=
"!isInstalled"
>
<button
type=
"button"
class=
"btn btn-primary"
>
安装
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
导入
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
正版代购
</button>
</div>
<div
*ngIf=
"isInstalled
()
"
>
<div
*ngIf=
"isInstalled"
>
<button
type=
"button"
class=
"btn btn-primary"
>
运行
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
设置
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
游览本地文件
</button>
...
...
app/app-detail.component.ts
View file @
1d10647c
import
{
Component
}
from
'
@angular/core
'
;
import
{
AppsService
}
from
'
./apps.service
'
import
{
RoutingService
}
from
'
./routing.service
'
//import 'rxjs/Rx';
import
{
App
}
from
"
./app
"
;
@
Component
({
selector
:
'
app-detail
'
,
templateUrl
:
'
app/app-detail.component.html
'
,
styleUrls
:
[
'
app/app-detail.component.css
'
],
})
export
class
AppDetailComponent
{
name
()
{
if
(
this
.
appsService
.
detail
[
this
.
routingService
.
app
])
{
return
this
.
appsService
.
detail
[
this
.
routingService
.
app
].
name
;
_currentApp
;
get
currentApp
():
App
{
let
data
=
this
.
appsService
.
data
;
let
tmp
;
if
(
data
)
{
tmp
=
data
.
find
((
v
)
=>
v
.
id
===
this
.
routingService
.
app
);
return
tmp
;
}
else
{
return
this
.
appsService
.
detail
[
"
default
"
].
name
;
}
}
_name
;
get
name
()
{
if
(
this
.
currentApp
)
{
return
this
.
currentApp
.
name
[
this
.
currentApp
.
locales
[
0
]];
}
return
"
Loading
"
;
};
isInstalled
()
{
if
(
this
.
appsService
.
detail
[
this
.
routingService
.
app
])
{
return
this
.
appsService
.
detail
[
this
.
routingService
.
app
].
isInstalled
;
}
else
{
return
this
.
appsService
.
detail
[
"
default
"
].
isInstalled
;
_isInstalled
;
get
isInstalled
()
{
if
(
this
.
currentApp
)
{
if
(
this
.
currentApp
.
local
.
path
)
{
return
true
;
}
}
return
false
;
}
constructor
(
private
appsService
:
AppsService
,
private
routingService
:
RoutingService
)
{
}
...
...
app/app.ts
View file @
1d10647c
...
...
@@ -28,8 +28,26 @@ export class App {
tags
:
string
[];
version
:
string
;
local
:
AppLocal
;
constructor
(
app
:
AppInterface
)
{
this
.
id
=
app
.
id
;
this
.
name
=
app
.
name
;
this
.
description
=
app
.
description
;
this
.
author
=
app
.
author
;
this
.
homepage
=
app
.
homepage
;
this
.
category
=
app
.
category
;
this
.
actions
=
app
.
actions
;
this
.
references
=
app
.
references
;
this
.
locales
=
app
.
locales
;
this
.
download
=
app
.
download
;
this
.
news
=
app
.
news
;
this
.
tags
=
app
.
tags
;
this
.
version
=
app
.
version
;
this
.
local
=
app
.
local
;
}
}
export
interface
AppInterface
extends
App
{
}
/*export interface TestInterface {
id: string;
name: {[locale: string]: string};
...
...
app/apps.component.html
View file @
1d10647c
...
...
@@ -10,7 +10,7 @@
class=
"list-group-item list-group-item-action"
[ngClass]=
"{active: app.id==routingService.app}"
>
{{app.name}}
{{app.name
[app.locales[0]]
}}
</a>
<a
href=
"#"
class=
"list-group-item list-group-item-action disabled"
>
{{routingService.app}}
</a>
</div>
\ No newline at end of file
app/apps.component.ts
View file @
1d10647c
...
...
@@ -14,22 +14,14 @@ export class AppsComponent {
console
.
log
(
appsService
.
data
)
if
(
appsService
.
data
.
length
>
0
)
{
this
.
selectApp
(
appsService
.
data
[
0
].
id
);
let
tmp
=
this
.
appsService
.
data
.
filter
((
v
)
=>
v
.
id
===
this
.
routingService
.
app
);
console
.
log
(
tmp
);
}
});
}
selectApp
(
id
)
{
this
.
routingService
.
app
=
id
;
this
.
getDetail
();
}
getDetail
()
{
for
(
let
i
=
0
;
i
<
this
.
appsService
.
data
.
length
;
i
++
){
let
x
=
this
.
appsService
.
data
[
i
];
if
(
x
.
id
==
this
.
routingService
.
app
)
{
this
.
appsService
.
detail
[
this
.
routingService
.
app
]
=
x
;
}
}
console
.
log
(
this
.
appsService
.
detail
);
}
}
app/apps.service.ts
View file @
1d10647c
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
'
rxjs/Rx
'
;
import
{
App
}
from
"
./app
"
;
import
{
AppLocal
}
from
"
./app-local
"
;
@
Injectable
()
export
class
AppsService
{
data
;
detail
=
{
"
default
"
:
{
"
id
"
:
"
id
"
,
"
name
"
:
"
name
"
,
"
isInstalled
"
:
false
},
}
data
:
App
[];
constructor
(
private
http
:
Http
)
{
}
getApps
(
callback
)
{
this
.
http
.
get
(
'
./apps.json
'
)
.
map
(
response
=>
response
.
json
())
.
map
(
response
=>
{
return
response
.
json
()
})
.
subscribe
(
data
=>
{
this
.
data
=
data
this
.
data
=
data
;
console
.
log
(
this
.
data
);
if
(
typeof
(
callback
)
===
'
function
'
)
{
callback
();
}
});
}
}
\ No newline at end of file
}
apps.json
View file @
1d10647c
[
{
"id"
:
"th105"
,
"name"
:
"东方绯想天"
,
"isInstalled"
:
true
"name"
:
{
"zh-CN"
:
"东方绯想天"
},
"description"
:
{
"zh-CN"
:
"fxt desc"
},
"author"
:
"ZUN"
,
"homepage"
:
"http://www.myacg.cc"
,
"category"
:
"ACT"
,
"actions"
:
{
"darwin"
:
{
"main"
:
{
"execute"
:
""
,
"args"
:
[],
"env"
:
""
,
"open"
:
""
}
}
},
"references"
:
{
"id"
:
""
,
"type"
:
"runtime"
},
"locales"
:
[
"zh-CN"
],
"download"
:
""
,
"news"
:
[{
"title"
:
"title"
,
"url"
:
""
,
"image"
:
""
}
],
"tags"
:
[
"ACT"
],
"local"
:
{
"path"
:
""
,
"version"
:
""
}
},
{
"id"
:
"th12"
,
"name"
:
"东方地灵殿"
,
"isInstalled"
:
false
},
{
"id"
:
"th13"
,
"name"
:
"东方UFO"
,
"isInstalled"
:
false
"name"
:
{
"zh-CN"
:
"地灵殿"
},
"description"
:
{
"zh-CN"
:
"th12 desc"
},
"author"
:
"ZUN"
,
"homepage"
:
"http://www.myacg.cc"
,
"category"
:
"ACT"
,
"actions"
:
{
"darwin"
:
{
"main"
:
{
"execute"
:
""
,
"args"
:
[],
"env"
:
""
,
"open"
:
""
}
}
},
"references"
:
{
"id"
:
""
,
"type"
:
"runtime"
},
"locales"
:
[
"zh-CN"
],
"download"
:
""
,
"news"
:
[{
"title"
:
"title"
,
"url"
:
""
,
"image"
:
""
}
],
"tags"
:
[
"ACT"
],
"local"
:
{
"path"
:
"/foo/bar"
,
"version"
:
"10.3"
}
}
]
\ No newline at end of file
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