diff --git a/src/apis/index.php b/src/apis/index.php index 8adaa9a..2505490 100644 --- a/src/apis/index.php +++ b/src/apis/index.php @@ -71,6 +71,7 @@ switch($_GET['query']) { } } else if($_GET['type'] == 'works') { $item->type = $re['type']; + $item->videos = $re['videos']; $item->exhibitions = array(); $qx = mysqli_query($conn,"SELECT id,title FROM `exhibitions` WHERE id IN (".$re['exhibitions'].")"); while($re = mysqli_fetch_array($qx)) { diff --git a/src/app/detail/detail.component.html b/src/app/detail/detail.component.html index d9eed73..3840c58 100644 --- a/src/app/detail/detail.component.html +++ b/src/app/detail/detail.component.html @@ -12,6 +12,23 @@
+ +
+
+ {{video.title}} +
+ {{video.code}} + +
+
+
+ + Tags: {{details.tags}} Exhibitions: diff --git a/src/app/detail/detail.component.scss b/src/app/detail/detail.component.scss index 6d7c7c9..e7516ba 100644 --- a/src/app/detail/detail.component.scss +++ b/src/app/detail/detail.component.scss @@ -43,6 +43,27 @@ } } + .videos { + .video-title { + font-size: $font-18; + font-weight: bold; + padding-bottom: 5px; + } + + .youtube { + position: relative; + padding-bottom: 56.25%; + + .iframe{ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } + } + } + .tags, .links { display: block; diff --git a/src/app/detail/detail.component.ts b/src/app/detail/detail.component.ts index 1b0c36a..724e402 100644 --- a/src/app/detail/detail.component.ts +++ b/src/app/detail/detail.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core' import { Router, NavigationEnd, NavigationStart, ActivatedRoute } from '@angular/router' +import { DomSanitizer } from '@angular/platform-browser' import { Location } from '@angular/common' import { ApisService } from '../services/apis.service' @@ -19,7 +20,8 @@ export class DetailComponent implements OnInit { private apisService: ApisService, private router: Router, private location: Location, - private activeRoute: ActivatedRoute + private activeRoute: ActivatedRoute, + private sanitizer: DomSanitizer ) { } ngOnInit(): void { @@ -33,7 +35,16 @@ export class DetailComponent implements OnInit { if(this.history[this.history.length - 1] != `/detail/${section}/${id}`) { this.history.push(`/detail/${section}/${id}`) } - this.details = response.item + + const detail = response.item + detail.videos = detail.videos ? JSON.parse(detail.videos) : [] + detail.videos.forEach((e) => { + e.code = e.url.split('/').pop() + e.embed = this.sanitizer.bypassSecurityTrustResourceUrl(`https://www.youtube.com/embed/${e.code}`) + }) + this.details = detail + console.log(response.item) + },(error) => { console.error('getPortfolio ERROR', error) }).catch((e) => {