Commit 02bed373 by Sweet Zhang

获取被分享者头像

parent 50061c98
...@@ -26,6 +26,21 @@ export class LifeCommonService { ...@@ -26,6 +26,21 @@ export class LifeCommonService {
} }
/** /**
* url中的参数
* @param name
* @returns {any}
*/
getQueryString(name) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = decodeURIComponent(window.location.search).substr(1).match(reg);
if (r != null) {
return r[2];
}
return null;
}
/**
* 检测操作系统 * 检测操作系统
*/ */
checkOs() { checkOs() {
......
<button (click)="getWxUserInfo()">getWxUserInfo</button>
<div id="js_article" class="rich_media"> <div id="js_article" class="rich_media">
<div class="rich_media_inner"> <div class="rich_media_inner">
<div id="page-content" class="rich_media_area_primary"> <div id="page-content" class="rich_media_area_primary">
......
...@@ -65,8 +65,8 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -65,8 +65,8 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
} }
// 从后台获取到获取微信code的URL // 从后台获取到获取微信code的URL
getWxUserInfo() { getWxUserInfo(trackId) {
this.myService.getWxUserInfo().subscribe(res => { this.myService.getWxUserInfo(trackId).subscribe(res => {
if (res['success']) { if (res['success']) {
this.paymentForm = res['data'].paymentForm; this.paymentForm = res['data'].paymentForm;
this.getOrPost(this.paymentForm.action, this.paymentForm.param, this.paymentForm.charset, this.paymentForm.actionType); this.getOrPost(this.paymentForm.action, this.paymentForm.param, this.paymentForm.charset, this.paymentForm.actionType);
...@@ -137,6 +137,9 @@ export class ArticleDetailComponent implements OnInit, OnDestroy { ...@@ -137,6 +137,9 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
}; };
this.myService.articleTrackSave(param).subscribe(res => { this.myService.articleTrackSave(param).subscribe(res => {
sessionStorage.setItem('articleTrackId', res['data']['id']); sessionStorage.setItem('articleTrackId', res['data']['id']);
if (this.lifeCommonService.getQueryString('state') != '1') {
this.getWxUserInfo(res['data']['id']);
}
}) })
} }
......
...@@ -610,9 +610,9 @@ export class MyService { ...@@ -610,9 +610,9 @@ export class MyService {
/** /**
* 获取微信用户的详细信息 * 获取微信用户的详细信息
*/ */
getWxUserInfo() { getWxUserInfo(trackId) {
const url = this.API + '/getWxUserInfo'; const url = this.API + '/getWxUserInfo';
const cs = {}; const cs = {trackId:trackId};
return this.http.post(url, cs).pipe((res)=>{ return this.http.post(url, cs).pipe((res)=>{
return 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