forked from Gitlink/forgeplus-react
Merge branch 'develop_new' into develop_educoder
# Conflicts: # src/forge/Head/Header.js # src/modules/tpm/TPMIndex.css # src/modules/tpm/TPMIndexHOC.js
This commit is contained in:
commit
29f25a585d
|
@ -17,6 +17,7 @@ import Releases from '../Component/Releases';
|
|||
import Contributors from '../Component/Contributors';
|
||||
import LanguagePower from '../Component/LanguagePower';
|
||||
import DrawerPanel from '../Component/DrawerPanel';
|
||||
import UpdateDescModal from './sub/UpdateDescModal';
|
||||
import Nodata from '../Nodata';
|
||||
|
||||
|
||||
|
@ -38,6 +39,9 @@ function CoderDepot(props){
|
|||
const [ isSpin , setIsSpin] = useState(true);
|
||||
const [ visible ,setVisible ] = useState(false);
|
||||
const [ mainFlag ,setMainFlag ] = useState(false);
|
||||
const [ openModal , setOpenModal ] = useState(false);
|
||||
const [ desc , setDesc ] = useState(undefined);
|
||||
const [ website , setWebsite ] = useState(undefined);
|
||||
|
||||
const owner = props.match.params.owner;
|
||||
const projectsId = props.match.params.projectsId;
|
||||
|
@ -47,6 +51,8 @@ function CoderDepot(props){
|
|||
useEffect(()=>{
|
||||
if(props.projectDetail){
|
||||
setProjectDetail(props.projectDetail);
|
||||
setDesc(props.projectDetail.description);
|
||||
setWebsite(props.projectDetail.website);
|
||||
}
|
||||
},[props])
|
||||
|
||||
|
@ -208,8 +214,20 @@ function CoderDepot(props){
|
|||
</Menu>
|
||||
</div>
|
||||
)
|
||||
function okUpdate(d,w){
|
||||
const url = `/${owner}/${projectsId}.json`;
|
||||
axios.put(url,{
|
||||
description:d,website:w
|
||||
}).then(result=>{
|
||||
if(result && result.data && result.data.id){
|
||||
setDesc(result.data.description);
|
||||
setWebsite(result.data.website);
|
||||
}
|
||||
})
|
||||
}
|
||||
return(
|
||||
<WhiteBack>
|
||||
<UpdateDescModal desc={desc} website={website} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
|
||||
<Spin spinning={isSpin}>
|
||||
{
|
||||
(dirInfo || fileInfo) &&
|
||||
|
@ -337,13 +355,15 @@ function CoderDepot(props){
|
|||
<ShortWidth>
|
||||
<Gap style={{paddingLeft:"30px"}}>
|
||||
<div className="panelmenu">
|
||||
<p className="font-18 color-grey-6 mb20" style={{lineHeight:"28px"}}>简介</p>
|
||||
<p className="font-14 color-grey-9 mb15" style={{lineHeight:"22px"}}>{projectDetail && projectDetail.content}</p>
|
||||
<FlexAJ className="font-18 color-grey-6 mb20" style={{lineHeight:"28px"}}>简介
|
||||
{projectDetail.permission && (projectDetail.permission==="Admin" || projectDetail.permission==="Owner") && <i onClick={()=>setOpenModal(true)} className="iconfont icon-anquanshezhi color-grey-9 font-15"></i>}
|
||||
</FlexAJ>
|
||||
{desc && <p className="font-14 color-grey-9 mb15 task-hide-2" style={{lineHeight:"22px",WebkitLineClamp:"4",textAlign:"justify"}}>{desc}</p>}
|
||||
{
|
||||
projectDetail && projectDetail.website &&
|
||||
website &&
|
||||
<p className="color-grey-6 df">
|
||||
<i className="iconfont icon-lianjie2 font-15 mr10 color-grey-9"></i>
|
||||
<span style={{wordBreak:"break-all",lineHeight:"20px",marginTop:"5px"}}>{projectDetail.website}</span>
|
||||
<span style={{wordBreak:"break-all",lineHeight:"20px",marginTop:"5px"}}>{website}</span>
|
||||
</p>
|
||||
}
|
||||
<p>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
import React , { forwardRef, useEffect } from 'react';
|
||||
import {Form , Modal , Input } from 'antd';
|
||||
import "./sub.scss";
|
||||
const { TextArea } = Input;
|
||||
function UpdateDescModal({form , visible , onCancel , onOk,desc,website}){
|
||||
const { getFieldDecorator, validateFields , setFieldsValue } = form;
|
||||
|
||||
useEffect(()=>{
|
||||
if(desc || website){
|
||||
setFieldsValue({
|
||||
website,desc
|
||||
})
|
||||
}
|
||||
},[desc,website])
|
||||
|
||||
function onSure(){
|
||||
validateFields((err,values)=>{
|
||||
if(!err){
|
||||
onCancel();
|
||||
onOk(values.desc,values.website)
|
||||
}
|
||||
})
|
||||
}
|
||||
return(
|
||||
<Modal
|
||||
title={"修改信息"}
|
||||
closable={false}
|
||||
visible={visible}
|
||||
centered
|
||||
onCancel={onCancel}
|
||||
onOk={onSure}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
width="400px"
|
||||
className={"descmodal"}
|
||||
>
|
||||
<Form>
|
||||
<Form.Item label="仓库描述">
|
||||
{getFieldDecorator("desc",{
|
||||
rules:[]
|
||||
})(
|
||||
<TextArea placeholder="仓库描述" rows={4} maxLength={200}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="website">
|
||||
{getFieldDecorator("website",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="website链接"/>
|
||||
)}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
export default Form.create()(forwardRef(UpdateDescModal));
|
|
@ -12,3 +12,12 @@
|
|||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
.descmodal{
|
||||
.ant-row.ant-form-item{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.ant-col.ant-form-item-label{
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
|
@ -226,7 +226,7 @@ class Setting extends Component {
|
|||
})(
|
||||
<TextArea
|
||||
placeholder="请输入仓库描述"
|
||||
style={{ height: "80px" }}
|
||||
style={{ height: "80px" }} maxLength={200}
|
||||
/>
|
||||
)}
|
||||
</Form.Item>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import NewHeader from '../../forge/Head/Header'
|
||||
import Header from '../../forge/Head/Header'
|
||||
import NewFooter from './NewFooter'
|
||||
import { downloadFile } from 'educoder'
|
||||
import axios from 'axios';
|
||||
|
@ -8,7 +8,6 @@ import './TPMIndex.css';
|
|||
import LoginDialog from '../login/LoginDialog';
|
||||
import AccountProfile from '../user/AccountProfile';
|
||||
import AccountPhoneemail from '../user/AccountPhoneemail';
|
||||
import EducoderAccount from '../../forge/Component/EducoderAccount';
|
||||
|
||||
export function TPMIndexHOC(WrappedComponent) {
|
||||
return class II extends React.Component {
|
||||
|
@ -29,9 +28,6 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
dataquerys: {},
|
||||
isloginCancel: undefined,
|
||||
mygetHelmetapi: null,
|
||||
giteaVisible:false,
|
||||
email:undefined,
|
||||
is_sync_pwd:undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,15 +165,6 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
if (this.props.match.path === "/" && response.data.login) {
|
||||
this.props.history.push(`/users/${response.data.login}`);
|
||||
}
|
||||
if(response.data && response.data.login){
|
||||
if(!response.data.has_gitea_user || (response.data.has_gitea_user && !response.data.is_sync_pwd)){
|
||||
this.setState({
|
||||
giteaVisible:true,
|
||||
email:response.data.email,
|
||||
is_sync_pwd:response.data.is_sync_pwd
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
|
@ -358,27 +345,8 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
}
|
||||
}
|
||||
|
||||
onOk =(values)=>{
|
||||
let url = `/accounts/gitea_register.json`;
|
||||
const { email , current_user , is_sync_pwd } = this.state;
|
||||
if(email && !is_sync_pwd){
|
||||
url = `/users/change_password.json`;
|
||||
}
|
||||
axios.post(url,{
|
||||
login:current_user && current_user.login,
|
||||
...values
|
||||
}).then(result=>{
|
||||
if(result && result.data && result.data.status === 0){
|
||||
this.setState({
|
||||
giteaVisible:false,
|
||||
email:undefined
|
||||
})
|
||||
window.location.reload();
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
render() {
|
||||
let { email , giteaVisible , Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state;
|
||||
let { Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state;
|
||||
const common = {
|
||||
|
||||
showLoginDialog: this.showLoginDialog,
|
||||
|
@ -404,7 +372,6 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
};
|
||||
return (
|
||||
<div className="indexHOC">
|
||||
<EducoderAccount visible={giteaVisible} email={email} onOk={this.onOk}/>
|
||||
{isRender === true ? <LoginDialog
|
||||
Modifyloginvalue={() => this.hideLoginDialog()}
|
||||
{...this.props}
|
||||
|
@ -424,7 +391,7 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
{...this.state}
|
||||
{...this.dialogObj}
|
||||
/> : ""}
|
||||
<NewHeader {...this.state} {...this.props}></NewHeader>
|
||||
<Header {...this.state} {...this.props}></Header>
|
||||
<Spin spinning={this.state.globalLoading} delay={0} className="globalSpin"
|
||||
size="large"
|
||||
tip={this._gLoadingTip || "加载中..."}
|
||||
|
@ -438,6 +405,7 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
>
|
||||
</WrappedComponent>
|
||||
}
|
||||
|
||||
</div>
|
||||
</Spin>
|
||||
<NewFooter
|
||||
|
|
Loading…
Reference in New Issue