diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 02012bb83..7570bbc2e 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -42,6 +42,7 @@ function CoderDepot(props){ const [ openModal , setOpenModal ] = useState(false); const [ desc , setDesc ] = useState(undefined); const [ website , setWebsite ] = useState(undefined); + const [ lesson_url , setLessonUrl ] = useState(undefined); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; @@ -52,6 +53,7 @@ function CoderDepot(props){ setProjectDetail(props.projectDetail); setDesc(props.projectDetail.description); setWebsite(props.projectDetail.website); + setLessonUrl(props.projectDetail.lesson_url); } },[props]) @@ -213,20 +215,21 @@ function CoderDepot(props){ ) - function okUpdate(d,w){ + function okUpdate(d,w,l){ const url = `/${owner}/${projectsId}.json`; axios.put(url,{ - description:d,website:w + description:d,website:w,lesson_url:l }).then(result=>{ if(result && result.data && result.data.id){ setDesc(result.data.description); setWebsite(result.data.website); + setLessonUrl(result.data.lesson_url); } }) } return( - setOpenModal(false)} onOk={okUpdate}/> + setOpenModal(false)} onOk={okUpdate}/> { (dirInfo || fileInfo) && @@ -371,7 +374,7 @@ function CoderDepot(props){ website &&

- {website} + {website}

}

@@ -390,6 +393,14 @@ function CoderDepot(props){

} + { + lesson_url && +
+ +

实践课程

+ {lesson_url} +
+ } {/* 发布 */} { projectDetail && projectDetail.release_versions && diff --git a/src/forge/Main/sub/UpdateDescModal.jsx b/src/forge/Main/sub/UpdateDescModal.jsx index a2489bca8..766e18dd3 100644 --- a/src/forge/Main/sub/UpdateDescModal.jsx +++ b/src/forge/Main/sub/UpdateDescModal.jsx @@ -2,13 +2,13 @@ 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}){ +function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url}){ const { getFieldDecorator, validateFields , setFieldsValue } = form; useEffect(()=>{ if(desc || website){ setFieldsValue({ - website,desc + website,desc,lesson_url }) } },[desc,website]) @@ -17,7 +17,7 @@ function UpdateDescModal({form , visible , onCancel , onOk,desc,website}){ validateFields((err,values)=>{ if(!err){ onCancel(); - onOk(values.desc,values.website) + onOk(values.desc,values.website,values.lesson_url) } }) } @@ -49,6 +49,13 @@ function UpdateDescModal({form , visible , onCancel , onOk,desc,website}){ )} + + {getFieldDecorator("lesson_url",{ + rules:[] + })( + + )} + )