Commit 1465d881 authored by wangqinghua's avatar wangqinghua

主题教育

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