|
|
@ -281,7 +281,58 @@ class App extends Component {
|
|
|
|
mydisplay:true,
|
|
|
|
mydisplay:true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
initWXShare = () => {
|
|
|
|
|
|
|
|
if (window.wx) {
|
|
|
|
|
|
|
|
const wx = window.wx
|
|
|
|
|
|
|
|
const url = '/wechats/js_sdk_signature.json'
|
|
|
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
|
|
|
url: 'http://pre-newweb.educoder.net',
|
|
|
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
|
|
|
const data = response.data;
|
|
|
|
|
|
|
|
wx.config({
|
|
|
|
|
|
|
|
debug: false,
|
|
|
|
|
|
|
|
appId: data.appid,
|
|
|
|
|
|
|
|
timestamp: data.timestamp,
|
|
|
|
|
|
|
|
nonceStr: data.nonceStr,
|
|
|
|
|
|
|
|
signature: data.signature,
|
|
|
|
|
|
|
|
jsApiList: [
|
|
|
|
|
|
|
|
'onMenuShareTimeline',//
|
|
|
|
|
|
|
|
'onMenuShareAppMessage',
|
|
|
|
|
|
|
|
'onMenuShareQQ',
|
|
|
|
|
|
|
|
'onMenuShareWeibo',
|
|
|
|
|
|
|
|
'onMenuShareQZone'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
wx.ready(function () {
|
|
|
|
|
|
|
|
var shareData = {
|
|
|
|
|
|
|
|
title: '这是是分享标题',
|
|
|
|
|
|
|
|
desc: '这是是摘要',
|
|
|
|
|
|
|
|
link: 'http://pre-newweb.educoder.net',
|
|
|
|
|
|
|
|
imgUrl: 'http://pre-newweb.educoder.net/images/educoder/index/subject/subject15.jpg'
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wx.onMenuShareAppMessage(shareData);//分享给好友
|
|
|
|
|
|
|
|
wx.onMenuShareTimeline(shareData);//分享到朋友圈
|
|
|
|
|
|
|
|
wx.onMenuShareQQ(shareData);//分享给手机QQ
|
|
|
|
|
|
|
|
wx.onMenuShareWeibo(shareData);//分享腾讯微博
|
|
|
|
|
|
|
|
wx.onMenuShareQZone(shareData);//分享到QQ空间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
wx.error(function (res) {
|
|
|
|
|
|
|
|
//alert(res.errMsg);//错误提示
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// force an update if the URL changes
|
|
|
|
// force an update if the URL changes
|
|
|
|
history.listen(() => {
|
|
|
|
history.listen(() => {
|
|
|
|
this.forceUpdate()
|
|
|
|
this.forceUpdate()
|
|
|
@ -291,7 +342,7 @@ class App extends Component {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
initAxiosInterceptors(this.props)
|
|
|
|
initAxiosInterceptors(this.props)
|
|
|
|
|
|
|
|
this.initWXShare()
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// axios.interceptors.response.use((response) => {
|
|
|
|
// axios.interceptors.response.use((response) => {
|
|
|
|
// // console.log("response"+response);
|
|
|
|
// // console.log("response"+response);
|
|
|
|