Merge branch 'gitlink_orz' into gitlink_chain

This commit is contained in:
caishi 2023-04-27 15:29:43 +08:00
commit 4caf3ca04c
10 changed files with 167 additions and 141 deletions

View File

@ -3268,6 +3268,7 @@ a.user_greybg_btn {
.markdown-body ul>li {
list-style-type: disc !important;
margin-bottom: 0 !important;
}
.new_li .markdown-body ol>li,

View File

@ -16,7 +16,7 @@ import IDEPlugin, { ExtensionCommand } from './plugins/idePlugin';
import { repoService } from './codeReview/mock/repo.service';
function CloudIDE({ download_url, params: { owner, projectsId, branchName }, filepath }) {
function CloudIDE({ download_url, params: { owner, projectsId, branchName }, filepath , value }) {
function FileContentStore() {
const [loading, setLoading] = useState(true);
const [showIde, setShowIde] = useState(false);
@ -35,8 +35,7 @@ function CloudIDE({ download_url, params: { owner, projectsId, branchName }, fil
};
}
const { fileSize, fileName } =
FileContentStore();
const { fileSize, fileName } = FileContentStore();
const fileCache = new Map();
const copyFile = () => {
@ -92,12 +91,11 @@ function CloudIDE({ download_url, params: { owner, projectsId, branchName }, fil
// blame
const onBlame = async (e) => {
setBlameChecked(e.target.checked);
console.log('onBlame:', e.target.checked);
if (!e.target.checked) {
plugin.current.commands.executeCommand(ExtensionCommand.toggleBlame);
if (!e.target.checked ) {
plugin.current.commands && plugin.current.commands.executeCommand(ExtensionCommand.toggleBlame);
} else {
const res = await repoService.getCodeBlame(projectsId, owner, { sha:decodeURIComponent(branchName), filepath })
plugin.current.commands.executeCommand(ExtensionCommand.toggleBlame, res);
plugin.current.commands && plugin.current.commands.executeCommand(ExtensionCommand.toggleBlame, res);
}
};
const [wordWrap, setWordWrap] = useState(false);
@ -194,89 +192,92 @@ function CloudIDE({ download_url, params: { owner, projectsId, branchName }, fil
wordWrap={wordWrap}
setWordWrap={onWordWrapChange}
/> */}
<EditorRenderer
appConfig={{
//
plugins: [changeThemePlugin, plugin.current],
workspaceDir: `${owner}/${projectsId}`,
defaultPreferences: {
// opensumi-dark
// 'general.theme': 'opensumi-light',
'general.theme': 'opensumi-light',
//
'editor.forceReadOnly': true,
//
'editor.scrollBeyondLastLine': false,
},
extensionMetadata: [
html,
css,
json,
typescript,
markdown,
ideTheme,
CodeBlame],
}}
runtimeConfig={{
//
biz: 'gitlink',
// editor null
scenario: null,
// editor none
startupEditor: 'none',
// editor tab
hideEditorTab: true,
}}
editorConfig={{
stretchHeight: true,
disableEditorSearch: true,
}}
//
documentModel={{
// code code
type: 'code',
// tag
ref: branchName,
//
owner: owner,
//
name: projectsId,
//
filepath: filepath,
//
readFile: async (filepath) => {
if (!filepath) {
return;
}
//
// const res = await fetch('https://gist.githubusercontent.com/gaearon/0b180827c190fe4fd98b4c7f570ea4a8/raw/b9157ce933c79a4559d2aa9ff3372668cce48de7/LikeButton.js');
const res = await fetch(`${getUrl()}/attachments/entries/get_file?download_url=${download_url}`);
setTimeout(()=>{
onWordWrapChange(localStorage.getItem('code.file.viewer.worlWrap') === 'on');
},5000)
return res.arrayBuffer();
},
// utf8 gbk
// encoding: 'utf8',
encoding,
onFilepathChange: (changedFilepath) => {
if (changedFilepath) {
console.log(`路由跳转到 ${changedFilepath}`)
}
},
//
// lineNumber: [0, 1],
onLineNumberChange: line => {
if (typeof line === 'number') {
console.log(`#L${line}`)
} else {
console.log(`#L${line[0]}-${line[1]}`)
}
},
}}
/>
{
value ?
<EditorRenderer
appConfig={{
//
plugins: [changeThemePlugin, plugin.current],
workspaceDir: `${owner}/${projectsId}`,
defaultPreferences: {
// opensumi-dark
// 'general.theme': 'opensumi-light',
'general.theme': 'opensumi-light',
//
'editor.forceReadOnly': true,
//
'editor.scrollBeyondLastLine': false,
},
extensionMetadata: [
html,
css,
json,
typescript,
markdown,
ideTheme,
CodeBlame],
}}
runtimeConfig={{
//
biz: 'gitlink',
// editor null
scenario: null,
// editor none
startupEditor: 'none',
// editor tab
hideEditorTab: true,
}}
editorConfig={{
stretchHeight: true,
disableEditorSearch: true,
}}
//
documentModel={{
// code code
type: 'code',
// tag
ref: branchName,
//
owner: owner,
//
name: projectsId,
//
filepath: filepath,
//
readFile: async (filepath) => {
if (!filepath) {
return;
}
//
// const res = await fetch('https://gist.githubusercontent.com/gaearon/0b180827c190fe4fd98b4c7f570ea4a8/raw/b9157ce933c79a4559d2aa9ff3372668cce48de7/LikeButton.js');
const res = await fetch(`${getUrl()}/attachments/entries/get_file?download_url=${download_url}`);
setTimeout(()=>{
onWordWrapChange(localStorage.getItem('code.file.viewer.worlWrap') === 'on');
},5000)
return res.arrayBuffer();
},
// utf8 gbk
// encoding: 'utf8',
encoding,
onFilepathChange: (changedFilepath) => {
if (changedFilepath) {
console.log(`路由跳转到 ${changedFilepath}`)
}
},
//
// lineNumber: [0, 1],
onLineNumberChange: line => {
if (typeof line === 'number') {
console.log(`#L${line}`)
} else {
console.log(`#L${line[0]}-${line[1]}`)
}
},
}}
/>:
<div className="pl20">空文件</div>
}
</Fragment>
)
}

View File

@ -34,6 +34,7 @@ class m_editor extends Component {
render() {
const { editorValue, changeValue } = this.state;
console.log("editorValue:",editorValue)
const { readOnly, editorType,onEmpty,filename,empty, currentBranch, descName, checkName, detail, match: { params },filepath,ideTheme } = this.props;
const editor_options = {
lineNumbers: "on",
@ -68,7 +69,7 @@ class m_editor extends Component {
options={editor_options}
onChange={this.changeEditor}
/> :
<CloudIDE download_url={download_url} params={params} filepath={filepath&&filepath.startsWith('/')?filepath.slice(1):filepath}/>
<CloudIDE download_url={download_url} value={editorValue} params={params} filepath={filepath&&filepath.startsWith('/')?filepath.slice(1):filepath}/>
}
</div>
{!readOnly && (

View File

@ -101,22 +101,22 @@
width: 72%;
margin-bottom: 30px;
padding:30px;
.newstatus{
.teamnewstatus{
padding-bottom: 20px;
border-bottom: 1px dashed rgba(170, 175, 190, 1);
.desc{
.teamdesc{
color:#4c5876;
font-size:14px;
line-height:26px;
}
.title{
.teamtitle{
height:22px;
line-height:22px;
color:#1f2329;
font-size:16px;
margin:20px auto 14px!important;
}
.name{
.teamname{
height:24px;
span{
font-weight:700;
@ -130,7 +130,6 @@
}
}
.sepment{
text-align: center;
margin:30px auto 20px;
.ant-radio-group{
.ant-radio-button-wrapper{
@ -138,6 +137,7 @@
line-height: 42px;
border:none;
border:1px solid #cccfd2;
text-align: center;
&:first-child{
border-right: none;
}
@ -551,11 +551,14 @@
}
}
.overviewcontent{
.ConcentrateTip{
margin:20px 0px 0px 0px!important;
}
.concentrateUl li{
border-color:#cddbeb!important;
border-radius:4px;
}
.ConcentrateTipImg{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}

View File

@ -10,6 +10,7 @@ import CheckProfile from '../Component/ProfileModal/Profile';
import { Menu , Pagination , Dropdown , Spin , Tabs , Radio } from 'antd';
import ConcentrateProject from '../users/GeneralView/ConcentrateProject';
import { getImageUrl } from 'educoder';
import EmptyImg from '../Images/nodata.png';
import axios from 'axios';
const limit = 15;
@ -123,12 +124,12 @@ function List(props){
<div className="list-l">
{
organizeDetail.news_title &&
<div className="newstatus">
<p className="name"><i className="iconfont icon-dongtaiicon1" /><span>新闻动态</span></p>
<p className="title">
<div className="teamnewstatus">
<p className="teamname"><i className="iconfont icon-dongtaiicon1" /><span>新闻动态</span></p>
<p className="teamtitle">
{organizeDetail.news_title}
</p>
<div className="desc">
<div className="teamdesc">
{organizeDetail.news_content}
</div>
</div>
@ -153,18 +154,24 @@ function List(props){
btn={
<span><i className="iconfont icon-zidingyi font-14 mr5"></i>自定义</span>
}
emptyContent={
<img src={EmptyImg} width="325px" alt=""/>
}
typeFlag={true}
userLogin={OIdentifier}
type="organizations"
current={organizeDetail.is_admin}
/>
<div>
<p className="mt30 mb10">
<i className="iconfont icon-zuzhijieshao mr4"></i>
<span className="font-17">组织介绍</span>
</p>
<div style={{color:"#4c5876",lineHeight:"30px",wordBreak:"break-all",textAlign:"justify"}}>{organizeDetail.memo}</div>
</div>
{
organizeDetail.memo &&
<div>
<p className="mt30 mb10">
<i className="iconfont icon-zuzhijieshao mr4"></i>
<span className="font-17">组织介绍</span>
</p>
<div style={{color:"#4c5876",lineHeight:"30px",wordBreak:"break-all",textAlign:"justify"}}>{organizeDetail.memo}</div>
</div>
}
</div>
}
{

View File

@ -14,10 +14,10 @@ export default Form.create()(forwardRef((props)=>{
const [ imageUrl , setImageUrl ] = useState("");
const [ imageId , setImageId ] = useState(undefined);
useEffect(()=>{
let url = imageId ? getImageUrl(`/api/attachments/${imageId}`) :"";
setImageUrl(url);
},[imageId])
// useEffect(()=>{
// let url = imageId ? getImageUrl(`/api/attachments/${imageId}`) :"";
// setImageUrl(url);
// },[imageId])
useEffect(()=>{
if(organizeDetail){
@ -41,7 +41,7 @@ export default Form.create()(forwardRef((props)=>{
axios.post(url,{
...values,
memo:content,
news_banner_id:imageId
// news_banner_id:imageId
}).then(result=>{
if(result){
props.showNotification("组织首页更新成功!");
@ -57,9 +57,9 @@ export default Form.create()(forwardRef((props)=>{
</Title>
<Form style={{padding:"20px 30px 30px 30px"}}>
<p>新闻动态图片</p>
{/* <p></p>
<UploadImage url={imageUrl} getImageId={(id)=>{setImageId(id);}}/>
<p><a className="color-blue" onClick={()=>setImageId("")}>删除</a></p>
<p><a className="color-blue" onClick={()=>setImageId("")}>删除</a></p> */}
<Form.Item label="新闻动态原文链接">
{getFieldDecorator("news_url",{
rules:[]

View File

@ -147,8 +147,8 @@ function ConcentrateBox({ visible , onCancel , onSure , type , username , choose
onChange={(e)=>setSearch(e.target.value)}
/>
</div>
<div className="listbox">
<Checkbox.Group value={value} onChange={chooseProject} style={{width:"100%"}}>
<div className="conbox">
<Checkbox.Group value={value} onChange={chooseProject}>
{
copyList && copyList.length >0 && copyList.map((i,k)=>{
return(

View File

@ -14,7 +14,8 @@ function ConcentrateProject({
type,
title,
typeFlag,
btn
btn,
emptyContent
}) {
const [ list , setList ] = useState(undefined);
const [ visible , setVisible ] = useState(false);
@ -106,7 +107,19 @@ function ConcentrateProject({
}
</div>
{
list && list.length === 0 && current && <div className="ConcentrateTip"><i className="iconfont icon-tishi2"></i>你还没有设置精选项目<a onClick={()=>setVisible(true)}>点击设置</a></div>
(!emptyContent && list && list.length === 0 && current) &&
<div className="ConcentrateTip">
<i className="iconfont icon-tishi2"></i>
你还没有设置精选项目<a onClick={()=>setVisible(true)}>点击设置</a>
</div>
}
{
emptyContent && list && list.length === 0 ?
<div className="ConcentrateTipImg">
{emptyContent}
<span className="font-15">暂无数据{current && <span><a className="color-blue" onClick={()=>setVisible(true)}>点击设置</a></span>}</span>
</div>
:""
}
</React.Fragment>
)

View File

@ -74,10 +74,27 @@
padding:0px;
padding-bottom: 15px;
}
.listbox{
.conbox{
max-height: 210px;
overflow-y: auto;
padding-left: 30px;
.ant-checkbox-group{
display: flex;
flex-wrap: wrap;
width: 100%;
.ant-checkbox-wrapper{
width: 48%;
margin-left: 0px!important;
display: flex;
align-items: center;
span:last-child{
flex:1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
}
.operateDiv{
padding:20px 30px
@ -87,24 +104,6 @@
padding-top:15px;
cursor: pointer;
}
.ant-checkbox-group{
display: flex;
flex-wrap: wrap;
.ant-checkbox-wrapper{
width: 50%;
margin-left: 0px!important;
display: flex;
.ant-checkbox{
padding-top: 3px;
}
span:last-child{
flex:1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
}
.recentStatic{
padding: 30px 0px;

View File

@ -2139,9 +2139,10 @@ input.ant-input-number-input:focus {
}
/* md代码类样式渲染 */
.new_li .markdown-body ul>li {
.new_li .markdown-body ul>li ,.markdown-body ul>li {
list-style-type: disc !important;
margin-bottom: 0 !important;
white-space: pre-wrap;
}
.new_li .markdown-body ol>li {