Merge branches 'dev_aliyun' and 'dev_ec' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_ec

dev_ec
杨树明 5 years ago
commit 05d7c03b03

@ -0,0 +1,125 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-carousels-index-page').length > 0) {
// ------------ 保存链接 -----------
$('.carousels-card').on('click', '.save-data-btn', function(){
var $link = $(this);
var id = $link.data('id');
var link = $('.custom-carousel-item-' + id).find('.link-input').val();
var name = $('.custom-carousel-item-' + id).find('.name-input').val();
if(!name || name.length == 0){
$.notify({ message: '名称不能为空' },{ type: 'danger' });
return;
}
$link.attr('disabled', true);
$.ajax({
url: '/admins/carousels/' + id,
method: 'PATCH',
dataType: 'json',
data: { link: link, name: name },
success: function(data){
$.notify({ message: '操作成功' });
},
error: ajaxErrorNotifyHandler,
complete: function(){
$link.removeAttr('disabled');
}
})
});
// -------------- 是否在首页展示 --------------
$('.carousels-card').on('change', '.online-check-box', function(){
var $checkbox = $(this);
var id = $checkbox.data('id');
var checked = $checkbox.is(':checked');
$checkbox.attr('disabled', true);
$.ajax({
url: '/admins/carousels/' + id,
method: 'PATCH',
dataType: 'json',
data: { status: checked },
success: function(data){
$.notify({ message: '保存成功' });
var box = $('.custom-carousel-item-' + id).find('.drag');
if(checked){
box.removeClass('not_active');
}else{
box.addClass('not_active');
}
},
error: ajaxErrorNotifyHandler,
complete: function(){
$checkbox.removeAttr('disabled');
}
})
});
// ------------ 拖拽 -------------
var onDropFunc = function(el, _target, _source, sibling){
var moveId = $(el).data('id');
var insertId = $(sibling).data('id') || '';
$.ajax({
url: '/admins/carousels/drag',
method: 'POST',
dataType: 'json',
data: { move_id: moveId, after_id: insertId },
success: function(data){
$('#carousels-container .custom-carousel-item-no').each(function(index, ele){
$(ele).html(index + 1);
})
},
error: function(res){
var data = res.responseJSON;
$.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'});
}
})
};
var ele1 = document.getElementById('carousels-container');
dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc);
// ----------- 新增 --------------
var $createModal = $('.modal.admin-add-carousel-modal');
var $createForm = $createModal.find('form.admin-add-carousel-form');
$createForm.validate({
errorElement: 'span',
errorClass: 'danger text-danger',
rules: {
"portal_image[image]": {
required: true
},
"portal_image[name]": {
required: true
},
}
});
$createModal.on('show.bs.modal', function(event){
resetFileInputFunc($createModal.find('.img-file-input'));
$createModal.find('.file-names').html('选择文件');
});
$createModal.on('click', '.submit-btn', function() {
$createForm.find('.error').html('');
if ($createForm.valid()) {
$createForm.submit();
} else {
$createForm.find('.error').html('请选择图片');
}
});
$createModal.on('change', '.img-file-input', function(){
var file = $(this)[0].files[0];
$createModal.find('.file-names').html(file ? file.name : '请选择文件');
})
// -------------- 重新上传图片 --------------
//replace_image_url
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $carouselItem = $('.custom-carousel-item-' + data.source_id);
$carouselItem.find('.custom-carousel-item-img img').attr('src', data.url);
})
}
})

@ -0,0 +1,60 @@
.admins-carousels-index-page {
.carousels-card {
.custom-carousel-item {
& > .drag {
cursor: move;
background: #fff;
box-shadow: 1px 2px 5px 3px #f0f0f0;
}
&-no {
font-size: 28px;
text-align: center;
}
&-img {
cursor: pointer;
width: 100%;
height: 60px;
& > img {
display: block;
width: 100%;
height: 60px;
background: #F5F5F5;
}
}
.not_active {
background: #F0F0F0;
}
.delete-btn {
font-size: 20px;
color: red;
cursor: pointer;
}
.save-url-btn {
cursor: pointer;
}
.operate-box {
display: flex;
justify-content: space-between;
align-items: center;
}
.online-check-box {
font-size: 20px;
}
.name-input {
flex: 1;
}
.link-input {
flex: 3;
}
}
}
}

@ -33,7 +33,7 @@ class AccountsController < ApplicationController
uid_logger("start register: verifi_code is #{verifi_code}, code is #{code}, time is #{Time.now.to_i - verifi_code.try(:created_at).to_i}")
# check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60)
# todo 上线前请删除万能验证码"513231"
unless code == "513231" && request.subdomain == "pre-newweb"
unless code == "513231" && request.subdomain == "test-newweb"
return normal_status(-2, "验证码不正确") if verifi_code.try(:code) != code.strip
return normal_status(-2, "验证码已失效") if !verifi_code&.effective?
end

@ -0,0 +1,80 @@
class Admins::CarouselsController < Admins::BaseController
before_action :convert_file!, only: [:create]
def index
@images = PortalImage.order(position: :asc)
end
def create
position = PortalImage.count + 1
ActiveRecord::Base.transaction do
image = PortalImage.create!(create_params.merge(position: position))
file_path = Util::FileManage.disk_filename('PortalImage', image.id)
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
Util.write_file(@file, file_path)
end
flash[:success] = '保存成功'
redirect_to admins_carousels_path
end
def update
current_image.update!(update_params)
render_ok
end
def destroy
ActiveRecord::Base.transaction do
current_image.destroy!
# 前移
PortalImage.where('position > ?', current_image.position)
.update_all('position = position - 1')
file_path = Util::FileManage.disk_filename('PortalImage', current_image.id)
File.delete(file_path) if File.exist?(file_path)
end
render_delete_success
end
def drag
move = PortalImage.find_by(id: params[:move_id])
after = PortalImage.find_by(id: params[:after_id])
Admins::DragPortalImageService.call(move, after)
render_ok
rescue Admins::DragPortalImageService::Error => e
render_error(e.message)
end
private
def current_image
@_current_image ||= PortalImage.find(params[:id])
end
def create_params
params.require(:portal_image).permit(:name, :link)
end
def update_params
params.permit(:name, :link, :status)
end
def convert_file!
max_size = 10 * 1024 * 1024 # 10M
file = params.dig('portal_image', 'image')
if file.class == ActionDispatch::Http::UploadedFile
@file = file
render_error('请上传文件') if @file.size.zero?
render_error('文件大小超过限制') if @file.size > max_size
else
file = file.to_s.strip
return render_error('请上传正确的图片') if file.blank?
@file = Util.convert_base64_image(file, max_size: max_size)
end
rescue Base64ImageConverter::Error => ex
render_error(ex.message)
end
end

@ -355,7 +355,7 @@ class ApplicationController < ActionController::Base
# type 0 创始内容, 1 最新内容
def game_passed_code(path, myshixun, game_id)
# 如果代码窗口是隐藏的,则不用保存代码
return if myshixun.shixun.hide_code
return if myshixun.shixun.hide_code || myshixun.shixun.vnc
file_content = git_fle_content myshixun.repo_path, path
unless file_content.present?
raise("获取文件代码异常")

@ -201,12 +201,12 @@ class HomeworkCommonsController < ApplicationController
page = params[:page] || 1
limit = params[:limit] || 20
@student_works = @student_works.page(page).per(limit)
@students = @course.students.where(user_id: @student_works.pluck(:user_id)).preload(:course_group)
if @homework.homework_type == "practice"
@student_works = @student_works.includes(:student_works_scores, user: :user_extension, myshixun: :games)
else
@student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension)
end
@students = @course.students.preload(:course_group)
end
if params[:format] == "xlsx"

@ -25,9 +25,9 @@ class MemosController < ApplicationController
!search.blank? ? "forum_id = #{forum_id} and root_id is null and subject like '%#{search}%'" :
"forum_id = #{forum_id} and root_id is null"
elsif !search.blank?
"forum_id in(3, 5) and root_id is null and subject like '%#{search}%'"
"forum_id in(3, 5, 16) and root_id is null and subject like '%#{search}%'"
else
"forum_id in(3, 5) and root_id is null"
"forum_id in(3, 5, 16) and root_id is null"
end
if tag_repertoire_id

@ -1,6 +1,6 @@
module MemosHelper
def forum_list
[{id: 5, name: "技术分享"}, {id: 3, name: "操作指南"}]
[{id: 5, name: "技术分享"}, {id: 3, name: "操作指南"}, {id: 16, name: "通知公告"}]
end
end

@ -1,2 +1,3 @@
class Forum < ApplicationRecord
has_many :memos, dependent: :destroy
end

@ -1,2 +1,5 @@
class PortalImage < ApplicationRecord
def online?
status?
end
end

@ -0,0 +1,35 @@
class Admins::DragPortalImageService < ApplicationService
Error = Class.new(StandardError)
attr_reader :move, :after
def initialize(move, after)
@move = move
@after = after # 移动后下一个位置的元素
end
def call
return if move.position + 1 == after&.position # 未移动
images = PortalImage.all
ActiveRecord::Base.transaction do
if after.blank? # 移动至末尾
total = images.count
images.where('position > ?', move.position).update_all('position = position - 1')
move.update!(position: total)
return
end
if move.position > after.position # 前移
images.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1')
move.update!(position: after.position)
else # 后移
images.where('position > ? AND position <= ?', move.position, after.position).update_all('position = position - 1')
move.update!(position: after.position)
end
end
end
end

@ -0,0 +1,43 @@
<%
define_admin_breadcrumbs do
add_admin_breadcrumb('轮播图')
end
%>
<div class="card mb-5 carousels-card">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="flex-1">首页轮播图<span class="text-secondary font-12">(拖动排序)</span></span>
<%= javascript_void_link '添加', class: 'btn btn-primary btn-sm add-btn', data: { toggle: 'modal', target: '.admin-add-carousel-modal' } %>
</div>
<div class="card-body row" id="carousels-container">
<% @images.each_with_index do |image, index| %>
<div class="col-12 custom-carousel-item custom-carousel-item-<%= image.id %>" data-id="<%= image.id %>">
<div class="border rounded relative p-3 mb-3 drag row align-items-center <%= image.online? ? '' : 'not_active' %>">
<div class="col-2 col-md-1 custom-carousel-item-no"><%= index + 1 %></div>
<div class="col-10 col-md-3 custom-carousel-item-img" data-source-id="<%= image.id %>" data-source-type="PortalImage" data-toggle="modal" data-target=".admin-upload-file-modal">
<img src="<%= Util::FileManage.exist?('PortalImage', image.id) ? Util::FileManage.disk_file_url('PortalImage', image.id) : '' %>" data-toggle="tooltip" data-title="重新上传"/>
</div>
<div class="col-10 col-md-7">
<div class="input-group">
<input type="text" value="<%= image.name %>" class="form-control name-input" placeholder="请输入名称" />
<input type="text" value="<%= image.link %>" class="form-control link-input" placeholder="请输入跳转地址">
<div class="input-group-prepend">
<button class="input-group-text save-data-btn" data-id="<%= image.id %>">保存</button>
</div>
</div>
</div>
<div class="col-2 col-md-1 operate-box">
<%= check_box_tag(:online, 1, image.online?, id: nil, class: 'online-check-box', data: { id: image.id, toggle: 'tooltip', title: '首页展示' }) %>
<%= delete_link '删除', admins_carousel_path(image, element: ".custom-carousel-item-#{image.id}", not_refresh: true), class: 'delete-btn' do %>
<i class="fa fa-trash-o" data-id="<%= image.id %>"></i>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<%= render partial: 'admins/carousels/shared/add_carousel_modal' %>
<%= render partial: 'admins/shared/modal/upload_file_modal' %>

@ -0,0 +1,36 @@
<div class="modal fade admin-add-carousel-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">添加轮播图</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<%= simple_form_for(PortalImage.new, url: admins_carousels_path, html: { class: 'admin-add-carousel-form', enctype: 'multipart/form-data' }) do |f| %>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">图片</span>
</div>
<div class="custom-file flex-row-reverse">
<input type="file" name="portal_image[image]" class="img-file-input" id="img-file-input" accept="image/*">
<label class="custom-file-label file-names" for="img-file-input">选择文件</label>
</div>
</div>
</div>
<%= f.input :name, label: '名称', placeholder: '请输入名称' %>
<%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %>
<div class="error text-danger"></div>
<% end %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary submit-btn">确认</button>
</div>
</div>
</div>
</div>

@ -77,7 +77,8 @@
</li>
<li>
<%= sidebar_item_group('#helps-submenu', '帮助中心', icon: 'info-circle') do %>
<%= sidebar_item_group('#setting-submenu', '网站建设', icon: 'cogs') do %>
<li><%= sidebar_item(admins_carousels_path, '轮播图', icon: 'image', controller: 'admins-carousels') %></li>
<li><%= sidebar_item(edit_admins_about_path, '关于我们', icon: 'smile-o', controller: 'admins-abouts') %></li>
<li><%= sidebar_item(edit_admins_contact_us_path, '联系我们', icon: 'commenting-o', controller: 'admins-contact_us') %></li>
<li><%= sidebar_item(admins_cooperatives_path, '合作伙伴', icon: 'handshake-o', controller: 'admins-cooperatives') %></li>

@ -962,6 +962,9 @@ Rails.application.routes.draw do
post :drag, on: :collection
post :replace_image_url, on: :member
end
resources :carousels, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
end
resources :colleges, only: [] do

@ -0,0 +1,7 @@
class ResortPortalImageData < ActiveRecord::Migration[5.2]
def change
PortalImage.order(position: :asc).each_with_index do |image, index|
image.update!(position: index + 1)
end
end
end

@ -0,0 +1,9 @@
class MigrateForumName < ActiveRecord::Migration[5.2]
def change
forum = Forum.find_by(id: 16)
if forum.present?
forum.update_attributes(name: "通知公告")
forum.memos.destroy_all
end
end
end

@ -1,100 +1,106 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames'
class ForumsNavTab extends Component {
constructor(props) {
super(props)
this.state = {
}
}
onNavClick(active) {
// TODO 为什么事件发不过去
// https://github.com/facebook/react/issues/3249#issuecomment-177750141
// window.$(window).trigger('setSearchValue', '', true);
this.props.setSearchValue('')
if (!active) {
this.props.initForumState({
selectedHotLabelIndex: -1,
})
}
}
render() {
const { match, history, currentPage } = this.props
const techSharePath = `/forums/categories/5`
const guidePath = `/forums/categories/3`
const hottestPath = `/forums/categories/all?order=hottest` // ?order=hottest
const newestPath = `/forums/categories/all?order=newest` // ?order=newest
const shixunDiscussPath = `/forums/categories/shixun_discuss`
const locationPath = history.location.pathname + history.location.search
/*
<ul>
<li className={classNames({'selected': locationPath.indexOf(techSharePath) === 0 })}>
<Link to={`${techSharePath}`} >techShare</Link>
</li>
<li className={classNames({'selected': locationPath.indexOf(guidePath) === 0 })}>
<Link to={`${guidePath}`}>guide</Link>
</li>
</ul>
*/
return (
<div className="discuss-tab pl20 bor-bottom-greyE clearfix pr edu-back-white">
<p className="_forum_tab clearfix">
{/*<a href="/forums" className="fl font-16 ptl5-10 block mr20 active">
<span className="fl">技术分享</span>
<span className="forum_filtrate_span2 forum_filtrate_span2_bg mt10 ml10 fl">219</span>
</a>*/}
<Link to={`${newestPath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf('order=newest') !== -1 })}
onClick={()=>this.onNavClick(locationPath.indexOf('order=newest') !== -1)}
>
<span className="fl">最新回复</span>
</Link>
<Link to={`${hottestPath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf('order=hottest') !== -1 })}
onClick={()=>this.onNavClick(locationPath.indexOf('order=hottest') !== -1)}
>
<span className="fl">热门话题</span>
</Link>
<Link to={`${shixunDiscussPath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf('shixun_discuss') !== -1 })}
onClick={()=>this.onNavClick(locationPath.indexOf('shixun_discuss') !== -1)}
>
<span className="fl">实训回复</span>
</Link>
<Link to={`${techSharePath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf(techSharePath) === 0 })}
onClick={()=>this.onNavClick(locationPath.indexOf(techSharePath) === 0)}
>
<span className="fl">技术分享</span>
</Link>
<Link to={`${guidePath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf(guidePath) === 0 })}
onClick={()=>this.onNavClick(locationPath.indexOf(guidePath) === 0)}
>
<span className="fl">操作指南</span>
</Link>
{/*<a href="/forums?type=discuss" className="fl font-16 ptl5-10 block mr20">
<span className="fl">实训交流</span>
<span className="forum_filtrate_span2 mt10 ml10 fl">1391</span>
</a>*/}
</p>
</div>
);
}
}
export default ForumsNavTab;
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames'
class ForumsNavTab extends Component {
constructor(props) {
super(props)
this.state = {
}
}
onNavClick(active) {
// TODO 为什么事件发不过去
// https://github.com/facebook/react/issues/3249#issuecomment-177750141
// window.$(window).trigger('setSearchValue', '', true);
this.props.setSearchValue('')
if (!active) {
this.props.initForumState({
selectedHotLabelIndex: -1,
})
}
}
render() {
const { match, history, currentPage } = this.props
const techSharePath = `/forums/categories/5`
const guidePath = `/forums/categories/3`
const guidePaths = `/forums/categories/16`
const hottestPath = `/forums/categories/all?order=hottest` // ?order=hottest
const newestPath = `/forums/categories/all?order=newest` // ?order=newest
const shixunDiscussPath = `/forums/categories/shixun_discuss`
const locationPath = history.location.pathname + history.location.search
/*
<ul>
<li className={classNames({'selected': locationPath.indexOf(techSharePath) === 0 })}>
<Link to={`${techSharePath}`} >techShare</Link>
</li>
<li className={classNames({'selected': locationPath.indexOf(guidePath) === 0 })}>
<Link to={`${guidePath}`}>guide</Link>
</li>
</ul>
*/
return (
<div className="discuss-tab pl20 bor-bottom-greyE clearfix pr edu-back-white">
<p className="_forum_tab clearfix">
{/*<a href="/forums" className="fl font-16 ptl5-10 block mr20 active">
<span className="fl">技术分享</span>
<span className="forum_filtrate_span2 forum_filtrate_span2_bg mt10 ml10 fl">219</span>
</a>*/}
<Link to={`${newestPath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf('order=newest') !== -1 })}
onClick={()=>this.onNavClick(locationPath.indexOf('order=newest') !== -1)}
>
<span className="fl">最新回复</span>
</Link>
<Link to={`${hottestPath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf('order=hottest') !== -1 })}
onClick={()=>this.onNavClick(locationPath.indexOf('order=hottest') !== -1)}
>
<span className="fl">热门话题</span>
</Link>
<Link to={`${shixunDiscussPath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf('shixun_discuss') !== -1 })}
onClick={()=>this.onNavClick(locationPath.indexOf('shixun_discuss') !== -1)}
>
<span className="fl">实训回复</span>
</Link>
<Link to={`${techSharePath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf(techSharePath) === 0 })}
onClick={()=>this.onNavClick(locationPath.indexOf(techSharePath) === 0)}
>
<span className="fl">技术分享</span>
</Link>
<Link to={`${guidePath}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf(guidePath) === 0 })}
onClick={()=>this.onNavClick(locationPath.indexOf(guidePath) === 0)}
>
<span className="fl">操作指南</span>
</Link>
<Link to={`${guidePaths}`} className={classNames("fl font-16 padding5-20 block mr30 navItem"
, {'active': locationPath.indexOf(guidePaths) === 0 })}
onClick={()=>this.onNavClick(locationPath.indexOf(guidePaths) === 0)}
>
<span className="fl">通知公告</span>
</Link>
{/*<a href="/forums?type=discuss" className="fl font-16 ptl5-10 block mr20">
<span className="fl">实训交流</span>
<span className="forum_filtrate_span2 mt10 ml10 fl">1391</span>
</a>*/}
</p>
</div>
);
}
}
export default ForumsNavTab;

@ -119,11 +119,13 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback){
const typeNameMap = {
'技术分享': 5,
'操作指南': 3,
'操作指南': 3,
'通知公告':16,
}
export const typeNameMap2 = {
5: '技术分享',
3: '操作指南',
3: '操作指南',
16: '通知公告',
}
const defaultType = '技术分享'
@ -171,7 +173,8 @@ class MemoNew extends Component {
currentSelectRepertoiresIndex: -1,
repertoiresTagMap: {},
fileList: []
fileList: [],
forums:[{id:5,name:"技术分享"},{id:3,name:"技术指南"},{id:16,name:"通知公告"}],
}
}
onCommit() {
@ -336,6 +339,13 @@ class MemoNew extends Component {
$('head').append( $('<meta content="authenticity_token" name="csrf-param" />') )
$('head').append( $(`<meta content="${response.data.csrf_token}" name="csrf-token" />`) )
}
if(data.forums){
this.setState({
forums: data.forums===undefined||data.forums===null||data.forums.length===0? this.state.forums:data.forums
// repertoires,
// repertoiresTagMap
})
}
}).catch((error) => {
console.log(error)
})
@ -607,7 +617,7 @@ class MemoNew extends Component {
});
}
render() {
const { match, history } = this.props
const { match, history,forums } = this.props
const {
// repertoires, repertoiresTagMap, currentSelectRepertoiresIndex, memoRepertoire,
tag_list,
@ -754,6 +764,7 @@ class MemoNew extends Component {
onChange={(val)=>this.onTypeChange(val)}>
<Option value="技术分享">技术分享</Option>
<Option value="操作指南">操作指南</Option>
<Option value="通知公告">通知公告</Option>
</Select>
</div>
<div style={{width: '57px'}}>

@ -15,6 +15,7 @@ import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor'
class TPMRepositoryComponent extends Component {
constructor(props) {
super(props)
this.nameTypeMap = {}
let pathArray = []
var splitArray = window.location.pathname.split('shixun_show/');
if (splitArray[1]) {
@ -38,7 +39,7 @@ class TPMRepositoryComponent extends Component {
componentDidMount = () => {
this.nameTypeMap = {}
this.fetchRepo()
}
setContentWidth100 = (flag) => {
@ -139,7 +140,7 @@ class TPMRepositoryComponent extends Component {
let fileInPathArray = false;
if (newPathArray.length) {
fileInPathArray = this.nameTypeMap[newPathArray[newPathArray.length - 1]] ? this.nameTypeMap[newPathArray[newPathArray.length - 1]] !== 'tree'
: (listItem.type !== 'tree' && this._isFileName( newPathArray[newPathArray.length - 1] ))
: (listItem ? listItem.type !== 'tree' : this._isFileName( newPathArray[newPathArray.length - 1] ))
if ( fileInPathArray ) {
urlNewPathArray = newPathArray.slice(0, newPathArray.length - 1)
}

Loading…
Cancel
Save