forked from Gitlink/forgeplus-react
merge
This commit is contained in:
commit
faf3b61b5a
|
@ -17,6 +17,13 @@ const paths = require("./paths");
|
||||||
const publicPath = "/";
|
const publicPath = "/";
|
||||||
const env = getClientEnvironment("/","development");
|
const env = getClientEnvironment("/","development");
|
||||||
|
|
||||||
|
const process = require('process');
|
||||||
|
|
||||||
|
process.on('uncaughtException', function (err) {
|
||||||
|
// 开发时,websocket proxy 会因服务重新部署而报错中断本地 server,这里拦截一下
|
||||||
|
console.log('拦截未处理异常:', err);
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
splitChunks: {
|
splitChunks: {
|
||||||
|
@ -273,12 +280,11 @@ module.exports = {
|
||||||
reactPath:'react.production.min.js',
|
reactPath:'react.production.min.js',
|
||||||
}),
|
}),
|
||||||
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
|
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
|
||||||
|
|
||||||
// Add module names to factory functions so they appear in browser profiler.
|
// Add module names to factory functions so they appear in browser profiler.
|
||||||
new webpack.NamedModulesPlugin(),
|
new webpack.NamedModulesPlugin(),
|
||||||
// Makes some environment variables available to the JS code, for example:
|
// Makes some environment variables available to the JS code, for example:
|
||||||
// if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
|
// if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
|
||||||
new webpack.DefinePlugin(env.stringified),
|
new webpack.DefinePlugin({ ...env.stringified, __SERVER__: 'false',__CLIENT__: 'true' }),
|
||||||
// This is necessary to emit hot updates (currently CSS only):
|
// This is necessary to emit hot updates (currently CSS only):
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
// Watcher doesn't work well if you mistype casing in a path so we use
|
// Watcher doesn't work well if you mistype casing in a path so we use
|
||||||
|
|
|
@ -294,6 +294,7 @@ module.exports = {
|
||||||
minifyURLs: true,
|
minifyURLs: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
new webpack.DefinePlugin({ ...env.stringified, __SERVER__: 'false',__CLIENT__: 'true' }),
|
||||||
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
|
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
|
||||||
// Makes some environment variables available to the JS code, for example:
|
// Makes some environment variables available to the JS code, for example:
|
||||||
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
||||||
|
|
|
@ -178,7 +178,7 @@
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "react-app"
|
"extends": "react-app"
|
||||||
},
|
},
|
||||||
"proxy": "http://172.20.32.202:4000",
|
"proxy": "https://testforgeplus.trustie.net",
|
||||||
"port": "3007",
|
"port": "3007",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/runtime": "7.0.0-beta.51",
|
"@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/codemirror/merge/merge.js"></script>
|
||||||
<script src="%PUBLIC_URL%js/alex/moment.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://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="">
|
<meta name="viewport" content="">
|
||||||
<%= htmlWebpackPlugin.tags.bodyTags %>
|
<%= htmlWebpackPlugin.tags.bodyTags %>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -20,11 +20,12 @@ import SiderBar from './forge/Component/SiderBar';
|
||||||
import SiderBarHelp from './glcc/siderBarHelp';
|
import SiderBarHelp from './glcc/siderBarHelp';
|
||||||
// import GlccModal from './modules/glccModal';
|
// import GlccModal from './modules/glccModal';
|
||||||
|
|
||||||
import { SnackbarHOC } from 'educoder';
|
import { SnackbarHOC, configShareForCustom } from 'educoder';
|
||||||
import { initAxiosInterceptors } from './AppConfig'
|
import { initAxiosInterceptors } from './AppConfig'
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import configureStore from './redux/stores/configureStore';
|
import configureStore from './redux/stores/configureStore';
|
||||||
import cookie from 'react-cookies';
|
import cookie from 'react-cookies';
|
||||||
|
|
||||||
|
|
||||||
const store = configureStore();
|
const store = configureStore();
|
||||||
window.marked = marked;
|
window.marked = marked;
|
||||||
|
@ -302,6 +303,9 @@ class App extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
mygetHelmetapi: response.data.setting
|
mygetHelmetapi: response.data.setting
|
||||||
});
|
});
|
||||||
|
|
||||||
|
configShareForCustom(response.data.name)
|
||||||
|
|
||||||
//存储配置到游览器
|
//存储配置到游览器
|
||||||
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
|
||||||
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import md5 from 'md5';
|
import md5 from 'md5';
|
||||||
import {Input} from "antd";
|
import {Input} from "antd";
|
||||||
|
import { url as ssrOrigin, host as ssrHost } from '../ssrUrl'
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
const $ = window.$;
|
const $ = window.$;
|
||||||
|
@ -198,7 +199,7 @@ function railsgettimess(proxy) {
|
||||||
}
|
}
|
||||||
}})
|
}})
|
||||||
|
|
||||||
window.setTimeout(function () {
|
setTimeout(function () {
|
||||||
checkSubmitFlgs=false;
|
checkSubmitFlgs=false;
|
||||||
}, 2500);
|
}, 2500);
|
||||||
}
|
}
|
||||||
|
@ -345,15 +346,15 @@ export function addMeta(name, content){
|
||||||
*/
|
*/
|
||||||
export function setSeoMeta(keyWords, title, description, url, owner, projectId) {
|
export function setSeoMeta(keyWords, title, description, url, owner, projectId) {
|
||||||
// 服务端没有location
|
// 服务端没有location
|
||||||
const host = window.location.host
|
const host = window.location.host === 'null' || !window.location.host ? ssrHost : window.location.host
|
||||||
const origin = window.location.origin
|
const origin = window.location.origin === 'null' || !window.location.origin ? ssrOrigin : window.location.origin
|
||||||
document.querySelector(`meta[property='og:title']`).content = title + ' | GitLink';
|
document.querySelector(`meta[property='og:title']`).content = title;
|
||||||
document.querySelector(`title`).textContent = title + ' | GitLink';
|
document.querySelector(`title`).textContent = title;
|
||||||
document.querySelector(`meta[property='og:url']`).content = origin + url;
|
document.querySelector(`meta[property='og:url']`).content = origin + url;
|
||||||
document.querySelector(`meta[property='og:description']`).content = description + ' | GitLink';
|
document.querySelector(`meta[property='og:description']`).content = description;
|
||||||
document.querySelector(`meta[property='og:image:alt']`).content = description + ' | GitLink';
|
document.querySelector(`meta[property='og:image:alt']`).content = description;
|
||||||
document.querySelector('meta[name="Keywords"]').content= `${ keyWords },${ keyWords ? '' : 'GitLink, git, 开源, 代码托管, 项目管理, 版本控制, 代码分享, 项目协作, 协同开发平台' }` ;
|
document.querySelector('meta[name="Keywords"]').content= `${ keyWords }${ keyWords ? '' : 'GitLink, git, 开源, 代码托管, 项目管理, 版本控制, 代码分享, 项目协作, 协同开发平台' }` ;
|
||||||
document.querySelector(`meta[name='description']`).content = description + ' | GitLink';
|
document.querySelector(`meta[name='description']`).content = description;
|
||||||
document.querySelector(`meta[name='go-import']`).content = host + url + ' git ' + origin + url;
|
document.querySelector(`meta[name='go-import']`).content = host + url + ' git ' + origin + url;
|
||||||
document.querySelector(`meta[name='octolytics-dimension-user_login']`).content = owner;
|
document.querySelector(`meta[name='octolytics-dimension-user_login']`).content = owner;
|
||||||
if (projectId) {
|
if (projectId) {
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
const host = window.location.protocol + '//' + window.location.host
|
const host = window.location.protocol + '//' + window.location.host
|
||||||
const wx = window.wx
|
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) {
|
function share(shareData) {
|
||||||
try {
|
try {
|
||||||
wx.onMenuShareAppMessage(shareData);//分享给好友
|
wx.updateAppMessageShareData(shareData);//分享给好友
|
||||||
wx.onMenuShareTimeline(shareData);//分享到朋友圈
|
wx.updateTimelineShareData(shareData);//分享到朋友圈
|
||||||
wx.onMenuShareQQ(shareData);//分享给手机QQ
|
|
||||||
wx.onMenuShareWeibo(shareData);//分享腾讯微博
|
|
||||||
wx.onMenuShareQZone(shareData);//分享到QQ空间
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
@ -21,26 +28,24 @@ function requestForSignatrue (callback) {
|
||||||
callback && callback()
|
callback && callback()
|
||||||
} else {
|
} else {
|
||||||
const wx = window.wx
|
const wx = window.wx
|
||||||
const url = '/wechats/js_sdk_signature.json'
|
const url = '/cms/doc/open/wechatSignature'
|
||||||
urlDoneMap[currentUrl] = true
|
urlDoneMap[currentUrl] = true
|
||||||
// window.encodeURIComponent()
|
// window.encodeURIComponent()
|
||||||
axios.post(url, {
|
service.post(url, {
|
||||||
url: window.__testUrl || currentUrl,
|
url: currentUrl,
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
console.log('got res')
|
console.log('got res')
|
||||||
const data = response.data;
|
const data = response.data && response.data.data;
|
||||||
|
|
||||||
wx.config({
|
wx.config({
|
||||||
debug: false,
|
debug: false,
|
||||||
appId: data.appid,
|
appId: appId, // data.appid,
|
||||||
timestamp: data.timestamp,
|
timestamp: data.timestamp,
|
||||||
nonceStr: data.noncestr,
|
nonceStr: data.noncestr,
|
||||||
signature: data.signature,
|
signature: data.signature,
|
||||||
jsApiList: [
|
jsApiList: [
|
||||||
'onMenuShareTimeline',//
|
'updateAppMessageShareData',//
|
||||||
'onMenuShareAppMessage',
|
'updateTimelineShareData',
|
||||||
'onMenuShareQQ',
|
|
||||||
'onMenuShareWeibo',
|
|
||||||
'onMenuShareQZone'
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
wx.ready(function () {
|
wx.ready(function () {
|
||||||
|
@ -125,11 +130,10 @@ export function configShareForCustom (title, desc, imgUrl, path) {
|
||||||
console.log('configShareForCustom', host)
|
console.log('configShareForCustom', host)
|
||||||
const _url = window.location.href.split('#')[0];
|
const _url = window.location.href.split('#')[0];
|
||||||
var shareData = {
|
var shareData = {
|
||||||
title: title,
|
title: title || 'GitLink | 确实开源',
|
||||||
desc: desc,
|
desc: desc || 'GitLink,新一代开源创新服务平台',
|
||||||
link: path ? `${host}/${path}` : _url,
|
link: path ? `${host}/${path}` : _url,
|
||||||
imgUrl: imgUrl || window.__testImageUrl
|
imgUrl: imgUrl || host + '/build/images/share_logo_icon.png'
|
||||||
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
||||||
};
|
};
|
||||||
share(shareData)
|
share(shareData)
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,7 +29,7 @@ function Badge(props) {
|
||||||
} else {
|
} else {
|
||||||
setProjectDetail(result.data);
|
setProjectDetail(result.data);
|
||||||
// seo优化设置
|
// seo优化设置
|
||||||
let keyWords = `${owner},${projectsId},${result.data.author.name},`;
|
let keyWords = `${owner},${projectsId},${result.data.author.name}`;
|
||||||
let title = `${owner}/${projectsId}${result.data.description ? ':' + result.data.description : ''}`;
|
let title = `${owner}/${projectsId}${result.data.description ? ':' + result.data.description : ''}`;
|
||||||
setSeoMeta(keyWords, title, result.data.description, `/${owner}/${projectsId}`, owner, projectsId);
|
setSeoMeta(keyWords, title, result.data.description, `/${owner}/${projectsId}`, owner, projectsId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React , { useEffect } from 'react';
|
import React , { useEffect } from 'react';
|
||||||
import Slider from 'react-slick';
|
// import Slider from 'react-slick';
|
||||||
import { httpUrl } from '../fetch';
|
import { httpUrl } from '../fetch';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
|
@ -116,7 +116,7 @@ function HeaderPageCCF(props) {
|
||||||
{
|
{
|
||||||
// 新闻动态
|
// 新闻动态
|
||||||
data && data.cmsShow === 1 && newsList && newsList.length >= 0 &&
|
data && data.cmsShow === 1 && newsList && newsList.length >= 0 &&
|
||||||
<div className="zone_news">
|
<div className="zone_news zone_news_ccf">
|
||||||
<p className="in_title mb50">{data.homepageCmsTitle}</p>
|
<p className="in_title mb50">{data.homepageCmsTitle}</p>
|
||||||
<div className="boxmain mb100" style={{ display: "flex" }}>
|
<div className="boxmain mb100" style={{ display: "flex" }}>
|
||||||
<div className="zone_new_first">
|
<div className="zone_new_first">
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { getNewsDetail } from '../api';
|
||||||
import { isPhone } from 'educoder';
|
import { isPhone } from 'educoder';
|
||||||
import { tempConfig } from '../tempInfo';
|
import { tempConfig } from '../tempInfo';
|
||||||
import Acce from '../Component/mobile/accessory';
|
import Acce from '../Component/mobile/accessory';
|
||||||
import { addMeta, setSeoMeta } from 'educoder';
|
import { addMeta, setSeoMeta, configShareForCustom } from 'educoder';
|
||||||
import CommentList from '../Component/comments/list'
|
import CommentList from '../Component/comments/list'
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,9 +25,12 @@ function NewsDetail(props){
|
||||||
let initialContent = undefined;
|
let initialContent = undefined;
|
||||||
// 设置网页标题
|
// 设置网页标题
|
||||||
if(detail){
|
if(detail){
|
||||||
const { name, cmsDir, summary} = detail;
|
const { name, cmsDir} = detail;
|
||||||
document.title = `${ name }/${ cmsDir.name }`;
|
document.title = `${ name }/${ cmsDir.name }`;
|
||||||
addMeta('Keywords', `${ name },${ cmsDir.name },${ summary }`);
|
setMeta()
|
||||||
|
setTimeout(() => {
|
||||||
|
configShareForCustom(detail.name, detail.summary, detail.headImg)
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
if(isPhone() && zonedetail){
|
if(isPhone() && zonedetail){
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
@ -43,8 +46,7 @@ function NewsDetail(props){
|
||||||
document.querySelector('meta[name="viewport"]').setAttribute('content', initialContent);
|
document.querySelector('meta[name="viewport"]').setAttribute('content', initialContent);
|
||||||
}
|
}
|
||||||
if (zonedetail) {
|
if (zonedetail) {
|
||||||
document.title= zonedetail.mainTitle;
|
setMeta(true)
|
||||||
setSeoMeta(`${zonedetail.name},`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},[zonedetail,detail])
|
},[zonedetail,detail])
|
||||||
|
@ -56,6 +58,19 @@ function NewsDetail(props){
|
||||||
}
|
}
|
||||||
},[id])
|
},[id])
|
||||||
|
|
||||||
|
function setMeta(unmount = false) {
|
||||||
|
if (unmount) {
|
||||||
|
document.title= zonedetail.name;
|
||||||
|
setSeoMeta(`${zonedetail.name}`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
|
||||||
|
} else {
|
||||||
|
const { name, cmsDir, summary, id} = detail;
|
||||||
|
const title = `${ name }/${ cmsDir.name }`;
|
||||||
|
const keywords = `${ name },${ cmsDir.name },${ zonedetail.name }`;
|
||||||
|
document.title = title;
|
||||||
|
setSeoMeta(keywords, title, summary, `/zone/${deptId}/newdetail/${ id }`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getDetails(){
|
function getDetails(){
|
||||||
setIsSpin(true)
|
setIsSpin(true)
|
||||||
getNewsDetail(id).then(result=>{
|
getNewsDetail(id).then(result=>{
|
||||||
|
|
|
@ -17,6 +17,7 @@ import "slick-carousel/slick/slick-theme.css";
|
||||||
import { tempEnum } from "./tempInfo";
|
import { tempEnum } from "./tempInfo";
|
||||||
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
||||||
import { setSeoMeta } from 'educoder';
|
import { setSeoMeta } from 'educoder';
|
||||||
|
import { configShareForCustom } from 'educoder';
|
||||||
|
|
||||||
|
|
||||||
const SourceDetail = Loadable({
|
const SourceDetail = Loadable({
|
||||||
|
@ -142,6 +143,7 @@ function Index(props){
|
||||||
getAdminUrl(data.id);
|
getAdminUrl(data.id);
|
||||||
getRole(data.id)
|
getRole(data.id)
|
||||||
}
|
}
|
||||||
|
configShareForCustom(data.mainTitle, data.subTitle, data.introductionImage)
|
||||||
// 存储deptId,所有专区接口header带上
|
// 存储deptId,所有专区接口header带上
|
||||||
sessionStorage.setItem('deptId', data.deptId)
|
sessionStorage.setItem('deptId', data.deptId)
|
||||||
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)
|
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@import './theme.scss';
|
@import './theme.scss';
|
||||||
|
|
||||||
.zone_news {
|
.zone_news_ccf {
|
||||||
margin-top: -10px !important;
|
margin-top: -10px !important;
|
||||||
|
|
||||||
.zone_new_first {
|
.zone_new_first {
|
||||||
|
|
|
@ -161,7 +161,7 @@ class Infos extends Component {
|
||||||
const { pathname } = this.props.location;
|
const { pathname } = this.props.location;
|
||||||
this.renderPath(pathname,result.data);
|
this.renderPath(pathname,result.data);
|
||||||
document.title = result.data.username ? result.data.username : username;
|
document.title = result.data.username ? result.data.username : username;
|
||||||
let keyWords=`${result.data.username},${username},`;
|
let keyWords=`${result.data.username},${username}`;
|
||||||
let title= result.data.username+'('+ username +')';
|
let title= result.data.username+'('+ username +')';
|
||||||
setSeoMeta(keyWords,title,title,`/${username}`,username);
|
setSeoMeta(keyWords,title,title,`/${username}`,username);
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export const url = process.env.NODE_ENV === 'production' ? 'https://www.gitlink.org.cn' : 'https://testforgeplus.trustie.net'
|
||||||
|
export const zoneUrl = process.env.NODE_ENV === 'production' ? 'https://gateway.gitlink.org.cn' : 'https://testgetway.trustie.net'
|
||||||
|
export const host = process.env.NODE_ENV === 'production' ? 'www.gitlink.org.cn' : 'testforgeplus.trustie.net'
|
||||||
|
|
||||||
|
// export const url = process.env.NODE_ENV === 'production' ? 'https://www.gitlink.org.cn' : ''
|
||||||
|
// export const zoneUrl = process.env.NODE_ENV === 'production' ? 'https://gateway.gitlink.org.cn' : ''
|
||||||
|
// export const host = process.env.NODE_ENV === 'production' ? 'www.gitlink.org.cn' : ''
|
Loading…
Reference in New Issue