From 6296434527b454e9cf683faabc12ddfd5f35a69a Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 1 Apr 2021 14:41:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86appconfig=E6=96=87=E4=BB=B6?= =?UTF-8?q?=20=E8=B5=84=E6=BA=90=E5=BA=93=E6=89=80=E6=9C=89=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8E=92=E7=89=88=E3=80=81=E6=95=B0=E6=8D=AE=E6=9C=AA?= =?UTF-8?q?=E7=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 57 +++---------------- src/common/UrlTool.js | 12 ++-- src/forge/DevOps/About.jsx | 5 -- src/forge/Source/Index.jsx | 39 +++++++++++-- src/forge/Source/Index.scss | 22 ++++++++ src/forge/Source/UploadSource.jsx | 93 +++++++++++++++++++++++++++++-- src/forge/Upload/Index.js | 23 ++++---- 7 files changed, 168 insertions(+), 83 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index a5a063b09..c42dcbf48 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -2,7 +2,7 @@ import axios from 'axios'; import { requestProxy } from "./indexEduplus2RequestProxy"; import { broadcastChannelOnmessage, isDev, queryString } from 'educoder'; import { notification } from 'antd'; -import cookie from 'react-cookies'; + import './index.css'; let message501 = false; @@ -11,10 +11,8 @@ broadcastChannelOnmessage('refreshPage', () => { }) function locationurl(list) { - if (window.location.port === "3007") { - - } else { - window.location.href = list + if (window.location.port !== "3007") { + window.location.href = list } } // TODO 开发期多个身份切换 @@ -26,52 +24,21 @@ if (isDev) { parsed = queryString.parse(_search); } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : - window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' + window.location.search.indexOf('debug=s') !== -1 ? 'student' : + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' } -function clearAllCookie() { - cookie.remove('_educoder_session', { path: '/' }); - cookie.remove('autologin_trustie', { path: '/' }); - setpostcookie() -} -clearAllCookie(); -function setpostcookie() { - const str = window.location.pathname; - if (str.indexOf("/wxcode") !== -1) { - cookie.remove('_educoder_session', { path: '/' }); - cookie.remove('autologin_trustie', { path: '/' }); - const _params = window.location.search; - if (_params) { - let _search = _params.split('?')[1]; - let _educoder_sessions = _search.split('&')[0].split('='); - cookie.save('_educoder_session', _educoder_sessions[1], { domain: '.educoder.net', path: '/' }); - let autologin_trusties = _search.split('&')[1].split('='); - cookie.save('autologin_trustie', autologin_trusties[1], { domain: '.educoder.net', path: '/' }); - } - } -} -setpostcookie(); - window._debugType = debugType; export function initAxiosInterceptors(props) { initOnlineOfflineListener(); - var proxy = "http://localhost:3000"; - proxy = "https://testforgeplus.trustie.net"; + var proxy = "https://testforgeplus.trustie.net"; - const requestMap = {}; - window.setfalseInRequestMap = function (keyName) { - requestMap[keyName] = false; - } //响应前的设置 axios.interceptors.request.use( config => { - setpostcookie() - clearAllCookie() - - if (config.url.indexOf(proxy) !== -1) { + if (config.url.indexOf(proxy) !== -1 || config.url.indexOf("http") !== -1) { return config } - requestProxy(config) + requestProxy(config); let url = `/api${config.url}`; @@ -86,12 +53,6 @@ export function initAxiosInterceptors(props) { } else { config.url = url; } - setpostcookie(); - } - if (config.url.indexOf('update_file') === -1) { - requestMap[config.url] = true; - - window.setTimeout("setfalseInRequestMap('" + config.url + "')", 900) } return config; }, @@ -146,8 +107,6 @@ export function initAxiosInterceptors(props) { message501 = false }, 2000); } - requestMap[response.config.url] = false; - setpostcookie(); return response; }, function (error) { return Promise.reject(error); diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index 6b3d3564b..329bc81af 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -162,28 +162,28 @@ export function getmyUrl(geturl) { } export function getUploadActionUrl(path, goTest) { - return `${getUrl()}/api/attachments.json`; + return `${getUrl()}/api/attachments.json${isDev ?`${isDev ?`?debug=${window._debugType || 'admin'}` : ""}` : ""}`; } export function getUploadLogoActionUrl() { - return `${getUrl()}/api/resumes/logo.json?debug=${window._debugType || 'admin'}`; + return `${getUrl()}/api/resumes/logo.json${isDev ?`?debug=${window._debugType || 'admin'}` : ""}`; } export function getUploadActionUrltwo(id) { - return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json?debug=${window._debugType || 'admin'}` + return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ?`?debug=${window._debugType || 'admin'}` : ""}` } export function getUploadActionUrlthree() { - return `${getUrlmys()}/api/jupyters/import_with_tpm.json?debug=${window._debugType || 'admin'}` + return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ?`?debug=${window._debugType || 'admin'}` : ""}` } export function getupload_git_file(id) { - return `${getUrlmys()}/api/shixuns/${id}/upload_git_file.json?debug=${window._debugType || 'admin'}` + return `${getUrlmys()}/api/shixuns/${id}/upload_git_file.json${isDev ?`?debug=${window._debugType || 'admin'}` : ""}` } export function getUploadActionUrlOfAuth(id) { - return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json?debug=${window._debugType || 'admin'}` + return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ?`?debug=${window._debugType || 'admin'}` : ""}` } export function getRandomNumber(type) { diff --git a/src/forge/DevOps/About.jsx b/src/forge/DevOps/About.jsx index bb79caad3..b9524d548 100644 --- a/src/forge/DevOps/About.jsx +++ b/src/forge/DevOps/About.jsx @@ -55,11 +55,6 @@ function About(props, ref) { setIsSpining(false); if(result && result.data ){ setStep(result.data.step); - // setStep(0); - // setFieldsValue({...result.data.cloud_account}); - // if(result.data.cloud_account){ - // setDisabled(true); - // } } }).catch(error=>{ setIsSpining(false); diff --git a/src/forge/Source/Index.jsx b/src/forge/Source/Index.jsx index 3ba406782..b01e39077 100644 --- a/src/forge/Source/Index.jsx +++ b/src/forge/Source/Index.jsx @@ -4,6 +4,7 @@ import { Blueback , FlexAJ } from '../Component/layout'; import { Dropdown, Input , Menu , Pagination } from 'antd'; import { Link } from 'react-router-dom'; import UploadSource from './UploadSource'; +import axios from 'axios'; const { Search } = Input; const sort = [ @@ -13,16 +14,37 @@ const sort = [ ] const limit = 15; function Index(props){ - const [ sortValue , setSortValue ] = useState(0); + const [ sortValue , setSortValue ] = useState(1); const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); const [ search , setSearch ] = useState(undefined); const [ visible , setVisible ] = useState(false); + const projectsId = props.match.params.projectsId; + const owner = props.match.params.owner; useEffect(()=>{ + if(owner && projectsId){ + getData(); + } + },[projectsId,owner,search,sort,page]) - },[search,sort,page]) + function getData(){ + const url = `http://117.50.100.12:8001/api/project/achievement/`; + axios.get(url,{ + params:{ + projectId:projectsId, + curPage:page, + pageSize:limit, + name:search, + sort:sortValue, + } + }).then(result=>{ + if(result && result.data){ + + } + }).catch(error=>{}) + } // 搜索 function onSearch(value){ @@ -40,7 +62,7 @@ function Index(props){ { sort && sort.map((item,key)=>{ return( -
资源描述资源描述资源描述资源描述资源描述资源描述资源描述