Merge pull request '个人建站修改' (#612) from Eeeros/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
4ea17c6ecf
|
|
@ -19,7 +19,7 @@ export function getImageUrl(path) {
|
|||
return `${path}`;
|
||||
}
|
||||
|
||||
export function IsPC(){
|
||||
export function isPhone(){
|
||||
var userAgentInfo = navigator.userAgent;
|
||||
var Agents = ["Android", "iPhone",
|
||||
"SymbianOS", "Windows Phone",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export {
|
|||
getImageUrl as getImageUrl,getImageUrlAbsolute as getImageUrlAbsolute,getImage as getImage, getmyUrl as getmyUrl, getRandomNumber as getRandomNumber, getUrl as getUrl, getZoneUrl as getZoneUrl, publicSearchs as publicSearchs, getRandomcode as getRandomcode, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
|
||||
, getUploadActionUrl as getUploadActionUrl, getUploadActionUrltwo as getUploadActionUrltwo, getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
|
||||
, getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl,
|
||||
turnbar,returnbar,setSeoMeta as setSeoMeta , IsPC as IsPC, addMeta as addMeta
|
||||
turnbar,returnbar,setSeoMeta as setSeoMeta , isPhone as isPhone, addMeta as addMeta
|
||||
} from './UrlTool';
|
||||
|
||||
export { setmiyah as setmiyah } from './Component';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Popconfirm, Radio, Input, message, Tooltip, Spin, Pagination } from 'antd';
|
||||
import axios from 'axios';
|
||||
import { getImageUrl, timeAgo } from 'educoder';
|
||||
import { getImageUrl, timeAgo, isPhone } from 'educoder';
|
||||
import RenderHtml from '../../../../components/render-html';
|
||||
import Attachment from '../../../Upload/attachment';
|
||||
import EditComment from './editComment';
|
||||
|
|
@ -109,7 +109,7 @@ function IssueCommentList(props){
|
|||
}
|
||||
|
||||
return(
|
||||
<div className="commentListBox">
|
||||
(isPhone() && journalsCount === 0) ? '' : <div className="commentListBox info_text mt30">
|
||||
{/* 评论 */}
|
||||
<div className={`${!login && journalsCount > 0 && 'pb15'}`}>
|
||||
<div className='typeActionBox mb20'>
|
||||
|
|
@ -118,7 +118,7 @@ function IssueCommentList(props){
|
|||
</div>
|
||||
</div>
|
||||
{/* 评论快速入口-仅有评论且登录时展示 */}
|
||||
{login && category !== 'operate' && journalsCount > 0 && <div className={`pb30 ${journalsCount > 0 && 'pt15'}`}><div className='gotoComment'>点击<a className='ml5' href='#addComments'>添加评论</a></div></div>}
|
||||
{login && category !== 'operate' && journalsCount > 0 && !isPhone() && <div className={`pb30 ${journalsCount > 0 && 'pt15'}`}><div className='gotoComment'>点击<a className='ml5' href='#addComments'>添加评论</a></div></div>}
|
||||
{/* 评论/操作日志 展示列表 */}
|
||||
<Spin spinning={spin}>
|
||||
<div className={`issueCommentsBox ${category === 'comment' && !spin && 'justComment'}`}>
|
||||
|
|
@ -135,7 +135,7 @@ function IssueCommentList(props){
|
|||
<Link to={`/${item.user.login}`}>{item.user.name}</Link>
|
||||
<span className='ml15 timeAgo font-14'>{timeAgo(item.created_at)}</span>
|
||||
</div>
|
||||
{login && <div>
|
||||
{login && !isPhone() && <div>
|
||||
{/* 平台管理员/仓库管理员/发布评论者/issue创建者 */}
|
||||
{(admin || isManager || login === item.user.login || username === author) && <Popconfirm
|
||||
placement="bottom"
|
||||
|
|
@ -172,7 +172,7 @@ function IssueCommentList(props){
|
|||
<span>{i.reply_user && i.reply_user.name}</span>
|
||||
<span className='ml15 timeAgo font-14'>{timeAgo(i.created_at)}</span>
|
||||
</div>
|
||||
{login && <div>
|
||||
{login && !isPhone() && <div>
|
||||
{/* 平台管理员/仓库管理员/发布评论者/回复评论者/issue创建者 */}
|
||||
{(admin || isManager || login === i.user.login || (i.reply_user && login === i.reply_user.login) || username === author) && <Popconfirm
|
||||
placement="bottom"
|
||||
|
|
@ -207,7 +207,7 @@ function IssueCommentList(props){
|
|||
<Pagination simple current={page} pageSize={limit} total={totalCount} onChange={(page)=>setPage(page)}/>
|
||||
</div>}
|
||||
{/* 添加评论 */}
|
||||
{category !== 'operate' && <div className="pb30" style={{marginTop: journalsCount ? '-5px' : '30px'}}>
|
||||
{category !== 'operate' && !isPhone() && <div className="pb30" style={{marginTop: journalsCount ? '-5px' : '30px'}}>
|
||||
{login ? showEdit === 1 ? <EditComment {...props} cancelMd={cancelMd}/> : <div className="addComments" id='addComments'>
|
||||
<img src={getImageUrl(image_url)} alt="" />
|
||||
<div style={{flex:1}}>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import liulan from '../img/liulan.png';
|
|||
import RenderHtml from '../../../components/render-html';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { getNewsDetail } from '../api';
|
||||
import { IsPC } from 'educoder';
|
||||
import { isPhone } from 'educoder';
|
||||
import { tempConfig } from '../tempInfo';
|
||||
import Acce from '../Component/mobile/accessory';
|
||||
import { addMeta, setSeoMeta } from 'educoder';
|
||||
|
|
@ -19,11 +19,17 @@ function NewsDetail(props){
|
|||
const [ isSpin , setIsSpin]=useState(false);
|
||||
const [ commentReload, setCommentReload] = useState(undefined);
|
||||
const temp = props.temp;
|
||||
const { zonedetail, sectionCmsTitle, mainTitle } = props.data;
|
||||
const zonedetail = props.data;
|
||||
|
||||
useEffect(()=>{
|
||||
let initialContent = undefined;
|
||||
if(IsPC() && zonedetail){
|
||||
// 设置网页标题
|
||||
if(detail){
|
||||
const { name, cmsDir, summary} = detail;
|
||||
document.title = `${ name }/${ cmsDir.name }`;
|
||||
addMeta('Keywords', `${ name },${ cmsDir.name },${ summary }`);
|
||||
}
|
||||
if(isPhone() && zonedetail){
|
||||
setTimeout(()=>{
|
||||
window.scrollTo(0,1);
|
||||
if(detail)
|
||||
|
|
@ -33,37 +39,23 @@ function NewsDetail(props){
|
|||
document.querySelector('meta[name="viewport"]').setAttribute('content','width=device-width, user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0');
|
||||
}
|
||||
return()=>{
|
||||
document.title = mainTitle;
|
||||
if(IsPC()){
|
||||
if(isPhone()){
|
||||
document.querySelector('meta[name="viewport"]').setAttribute('content', initialContent);
|
||||
}
|
||||
if (zonedetail) {
|
||||
document.title= zonedetail.mainTitle;
|
||||
setSeoMeta(`${zonedetail.name},`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
|
||||
}
|
||||
}
|
||||
},[zonedetail,detail])
|
||||
|
||||
useEffect(()=>{
|
||||
if(id){
|
||||
window.scrollTo(0,IsPC() ? 0 : 450);
|
||||
window.scrollTo(0,isPhone() ? 0 : 450);
|
||||
getDetails();
|
||||
}
|
||||
},[id])
|
||||
|
||||
useEffect(()=>{
|
||||
// 设置网页标题
|
||||
if(detail){
|
||||
const { name, cmsDir, summary} = detail;
|
||||
document.title = `${ name }/${ cmsDir.name }`;
|
||||
addMeta('Keywords', `${ name },${ cmsDir.name },${ summary }`);
|
||||
}
|
||||
return componentWillUnmount
|
||||
}, [detail])
|
||||
|
||||
function componentWillUnmount() {
|
||||
if (zonedetail) {
|
||||
document.title= zonedetail.name;
|
||||
setSeoMeta(`${zonedetail.name},`, zonedetail.name, zonedetail.subTitle, `/zone/${deptId}`)
|
||||
}
|
||||
}
|
||||
|
||||
function getDetails(){
|
||||
setIsSpin(true)
|
||||
getNewsDetail(id).then(result=>{
|
||||
|
|
@ -83,24 +75,24 @@ function NewsDetail(props){
|
|||
return(
|
||||
<React.Fragment>
|
||||
{
|
||||
IsPC() && <Acce type="head"/>
|
||||
isPhone() && <Acce type="head"/>
|
||||
}
|
||||
<div className={IsPC() ? "detail_news_phone" :"detail_news_all"}>
|
||||
<div className={isPhone() ? "detail_news_phone" :"detail_news_all"}>
|
||||
<Spin spinning={isSpin} size="large">
|
||||
{
|
||||
detail &&
|
||||
<div className="d_news_box">
|
||||
{
|
||||
IsPC() && zonedetail &&
|
||||
isPhone() && zonedetail &&
|
||||
<div className="p_title_box">
|
||||
<p className="p_t_title"><a href={`/zone/${deptId}`}>{zonedetail.name}</a></p>
|
||||
<p className="p_t_desc" dangerouslySetInnerHTML={{ __html: zonedetail.introductionContent }}></p>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!IsPC() &&
|
||||
!isPhone() &&
|
||||
<Breadcrumb separator=">">
|
||||
<Breadcrumb.Item href={`/zone/${deptId}/news`}>{ sectionCmsTitle }</Breadcrumb.Item>
|
||||
<Breadcrumb.Item href={`/zone/${deptId}/news`}>{ zonedetail.sectionCmsTitle }</Breadcrumb.Item>
|
||||
{ cmsDir && <Breadcrumb.Item href={`/zone/${deptId}/news/${cmsDir.id}`}>{cmsDir.name}</Breadcrumb.Item> }
|
||||
<Breadcrumb.Item>正文</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
|
|
@ -116,7 +108,7 @@ function NewsDetail(props){
|
|||
{ detail.auditStatus === '0' && <li><Badge color="#eb1212" text="未通过" className='failed'/></li>}
|
||||
</ul>
|
||||
</div>
|
||||
{ !IsPC() && <Divider dashed={true} /> }
|
||||
{ !isPhone() && <Divider dashed={true} /> }
|
||||
{
|
||||
content ?
|
||||
<RenderHtml className="informations_detail imageLayerParent" value={content} url={props.history.location} />
|
||||
|
|
@ -126,7 +118,7 @@ function NewsDetail(props){
|
|||
</div>
|
||||
{
|
||||
// 审核通过才有评论
|
||||
detail.auditStatus === '1' && <div className="info_text mt30">
|
||||
detail.auditStatus === '1' && <div>
|
||||
<CommentList {...props} docId={ id } reload={commentReload} author={ detail.createBy } reloadComment={()=>{setCommentReload(Math.random())}}/>
|
||||
</div>
|
||||
}
|
||||
|
|
@ -136,7 +128,7 @@ function NewsDetail(props){
|
|||
</Spin>
|
||||
</div>
|
||||
{
|
||||
IsPC() && <Acce type="foot" />
|
||||
isPhone() && <Acce type="foot" />
|
||||
}
|
||||
</React.Fragment>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Loading from "../../Loading";
|
|||
import { getMainInfos , getCheckZoneRole, getCurrentRole } from './api';
|
||||
import PublicBanner from "./Component/publicBanner";
|
||||
import './index.scss';
|
||||
import { IsPC } from 'educoder';
|
||||
import { isPhone } from 'educoder';
|
||||
import "slick-carousel/slick/slick.css";
|
||||
import "slick-carousel/slick/slick-theme.css";
|
||||
import { tempEnum } from "./tempInfo";
|
||||
|
|
@ -98,7 +98,7 @@ function Index(props){
|
|||
const [ temp , setTemp ] = useState(tempEnum.zone);
|
||||
const [ role , setRole ] = useState(undefined);
|
||||
const { pathname } = props.history.location;
|
||||
const sourcedetail = pathname.indexOf(`/zone/${deptId}/newdetail/`)>-1 && IsPC();
|
||||
const sourcedetail = pathname.indexOf(`/zone/${deptId}/newdetail/`)>-1 && isPhone();
|
||||
const {current_user} = props;
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useState, useEffect, Fragment } from "react";
|
||||
import { Button, message, Form, Input, Select } from "antd";
|
||||
import { Button, message, Form, Input, Select, Modal, Checkbox } from "antd";
|
||||
import "./index.scss";
|
||||
import "../../users/Material/Index.scss";
|
||||
import axios from "axios";
|
||||
|
|
@ -17,6 +17,9 @@ function CreateSite(props) {
|
|||
const [language, setLanguage] = useState(undefined);
|
||||
const [themes, setThemes] = useState([]);
|
||||
const [theme, setTheme] = useState(undefined);
|
||||
const [modalVisibal, setmodalVisibal] = useState(false);
|
||||
const [accept, setAccept] = useState(false);
|
||||
const [formValues, setFormValues] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
document.title = "创建站点";
|
||||
|
|
@ -59,22 +62,34 @@ function CreateSite(props) {
|
|||
e.preventDefault();
|
||||
validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
axios.post(`/projects/page_migrate.json`,{
|
||||
...values,
|
||||
clone_addr: theme && theme.clone_url,
|
||||
theme: theme && theme.name,
|
||||
user_id: current_user.user_id,
|
||||
identifier: values.identifier.split("http://")[1]
|
||||
}).then(res=>{
|
||||
if(res && res.status === 200){
|
||||
message.success("新建成功");
|
||||
history.push(`/settings/mysite`);
|
||||
}
|
||||
})
|
||||
setmodalVisibal(true)
|
||||
setFormValues(values)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmSubmit() {
|
||||
axios.post(`/projects/page_migrate.json`,{
|
||||
...formValues,
|
||||
site_name: formValues.identifier,
|
||||
clone_addr: theme && theme.clone_url,
|
||||
theme: theme && theme.name,
|
||||
user_id: current_user.user_id,
|
||||
identifier: formValues.identifier.split("http://")[1]
|
||||
}).then(res=>{
|
||||
onCancel()
|
||||
if(res && res.status === 200){
|
||||
message.success("新建成功");
|
||||
history.push(`/settings/mysite`);
|
||||
}
|
||||
})
|
||||
}
|
||||
function onCancel() {
|
||||
setmodalVisibal(false);
|
||||
setAccept(false);
|
||||
setFormValues({});
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="mySites_head mb30"><Link to={`/settings/mysite`} className="font-16">我的站点 / </Link><span>新建站点</span></div>
|
||||
|
|
@ -89,22 +104,18 @@ function CreateSite(props) {
|
|||
onSubmit={submit}
|
||||
>
|
||||
<div className="formTitle font-16 mb20 ml20">站点配置</div>
|
||||
<Form.Item name="站点名称" label="站点名称">
|
||||
{/* <Form.Item name="站点名称" label="站点名称">
|
||||
{getFieldDecorator("site_name", {
|
||||
rules: [{ required: true, message: "请输入站点名称" },
|
||||
{type: 'string', max: 50, min: 1, message: "长度1-50"}],
|
||||
})(<Input placeholder="请输入站点名称" />)}
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
<Form.Item
|
||||
name="站点标识"
|
||||
label="站点标识"
|
||||
className="Create-Form-biaoshi"
|
||||
>
|
||||
{getFieldDecorator("identifier", {
|
||||
rules: [{ required: true, message: "请输入站点标识" },
|
||||
// {pattern: /^[a-zA-Z0-9]{2,100}$/, message: '长度2-100,只能包含数字和字母'}
|
||||
],
|
||||
})(
|
||||
{getFieldDecorator("identifier")(
|
||||
<Input
|
||||
onChange={(e) => {
|
||||
setTag(e.target.value);
|
||||
|
|
@ -154,7 +165,7 @@ function CreateSite(props) {
|
|||
{/* <span className="mb20 font-18">/</span> 0.87 */}
|
||||
<Form.Item name="项目标识" label="项目标识" style={{flex: '0.83'}} labelCol={{span: 4}}>
|
||||
{getFieldDecorator("repository_name", {
|
||||
rules: [{ required: true, message: "请输入项目标识" },
|
||||
rules: [
|
||||
{pattern: /^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,100}[a-zA-Z0-9]$/, message: "长度2-100,只能包含数字、字母、下划线、中划线、英文句号,必须以数字和字母开头,不能以下划线/中划线/英文句号开头和结尾"}],
|
||||
})(
|
||||
<Input placeholder="请输入项目标识" disabled/>
|
||||
|
|
@ -166,8 +177,7 @@ function CreateSite(props) {
|
|||
label="项目名称"
|
||||
>
|
||||
{getFieldDecorator("name", {
|
||||
rules: [{ required: true, message: "请输入项目名称" },
|
||||
{type: 'string', max: 50, min: 1, message: "长度1-50"}],
|
||||
rules: [{type: 'string', max: 50, min: 1, message: "长度1-50"}],
|
||||
})(
|
||||
<Input placeholder="请输入项目名称" disabled/>
|
||||
)}
|
||||
|
|
@ -192,6 +202,40 @@ function CreateSite(props) {
|
|||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<Modal
|
||||
visible={modalVisibal}
|
||||
onCancel={onCancel}
|
||||
footer={null}
|
||||
closable={false}
|
||||
bodyStyle={{ padding: 0 }}
|
||||
width={'650px'}
|
||||
>
|
||||
<div className="m-header">
|
||||
个人建站声明
|
||||
<i className="iconfont icon-shanchuicon2 mr5 font-14" onClick={onCancel}></i>
|
||||
</div>
|
||||
<div className="m-content">
|
||||
<p>个人建站服务仅供Jekyll、Hugo、Hexo静态网站效果演示用途,请勿用于违规内容,包括但不仅限于:</p>
|
||||
<ul>
|
||||
<ol>发布诱导分享/诱导关注/诱导下载/诱导跳转内容</ol>
|
||||
<ol>发布欺诈/谣言/骚扰信息/广告信息/垃圾信息/特殊识别码、口令类信息</ol>
|
||||
<ol>发布低俗内容/“宗教性捐献”及相关信息</ol>
|
||||
<ol>发布侵害他人权利/违法经营及可疑服务类内容</ol>
|
||||
<ol>发布其它违反国家法律法规的内容</ol>
|
||||
</ul>
|
||||
<p>平台保留使用规则最终解释权,如发现上述违规行为,平台将视违规情况严重程度予以建站服务封禁以至账号永久封禁惩罚。</p>
|
||||
<Checkbox checked={accept} onChange={(e) => { setAccept(e.target.checked) }}>我已阅读并接受 《个人建站声明条款》</Checkbox>
|
||||
<div className="divider"></div>
|
||||
</div>
|
||||
<div className="m-footer">
|
||||
<Button onClick={onCancel}>
|
||||
取消
|
||||
</Button>
|
||||
<Button type="primary" className="mr20" disabled={ !accept } onClick={confirmSubmit}>
|
||||
确认
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,71 @@
|
|||
color: $primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
.m-header {
|
||||
background: url(../img/header.png) no-repeat;
|
||||
background-size: 101% 100%;
|
||||
height: 56px;
|
||||
text-align: center;
|
||||
line-height: 56px;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #FFFFFF;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
position: relative;
|
||||
i {
|
||||
position: absolute;
|
||||
right: 16px;
|
||||
top: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.m-content {
|
||||
padding: 19px 26px;
|
||||
font-size: 15px;
|
||||
color: #4C5B76;
|
||||
line-height: 30px;
|
||||
ul {
|
||||
padding: 10px 0;
|
||||
}
|
||||
ol {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background: #202D40;
|
||||
opacity: 1;
|
||||
border-radius: 100%;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
.divider {
|
||||
width: 100%;
|
||||
height: 0px;
|
||||
opacity: 1;
|
||||
border: 1px solid rgba(153,153,153,0.1);
|
||||
margin-top: 21px;
|
||||
}
|
||||
}
|
||||
.m-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 5px 0 27px 0;
|
||||
button {
|
||||
width: 120px;
|
||||
height: 36px;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
color: #FFFFFF;
|
||||
&:nth-of-type(1) {
|
||||
color: #666666;
|
||||
margin-right: 78px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ import SupplyPhoneModal from '../../forge/Component/ProfileModal/SupplyPhone';
|
|||
import SystemNotice from '../../forge/Component/NoticeModal/SystemNotice';
|
||||
import cookie from 'react-cookies';
|
||||
import NpsModal from '../modals/npsModal';
|
||||
import { IsPC } from 'educoder';
|
||||
import { isPhone } from 'educoder';
|
||||
|
||||
export function TPMIndexHOC(WrappedComponent) {
|
||||
return class II extends React.Component {
|
||||
|
|
@ -287,7 +287,7 @@ export function TPMIndexHOC(WrappedComponent) {
|
|||
showNpsModal: this.showNpsModal
|
||||
};
|
||||
let path =this.props.location.pathname;
|
||||
let pathCheck = path.indexOf("/zone")>-1 && path.indexOf("/newdetail")>-1 && IsPC();
|
||||
let pathCheck = path.indexOf("/zone")>-1 && path.indexOf("/newdetail")>-1 && isPhone();
|
||||
return (
|
||||
<div className="indexHOC">
|
||||
<SystemNotice
|
||||
|
|
|
|||
Loading…
Reference in New Issue