Commit 1465d881 authored by wangqinghua's avatar wangqinghua

主题教育

parent c917de7f
<!--主题教育-->
<div *ngIf="isEdu" class="signMask" (click)="closeEdu()">
<div class="mask-content-edu" >
<div class="mask-content-edu" (click)="stop($event)">
<ion-icon class="close" name="close"></ion-icon>
</div>
</div>
import { Component } from '@angular/core';
import {Component, EventEmitter, Output} from '@angular/core';
@Component({
selector: 'education',
templateUrl: 'education.html'
})
export class EducationComponent {
@Output() done = new EventEmitter();
isEdu:Boolean = true;
......@@ -18,6 +19,8 @@ export class EducationComponent {
stop(e) {
e.stopPropagation();
this.isEdu = false;
this.done.emit();
}
}
......@@ -36,7 +36,8 @@
<ng-container *ngIf="slidersItems.length > 0">
<div class="swiper-slide" *ngFor="let item of slidersItems;">
<img *ngIf="item.static" [src]="item.imgUrl" class="slide-image">
<img *ngIf="!item.static" [src]="picture+item.imgUrl" class="slide-image" [alt]="item.title">
<img *ngIf="!item.static" [src]="picture+item.imgUrl" class="slide-image"
[alt]="item.title">
</div>
</ng-container>
</div>
......@@ -100,7 +101,9 @@
</p>
<div class="item-news">
<ion-row class="news-item">
<ng-container *ngIf="item.imgUrl">
<!-- 标题图片 -->
<ng-container *ngIf="item.path">
<ng-container *ngIf="item.resourceType == 1">
<ion-col col-8 class="news-left">
<p class="news-title">{{item.title}}
<ion-icon *ngIf="new.topTime"
......@@ -119,10 +122,38 @@
</p>
</ion-col>
<ion-col col-4 class="news-right">
<img src="{{picture+item.imgUrl}}">
<img src="{{picture+item.path}}">
</ion-col>
</ng-container>
<ng-container *ngIf="!item.imgUrl">
<!-- 视频 -->
<ng-container *ngIf="item.resourceType == 3">
<ion-col col-12 class="news-left">
<p class="news-title">{{item.title}}
<ion-icon *ngIf="new.topTime"
class="icon-fire iconfont"></ion-icon>
</p>
<div (click)="clickVideo($event)">
<video width="100%" height="100%"
controls="controls" preload="metadata" muted="muted">
<source [src]="picture +item.path+ '#t=0.1' ">
您的浏览器不支持 html5。
</video>
</div>
<p class="news-end">
<ion-icon style="font-size: 2.5rem;vertical-align: sub"
name="eye"></ion-icon>
<span>{{item.browseCount}}</span>
<ion-icon name="chatboxes"></ion-icon>
<span>{{item.commentCount}}</span>
<ion-icon name="thumbs-up"></ion-icon>
<span>{{item.likeCount}}</span>
<ion-icon name="heart"></ion-icon>
<span>{{item.collectionCount}}</span>
</p>
</ion-col>
</ng-container>
</ng-container>
<ng-container *ngIf="!item.path">
<ion-col col-12 class="news-left">
<p class="news-title">{{item.title}}
<ion-icon *ngIf="new.topTime"
......@@ -191,4 +222,4 @@
</div>
</div>
<education></education>
<education (done)="goEdu()"></education>
......@@ -186,6 +186,7 @@ export class DiscoverPage {
plateType; //分类
relateTopicedu; //是否主题教育 1 是 0否
isManyPlate = null;
resourceType = 1; //1 标题图片 2 轮播图 3 视频
picture: string = AppGlobal.domain + '/wisdomgroup';
slidersItems = [];
......@@ -286,7 +287,7 @@ export class DiscoverPage {
click: function () {
const item = that.slidersItems[this.activeIndex];
if (item.static == "true") {
that.swiper.slideTo(0, 500);
that.swiper.slideTo(1, 500); //前往主题教育
return false;
}
if (item.plateType == 20) return false;
......@@ -298,6 +299,11 @@ export class DiscoverPage {
});
}
//前往主题教育
goEdu() {
this.swiper.slideTo(1, 500); //前往主题教育
}
//获取轮播图
getBanner() {
const data = {
......@@ -318,7 +324,7 @@ export class DiscoverPage {
}
this.slidersItems = res.data.list;
this.slidersItems.push(this.eduObj);
this.slideTitle = this.slidersItems[this.slidersItems.length -2].title;
this.slideTitle = this.slidersItems[this.slidersItems.length - 2].title;
}
)
}
......@@ -333,6 +339,7 @@ export class DiscoverPage {
this.childrenList = item.children;
this.relateTopicedu = item.indexParent == '2' ? 1 : 0;
this.resourceType = item.type == "16" ? 3 : 1;
if (this.childrenList.length > 0) this.indexChildren = this.childrenList[0].indexChildren;
let itemWidth = window.screen.width / 4;
let spanWidth = this.tabSpan.nativeElement.offsetWidth; //文字宽度
......@@ -345,7 +352,7 @@ export class DiscoverPage {
isRecent: 0,
obj: {
'plateType': this.plateType,
'resourceType': 1,
'resourceType': this.resourceType,
'relateTopicedu': this.relateTopicedu,
}
};
......@@ -354,10 +361,11 @@ export class DiscoverPage {
this.newList = res.data.list;
this.newList.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
e.path = e.attachments[0].path;
e.resourceType = e.attachments[0].resourceType;
}
});
console.log(this.indexParent);
console.log(this.newList);
this.swiper.slideTo(this.indexParent, 500);
this.slideList[this.indexParent] = this.newList;
}
......@@ -368,6 +376,7 @@ export class DiscoverPage {
changeChildren(item) {
this.indexChildren = item.indexChildren;
this.isManyPlate = this.indexChildren == 25 ? 1 : null;
this.resourceType = item.type == "16" ? 3 : 1;
if (this.indexChildren == 45) {
this.getQuestion();
return false;
......@@ -379,7 +388,7 @@ export class DiscoverPage {
isRecent: 0,
obj: {
'plateType': item.type,
'resourceType': 1,
'resourceType': this.resourceType,
'relateTopicedu': this.relateTopicedu,
'isManyPlate': this.isManyPlate
}
......@@ -389,7 +398,8 @@ export class DiscoverPage {
this.newList = res.data.list;
this.newList.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
e.path = e.attachments[0].path;
e.resourceType = e.attachments[0].resourceType;
}
});
this.slideList[this.indexParent] = this.newList;
......@@ -517,4 +527,12 @@ export class DiscoverPage {
issue() {
this.navCtrl.push('SelectTypePage', {type: 'issue'});
}
clickVideo(e){
const video = document.querySelectorAll("video");
video.forEach(e=>{
console.log(video);
})
console.log(e);
}
}
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