课程又要继续支持跳转慕课、移除ssh、拼接clone地址、首页课程跳转问题

This commit is contained in:
黄心宇 2026-01-08 17:32:33 +08:00
parent 8de2b403a6
commit 8ec860eec8
6 changed files with 64 additions and 24 deletions

View File

@ -130,7 +130,9 @@ const Resource2 = forwardRef(({ zoneId }, ref) => {
<div className="item-info">
<h4 title={ item.name }>{item.name}</h4>
<p title={ item.summary }>{item.summary}</p>
<button className="shiny-button" onClick={() => { window.open(item.extendDataUrl) }}>查看详情</button>
<Link to={`/sf/lessons/${ item.id }`}>
<button className="shiny-button">查看详情</button>
</Link>
</div>
</div>
})

View File

@ -102,6 +102,10 @@
font-weight: 700;
color: #091221;
font-size: 22px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding-right: 30px;
}
p {
@ -111,6 +115,9 @@
overflow: hidden;
color: #091221;
}
a {
margin-top: auto;
}
button {
cursor: pointer;
@ -125,7 +132,6 @@
color: #091221;
font-size: 14px;
text-align: center;
margin-top: auto;
// background: #ffffff !important;
background-image: linear-gradient(#ffffff, #ffffff);

View File

@ -62,23 +62,29 @@ function Index(props) {
<p title={detail.summary}>{detail.summary}</p>
{
detail.keywords === docId &&
<button onClick={() => {
if (detail.fileIds) {
downloadFunc(`${httpUrl}/file/open/download/${detail.fileIds}`)
}
}} disabled={!detail.fileIds} className={`shiny-button ${!detail.fileIds && 'disabled'}`} >{detail.fileIds ? '立即下载' : '稍后下载'}</button>
<button onClick={() => {
if (detail.fileIds) {
downloadFunc(`${httpUrl}/file/open/download/${detail.fileIds}`)
}
}} disabled={!detail.fileIds} className={`shiny-button ${!detail.fileIds && 'disabled'}`} >{detail.fileIds ? '立即下载' : '稍后下载'}</button>
}
{
detail.url &&
<button className="shiny-button" onClick={() => {
window.scrollTo({left:0, top: document.body.scrollHeight, behavior: 'smooth'})
if (videoRef.current) {
videoRef.current.play()
}
}}>
detail.keywords !== docId && detail.url &&
<button className="shiny-button" onClick={() => {
window.scrollTo({ left: 0, top: document.body.scrollHeight, behavior: 'smooth' })
if (videoRef.current) {
videoRef.current.play()
}
}}>
立即观看
</button>
}
{
detail.keywords !== docId && detail.url2 &&
<button className="button2" onClick={() => { window.open(detail.url2) }}>查看慕课</button>
}
<div className="header-img">
<div className="header-img-wrapper">
<img src={detail.headImg || imageBack1} alt="" />
@ -96,7 +102,7 @@ function Index(props) {
}
{
detail.url && <div className="news-detail-content-wrapper">
<video ref={videoRef} src={ detail.url } controls={ true } poster={ detail.headImg || imageBack1 }></video>
<video ref={videoRef} src={detail.url} controls={true} poster={detail.headImg || imageBack1}></video>
</div>
}
</div>

View File

@ -128,6 +128,15 @@
text-align: center;
background-color: #091221;
}
.button2 {
margin-left: 20px;
border: 1px solid #091221;
font-family: alibaba;
font-weight: 500;
color: #091221;
font-size: 14px;
background-color: unset;
}
h6 {
margin-top: 34px;

View File

@ -148,7 +148,7 @@
text-overflow: ellipsis;
overflow: hidden;
padding-right: 30px;
width: 600px;
}
&::before {

View File

@ -1,24 +1,41 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Menu } from 'antd';
import "./branch.scss";
import CopyTool from '../Component/CopyTool';
function CloneAddress({http_url , ssh_url , zip_url , tar_url}) {
const [ key , setKey ] = useState("HTTP");
function CloneAddress({ http_url, ssh_url, zip_url, tar_url }) {
const [key, setKey] = useState("HTTP");
const [cloneUrl, setCloneUrl] = useState("");
useEffect(() => {
if (!http_url) {
setCloneUrl('');
return;
}
const match = http_url.match(/:3000\/(.+)/);
if (match && match[1]) {
const path = match[1];
setCloneUrl(`${window.location.hostname}:3000/${path}`);
} else {
setCloneUrl(http_url);
}
}, [http_url]);
return (
<div className="downMenu">
<div>
<Menu className="urlMenu" selectedKeys={[key]} mode={"horizontal"}>
<Menu.Item key="HTTP" onClick={(e)=>{setKey(e.key)}}>HTTP</Menu.Item>
{ssh_url && <Menu.Item key="SSH" onClick={(e)=>{setKey(e.key)}}>SSH</Menu.Item>}
<Menu.Item key="HTTP" onClick={(e) => { setKey(e.key) }}>HTTP</Menu.Item>
{/* {ssh_url && <Menu.Item key="SSH" onClick={(e)=>{setKey(e.key)}}>SSH</Menu.Item>} */}
</Menu>
<div className="gitAddressClone">
<input type="text" id="copy_rep_content" value={key==="HTTP" ? http_url:ssh_url} />
<CopyTool inputId="copy_rep_content" className="copytool"/>
<input type="text" id="copy_rep_content" value={cloneUrl} />
<CopyTool inputId="copy_rep_content" className="copytool" />
</div>
</div>
<Menu className="edu-txt-center">
{zip_url && <Menu.Item style={{borderTop:"1px solid #eee"}}><a href={zip_url}>下载 ZIP</a></Menu.Item>}
{zip_url && <Menu.Item style={{ borderTop: "1px solid #eee" }}><a href={zip_url}>下载 ZIP</a></Menu.Item>}
{tar_url && <Menu.Item><a href={tar_url}>下载 TAR.GZ</a></Menu.Item>}
</Menu>
</div>