style 代码清理

This commit is contained in:
caishi 2020-05-06 16:52:00 +08:00
parent 040ab7b5e2
commit 5f35b8dc91
6 changed files with 31 additions and 253 deletions

View File

@ -3506,7 +3506,7 @@ a.user_bluebg_btn {
color: #05101A;
float: left;
cursor: pointer;
border: 1px solid #fff;
border: none;
}
.white-panel li a {

View File

@ -4,7 +4,6 @@ import { Dropdown , Menu , Icon , Tooltip } from 'antd';
import { truncateCommitId } from '../common/util';
import './list.css'
import { branch } from 'recompose';
import Top from './DetailTop';
class CoderRootBranch extends Component {
@ -16,32 +15,27 @@ class CoderRootBranch extends Component {
}
render(){
const { branchList, projectDetail } = this.props;
const { branchList } = this.props;
const { projectsId } = this.props.match.params;
const list =()=>{
if(branchList && branchList.length>0){
return(
<React.Fragment>
<ul className="branchUl">
{
branchList.map((item,key)=>{
return(
<li>
<li key={key}>
<div>
<Link to={`/projects/${projectsId}/coders?branch=${item.name}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
{/*<span className="color-blue font-15">{item.name}</span>*/}
<p className="f-wrap-alignCenter">
<span className="mr5 color-blue">{item.last_commit && truncateCommitId(item.last_commit.id)}</span>
{/*<Link to="javascript:void(0)" className="mr5 color-blue" >{item.last_commit && item.last_commit.id}</Link>*/}
<span className="color-grey-9 hide-1 messages leftPoint">{item.last_commit && item.last_commit.message}</span>
<span className="color-grey-6 leftPoint">最后更新于{item.last_commit && item.last_commit.time_from_now}</span>
</p>
</div>
<span>
<Link to={`/projects/${projectsId}/merge/new`} className="mr20 operationBtn">创建合并请求</Link>
<Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="operationBtn">
<a className="ant-dropdown-link">
<Tooltip title={`下载分支${item.name}`}><Icon type="cloud-download" className="font-18"/></Tooltip>
@ -59,8 +53,8 @@ class CoderRootBranch extends Component {
}
const menu =(zip_url,tar_url)=> (
<Menu>
<Menu.Item><a href={zip_url}>ZIP</a></Menu.Item>
<Menu.Item><a href={tar_url}>TAR.GZ</a></Menu.Item>
<Menu.Item key={'0'}><a href={zip_url}>ZIP</a></Menu.Item>
<Menu.Item key={'1'}><a href={tar_url}>TAR.GZ</a></Menu.Item>
</Menu>
)
return(

View File

@ -89,9 +89,8 @@ class CoderRootCommit extends Component{
<span className="f-wrap-alignCenter">
<Link to={`/users/${item.login}/projects`} className="show-user-link">
<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
<label className="hide-1" style={{maxWidth:"75px",'vertical-align':'middle'}}>{text}</label>
<label className="hide-1" style={{maxWidth:"75px",'verticalAlign':'middle'}}>{text}</label>
</Link>
</span>
),
},{
@ -119,11 +118,6 @@ class CoderRootCommit extends Component{
return(
<div className="f-wrap-between" style={{alignItems:"center"}}>
<span className="font-16">{dataCount}次提交代码({branch})</span>
{/* <div className="f-wrap-alignCenter">
<Input placeholder="搜索提交历史" style={{width:"300px"}}/>
<Checkbox className="ml15">所有分支</Checkbox>
<a className="btn_32 ml15">搜索</a>
</div> */}
</div>
)
}

View File

@ -218,7 +218,6 @@ class MessageCount extends Component{
//修改评论
updatedetail=(id)=>{
// console.log("updtedetail", this.state)
this.setState({
edit_spin: true
})
@ -339,13 +338,11 @@ class MessageCount extends Component{
<div>
<span>没有评论~</span>
</div>
)
}
}
handleSubmit=()=>{
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { projectsId , mergeId } = this.props.match.params;
@ -354,7 +351,7 @@ class MessageCount extends Component{
if(values.issue_tag_ids===''){
values.issue_tag_ids = []
}else{
values.issue_tag_ids = [parseInt(values.issue_tag_ids)]
values.issue_tag_ids = [parseInt(values.issue_tag_ids,0)]
}
if(values.assigned_to_id===0){

View File

@ -1,51 +1,23 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Redirect } from 'react-router';
import { Link } from "react-router-dom";
import AccountProfile from"../user/AccountProfile";
import PropTypes from 'prop-types';
import Certifiedprofessional from "../../modules/modals/Certifiedprofessional"
// import searchImg from '../../../../images/educoder/icon/search.svg'
// /images/educoder/icon/search.svg
import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educoder'
import { getImageUrl } from 'educoder'
import axios from 'axios';
import { Modal,Checkbox ,Radio,Input,message,notification,Popover} from 'antd';
import Addcourses from '../courses/coursesPublic/Addcourses';
import { Modal , Input , message , notification } from 'antd';
import LoginDialog from '../login/LoginDialog';
import Trialapplication from '../login/Trialapplication';
import GotoQQgroup from '../../modal/GotoQQgroup'
import 'antd/lib/modal/style/index.css';
import 'antd/lib/checkbox/style/index.css';
import 'antd/lib/radio/style/index.css';
import 'antd/lib/input/style/index.css';
import './TPMIndex.css';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
const RadioGroup = Radio.Group;
const { Search } = Input;
let old_url;
/*
_logined_header.html.erb
_unlogin_header.html.erb
*/
window._header_componentHandler = null;
class NewHeader extends Component {
constructor(props) {
@ -91,7 +63,7 @@ class NewHeader extends Component {
var hoveredPanel;
$(".edu-menu-panel").hover(function(){
if (hoverTimeout) { // 一次只显示一个panel
if (hoveredPanel && hoveredPanel != this) {
if (hoveredPanel && hoveredPanel !== this) {
$(hoveredPanel).find(".edu-menu-list").hide()
}
clearTimeout(hoverTimeout);
@ -114,44 +86,6 @@ class NewHeader extends Component {
} catch (e) {
}
// axios.interceptors.response.use((response) => {
// if (response != undefined)
// if (response && response.data.status === -1) {
// if (response.data.message === "该课堂要求成员完成实名认证") {
//
// } else if (response.data.message === "该课堂要求成员完成职业认证") {
// console.log("该课堂要求成员完成职业认证");
// this.HideAddcoursestypess(2);
//
//
//
// return
// } else if (response.data.message === "该课堂要求成员完成实名和职业认证") {
// console.log("该课堂要求成员完成实名和职业认证");
// this.HideAddcoursestypess(3);
// return
//
// }
// }
// return response;
// }, (error) => {
//
// });
}
componentDidUpdate = (prevProps) => {
// if(prevProps.user!=this.props.user){
// // console.log("216")
// // console.log(prevProps.user);
// // console.log(this.props.user);
// if(this.props.user !== undefined){
// this.setState({
// user_phone_binded :this.props.user.user_phone_binded,
// })
// }
//
//
// }
}
openNotification = (messge) => {
@ -166,14 +100,14 @@ class NewHeader extends Component {
this.setState({
user:newProps.user
})
if(newProps.Headertop!=undefined){
if(newProps.Headertop!==undefined){
old_url=newProps.Headertop.old_url
}
}
getCookie=(key)=>{
var arr,reg = RegExp('(^| )'+key+'=([^;]+)(;|$)');
if (arr = document.cookie.match(reg)) //["username=liuwei;", "", "liuwei", ";"]
if (arr === document.cookie.match(reg))
return decodeURIComponent(arr[2]);
else
return null;
@ -197,9 +131,6 @@ class NewHeader extends Component {
this.setState({
user:undefined
})
// let path="/";
// this.props.history.push(path);
// broadcastChannelPostMessage('refreshPage')
window.location.href ="/login"
message.success('退出成功');
}
@ -234,7 +165,7 @@ class NewHeader extends Component {
}
tojoinitem=()=>{
if(this.props.user&&this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){
if(this.props.user && this.props.user.email===undefined || this.props.user && this.props.user.email===null || this.props.user && this.props.user.email===""){
this.openNotification("请先绑定邮箱,谢谢");
return
}
@ -302,11 +233,11 @@ class NewHeader extends Component {
RadioGroupvalue:undefined
})
if(submitapplicationssum===0){
if(submitapplicationsvaluedata!=undefined){
if(submitapplicationsvaluedata!==undefined){
window.location.href = "/courses/"+submitapplicationsvaluedata;
}
}else if(submitapplicationssum===1){
if(submitapplicationsvaluedata!=undefined){
if(submitapplicationsvaluedata!==undefined){
window.location.href = "/projects/"+submitapplicationsvaluedata;
}
}
@ -334,38 +265,12 @@ class NewHeader extends Component {
this.setState({
isRender:true
})
// var url = `/accounts/logout.json`;
//
// axios.get((url)).then((result) => {
// if(result!==undefined){
// // this.setState({
// // isRender:true
// // })
// window.location.href = "/";
// }
// }).catch((error) => {
// console.log(error);
// })
}
educoderloginysl=()=>{
//退出账号
// this.setState({
// isRender:true
// })
// let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'
// let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess'
// let openopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype'
var url = `/accounts/logout.json`;
// let storage=window.localStorage;
axios.get((url)).then((result) => {
// storage.removeItem(newTPMsettings);
// storage.removeItem(shixunopenprocess);
// storage.removeItem( openopenpublictype);
if(result!==undefined){
// this.setState({
// isRender:true
// })
// broadcastChannelPostMessage('refreshPage')
window.location.href = "/";
}
}).catch((error) => {
@ -420,21 +325,12 @@ submittojoinclass=(value)=>{
return
}
let newrolearr=rolearr;
// if(value===1){
if(tojoinclasstitle.length<6){
this.setState({
code_notice:true
})
return
}
// }else if(value===0){
// if(tojoinclasstitle.length<5){
// this.setState({
// code_notice:true
// })
// return
// }
// }
if(tojoinclasstitle===""||tojoinclasstitle===undefined){
this.setState({
code_notice:true
@ -469,59 +365,8 @@ submittojoinclass=(value)=>{
})
return
}
// if(value===0){
// let url="/courses/join_course_multi_role.json"
// const form = new FormData();
// form.append('invite_code', tojoinclasstitle);
// form.append('role', pamst);
// form.append('type', 1);
// axios.post(url,form,[true]
// ).then((response) => {
// if( response.data.state===0){
// this.submitstatevalue(0,"加入成功",response.data.course_id)
// }else if( response.data.state===1){
// }else if( response.data.state===2){
// this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)")
// }else if( response.data.state===3){
// this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id)
// }else if( response.data.state===4){
// this.submitstatevalue( 0,"您输入的邀请码错误)")
// }else if( response.data.state===5){
// this.submitstatevalue( 0,"您还未登录")
// }else if( response.data.state===6){
// this.submitstatevalue( 0,"申请已提交,请等待审核")
// }else if( response.data.state===7){
// this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待")
// }else if( response.data.state===8){
// this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id)
// }else if( response.data.state==9){
// this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id)
// }else if( response.data.state==10){
// this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id)
// }else if( response.data.state==11){
// this.submitstatevalue(0," 该课堂已归档,请联系老师")
// }else if( response.data.state==12){
// this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师")
// }else if( response.data.state==13){
// this.submitstatevalue(0,"您申请已提交,请等待审核")
// }else if( response.data.state==14){
// this.submitstatevalue("此邀请码已停用,请与老师联系")
// }else if( response.data.state==15){
// this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行")
// }else {
// this.submitstatevalue(0," 未知错误,请稍后再试")
// }
// })
//
// }
if(value===1){
let url="/project_applies.json"
// const form = new FormData();
// form.append('code', tojoinclasstitle);
// form.append('role', RadioGroupvalue);
// form.append('type', 1);
let url="/project_applies.json";
axios.post(url,{
code:tojoinclasstitle,
role:RadioGroupvalue
@ -551,15 +396,6 @@ submittojoinclass=(value)=>{
}
this.hidetojoinclass()
}
// trialapplications =()=>{
// console.log("点击了")
// this.setState({
// isRenders: true,
// showTrial:true,
// })
// }
// 关闭
cancelModulationModels = () => {
this.setState({isRenders: false})
@ -616,15 +452,12 @@ submittojoinclass=(value)=>{
}
//头部获取是否已经登录了
getUser=(url,type)=>{
if(type==="projects"){
if(this.props.user&&this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){
if(this.props.user && this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){
this.openNotification("请先绑定邮箱,谢谢");
return
}
}
// console.log("点击了503")
// console.log(url);
let{user} =this.state;
if(user===undefined){
@ -633,7 +466,6 @@ submittojoinclass=(value)=>{
})
return
}
if(user&&user.login===""){
this.setState({
isRender:true
@ -647,25 +479,15 @@ submittojoinclass=(value)=>{
})
return;
}
if(type==="newshixuns"){
if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){
this.setgoshowqqgtounp(true);
return;
}
}
if(url !== undefined || url!==""){
window.location.href = url;
}
}
//修改登录方法
@ -691,7 +513,6 @@ submittojoinclass=(value)=>{
this.setState({
mygetHelmetapi2: undefined
});
// document.title = "Forge";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -739,7 +560,6 @@ submittojoinclass=(value)=>{
this.gettablogourlnull();
}
}catch (e) {
// console.log("head获取游览器配置失败 重新请求开始读取配置");
this.geturlsdata();
}
};
@ -747,8 +567,6 @@ submittojoinclass=(value)=>{
geturlsdata=()=>{
let url = "/setting.json";
axios.get(url).then((response) => {
// console.log("app.js开始请求/setting.json");
// console.log("获取当前定制信息");
if(response){
if(response.data){
this.setState({
@ -802,25 +620,6 @@ submittojoinclass=(value)=>{
} else {
return false
}
// if (url=== '/forums'&&match.path === '/forums') {
// return true
// } else if (url.startsWith('/shixuns')&&match.path.startsWith('/shixuns')) {
// return true
// }else if (url.startsWith('/paths')&&match.path.startsWith('/paths')) {
// return true
// } else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) {
// return true
// }else if (url.startsWith('/competitions')&&match.path.startsWith('/competitions')) {
// return true
// }else if (url.startsWith('/crowdsourcing')&&match.path.startsWith('/crowdsourcing')) {
// return true
// }else if(url.startsWith('/moop_cases')&&match.path.startsWith('/moop_cases')){
// return true
// }else if(url.startsWith('/developer')&&match.path.startsWith('/developer')){
// return true
// }else {
// return false
// }
}
@ -1137,7 +936,6 @@ submittojoinclass=(value)=>{
placeholder="实践课程/翻转课堂/实训项目/交流问答"
onInput={()=>this.onKeywordSearchKeyDowns()}
onSearch={(value) => this.onKeywordSearchKeyDown(value)}
// onPressEnter={this.onKeywordSearchKeyDown}
style={{ width: 300,height:32}}
autoFocus={true}
/>
@ -1164,7 +962,7 @@ submittojoinclass=(value)=>{
src={getImageUrl(`images/`+user.image_url)} width="34">
</img>
</a>
<ul className="edu-menu-list" style={{top:'60px', 'text-align': 'center'}}>
<ul className="edu-menu-list" style={{top:'60px', 'textAlign': 'center'}}>
{
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.edit_account &&
<li><a href={`${mygetHelmetapi2.new_course.edit_account}`} target="_blank">修改资料</a></li>
@ -1173,10 +971,6 @@ submittojoinclass=(value)=>{
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_courses &&
<li><a href={`${mygetHelmetapi2.new_course.my_courses}`} target="_blank">我的课程</a></li>
}
{/*{*/}
{/*mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_projects &&*/}
{/*<li><a href={`${mygetHelmetapi2.new_course.my_projects}`} target="_blank">我的项目</a></li>*/}
{/*}*/}
{
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_projects &&
<li><Link to={`/users/${this.props.current_user.login}/projects`} >我的项目</Link></li>

View File

@ -300,10 +300,9 @@ class InfosCourse extends Component {
}
</style>
<div className="square-list clearfix">
{/* 289 */}
{
page == 1 && is_current && !category &&
this.props.current_user && this.props.current_user.user_identity != "学生" ?
page === 1 && is_current && !category &&
this.props.current_user && this.props.current_user.user_identity !== "学生" ?
<Create href={"/classrooms/new"} name={"新建课堂"} index="1"></Create> : ""
}
{
@ -314,17 +313,17 @@ class InfosCourse extends Component {
return (
<div className="square-Item" key={key} onClick={() => this.turnToCourses(`${item.first_category_url}`, item.can_visited)} style={{ "cursor": "pointer" }}>
{
item.is_public == 1 &&
item.is_public === 1 &&
<React.Fragment>
<div className={key == 0 ? "publicpart orangeBlack" : "publicpart"}></div>
<div className={key === 0 ? "publicpart orangeBlack" : "publicpart"}></div>
<span className="smalltrangle"></span>
<span className="publicword">公开</span>
</React.Fragment>
}
{
item.can_visited == false ?
item.can_visited === false ?
<div className="closeSquare">
<img src={getImageUrl("images/educoder/icon/lockclose.svg")} className="mt80 mb25" />
<img src={getImageUrl("images/educoder/icon/lockclose.svg")} alt="" className="mt80 mb25" />
<p className="font-14 color-white">非成员不能访问</p>
</div> : ""
}