Merge branch 'develop'

This commit is contained in:
caishi 2021-04-20 10:56:50 +08:00
commit 2d2deec224
54 changed files with 524 additions and 139 deletions

17
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "educoder",
"name": "forge",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
@ -3888,11 +3888,6 @@
"randomfill": "^1.0.3"
}
},
"crypto-js": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/crypto-js/download/crypto-js-4.0.0.tgz",
"integrity": "sha1-KQSrJnep0EKFai6i74DekuSjbcw="
},
"crypto-random-string": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz",
@ -20480,6 +20475,16 @@
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
"dev": true
},
"xterm": {
"version": "4.8.1",
"resolved": "https://registry.npm.taobao.org/xterm/download/xterm-4.8.1.tgz",
"integrity": "sha1-FVoXKaQ+Gom0BlJOIsVjQznjnKE="
},
"xterm-addon-fit": {
"version": "0.4.0",
"resolved": "https://registry.npm.taobao.org/xterm-addon-fit/download/xterm-addon-fit-0.4.0.tgz",
"integrity": "sha1-BuDF0KaqrPsAnvVl76HIHpPZAZM="
},
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",

View File

@ -111,7 +111,9 @@
"webpack-dev-server": "^3.10.3",
"webpack-manifest-plugin": "^2.2.0",
"whatwg-fetch": "2.0.3",
"wrap-md-editor": "^0.2.20"
"wrap-md-editor": "^0.2.20",
"xterm": "4.8.1",
"xterm-addon-fit": "0.4.0"
},
"scripts": {
"start": "node --max_old_space_size=15360 scripts/start.js",

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
var proxy = "https://forgeplus.trustie.net";
var proxy = "https://testforgeplus.trustie.net";
//响应前的设置
axios.interceptors.request.use(
config => {

View File

@ -15,7 +15,7 @@ export function getImageUrl(path) {
if (isDev) {
return `${local}/${path}`
}
return `/${path}`;
return `${path}`;
}
export function getImage(path) {

View File

@ -33,7 +33,7 @@ class ActivityItem extends Component {
}
<p className="itemLine mt10">
<Link to={`/users/${item && item.user_login}`} className="show-user-link">
<img alt="" src={getImageUrl(`images/${item.user_avatar}`)} className="createImage" />
<img alt="" src={getImageUrl(`/${item.user_avatar}`)} className="createImage" />
<span className="mr20">{item.user_name}</span>
</Link>
{item.created_at && <span className="color-grey-9">创建于<span className="ml2 color-grey-6">{item.created_at}</span></span>}

View File

@ -42,7 +42,7 @@ function AddMember({getID,login}){
className="user_img radius"
width="28"
height="28"
src={getImageUrl(`images/${item && item.image_url}`)}
src={getImageUrl(`/${item && item.image_url}`)}
alt=""
/>
<span className="ml10" style={{ "vertical-align": "middle" }}>

View File

@ -6,7 +6,7 @@ import './Component.scss';
function Cards({img , title, desc , rightBtn , src}){
return(
<div className="cards">
{img &&<div className="img"><img src={getImageUrl(`images/${img}`)} alt=""/></div>}
{img &&<div className="img"><img src={getImageUrl(`/${img}`)} alt=""/></div>}
<div className="content">
<p className="titles">
<Link to={src}>{title}</Link>

View File

@ -15,7 +15,7 @@ function Contributors({contributors,owner,projectsId}){
contributors && contributors.total_count > 0 ?
contributors.list.map((item,key)=>{
return(
<Link key={key} to={`/users/${item.login}`}><img src={getImageUrl(`images/${item.image_url}`)} alt=""/></Link>
<Link key={key} to={`/users/${item.login}`}><img src={getImageUrl(`/${item.image_url}`)} alt=""/></Link>
)
})
:""

View File

@ -45,7 +45,7 @@ const Div = styled.div`{
export default (({ user , img, name, time, focusStatus, is_current_user, login , successFunc }) => {
return (
<Div>
<Link to={`/users/${user && user.login}`}><Img src={getImageUrl(`images/${img}`)} /></Link>
<Link to={`/users/${user && user.login}`}><Img src={getImageUrl(`/${img}`)} /></Link>
<div className="m-infos">
<Link to={`/users/${user && user.login}`}><Name>{name}</Name></Link>
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>

View File

@ -44,7 +44,7 @@ export default ({ getUser })=>{
className="user_img radius"
width="28"
height="28"
src={getImageUrl(`images/${item && item.image_url}`)}
src={getImageUrl(`/${item && item.image_url}`)}
alt=""
/>
<span className="ml10" style={{ "vertical-align": "middle" }}>

View File

@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react";
import { Spin , Menu } from "antd";
import { FlexAJ, AlignCenter } from "../Component/layout";
import axios from "axios";
import CodeSSH from './ssh/Index';
export default ({
data,
@ -37,6 +38,7 @@ export default ({
: p[0];
setStep(sub);
setNav("0");
if (sub && sub.status !== "skipped") {
getStep(pre.number, sub.number);
}
@ -67,51 +69,55 @@ export default ({
}
}
return (
<Spin spinning={spining}>
<React.Fragment>
{/* <Menu className="devopsNav" onClick={(e)=>{setNav(e.key)}} selectedKeys={[nav]} mode="horizontal">
<Menu.Item key={'0'} value="0">文件</Menu.Item>
<Menu.Item key={'0'} value="0">开发流水线</Menu.Item>
<Menu.Item key={'1'} value="1">命令行</Menu.Item>
</Menu> */}
{
nav === "0" &&
<div className="rightMainContent">
{data && data.status !== "error" ? (
<div>
<FlexAJ className="items">
<span>{step && step.name}</span>
<AlignCenter>
{step && step.duration_time}
<i className="iconfont icon-sanjiaoxing-down"></i>
</AlignCenter>
</FlexAJ>
<Spin spinning={spining}>
<div className="rightMainContent">
{data && data.status !== "error" ? (
<div>
{coders && coders.length > 0 ? (
coders.map((item, key) => {
return (
<div className="opsDetailOut">
<span>{key + 1}</span>
<p>{item.out}</p>
</div>
);
})
) : empty ? (
<div className="opsDetailOut">
<span>1</span>
<p>
{stage && stage.name} {step && step.name}: Skipped
</p>
</div>
) : (
""
)}
<FlexAJ className="items">
<span>{step && step.name}</span>
<AlignCenter>
{step && step.duration_time}
<i className="iconfont icon-sanjiaoxing-down"></i>
</AlignCenter>
</FlexAJ>
<div>
{coders && coders.length > 0 ? (
coders.map((item, key) => {
return (
<div className="opsDetailOut">
<span>{key + 1}</span>
<p>{item.out}</p>
</div>
);
})
) : empty ? (
<div className="opsDetailOut">
<span>1</span>
<p>
{stage && stage.name} {step && step.name}: Skipped
</p>
</div>
) : (
""
)}
</div>
</div>
</div>
) : (
<div style={{ color: "red" }}>error:{data && data.error}</div>
)}
</div>
) : (
<div style={{ color: "red" }}>error:{data && data.error}</div>
)}
</div>
</Spin>
}
</Spin>
{
nav === "1" && <CodeSSH />
}
</React.Fragment>
);
};

View File

@ -0,0 +1,42 @@
import React, { useState, useEffect } from "react";
import XmlPanel from "./XmlPanel";
import mediator from "./mediator";
import axios from "axios";
// const defaulturl = `http://47.111.130.18:48088`;
const defaultValue = {
host: "106.75.231.63",
port: "2021",
ws_url: "wss://pre-webssh.educoder.net/ws",
username: "root",
secret: "Dron_123123",
};
function Index() {
const [sshConfigData, setSshConfigData] = useState(undefined);
useEffect(() => {
if (!sshConfigData) {
init();
}
setTimeout(() => {
mediator.publish("create-socket", 1);
}, 300);
}, [sshConfigData]);
//
function init() {
const url = `/api/ci/pipelines/ssh_server.json`;
axios.get(url).then(result=>{
if(result && result.data){
setSshConfigData({...result.data})
}
}).catch(error=>{})
}
return (
<XmlPanel
sshConfigData={sshConfigData||{}}
sid={1}
/>
);
}
export default Index;

View File

@ -0,0 +1,219 @@
import React, { useRef, useEffect, useState } from 'react';
import { Base64 } from 'js-base64';
import { Terminal } from 'xterm';
import 'xterm/css/xterm.css';
import mediator from './mediator';
import ResizeObserver from 'resize-observer-polyfill';
function getColsAndRows(width, height, term) {
let w = term._core._renderService.dimensions.actualCellWidth || 9.5;
let h = term._core._renderService.dimensions.actualCellHeight || 18;
const rows = Math.floor(height / h);
const cols = Math.floor(width / w);
return [cols, rows];
}
function onLayout(term, el) {
const ro = new ResizeObserver(entries => {
console.log(entries);
for (let entry of entries) {
if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) {
const [cols, rows] = getColsAndRows(
entry.target.offsetWidth,
entry.target.offsetHeight,
term,
);
console.log('cols, rows', cols, rows);
term.resize(cols, rows);
mediator.publish('ssh-xterm-resize', {
columns: cols,
rows: rows,
width: entry.target.offsetWidth,
height: entry.target.offsetHeight,
});
}
}
});
ro.observe(el);
return ro;
}
const TimeTicket = 30000;
// websockt
//
//socket term socket
//mediator id
export default ({ sshConfigData, sid }) => {
const [term, setTerm] = useState(null);
const { ws_url, password, port, secret } = sshConfigData;
const el = useRef();
const socket = useRef();
const isFirstConnected = useRef(false);
//term init
useEffect(() => {
if (el.current && ws_url) {
const term = new Terminal({ fontSize: 16, rendererType: 'dom' });
term.open(el.current);
term.onData(data => {
if (socket.current) {
if (socket.current.readyState === 1) {
socket.current.send(JSON.stringify({ tp: 'client', data: data }));
mediator.publish('on-operating-ssh'); //
} else {
//
// socket.current = null
// mediator.publish('create-socket', sid)
}
}
});
term.write('Connecting...');
setTerm(term);
const ro = onLayout(term, el.current);
return () => {
term.dispose();
ro.unobserve(el.current);
};
}
}, [ws_url, el.current]);
useEffect(() => {
if (term && ws_url) {
function createSocket() {
const socketInstance = new WebSocket(ws_url);
socket.current = socketInstance;
socketInstance.onopen = () => {
let container = term.element.parentElement;
if (container) {
let width = container.offsetWidth;
let height = container.offsetHeight;
console.log('init', {
tp: 'init',
data: {
...sshConfigData,
secret: secret,
width,
height,
rows: term.rows,
columns: term.cols,
},
});
socketInstance.send(
JSON.stringify({
tp: 'init',
data: {
...sshConfigData,
secret: secret,
width,
height,
rows: term.rows,
columns: term.cols,
},
}),
);
}
term.focus();
};
socketInstance.onerror = error => {
console.log(
'------in socket error----',
error,
socketInstance,
ws_url,
);
//
// mediator.publish('on-recreate-socket')
};
socketInstance.onmessage = event => {
if (!isFirstConnected.current) {
term.write('\r');
// term.focus()
setTimeout(() => {
// term.clear();
}, 1000);
}
isFirstConnected.current = true;
console.log('event:', event);
const data = Base64.decode(event.data.toString());
let w = term._core._renderService.dimensions.actualCellWidth || 9.5;
console.log('data:', data, w, term);
term.write(data);
};
socketInstance.onclose = evt => {
if (tid) {
clearInterval(tid);
}
term.write('\r\nconnection closed');
};
}
const tid = setInterval(() => {
if (socket.current) {
socket.current.send(JSON.stringify({ tp: 'h' }));
}
}, TimeTicket);
const unSubCreate = mediator.subscribe('create-socket', id => {
if (sid === id) {
if (socket.current && socket.current.readyState === 1) {
term.focus();
} else {
createSocket();
}
term.focus();
}
});
const unSubClose = mediator.subscribe('close-socket', id => {
if (sid === id) {
if (socket.current) {
socket.current.close();
isFirstConnected.current = false;
term.clear();
}
socket.current = null;
}
});
const unSubResize = mediator.subscribe('ssh-xterm-resize', option => {
if (socket.current && socket.current.readyState === 1) {
socket.current.send(
JSON.stringify({ tp: 'resize', data: { ...option } }),
);
}
});
const unSubAddTime = mediator.subscribe('ssh-add-connect-time', () => {
if (socket.current && socket.current.readyState === 1) {
socket.current.send(JSON.stringify({ tp: 'overtime' }));
}
});
return () => {
unSubClose();
unSubCreate();
unSubResize();
unSubAddTime();
if (socket.current) {
socket.current.close();
isFirstConnected.current = false;
}
};
}
}, [term, ws_url, port]);
return (
<div ref={el} className="xterm-panel" style={{height:"100%"}}>
{!ws_url ? <p style={{ color: '#fff' }}>正在连接命令行服务...</p> : null}
</div>
);
};

View File

@ -0,0 +1,46 @@
function Mediator(obj) {
const channels = {};
const mediator = {
subscribe: function(channel, cb) {
if (!channels[channel]) {
channels[channel] = [];
}
channels[channel].push(cb);
return this.unsubscribe.bind(null, channel, cb);
},
unsubscribe: function(channel, cb) {
let rs = channels[channel];
let index = -1;
if (rs) {
for (let i = 0; i < rs.length; i++) {
if (rs[i].name === cb.name) {
index = i;
break;
}
}
if (index >= 0) {
channels[channel].splice(index, 1);
return true;
}
}
return false;
},
publish: function(channel) {
if (!channels[channel]) {
return false;
}
const args = Array.prototype.slice.call(arguments, 1);
channels[channel].forEach(subscription => {
subscription.apply(null, args);
});
return this;
},
};
return obj ? Object.assign(obj, mediator) : mediator;
}
const mediator = new Mediator();
export default mediator;

View File

@ -603,7 +603,7 @@ class NewHeader extends Component {
<a href={settings && settings.new_course.default_url} className={"fl mr30"} style={{minWidth:"45px"}}>
{
settings && settings.nav_logo_url ?
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(settings.nav_logo_url)}></img>
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(`/${settings.nav_logo_url}`)}></img>
:
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={logo}></img>
}
@ -703,8 +703,7 @@ class NewHeader extends Component {
:
<div className="ml30 edu-menu-panel" style={{ height: "70px", lineHeight: "70px" }}>
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>
<img alt="头像" className="radius" height="34" id="nh_user_logo" name="avatar_image"
src={getImageUrl(`images/` + user.image_url)} width="34">
<img alt="头像" className="radius" height="34" id="nh_user_logo" name="avatar_image" src={getImageUrl(`/${user.image_url}`)} width="34">
</img>
</a>
<ul className="edu-menu-list" style={{ top: '60px', textAlign: 'center' }}>

View File

@ -315,7 +315,7 @@ function CoderDepot(props){
{
lastCommit &&
<div className="listtablehead">
<User url={getImageUrl(`images/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
<User url={getImageUrl(`/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
<div className={hideBtn && hide ? "ellipsistxt hide" :"ellipsistxt"}><p id="ptxt">{lastCommit && lastCommit.message}</p></div>
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }

View File

@ -1,13 +1,49 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import RenderHtml from '../../components/render-html';
import { Dropdown , Menu , Spin } from 'antd';
import { Link } from 'react-router-dom';
const $ = window.$;
function CoderDepotReadme({ operate , history , readme , ChangeFile }){
const [ menuList ,setMenuList ] = useState(undefined);
useEffect(()=>{
if(readme && readme.content){
let path = history.location.pathname;
const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) {
const anchor = el.id;
const level = el.tagName.replace("H", "");
const href = `#${anchor}`;
return { href:`${path}${href}`,text:el.textContent , level:level }
});
setMenuList(items);
}
},[readme])
function menu(){
if(menuList && menuList.length > 0){
let hash = history.location.hash;
return(
<Menu className="menuslist">
{
menuList.map((item,key)=>{
return(
<Menu.Item key={item.id} className={decodeURI(hash).indexOf(item.text)>-1 ?"active":""}><Link to={`${item.href}`} style={{paddingLeft:`${item.level *10}px`}} title={item.text}>{item.text}</Link></Menu.Item>
)
})
}
</Menu>
)
}else{
return <Spin />
}
}
return(
<div className="commonBox" id="readme">
<div className="commonBox-title">
<span className="mr10">
<i className="iconfont icon-wenjian1 font-16 color-grey-9 fl mt3"></i>
</span>
<Dropdown overlay={menu()}>
<i className="iconfont icon-zhangjie1 font-16 color-grey-3 mr10"></i>
</Dropdown>
<span className="commonBox-title-read">README.md</span>
{
operate ?

View File

@ -140,11 +140,11 @@ class CoderRootCommit extends Component{
{
item.id ?
<Link to={`/users/${item.login}`} className="show-user-link">
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
{item.image_url?<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
</Link>:
<span className="show-user-link">
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
{item.image_url?<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
</span>
}

View File

@ -31,6 +31,18 @@ class CoderRootFileDetail extends Component {
this.languages_total();
};
componentDidUpdate=(prevProps)=>{
const { content } = this.props && this.props.detail;
const prevcontent = prevProps.detail && prevProps.detail.content;
if (content && prevcontent) {
if (prevcontent !== content){
this.setState({
description: content
});
}
}
}
languages_total = () => {
const { detail } = this.props;
const file_name = detail.path.split("/").pop().split(".").pop();
@ -273,7 +285,7 @@ class CoderRootFileDetail extends Component {
{...this.state}
language={language ? language : "javascript"}
filepath={`/${detail.path}`}
content={detail.content}
content={description}
readOnly={readOnly}
editorType="update"
currentBranch={currentBranch}

View File

@ -65,7 +65,7 @@ export default ({ match , history }) => {
<div className="f-wrap-between" style={{ alignItems: "center" }}>
<ul className="df">
<User
url={(committer && getImageUrl(`images/${committer.image_url}`))|| "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
url={(committer && getImageUrl(`/${committer.image_url}`))|| "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
name={committer && committer.name}
/>
{committer && committer.time_from_now && <li className="ml20 mt2">{committer.time_from_now}</li>}

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Menu, Input , Spin, Pagination , Popover , Select } from 'antd';
import { getUrl } from 'educoder';
import { getImageUrl } from 'educoder';
import '../css/index.scss'
import './list.css';
import './Index.scss';
@ -271,7 +271,7 @@ class Index extends Component {
return(
<div onClick={()=>this.getoDetail(item.author && item.author.login,item.identifier)}>
<div className="mainInfo">
<img src={getUrl(`/images/${item.author && item.author.image_url}`)} alt=""/>
<img src={getImageUrl(`/${item.author && item.author.image_url}`)} alt=""/>
<p className="school">{item.name}</p>
<p className="name">{item.author && item.author.name}</p>
</div>

View File

@ -286,4 +286,23 @@
.downMenu{
box-shadow: 0px 0px 9px rgba(134, 134, 134,0.4);
background-color: #fff;
}
.menuslist{
max-height: 200px;
overflow-y: auto;
padding:10px 15px;
border-radius: 4px;
.ant-dropdown-menu-item{
border-radius: 8px;
a{
width: 350px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.ant-dropdown-menu-item.active{
background-color: #e6f7ff;
}
}

View File

@ -28,7 +28,7 @@ class IndexItem extends Component {
</a>
:
<Link to={item.author && (item.author.type === "Organization" ? `/organize/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`${item.author && item.author.image_url}`)} ></img>
<img className="p-r-photo" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
</Link>
}
<div className="p-r-Infos">

View File

@ -437,9 +437,6 @@
font-size: 16px;
border-bottom: 1px solid #d9d9d9;
}
.branchUl{
padding:0px 30px;
}
.branchUl li{
display: flex;
flex-wrap: wrap;

View File

@ -50,7 +50,7 @@ function Contribute(props){
list.map((item,key)=>{
return(
<AlignCenter>
<img alt="" style={{borderRadius:"50%",marginRight:"10px"}} src={getImageUrl(`images/${item.image_url}`)} width="50px" height="50px"/>
<img alt="" style={{borderRadius:"50%",marginRight:"10px"}} src={getImageUrl(`/${item.image_url}`)} width="50px" height="50px"/>
<div>
<Link to={`/users/${item.login}`} className="font-16">{item.name}</Link>
<p className="font-12 color-grey-9">提交{item.contributions}</p>

View File

@ -22,7 +22,7 @@ function Commits({ commits , projectsId , owner }){
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(item.sha)}`} className="color-blue">浏览代码</Link>
</FlexAJ>
<AlignCenter className="mt15">
<User url={getImageUrl(`images/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>提交于{item.time_from_now}</span>
<User url={getImageUrl(`/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>提交于{item.time_from_now}</span>
</AlignCenter>
</div>
</div>

View File

@ -1,6 +1,7 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Popconfirm, Tag } from "antd";
import { Tag } from "antd";
import { AlignCenter } from '../Component/layout';
import { getImageUrl } from "educoder";
import "./merge.css";
@ -74,13 +75,13 @@ class MergeItem extends Component {
>
<img
className="radius"
src={getImageUrl(`images/${item && item.avatar_url}`)}
src={getImageUrl(`/${item && item.avatar_url}`)}
alt=""
width="24"
height="24"
/>
</Link>
<span>
<AlignCenter>
<Link
to={`/users/${item && item.author_login}`}
className="show-user-link color-grey-8 ml5"
@ -124,7 +125,7 @@ class MergeItem extends Component {
</Link>
</Tag>
</span>
</span>
</AlignCenter>
</p>
</div>
<ul

View File

@ -101,7 +101,7 @@ class MergeSubmit extends Component{
render: (text,item) => (
<span className="f-wrap-alignCenter">
<Link to={`/users/${item.login}`} className="show-user-link">
<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
<label className="hide-1" style={{maxWidth:"75px",'vertical-align':'middle'}}>{text}</label>
</Link>
</span>

View File

@ -12,6 +12,13 @@ class m_editor extends Component {
editorValue: this.props.content,
};
}
componentDidUpdate=(prevProps)=>{
if(prevProps && this.props && this.props.content !== prevProps.content){
this.setState({
editorValue:this.props.content
})
}
}
changeEditor = (editorValue) => {
this.setState({
editorValue,

View File

@ -212,7 +212,7 @@ class Detail extends Component {
>
<img
className="user_img"
src={getImageUrl(`images/${data && data.author_picture}`)}
src={getImageUrl(`/${data && data.author_picture}`)}
alt=""
width="50"
height="50"

View File

@ -26,8 +26,8 @@ function Collaborator(props){
{
author && author.type === "Organization" ?
<span>
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>setNav("1")}>协作者管理</span>
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>setNav("2")}>团队管理</span>
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>{setNav("1");setNewId(undefined)}}>协作者管理</span>
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined)}}>团队管理</span>
</span>
:
<span className="font-18 text-black">协作者管理</span>

View File

@ -186,7 +186,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
className="show-user-link"
>
<img
src={getImageUrl(`images/${text}`)}
src={getImageUrl(`/${text}`)}
alt=""
width="32px"
height="32px"

View File

@ -12,8 +12,7 @@ import axios from 'axios';
const { Search } = Input;
const sort = [
"按上传时间排序",
"按下载次数排序",
"按引用排序"
"按下载次数排序"
]
const limit = 15;
const https = 'https://testfiles.trustie.net';
@ -191,7 +190,7 @@ function Index(props){
/>
<div className="headtitle">
<FlexAJ>
<span className="font-18">资源库(18)</span>
<span className="font-18">资源库{total ? <span>({total})</span>:""}</span>
{ current_user && current_user.login && (props.projectDetail && props.projectDetail.permission) ?
<Blueback onClick={()=>{setId(undefined);setVisible(true);}}>上传资源</Blueback>:""
}

View File

@ -10,6 +10,7 @@ export default (({ data , current_user , successFunc }) => {
data.map((item, key) => {
return (
<Cards
user={item.user}
img={item.user.image_url}
name={item.user.name}
time={item.created_at}

View File

@ -30,8 +30,8 @@ export default (({projects}) => {
projects.map((item, key) => {
return (
<Div>
<Imgs src={item.project && getImageUrl(`images/${item.project.owner_image_url}`)}/>
<Link to={`/projects/${item.project.owner_name}/${item.project.identifier}`}>{item.project.name}</Link>
<Imgs src={item.project && getImageUrl(`/${item.project.owner_image_url}`)}/>
<Link to={`/projects/${item.project.owner_login}/${item.project.identifier}`}>{item.project.name}</Link>
</Div>
)
})

View File

@ -101,7 +101,7 @@ export default ((props) => {
group ?
<div>
<AlignCenterBetween>
<span className="color-grey-3">{group.name}</span>
<span className="color-grey-3">{group.nickname}</span>
{group.is_member && !group.is_admin ?
<Popconfirm
title="确认离开团队吗?"

View File

@ -137,17 +137,39 @@ export default Form.create()(
history.push(`/organize/${OIdentifier}`);
}
}
function checkname(rule, value, callback){
if(!value){
callback();
}
if(value && !value.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)){
callback("只能使用英文字母和数字以字母开头长度为4到15个字符");
}
callback();
}
return (
<Spin spinning={isSpin}>
<WhiteBack className="mb30">
<WhiteBack className="mb30" style={{border:groupId?"none":"1px solid #eee"}}>
<Banner>{groupId ? "基本设置" : "新建团队"}</Banner>
<Div>
<Form>
{helper(
'团队名称:',
'团队标识',
"name",
[
{ required: true, message: "请输入团队标识" },
{
validator:checkname
}
],
<Input placeholder="请输入团队标识" disabled={onwers}/>, true
)}
{helper(
'团队名称:',
"nickname",
[{ required: true, message: "请输入团队名称" }],
<Input placeholder="请输入团队名称" disabled={onwers}/>, true
<Input placeholder="请输入团队名称"/>, true
)}
{helper(
<span className="mb5">团队描述<span className="color-grey-8">(描述团队的目的或作用)</span></span>,

View File

@ -76,7 +76,7 @@ export default ((props) => {
width: "7%",
render: (value, item) => {
return (
<Img src={getImageUrl(`images/${item.user.image_url}`)}></Img>
<Img src={getImageUrl(`/${item.user.image_url}`)}></Img>
)
}
},

View File

@ -180,7 +180,7 @@ function GroupProjectSetting(props) {
}
>
<List.Item.Meta
title={<a href={`/projects/${item.project.owner_name}/${item.project.name}`}>{item.project.owner_name}/{item.project.name}</a>}
title={<a href={`/projects/${item.project.owner_login}/${item.project.identifier}`}>{item.project.owner_name}/{item.project.name}</a>}
/>
</List.Item>
)}

View File

@ -72,7 +72,7 @@ function RightBox({ OIdentifier , history , admin }) {
memberData.organization_users.map((item,key)=>{
return(
<div className="teammembers" key={key}>
<Link to={`/users/${item.user && item.user.login}`}><Img src={getImageUrl(`images/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
<Link to={`/users/${item.user && item.user.login}`}><Img src={getImageUrl(`/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
<div>
<Link to={`/users/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
<Align><i className="iconfont icon-shijian color-green mr3 font-13"></i><Span>加入时间{item.created_at}</Span></Align>

View File

@ -169,7 +169,7 @@ export default Form.create()(
<Input value="-1" style={{width:"350px"}}/>
)}
<p>选择头像:</p>
<UploadImage url={getImageUrl(`images/${image}`)} getImage={getImage}/>
<UploadImage url={getImageUrl(`/${image}`)} getImage={getImage}/>
<Button type={"primary"} onClick={updateDetail}>更新仓库设置</Button>
</Form>
</Div>

View File

@ -64,7 +64,7 @@ export default (({organizeDetail})=>{
width:"5%",
render:(value)=>{
return(
value && <Link to={`/users/${value && value.login}`}><Img src={getImageUrl('images/'+value.image_url)}></Img> </Link>
value && <Link to={`/users/${value && value.login}`}><Img src={getImageUrl('/'+value.image_url)}></Img> </Link>
)
}
},

View File

@ -78,7 +78,7 @@ function Detail(props){
detail &&
<Cards
src={`/organize/${detail.name}`}
title={detail.name}
title={detail.nickname}
desc={!buttonflag && detail.description}
img={detail.avatar_url}
rightBtn={

View File

@ -75,7 +75,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
return(
<div key={key}>
<p className="g-head">
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.name}</Link>
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
<span>
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
@ -86,7 +86,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
{
item.users && item.users.map((i,k)=>{
return(
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`images/${i.image_url}`)}/></Link>
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
:
k === count ?
<Link to={`/organize/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>

View File

@ -88,7 +88,7 @@ class ForkUsers extends Component {
>
<img
className="avatar-60"
src={getImageUrl(`images/${item.image_url}`)}
src={getImageUrl(`/${item.image_url}`)}
alt=""
/>
</Link>

View File

@ -18,7 +18,7 @@ class UserList extends Component {
>
<img
className="avatar-60"
src={getImageUrl(`images/${item.image_url}`)}
src={getImageUrl(`/${item.image_url}`)}
alt=""
/>
</a>

View File

@ -118,7 +118,7 @@ class children_comments extends Component {
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
src={getImageUrl(`/${item && item.user_picture}`)}
alt=""
width="30"
height="30"

View File

@ -82,7 +82,7 @@ class children_journals extends Component {
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
src={getImageUrl(`/${item && item.user_picture}`)}
alt=""
width="30"
height="30"

View File

@ -375,7 +375,7 @@ class comments extends Component {
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
src={getImageUrl(`/${item && item.user_picture}`)}
alt=""
width="30"
height="30"
@ -471,7 +471,7 @@ class comments extends Component {
className="radius"
src={
current_user && current_user.image_url
? getImageUrl(`images/${current_user.image_url}`)
? getImageUrl(`/${current_user.image_url}`)
: "images/avatars/User/b"
}
alt=""
@ -528,7 +528,7 @@ class comments extends Component {
className="radius"
src={
current_user && current_user.image_url
? getImageUrl(`images/${current_user.image_url}`)
? getImageUrl(`/${current_user.image_url}`)
: "images/avatars/User/b"
}
alt=""

View File

@ -150,7 +150,7 @@ class Infos extends Component {
<div className="list-l-Menu text-center pd20 ">
<Avatar
size={110}
src={getImageUrl(`images/${user && user.image_url}`)}
src={getImageUrl(`/${user && user.image_url}`)}
/>
{user && user.user_identity && (
<div className="mt-n15 position-relative">

View File

@ -4,7 +4,7 @@ import { getImageUrl } from 'educoder';
function TeamItem({item,history}){
return(
<div onClick={()=>{history.push(`/organize/${item.name}`)}} style={{cursor:"pointer"}}>
<div className="imgBox"><img alt="" src={getImageUrl(`images/${item.avatar_url}`)}/></div>
<div className="imgBox"><img alt="" src={getImageUrl(`/${item.avatar_url}`)}/></div>
<div style={{flex:'1'}}>
<span className="mb5 font-18 color-grey-3 task-hide">{item.name}</span>
<div className="task-hide-2">

View File

@ -1,34 +1,14 @@
import React, {Component} from "react";
import moment from 'moment';
import { SnackbarHOC,getImageUrl } from 'educoder';
import { getImageUrl } from 'educoder';
import '../courses/css/members.css';
import "../courses/common/formCommon.css"
import "../courses/common/formCommon.css";
import '../courses/css/Courses.css';
import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png';
import educodernet from '../../../src/images/login/educodernet.png';
import LoginRegisterComponent from '../user/LoginRegisterComponent';
import FindPasswordComponent from '../user/FindPasswordComponent';
import passopen from "../../images/login/passopen.png";
//educoder登入页面
var sectionStyle = {
"height": "100%",
"width": "100%",
"min-width": "1000px",
// makesure here is String确保这里是一个字符串以下是es6写法
};
var imgback = {
" background-size":"cover",
"background-repeat":"no-repeat",
backgroundImage: `url(${beijintulogontwo})`,
}
var imgmian ={
width: "100%",
background: `url(${beijintulogontwo})`,
position: "relative",
}
var newContainer={
background: `url(${beijintulogontwo})`,
@ -89,11 +69,6 @@ class EducoderLogin extends Component {
}
componentDidMount() {
// console.log("EducoderLogin");
// console.log(this.props);
}
Setlogins=(i)=>{
console.log("96ye");
console.log(i)
@ -120,9 +95,6 @@ class EducoderLogin extends Component {
render() {
let {showbool,loginstatus,logini} = this.state;
// console.log("EducoderLogingetHelmetapi");
// console.log(this.props);
// console.log(this.props.mygetHelmetapi);
return (
<div style={newContainer} className=" clearfix" >

View File

@ -21,7 +21,6 @@ body>.-task-title {
height: 100%;
min-height: 100%;
overflow: hidden;
padding-top:70px;
}
.newHeaders{
max-width: unset;

View File

@ -427,6 +427,7 @@ export function TPMIndexHOC(WrappedComponent) {
tip={this._gLoadingTip || "加载中..."}
>
<div className="newContainer newContainers">
<div style={{height:"70px"}}></div>
{
current_user &&
<WrappedComponent initCommonState={(user) => this.initCommonState(user)}