forked from Gitlink/forgeplus-react
Merge pull request '更新' (#476) from durian/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
3e3ad0531a
|
@ -558,20 +558,21 @@
|
||||||
|
|
||||||
_this.setToolbar();
|
_this.setToolbar();
|
||||||
|
|
||||||
// editormd.loadScript(loadPath + "marked.min", function () {
|
// 此处影响公式加载
|
||||||
// });
|
editormd.loadScript(loadPath + "marked.min", function () {
|
||||||
|
|
||||||
editormd.$marked = marked;
|
editormd.$marked = marked;
|
||||||
|
|
||||||
if (settings.previewCodeHighlight) {
|
if (settings.previewCodeHighlight) {
|
||||||
editormd.loadScript(loadPath + "prettify.min", function () {
|
editormd.loadScript(loadPath + "prettify.min", function () {
|
||||||
|
loadFlowChartOrSequenceDiagram();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
loadFlowChartOrSequenceDiagram();
|
loadFlowChartOrSequenceDiagram();
|
||||||
});
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
loadFlowChartOrSequenceDiagram();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1434,7 +1435,7 @@
|
||||||
var tex = $(this);
|
var tex = $(this);
|
||||||
editormd.$katex.render(tex.text(), tex[0]);
|
editormd.$katex.render(tex.text(), tex[0]);
|
||||||
|
|
||||||
tex.find(".katex").css("font-size", "1.0em");
|
tex.find(".katex").css("font-size", "1.6em");
|
||||||
});
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -3810,7 +3811,7 @@
|
||||||
div.find("." + editormd.classNames.tex).each(function () {
|
div.find("." + editormd.classNames.tex).each(function () {
|
||||||
var tex = $(this);
|
var tex = $(this);
|
||||||
katex.render(tex.text(), tex[0]);
|
katex.render(tex.text(), tex[0]);
|
||||||
tex.find(".katex").css("font-size", "1.0em");
|
tex.find(".katex").css("font-size", "1.6em");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
69
src/App.css
69
src/App.css
|
@ -33,7 +33,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* md样式 */
|
||||||
|
.editormd-fullscreen{
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
.editormd-menu>li:last-child{
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
/* 控制md编辑器列行的宽度
|
/* 控制md编辑器列行的宽度
|
||||||
见 codermirror maybeUpdateLineNumberWidth方法
|
见 codermirror maybeUpdateLineNumberWidth方法
|
||||||
*/
|
*/
|
||||||
|
@ -72,8 +78,7 @@ body {
|
||||||
.markdown-body p {
|
.markdown-body p {
|
||||||
margin:10px 0px!important;
|
margin:10px 0px!important;
|
||||||
font-size: 16px !important;
|
font-size: 16px !important;
|
||||||
/* 用户提出多个徽章换行显示,p标签会换行显示 */
|
white-space: pre-wrap;
|
||||||
/* white-space: pre-wrap; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-body>p {
|
.markdown-body>p {
|
||||||
|
@ -94,7 +99,7 @@ body {
|
||||||
border-left: 1px solid rgb(221, 221, 221);
|
border-left: 1px solid rgb(221, 221, 221);
|
||||||
/* 某些情况下,被cm盖住了 */
|
/* 某些情况下,被cm盖住了 */
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
padding:8px 8px 50px;
|
padding: 0 8px;
|
||||||
}
|
}
|
||||||
.editormd-preview .markdown-body{
|
.editormd-preview .markdown-body{
|
||||||
padding:0px !important;
|
padding:0px !important;
|
||||||
|
@ -118,7 +123,6 @@ body {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* antd扩展 */
|
/* antd扩展 */
|
||||||
.formItemInline.ant-form-item {
|
.formItemInline.ant-form-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -141,58 +145,3 @@ body {
|
||||||
min-height: calc(100% - 60px) !important;
|
min-height: calc(100% - 60px) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.feedBackModal .ant-modal-header{
|
|
||||||
border-bottom: none;
|
|
||||||
background: none;
|
|
||||||
padding: 16px 24px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feedBackModal .ant-modal-title{
|
|
||||||
font-weight:500 !important;
|
|
||||||
color:#151d40;
|
|
||||||
font-size:18px;
|
|
||||||
}
|
|
||||||
.feedBackModal .anticon-close{
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
||||||
.feedBackModal .ant-modal-footer{
|
|
||||||
border-top: none;
|
|
||||||
text-align: center;
|
|
||||||
padding-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feedBackModal .ant-modal-content{
|
|
||||||
background-image:linear-gradient(359.37deg,#ebf3ff 0%,#f8fbff 55.01%,#cbdbff 100%);
|
|
||||||
border:1.5px solid #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feedBackModal .feedBackText{
|
|
||||||
padding: 20px;
|
|
||||||
font-size:15px;
|
|
||||||
color:#202d40;
|
|
||||||
}
|
|
||||||
.feedBackModal .feedBackText::placeholder{
|
|
||||||
color:#afb7c2;
|
|
||||||
}
|
|
||||||
.feedBackModal .gotoIssueFeedBack{
|
|
||||||
color: rgba(70, 106, 255, 1);
|
|
||||||
}
|
|
||||||
.feedBackBox{
|
|
||||||
position: relative;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
.feedBackText.errorInput{
|
|
||||||
border: 1px solid #f60011;
|
|
||||||
}
|
|
||||||
.errorInput{
|
|
||||||
background-color:rgba(255, 0, 0, 0.04) !important;
|
|
||||||
}
|
|
||||||
.ant-input.errorInput:hover{
|
|
||||||
background-color: white !important;
|
|
||||||
}
|
|
||||||
.countNumBox{
|
|
||||||
position: absolute;
|
|
||||||
bottom: 2px;
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
|
@ -460,3 +460,58 @@ li.ant-menu-item{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.feedBackModal .ant-modal-header{
|
||||||
|
border-bottom: none;
|
||||||
|
background: none;
|
||||||
|
padding: 16px 24px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedBackModal .ant-modal-title{
|
||||||
|
font-weight:500 !important;
|
||||||
|
color:#151d40;
|
||||||
|
font-size:18px;
|
||||||
|
}
|
||||||
|
.feedBackModal .anticon-close{
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
.feedBackModal .ant-modal-footer{
|
||||||
|
border-top: none;
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedBackModal .ant-modal-content{
|
||||||
|
background-image:linear-gradient(359.37deg,#ebf3ff 0%,#f8fbff 55.01%,#cbdbff 100%);
|
||||||
|
border:1.5px solid #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedBackModal .feedBackText{
|
||||||
|
padding: 20px;
|
||||||
|
font-size:15px;
|
||||||
|
color:#202d40;
|
||||||
|
}
|
||||||
|
.feedBackModal .feedBackText::placeholder{
|
||||||
|
color:#afb7c2;
|
||||||
|
}
|
||||||
|
.feedBackModal .gotoIssueFeedBack{
|
||||||
|
color: rgba(70, 106, 255, 1);
|
||||||
|
}
|
||||||
|
.feedBackBox{
|
||||||
|
position: relative;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.feedBackText.errorInput{
|
||||||
|
border: 1px solid #f60011;
|
||||||
|
}
|
||||||
|
.errorInput{
|
||||||
|
background-color:rgba(255, 0, 0, 0.04) !important;
|
||||||
|
}
|
||||||
|
.ant-input.errorInput:hover{
|
||||||
|
background-color: white !important;
|
||||||
|
}
|
||||||
|
.countNumBox{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 2px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
|
@ -51,11 +51,14 @@ class NewHeader extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// this.geturlsdata();
|
// 用personal判断是否需要再次请求settings接口,解决登录注册之后无设置按钮的情况
|
||||||
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
|
if(localStorage.chromesetting && localStorage.chromesetting.personal){
|
||||||
this.setState({
|
this.setState({
|
||||||
settings
|
settings: JSON.parse(localStorage.chromesetting)
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
this.geturlsdata();
|
||||||
|
}
|
||||||
window._header_componentHandler = this;
|
window._header_componentHandler = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -402,7 +402,8 @@ class Detail extends Component {
|
||||||
praises_count: result.data.praises_count,
|
praises_count: result.data.praises_count,
|
||||||
forked_count: result.data.forked_count,
|
forked_count: result.data.forked_count,
|
||||||
defaultBranch: result.data.default_branch
|
defaultBranch: result.data.default_branch
|
||||||
})
|
});
|
||||||
|
document.title = `${result.data.author.name}/${result.data.name}:${result.data.description}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch((error) => { })
|
}).catch((error) => { })
|
||||||
|
|
|
@ -382,7 +382,7 @@ class Index extends Component {
|
||||||
}
|
}
|
||||||
</Select>
|
</Select>
|
||||||
<Search
|
<Search
|
||||||
placeholder="输入项目名称关键字进行搜索"
|
placeholder="输入关键字进行搜索"
|
||||||
enterButton="搜索"
|
enterButton="搜索"
|
||||||
size="large"
|
size="large"
|
||||||
onSearch={this.searchFun}
|
onSearch={this.searchFun}
|
||||||
|
|
|
@ -84,7 +84,7 @@ function Index() {
|
||||||
<span>开源项目</span>
|
<span>开源项目</span>
|
||||||
|
|
||||||
<Search
|
<Search
|
||||||
placeholder="输入项目名称关键字进行搜索"
|
placeholder="输入关键字进行搜索"
|
||||||
enterButton="搜索"
|
enterButton="搜索"
|
||||||
size="middle"
|
size="middle"
|
||||||
onSearch={searchFun}
|
onSearch={searchFun}
|
||||||
|
|
|
@ -657,7 +657,7 @@ a.issue-type-button.active:hover {
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
background-color: rgba(235,244,254,1);
|
background-color: rgba(235,244,254,1);
|
||||||
color: #1890ff;
|
color: $primary-color;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 9px;
|
border-radius: 9px;
|
||||||
|
|
|
@ -90,7 +90,7 @@ function Index(props){
|
||||||
<ul className="securityUl ul-border-buttom">
|
<ul className="securityUl ul-border-buttom">
|
||||||
<li>个人信息</li>
|
<li>个人信息</li>
|
||||||
<li className={pathname.indexOf("/settings/profile")>-1 ?"active":""}><Link to={`/settings/profile`}><i className="iconfont icon-gerenziliao mr5 font-14"></i><span className="text-shodow-bold">基本资料</span></Link></li>
|
<li className={pathname.indexOf("/settings/profile")>-1 ?"active":""}><Link to={`/settings/profile`}><i className="iconfont icon-gerenziliao mr5 font-14"></i><span className="text-shodow-bold">基本资料</span></Link></li>
|
||||||
<li className={pathname.indexOf("/settings/account")>-1 ?"active":""}><Link to={`/settings/account`}><i className="iconfont icon-xuanzhonganquanshezhi_icon mr5 font-14"></i><span className="text-shodow-bold">账号管理</span></Link></li>
|
<li className={(pathname.indexOf("/settings/emails")>-1 || pathname.indexOf("/settings/password")>-1 || pathname.indexOf("/settings/cancel")>-1) ?"active":""}><Link to={`/settings/emails`}><i className="iconfont icon-xuanzhonganquanshezhi_icon mr5 font-14"></i><span className="text-shodow-bold">账号管理</span></Link></li>
|
||||||
</ul>
|
</ul>
|
||||||
{notice_url && <ul className="securityUl ul-border-buttom">
|
{notice_url && <ul className="securityUl ul-border-buttom">
|
||||||
<li>消息通知</li>
|
<li>消息通知</li>
|
||||||
|
@ -136,7 +136,19 @@ function Index(props){
|
||||||
)}
|
)}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/settings/account"
|
path="/settings/emails"
|
||||||
|
render={(p) => (
|
||||||
|
<Password {...props} {...p}/>
|
||||||
|
)}
|
||||||
|
></Route>
|
||||||
|
<Route
|
||||||
|
path="/settings/password"
|
||||||
|
render={(p) => (
|
||||||
|
<Password {...props} {...p}/>
|
||||||
|
)}
|
||||||
|
></Route>
|
||||||
|
<Route
|
||||||
|
path="/settings/cancel"
|
||||||
render={(p) => (
|
render={(p) => (
|
||||||
<Password {...props} {...p}/>
|
<Password {...props} {...p}/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
|
|
||||||
.menuPanels{
|
.menuPanels{
|
||||||
width: 295px;
|
width: 295px;
|
||||||
|
&.maxWidth{
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
.leftline{
|
.leftline{
|
||||||
position: relative;
|
position: relative;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
@ -43,16 +46,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.claimNote_input{
|
.claimNote_input{
|
||||||
// up, right, botton, left
|
padding: 15px;
|
||||||
margin: 5px 10px 5px 10px;
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.claimNote{
|
.claimNote{
|
||||||
// up, right, botton, left
|
margin: 5px 14px;
|
||||||
margin: 5px 14px 0px 14px;
|
padding-bottom: 10px;
|
||||||
padding-bottom: 5px;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
.attrPerson{
|
.attrPerson{
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
|
|
|
@ -1,288 +1,341 @@
|
||||||
import React, { Component } from "react";
|
import React from "react";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { AlignCenter , FlexAJ } from '../Component/layout';
|
import { AlignCenter, FlexAJ } from "../Component/layout";
|
||||||
import { Popover, List, Button, Dropdown, Input} from "antd";
|
import { Popover, Button, Input } from "antd";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { getImageUrl } from "educoder";
|
import { getImageUrl } from "educoder";
|
||||||
import "./claim.scss"
|
import "./claim.scss";
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
||||||
class claims extends React.Component {
|
class claims extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
claimerdata: new Array(),
|
claimerData: new Array(),
|
||||||
currentUserClaimed:0,
|
currentUserClaimed: 0,
|
||||||
issue_id:this.props.issue_id,
|
issue_id: this.props.issue_id,
|
||||||
claimNoteBody:'',
|
claimNoteBody: "",
|
||||||
claimNoteBodyChanged:false,
|
claimNoteBodyChanged: false,
|
||||||
claimNotePop:false
|
claimNotePop: false,
|
||||||
};
|
claimNoteBodyError: undefined,
|
||||||
|
// 原声明信息
|
||||||
};
|
currentUserClaimedContent: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getClaimers = ()=>{
|
getClaimers = () => {
|
||||||
const {issue_id} = this.state;
|
const { issue_id } = this.state;
|
||||||
axios.get(`/issues/${issue_id}/claims.json`)
|
const { current_user } = this.props;
|
||||||
.then((result) => {
|
axios
|
||||||
if(result){
|
.get(`/issues/${issue_id}/claims.json`)
|
||||||
|
.then((result) => {
|
||||||
|
if (result) {
|
||||||
this.setState({
|
this.setState({
|
||||||
claimerdata: result.data.claimers,
|
claimerData: result.data.claimers,
|
||||||
currentUserClaimed: result.data.currentUserclaimed,
|
currentUserClaimed: result.data.currentUserclaimed,
|
||||||
});
|
|
||||||
}
|
|
||||||
}).catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
delClaim = () => {
|
|
||||||
if (this.props.checkIfLogin() === false) {
|
|
||||||
this.props.showLoginDialog();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
const {issue_id} = this.state;
|
|
||||||
axios({
|
|
||||||
method: 'delete',
|
|
||||||
url: `/issues/${issue_id}/claims.json`
|
|
||||||
}).then(result => {
|
|
||||||
this.setState({
|
|
||||||
claimerdata: result.data.claimers,
|
|
||||||
currentUserClaimed: result.data.currentUserclaimed,
|
|
||||||
claimNotePop:false,
|
|
||||||
claimNoteBody:'',
|
|
||||||
});
|
|
||||||
const { refreshFunc } = this.props;
|
|
||||||
refreshFunc && refreshFunc();
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log(error);
|
|
||||||
});
|
});
|
||||||
|
// 如果用户有声明此issue,则赋值currentUserClaimedContent、claimNoteBody
|
||||||
|
if(result.data.currentUserclaimed){
|
||||||
|
const map = result.data.claimers.filter(item =>{return item.user_login === current_user.login});
|
||||||
|
this.setState({
|
||||||
|
currentUserClaimedContent: map[0],
|
||||||
|
claimNoteBody: map[0] && map[0].note_body
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
})
|
||||||
|
.catch(function (error) {
|
||||||
changeClaimNote = (e)=>{
|
console.log(error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
delClaim = () => {
|
||||||
|
if (this.props.checkIfLogin() === false) {
|
||||||
|
this.props.showLoginDialog();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
const { issue_id } = this.state;
|
||||||
|
axios({
|
||||||
|
method: "delete",
|
||||||
|
url: `/issues/${issue_id}/claims.json`,
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
this.setState({
|
||||||
|
claimerData: result.data.claimers,
|
||||||
|
currentUserClaimed: result.data.currentUserclaimed,
|
||||||
|
claimNotePop: false,
|
||||||
|
claimNoteBody: "",
|
||||||
|
currentUserClaimedContent: undefined
|
||||||
|
});
|
||||||
|
const { refreshFunc } = this.props;
|
||||||
|
refreshFunc && refreshFunc();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
changeClaimNote = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
claimNoteBodyError: undefined,
|
||||||
claimNoteBody: e.target.value,
|
claimNoteBody: e.target.value,
|
||||||
claimNoteBodyChanged: true,
|
claimNoteBodyChanged: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
yesClaim = ()=>{
|
yesClaim = () => {
|
||||||
const {issue_id,claimNoteBody} = this.state;
|
const { issue_id, claimNoteBody, currentUserClaimed, currentUserClaimedContent} = this.state;
|
||||||
const { refreshFunc } = this.props;
|
const { refreshFunc, current_user} = this.props;
|
||||||
|
if(claimNoteBody){
|
||||||
axios.post(`/issues/${issue_id}/claims.json`, {
|
// 新增声明
|
||||||
claim_note: claimNoteBody
|
if(!currentUserClaimed){
|
||||||
})
|
axios.post(`/issues/${issue_id}/claims.json`, {
|
||||||
.then(result => {
|
claim_note: claimNoteBody,
|
||||||
this.setState({
|
})
|
||||||
claimerdata: result.data.claimers,
|
.then((result) => {
|
||||||
|
const map = result.data.claimers.filter(item =>{return item.user_login === current_user.login});
|
||||||
|
this.setState({
|
||||||
|
claimerData: result.data.claimers,
|
||||||
currentUserClaimed: result.data.currentUserclaimed,
|
currentUserClaimed: result.data.currentUserclaimed,
|
||||||
claimNotePop:false,
|
claimNotePop: false,
|
||||||
|
currentUserClaimedContent: map[0],
|
||||||
|
claimNoteBody: map[0] && map[0].note_body
|
||||||
});
|
});
|
||||||
refreshFunc && refreshFunc();
|
refreshFunc && refreshFunc();
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
addClaim = ()=> {
|
|
||||||
if (this.props.checkIfLogin() === false) {
|
|
||||||
this.props.showLoginDialog();
|
|
||||||
return;
|
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
// 更新声明
|
||||||
claimNotePop: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
updateClaim = (claimId,key)=>{
|
|
||||||
const {issue_id,claimNoteBody,claimNoteBodyChanged} = this.state;
|
|
||||||
const { refreshFunc } = this.props;
|
|
||||||
if(claimNoteBodyChanged){
|
|
||||||
axios.put(`/issues/${issue_id}/claims.json`, {
|
axios.put(`/issues/${issue_id}/claims.json`, {
|
||||||
claim_note: claimNoteBody,
|
claim_note: claimNoteBody,
|
||||||
claim_id: claimId
|
claim_id: currentUserClaimedContent.claim_id,
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
claimerdata: result.data.claimers,
|
claimerData: result.data.claimers,
|
||||||
currentUserClaimed: result.data.currentUserclaimed,
|
currentUserClaimed: result.data.currentUserclaimed,
|
||||||
});
|
claimNotePop: false
|
||||||
refreshFunc && refreshFunc();
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log(error);
|
|
||||||
});
|
});
|
||||||
}
|
refreshFunc && refreshFunc();
|
||||||
this.setVisibleFunc(false,key)
|
})
|
||||||
};
|
.catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.setState({claimNoteBodyError: '请输入您的声明留言'});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
addClaim = () => {
|
||||||
|
if (this.props.checkIfLogin() === false) {
|
||||||
|
this.props.showLoginDialog();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
claimNotePop: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
cancelClaim = () => {
|
||||||
cancleClaim = ()=>{
|
const {currentUserClaimedContent} = this.state;
|
||||||
this.setState({
|
this.setState({
|
||||||
claimNotePop: false,
|
claimNotePop: false,
|
||||||
})
|
claimNoteBodyError: undefined,
|
||||||
};
|
claimNoteBody: currentUserClaimedContent ? currentUserClaimedContent.note_body : ''
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
this.getClaimers();
|
this.getClaimers();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setVisibleFunc = (flag, index) => {
|
||||||
setVisibleFunc = (flag,index) => {
|
const { claimerData } = this.state;
|
||||||
const {claimerdata} = this.state
|
var lx = claimerData.concat();
|
||||||
var lx = claimerdata.concat();
|
lx.map((i) => (i.visible = false));
|
||||||
lx.map(i=>i.visible =false);
|
if (flag) {
|
||||||
if(flag){
|
|
||||||
lx[index].visible = flag;
|
lx[index].visible = flag;
|
||||||
}
|
}
|
||||||
lx.splice();
|
lx.splice();
|
||||||
this.setState({
|
this.setState({
|
||||||
claimerdata:lx
|
claimerData: lx,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { claimerData, currentUserClaimed, claimNoteBody, claimNoteBodyError } = this.state;
|
||||||
claimerdata,
|
|
||||||
currentUserClaimed,
|
|
||||||
issue_id
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
const rednerlist = (item)=>{
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Link to={`/${item && item.user_login}`} className="show-user-link">
|
|
||||||
<img
|
|
||||||
className="radius"
|
|
||||||
src={getImageUrl(`/${item && item.user_picture}`)}
|
|
||||||
alt=""
|
|
||||||
width="30"
|
|
||||||
height="30"/>
|
|
||||||
</Link>
|
|
||||||
<Link to={`/${item && item.user_login}`}
|
|
||||||
className="show-user-link color-black ml10 fwb">
|
|
||||||
{item && item.user_name}
|
|
||||||
</Link>
|
|
||||||
<span className="color-grey-8"> 声明于 {item.created_at}</span>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderClaim = ()=>{
|
|
||||||
return(
|
|
||||||
<div className="claimNote_input">
|
|
||||||
<span> 声明留言:</span> <br/>
|
|
||||||
<TextArea rows={4} type="text" placeholder="例如可以留言你的解决思路......" onChange={this.changeClaimNote}/><br/><br/>
|
|
||||||
<div style={{display:"flex",justifyContent:'center'}}>
|
|
||||||
<Button onClick={()=>this.cancleClaim()} >取 消</Button>
|
|
||||||
<Button onClick={()=>this.yesClaim()} style={{marginLeft:"20px"}} type={'primary'} >确 认</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderUser = (item,key)=>{
|
const renderClaim = () => {
|
||||||
const { current_user} = this.props;
|
return (
|
||||||
|
<div className="claimNote_input" style={{ width: "400" }}>
|
||||||
|
<div className="mb5"> 声明留言:</div>
|
||||||
|
<TextArea
|
||||||
|
rows={6}
|
||||||
|
type="text"
|
||||||
|
placeholder="例如可以留言你的解决思路......"
|
||||||
|
onChange={this.changeClaimNote}
|
||||||
|
value={claimNoteBody}
|
||||||
|
className={claimNoteBodyError ? 'error' : ''}
|
||||||
|
/>
|
||||||
|
<div className="mt10" style={{color: 'red'}}>{claimNoteBodyError}</div>
|
||||||
|
<div style={{ display: "flex", justifyContent: "center" }} className="mt10">
|
||||||
|
<Button onClick={() => this.cancelClaim()}>取 消</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => this.yesClaim()}
|
||||||
|
style={{ marginLeft: "20px" }}
|
||||||
|
type={"primary"}
|
||||||
|
>
|
||||||
|
确 认
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderUser = (item, key) => {
|
||||||
return (
|
const { current_user } = this.props;
|
||||||
<div>
|
return (
|
||||||
<FlexAJ className="menuMaininfos">
|
<div>
|
||||||
<AlignCenter>
|
<FlexAJ className="menuMaininfos">
|
||||||
<Link to={`/${item && item.user_login}`} className="show-user-link">
|
<AlignCenter>
|
||||||
<img
|
<Link
|
||||||
className="radius"
|
to={`/${item && item.user_login}`}
|
||||||
src={getImageUrl(`/${item && item.user_picture}`)}
|
className="show-user-link"
|
||||||
alt=""
|
>
|
||||||
width="30"
|
<img
|
||||||
height="30"/>
|
className="radius"
|
||||||
</Link>
|
src={getImageUrl(`/${item && item.user_picture}`)}
|
||||||
<Link to={`/${item && item.user_login}`}
|
alt=""
|
||||||
className="show-user-link color-black ml10 fwb">
|
width="30"
|
||||||
<div >
|
height="30"
|
||||||
{current_user.login == item.user_login?(<div>你</div>
|
/>
|
||||||
):(
|
</Link>
|
||||||
<div>{item && item.user_name}</div>
|
<Link
|
||||||
)}
|
to={`/${item && item.user_login}`}
|
||||||
</div>
|
className="show-user-link color-black ml10 fwb"
|
||||||
</Link>
|
>
|
||||||
<div style={{marginLeft:"10px"}}> <span className="color-grey-8"> 声明于 {item.created_at}</span></div>
|
|
||||||
</AlignCenter>
|
|
||||||
</FlexAJ>
|
|
||||||
<div className="claimNote">
|
|
||||||
{current_user.login==item.user_login?(
|
|
||||||
<div><span>你的留言:</span><br/>
|
|
||||||
<TextArea onChange={this.changeClaimNote} type="text" defaultValue={item.note_body} /><br/>
|
|
||||||
<div style={{display:"flex",justifyContent:'center',paddingBottom:"10px",paddingTop:"10px"}}>
|
|
||||||
<Button onClick={()=>this.updateClaim(item.claim_id,key)} type={'primary'} >更新声明留言</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
):
|
|
||||||
(
|
|
||||||
<div>
|
<div>
|
||||||
{item.note_body.length==0?(
|
{current_user.login == item.user_login ? (
|
||||||
<span>未留言</span>
|
<div>你</div>
|
||||||
):(
|
) : (
|
||||||
<div><span>声明留言:</span><br/>
|
<div>{item && item.user_name}</div>
|
||||||
<span>{item.note_body}</span></div>
|
)}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</Link>
|
||||||
</div>
|
<div style={{ marginLeft: "10px" }}>
|
||||||
|
{" "}
|
||||||
</div>
|
<span className="color-grey-8"> 声明于 {item.created_at}</span>
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{currentUserClaimed===1?(
|
|
||||||
<div><Button onClick={()=>this.delClaim()} >取消声明</Button>
|
|
||||||
</div>
|
|
||||||
):(
|
|
||||||
<Popover visible={this.state.claimNotePop} content={renderClaim()} trigger='click' placement="bottom" overlayClassName="menuPanels">
|
|
||||||
<Button onClick={()=> this.addClaim()} type="primary"><i className="iconfont icon-shengming font-14 mr5 color-white"></i>声明</Button>
|
|
||||||
</Popover>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="ant-divider ant-divider-horizontal"> </div>
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
claimerdata&&claimerdata.length>0?(
|
|
||||||
<div>
|
|
||||||
<div className="mt15">
|
|
||||||
<span>声明要关注/解决此疑修的用户</span>
|
|
||||||
<span className="infoCount">{claimerdata.length}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="attrPerson" onMouseLeave={()=>this.setVisibleFunc(false)}>
|
</AlignCenter>
|
||||||
{claimerdata.map((item,key)=>{
|
</FlexAJ>
|
||||||
return(
|
<div className="claimNote">
|
||||||
<Popover content={renderUser(item,key)} visible={item.visible} placement="top" overlayClassName="menuPanels">
|
{current_user.login == item.user_login ? (
|
||||||
<Link key={key} to={`/${item.user_login}`}>
|
<div>
|
||||||
<img src={getImageUrl(`/${item.user_picture}`)} alt="" onMouseOver={()=>this.setVisibleFunc(true,key)}/>
|
<div className="mb5">你的留言:</div>
|
||||||
</Link>
|
<span>{item.note_body}</span>
|
||||||
</Popover>
|
<br />
|
||||||
)
|
<div
|
||||||
})}
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
paddingBottom: "10px",
|
||||||
|
paddingTop: "10px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
onClick={() => this.delClaim()}
|
||||||
|
type={"primary"}
|
||||||
|
>
|
||||||
|
取消声明
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>):(
|
) : (
|
||||||
<div className='mt15'>
|
<div>
|
||||||
|
{item.note_body.length == 0 ? (
|
||||||
|
<span>未留言</span>
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
<div className="mb5">声明留言:</div>
|
||||||
|
<span>{item.note_body}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Popover
|
||||||
|
visible={this.state.claimNotePop}
|
||||||
|
content={renderClaim()}
|
||||||
|
trigger="click"
|
||||||
|
placement="bottom"
|
||||||
|
overlayClassName="menuPanels maxWidth"
|
||||||
|
>
|
||||||
|
{currentUserClaimed === 1 ? <a
|
||||||
|
className="topWrapper_btn"
|
||||||
|
onClick={() => {this.setState({claimNotePop: true});}}
|
||||||
|
style={{ display: "inline-block" }}
|
||||||
|
>
|
||||||
|
更改声明
|
||||||
|
</a> : <Button onClick={() => this.addClaim()} type="primary">
|
||||||
|
<i className="iconfont icon-shengming font-14 mr5 color-white"></i>
|
||||||
|
声明
|
||||||
|
</Button>}
|
||||||
|
</Popover>
|
||||||
|
|
||||||
|
<div className="ant-divider ant-divider-horizontal"> </div>
|
||||||
|
|
||||||
|
{claimerData && claimerData.length > 0 ? (
|
||||||
|
<div>
|
||||||
|
<div className="mt15">
|
||||||
<span>声明要关注/解决此疑修的用户</span>
|
<span>声明要关注/解决此疑修的用户</span>
|
||||||
<span className="infoCount">0</span>
|
<span className="infoCount">{claimerData.length}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
<div
|
||||||
|
className="attrPerson"
|
||||||
</div>
|
onMouseLeave={() => this.setVisibleFunc(false)}
|
||||||
);
|
>
|
||||||
}
|
{claimerData.map((item, key) => {
|
||||||
}
|
return (
|
||||||
|
<Popover
|
||||||
|
content={renderUser(item, key)}
|
||||||
|
visible={item.visible}
|
||||||
|
placemen
|
||||||
|
t="top"
|
||||||
|
overlayClassName="menuPanels"
|
||||||
|
width={400}
|
||||||
|
>
|
||||||
|
<Link key={key} to={`/${item.user_login}`}>
|
||||||
|
<img
|
||||||
|
src={getImageUrl(`/${item.user_picture}`)}
|
||||||
|
alt=""
|
||||||
|
onMouseOver={() => this.setVisibleFunc(true, key)}
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="mt15">
|
||||||
|
<span>声明要关注/解决此疑修的用户</span>
|
||||||
|
<span className="infoCount">0</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default claims;
|
export default claims;
|
||||||
|
|
|
@ -147,6 +147,7 @@ class Infos extends Component {
|
||||||
});
|
});
|
||||||
const { pathname } = this.props.location;
|
const { pathname } = this.props.location;
|
||||||
this.renderPath(pathname,result.data);
|
this.renderPath(pathname,result.data);
|
||||||
|
document.title = result.data.username+'('+ username +')';
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { AlignCenter } from '../../Component/layout';
|
||||||
import './Index.scss';
|
import './Index.scss';
|
||||||
import { locData } from '../../Utils/locData';
|
import { locData } from '../../Utils/locData';
|
||||||
import Axios from 'axios';
|
import Axios from 'axios';
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
|
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
export default Form.create()(
|
export default Form.create()(
|
||||||
|
@ -58,6 +59,7 @@ export default Form.create()(
|
||||||
<Input placeholder="请输入您的邮箱账号" disabled style={{width:"400px"}}/>
|
<Input placeholder="请输入您的邮箱账号" disabled style={{width:"400px"}}/>
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Link className='gotoUpdateEmail mr30' to='/settings/emails'><i className='iconfont icon-bianji1 font-15 mr5'></i>更改邮箱</Link>
|
||||||
<Form.Item label="">
|
<Form.Item label="">
|
||||||
{getFieldDecorator("show_email",{
|
{getFieldDecorator("show_email",{
|
||||||
rules:[],
|
rules:[],
|
||||||
|
|
|
@ -17,20 +17,29 @@ function Index(props){
|
||||||
setKey("0");
|
setKey("0");
|
||||||
}else{
|
}else{
|
||||||
setKey("1");
|
setKey("1");
|
||||||
|
switch(pathname){
|
||||||
|
case '/settings/emails':
|
||||||
|
setType('0');
|
||||||
|
break;
|
||||||
|
case '/settings/password':
|
||||||
|
setType('1');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setType('2');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},[pathname])
|
},[pathname])
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="notice01">
|
<div className="notice01">
|
||||||
<div className="sshHead personalInfo mb20">
|
<div className="sshHead personalInfo mb20">
|
||||||
{key === "0" ? <Menu mode={'horizontal'} className="infosRightMenu">
|
{key === "0" ? <Menu mode={'horizontal'} className="infosRightMenu">
|
||||||
<Menu.Item key="0" className="font-16">基本资料</Menu.Item>
|
<Menu.Item key="0" className="font-16">基本资料</Menu.Item>
|
||||||
</Menu> : <Menu mode={'horizontal'} className="infosRightMenu" selectedKeys={type} onClick={(e)=>{setType(e.key)}}>
|
</Menu> : <Menu mode={'horizontal'} className="infosRightMenu" selectedKeys={type}>
|
||||||
<Menu.Item key="0" className="font-16">邮箱管理</Menu.Item>
|
<Menu.Item key="0" className="font-16" onClick={()=>{props.history.push('/settings/emails')}}>邮箱管理</Menu.Item>
|
||||||
<Menu.Item key="1" className="font-16">密码管理</Menu.Item>
|
<Menu.Item key="1" className="font-16" onClick={()=>{props.history.push('/settings/password')}}>密码管理</Menu.Item>
|
||||||
<Menu.Item key="2" className="font-16">账号注销</Menu.Item>
|
<Menu.Item key="2" className="font-16" onClick={()=>{props.history.push('/settings/cancel')}}>账号注销</Menu.Item>
|
||||||
</Menu>}
|
</Menu>}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -164,4 +164,7 @@
|
||||||
border-color: #1140ff;
|
border-color: #1140ff;
|
||||||
color: #1140ff;
|
color: #1140ff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.gotoUpdateEmail{
|
||||||
|
line-height: 40px;
|
||||||
}
|
}
|
|
@ -48,7 +48,7 @@ function TopEdition({register,current_user}) {
|
||||||
return(
|
return(
|
||||||
<div className={`regform`}>
|
<div className={`regform`}>
|
||||||
{/* style={{backgroundImage:`url(${getImageUrl(i.image)})`}} */}
|
{/* style={{backgroundImage:`url(${getImageUrl(i.image)})`}} */}
|
||||||
<div onClick={()=>{if(k === 3){window.location.href="https://forum.gitlink.org.cn/forums/7653/detail"}}} style={{cursor: k === 3 ? 'pointer' : ''}}>
|
<div onClick={()=>{if(i.url){window.location.href=i.url}}} style={{cursor: i.url ? 'pointer' : ''}}>
|
||||||
<img src={getImageUrl(i.image)} alt="" height="100%"/>
|
<img src={getImageUrl(i.image)} alt="" height="100%"/>
|
||||||
{
|
{
|
||||||
k +1 === bannerList.length && (!(current_user && current_user.login)) ?
|
k +1 === bannerList.length && (!(current_user && current_user.login)) ?
|
||||||
|
|
|
@ -99,7 +99,7 @@ li {
|
||||||
|
|
||||||
pre.prettyprint {
|
pre.prettyprint {
|
||||||
border: 0px solid transparent;
|
border: 0px solid transparent;
|
||||||
padding: 10px;
|
padding: 10px 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.-flex-basic0 {
|
.-flex-basic0 {
|
||||||
|
|
|
@ -518,7 +518,7 @@ class LoginDialog extends Component {
|
||||||
}
|
}
|
||||||
value={this.state.loginValue}
|
value={this.state.loginValue}
|
||||||
name="username"
|
name="username"
|
||||||
placeholder="请输入邮箱地址/用户名" ></input>
|
placeholder="请输入手机号/邮箱/用户名" ></input>
|
||||||
|
|
||||||
<div style={{ height: '25px' }}><p className="color-orange edu-txt-left none" id="username_error_notice"
|
<div style={{ height: '25px' }}><p className="color-orange edu-txt-left none" id="username_error_notice"
|
||||||
style={{ display: Phonenumberisnotco === undefined ? 'none' : 'block' }}>{Phonenumberisnotco}</p></div>
|
style={{ display: Phonenumberisnotco === undefined ? 'none' : 'block' }}>{Phonenumberisnotco}</p></div>
|
||||||
|
|
|
@ -15,13 +15,14 @@ function Login(props){
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
//控制密码输入框在DOM不可见value
|
//控制密码输入框在DOM不可见value
|
||||||
clear;
|
clear();
|
||||||
//获取第三方登录平台信息
|
//获取第三方登录平台信息
|
||||||
setSetting(JSON.parse(localStorage.getItem("chromesetting")));
|
setSetting(JSON.parse(localStorage.getItem("chromesetting")));
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
// 登录表单提交
|
// 登录表单提交
|
||||||
function handleSubmit(){
|
function handleSubmit(){
|
||||||
|
setMessage(undefined);
|
||||||
form.validateFields((err, values) => {
|
form.validateFields((err, values) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
axios.post(`/accounts/login.json`, {
|
axios.post(`/accounts/login.json`, {
|
||||||
|
@ -46,12 +47,6 @@ function Login(props){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//校验用户名
|
|
||||||
function comfirmWrite(rule, value, callback, index){
|
|
||||||
setMessage(undefined);
|
|
||||||
value ? callback():index === 1? callback("请输入邮箱地址或用户名登录"):callback("请输入登录密码");
|
|
||||||
}
|
|
||||||
|
|
||||||
//清除密码框的value属性->DOM看不见密码值
|
//清除密码框的value属性->DOM看不见密码值
|
||||||
function clear(){
|
function clear(){
|
||||||
const password = document.getElementById("login_password");
|
const password = document.getElementById("login_password");
|
||||||
|
@ -65,28 +60,30 @@ function Login(props){
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<div className="right_cont login_content">
|
<div className="right_cont login_content">
|
||||||
<div className="login_register_head">
|
<div className="login_register_head mb30">
|
||||||
<span>欢迎登录 GitLink</span>
|
<span>欢迎登录 GitLink</span>
|
||||||
<span className="link_span">没有账号?<Link to={`/register`}>去注册</Link></span>
|
<span className="link_span">没有账号?<Link to={`/register`}>去注册</Link></span>
|
||||||
</div>
|
</div>
|
||||||
<p className = {message?"message active":"message"}>{message}</p>
|
<p className = {message?"message active mb10":"message"}>{message}</p>
|
||||||
<Form className="login-form">
|
<Form className="login-form">
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
{getFieldDecorator('username',{
|
{getFieldDecorator('username',{
|
||||||
rules:[
|
rules:[
|
||||||
{
|
{
|
||||||
validator: (rule, value, callback) => { comfirmWrite(rule, value, callback, 1) }
|
required:true,
|
||||||
|
message:"请输入手机号/邮箱/用户名"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
validateTrigger:"onBlur",
|
validateTrigger:"onBlur",
|
||||||
})(<Input className="account" placeholder="请输入邮箱地址/用户名"/>)}
|
})(<Input className="account" placeholder="请输入手机号/邮箱/用户名"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
{getFieldDecorator('password', {
|
{getFieldDecorator('password', {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
validator: (rule, value, callback) => { comfirmWrite(rule, value, callback, 2) }
|
required:true,
|
||||||
|
message:"请输入登录密码"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
validateTrigger:"onBlur",
|
validateTrigger:"onBlur",
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
padding: 2.5em 5em;
|
padding: 2.5em 5em;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
& .login_register_head{
|
.login_register_head{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -89,17 +89,15 @@
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
//注册页面的获取验证码输入框
|
//注册页面的获取验证码输入框
|
||||||
& .ant-input{width: 18rem; }
|
.ant-input{width: 18rem; }
|
||||||
}
|
}
|
||||||
//第一个输入框
|
|
||||||
& .account{margin-top: 4vh; }
|
|
||||||
//所有的链接
|
//所有的链接
|
||||||
& a{
|
.link_span a{
|
||||||
color: #466AFF;
|
color: #466AFF;
|
||||||
&:hover{opacity:0.8; }
|
&:hover{opacity:0.8; }
|
||||||
}
|
}
|
||||||
//登录 注册 重置密码并登录按钮
|
//登录 注册 重置密码并登录按钮
|
||||||
& .login_register_cofBut{
|
.login_register_cofBut{
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 3.1em;
|
height: 3.1em;
|
||||||
|
@ -128,28 +126,25 @@
|
||||||
border-color: #d9d9d9;
|
border-color: #d9d9d9;
|
||||||
}
|
}
|
||||||
//输入密码提示框
|
//输入密码提示框
|
||||||
& .password_tips{
|
.password_tips{
|
||||||
margin-top: -10px;
|
margin-top: -10px;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
color: #808080;
|
color: #808080;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
& .message, .ant-form-explain{
|
.message, .ant-form-explain{
|
||||||
color: #D40000;
|
color: #D40000;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
& .message.active{
|
|
||||||
margin-bottom: -30px !important;
|
|
||||||
}
|
|
||||||
//antd 输入框样式
|
//antd 输入框样式
|
||||||
& .ant-input{
|
.ant-input{
|
||||||
height: 3.1em;
|
height: 3.1em;
|
||||||
background-color: #F7F7F7 !important;
|
background-color: #F7F7F7 !important;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
&:hover{border-color:#466AFF; }
|
&:hover{border-color:#466AFF; }
|
||||||
}
|
}
|
||||||
& .ant-form-explain{
|
.ant-form-explain{
|
||||||
margin-top: 0.5vh;
|
margin-top: 0.5vh;
|
||||||
margin-bottom: -10px;
|
margin-bottom: -10px;
|
||||||
}
|
}
|
||||||
|
@ -181,20 +176,20 @@
|
||||||
top: 18vh;
|
top: 18vh;
|
||||||
background-image: url(./img/loginBg.png);
|
background-image: url(./img/loginBg.png);
|
||||||
//下次自动登录&&忘记密码
|
//下次自动登录&&忘记密码
|
||||||
& .login_register_head.login{
|
.login_register_head.login{
|
||||||
.ant-form-item{
|
.ant-form-item{
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
margin-top: -1vh;
|
margin-top: -1vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//第三方登录
|
//第三方登录
|
||||||
& .quick_logon{
|
.quick_logon{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
& .quick_logon_p{
|
.quick_logon_p{
|
||||||
border-top: 1px solid #979797;
|
border-top: 1px solid #979797;
|
||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
& .startlogin{
|
.startlogin{
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #dee1f4;
|
background: #dee1f4;
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -211,10 +206,13 @@
|
||||||
.Register_content{
|
.Register_content{
|
||||||
// top: 8em;
|
// top: 8em;
|
||||||
background-image: url(./img/registerBg.png);
|
background-image: url(./img/registerBg.png);
|
||||||
& .register_last_form .ant-form-item-control{
|
.register_last_form .ant-form-item-control{
|
||||||
line-height: 0.5;
|
line-height: 0.5;
|
||||||
}
|
}
|
||||||
& .login_register_cofBut{margin-top: 0.5vh; }
|
.login_register_cofBut{margin-top: 0.5vh; }
|
||||||
|
.message.active{
|
||||||
|
margin: -5px 0 10px 0 !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//找回密码框样式
|
//找回密码框样式
|
||||||
|
@ -222,12 +220,21 @@
|
||||||
// top: 12vh;
|
// top: 12vh;
|
||||||
background-image: url(./img/resetPasswordBg.png);
|
background-image: url(./img/resetPasswordBg.png);
|
||||||
// height: 550px;
|
// height: 550px;
|
||||||
& .resetFailCaptcha{
|
.resetFailCaptcha{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 25px;
|
top: 25px;
|
||||||
color: #D40000;
|
color: #D40000;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
& .login_register_cofBut{margin-top: 1.5vh; }
|
.login_register_cofBut{margin-top: 1.5vh; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.registerNav{
|
||||||
|
.type{color: #000;}
|
||||||
|
.activeRegisterNav{
|
||||||
|
color: $primary-color;
|
||||||
|
display: inline-block;
|
||||||
|
border-bottom: 2px solid;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ import './LoginRegisterPage.scss';
|
||||||
|
|
||||||
function Register(props){
|
function Register(props){
|
||||||
const {form} = props;
|
const {form} = props;
|
||||||
const {getFieldDecorator } = form;
|
const {getFieldDecorator, setFieldsValue } = form;
|
||||||
//用户输入的符合规则的邮箱(用于获取验证码)
|
//用户输入的符合规则的邮箱(用于获取验证码)
|
||||||
const [emailStr, setEmailStr] = useState(undefined);
|
const [emailStr, setEmailStr] = useState(undefined);
|
||||||
//用户输入的符合规则的用户名,用于当用户输入符合规则的用户名之后再更改又去触发check.json接口
|
//用户输入的符合规则的用户名,用于当用户输入符合规则的用户名之后再更改又去触发check.json接口
|
||||||
|
@ -20,10 +20,12 @@ function Register(props){
|
||||||
//用于表单提交时会再次校验数据
|
//用于表单提交时会再次校验数据
|
||||||
const [userNameGo, setUserNameGo] = useState(true);
|
const [userNameGo, setUserNameGo] = useState(true);
|
||||||
const [emailGo, setEmailGo] = useState(true);
|
const [emailGo, setEmailGo] = useState(true);
|
||||||
|
// 注册类型(手机号/邮箱)
|
||||||
|
const [registerType, setRegisterType] = useState(0);
|
||||||
const seconds = useRef();
|
const seconds = useRef();
|
||||||
let interval = undefined;
|
let interval = undefined;
|
||||||
//页面加载完自动聚焦到第一个输入框
|
//页面加载完自动聚焦到第一个输入框
|
||||||
const inputEl = useRef(null);
|
// const inputEl = useRef(null);
|
||||||
|
|
||||||
//注册表单提交
|
//注册表单提交
|
||||||
function handleSubmit(){
|
function handleSubmit(){
|
||||||
|
@ -52,7 +54,7 @@ function Register(props){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断用户名(username)是否注册
|
//判断用户名(username)是否注册
|
||||||
function usernameConfirm(rule, value, callback){
|
function usernameConfirm(rule, value, callback){
|
||||||
setUserNameGo(true);
|
setUserNameGo(true);
|
||||||
|
@ -70,23 +72,33 @@ function Register(props){
|
||||||
}):callback();setLoginStr(undefined);
|
}):callback();setLoginStr(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断邮箱是否注册
|
//判断邮箱/手机号是否符合规范、是否注册
|
||||||
function emailConfirm(rule, value, callback) {
|
function emailConfirm(rule, value, callback) {
|
||||||
setEmailGo(true);
|
if(value){
|
||||||
value && (emailGo || value !== emailStr) ? axios.post(`/accounts/check.json`, {
|
if((/^([1][3456789])\d{9}$/.test(value) && !registerType) || (/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(value) && registerType)){
|
||||||
value: value,
|
setEmailGo(true);
|
||||||
type: 2
|
(emailGo || value !== emailStr) ? axios.get(`/accounts/valid_email_and_phone.json`, {
|
||||||
}).then(response => {
|
params: {
|
||||||
if (response.data.status === -1) {
|
login: value,
|
||||||
setGetCaptchaBut(false);
|
type: 1
|
||||||
callback(response.data.message);
|
}
|
||||||
} else {
|
}).then(response => {
|
||||||
setEmailStr(value);
|
if(!response.data.status){
|
||||||
setGetCaptchaBut(true);
|
setEmailStr(value);
|
||||||
setEmailGo(false);
|
setGetCaptchaBut(true);
|
||||||
callback();
|
setEmailGo(false);
|
||||||
|
callback();
|
||||||
|
}else{
|
||||||
|
setGetCaptchaBut(false);
|
||||||
|
callback(response.data.status === -2 ? `该${registerType ? '邮箱' : '手机号'}已被注册` : response.data.message);
|
||||||
|
}
|
||||||
|
}):callback();setEmailStr(undefined);
|
||||||
|
}else{
|
||||||
|
callback(`请输入正确的${registerType ? '邮箱地址' : '手机号'}`);
|
||||||
}
|
}
|
||||||
}):callback();setEmailStr(undefined);
|
}else{
|
||||||
|
callback(`请输入${registerType ? '邮箱地址' : '手机号'}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//确认密码
|
//确认密码
|
||||||
|
@ -163,7 +175,7 @@ function Register(props){
|
||||||
if (response.data && response.data.status === 0) {
|
if (response.data && response.data.status === 0) {
|
||||||
//验证码发送成功
|
//验证码发送成功
|
||||||
let email = emailStr.substring(emailStr.indexOf("@")+1);
|
let email = emailStr.substring(emailStr.indexOf("@")+1);
|
||||||
message.success({content:<span>验证码已发送,请注意查收。<a href={`https://mail.${email}`} target="_blank">前往邮箱</a></span>});
|
message.success({content:<span>验证码已发送,请注意查收。{registerType ? <a href={`https://mail.${email}`} target="_blank">前往邮箱</a> : ''}</span>});
|
||||||
} else {
|
} else {
|
||||||
//验证码发送失败,获取验证码按钮变灰并且文案变回【获取验证码】
|
//验证码发送失败,获取验证码按钮变灰并且文案变回【获取验证码】
|
||||||
setGetCaptchaBut(false);
|
setGetCaptchaBut(false);
|
||||||
|
@ -192,17 +204,27 @@ function Register(props){
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
inputEl.current.focus();
|
// inputEl.current.focus();
|
||||||
clear;
|
// clear;
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
function changeRegisterType(type){
|
||||||
|
setGetCaptchaBut(false);
|
||||||
|
setRegisterType(type);
|
||||||
|
setFieldsValue({'email': undefined})
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<div className="right_cont Register_content">
|
<div className="right_cont Register_content">
|
||||||
<div className="login_register_head">
|
<div className="login_register_head mb30">
|
||||||
<span>欢迎注册 GitLink</span>
|
<span>欢迎注册 GitLink</span>
|
||||||
<span className="link_span">已有账号,<Link to={`/login`}>立即登录</Link></span>
|
<span className="link_span">已有账号,<Link to={`/login`}>立即登录</Link></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="registerNav mb20 font-18">
|
||||||
|
<a className={`type ${registerType ? '' : 'activeRegisterNav'}`} onClick={()=>{changeRegisterType(0)}}>手机号注册</a>
|
||||||
|
<a className={`type ${registerType ? 'activeRegisterNav' : ''} ml50`} onClick={()=>{changeRegisterType(1)}}>邮箱注册</a>
|
||||||
|
</div>
|
||||||
<p className={mess ? "message active" : "message"}>{mess}</p>
|
<p className={mess ? "message active" : "message"}>{mess}</p>
|
||||||
<Form className="login-form">
|
<Form className="login-form">
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
|
@ -231,29 +253,21 @@ function Register(props){
|
||||||
],
|
],
|
||||||
validateTrigger:"onBlur",
|
validateTrigger:"onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input ref={inputEl} className="account" placeholder="请输入4-15位用户名,以字母开头,只能使用字母和数字" readOnly onFocus={()=>{document.getElementById("register_register_username").removeAttribute("readOnly")}}/>)}
|
// ref={inputEl}
|
||||||
|
})(<Input placeholder="请输入4-15位用户名,以字母开头,只能使用字母和数字" autoComplete="off"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
{getFieldDecorator('email',{
|
{getFieldDecorator('email',{
|
||||||
rules:[
|
rules:[
|
||||||
{
|
|
||||||
type: 'email',
|
|
||||||
message: '请输入正确的邮箱格式',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
required:true,
|
|
||||||
message:"请输入邮箱地址"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
validator: (rule, value, callback) => { emailConfirm(rule, value, callback) }
|
validator: (rule, value, callback) => { emailConfirm(rule, value, callback) }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
validateTrigger:"onBlur",
|
validateTrigger:"onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input className="email" placeholder="请输入邮箱地址" readOnly onFocus={()=>{document.getElementById("register_email").removeAttribute("readOnly")}} />)}
|
})(<Input className="email" placeholder={`请输入${registerType ? '邮箱地址' : '手机号'}`} autoComplete="off"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<div className="login_register_head">
|
<div className="login_register_head">
|
||||||
{getFieldDecorator('captcha', {
|
{getFieldDecorator('captcha', {
|
||||||
|
@ -263,12 +277,12 @@ function Register(props){
|
||||||
}],
|
}],
|
||||||
validateTrigger: "onBlur",
|
validateTrigger: "onBlur",
|
||||||
})(
|
})(
|
||||||
<Input className="captcha" placeholder="请输入验证码" readOnly onFocus={()=>{document.getElementById("register_captcha").removeAttribute("readOnly")}} />
|
<Input className="captcha" placeholder="请输入验证码" autoComplete="off"/>
|
||||||
)}
|
)}
|
||||||
<Button className={getCaptchaBut ? 'codeBut':'codeBut disable'} disabled={!getCaptchaBut} onClick={getCaptcha}>{getCaptchaBut || (!getCaptchaBut && !countDown)?"获取验证码":`重发(${secondsStr}s)`}</Button>
|
<Button className={getCaptchaBut ? 'codeBut':'codeBut disable'} disabled={!getCaptchaBut} onClick={getCaptcha}>{getCaptchaBut || (!getCaptchaBut && !countDown)?"获取验证码":`重发(${secondsStr}s)`}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
{getFieldDecorator('register_psd',{
|
{getFieldDecorator('register_psd',{
|
||||||
rules:[
|
rules:[
|
||||||
|
@ -281,7 +295,7 @@ function Register(props){
|
||||||
],
|
],
|
||||||
validateTrigger:"onBlur",
|
validateTrigger:"onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input.Password className="register_psd" placeholder="请输入登录密码" onBlur={clear} onChange={clear} readOnly onFocus={()=>{document.getElementById("register_register_psd").removeAttribute("readOnly")}}/>)}
|
})(<Input.Password className="register_psd" placeholder="请输入登录密码" onBlur={clear} onChange={clear} autoComplete="new-password"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<span className="password_tips" style={{display:tipVisable?"none":"block"}}>请输入8-16位密码,区分大小写、不能使用空格</span>
|
<span className="password_tips" style={{display:tipVisable?"none":"block"}}>请输入8-16位密码,区分大小写、不能使用空格</span>
|
||||||
|
|
||||||
|
@ -298,10 +312,9 @@ function Register(props){
|
||||||
],
|
],
|
||||||
validateTrigger: "onBlur",
|
validateTrigger: "onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input.Password className="psdComfirm" placeholder="请确认登录密码" onBlur={clear} onChange={clear} readOnly onFocus={()=>{document.getElementById("register_psdComfirm").removeAttribute("readOnly")}}/>)}
|
})(<Input.Password className="psdComfirm" placeholder="请确认登录密码" onBlur={clear} onChange={clear} autoComplete="new-password"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|
||||||
<Form.Item className="register_last_form">
|
<Form.Item className="register_last_form">
|
||||||
{getFieldDecorator('agreement', {
|
{getFieldDecorator('agreement', {
|
||||||
valuePropName: 'checked',
|
valuePropName: 'checked',
|
||||||
|
@ -311,7 +324,7 @@ function Register(props){
|
||||||
validator: (rule, value, callback) => { comfirmRead(rule, value, callback) }
|
validator: (rule, value, callback) => { comfirmRead(rule, value, callback) }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
})(<Checkbox>我已阅读并接受<a className="login-form-forgot" href="https://forum.trustie.net/forums/5029/detail" target="_blank">《GitLink服务协议条款》</a></Checkbox>)}
|
})(<Checkbox className="link_span">我已阅读并接受<a className="login-form-forgot" href="https://forum.trustie.net/forums/5029/detail" target="_blank">《GitLink服务协议条款》</a></Checkbox>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="primary" htmlType="submit" className="login_register_cofBut" onClick={handleSubmit}>注册</Button>
|
<Button type="primary" htmlType="submit" className="login_register_cofBut" onClick={handleSubmit}>注册</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
@ -56,23 +56,34 @@ function ResetPassword(props) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断邮箱是否注册
|
//判断邮箱/手机号是否符合规范、是否注册
|
||||||
function emailConfirm(rule, value, callback) {
|
function emailConfirm(rule, value, callback) {
|
||||||
setEmailGo(true);
|
if(/^([1][3456789])\d{9}$/.test(value) || /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(value)){
|
||||||
value && (emailGo || value !== emailStr) ? axios.post(`/accounts/check.json`, {
|
setEmailGo(true);
|
||||||
value: value,
|
if(value && (emailGo || value !== emailStr)){
|
||||||
type: 2
|
axios.get(`/accounts/valid_email_and_phone.json`, {
|
||||||
}).then(response => {
|
params: {
|
||||||
if (response.data && response.data.status === -1) {
|
login: value,
|
||||||
setEmailStr(value);
|
type: 2
|
||||||
setGetCaptchaBut(true);
|
}
|
||||||
setEmailGo(false);
|
}).then(response => {
|
||||||
callback();
|
if (response.data && !response.data.status) {
|
||||||
} else {
|
setEmailStr(value);
|
||||||
setGetCaptchaBut(false);
|
setGetCaptchaBut(true);
|
||||||
callback('此邮箱未注册');
|
setEmailGo(false);
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
setGetCaptchaBut(false);
|
||||||
|
callback('此手机号/邮箱未注册');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
callback()
|
||||||
}
|
}
|
||||||
}):callback();setEmailStr(undefined);
|
setEmailStr(undefined);
|
||||||
|
}else{
|
||||||
|
callback("请输入正确的手机号/邮箱")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//确认密码
|
//确认密码
|
||||||
|
@ -140,7 +151,7 @@ function ResetPassword(props) {
|
||||||
if (response.data && response.data.status === 0) {
|
if (response.data && response.data.status === 0) {
|
||||||
//验证码发送成功
|
//验证码发送成功
|
||||||
let email = emailStr.substring(emailStr.indexOf("@")+1);
|
let email = emailStr.substring(emailStr.indexOf("@")+1);
|
||||||
message.success({content:<span>验证码已发送,请注意查收。<a href={`https://mail.${email}`} target="_blank">前往邮箱</a></span>});
|
message.success({content:<span>验证码已发送,请注意查收。{emailStr.indexOf("@") === -1 ? '' : <a href={`https://mail.${email}`} target="_blank">前往邮箱</a>}</span>});
|
||||||
} else {
|
} else {
|
||||||
//验证码发送失败,获取验证码按钮变灰并且文案变回【获取验证码】
|
//验证码发送失败,获取验证码按钮变灰并且文案变回【获取验证码】
|
||||||
setGetCaptchaBut(false);
|
setGetCaptchaBut(false);
|
||||||
|
@ -151,7 +162,7 @@ function ResetPassword(props) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除密码框的value属性->DOM看不见密码值
|
//清除密码框的value属性->DOM看不见密码值
|
||||||
function clear(){
|
function clear(){
|
||||||
const password = document.getElementById("resetPassword_psd");
|
const password = document.getElementById("resetPassword_psd");
|
||||||
|
@ -170,13 +181,12 @@ function ResetPassword(props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
inputEl.current.focus();
|
inputEl.current.focus();
|
||||||
clear;
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="right_cont ResetPassword_content">
|
<div className="right_cont ResetPassword_content">
|
||||||
<div className="login_register_head">
|
<div className="login_register_head mb30">
|
||||||
<span>找回密码</span>
|
<span>找回密码</span>
|
||||||
<span className="link_span">已有账号,<Link to={`/login`}>立即登录</Link></span>
|
<span className="link_span">已有账号,<Link to={`/login`}>立即登录</Link></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -185,13 +195,9 @@ function ResetPassword(props) {
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
{getFieldDecorator('email', {
|
{getFieldDecorator('email', {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
|
||||||
type: 'email',
|
|
||||||
message: '请输入正确的邮箱格式',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入已注册的邮箱"
|
message: "请输入已注册的手机号/邮箱"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: (rule, value, callback) => { emailConfirm(rule, value, callback) }
|
validator: (rule, value, callback) => { emailConfirm(rule, value, callback) }
|
||||||
|
@ -199,10 +205,9 @@ function ResetPassword(props) {
|
||||||
],
|
],
|
||||||
validateTrigger: "onBlur",
|
validateTrigger: "onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input ref={inputEl} className="account" placeholder="请输入已注册的邮箱" readOnly onFocus={()=>{document.getElementById("resetPassword_email").removeAttribute("readOnly")}} />)}
|
})(<Input ref={inputEl} className="account" placeholder="请输入已注册的手机号/邮箱" autoComplete="off"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<div className="login_register_head">
|
<div className="login_register_head">
|
||||||
{getFieldDecorator('captcha', {
|
{getFieldDecorator('captcha', {
|
||||||
|
@ -212,7 +217,7 @@ function ResetPassword(props) {
|
||||||
}],
|
}],
|
||||||
validateTrigger: "onBlur",
|
validateTrigger: "onBlur",
|
||||||
})(
|
})(
|
||||||
<Input className="captcha" placeholder="请输入验证码" readOnly onFocus={()=>{document.getElementById("resetPassword_captcha").removeAttribute("readOnly")}} />
|
<Input className="captcha" placeholder="请输入验证码" autoComplete="off"/>
|
||||||
)}
|
)}
|
||||||
<Button className={getCaptchaBut ? 'codeBut':'codeBut disable'} disabled={!getCaptchaBut} onClick={getCaptcha}>{getCaptchaBut || (!getCaptchaBut && !countDown)?"获取验证码":`重发(${secondsStr}s)`}</Button>
|
<Button className={getCaptchaBut ? 'codeBut':'codeBut disable'} disabled={!getCaptchaBut} onClick={getCaptcha}>{getCaptchaBut || (!getCaptchaBut && !countDown)?"获取验证码":`重发(${secondsStr}s)`}</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -230,7 +235,7 @@ function ResetPassword(props) {
|
||||||
],
|
],
|
||||||
validateTrigger: "onBlur",
|
validateTrigger: "onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input.Password className="psd" placeholder="请输入新密码" onBlur={clear} onChange={clear} readOnly onFocus={()=>{document.getElementById("resetPassword_psd").removeAttribute("readOnly")}} />)}
|
})(<Input.Password className="psd" placeholder="请输入新密码" onBlur={clear} onChange={clear} autoComplete="new-password"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<span className="password_tips" style={{display:tipVisable?"none":"block"}}>请输入8-16位密码,区分大小写、不能使用空格</span>
|
<span className="password_tips" style={{display:tipVisable?"none":"block"}}>请输入8-16位密码,区分大小写、不能使用空格</span>
|
||||||
|
|
||||||
|
@ -247,7 +252,7 @@ function ResetPassword(props) {
|
||||||
],
|
],
|
||||||
validateTrigger: "onBlur",
|
validateTrigger: "onBlur",
|
||||||
validateFirst: true,
|
validateFirst: true,
|
||||||
})(<Input.Password className="psdComfirm" placeholder="请确认新密码" onBlur={clear} onChange={clear} readOnly onFocus={()=>{document.getElementById("resetPassword_psdComfirm").removeAttribute("readOnly")}} />)}
|
})(<Input.Password className="psdComfirm" placeholder="请确认新密码" onBlur={clear} onChange={clear} autoComplete="new-password"/>)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
|
|
|
@ -106,7 +106,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
|
||||||
let react_id = `react_${id}`;
|
let react_id = `react_${id}`;
|
||||||
const __that = window[react_id]
|
const __that = window[react_id]
|
||||||
// Using "||" set icons align right.
|
// Using "||" set icons align right.
|
||||||
const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "line-break", "watch", "clear"];
|
const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "line-break", "watch", "clear","fullscreen"];
|
||||||
// 试卷处用到的填空题新增按钮
|
// 试卷处用到的填空题新增按钮
|
||||||
if (__that.props.showNullButton) {
|
if (__that.props.showNullButton) {
|
||||||
icons.push('nullBtton')
|
icons.push('nullBtton')
|
||||||
|
@ -313,7 +313,7 @@ export default class TPMMDEditor extends Component {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div className={`df ${className} ${imageExpand && 'editormd-image-click-expand'}`} >
|
<div className={`df editormd-editing ${className} ${imageExpand && 'editormd-image-click-expand'}`} >
|
||||||
{/* padding10-20 */}
|
{/* padding10-20 */}
|
||||||
<div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{ ..._style }}>
|
<div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{ ..._style }}>
|
||||||
<textarea style={{ display: 'none' }} id={`mdEditors_${mdID}`} name="content"></textarea>
|
<textarea style={{ display: 'none' }} id={`mdEditors_${mdID}`} name="content"></textarea>
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'codemirror/lib/codemirror.css';
|
||||||
import './css/newquestion.css';
|
import './css/newquestion.css';
|
||||||
const $ = window.$
|
const $ = window.$
|
||||||
|
|
||||||
const mdIcons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "inline-latex", "latex", '|', "image", "table", '|', "line-break", "watch", "clear"];
|
const mdIcons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "inline-latex", "latex", '|', "image", "table", '|', "line-break", "watch", "clear","fullscreen"];
|
||||||
|
|
||||||
const NULL_CH = '▁';
|
const NULL_CH = '▁';
|
||||||
|
|
||||||
|
@ -289,7 +289,8 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
setEditorInstance(this)
|
setEditorInstance(this)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('editor_instance');
|
||||||
|
console.log(editor_instance);
|
||||||
|
|
||||||
}, [containerId, editorInstance, startInit])
|
}, [containerId, editorInstance, startInit])
|
||||||
|
|
||||||
|
@ -566,7 +567,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{atWhoVisible && atWhoList}
|
{atWhoVisible && atWhoList}
|
||||||
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'} `}>
|
<div ref={editorEl} className={`df editormd-editing ${className} ${imageExpand && 'editormd-image-click-expand'} `}>
|
||||||
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
|
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
|
||||||
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
|
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
|
||||||
<div className="CodeMirror cm-s-defualt"></div>
|
<div className="CodeMirror cm-s-defualt"></div>
|
||||||
|
|
Loading…
Reference in New Issue