diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index 452529717..5a9fa372e 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -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", diff --git a/src/common/educoder.js b/src/common/educoder.js index 6575c5032..96896845a 100644 --- a/src/common/educoder.js +++ b/src/common/educoder.js @@ -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'; diff --git a/src/forge/Information/Component/comments/list.jsx b/src/forge/Information/Component/comments/list.jsx index 4e70f5468..4014063d4 100644 --- a/src/forge/Information/Component/comments/list.jsx +++ b/src/forge/Information/Component/comments/list.jsx @@ -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( -
+ (isPhone() && journalsCount === 0) ? '' :
{/* 评论 */}
0 && 'pb15'}`}>
@@ -118,7 +118,7 @@ function IssueCommentList(props){
{/* 评论快速入口-仅有评论且登录时展示 */} - {login && category !== 'operate' && journalsCount > 0 &&
0 && 'pt15'}`}>
点击添加评论
} + {login && category !== 'operate' && journalsCount > 0 && !isPhone() &&
0 && 'pt15'}`}>
点击添加评论
} {/* 评论/操作日志 展示列表 */}
@@ -135,7 +135,7 @@ function IssueCommentList(props){ {item.user.name} {timeAgo(item.created_at)}
- {login &&
+ {login && !isPhone() &&
{/* 平台管理员/仓库管理员/发布评论者/issue创建者 */} {(admin || isManager || login === item.user.login || username === author) && {i.reply_user && i.reply_user.name} {timeAgo(i.created_at)}
- {login &&
+ {login && !isPhone() &&
{/* 平台管理员/仓库管理员/发布评论者/回复评论者/issue创建者 */} {(admin || isManager || login === i.user.login || (i.reply_user && login === i.reply_user.login) || username === author) && setPage(page)}/>
} {/* 添加评论 */} - {category !== 'operate' &&
+ {category !== 'operate' && !isPhone() &&
{login ? showEdit === 1 ? :
diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index 713fe41ba..64c386fa4 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -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( { - IsPC() && + isPhone() && } -
+
{ detail &&
{ - IsPC() && zonedetail && + isPhone() && zonedetail && } { - !IsPC() && + !isPhone() && - { sectionCmsTitle } + { zonedetail.sectionCmsTitle } { cmsDir && {cmsDir.name} } 正文 @@ -116,7 +108,7 @@ function NewsDetail(props){ { detail.auditStatus === '0' &&
  • }
    - { !IsPC() && } + { !isPhone() && } { content ? @@ -126,7 +118,7 @@ function NewsDetail(props){
    { // 审核通过才有评论 - detail.auditStatus === '1' &&
    + detail.auditStatus === '1' &&
    {setCommentReload(Math.random())}}/>
    } @@ -136,7 +128,7 @@ function NewsDetail(props){
    { - IsPC() && + isPhone() && } ) diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index 09f99b3b3..c68756bd3 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -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(()=>{ diff --git a/src/forge/SecuritySetting/img/header.png b/src/forge/SecuritySetting/img/header.png new file mode 100644 index 000000000..4a4b6c8f6 Binary files /dev/null and b/src/forge/SecuritySetting/img/header.png differ diff --git a/src/forge/SecuritySetting/website/createSite.jsx b/src/forge/SecuritySetting/website/createSite.jsx index ba12ace0c..91344adfd 100644 --- a/src/forge/SecuritySetting/website/createSite.jsx +++ b/src/forge/SecuritySetting/website/createSite.jsx @@ -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 (
    我的站点 / 新建站点
    @@ -89,22 +104,18 @@ function CreateSite(props) { onSubmit={submit} >
    站点配置
    - + {/* {getFieldDecorator("site_name", { rules: [{ required: true, message: "请输入站点名称" }, {type: 'string', max: 50, min: 1, message: "长度1-50"}], })()} - + */} - {getFieldDecorator("identifier", { - rules: [{ required: true, message: "请输入站点标识" }, - // {pattern: /^[a-zA-Z0-9]{2,100}$/, message: '长度2-100,只能包含数字和字母'} - ], - })( + {getFieldDecorator("identifier")( { setTag(e.target.value); @@ -154,7 +165,7 @@ function CreateSite(props) { {/* / 0.87 */} {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,只能包含数字、字母、下划线、中划线、英文句号,必须以数字和字母开头,不能以下划线/中划线/英文句号开头和结尾"}], })( @@ -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"}], })( )} @@ -192,6 +202,40 @@ function CreateSite(props) { + +
    + 个人建站声明 + +
    +
    +

    个人建站服务仅供Jekyll、Hugo、Hexo静态网站效果演示用途,请勿用于违规内容,包括但不仅限于:

    +
      +
        发布诱导分享/诱导关注/诱导下载/诱导跳转内容
      +
        发布欺诈/谣言/骚扰信息/广告信息/垃圾信息/特殊识别码、口令类信息
      +
        发布低俗内容/“宗教性捐献”及相关信息
      +
        发布侵害他人权利/违法经营及可疑服务类内容
      +
        发布其它违反国家法律法规的内容
      +
    +

    平台保留使用规则最终解释权,如发现上述违规行为,平台将视违规情况严重程度予以建站服务封禁以至账号永久封禁惩罚。

    + { setAccept(e.target.checked) }}>我已阅读并接受 《个人建站声明条款》 +
    +
    +
    + + +
    +
    ); } diff --git a/src/forge/SecuritySetting/website/index.scss b/src/forge/SecuritySetting/website/index.scss index 45834b803..d01f5c61f 100644 --- a/src/forge/SecuritySetting/website/index.scss +++ b/src/forge/SecuritySetting/website/index.scss @@ -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; + } + } } \ No newline at end of file diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 3f0ae26db..0ad751e5c 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -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 (