Commit e6f02939 by sunchao

跟踪用户信息

parent c7af2c1c
......@@ -548,4 +548,18 @@ export class LifeCommonService {
}
return str;
}
//判断是否为空
isEmpty(date) {
if (
date == null ||
date == undefined ||
date == "" ||
date == "null" ||
date == []
) {
return "暂无";
}
return date;
}
}
......@@ -5,14 +5,14 @@
<li>性别</li>
<li>阅读时间</li>
</ul>
<ul>
<ul *ngFor="let readerItem of readerList">
<li>
<div class="headimg">
<img src="/assets/images/icons/meng.png" alt="头像">
<img src="{{getDefaultHead(readerItem.imagePath)}}" alt="头像">
</div>
</li>
<li>曲终人未散</li>
<li></li>
<li>2021-05-08 11:41</li>
<li>{{lifeCommonService.isEmpty(readerItem.nickName)}}</li>
<li>{{getGender(readerItem.gender)}}</li>
<li>{{readerItem.trackInTime.substr(0,16)}}</li>
</ul>
</div>
\ No newline at end of file
......@@ -3,6 +3,7 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
li{
height: 45px;
line-height: 45px;
......@@ -16,13 +17,19 @@
margin: 0 auto;
overflow: hidden;
border-radius: 50%;
img{
border-radius: 50%;
}
}
}
li:nth-child(1){
width: 18%;
}
li:nth-child(3){
width: 10%;
}
li:nth-child(4){
width: 30%;
width: 35%;
}
}
}
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { MyService } from '../../my/my.service';
import { ActivatedRoute, Router } from "@angular/router";
import { LifeCommonService } from '../../common/life-common.service';
@Component({
selector: 'ydlife-article-read',
......@@ -6,10 +9,43 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./article-read.component.scss']
})
export class ArticleReadComponent implements OnInit {
constructor() { }
articleId:any;
practitionerId:any;
readerList:Array<any>;
constructor( public activatedRoute: ActivatedRoute,
private myService: MyService,
public lifeCommonService: LifeCommonService,
private router: Router) { }
ngOnInit() {
this.articleId = this.activatedRoute.snapshot.params['id'];
this.practitionerId = JSON.parse(localStorage.getItem('lifeCustomerInfo'))['practitionerId'];
this.articleTrackQuery();
}
articleTrackQuery(){
this.myService.articleTrackQuery(this.practitionerId,this.articleId).subscribe((res)=>{
if(res['success']){
this.readerList = res['data']['articleTrackQueryInfos'];
}
})
}
//获取默认头像
getDefaultHead(headImagePath){
if(!headImagePath){
return 'assets/images/icons/meng.png';
}else{
return headImagePath;
}
}
//判断性别
getGender(sex){
if(!sex){
return '暂无'
}else{
return sex==1?'男':'女'
}
}
}
......@@ -19,9 +19,13 @@
<div class="right" (click)="articleDetail(articleItem)">
<img [src]="articleItem.coverUrl">
</div>
<div class="read" (click)="whoRead(articleItem)">
<span>72人已阅读</span>
<span class="iconfont icon-ar-r"></span></div>
<div class="read">
<span>总阅读量:{{articleItem.totalNum}}</span>
<div (click)="whoRead(articleItem)">
<span>个人分享阅读量:{{articleItem.num}}</span>
<span class="iconfont icon-ar-r"></span>
</div>
</div>
</li>
<div class="more" *ngIf="paginationInfo?.pageNum<totalPage" (click)="lookMore()">
查看更多
......
......@@ -37,12 +37,14 @@
flex-wrap: wrap;
.right{
width: 40%;
margin-bottom: 10px;
img{
border-radius: 8px;
}
}
.left{
width: 55%;
margin-bottom: 10px;
.title{
color: #333333;
font-size: 16px;
......@@ -58,6 +60,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
width: 100%;
}
}
li:last-child{
......
......@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { MyService } from '../../my/my.service';
import { LifeCommonService } from '../../common/life-common.service';
import { Router,ActivatedRoute } from '@angular/router';
import { parse } from 'querystring';
import { ModalService, ToastService } from 'ng-zorro-antd-mobile';
@Component({
selector: 'ydlife-article',
......@@ -15,7 +15,12 @@ export class ArticleComponent implements OnInit {
paginationInfo:any;
articleList:Array<any>;
totalPage:number;
constructor(private myService:MyService,public lifeCommonService:LifeCommonService,private router:Router) {
practitionerId:any;
constructor(private myService:MyService,
public lifeCommonService:LifeCommonService,
private router:Router,
private _modal: ModalService,
private _toast: ToastService) {
this.paginationInfo = {
pageNum: 1,
pageSize: 5
......@@ -23,6 +28,7 @@ export class ArticleComponent implements OnInit {
}
ngOnInit() {
this.practitionerId = JSON.parse(localStorage.getItem('lifeCustomerInfo'))['practitionerId'];
this.dropOptionsQuery();
}
......@@ -50,7 +56,8 @@ export class ArticleComponent implements OnInit {
practitionerFileSharingList(flag){
const param = {
mdDropOptionId:this.mdDropOptionId,
practitionerFileShares:this.paginationInfo
practitionerFileShares:this.paginationInfo,
practitionerId:this.practitionerId
}
this.myService.practitionerFileSharingList(param).subscribe((res)=>{
if(res['success']){
......@@ -78,6 +85,14 @@ export class ArticleComponent implements OnInit {
}
whoRead(articleItem){
this.router.navigate(['/article_read',articleItem.id])
if(articleItem.num > 0){
this.router.navigate(['/article_read',articleItem.id])
}else{
const toast = ToastService.show('暂时无人阅读您分享的文章!', 0);
setTimeout(() => {
ToastService.hide();
}, 3000);
return;
}
}
}
......@@ -633,4 +633,12 @@ export class MyService {
return res;
});
}
//用户信息跟踪
articleTrackQuery(practitionerId,sharingId){
const url = this.ydapi + '/practitionerArticle/articleTrackQuery?practitionerId=' + practitionerId + '&sharingId=' + sharingId;
return this.http.get(url).pipe((res)=>{
return res;
});
}
}
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