forked from Gitlink/forgeplus-react
Merge remote-tracking branch 'upstream/develop' into dev-search
This commit is contained in:
commit
695d5e4f50
|
@ -5068,11 +5068,11 @@
|
|||
}
|
||||
},
|
||||
"echarts": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-4.7.0.tgz",
|
||||
"integrity": "sha512-NlOTdUcAsIyCCG+N4uh0ZEvXtrPW2jvcuqf03RyqYeCKzyPbiOQ4I3MdKXMhxG3lBdqQNdNXVT71SB4KTQjN0A==",
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.nlark.com/echarts/download/echarts-4.9.0.tgz",
|
||||
"integrity": "sha1-qbm6oD8Doqcx5jQMVb77V6nhNH0=",
|
||||
"requires": {
|
||||
"zrender": "4.3.0"
|
||||
"zrender": "4.3.2"
|
||||
}
|
||||
},
|
||||
"editor.md": {
|
||||
|
@ -9898,6 +9898,11 @@
|
|||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"js2wordcloud": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npm.taobao.org/js2wordcloud/download/js2wordcloud-1.1.12.tgz",
|
||||
"integrity": "sha1-8BdC2k5qyzAAsoY1dmQWjvn8o64="
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
|
@ -14030,7 +14035,7 @@
|
|||
},
|
||||
"qr.js": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npm.taobao.org/qr.js/download/qr.js-0.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz",
|
||||
"integrity": "sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8="
|
||||
},
|
||||
"qrcode.react": {
|
||||
|
@ -20538,9 +20543,9 @@
|
|||
}
|
||||
},
|
||||
"zrender": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/zrender/-/zrender-4.3.0.tgz",
|
||||
"integrity": "sha512-Dii6j2bDsPkxQayuVf2DXJeruIB/mKVxxcGRZQ9GExiBd4c3w7+oBuvo1O/JGHeFeA1nCmSDVDs/S7yKZG1nrA=="
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npm.taobao.org/zrender/download/zrender-4.3.2.tgz",
|
||||
"integrity": "sha1-7HQy+UFcgsc1hLa3uMR+GwFiCcY="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"dompurify": "^2.0.15",
|
||||
"dotenv": "4.0.0",
|
||||
"dotenv-expand": "4.2.0",
|
||||
"echarts": "^4.7.0",
|
||||
"echarts": "^4.9.0",
|
||||
"editor.md": "^1.5.0",
|
||||
"eslint": "4.10.0",
|
||||
"eslint-config-react-app": "^2.1.0",
|
||||
|
@ -47,6 +47,7 @@
|
|||
"install": "^0.12.2",
|
||||
"jest": "20.0.4",
|
||||
"js-base64": "^2.5.2",
|
||||
"js2wordcloud": "^1.1.12",
|
||||
"katex": "^0.11.1",
|
||||
"lodash": "^4.17.15",
|
||||
"loglevel": "^1.6.8",
|
||||
|
|
|
@ -46,18 +46,18 @@ export default ({
|
|||
let id = decodeURIComponent(u.split("#")[1]);
|
||||
let ele = document.getElementById(id);
|
||||
if(ele){
|
||||
window.scrollTo(0, ele.offsetTop + 220);
|
||||
window.scrollTo(0, ele.offsetTop + 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
},[url])
|
||||
},[url,html])
|
||||
|
||||
const el = useRef();
|
||||
function onAncherHandler(e) {
|
||||
let target = e.target
|
||||
let target = e.target;
|
||||
if (target.tagName.toUpperCase() === 'A') {
|
||||
let ancher = target.getAttribute('href')
|
||||
if (ancher.startsWith('#')) {
|
||||
let ancher = target.getAttribute('href');
|
||||
if (ancher && ancher.startsWith('#')) {
|
||||
e.preventDefault()
|
||||
let viewEl = document.getElementById(ancher.replace('#', ''))
|
||||
if (viewEl) {
|
||||
|
|
|
@ -45,7 +45,8 @@ function CoderDepot(props){
|
|||
const [ desc , setDesc ] = useState(undefined);
|
||||
const [ website , setWebsite ] = useState(undefined);
|
||||
const [ lesson_url , setLessonUrl ] = useState(undefined);
|
||||
const [ readme , setReadme ] = useState(undefined)
|
||||
const [ readme , setReadme ] = useState(undefined);
|
||||
const [ defaultBranch , setDefaultBranch ] = useState(undefined)
|
||||
|
||||
const owner = props.match.params.owner;
|
||||
const projectsId = props.match.params.projectsId;
|
||||
|
@ -59,6 +60,7 @@ function CoderDepot(props){
|
|||
setDesc(details.description);
|
||||
setWebsite(details.website);
|
||||
setLessonUrl(details.lesson_url);
|
||||
setDefaultBranch(details.default_branch);
|
||||
}
|
||||
},[details])
|
||||
|
||||
|
@ -72,17 +74,17 @@ function CoderDepot(props){
|
|||
|
||||
|
||||
useEffect(()=>{
|
||||
if (projectsId && owner){
|
||||
if (projectsId && owner && defaultBranch){
|
||||
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
|
||||
let url = pathname.split(`/tree/${branchName}/`)[1];
|
||||
setTreeValue(url);
|
||||
getFileInfo(url,branchName);
|
||||
}else{
|
||||
setTreeValue(undefined);
|
||||
getDirInfo(branchName ||(projectDetail && projectDetail.default_branch));
|
||||
getDirInfo(branchName || defaultBranch);
|
||||
}
|
||||
}
|
||||
},[projectsId,owner,pathname])
|
||||
},[projectsId,owner,pathname,defaultBranch])
|
||||
|
||||
// 获取主目录列表
|
||||
function getDirInfo(branch){
|
||||
|
@ -159,8 +161,8 @@ function CoderDepot(props){
|
|||
// 文件相关的下拉项
|
||||
const fileMenu =(
|
||||
<Menu>
|
||||
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${branchName || (projectDetail && projectDetail.default_branch)}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item>
|
||||
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${branchName || (projectDetail && projectDetail.default_branch)}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item>
|
||||
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${branchName || defaultBranch}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item>
|
||||
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${branchName || defaultBranch}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
|
||||
|
@ -176,7 +178,7 @@ function CoderDepot(props){
|
|||
// 页面地址返回到主目录
|
||||
function returnMain(){
|
||||
setTreeValue(undefined);
|
||||
let branch = branchName || (projectDetail && projectDetail.default_branch);
|
||||
let branch = branchName || defaultBranch;
|
||||
props.history.push(`/projects/${owner}/${projectsId}/tree/${branch}`);
|
||||
};
|
||||
// 子目录路径返回链接
|
||||
|
@ -186,7 +188,7 @@ function CoderDepot(props){
|
|||
// 点击跳转到子目录
|
||||
function goToSubRoot(path,type,filename){
|
||||
setType(type);
|
||||
props.history.push(`/projects/${owner}/${projectsId}${`/tree/${branchName || (projectDetail && projectDetail.default_branch)}`}${path?`/${path}`:""}`);
|
||||
props.history.push(`/projects/${owner}/${projectsId}${`/tree/${branchName || defaultBranch}`}${path?`/${path}`:""}`);
|
||||
}
|
||||
|
||||
function onEdit(readOnly){
|
||||
|
@ -194,7 +196,7 @@ function CoderDepot(props){
|
|||
}
|
||||
function ChangeFile(path, readOnly){
|
||||
//点击直接跳转页面 加载一次路由
|
||||
props.history.push(`/projects/${owner}/${projectsId}/tree/${branchName || (projectDetail && projectDetail.default_branch)}/${path}`);
|
||||
props.history.push(`/projects/${owner}/${projectsId}/tree/${branchName || defaultBranch}/${path}`);
|
||||
setType("file");
|
||||
setReadOnly(readOnly);
|
||||
};
|
||||
|
@ -253,7 +255,7 @@ function CoderDepot(props){
|
|||
owner={owner}
|
||||
projectsId={projectsId}
|
||||
name={projectDetail && projectDetail.name}
|
||||
branch={branchName || (projectDetail && projectDetail.default_branch)}
|
||||
branch={branchName || defaultBranch}
|
||||
visible={visible}
|
||||
onClose={()=>setVisible(false)}
|
||||
list = {mainFlag ? dirInfo : undefined}
|
||||
|
@ -278,14 +280,14 @@ function CoderDepot(props){
|
|||
<SelectBranch
|
||||
repo_id={projectDetail && projectDetail.repo_id}
|
||||
projectsId={projectsId}
|
||||
branch={branchName || (projectDetail && projectDetail.default_branch)}
|
||||
branch={branchName || defaultBranch}
|
||||
changeBranch={changeBranch}
|
||||
owner={owner}
|
||||
history={props.history}
|
||||
branchList={projectDetail && projectDetail.branches && projectDetail.branches.list}
|
||||
></SelectBranch>
|
||||
:
|
||||
<span>分支:<span className="color-grey-6">{branchName || (projectDetail && projectDetail.default_branch)}</span></span>
|
||||
<span>分支:<span className="color-grey-6">{branchName || defaultBranch}</span></span>
|
||||
}
|
||||
</div>
|
||||
<AlignCenter className="mr20">
|
||||
|
@ -366,7 +368,7 @@ function CoderDepot(props){
|
|||
readOnly={readOnly}
|
||||
md={mdFlag}
|
||||
onEdit={onEdit}
|
||||
currentBranch={branchName || (projectDetail && projectDetail.default_branch)}
|
||||
currentBranch={branchName || defaultBranch}
|
||||
type={projectDetail.type}
|
||||
></CoderRootFileDetail>
|
||||
}
|
||||
|
|
|
@ -58,9 +58,12 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
|||
:""
|
||||
}
|
||||
</div>
|
||||
<div className="commonBox-info">
|
||||
<RenderHtml className="break_word_comments imageLayerParent" value={content} url={history.location}/>
|
||||
</div>
|
||||
{
|
||||
content &&
|
||||
<div className="commonBox-info">
|
||||
<RenderHtml className="break_word_comments imageLayerParent" value={content} url={history.location}/>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export default (( props, { projectDetail }) => {
|
|||
}, [owner, projectsId]);
|
||||
|
||||
return (
|
||||
<div className="main">
|
||||
<div className="main" style={{padding:"0px",border:"none"}}>
|
||||
<Spin spinning={isSpin}>
|
||||
<div style={{minHeight:"400px"}}>
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ export default ({ match , history }) => {
|
|||
}
|
||||
}, [projectsId , owner, sha]);
|
||||
return (
|
||||
<div className="main">
|
||||
<div className="main" style={{padding:"0px",border:"none"}}>
|
||||
<Spin spinning={isSpin}>
|
||||
<Infos>
|
||||
<div className="commitinfos">
|
||||
|
|
|
@ -203,15 +203,17 @@
|
|||
.listtablehead{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #d9d9d9;
|
||||
padding:7px 20px;
|
||||
border-radius: 4px 4px 0px 0px;
|
||||
background-color: #FAFBFC;
|
||||
.ellipsistxt{
|
||||
#ptxt{
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
margin-left: 13px;
|
||||
line-height:18px;
|
||||
margin-top:6px;
|
||||
flex:1;
|
||||
width: 0;
|
||||
color: #666;
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import React ,{ useEffect } from 'react';
|
||||
import Js2WordCloud from 'js2wordcloud/dist/js2wordcloud.js'
|
||||
|
||||
function Cloud({data}) {
|
||||
|
||||
useEffect(()=>{
|
||||
optionChart1();
|
||||
},[])
|
||||
|
||||
function optionChart1(){
|
||||
var div = new Js2WordCloud(document.getElementById('cloud'))
|
||||
let textList=[
|
||||
['服务'], ['细致'], ['意识'], ['踏实'],['开发'], ['反馈'], ['协助'],['使用'],['谈判']
|
||||
]
|
||||
let cyList=[]
|
||||
for(let i=0;i<60;i++){
|
||||
cyList.push([textList[parseInt(Math.random()*textList.length)],Math.round(Math.random()*10)+1])
|
||||
}
|
||||
div.setOption({
|
||||
backgroundColor:'transparent',
|
||||
shape: 'circle',
|
||||
// ellipticity: 1,//椭圆
|
||||
maxFontSize: 40,//最大字号
|
||||
minFontSize: 12,//最小字号
|
||||
tooltip: {
|
||||
show: true
|
||||
},
|
||||
list: cyList,
|
||||
color(word, weight, fontSize, distance, theta) { //自定义颜色、透明度
|
||||
if (fontSize>=12 && fontSize<=20) {
|
||||
return 'rgb(29,227,250,0.3)';
|
||||
} else if(fontSize>20 && fontSize<=30){
|
||||
return 'rgb(29,227,250,0.6)';
|
||||
}else if(fontSize>30 && fontSize<=40){
|
||||
return 'rgb(29,227,250)';
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
return(
|
||||
<div id="cloud" style={{height:"200px"}}></div>
|
||||
)
|
||||
}
|
||||
export default Cloud;
|
|
@ -0,0 +1,96 @@
|
|||
import React ,{ useEffect } from 'react';
|
||||
import * as echarts from 'echarts';
|
||||
|
||||
function Line({data}) {
|
||||
useEffect(()=>{
|
||||
Init();
|
||||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
if(data){
|
||||
Init();
|
||||
}
|
||||
},[data])
|
||||
|
||||
function Init() {
|
||||
var huan_val = document.getElementById("Line");
|
||||
var myEcharts = echarts.init(huan_val);
|
||||
let option = {
|
||||
color: ["#f8e367", "#99dfff", "#58c0f0", "#5ea6ff", "#ff9e48", "#bcbcbc"],
|
||||
title: {
|
||||
text: '近期活动统计',
|
||||
left: '3%'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎'],
|
||||
right: '3%'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
// saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLine:{
|
||||
show:false
|
||||
},
|
||||
axisTick:{
|
||||
show:false
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '邮件营销',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
name: '联盟广告',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
name: '视频广告',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
name: '直接访问',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
name: '搜索引擎',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
};
|
||||
myEcharts.setOption(option);
|
||||
}
|
||||
|
||||
return(
|
||||
<div id="Line" style={{height:"300px"}}></div>
|
||||
)
|
||||
}
|
||||
export default Line;
|
|
@ -0,0 +1,75 @@
|
|||
import React ,{ useEffect } from 'react';
|
||||
import echarts from 'echarts/lib/echarts';
|
||||
import 'echarts/lib/chart/pie';
|
||||
|
||||
function Pie({data}) {
|
||||
useEffect(()=>{
|
||||
Init();
|
||||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
if(data){
|
||||
Init();
|
||||
}
|
||||
},[data])
|
||||
|
||||
function Init() {
|
||||
var huan_val = document.getElementById("Pie");
|
||||
var chart = echarts.init(huan_val);
|
||||
let option = {
|
||||
color: ["#f8e367", "#99dfff", "#58c0f0", "#5ea6ff", "#ff9e48", "#bcbcbc"],
|
||||
title: {
|
||||
text: '角色定位',
|
||||
top:"5%",
|
||||
left:"3%"
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
top: '5%',
|
||||
right: '3%'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'pie',
|
||||
radius: ['40%', '70%'],
|
||||
avoidLabelOverlap: false,
|
||||
itemStyle: {
|
||||
borderRadius: 10,
|
||||
borderColor: '#fff',
|
||||
borderWidth: 2
|
||||
},
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
fontSize: '40',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: [
|
||||
{value: 1048, name: '搜索引擎'},
|
||||
{value: 735, name: '直接访问'},
|
||||
{value: 580, name: '邮件营销'},
|
||||
{value: 484, name: '联盟广告'},
|
||||
{value: 300, name: '视频广告'}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
chart.setOption(option);
|
||||
}
|
||||
|
||||
return(
|
||||
<div id="Pie" style={{height:"400px"}}></div>
|
||||
)
|
||||
}
|
||||
export default Pie;
|
|
@ -0,0 +1,65 @@
|
|||
import React ,{ useEffect } from 'react';
|
||||
import echarts from 'echarts/lib/echarts'
|
||||
import 'echarts/lib/chart/radar';
|
||||
|
||||
function Radar({data}) {
|
||||
useEffect(()=>{
|
||||
Init();
|
||||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
if(data){
|
||||
Init();
|
||||
}
|
||||
},[data])
|
||||
|
||||
function Init() {
|
||||
var huan_val = document.getElementById("radar");
|
||||
var myEcharts = echarts.init(huan_val);
|
||||
let option = {
|
||||
color: ["#f8e367", "#99dfff", "#58c0f0", "#5ea6ff", "#ff9e48", "#bcbcbc"],
|
||||
title: {
|
||||
text: '开发能力',
|
||||
top:"0",
|
||||
left:"3%"
|
||||
},
|
||||
legend: {
|
||||
data: ['预算分配', '实际开销'],
|
||||
top:"0",
|
||||
right:"center"
|
||||
},
|
||||
radar: {
|
||||
// shape: 'circle',
|
||||
indicator: [
|
||||
{ name: '销售', max: 6500},
|
||||
{ name: '管理', max: 16000},
|
||||
{ name: '信息技术', max: 30000},
|
||||
{ name: '客服', max: 38000},
|
||||
{ name: '研发', max: 52000},
|
||||
{ name: '市场', max: 25000}
|
||||
],
|
||||
center:["50%","55%"]
|
||||
},
|
||||
series: [{
|
||||
name: '预算 vs 开销',
|
||||
type: 'radar',
|
||||
data: [
|
||||
{
|
||||
value: [4200, 3000, 20000, 35000, 50000, 18000],
|
||||
name: '预算分配'
|
||||
},
|
||||
{
|
||||
value: [5000, 14000, 28000, 26000, 42000, 21000],
|
||||
name: '实际开销'
|
||||
}
|
||||
]
|
||||
}]
|
||||
};
|
||||
myEcharts.setOption(option);
|
||||
}
|
||||
|
||||
return(
|
||||
<div id="radar" style={{height:"400px"}}></div>
|
||||
)
|
||||
}
|
||||
export default Radar;
|
|
@ -0,0 +1,23 @@
|
|||
import React from 'react';
|
||||
import './Index.scss';
|
||||
import 'echarts/lib/component/tooltip';
|
||||
import 'echarts/lib/component/title';
|
||||
import 'echarts/lib/component/legend'
|
||||
import 'echarts/lib/component/markPoint';
|
||||
|
||||
import Pie from '../Echart/Pie';
|
||||
import Line from '../Echart/Line';
|
||||
import Radar from '../Echart/Radar';
|
||||
import Cloud from '../Echart/Cloud';
|
||||
|
||||
function Index(props) {
|
||||
return(
|
||||
<div>
|
||||
<Pie />
|
||||
<Line />
|
||||
<Radar />
|
||||
<Cloud />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default Index;
|
|
@ -23,6 +23,11 @@ const InfosDevOpsCD = Loadable({
|
|||
loader: () => import("./devOpsCD"),
|
||||
loading: Loading,
|
||||
});
|
||||
|
||||
const GeneralView = Loadable({
|
||||
loader: () => import("./GeneralView/Index"),
|
||||
loading: Loading,
|
||||
});
|
||||
const InfosUser = Loadable({
|
||||
loader: () => import("./InfosUser"),
|
||||
loading: Loading,
|
||||
|
|
Loading…
Reference in New Issue