个人建站

This commit is contained in:
谢思 2023-12-21 16:17:27 +08:00
parent 16886e2086
commit 147e9edcc2
8 changed files with 35 additions and 18 deletions

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
var proxy = "http://172.20.32.202:4000";
var proxy = "https://testforgeplus.trustie.net/";
//响应前的设置
axios.interceptors.request.use(

View File

@ -308,7 +308,7 @@ function Details(props){
}).then(result=>{
if(result && result.data && result.data.project_issues_index){
window.scrollTo(0,0);
props.showNotification("任务复制成功!");
props.showNotification("疑修复制成功!");
props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`);
}
}).catch(error=>{})

View File

@ -6,6 +6,8 @@ import axios from "axios";
import { AlignCenter, AlignTop } from "../../Component/layout";
import { Link } from "react-router-dom";
import { getImageUrl } from "../../../common/UrlTool";
import { ImageLayerOfCommentHOC } from "../../../modules/page/layers/ImageLayerOfCommentHOC";
import { withRouter } from "react-router";
const { TextArea } = Input;
function CreateSite(props) {
@ -18,6 +20,11 @@ function CreateSite(props) {
useEffect(() => {
document.title = "创建站点";
setFieldsValue({
identifier: `http://${current_user.login}.${site_page_deploy_domain || 'gitlink.net'}`,
repository_name: `${current_user.login}.${site_page_deploy_domain || 'gitlink.net'}`,
name: `${current_user.login}.${site_page_deploy_domain || 'gitlink.net'}`
})
}, []);
useEffect(()=>{
@ -56,7 +63,8 @@ function CreateSite(props) {
...values,
clone_addr: theme && theme.clone_url,
theme: theme && theme.name,
user_id: current_user.user_id
user_id: current_user.user_id,
identifier: values.identifier.split("http://")[1]
}).then(res=>{
if(res && res.status === 200){
message.success("新建成功");
@ -94,18 +102,20 @@ function CreateSite(props) {
>
{getFieldDecorator("identifier", {
rules: [{ required: true, message: "请输入站点标识" },
{pattern: /^[a-zA-Z0-9]{2,100}$/, message: '长度2-100只能包含数字和字母'}],
// {pattern: /^[a-zA-Z0-9]{2,100}$/, message: '2-100'}
],
})(
<Input
onChange={(e) => {
setTag(e.target.value);
}}
placeholder="请输入站点标识"
disabled
/>
)}
<span style={{wordBreak: 'break-all'}}>
{/* <span style={{wordBreak: 'break-all'}}>
http://{current_user.login}.{site_page_deploy_domain}/{tag}
</span>
</span> */}
</Form.Item>
<Form.Item name="建站工具" label="建站工具">
{getFieldDecorator("language_frame", {initialValue: 0})(
@ -124,9 +134,9 @@ function CreateSite(props) {
<AlignTop style={{flexWrap: 'wrap'}}>
{themes && themes.map(item=>{
const {image, name, clone_url} = item;
return <div className="mr20 themeBox" onClick={()=>{setTheme(item)}}>
return <div className="mr20 themeBox imageLayerParent" onClick={()=>{setTheme(item)}}>
<i className={`iconfont icon-wancheng ${theme && theme.clone_url === clone_url ? 'active' : ''}`}></i>
<img src={getImageUrl(image)} alt="" width="125px" height="85px"/>
<img src={getImageUrl(image)} alt="" width="125px" height="85px" className="imageTarget"/>
<p className="task-hide" style={{maxWidth: '120px'}}>{name}</p>
</div>
})}
@ -147,7 +157,7 @@ function CreateSite(props) {
rules: [{ required: true, message: "请输入项目标识" },
{pattern: /^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,100}[a-zA-Z0-9]$/, message: "长度2-100只能包含数字、字母、下划线、中划线、英文句号必须以数字和字母开头不能以下划线/中划线/英文句号开头和结尾"}],
})(
<Input placeholder="请输入项目标识"/>
<Input placeholder="请输入项目标识" disabled/>
)}
</Form.Item>
</AlignCenter>
@ -159,7 +169,7 @@ function CreateSite(props) {
rules: [{ required: true, message: "请输入项目名称" },
{type: 'string', max: 50, min: 1, message: "长度1-50"}],
})(
<Input placeholder="请输入项目名称"/>
<Input placeholder="请输入项目名称" disabled/>
)}
</Form.Item>
<Form.Item name="项目简介" label="项目简介">
@ -185,4 +195,7 @@ function CreateSite(props) {
</Fragment>
);
}
export default Form.create()(CreateSite);
export default withRouter(ImageLayerOfCommentHOC({
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
parentSelector: ".newContainer",
})(Form.create()(CreateSite)));

View File

@ -1,6 +1,5 @@
.mySites_head{
height: 65px;
line-height: 64px;
border-bottom: 1px solid rgba(224, 230, 245, 1);
color:#151d40;
font-size:17px;

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect, Fragment } from "react";
import { Button, Pagination, Spin } from "antd";
import { Button, Pagination, Spin, Tooltip } from "antd";
import './index.scss';
import '../../users/Material/Index.scss';
import '../bot/exploit/index.scss'
@ -38,7 +38,9 @@ function MySiteList(props){
return <Spin spinning={loading}>
<FlexAJ className="mySites_head">
<span>我的站点</span>
{id_card_verify && website_permission && <Button type="primary" onClick={()=>{history.push(`/settings/mysite/create`)}}>新建站点</Button>}
{id_card_verify && website_permission && total >= 1 ? <Tooltip title="您已存在站点,请勿重复创建">
<Button type="primary" disabled>新建站点</Button>
</Tooltip> : <Button type="primary" onClick={()=>{history.push(`/settings/mysite/create`)}}>新建站点</Button>}
</FlexAJ>
{/* 站点权限被管理员关闭 */}
{id_card_verify && !website_permission && <div className="tipsBox font-15 mt20">您的站点权限被锁定请联系平台管理员</div>}

View File

@ -48,7 +48,7 @@ function ServerIndex(props){
}
></Route>
{/* 个人建站服务 */}
{projectDetail && projectDetail.author.type === "User" && <Route path="/:owner/:projectsId/service/pages"
{projectDetail && projectDetail.web_site && projectDetail.author.type === "User" && <Route path="/:owner/:projectsId/service/pages"
render={
() => (<Pages {...props}/>)
}

View File

@ -64,7 +64,8 @@ function Main(props){
<Link to={`/${owner}/${projectsId}/service/reposyncer`} className="btnhover">查看详情</Link>
</span>
</li> */}
{projectDetail && projectDetail.author.type === "User" && <li>
{/* 是站点仓库则显示,否则隐藏 */}
{projectDetail && projectDetail.web_site && projectDetail.author.type === "User" && <li>
<span className="servername">
<img src={require('./img/logo.png')} alt=""/>
<a onClick={openDetail}>个人建站服务</a>

View File

@ -277,6 +277,8 @@ class Setting extends Component {
let mirror = projectDetail && projectDetail.mirror;
let type = projectDetail && projectDetail.type;
const forked_from_project_id = this.props && this.props.projectDetail && this.props.projectDetail.forked_from_project_id;
// 站点仓库不允许修改项目名称和标识
const isWebSiteRepo = projectDetail && projectDetail.web_site;
return (
<div>
<DivertModal
@ -298,7 +300,7 @@ class Setting extends Component {
message: "请输入项目名称",
},
],
})(<Input placeholder="请输入项目名称" />)}
})(<Input placeholder="请输入项目名称" disabled={isWebSiteRepo}/>)}
{
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">该项目导入于 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
@ -335,7 +337,7 @@ class Setting extends Component {
},
],
})(
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" />
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" disabled={isWebSiteRepo}/>
)}
</Form.Item>
<Form.Item label="项目简介">