Commit 4dd0cf5b by Sweet Zhang

保存用户轨迹

parent 1c98bb3c
......@@ -5,17 +5,17 @@
<div id="img-content" class="rich_media_wrp">
<button (click)="getWxUserInfo()">getWxUserInfo</button>
<h2 class="rich_media_title" id="activity-name">
{{articleInfo.title}}
{{articleInfo?.title}}
</h2>
<div id="meta_content" class="rich_media_meta_list">
<span class="rich_media_meta rich_media_meta_nickname" id="profileBt">
<a href="javascript:void(0);" id="js_name">银盾保险在线</a>
</span>
<em id="publish_time"
class="rich_media_meta rich_media_meta_text">{{(articleInfo.updatedAt).substr(0,10)}}</em>
class="rich_media_meta rich_media_meta_text">{{(articleInfo?.updatedAt).substr(0,10)}}</em>
</div>
<div class="rich_media_content " id="js_content" style="visibility: visible;">
<div [innerHTML]="articleInfo.fileContent | safeHtml">
<div [innerHTML]="articleInfo?.fileContent | safeHtml">
</div>
</div>
</div>
......@@ -23,7 +23,7 @@
</div>
</div>
<!--经纪人名片-->
<div class="agentInfoContainer">
<div class="agentInfoContainer" *ngIf="agentInfo">
<div style="display: flex">
<div class="portrait">
<img
......
......@@ -3,6 +3,8 @@ import {MyService} from '../../my/my.service';
import {LifeCommonService} from '../../common/life-common.service';
import {Subscription} from "rxjs/index";
import {OnDestroy} from "@angular/core";
import {ActivatedRoute, Router} from "@angular/router";
import * as uuid from 'uuid';
declare const wx: any;
@Component({
......@@ -19,15 +21,27 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
agentInfo: any;
shareAbled: boolean = false;
subscription: Subscription;
articleId: number;
shareCode: string;
articleShareCodeSaveInfo: any;
sharePractitionerInfo: any;
constructor(private myService: MyService, public lifeCommonService: LifeCommonService) {
constructor(private myService: MyService, public lifeCommonService: LifeCommonService, public router: Router, public activatedRoute: ActivatedRoute) {
this.subscription = lifeCommonService.shareStatus$.subscribe(status => {
this.shareAbled = !(status == '0');
});
}
ngOnInit() {
this.articleInfo = JSON.parse(sessionStorage.getItem('articleInfo'));
this.articleId = this.activatedRoute.snapshot.params['id'];
this.shareCode = this.activatedRoute.snapshot.queryParams['shareCode'] ? this.activatedRoute.snapshot.queryParams['shareCode'] : uuid.v4();
if (this.activatedRoute.snapshot.queryParams['shareCode']) {
this.practitionerFileSharingList(null, this.shareCode);
this.articleTrackSave();
} else {
this.practitionerFileSharingList(this.articleId, null);
}
this.lifeCustomerInfo = JSON.parse(localStorage.getItem('lifeCustomerInfo')) ? JSON.parse(localStorage.getItem('lifeCustomerInfo')) : null;
if (this.lifeCustomerInfo) {
this.customerId = JSON.parse(localStorage.getItem('lifeCustomerInfo'))['customerId']
......@@ -41,7 +55,6 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
qrCodePath: this.lifeCustomerInfo.practitionerBasicInfo.qrCodePath,
mobileNo: this.lifeCustomerInfo.mobileNo
};
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.agentInfo.agentName}的分享`, `${window.location.href}`, this.articleInfo.coverUrl);
if (this.lifeCommonService.checkDeviceType() == '3' && !this.customerId) {
this.getWxUserInfo();
}
......@@ -64,12 +77,64 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
// 点击分享
share() {
this.shareAbled = !this.shareAbled;
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.agentInfo.agentName}的分享`, `${window.location.href}`, this.articleInfo.coverUrl);
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.agentInfo.agentName}的分享`, `${window.location.href}?shareCode=${this.shareCode}`, this.articleInfo.coverUrl);
this.articleShareCodeSave();
setTimeout(() => {
this.shareAbled = false;
}, 6000);
}
// 通过文章ID或者分享码查询文章详情
practitionerFileSharingList(id, shareCode) {
this.myService.practitionerFileSharingList({
shareCode: shareCode,
id: id,
practitionerFileShares: {pageNum: 1, pageSize: 5}
}).subscribe(res => {
this.articleInfo = res['data'].practitionerFileShares.list['0'];
this.sharePractitionerInfo = res['data'].sharePractitionerInfo;
this.agentInfo = {
headImagePath: this.sharePractitionerInfo.headImagePath,
agentName: this.sharePractitionerInfo.name,
insurerBranchName: this.sharePractitionerInfo.insurerBranchName,
qrCodePath: this.sharePractitionerInfo.qrCodePath,
mobileNo: this.sharePractitionerInfo.mobileNo
};
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.agentInfo.agentName}的分享`, `${window.location.href}`, this.articleInfo.coverUrl);
});
}
// 保存文章code
articleShareCodeSave() {
this.articleShareCodeSaveInfo = {
itemId: this.articleId,
shareCode: this.shareCode,
practitionerId: this.lifeCustomerInfo.practitionerId ? this.lifeCustomerInfo.practitionerId : this.sharePractitionerInfo.practitionerId,
customerId: this.lifeCustomerInfo.customerId ? this.lifeCustomerInfo.customerId : this.sharePractitionerInfo.customerId,
os: this.lifeCommonService.checkOs(),
channel: 1,
url: window.location.href
};
this.myService.articleShareCodeSave(this.articleShareCodeSaveInfo).subscribe(res => {
// console.log(res);
});
}
// 保存客户痕迹:
// 有id就是出 没id就是进
articleTrackSave() {
const param = {
id: null,
shareCode: this.shareCode,
nickname: null,
gender: null,
imagePath: null,
deviceType: this.lifeCommonService.checkDeviceType()
};
this.myService.articleTrackSave(param).subscribe(res => {
console.log(res);
})
}
// 判断是get请求还是post请求进行支付请求
getOrPost(action, params, charset, actionType) {
......
<div class="salesWrapper">
<ul class="tab" >
<ul class="tab">
<li *ngFor="let titleItem of titleList" (click)="selectTab(titleItem.id)"
[ngClass]="{selected:mdDropOptionId===titleItem.id}">
[ngClass]="{selected:mdDropOptionId===titleItem.id}">
<div style="position: relative;">
<h3>{{titleItem.dropOptionName}}
</h3>
......@@ -14,6 +14,7 @@
<div class="left">
<div class="title">{{articleItem.title}}</div>
<div class="digest">{{lifeCommonService.getTwenty(articleItem.digest,46)}}</div>
<div class="updateAt" style="font-size: 12px;color:#8a8a8a;margin-top: 3px;">{{articleItem.updatedAt}}</div>
</div>
<div class="right">
<img [src]="articleItem.coverUrl">
......@@ -24,4 +25,4 @@
</div>
</ul>
</div>
</div>
\ No newline at end of file
</div>
......@@ -3,7 +3,7 @@ import { MyService } from '../../my/my.service';
import { LifeCommonService } from '../../common/life-common.service';
import { Router,ActivatedRoute } from '@angular/router';
import { parse } from 'querystring';
@Component({
selector: 'ydlife-article',
templateUrl: './article.component.html',
......@@ -15,7 +15,7 @@ export class ArticleComponent implements OnInit {
paginationInfo:any;
articleList:Array<any>;
totalPage:number;
constructor(private myService:MyService,public lifeCommonService:LifeCommonService,private router:Router) {
constructor(private myService:MyService,public lifeCommonService:LifeCommonService,private router:Router) {
this.paginationInfo = {
pageNum: 1,
pageSize: 5
......@@ -66,7 +66,7 @@ export class ArticleComponent implements OnInit {
}
})
}
lookMore(){
this.paginationInfo.pageNum ++;
this.practitionerFileSharingList('flag');
......@@ -74,8 +74,7 @@ export class ArticleComponent implements OnInit {
//设置缓存并跳转到文章详情
articleDetail(articleItem){
sessionStorage.setItem('articleInfo',JSON.stringify(articleItem));
this.router.navigate(['/articleDetail']);
this.router.navigate(['/articleDetail',articleItem.id]);
}
}
......@@ -108,7 +108,7 @@ const myRoutes: Routes = [
{ path: 'historical_rank', component: HistoricalRankComponent, canActivate: [AuthGuard] },
{ path: 'team_area',component:TeamAreaPanelComponent, canActivate: [AuthGuard]},
{ path: 'article', component:ArticleComponent},
{ path: 'articleDetail',component:ArticleDetailComponent}
{ path: 'articleDetail/:id',component:ArticleDetailComponent}
];
@NgModule({
......
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