forked from Gitlink/forgeplus-react
Merge branch 'gitlink_orz' into gitlink_chain
This commit is contained in:
commit
6b869ddcba
|
|
@ -5,9 +5,7 @@ import { getUploadActionUrl } from 'educoder';
|
|||
function UploadImage({ getImage , url, getImageId }){
|
||||
const [ imageUrl , setImageUrl ] = useState(undefined);
|
||||
useEffect(()=>{
|
||||
if(url){
|
||||
setImageUrl(url);
|
||||
}
|
||||
setImageUrl(url);
|
||||
},[url])
|
||||
|
||||
function getBase64(img, callback) {
|
||||
|
|
@ -33,7 +31,6 @@ function UploadImage({ getImage , url, getImageId }){
|
|||
// 上传完成后
|
||||
function handleChange(info){
|
||||
if(info && info.file && info.file.status === "done"){
|
||||
console.log('info', info);
|
||||
getImageId && getImageId(info.file.response.id);
|
||||
getBase64(info.file.originFileObj, imageUrl =>
|
||||
setImageUrl(imageUrl)
|
||||
|
|
@ -49,6 +46,7 @@ function UploadImage({ getImage , url, getImageId }){
|
|||
action={getUploadActionUrl()}
|
||||
beforeUpload={beforeUpload}
|
||||
onChange={handleChange}
|
||||
accept="image/*"
|
||||
>
|
||||
{
|
||||
imageUrl ?
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ function List(props){
|
|||
<i className="iconfont icon-zuzhijieshao mr4"></i>
|
||||
<span className="font-17">组织介绍</span>
|
||||
</p>
|
||||
<div style={{color:"#4c5876",lineHeight:"30px",wordBreak:"break-all",textAlign:"justify"}}>{organizeDetail.description}</div>
|
||||
<div style={{color:"#4c5876",lineHeight:"30px",wordBreak:"break-all",textAlign:"justify"}}>{organizeDetail.memo}</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ const Member = Loadable({
|
|||
loader: () => import("./TeamSettingMember"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Index = Loadable({
|
||||
loader: () => import("./TeamSettingPage"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Common = Loadable({
|
||||
loader: () => import("./TeamSettingCommon"),
|
||||
loading: Loading,
|
||||
|
|
@ -39,17 +43,20 @@ export default (( props )=>{
|
|||
function returnActive (pathname){
|
||||
let a = 0;
|
||||
if(pathname === `/${OIdentifier}/setting/member`){
|
||||
a = 2;
|
||||
}else if(pathname === `/${OIdentifier}/setting/index`){
|
||||
a = 1;
|
||||
}else if(pathname === `/${OIdentifier}/setting/group`){
|
||||
a = 2;
|
||||
}else if(pathname === `/${OIdentifier}/setting/hooks`){
|
||||
a = 3;
|
||||
}else if(pathname === `/${OIdentifier}/setting/hooks`){
|
||||
a = 4;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
const active = returnActive(pathname);
|
||||
const array = {list:[
|
||||
{name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/setting`},
|
||||
{name:'组织首页管理',icon:"icon-huabanfuben",href:`/${OIdentifier}/setting/index`},
|
||||
{name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/setting/member`},
|
||||
{name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/setting/group`},
|
||||
// {name:'管理web钩子',icon:"icon-zhongqingdianxinicon10",href:`/${OIdentifier}/setting/hooks`}
|
||||
|
|
@ -71,6 +78,12 @@ export default (( props )=>{
|
|||
<Hooks {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:OIdentifier/setting/index"
|
||||
render={() => (
|
||||
<Index {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:OIdentifier/setting/group"
|
||||
render={() => (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
import React, { useEffect, useState , forwardRef } from 'react';
|
||||
import { Button, Form , Input } from 'antd';
|
||||
import Title from '../../Component/Title';
|
||||
import MDEditor from "../../../modules/tpm/challengesnew/tpm-md-editor";
|
||||
import UploadImage from '../Component/UploadImage';
|
||||
import {getImageUrl } from 'educoder';
|
||||
import axios from 'axios';
|
||||
|
||||
export default Form.create()(forwardRef((props)=>{
|
||||
const { form , organizeDetail } = props;
|
||||
const OIdentifier = props.match.params.OIdentifier;
|
||||
const { getFieldDecorator , validateFields , setFieldsValue , getFieldsValue} = form;
|
||||
const [ content , setContent ] = useState("");
|
||||
const [ imageUrl , setImageUrl ] = useState("");
|
||||
const [ imageId , setImageId ] = useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
let url = imageId ? getImageUrl(`/api/attachments/${imageId}`) :"";
|
||||
setImageUrl(url);
|
||||
},[imageId])
|
||||
|
||||
useEffect(()=>{
|
||||
if(organizeDetail){
|
||||
setContent(organizeDetail.memo);
|
||||
setFieldsValue({
|
||||
...organizeDetail
|
||||
})
|
||||
setImageId(organizeDetail.news_banner_id);
|
||||
}
|
||||
},[organizeDetail])
|
||||
|
||||
|
||||
function onChangeDesc(v){
|
||||
setContent(v);
|
||||
}
|
||||
|
||||
function save(){
|
||||
validateFields((error,values)=>{
|
||||
if(!error){
|
||||
const url = `/organizations/${OIdentifier}/update_other.json`;
|
||||
axios.post(url,{
|
||||
...values,
|
||||
memo:content,
|
||||
news_banner_id:imageId
|
||||
}).then(result=>{
|
||||
if(result){
|
||||
props.showNotification("组织首页更新成功!");
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
})
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
<Title>
|
||||
<span>组织首页管理</span>
|
||||
</Title>
|
||||
|
||||
<Form style={{padding:"20px 30px 30px 30px"}}>
|
||||
<p>新闻动态图片</p>
|
||||
<UploadImage url={imageUrl} getImageId={(id)=>{setImageId(id);}}/>
|
||||
<p><a className="color-blue" onClick={()=>setImageId("")}>删除</a></p>
|
||||
<Form.Item label="新闻动态原文链接">
|
||||
{getFieldDecorator("news_url",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="请输入新闻动态原文链接" maxLength={50}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="新闻动态标题">
|
||||
{getFieldDecorator("news_title",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="请输入新闻动态标题" maxLength={45}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="新闻动态内容">
|
||||
{getFieldDecorator("news_content",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="请输入新闻动态内容" maxLength={200}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<p class="mt30">组织介绍</p>
|
||||
<MDEditor
|
||||
placeholder={"请输入组织介绍"}
|
||||
height={300}
|
||||
mdID={"teamdescription"}
|
||||
initValue={content}
|
||||
onChange={onChangeDesc}
|
||||
></MDEditor>
|
||||
<Button type="primary" onClick={save}>确定</Button>
|
||||
</Form>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
)
|
||||
Loading…
Reference in New Issue