Merge pull request '微信分享' (#680) from Eeeros/forgeplus-react:gitlink_server into gitlink_server
1
This commit is contained in:
commit
3eea0cb4a1
|
|
@ -16,7 +16,7 @@ const TerserWebpackPlugin = require('terser-webpack-plugin');
|
|||
const paths = require("./paths");
|
||||
const getClientEnvironment = require("./env");
|
||||
|
||||
let publicPath = "/react/build/";
|
||||
let publicPath = "/build/";
|
||||
const publicUrl = publicPath.slice(0, -1);
|
||||
// const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";
|
||||
const shouldUseSourceMap = process.env.NODE_ENV !== "production";
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@
|
|||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"proxy": "http://172.20.32.202:4000",
|
||||
"proxy": "https://testforgeplus.trustie.net",
|
||||
"port": "3007",
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "7.0.0-beta.51",
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
|
|
@ -50,6 +50,7 @@
|
|||
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
|
||||
<script src="%PUBLIC_URL%js/alex/moment.js"></script>
|
||||
<script src="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.19/bundle/alex.all.global.min.js"></script>
|
||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<meta name="viewport" content="">
|
||||
<%= htmlWebpackPlugin.tags.bodyTags %>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -20,11 +20,12 @@ import SiderBar from './forge/Component/SiderBar';
|
|||
import SiderBarHelp from './glcc/siderBarHelp';
|
||||
// import GlccModal from './modules/glccModal';
|
||||
|
||||
import { SnackbarHOC } from 'educoder';
|
||||
import { SnackbarHOC, configShareForCustom } from 'educoder';
|
||||
import { initAxiosInterceptors } from './AppConfig'
|
||||
import { Provider } from 'react-redux';
|
||||
import configureStore from './redux/stores/configureStore';
|
||||
import cookie from 'react-cookies';
|
||||
|
||||
|
||||
const store = configureStore();
|
||||
window.marked = marked;
|
||||
|
|
@ -302,6 +303,9 @@ class App extends Component {
|
|||
this.setState({
|
||||
mygetHelmetapi: response.data.setting
|
||||
});
|
||||
|
||||
configShareForCustom(response.data.name)
|
||||
|
||||
//存储配置到游览器
|
||||
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
||||
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
||||
|
|
|
|||
|
|
@ -1,13 +1,20 @@
|
|||
import axios from 'axios'
|
||||
const host = window.location.protocol + '//' + window.location.host
|
||||
const wx = window.wx
|
||||
const appId = 'wxf8debe756b4a0309'
|
||||
|
||||
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
|
||||
let actionUrl = settings && settings.common.zone +'/api';
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: actionUrl,
|
||||
timeout: 1800000, // 请求超时时间
|
||||
});
|
||||
|
||||
function share(shareData) {
|
||||
try {
|
||||
wx.onMenuShareAppMessage(shareData);//分享给好友
|
||||
wx.onMenuShareTimeline(shareData);//分享到朋友圈
|
||||
wx.onMenuShareQQ(shareData);//分享给手机QQ
|
||||
wx.onMenuShareWeibo(shareData);//分享腾讯微博
|
||||
wx.onMenuShareQZone(shareData);//分享到QQ空间
|
||||
wx.updateAppMessageShareData(shareData);//分享给好友
|
||||
wx.updateTimelineShareData(shareData);//分享到朋友圈
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
|
@ -21,26 +28,24 @@ function requestForSignatrue (callback) {
|
|||
callback && callback()
|
||||
} else {
|
||||
const wx = window.wx
|
||||
const url = '/wechats/js_sdk_signature.json'
|
||||
const url = '/cms/doc/open/wechatSignature'
|
||||
urlDoneMap[currentUrl] = true
|
||||
// window.encodeURIComponent()
|
||||
axios.post(url, {
|
||||
url: window.__testUrl || currentUrl,
|
||||
service.post(url, {
|
||||
url: currentUrl,
|
||||
}).then((response) => {
|
||||
console.log('got res')
|
||||
const data = response.data;
|
||||
const data = response.data && response.data.data;
|
||||
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: data.appid,
|
||||
appId: appId, // data.appid,
|
||||
timestamp: data.timestamp,
|
||||
nonceStr: data.noncestr,
|
||||
signature: data.signature,
|
||||
jsApiList: [
|
||||
'onMenuShareTimeline',//
|
||||
'onMenuShareAppMessage',
|
||||
'onMenuShareQQ',
|
||||
'onMenuShareWeibo',
|
||||
'onMenuShareQZone'
|
||||
'updateAppMessageShareData',//
|
||||
'updateTimelineShareData',
|
||||
]
|
||||
});
|
||||
wx.ready(function () {
|
||||
|
|
@ -125,11 +130,10 @@ export function configShareForCustom (title, desc, imgUrl, path) {
|
|||
console.log('configShareForCustom', host)
|
||||
const _url = window.location.href.split('#')[0];
|
||||
var shareData = {
|
||||
title: title,
|
||||
desc: desc,
|
||||
title: title || 'GitLink | 确实开源',
|
||||
desc: desc || 'GitLink,新一代开源创新服务平台',
|
||||
link: path ? `${host}/${path}` : _url,
|
||||
imgUrl: imgUrl || window.__testImageUrl
|
||||
|| host + '/react/build/images/share_logo_icon.jpg'
|
||||
imgUrl: imgUrl || host + '/build/images/share_logo_icon.png'
|
||||
};
|
||||
share(shareData)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { getNewsDetail } from '../api';
|
|||
import { isPhone } from 'educoder';
|
||||
import { tempConfig } from '../tempInfo';
|
||||
import Acce from '../Component/mobile/accessory';
|
||||
import { addMeta, setSeoMeta } from 'educoder';
|
||||
import { addMeta, setSeoMeta, configShareForCustom } from 'educoder';
|
||||
import CommentList from '../Component/comments/list'
|
||||
|
||||
|
||||
|
|
@ -28,6 +28,9 @@ function NewsDetail(props){
|
|||
const { name, cmsDir, summary} = detail;
|
||||
document.title = `${ name }/${ cmsDir.name }`;
|
||||
addMeta('Keywords', `${ name },${ cmsDir.name },${ summary }`);
|
||||
setTimeout(() => {
|
||||
configShareForCustom(detail.name, detail.summary, detail.headImg)
|
||||
}, 1000);
|
||||
}
|
||||
if(isPhone() && zonedetail){
|
||||
setTimeout(()=>{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import "slick-carousel/slick/slick-theme.css";
|
|||
import { tempEnum } from "./tempInfo";
|
||||
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
||||
import { setSeoMeta } from 'educoder';
|
||||
import { configShareForCustom } from 'educoder';
|
||||
|
||||
|
||||
const SourceDetail = Loadable({
|
||||
|
|
@ -142,6 +143,7 @@ function Index(props){
|
|||
getAdminUrl(data.id);
|
||||
getRole(data.id)
|
||||
}
|
||||
configShareForCustom(data.mainTitle, data.subTitle, data.introductionImage)
|
||||
// 存储deptId,所有专区接口header带上
|
||||
sessionStorage.setItem('deptId', data.deptId)
|
||||
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)
|
||||
|
|
|
|||
Loading…
Reference in New Issue