Merge branch 'newVersion_forge' into dev_devOps

This commit is contained in:
caishi 2020-09-27 13:59:04 +08:00
commit c3ed52bc32
12 changed files with 208 additions and 96 deletions

8
package-lock.json generated
View File

@ -14939,8 +14939,8 @@
},
"react-player": {
"version": "1.15.3",
"resolved": "https://registry.npmjs.org/react-player/-/react-player-1.15.3.tgz",
"integrity": "sha512-8fc0R1AipFIy7l4lKgnIg+gMU2IY32ZMxxBlINjXAq/YnN3HUP3hOaE+aQ0lQv+a1/MMZgbekWD86ZGDO7kB8g==",
"resolved": "https://registry.npm.taobao.org/react-player/download/react-player-1.15.3.tgz",
"integrity": "sha1-0AzxRfnIYYTLCgcaH7+Oy3tomH8=",
"requires": {
"deepmerge": "^4.0.0",
"load-script": "^1.0.0",
@ -14949,8 +14949,8 @@
"dependencies": {
"deepmerge": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg=="
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz",
"integrity": "sha1-RNLqNnm49NT/ujPwPYZfwee/SVU="
}
}
},

View File

@ -14,7 +14,6 @@
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"code-prettify": "^0.1.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "6.26.0",
@ -24,6 +23,7 @@
"chalk": "1.1.3",
"classnames": "^2.2.5",
"clipboard": "^2.0.6",
"code-prettify": "^0.1.0",
"codemirror": "^5.53.0",
"connected-react-router": "4.4.1",
"css-loader": "^3.5.2",

View File

@ -20,7 +20,7 @@
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<script type="text/javascript">
<!-- <script type="text/javascript">
window.__isR = true;
if (
(navigator.userAgent.indexOf('MSIE 9') != -1
@ -29,7 +29,7 @@
location.pathname.indexOf("/compatibility") == -1) {
location.href = '/compatibility.html'
}
</script>
</script> -->
<link rel=" stylesheet" type="text/css" href="%PUBLIC_URL%css/iconfont.css">
<link rel=" stylesheet" type="text/css" href="%PUBLIC_URL%css/edu-purge.css">
@ -43,7 +43,7 @@
<div id="md_div" style="display: none;"></div>
<div id="root" class="page -layout-v -fit widthunit"></div>
<div id="picture_display" style="display: none;"></div>
<script src="%PUBLIC_URL%js/js_min_all.js"></script>
<script src="%PUBLIC_URL%js/jquery-1.8.3.min.js"></script>
<script src="%PUBLIC_URL%js/codemirror/codemirror.js"></script>
<script src="%PUBLIC_URL%js/editormd/editormd.min.js"></script>
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>

View File

@ -213,13 +213,13 @@ class App extends Component {
<Provider store={store}>
<ConfigProvider locale={zhCN}>
<MuiThemeProvider theme={theme}>
<Accountnewprofile {...this.props}{...this.state} />
{/* <Accountnewprofile {...this.props}{...this.state} /> */}
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>
<AccountProfile {...this.props} {...this.state} />
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.ModalCancelsy} ModalshowCancelsy={this.ModalshowCancelsy} />
{/* <Notcompletedysl {...this.props} {...this.state}></Notcompletedysl> */}
{/* <Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl> */}
{/* <Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview> */}
{/* <AccountProfile {...this.props} {...this.state} /> */}
{/* <Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.ModalCancelsy} ModalshowCancelsy={this.ModalshowCancelsy} /> */}
<Router>
<Switch>
{/*项目*/}

View File

@ -64,8 +64,8 @@ export function initAxiosInterceptors(props) {
initOnlineOfflineListener()
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
var
proxy = "http://localhost:3000"
proxy = "https://testforgeplus.trustie.net"
// proxy = "http://localhost:3000"
proxy = "https://forgeplus.trustie.net"
const requestMap = {};
window.setfalseInRequestMap = function (keyName) {

View File

@ -427,7 +427,7 @@ class CoderRootDirectory extends Component {
width: "60%",
render: (text, item) =>
item.commit && item.commit.message ?
<span className="task-hide" style={{ display: "block", maxWidth: "670px" }} >
<span title={item.commit.message} className="task-hide" style={{ display: "block", maxWidth: "670px" }} >
{item.commit.message}
</span>
: ""

View File

@ -378,14 +378,12 @@ class MessageCount extends Component {
</div>
</div>
</div>
<div className="mt15">
{data.issue.description &&
data.issue.description.length > 0 ? (
this.commentCtx(data.issue.description)
) : (
<span className="color-grey-9 ml3 mr3">没有描述</span>
)}
</div>
{
data.issue.description ?
<div className="mt15">{this.commentCtx(data.issue.description)}</div>
:
<p className="color-grey-9 ml3 mr3 mt15">没有描述</p>
}
</div>
<div className="mt15">
{pr_status === 2 && (

View File

@ -52,12 +52,9 @@ class NewMilepost extends Component {
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/milestones.json`;
let time = undefined;
if (this.state.selectedValue === undefined) {
} else {
time = this.state.selectedValue.format("YYYY-MM-DD")
if (this.state.selectedValue) {
time = this.state.selectedValue.format("YYYY-MM-DD");
}
axios.post(url, {
...values,
project_id: projectsId,
@ -68,10 +65,8 @@ class NewMilepost extends Component {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${owner}/${projectsId}/milestones`);
}
}).catch(error => {
this.setState({ isSpin: false })
console.log(error);
})
}else{
this.setState({ isSpin: false })

View File

@ -1,82 +1,187 @@
import React, { Component } from 'react';
import {Link} from 'react-router-dom';
import React, { Component } from "react";
import { Link } from "react-router-dom";
import axios from "axios";
import {Popconfirm} from "antd";
class Attachment extends Component{
constructor(props){
import { Popconfirm, Modal, Spin } from "antd";
import Videos from "./videos";
class Attachment extends Component {
constructor(props) {
super(props);
this.state={
this.state = {
canDelete: false,
Deleted:[]
}
show_video: false,
video_url: undefined,
video_title: undefined,
video_id: undefined,
move_spin: false,
Deleted: [],
};
}
componentDidMount=()=>{
componentDidMount = () => {
this.getDetail();
}
};
getDetail=()=>{
getDetail = () => {
this.setState({
canDelete: this.props.canDelete
})
}
canDelete: this.props.canDelete,
});
};
show_video_modal = (item) => {
this.setState({
video_title: item.title,
move_spin: true,
video_id: item.id,
});
this.move_attachment(item.id, "preview");
};
hide_video_modal = () => {
const { video_id } = this.state;
this.setState({
video_title: undefined,
});
this.move_attachment(video_id, "close");
};
move_attachment = (id, status) => {
axios
.post(`/attachments/${id}/preview_attachment`, { status: status })
.then((result) => {
if (result) {
this.setState({
show_video: status === "preview",
video_url:
status === "preview"
? "https://forgeplus.trustie.net" + result.data.url
: undefined,
move_spin: false,
});
} else {
this.setState({
move_spin: false,
});
}
})
.catch((error) => {
this.setState({
move_spin: false,
});
console.log(error);
});
};
is_video = (name) => {
const video_names = ["mp4", "flv", "mkv", "3gp"];
return video_names.indexOf(name.split(".").pop()) > -1;
};
deleteAttachment = (id) => {
const url = `/attachments/${id}.json`
axios.delete(url, {
}).then((response) => {
if (response.data) {
if (response.data.status === 0) {
this.setState({
Deleted: this.state.Deleted.concat(id)
});
this.props.showNotification("附件删除成功")
}else{
this.props.showNotification(response.data.message)
const url = `/attachments/${id}.json`;
axios
.delete(url, {})
.then((response) => {
if (response.data) {
if (response.data.status === 0) {
this.setState({
Deleted: this.state.Deleted.concat(id),
});
this.props.showNotification("附件删除成功");
} else {
this.props.showNotification(response.data.message);
}
}
}
}).catch(function (error) {
console.log(error);
});
}
})
.catch(function (error) {
console.log(error);
});
};
render(){
const { Deleted , canDelete } = this.state;
const { attachments }= this.props
return(
render() {
const {
Deleted,
canDelete,
show_video,
video_url,
video_title,
move_spin,
} = this.state;
const { attachments } = this.props;
return (
<div>
{
attachments ?
<div className="attachmentsList mt5">
{
attachments.map((item,key)=>{
return(
<div key= {key} style={{display: (Deleted.length > 0 && Deleted.indexOf(item.id) !== -1) ? "none" : "block"}} className="pd510 attachment-list-div" >
<Link to={`${item.url}`} target="_blank" className="attachment-list-a">
{attachments ? (
<div className="attachmentsList mt5">
{attachments.map((item, key) => {
return (
<div
key={key}
style={{
display:
Deleted.length > 0 && Deleted.indexOf(item.id) !== -1
? "none"
: "block",
}}
className="pd510 attachment-list-div"
>
<Spin spinning={move_spin}>
{this.is_video(item.title) ? (
<a
onClick={() => this.show_video_modal(item)}
className="attachment-list-a"
>
<i className="iconfont icon-fujian mr8 paper-clip-color font-12"></i>
<span>{item.title}</span>
<span className="ml20">{item.filesize}</span>
</a>
) : (
<Link
to={`${item.url}`}
target="_blank"
className="attachment-list-a"
>
<i className="iconfont icon-fujian mr8 paper-clip-color font-12"></i>
<span>{item.title}</span>
<span className="ml20">{item.filesize}</span>
</Link>
{
canDelete ?
<Popconfirm placement="bottom" title={'您确定要删除附件吗'} okText="是" cancelText="否" onConfirm={()=>this.deleteAttachment(item.id)}>
<span className="attachment-list-delete fr" ><i className="iconfont icon-lajitong mr10 color-grey-9 font-14"></i></span>
</Popconfirm>
:
""
}
</div>
)}
)
})
}
</div>
:
""
}
{canDelete ? (
<Popconfirm
placement="bottom"
title={"您确定要删除附件吗"}
okText="是"
cancelText="否"
onConfirm={() => this.deleteAttachment(item.id)}
>
<span className="attachment-list-delete fr">
<i className="iconfont icon-lajitong mr10 color-grey-9 font-14"></i>
</span>
</Popconfirm>
) : (
""
)}
</Spin>
</div>
);
})}
</div>
) : (
""
)}
{show_video ? (
<Modal
title={video_title}
visible={true}
width={690}
footer={null}
onCancel={this.hide_video_modal}
>
<Videos video_url={video_url}></Videos>
</Modal>
) : (
""
)}
</div>
)
);
}
}
export default Attachment;
export default Attachment;

View File

@ -0,0 +1,13 @@
import React, { useEffect, useState } from "react";
import ReactPlayer from 'react-player'
function videos(video_url) {
const [VideUrl, setUrl] = useState(null); //用户的内容
useEffect(() => {
setUrl(video_url.video_url);
}, []);
return (
<ReactPlayer url={VideUrl} controls playing={false}/>
);
}
export default videos;

View File

@ -29,7 +29,7 @@ body>.-task-title {
width: 100%;
height:70px;
min-width: 1200px;
z-index: 1000;
z-index: 10000;
-moz-box-shadow: 0px 2px 10px 0px rgba(0,0,0,0.1);
background:rgba(255,255,255,1);
box-shadow:0px 2px 10px 0px rgba(0,0,0,0.1);

View File

@ -8,7 +8,6 @@ import './TPMIndex.css';
import LoginDialog from '../login/LoginDialog';
import AccountProfile from '../user/AccountProfile';
import AccountPhoneemail from '../user/AccountPhoneemail';
import cookies from 'react-cookies';
export function TPMIndexHOC(WrappedComponent) {
return class II extends React.Component {
@ -184,15 +183,16 @@ export function TPMIndexHOC(WrappedComponent) {
json[key] = value;
}
} while (arr);
return json;
};
hideLoginDialog = () => {
this.setState({
isRender: false,
isloginCancel: undefined
})
}
showLoginDialog = () => {
this.setState({
isRender: true,
@ -209,6 +209,7 @@ export function TPMIndexHOC(WrappedComponent) {
AccountProfiletype: false
})
}
showProfileCompleteDialog = () => {
this.dialogObj = {}
this.setState({