Commit 5bf0dc95 by Sweet Zhang

文章分享

parent e30b0df5
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="shareCus" (click)="share()"> <div class="shareCus" (click)="share()" *ngIf="this.lifeCommonService.checkDeviceType() == 3">
<span>分享获客</span> <span>分享</span>
</div> </div>
<!--分享引导页--> <!--分享引导页-->
<div class="shareGuidePage" *ngIf="shareAbled" (click)="share()"> <div class="shareGuidePage" *ngIf="shareAbled" (click)="share()">
......
...@@ -27,9 +27,9 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -27,9 +27,9 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
sharePractitionerInfo: any; sharePractitionerInfo: any;
constructor(private myService: MyService, public lifeCommonService: LifeCommonService, public router: Router, public activatedRoute: ActivatedRoute) { constructor(private myService: MyService, public lifeCommonService: LifeCommonService, public router: Router, public activatedRoute: ActivatedRoute) {
this.subscription = lifeCommonService.shareStatus$.subscribe(status => { // this.subscription = lifeCommonService.shareStatus$.subscribe(status => {
this.shareAbled = !(status == '0'); // this.shareAbled = !(status == '0');
}); // });
} }
ngOnInit() { ngOnInit() {
...@@ -60,7 +60,8 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -60,7 +60,8 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
} }
ngOnDestroy() { ngOnDestroy() {
this.subscription.unsubscribe(); this.articleTrackSave();
sessionStorage.removeItem('articleTrackId');
} }
// 从后台获取到获取微信code的URL // 从后台获取到获取微信code的URL
...@@ -76,8 +77,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -76,8 +77,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
// 点击分享 // 点击分享
share() { share() {
this.shareAbled = !this.shareAbled; this.shareAbled = true;
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.agentInfo.agentName}的分享`, `${window.location.href}?shareCode=${this.shareCode}`, this.articleInfo.coverUrl);
this.articleShareCodeSave(); this.articleShareCodeSave();
setTimeout(() => { setTimeout(() => {
this.shareAbled = false; this.shareAbled = false;
...@@ -101,7 +101,6 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -101,7 +101,6 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
qrCodePath: this.sharePractitionerInfo.qrCodePath, qrCodePath: this.sharePractitionerInfo.qrCodePath,
mobileNo: this.sharePractitionerInfo.mobileNo mobileNo: this.sharePractitionerInfo.mobileNo
}; };
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.agentInfo.agentName}的分享`, `${window.location.href}`, this.articleInfo.coverUrl);
} }
...@@ -119,6 +118,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -119,6 +118,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
channel: 1, channel: 1,
url: window.location.href url: window.location.href
}; };
this.lifeCommonService.wxShare(this.articleInfo.title, `来自银盾经纪人${this.lifeCustomerInfo.practitionerBasicInfo.name ? this.lifeCustomerInfo.practitionerBasicInfo.name : this.sharePractitionerInfo.name}的分享`, `${window.location.origin}${window.location.pathname}?shareCode=${this.articleShareCodeSaveInfo.shareCode}`, this.articleInfo.coverUrl);
this.myService.articleShareCodeSave(this.articleShareCodeSaveInfo).subscribe(res => { this.myService.articleShareCodeSave(this.articleShareCodeSaveInfo).subscribe(res => {
// console.log(res); // console.log(res);
}); });
...@@ -128,7 +128,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -128,7 +128,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
// 有id就是出 没id就是进 // 有id就是出 没id就是进
articleTrackSave() { articleTrackSave() {
const param = { const param = {
id: null, id: sessionStorage.getItem('articleTrackId') ? sessionStorage.getItem('articleTrackId') : null,
shareCode: this.shareCode, shareCode: this.shareCode,
nickname: null, nickname: null,
gender: null, gender: null,
...@@ -136,7 +136,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -136,7 +136,7 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
deviceType: this.lifeCommonService.checkDeviceType() deviceType: this.lifeCommonService.checkDeviceType()
}; };
this.myService.articleTrackSave(param).subscribe(res => { this.myService.articleTrackSave(param).subscribe(res => {
console.log(res); sessionStorage.setItem('articleTrackId', res['data']['id']);
}) })
} }
......
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