diff --git a/package-lock.json b/package-lock.json index d3b23b756..88b71ed39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11299,7 +11299,7 @@ "dependencies": { "yallist": { "version": "4.0.0", - "resolved": "http://173.15.15.82:8081/repository/npm-all/yallist/-/yallist-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true } @@ -15441,7 +15441,7 @@ }, "react-copy-to-clipboard": { "version": "5.1.0", - "resolved": "https://registry.npmmirror.com/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz", + "resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz", "integrity": "sha512-k61RsNgAayIJNoy9yDsYzDe/yAZAzEbEgcz3DZMhF686LEyukcE1hzurxe85JandPUG+yTfGVFzuEw3xt8WP/A==", "requires": { "copy-to-clipboard": "^3.3.1", @@ -15450,7 +15450,7 @@ "dependencies": { "prop-types": { "version": "15.8.1", - "resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "requires": { "loose-envify": "^1.4.0", diff --git a/src/forge/Component/FileName/index.jsx b/src/forge/Component/FileName/index.jsx index 9ae8a6940..2f3ce0b1e 100644 --- a/src/forge/Component/FileName/index.jsx +++ b/src/forge/Component/FileName/index.jsx @@ -50,8 +50,12 @@ onChangeFile,addonBefore , name , empty , onEmpty function changeValue(e){ const value = e.target.value; + console.log(value); if(value){ - if(value.indexOf("/")>-1){ + if(value === "/"){ + setValue(undefined); + } + else if(value.indexOf("/")>-1){ let a = value.split("/"); let b = newUrl; let c = b.concat(a[0]); diff --git a/src/forge/Issues/Component/comments/list.jsx b/src/forge/Issues/Component/comments/list.jsx index b62902c45..b59a1ec8a 100644 --- a/src/forge/Issues/Component/comments/list.jsx +++ b/src/forge/Issues/Component/comments/list.jsx @@ -110,27 +110,17 @@ function IssueCommentList(props){ return(
{/* 全部 / 评论 / 操作日志 */} -
- {setSpin(true);setPage(1);setCategory(e.target.value)}} value={category}> - 评论{journalsCount} - 操作日志 - 全部 - +
0 && 'pb15'}`}> +
+ {setSpin(true);setPage(1);setCategory(e.target.value);history.push(history.pathname)}} value={category}> + 评论{journalsCount} + 操作日志 + 全部 + +
- {/* 添加评论 */} - {category !== 'operate' &&
- {login ? showEdit === 1 ? :
- -
- {setShowEdit(1)}}> - - -
-
:
- {/* 未登录用户 */} - {showLoginDialog()}}>登录并参与评论与回复 -
} -
} + {/* 评论快速入口-仅有评论且登录时展示 */} + {login && category !== 'operate' && journalsCount > 0 &&
0 && 'pt15'}`}>
点击添加评论
} {/* 评论/操作日志 展示列表 */}
@@ -232,8 +222,20 @@ function IssueCommentList(props){ {totalCount>limit &&
setPage(page)}/>
} - {/* 无数据 新建第一条评论时暂无数据隐藏 用户未登录隐藏*/} - {journals && !journals.length && showEdit !== 1 && login && } + {/* 添加评论 */} + {category !== 'operate' &&
+ {login ? showEdit === 1 ? :
+ +
+ {setShowEdit(1)}}> + + +
+
:
+ {/* 未登录用户 */} + {showLoginDialog()}}>登录并参与评论与回复 +
} +
}
) } diff --git a/src/forge/Issues/Component/comments/list.scss b/src/forge/Issues/Component/comments/list.scss index 5ab7622e5..0d54ede82 100644 --- a/src/forge/Issues/Component/comments/list.scss +++ b/src/forge/Issues/Component/comments/list.scss @@ -115,6 +115,7 @@ position: relative; top: -6px; padding: 10px 15px 16px; + width: 0; &::before{ content: ''; display: block; @@ -192,4 +193,12 @@ } .paginationIssueComment{ text-align: center; +} +.gotoComment{ + background-color:rgba(241, 243, 252, 0.55); + border-radius:4px; + color: rgba(172, 176, 191, 1); + padding: 8px 20px; + margin-top: -10px; + &>a{color: rgba(70, 106, 255, 1);} } \ No newline at end of file diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 228f75c67..b0bb7fcba 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -49,6 +49,7 @@ function CoderDepot(props){ const [ desc , setDesc ] = useState(undefined); const [ website , setWebsite ] = useState(undefined); const [ lesson_url , setLessonUrl ] = useState(undefined); + const [ topics, setTopics] = useState(undefined); const [ readme , setReadme ] = useState(undefined); const [ defaultBranch , setDefaultBranch ] = useState(undefined); const [ editReadme , setEditReadme ] = useState(false); @@ -94,6 +95,7 @@ function CoderDepot(props){ useEffect(()=>{ if(details){ setProjectDetail(details); + setTopics(details.topics); setDesc(details.description); setWebsite(details.website); setLessonUrl(details.lesson_url); @@ -343,15 +345,17 @@ function CoderDepot(props){ showNotification={props.showNotification}/> ) // 确认修改简介、website、实践课程链接 - function okUpdate(d,w,l){ + function okUpdate(d,w,l, projectTopicNames){ const url = `/${owner}/${projectsId}.json`; axios.put(url,{ - description:d,website:w || "",lesson_url:l||"" + description:d,website:w || "",lesson_url:l||"", + project_topic_names: projectTopicNames }).then(result=>{ if(result && result.data && result.data.id){ setDesc(result.data.description); setWebsite(result.data.website); setLessonUrl(result.data.lesson_url); + setTopics(result.data.topics); } }) } @@ -382,7 +386,7 @@ function CoderDepot(props){ const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin)); return( - setOpenModal(false)} onOk={okUpdate}/> + setOpenModal(false)} onOk={okUpdate}/> { (dirInfo || fileInfo) && @@ -586,6 +590,10 @@ function CoderDepot(props){ } {desc &&

{desc}

} + {/* 项目标签 */} + {topics &&
+ {topics.map(item=>{item.name})} +
} { website &&
diff --git a/src/forge/Main/Index.scss b/src/forge/Main/Index.scss index a14b38e98..eb133fbf2 100644 --- a/src/forge/Main/Index.scss +++ b/src/forge/Main/Index.scss @@ -529,4 +529,22 @@ } .readmeFile p[align=center]{ white-space: normal; +} +// 项目标签 +.projectHomeTopics{ + display: flex; + flex-wrap: wrap; + &.myProList .proHomeTopic{ + background-color:#f3f8ff; + color:#4c5b76; + } + .proHomeTopic{ + background-color: #eff2ff; + border-radius: 4px; + max-width: 158px; + padding: 0 10px; + height: 24px; + line-height: 24px; + color: $primary-color; + } } \ No newline at end of file diff --git a/src/forge/Main/IndexItem.js b/src/forge/Main/IndexItem.js index 39c9342a0..efd3fc3b6 100644 --- a/src/forge/Main/IndexItem.js +++ b/src/forge/Main/IndexItem.js @@ -6,7 +6,7 @@ import { Link } from 'react-router-dom'; import '../css/index.scss'; import Nodata from '../Nodata'; import './list.scss'; -import img_parise from '../Images/parise.png'; +import './Index.scss'; class IndexItem extends Component { TurnToDetail = (login, url) => { @@ -69,7 +69,10 @@ class IndexItem extends Component {

{item.description}

- + {/* 项目标签 */} + {item.topics &&
+ {item.topics.map(topic=>{topic.name})} +
}
{item.last_update_time ? {item.time_ago} : ""} diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 6635bb4fc..719e21a5c 100644 --- a/src/forge/Main/projecthome/Index.jsx +++ b/src/forge/Main/projecthome/Index.jsx @@ -93,7 +93,7 @@ function Index() { style={{width:"300px"}} allowClear /> - 更多 + 更多
@@ -110,20 +110,24 @@ function Index() { : - + }
- {i.author && i.author.name}/{i.name} + {i.author && i.author.name}/{i.name} {i.praises_count > 0 ? {i.praises_count} :"" } {i.forked_count > 0 ? {i.forked_count}:""}
{i.description}
+ {/* 项目标签 */} + {i.topics &&
+ {i.topics.map(item=>{item.name})} +
}
{i.category && i.category.id ? {i.category.name} :"" } - {i.language && i.language.id ? {i.language.name} :""} + {i.language && i.language.id ? {i.language.name} :""} 更新于{i.time_ago}
diff --git a/src/forge/Main/projecthome/Index.scss b/src/forge/Main/projecthome/Index.scss index fd4b604e0..93528abad 100644 --- a/src/forge/Main/projecthome/Index.scss +++ b/src/forge/Main/projecthome/Index.scss @@ -439,8 +439,10 @@ } .language{ position: relative; - padding-left: 11px; - &::before{ + &.hasCate{ + padding-left: 11px; + } + &.hasCate::before{ position: absolute; content: ""; width: 1px; @@ -558,4 +560,18 @@ } } } +} +.proListTopics{ + display: flex; + flex-wrap: wrap; + .proListTopic{ + background-color:#f3f8ff; + border-radius: 4px; + max-width: 158px; + padding: 0 10px; + height: 24px; + line-height: 24px; + color: #4c5b76; + margin-bottom: 5px !important; + } } \ No newline at end of file diff --git a/src/forge/Main/sub/UpdateDescModal.jsx b/src/forge/Main/sub/UpdateDescModal.jsx index 902f2f150..f0546bcee 100644 --- a/src/forge/Main/sub/UpdateDescModal.jsx +++ b/src/forge/Main/sub/UpdateDescModal.jsx @@ -1,9 +1,21 @@ import React , { forwardRef, useEffect } from 'react'; -import {Form , Modal , Input } from 'antd'; +import {Form , Modal , Input, Select } from 'antd'; import "./sub.scss"; +import axios from 'axios'; +import { useState } from 'react'; const { TextArea } = Input; -function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url}){ +function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url, topicsInfo}){ const { getFieldDecorator, validateFields , setFieldsValue } = form; + const [topics, setTopics] = useState(undefined); + + useEffect(()=>{ + // 获取所有的项目标签 + axios.get(`/v1/project_topics`).then(res=>{ + if(res && res.data){ + setTopics(res.data.project_topics); + } + }) + }, []) useEffect(()=>{ if(desc || website){ @@ -17,10 +29,22 @@ function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_u validateFields((err,values)=>{ if(!err){ onCancel(); - onOk(values.desc,values.website,values.lesson_url) + onOk(values.desc,values.website,values.lesson_url, values.project_topic_names) } }) } + + // 校验项目标签 + function checkTopics(rule, value, callback){ + const boolLength = value.filter(item=>item.length > 20); + if(value.length > 5){ + callback("最多创建5个标签"); + }else if(boolLength.length){ + callback("每个标签最多支持20个汉字"); + } + callback(); + } + return(
@@ -42,6 +67,16 @@ function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_u