Commit 02bed373 by Sweet Zhang

获取被分享者头像

parent 50061c98
......@@ -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() {
......
<button (click)="getWxUserInfo()">getWxUserInfo</button>
<div id="js_article" class="rich_media">
<div class="rich_media_inner">
<div id="page-content" class="rich_media_area_primary">
......
......@@ -65,8 +65,8 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
}
// 从后台获取到获取微信code的URL
getWxUserInfo() {
this.myService.getWxUserInfo().subscribe(res => {
getWxUserInfo(trackId) {
this.myService.getWxUserInfo(trackId).subscribe(res => {
if (res['success']) {
this.paymentForm = res['data'].paymentForm;
this.getOrPost(this.paymentForm.action, this.paymentForm.param, this.paymentForm.charset, this.paymentForm.actionType);
......@@ -137,6 +137,9 @@ export class ArticleDetailComponent implements OnInit, OnDestroy {
};
this.myService.articleTrackSave(param).subscribe(res => {
sessionStorage.setItem('articleTrackId', res['data']['id']);
if (this.lifeCommonService.getQueryString('state') != '1') {
this.getWxUserInfo(res['data']['id']);
}
})
}
......
......@@ -610,9 +610,9 @@ export class MyService {
/**
* 获取微信用户的详细信息
*/
getWxUserInfo() {
getWxUserInfo(trackId) {
const url = this.API + '/getWxUserInfo';
const cs = {};
const cs = {trackId:trackId};
return this.http.post(url, cs).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