From 2f25643fcce53f8af4bb32505fee3b9372dc64b4 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 22 Dec 2021 18:29:23 +0800 Subject: [PATCH] issue-2021-12-22 --- src/common/UrlTool.js | 33 ++++++++++++++++ src/common/educoder.js | 3 +- src/common/marked.js | 1 - src/forge/Branch/Select.jsx | 4 +- src/forge/Component/DrawerPanel.jsx | 7 +--- src/forge/DevOps/Dispose/List.jsx | 7 +--- src/forge/Main/CoderDepot.jsx | 30 +++------------ src/forge/Main/CoderRootBranch.js | 7 +--- src/forge/Main/Diff.jsx | 6 --- src/forge/Main/Index.js | 40 ++++++++++---------- src/forge/Main/tree/Index.jsx | 9 +---- src/forge/Merge/MergeItem.js | 9 +---- src/forge/Merge/MessageCount.js | 9 +---- src/forge/Newfile/UserSubmitComponent.js | 14 +------ src/forge/Order/order.js | 4 +- src/forge/SecuritySetting/Index.jsx | 11 ++++++ src/forge/Team/Setting/TeamSettingMember.jsx | 19 ++-------- src/forge/js/index.js | 2 +- src/forge/users/GeneralView/Activity.jsx | 15 +++++++- src/forge/users/Material/Index.jsx | 14 +++---- 20 files changed, 111 insertions(+), 133 deletions(-) diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index f1800a75..c5279913 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -250,3 +250,36 @@ export function publicSearchs(Placeholder,onSearch,onInputs,onChanges,loadings) allowClear={true} >) } + + + +export function turnbar(str){ + let s = str; + if(s && s.length>0){ + if(s.indexOf("%")>-1){ + s = s.replaceAll('%','55'); + } + if(s.indexOf("#")>-1){ + s = s.replaceAll('#','%23'); + } + if(s.indexOf("/")>-1){ + s = s.replaceAll('/','%2F'); + } + } + return s; +} +export function returnbar(str){ + let s = str; + if(s && s.length>0){ + if(str.indexOf("55")>-1){ + s = s.replaceAll('55','%'); + } + if(s.indexOf("%23")>-1){ + s = s.replaceAll('%23','#'); + } + if(s.indexOf("%2F")>-1){ + s = s.replaceAll('%2F','/'); + } + } + return s; +} \ No newline at end of file diff --git a/src/common/educoder.js b/src/common/educoder.js index 1a063d82..067d3f60 100644 --- a/src/common/educoder.js +++ b/src/common/educoder.js @@ -6,7 +6,8 @@ export { getUploadLogoActionUrl as getUploadLogoActionUrl,numFormat as numFormat, getImageUrl as getImageUrl,getImage as getImage, getmyUrl as getmyUrl, getRandomNumber as getRandomNumber, getUrl as getUrl, publicSearchs as publicSearchs, getRandomcode as getRandomcode, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl , getUploadActionUrl as getUploadActionUrl, getUploadActionUrltwo as getUploadActionUrltwo, getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth - , getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl + , getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl, + turnbar,returnbar } from './UrlTool'; export { setmiyah as setmiyah } from './Component'; diff --git a/src/common/marked.js b/src/common/marked.js index d481dc56..abfd657a 100644 --- a/src/common/marked.js +++ b/src/common/marked.js @@ -76,7 +76,6 @@ const tokenizer = { if (cap) { const raw = cap[0] let text = indentCodeCompensation(raw, cap[3] || '') - console.log(text); const lang = cap[2] ? cap[2].trim() : cap[2] if (['latex', 'katex', 'math'].indexOf(lang) >= 0) { const id = next_id() diff --git a/src/forge/Branch/Select.jsx b/src/forge/Branch/Select.jsx index ff3dd829..a39f9556 100644 --- a/src/forge/Branch/Select.jsx +++ b/src/forge/Branch/Select.jsx @@ -3,6 +3,7 @@ import { Dropdown} from 'antd'; import './branch.scss'; import SelectOverlay from './SelectOverlay'; import { findDOMNode } from 'react-dom'; +import { turnbar } from 'educoder'; export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{ const [ showValue , setShowValue ] = useState(branch); @@ -35,7 +36,8 @@ export default (({ projectsId , branch , owner , changeBranch , branchList , tag function ChangeB(params) { setVisible(false); - changeBranch(params); + let en = turnbar(params); + changeBranch(en); } const menu = ( diff --git a/src/forge/Component/DrawerPanel.jsx b/src/forge/Component/DrawerPanel.jsx index fa99e6c6..28847fda 100644 --- a/src/forge/Component/DrawerPanel.jsx +++ b/src/forge/Component/DrawerPanel.jsx @@ -1,15 +1,10 @@ import React, { useEffect, useState } from 'react'; import { Drawer , Tree , Spin } from 'antd'; +import { turnbar} from 'educoder'; import './Component.scss'; import axios from 'axios'; const { TreeNode , DirectoryTree } = Tree; -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , list}){ const [ treeData , setTreeData ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); diff --git a/src/forge/DevOps/Dispose/List.jsx b/src/forge/DevOps/Dispose/List.jsx index 297c5556..80a53372 100644 --- a/src/forge/DevOps/Dispose/List.jsx +++ b/src/forge/DevOps/Dispose/List.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { Table , Popconfirm } from 'antd'; import { Link } from 'react-router-dom'; +import { turnbar } from "educoder"; // const STATUS = { // running:"运行中", @@ -10,12 +11,6 @@ import { Link } from 'react-router-dom'; // killed:"已撤销", // pending:"准备中" // } -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} function renderTableStatus(status) { switch (status) { case "running": diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 56a02e7b..bb75c078 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -1,7 +1,7 @@ import React , { useEffect , useState } from 'react'; import { WhiteBack , Box , LongWidth , ShortWidth , Gap , AlignCenter , FlexAJ } from '../Component/layout'; import { Dropdown , Menu , Divider , Spin, Button , Typography } from 'antd'; -import { getImageUrl } from "educoder"; +import { getImageUrl , turnbar , returnbar } from "educoder"; import { Link } from 'react-router-dom'; import { truncateCommitId } from "../common/util"; import CloneAddress from '../Branch/CloneAddress'; @@ -23,24 +23,9 @@ import Nodata from '../Nodata'; import Invite from './sub/Invite'; import CheckProfile from '../Component/ProfileModal/Profile'; import RenderHtml from '../../components/render-html'; -import { Base64 } from 'js-base64'; /** * projectDetail.type:0是托管项目,1是镜像项目,2是同步镜像项目(为2时不支持在线创建、在线上传、在线修改、在线删除、创建合并请求等功能) */ - const { Paragraph } = Typography; -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} -function returnbar(str){ - if(str && str.length>0 && str.indexOf("%2F")>-1){ - return str.replaceAll('%2F','/'); - } - return str; -} - function CoderDepot(props){ const [ projectDetail , setProjectDetail ]= useState(undefined); const [ inviteCode , setInviteCode ] = useState(undefined); @@ -123,13 +108,10 @@ function CoderDepot(props){ setTreeValue(url); getFileInfo(url,branchName); setType("file"); - // getReadmeInfo(url,branchName); - // setReadme(undefined); }else{ setTreeValue(undefined); getDirInfo(branchName || defaultBranch); setType("dir"); - // getReadmeInfo('', branchName || defaultBranch); } } },[projectsId,owner,pathname,defaultBranch]) @@ -170,7 +152,7 @@ function CoderDepot(props){ const url = `/${owner}/${projectsId}/entries.json`; axios.get(url, { - params: { ref: branch } + params: { ref:branch} }).then((result) => { if (result) { setCommitCount(result.data.commits_count); @@ -240,9 +222,9 @@ function CoderDepot(props){ // 切换分支或者标签 function changeBranch(value){ - let checkvalue = turnbar(value); - let url = `/${owner}/${projectsId}${value && `/tree/${checkvalue}`}${treeValue ? `/${treeValue}`:""}`; - props.history.push(url); + let checkvalue = value; + let u = `/${owner}/${projectsId}${checkvalue && `/tree/${checkvalue}`}${treeValue ? `/${treeValue}`:""}`; + props.history.push(u); } // 文件相关的下拉项 @@ -574,7 +556,7 @@ function CoderDepot(props){ projectDetail && projectDetail.license_name &&
- {projectDetail.license_name} + {projectDetail.license_name}
} diff --git a/src/forge/Main/CoderRootBranch.js b/src/forge/Main/CoderRootBranch.js index 67bbb461..7137bc6d 100644 --- a/src/forge/Main/CoderRootBranch.js +++ b/src/forge/Main/CoderRootBranch.js @@ -3,15 +3,10 @@ import { Link } from "react-router-dom"; import { Dropdown , Menu , Icon , Tooltip , Spin } from 'antd'; import { truncateCommitId } from '../common/util'; import { getBranch } from '../GetData/getData'; +import { turnbar } from "educoder"; import Nodata from '../Nodata'; import './list.scss'; -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} export default ((props)=>{ const [ data , setData ] =useState(undefined); const [ isSpin , setIsSpin ] =useState(true); diff --git a/src/forge/Main/Diff.jsx b/src/forge/Main/Diff.jsx index 8dad59fb..985b03a8 100644 --- a/src/forge/Main/Diff.jsx +++ b/src/forge/Main/Diff.jsx @@ -46,12 +46,6 @@ const Infos = styled.div` } } `; -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} //提交详情页 export default (props) => { const {match , history } = props; diff --git a/src/forge/Main/Index.js b/src/forge/Main/Index.js index ede9c535..c3268739 100644 --- a/src/forge/Main/Index.js +++ b/src/forge/Main/Index.js @@ -279,26 +279,26 @@ class Index extends Component { isSpin, total, search, limit, page, typeList, categoryList , recommendOriList , CategoryList , category_id } = this.state; - const setting={ - dots: true, - infinite: true, - speed: 500, - slidesToShow: 5, - slidesToScroll: 5, - autoplay:false, - arrows:false, - adaptiveHeight:true - } - const settings={ - dots: true, - infinite: true, - speed: 500, - slidesToShow: 6, - slidesToScroll: 6, - autoplay:false, - arrows:false, - adaptiveHeight:true - } + // const setting={ + // dots: true, + // infinite: true, + // speed: 500, + // slidesToShow: 5, + // slidesToScroll: 5, + // autoplay:false, + // arrows:false, + // adaptiveHeight:true + // } + // const settings={ + // dots: true, + // infinite: true, + // speed: 500, + // slidesToShow: 6, + // slidesToScroll: 6, + // autoplay:false, + // arrows:false, + // adaptiveHeight:true + // } return (
diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index d9255260..2829331b 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -2,20 +2,13 @@ import React , { useEffect , useState } from 'react'; import CopyTool from '../../Component/CopyTool'; import { truncateCommitId } from '../../common/util'; import { Link } from 'react-router-dom'; -import { getImageUrl } from 'educoder'; +import { getImageUrl , turnbar } from 'educoder'; import { Dropdown , Menu , Spin } from 'antd'; import './Index.scss'; -import { Base64 } from 'js-base64'; import Tree from '../img/tree.png'; import Axios from 'axios'; -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} function Index(props) { const [ list , setList ] = useState([]); const [ isSpin , setIsSpin ] = useState(true); diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index 7dbdffd8..ef026261 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -2,15 +2,8 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; import { Tag } from "antd"; import { AlignCenter } from '../Component/layout'; -import { getImageUrl } from "educoder"; +import { getImageUrl, turnbar } from "educoder"; import "./merge.css"; - -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} class MergeItem extends Component { constructor(props) { super(props); diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 98a0d3c9..d7dfe3ca 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -2,7 +2,7 @@ import React, { Component } from "react"; import { Tabs } from 'antd'; import { Link } from "react-router-dom"; import axios from "axios"; -import { getImageUrl } from "educoder"; +import { getImageUrl , turnbar } from "educoder"; import { Form, Input, @@ -20,13 +20,6 @@ import "../Order/order.css"; import MergeLinkFooter from "./MergeLinkFooter"; const TextArea = Input.TextArea; - -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} class MessageCount extends Component { constructor(props) { super(props); diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index e67597cb..79b33361 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -3,23 +3,11 @@ import { getImageUrl } from "educoder"; import { Form, Input, Button, Radio, Icon, Spin } from "antd"; import { Link } from "react-router-dom"; import "./index.css"; +import { turnbar , returnbar } from 'educoder'; import axios from "axios"; const TextArea = Input.TextArea; - -function turnbar(str){ - if(str && str.length>0 && str.indexOf("/")>-1){ - return str.replaceAll('/','%2F'); - } - return str; -} -function returnbar(str){ - if(str && str.length>0 && str.indexOf("%2F")>-1){ - return str.replaceAll('%2F','/'); - } - return str; -} class UserSubmitComponent extends Component { constructor(props) { super(props); diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index 85b40716..8a7bc928 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -106,6 +106,7 @@ class order extends Component { isSpin: true }) const { select_params } = this.state; + console.log(select_params); const { projectsId, owner } = this.props.match.params; const url = `/${owner }/${projectsId}/issues.json`; axios @@ -246,10 +247,11 @@ class order extends Component { checkedValue:[], all:undefined }); - const { status_type } = this.state; + const { status_type , select_params } = this.state; this.setState({ select_params:{ + ...select_params, search:value, page:1 } diff --git a/src/forge/SecuritySetting/Index.jsx b/src/forge/SecuritySetting/Index.jsx index 4f47b33c..3c843a08 100644 --- a/src/forge/SecuritySetting/Index.jsx +++ b/src/forge/SecuritySetting/Index.jsx @@ -33,6 +33,10 @@ const Profile = Loadable({ loader: () => import("../users/Material/Index"), loading: Loading, }); +const Password = Loadable({ + loader: () => import("../users/Material/Index"), + loading: Loading, +}); const SSHIndex = Loadable({ loader: () => import("./sub/SSH"), loading: Loading, @@ -65,6 +69,7 @@ function Index(props){ {notice_url &&
) diff --git a/src/forge/users/Material/Index.jsx b/src/forge/users/Material/Index.jsx index e1b30e3a..dc0da8ce 100644 --- a/src/forge/users/Material/Index.jsx +++ b/src/forge/users/Material/Index.jsx @@ -1,15 +1,12 @@ import React , { useEffect , useState } from 'react'; import { Menu } from 'antd'; -import { Link } from 'react-router-dom'; import Base from './Base'; import Password from './Password'; import './Index.scss'; import '../../SecuritySetting/notice/manager/Index.scss'; function Index(props){ - // const { username } = props && props.match && props.match.params; const { pathname } = props && props.location; - const { current_user } = props; const [ key , setKey ] = useState("0"); @@ -28,10 +25,13 @@ function Index(props){ return(
- setKey(e.key)}> - 基本资料 - {/* 基本资料 */} - 密码管理 + + { + key === "0" ? + 基本资料 + : + 密码管理 + }