diff --git a/package-lock.json b/package-lock.json index f7e2271d7..1cb3733d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14030,13 +14030,13 @@ }, "qr.js": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/qr.js/download/qr.js-0.0.0.tgz", "integrity": "sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8=" }, "qrcode.react": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/qrcode.react/-/qrcode.react-1.0.0.tgz", - "integrity": "sha512-jBXleohRTwvGBe1ngV+62QvEZ/9IZqQivdwzo9pJM4LQMoCM2VnvNBnKdjvGnKyDZ/l0nCDgsPod19RzlPvm/Q==", + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/qrcode.react/download/qrcode.react-1.0.1.tgz", + "integrity": "sha1-KDS7UOXidf/lr2kG7/FTkf6eOKU=", "requires": { "loose-envify": "^1.4.0", "prop-types": "^15.6.0", diff --git a/package.json b/package.json index 1df95913c..128ff3a7a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "postcss-loader": "2.0.8", "promise": "8.0.1", "prop-types": "^15.6.1", - "qrcode.react": "^1.0.0", + "qrcode.react": "^1.0.1", "qs": "^6.9.3", "quill": "^1.3.7", "quill-delta-to-html": "^0.11.0", diff --git a/src/App.js b/src/App.js index 65a223535..556d5c4d3 100644 --- a/src/App.js +++ b/src/App.js @@ -205,7 +205,7 @@ class App extends Component { this.Modifyloginvalue()}> - + {/*项目*/} diff --git a/src/AppConfig.js b/src/AppConfig.js index d674d6ca0..034612ece 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) { // 判断网络是否连接 initOnlineOfflineListener(); - var proxy = "http://192.168.1.37:3000"; + var proxy = "https://testforgeplus.trustie.net"; //响应前的设置 axios.interceptors.request.use( config => { diff --git a/src/forge/Component/Component.scss b/src/forge/Component/Component.scss index 646061378..f34209bf0 100644 --- a/src/forge/Component/Component.scss +++ b/src/forge/Component/Component.scss @@ -205,17 +205,33 @@ li.ant-menu-item{ @media screen and (max-width: 1920px){ .-task-sidebar{ - right:240px; + right:220px; } } -@media screen and (max-width: 1500px){ +@media screen and (max-width: 1750px){ .-task-sidebar{ - right:100px; + right:160px; + } +} +@media screen and (max-width: 1650px){ + .-task-sidebar{ + right:115px; + } +} +@media screen and (max-width: 1550px){ + .-task-sidebar{ + right:90px; + } +} +@media screen and (max-width: 1450px){ + .-task-sidebar{ + right:45px; } } @media screen and (max-width: 1200px){ .-task-sidebar{ right:0px; + display: none; } } .-task-sidebar>div { @@ -246,6 +262,9 @@ li.ant-menu-item{ .helpBox{ width: 260px; z-index: 103; + &.shareContent{ + width: 200px; + } .ant-popover-inner-content{ padding:0px; } @@ -281,6 +300,17 @@ li.ant-menu-item{ } } } + .shareUl{ + padding:10px 0px; + display: flex; + align-items: center; + .titlecontent{ + margin-right: 20px; + } + li > i{ + font-size: 32px!important; + } + } } diff --git a/src/forge/Component/SiderBar.js b/src/forge/Component/SiderBar.js index 88acbc399..8267959ba 100644 --- a/src/forge/Component/SiderBar.js +++ b/src/forge/Component/SiderBar.js @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Popover , Tooltip } from 'antd'; import './Component.scss'; import axios from 'axios'; +import ShareModal from './SiderBarShareModal'; const $ = window.$; @@ -21,6 +22,7 @@ $(window).scroll(function () { function SiderBar() { const [ data , setData ] = useState([]); + const [ visible , setVisible ] = useState(false); useEffect(()=>{ getFAQ(); @@ -48,30 +50,40 @@ function SiderBar() { } + + function shareContent(){ + return
+
    +

    分享到

    +
  • setVisible(true)}>
  • +
+
+ } return (
- { - data && data.length > 0 && (data[0] && data[0].question) ? - -
- -
-
- :"" - } - {/*
- -
-
- - - -
*/} -
- - - -
+ setVisible(false)}/> + { + data && data.length > 0 && (data[0] && data[0].question) ? + +
+ +
+
+ :"" + } + {/*
+ +
*/} + +
+ +
+
+
+ + + +
) } diff --git a/src/forge/Component/SiderBarShareModal.jsx b/src/forge/Component/SiderBarShareModal.jsx new file mode 100644 index 000000000..aa8db379e --- /dev/null +++ b/src/forge/Component/SiderBarShareModal.jsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { Modal } from 'antd'; +import QRCode from 'qrcode.react'; + +function SiderBarShareModal({visible,urlValue,onCancel}) { + return( + +
+ {urlValue &&} +

打开微信“扫一扫”,点击右上角菜单,即可将网页分享至朋友圈

+
+
+ ) +} +export default SiderBarShareModal; \ No newline at end of file diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index f446ebb4f..9b13e8c3d 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -45,19 +45,22 @@ function CoderDepot(props){ const [ desc , setDesc ] = useState(undefined); const [ website , setWebsite ] = useState(undefined); const [ lesson_url , setLessonUrl ] = useState(undefined); + const [ readme , setReadme ] = useState(undefined) const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; const branchName = props.match.params.branchName; + const details = props.projectDetail; let pathname = props.history.location.pathname; + useEffect(()=>{ - if(props.projectDetail){ - setProjectDetail(props.projectDetail); - setDesc(props.projectDetail.description); - setWebsite(props.projectDetail.website); - setLessonUrl(props.projectDetail.lesson_url); + if(details){ + setProjectDetail(details); + setDesc(details.description); + setWebsite(details.website); + setLessonUrl(details.lesson_url); } - },[props]) + },[details]) useEffect(()=>{ if(treeValue){ @@ -67,18 +70,19 @@ function CoderDepot(props){ } },[treeValue]) + useEffect(()=>{ - if (pathname && projectDetail){ + if (projectsId && owner){ if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) { let url = pathname.split(`/tree/${branchName}/`)[1]; setTreeValue(url); getFileInfo(url,branchName); }else{ setTreeValue(undefined); - getDirInfo(branchName ||projectDetail.default_branch); + getDirInfo(branchName ||(projectDetail && projectDetail.default_branch)); } } - },[pathname,projectDetail]) + },[projectsId,owner,pathname]) // 获取主目录列表 function getDirInfo(branch){ @@ -98,6 +102,7 @@ function CoderDepot(props){ setLastCommitAuthor(c && c.committer); setMainFlag(true); setReadOnly(true); + setReadme(result.data.readme); } setTimeout(function(){setIsSpin(false);},500); }).catch(error=>{setIsSpin(false);}) @@ -373,7 +378,7 @@ function CoderDepot(props){ (dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? :"" } {/* readme文件显示(显示文件详情时不显示readme文件) */} - { dirInfo && (projectDetail && projectDetail.readme) ? :"" } + { dirInfo && readme ? :"" } { diff --git a/src/forge/Main/CoderDepotReadme.jsx b/src/forge/Main/CoderDepotReadme.jsx index da1435d55..e7e9826e3 100644 --- a/src/forge/Main/CoderDepotReadme.jsx +++ b/src/forge/Main/CoderDepotReadme.jsx @@ -6,20 +6,25 @@ const $ = window.$; function CoderDepotReadme({ operate , history , readme , ChangeFile }){ const [ menuList ,setMenuList ] = useState(undefined); + const [ content ,setContent ] = useState(undefined); useEffect(()=>{ if(readme && readme.content){ - let path = history.location.pathname; - const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) { - const anchor = el.id; - const level = el.tagName.replace("H", ""); - const href = `#${anchor}`; - return { href:`${path}${href}`,text:el.textContent , level:level } - }); - setMenuList(items); + setContent(readme.content); } },[readme]) + useEffect(()=>{ + let path = history.location.pathname; + const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) { + const anchor = el.id; + const level = el.tagName.replace("H", ""); + const href = `#${anchor}`; + return { href:`${path}${href}`,text:el.textContent , level:level } + }); + setMenuList(items); + },[content]) + function menu(){ if(menuList && menuList.length > 0){ let hash = history.location.hash; @@ -54,7 +59,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){ }
- +
) diff --git a/src/forge/Merge/Index.scss b/src/forge/Merge/Index.scss new file mode 100644 index 000000000..936b868f8 --- /dev/null +++ b/src/forge/Merge/Index.scss @@ -0,0 +1,21 @@ +.i_open{ + color: #28BD6C!important; +} +.i_merged{ + color: #4C9ED3!important; +} +.i_closed{ + color: #FA6400!important; +} +.pr_tags_open{ + border:1px solid #28BD6C; + color: #28BD6C; +} +.pr_tags_merged{ + border:1px solid #4C9ED3; + color: #4C9ED3; +} +.pr_tags_closed{ + border:1px solid #FA6400; + color: #FA6400; +} \ No newline at end of file diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index 0873f5da9..abf713224 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -49,10 +49,12 @@ class MergeItem extends Component { const renderList = () => { if (issues && issues.length > 0) { return issues.map((item, key) => { + let status = item.pull_request_staus; return (

+ {item.name} - - {item.pull_request_staus === "merged" + + {status === "merged" ? "已合并" - : item.pull_request_staus === "closed" + : status === "closed" ? "已拒绝" : "开启的"} diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 85333aaf3..9c526d6da 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -241,6 +241,34 @@ class MessageCount extends Component { ) } + // 点击按钮复制功能 + jsCopy = () => { + const copyEle = document.querySelector('#descContent') // 获取要复制的节点 + const range = document.createRange(); // 创造range + window.getSelection().removeAllRanges(); //清除页面中已有的selection + range.selectNode(copyEle); // 选中需要复制的节点 + window.getSelection().addRange(range); // 执行选中元素 + document.execCommand("Copy"); // 执行copy操作 + } + + mergeabledMes=()=>{ + return( +

+

该分支存在冲突,无法自动合并,你可以尝试通过如下命令手动合并

+ this.jsCopy()}> +
+ ) + } + mergeabledDesc=(base,head)=>{ + return( +
    +
  • git fetch origin
  • +
  • git checkout -b {`${base}`} origin/{`${base}`}
  • +
  • git merge {`${head}`}
  • +
+ ) + } + render() { const { projectsId, mergeId , owner } = this.props.match.params; @@ -323,7 +351,6 @@ class MessageCount extends Component { to={`/projects/${owner}/${projectsId}/tree/${data.pull_request.base}`} className="ver-middle" > - {/* {data.pull_request.is_fork ? data.pull_request.base : `${data.pull_request.pull_request_user}:${data.pull_request.base}`} */} {data.issue.project_author_name}:{data.pull_request.base} @@ -388,12 +415,6 @@ class MessageCount extends Component {
- {/* - this.setCopyVisible(e)}> - 复制 - - 下载为 - */} {operate && (