清理appconfig文件

资源库所有页面排版、数据未绑
This commit is contained in:
caishi 2021-04-01 14:41:13 +08:00
parent e2dbda3083
commit 6296434527
7 changed files with 168 additions and 83 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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(
<Menu.Item onClick={(e)=>changeSort(e,key)} value={key} className={key === sortValue ?"color-blue":""}>{item}</Menu.Item>
<Menu.Item onClick={(e)=>changeSort(e,key+1)} value={key} className={key+1 === sortValue ?"color-blue":""}>{item}</Menu.Item>
)
})
}
@ -55,12 +77,19 @@ function Index(props){
</Menu>
)
//
function onOk(){
}
//
function removeTagFunc(){
}
return(
<div className="sourcePanel">
<UploadSource visible={visible} onCancel={()=>setVisible(false)} onOk={onOk}/>
<UploadSource visible={visible} onCancel={()=>setVisible(false)} onOk={onOk} showNotification={props.showNotification}/>
<div className="headtitle">
<FlexAJ>
<span className="font-18">资源库(18)</span>
@ -98,7 +127,7 @@ function Index(props){
</p>
<p className="infodesc task-hide-2">资源描述资源描述资源描述资源描述资源描述资源描述资源描述</p>
<div className="infotag">
<span>软件版本<i className="iconfont icon-guanbi font-12 ml2"></i></span>
<span>软件版本<i className="iconfont icon-guanbi font-12 ml2" onClick={removeTagFunc}></i></span>
</div>
</div>
</li>

View File

@ -73,4 +73,26 @@
}
}
}
}
.versionTable{
.currentTip{
display: block;
padding:0px 3px;
border-radius: 2px;
border:1px solid #68c7ec;
font-size: 12px;
color: #68c7ec;
height: 18px;
line-height: 18px;
margin-left: 5px;
}
.ant-table-body{
margin:0px!important;
thead{
background-color: #eee;
}
thead >tr >th,tbody > tr > td{
padding:4px 5px!important;
}
}
}

View File

@ -1,8 +1,58 @@
import React from 'react';
import { Modal } from 'antd';
import React , { forwardRef, useEffect, useState } from 'react';
import { Modal , Form , Checkbox , Input , Table } from 'antd';
import Upload from '../Upload/Index';
import { AlignCenter } from '../Component/layout';
const { TextArea } = Input;
function UploadSource({ visible , onCancel , onOk }){
const data = [
{name:"sdfkjsfj.pdf",loadNum:"10",citeNum:"15",time:"2021-04-01 10:45"},
{name:"sdfkjsfj.pdf",loadNum:"10",citeNum:"15",time:"2021-04-01 10:45"},
{name:"sdfkjsfj.pdf",loadNum:"10",citeNum:"15",time:"2021-04-01 10:45"}
]
function UploadSource({ form , visible , onCancel , onOk , showNotification}){
const [ tableData , setTableData ] = useState(data);
const { getFieldDecorator, validateFields , setFieldsValue } = form;
function UploadFunc(){
}
const columns = [
{
dataIndex:"name",
key:"name",
title:"资源名称",
width:"45%",
ellipsis:true,
render:(value,item,key)=>{
return <AlignCenter>
<div className="task-hide" style={{maxWidth:key===0 ? "250px":"100%"}}>{value}</div>
{ key === 0 && <span className="currentTip">当前版本</span> }
</AlignCenter>
}
},
{
dataIndex:"loadNum",
key:"loadNum",
title:"下载数",
width:"15%",
className:"edu-txt-center"
},
{
dataIndex:"citeNum",
key:"citeNum",
title:"引用数",
width:"15%",
className:"edu-txt-center"
},
{
dataIndex:"time",
key:"time",
title:"上传时间",
width:"25%"
}
]
return(
<Modal
title={"上传资源"}
@ -15,8 +65,41 @@ function UploadSource({ visible , onCancel , onOk }){
width="600px"
centered
>
<div></div>
<div>
<Form>
<Table className="versionTable" columns={columns} dataSource={tableData} pagination={false} size={"small"}/>
<Form.Item>
{getFieldDecorator("type",{
rules:[]
})(
<Checkbox.Group>
<Checkbox value="软件版本">软件版本</Checkbox>
<Checkbox value="文档">文档</Checkbox>
<Checkbox value="代码">代码</Checkbox>
<Checkbox value="媒体">媒体</Checkbox>
<Checkbox value="论文">论文</Checkbox>
<Checkbox value="其它">其它</Checkbox>
</Checkbox.Group>
)}
</Form.Item>
<Upload
className="commentStyle"
isComplete={true}
load={UploadFunc}
size={100}
showNotification={showNotification}
btn
/>
<Form.Item className="mt20">
{getFieldDecorator("desc",{
rules:[]
})(
<TextArea rows={4} placeholder="请输入资源描述" />
)}
</Form.Item>
</Form>
</div>
</Modal>
)
}
export default UploadSource;
export default Form.create()(forwardRef(UploadSource));;

View File

@ -1,6 +1,7 @@
import React, { Component } from "react";
import { Upload, Button, Icon } from 'antd';
import { Upload, Icon , Button } from 'antd';
import { getUploadActionUrl, appendFileSizeToUploadFileAll } from 'educoder';
import { AlignCenter } from '../Component/layout';
import axios from 'axios';
const { Dragger } = Upload;
@ -28,22 +29,12 @@ class Index extends Component {
onAttachmentRemove = (file) => {
if (!file.percent || file.percent === 100) {
// this.props.confirm({
// content: '是否确认删除?',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
this.deleteAttachment(file)
return false;
}
}
deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
}).then((response) => {
@ -98,7 +89,7 @@ class Index extends Component {
render() {
//判断是否已经提交,如已提交评论则上一条评论数据清除
const { isComplete, icon } = this.props;
const { isComplete, icon , btn , className , size} = this.props;
const { fileList } = this.state;
let list = isComplete === true ? fileList : undefined;
@ -112,7 +103,13 @@ class Index extends Component {
};
return (
<Dragger {...upload} className={this.props.className}>
btn ?
<Upload {...upload} className={className}>
<Button type={"default"}>上传文件</Button>
<span className="ml10 color-grey-9">(你可以上传小于<span className="color-red">{size}MB</span>)</span>
</Upload>
:
<Dragger {...upload} className={className}>
{icon || <Icon type="inbox" />}
<p className="ant-upload-text font-14">拖动文件或<span className="color-blue">点击此处上传</span></p>
</Dragger>