Merge branch 'pre_gitlink_ssr' of https://gitlink.org.cn/Gitlink/forgeplus-react into gitlink_ssr_head
This commit is contained in:
commit
65a652d0c1
|
|
@ -93,7 +93,7 @@ function PublicBanner(props) {
|
|||
|
||||
function apply() {
|
||||
if (checkIfLogin() === false) {
|
||||
showLoginDialog()
|
||||
showLoginDialog(`/zone/${deptId}`)
|
||||
return false;
|
||||
} else if (memberStatus === memberStatusEnum.applying) {
|
||||
message.info("您已提交申请,请耐心等待管理员审核!")
|
||||
|
|
@ -108,7 +108,7 @@ function PublicBanner(props) {
|
|||
|
||||
function toLessonsFunc(){
|
||||
if (checkIfLogin() === false) {
|
||||
showLoginDialog()
|
||||
showLoginDialog(`/zone/${deptId}/lessons`)
|
||||
return false;
|
||||
} else{
|
||||
window.location.href = `/zone/${deptId}/lessons`;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ export function getCheckZoneRole(id) {
|
|||
});
|
||||
}
|
||||
|
||||
export function getCurrentRole(id) {
|
||||
export function getCurrentRole(id, deptId) {
|
||||
return fetch({
|
||||
url: `/zone/zoneFront/${id}/checkCurrentRole`,
|
||||
method: 'get',
|
||||
headers: {'Dept-Id': deptId}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function Main(props){
|
|||
<div>
|
||||
<AgreementModal visible={visible} onCancel={()=>setVisible(false)} onOk={onOk}/>
|
||||
<ul className="serverlist">
|
||||
<li>
|
||||
{/* <li>
|
||||
<span className="servername">
|
||||
<img src={require('./img/logo.png')} alt=""/>
|
||||
<a onClick={openDetail}>重睛鸟代码溯源</a>
|
||||
|
|
@ -55,7 +55,7 @@ function Main(props){
|
|||
<span className="serverbtn">
|
||||
<a onClick={openDetail} className="btnhover">查看详情</a>
|
||||
</span>
|
||||
</li>
|
||||
</li> */}
|
||||
{
|
||||
// 镜像项目隐藏服务
|
||||
projectDetail && parseInt(projectDetail.type) !== 2 && <li>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
|
|
@ -4,6 +4,7 @@ import axios from 'axios';
|
|||
import { branchForm, confirmInfo1, confirmInfo2, synchronizeTips } from './editStore';
|
||||
import gitHub from '../../img/github.png';
|
||||
import gitee from '../../img/gitee.png';
|
||||
import osredm from '../../img/osredm.png';
|
||||
import '../index.scss';
|
||||
|
||||
function DeleteBox({owner, projectsId, visible, setVisible, branchList, reload, form, sync_repositories_unique=[], repositoriesBranch}) {
|
||||
|
|
@ -76,6 +77,7 @@ function DeleteBox({owner, projectsId, visible, setVisible, branchList, reload,
|
|||
}}>
|
||||
<Select.Option value="Github" disabled={!repositoriesBranch["Github"]}><img src={gitHub} alt="" className="storeLogo mr5"/>Github{!repositoriesBranch["Github"] && ",获取分支列表失败,请检查token是否有效"}</Select.Option>
|
||||
<Select.Option value="Gitee" disabled={!repositoriesBranch["Gitee"]}><img src={gitee} alt="" className="storeLogo mr5"/>Gitee{!repositoriesBranch["Gitee"] && ",获取分支列表失败,请检查token是否有效"}</Select.Option>
|
||||
<Select.Option value="Osredm" disabled={!repositoriesBranch["Osredm"]}><img src={osredm} alt="" className="storeLogo mr5"/>Osredm{!repositoriesBranch["Osredm"] && ",获取分支列表失败,请检查token是否有效"}</Select.Option>
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import React, {Fragment, forwardRef, useEffect, useState} from "react";
|
||||
import { Button, Divider, Form, Icon, Input, Radio, Select, Steps, Tooltip, message, Modal , AutoComplete } from "antd";
|
||||
import github from '../../img/github.png';
|
||||
import gitee from '../../img/gitee.png';
|
||||
import arrow from '../../img/arrow.png';
|
||||
import '../index.scss';
|
||||
import axios from "axios";
|
||||
|
|
@ -148,10 +146,10 @@ function EditStore(props){
|
|||
|
||||
// 根据已配置仓库同步的平台显示还剩哪些平台
|
||||
const synchronizedPlatformList = sync_repositories_unique.map(item=>{return item.type.split("::").pop()})
|
||||
const platformList = (synchronizedPlatformList.length && ["Github", "Gitee"].filter(item=>synchronizedPlatformList.indexOf(item) === -1)) || ["Github", "Gitee"]
|
||||
const platformList = (synchronizedPlatformList.length && ["Github", "Gitee", "Osredm"].filter(item=>synchronizedPlatformList.indexOf(item) === -1)) || ["Github", "Gitee", "Osredm"]
|
||||
|
||||
// 正则:校验是否是gitee或者github的仓库地址
|
||||
const pattern = platform && (platform === "Github" ? /^https:\/\/github\.com\/.+\/.+$/ : /^https:\/\/gitee\.com\/.+\/.+$/)
|
||||
const pattern = platform && (platform === "Github" ? /^https:\/\/(www\.)?github\.com\/.+\/.+$/ : platform === "Gitee" ? /^https:\/\/(www\.)?gitee\.com\/.+\/.+$/ : /^https:\/\/(www\.)?osredm\.com\/.+\/.+$/)
|
||||
|
||||
useEffect(()=>{
|
||||
// 获取分支列表
|
||||
|
|
@ -248,6 +246,7 @@ function EditStore(props){
|
|||
1、登录{platform},确保拥有读写同步仓库的权限<br/>
|
||||
{platform === "Github" && "2、找到已存在的token,或新建一个token;新建方式为:点击个人头像→Settings→Developer Settings→Personal access tokens (classic)→Generate new token"}
|
||||
{platform === "Gitee" && "2、找到已存在的token,或新建一个token,新建方式为:点击个人头像→设置→私人令牌→生成新令牌"}
|
||||
{platform === "Osredm" && "2、找到已存在的token,或新建一个token,新建方式为:点击个人头像→账号管理→私人令牌→生成新令牌"}
|
||||
<br/>
|
||||
3、确保token拥有仓库读写权限,且未过期。将token复制到此处token填写框
|
||||
</div>}>
|
||||
|
|
@ -300,7 +299,7 @@ function EditStore(props){
|
|||
<Button type="primary" ghost className="mt10 mb10 ml10" onClick={()=>{
|
||||
const {type, external_repo_address} = values;
|
||||
if(external_repo_address){
|
||||
window.open(`${external_repo_address.replace(/.git$/, "")}${type === "Github" ? "/settings/hooks" : "/hooks"}`)
|
||||
window.open(`${external_repo_address.replace(/.git$/, "")}${type === "Github" ? "/settings/hooks" : type === "Gitee" ? "/hooks" : `/settings/webhooks`}`)
|
||||
}else{
|
||||
message.error("您暂未配置同步仓库地址")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ import React, { Fragment, useState } from "react";
|
|||
import '../index.scss';
|
||||
import { Breadcrumb, Button, Input, Table, Tag, message } from "antd";
|
||||
import { Link } from "react-router-dom";
|
||||
import gitHub1 from '../../img/github1.png';
|
||||
import gitee1 from '../../img/gitee1.png';
|
||||
import axios from "axios";
|
||||
import { platformLogo } from "..";
|
||||
|
||||
function RecordList(props){
|
||||
const { owner , projectsId, platform } = props.match.params;
|
||||
|
|
@ -13,7 +12,6 @@ function RecordList(props){
|
|||
const [token, setToken] = useState({});
|
||||
|
||||
function inviteClick(idName) {
|
||||
console.log('idName', idName);
|
||||
const copyEle = document.querySelector(idName); // 获取要复制的节点
|
||||
if (!copyEle) {
|
||||
console.error("您的CopyTool未设置正确的inputId");
|
||||
|
|
@ -40,7 +38,7 @@ function RecordList(props){
|
|||
const {type, external_repo_address, sync_repository_ids} = item
|
||||
return <Fragment>
|
||||
<div className="font-15 mt20 mb7">同步仓库平台</div>
|
||||
<div className="infoBox">{<img src={type === "SyncRepositories::Github" ? gitHub1 : gitee1} alt="" style={{width: '75px'}}/>}</div>
|
||||
<div className="infoBox">{type && platformLogo(type.split("::")[1])}</div>
|
||||
<div className="font-15 mt20 mb7">同步仓库地址</div>
|
||||
<div className="infoBox"><a href={external_repo_address} target="_blank">{external_repo_address}</a></div>
|
||||
<div className="font-15 mt20 mb7">Webhook接受请求地址</div>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ function StoreList(props){
|
|||
const externalRepoInfo = {
|
||||
address: repoInfoByType && repoInfoByType.external_repo_address,
|
||||
branchName: external_branch_name,
|
||||
type
|
||||
type: type && type.split("::")[1]
|
||||
}
|
||||
const gitlinkRepoInfo = {
|
||||
address: `${window.location.origin}/${owner}/${projectsId}.git`,
|
||||
|
|
@ -53,7 +53,6 @@ function StoreList(props){
|
|||
type: "gitlink"
|
||||
}
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
axios.get(`/${owner}/${projectsId}/pulls/get_branches.json`, {}).then(res=>{
|
||||
res && setBranchList(res.data);
|
||||
|
|
@ -120,7 +119,7 @@ function StoreList(props){
|
|||
let columns = [
|
||||
{ title: '序号', dataIndex: 'index', className:"recordColumns", render: (text, item, index) => <span>{(current-1)*pageSize+index + 1}</span> },
|
||||
{ title: '第三方平台分支', dataIndex: "external_branch_name", className:"recordColumns taskName", width: '300px', render: (text, item) => <span>
|
||||
{platformLogoUnText(item.type, "21px")}{text}
|
||||
{platformLogoUnText(item.type.split("::")[1], "21px")}{text}
|
||||
</span> },
|
||||
{ title: 'GitLink分支', dataIndex: 'gitlink_branch_name', width: '300px', className:"recordColumns", render: (text, item) => <span>
|
||||
<img src={gitlinkLogo} alt="" style={{width: "20px"}} className="storeLogo mr5"/>{text}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import gitHub1 from '../img/github1.png';
|
|||
import gitee1 from '../img/gitee1.png';
|
||||
import gitHub from '../img/github.png';
|
||||
import gitee from '../img/gitee.png';
|
||||
import osredm from '../img/osredm.png';
|
||||
import osredm1 from '../img/osredm1.png';
|
||||
import gitlink from '../img/gitlink.jpg';
|
||||
import gitlink1 from '../img/gitlink1.png';
|
||||
import Loadable from "react-loadable";
|
||||
import { Route, Switch } from "react-router";
|
||||
|
|
@ -35,11 +38,56 @@ const Setting = Loadable({
|
|||
});
|
||||
|
||||
export const platformLogo = (platform="Github", width="80px") => {
|
||||
return <img src={platform.indexOf("Github") !== -1 ? gitHub1 : platform === "gitlink" ? gitlink1 : gitee1} alt="" style={{width: platform === "gitlink" ? '120px' : width}}/>
|
||||
const normalizedPlatform = platform.toLowerCase() || "";
|
||||
|
||||
// 映射平台到对应的logo
|
||||
const logoMap = {
|
||||
github: gitHub1,
|
||||
gitee: gitee1,
|
||||
gitlink: gitlink1,
|
||||
osredm: osredm1
|
||||
};
|
||||
|
||||
// 获取logo,如果没有匹配则返回null
|
||||
const logo = logoMap[normalizedPlatform];
|
||||
|
||||
// 如果没有匹配的logo,不显示
|
||||
if (!logo) return null;
|
||||
|
||||
// gitlink特殊宽度处理
|
||||
const imageWidth = normalizedPlatform === "gitlink" ? '110px' : width;
|
||||
|
||||
return <img src={logo} alt={platform} style={{ width: imageWidth }} />;
|
||||
}
|
||||
|
||||
export const platformLogoUnText = (platform="Github", width="18px") => {
|
||||
return <img src={platform.indexOf("Github") !== -1 ? gitHub : gitee} alt="" style={{width: width}} className="storeLogo mr5"/>
|
||||
const normalizedPlatform = platform.toLowerCase() || "";
|
||||
|
||||
// 映射平台到对应的无文字logo
|
||||
const logoMap = {
|
||||
github: gitHub,
|
||||
gitee: gitee,
|
||||
gitlink: gitlink,
|
||||
osredm: osredm
|
||||
};
|
||||
|
||||
// 获取logo,如果没有匹配则返回null
|
||||
const logo = logoMap[normalizedPlatform];
|
||||
|
||||
// 如果没有匹配的logo,不显示
|
||||
if (!logo) return null;
|
||||
|
||||
// 特殊宽度处理
|
||||
const imageWidth = normalizedPlatform === "osredm" ? '21px' : width;
|
||||
|
||||
return (
|
||||
<img
|
||||
src={logo}
|
||||
alt={platform}
|
||||
style={{ width: imageWidth }}
|
||||
className="storeLogo mr5"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function Reposyncer(propsF){
|
||||
|
|
|
|||
|
|
@ -431,6 +431,7 @@ class LoginDialog extends Component {
|
|||
|
||||
render() {
|
||||
let { login, isGoing, isGoingValue, disabled , Phonenumberisnotco , dialogBox, isRender, weixinlogin, settings } = this.state;
|
||||
const {gopage} = this.props
|
||||
|
||||
if (isRender === undefined) {
|
||||
isRender = false
|
||||
|
|
@ -536,7 +537,7 @@ class LoginDialog extends Component {
|
|||
<span className="fr">
|
||||
<a href="/resetPassword" className="mr3 color-grey-9">找回密码</a>
|
||||
<em className="vertical-line"></em>
|
||||
<a href="/register" className="color-grey-9">注册</a>
|
||||
<a href={`/register${gopage ? `?go_page=${gopage}` : ""}`} className="color-grey-9">注册</a>
|
||||
</span>
|
||||
</p>
|
||||
<OtherLogin location={this.props.location} main_site_url={settings.common.main_site_url}/>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import OtherLogin from "./component/otherLogin";
|
|||
import cookie from 'react-cookies';
|
||||
import './LoginRegisterPage.scss';
|
||||
import { Encrypt } from "../../common/Env";
|
||||
import { getCurrentRole } from "../../forge/Information/api";
|
||||
|
||||
function Login(props){
|
||||
const [message,setMessage] = useState();
|
||||
|
|
@ -55,8 +56,17 @@ function Login(props){
|
|||
|
||||
const searchParams = new URLSearchParams(search.substring(1));
|
||||
const goPage = searchParams.get("go_page");
|
||||
//意见反馈
|
||||
window.location.href = goPage ? goPage : `/${response.data.login}`
|
||||
if(goPage && goPage.includes("gitlink.educoder.net")){
|
||||
const {login, real_name, nickname, email, custom_department, phone} = response.data;
|
||||
const params =`websiteName=gitlink&openkey=`+Base64.encode("05e9081ede2e7425db064df44b5fb1897234f44f922443b89597d17b60dc8f3e")+`&sign=cdf0f69b4d5b4293f7914cc1f1f31742&login=`+login+`&lastname=`+real_name+`&nickname=`+nickname+`&mail=`+email+`&school_name=`+custom_department+`&phone=`+phone+``;
|
||||
getCurrentRole(34, 375).finally(()=>{
|
||||
const decodedGoPage = decodeURIComponent(goPage);
|
||||
const separator = decodedGoPage.includes('?') ? '&' : '?';
|
||||
window.location.href = decodedGoPage + separator + params;
|
||||
})
|
||||
}else{
|
||||
window.location.href = goPage ? decodeURIComponent(goPage) : `/${response.data.login}`
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log('error',error);
|
||||
|
|
@ -81,7 +91,7 @@ function Login(props){
|
|||
<div className="right_cont login_content">
|
||||
<div className="login_register_head mb30">
|
||||
<span>欢迎登录 GitLink</span>
|
||||
<span className="link_span">没有账号?<Link to={`/register`}>去注册</Link></span>
|
||||
<span className="link_span">没有账号?<Link to={`/register${search}`}>去注册</Link></span>
|
||||
</div>
|
||||
<p className = {message?"message active mb10":"message"}>{message}</p>
|
||||
<Form className="login-form">
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ import { setmiyah } from 'educoder';
|
|||
import './LoginRegisterPage.scss';
|
||||
import OtherLogin from "./component/otherLogin";
|
||||
import { Encrypt } from "../../common/Env";
|
||||
import { getCurrentRole } from "../../forge/Information/api";
|
||||
|
||||
function Register(props){
|
||||
const {form, mygetHelmetapi,location} = props;
|
||||
const {search} = location;
|
||||
const {getFieldDecorator, setFieldsValue } = form;
|
||||
//用户输入的符合规则的邮箱(用于获取验证码)
|
||||
const [emailStr, setEmailStr] = useState(undefined);
|
||||
|
|
@ -45,9 +47,10 @@ function Register(props){
|
|||
function handleSubmit(){
|
||||
form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
const user_login = values.register_username.trim()
|
||||
values.agreement && axios.post(`/accounts/register.json`, {
|
||||
login: values.email,
|
||||
namespace: values.register_username.trim(),
|
||||
namespace: user_login,
|
||||
password: Encrypt(values.register_psd),
|
||||
password_confirmation: Encrypt(values.psdComfirm),
|
||||
code: values.captcha
|
||||
|
|
@ -59,7 +62,18 @@ function Register(props){
|
|||
setEmailStr(values.email);
|
||||
}else if(response.data && response.data.status === 0){
|
||||
//注册成功,页面跳转即可,注册后登录流程forge处理了
|
||||
window.location.href = "/"+values.register_username.trim();
|
||||
const searchParams = new URLSearchParams(search.substring(1));
|
||||
const goPage = searchParams.get("go_page");
|
||||
if(goPage && goPage.includes("gitlink.educoder.net")){
|
||||
const params = `websiteName=gitlink&openkey=${Base64.encode("05e9081ede2e7425db064df44b5fb1897234f44f922443b89597d17b60dc8f3e")}&sign=cdf0f69b4d5b4293f7914cc1f1f31742&login=${user_login}${values.email.includes("@") ? `&mail=${values.email}` : `&phone=${values.email}&mail=${user_login}@example.org`}`
|
||||
getCurrentRole(34, 375).finally(()=>{
|
||||
const decodedGoPage = decodeURIComponent(goPage);
|
||||
const separator = decodedGoPage.includes('?') ? '&' : '?';
|
||||
window.location.href = decodedGoPage + separator + params;
|
||||
})
|
||||
}else{
|
||||
window.location.href = goPage ? decodeURIComponent(goPage) : `/${user_login}`
|
||||
}
|
||||
} else {
|
||||
setEmailStr(values.email);
|
||||
setMess(response.data.message);
|
||||
|
|
@ -229,7 +243,7 @@ function Register(props){
|
|||
<div className="right_cont Register_content">
|
||||
<div className="login_register_head mb30">
|
||||
<span>欢迎注册 GitLink</span>
|
||||
<span className="link_span">已有账号,<Link to={`/login`}>立即登录</Link></span>
|
||||
<span className="link_span">已有账号,<Link to={`/login${search}`}>立即登录</Link></span>
|
||||
</div>
|
||||
<div className="registerNav mb20 font-18">
|
||||
<a className={`type ${registerType ? '' : 'activeRegisterNav'}`} onClick={()=>{changeRegisterType(0)}}>手机号注册</a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue