forked from Gitlink/forgeplus-react
意见反馈功能+未登录状态显示创建issue按钮
This commit is contained in:
parent
12ce0aa4f5
commit
387387108a
|
@ -74,23 +74,14 @@ function SiderBar() {
|
|||
</div>
|
||||
}
|
||||
|
||||
//意见反馈
|
||||
function feedback(){
|
||||
console.log('login',login);
|
||||
if(login){//登录状态
|
||||
window.location.href= `/jasder/forgeplus/issues/new`;
|
||||
}else{
|
||||
//未登录状态跳转到登录页面
|
||||
window.location.href = `/login`;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={"-task-sidebar"} >
|
||||
{/* 平台反馈 */}
|
||||
<Tooltip title="意见反馈" placement={"left"} overlayClassName="tooltipBox" onClick={feedback}>
|
||||
<Tooltip title="意见反馈" placement={"left"} overlayClassName="tooltipBox">
|
||||
<div className="consult">
|
||||
<i className="iconfont icon-yijianfankui2"></i>
|
||||
<a href={login ? `/jasder/forgeplus/issues/new?type=feedback`:`/login?go_page=/jasder/forgeplus/issues/new`}>
|
||||
<i className="iconfont icon-yijianfankui2"></i>
|
||||
</a>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import Nodata from '../Nodata';
|
|||
import Invite from './sub/Invite';
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
import RenderHtml from '../../components/render-html';
|
||||
import LoginDialog from '../../modules/login/LoginDialog'
|
||||
/**
|
||||
* projectDetail.type:0是托管项目,1是镜像项目,2是同步镜像项目(为2时不支持在线创建、在线上传、在线修改、在线删除、创建合并请求等功能)
|
||||
*/
|
||||
|
@ -69,6 +70,7 @@ function CoderDepot(props){
|
|||
const [ pullsFlag , setPullsFlag ] = useState(true);
|
||||
const [ issuesFlag , setIssuesFlag ] = useState(true);
|
||||
const [ releaseVersions , setReleaseVersions] = useState(undefined);
|
||||
const [ isRender , setIsRender] = useState(false);//是否显示登录弹框
|
||||
|
||||
const owner = props.match.params.owner;
|
||||
const projectsId = props.match.params.projectsId;
|
||||
|
@ -337,6 +339,20 @@ function CoderDepot(props){
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
//修改登录方法
|
||||
function Modifyloginvalue(){
|
||||
setIsRender(false);
|
||||
}
|
||||
|
||||
function createIssue(){
|
||||
if(baseOper){
|
||||
window.open(`/${owner}/${projectsId}/issues/new`,'_blank')
|
||||
}else{
|
||||
setIsRender(true);
|
||||
}
|
||||
}
|
||||
|
||||
let n = fileInfo && fileInfo.name;
|
||||
const mdFlag = n && n.substring(n.length-3,n.length) === ".md";
|
||||
|
||||
|
@ -347,6 +363,12 @@ function CoderDepot(props){
|
|||
|
||||
return(
|
||||
<WhiteBack>
|
||||
{isRender && <LoginDialog
|
||||
{...props}
|
||||
isRender={isRender}
|
||||
Modifyloginvalue={Modifyloginvalue}
|
||||
goPage={`/${owner}/${projectsId}/issues/new`}
|
||||
/>}
|
||||
<UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
|
||||
<Spin spinning={isSpin}>
|
||||
{
|
||||
|
@ -422,16 +444,16 @@ function CoderDepot(props){
|
|||
</AlignCenter>
|
||||
<AlignCenter className="depotBtn">
|
||||
{
|
||||
(baseOperate || baseOper) &&
|
||||
<div className="addOptionBtn">
|
||||
{
|
||||
baseOperate &&
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile>
|
||||
}
|
||||
{
|
||||
<a onClick={createIssue}>+ 易修</a>
|
||||
{/* {
|
||||
baseOper &&
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 易修</CheckProfile>
|
||||
}
|
||||
} */}
|
||||
</div>
|
||||
}
|
||||
{ fileOperate &&
|
||||
|
|
|
@ -2,9 +2,23 @@
|
|||
import React, { Component } from "react";
|
||||
import OrderForm from './order_form'
|
||||
class New extends Component {
|
||||
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
type : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
const searchParams = new URLSearchParams(this.props.location.search.substring(1));
|
||||
this.setState({
|
||||
type : searchParams.get("type"),
|
||||
})
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<OrderForm form_type="new" {...this.props}></OrderForm>
|
||||
<OrderForm form_type={this.state.type ? this.state.type : "new"} {...this.props}></OrderForm>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import moment from 'moment';
|
|||
import NoneData from "../Nodata";
|
||||
import OrderItem from "./OrderItem";
|
||||
import CheckProfile from '../Component/ProfileModal/Profile';
|
||||
import LoginDialog from '../../modules/login/LoginDialog';
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
|
@ -72,6 +73,7 @@ class order extends Component {
|
|||
page: 1,
|
||||
limit: 15,
|
||||
},
|
||||
isRender:false,//是否显示登录弹框
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -346,18 +348,29 @@ class order extends Component {
|
|||
islogin=()=>{
|
||||
this.props.showLoginDialog();
|
||||
}
|
||||
renderNew =()=>{
|
||||
|
||||
createIssue = () => {
|
||||
const { data } = this.state;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
if(data && data.user_admin_or_member){
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
return(
|
||||
<CheckProfile {...this.props} className="topWrapper_btn ml10" sureFunc={()=>{window.open(`/${owner}/${projectsId}/issues/new`,'_blank')}}>
|
||||
+ 创建易修
|
||||
</CheckProfile>
|
||||
)
|
||||
window.open(`/${owner}/${projectsId}/issues/new`,'_blank')
|
||||
}else{
|
||||
console.log('aaa');
|
||||
this.setState({
|
||||
isRender:true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
renderNew =()=>{
|
||||
return(
|
||||
// <CheckProfile {...this.props} className="topWrapper_btn ml10" sureoncFunc={()=>{createIssue()}}>
|
||||
// + 创建易修
|
||||
// </CheckProfile>
|
||||
<a className="topWrapper_btn ml10" onClick={this.createIssue}>+ 创建易修</a>
|
||||
)
|
||||
}
|
||||
|
||||
// 修改开始时间
|
||||
changeBeginTime = (data, value) => {
|
||||
const { status_type } = this.state;
|
||||
|
@ -507,8 +520,16 @@ class order extends Component {
|
|||
</Menu>
|
||||
);
|
||||
|
||||
//修改登录方法
|
||||
Modifyloginvalue = () => {
|
||||
this.setState({
|
||||
isRender: false,
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { current_user } = this.props;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const {
|
||||
issue_chosen,
|
||||
issues,
|
||||
|
@ -525,6 +546,12 @@ class order extends Component {
|
|||
return (
|
||||
<div className="main" style={{padding:"0px"}}>
|
||||
<div style={{padding:"10px 20px 0px 20px"}}>
|
||||
{this.state.isRender && <LoginDialog
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
Modifyloginvalue={() => this.Modifyloginvalue()}
|
||||
goPage={`/${owner}/${projectsId}/issues/new`}
|
||||
/>}
|
||||
<div className="topWrapper" style={{ paddingTop: "10px" }}>
|
||||
<ul className="topWrapper_type">
|
||||
<li>
|
||||
|
|
|
@ -99,7 +99,22 @@ class order_form extends Component {
|
|||
isSpin:false
|
||||
});
|
||||
|
||||
if(this.props.form_type !== "new"){
|
||||
if(this.props.form_type === "feedback"){
|
||||
let data ={
|
||||
//指派给段甲生,类型:缺陷,优先度:正常,issue状态:新增
|
||||
tracker_id: "1",
|
||||
assigned_to_id: "36480",
|
||||
priority_id: "2",
|
||||
status_id: "1",
|
||||
description:"####问题描述\n\n\n####重现问题步骤\n\n\n####截图\n\n\n####建议解决办法\n",
|
||||
}
|
||||
this.setState({ ...data });
|
||||
this.props.form.setFieldsValue({
|
||||
...this.state,
|
||||
fixed_version_id: milepostId || ""
|
||||
});
|
||||
|
||||
}else if(this.props.form_type !== "new"){
|
||||
this.get_detail();
|
||||
}else{
|
||||
this.props.form.setFieldsValue({
|
||||
|
@ -310,7 +325,7 @@ class order_form extends Component {
|
|||
<div className="list-right">
|
||||
<div className="pd20">
|
||||
<h3 className="mb15">
|
||||
{form_type === "new" ? "新建" :( form_type === "copy" ? "复制" : "编辑")}易修
|
||||
{form_type === "edit" ? "编辑" :( form_type === "copy" ? "复制" : "新建")}易修
|
||||
</h3>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("subject", {
|
||||
|
@ -363,14 +378,14 @@ class order_form extends Component {
|
|||
onClick={this.handleSubmit}
|
||||
>
|
||||
<span className="plr10">
|
||||
{form_type === "new" ? "创建" : "提交"}
|
||||
{form_type === "new" || form_type === "feedback" ? "创建" : "提交"}
|
||||
</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="default"
|
||||
className="ml30"
|
||||
onClick={()=>
|
||||
this.props.history.push(form_type === "new" ? `/${owner}/${projectsId || orderId}/issues` : `/${owner}/${projectsId}/issues/${orderId}`)}
|
||||
this.props.history.push(form_type === "new" || form_type === "feedback" ? `/${owner}/${projectsId || orderId}/issues` : `/${owner}/${projectsId}/issues/${orderId}`)}
|
||||
>
|
||||
<span className="plr10">取消</span>
|
||||
</Button>
|
||||
|
|
|
@ -102,7 +102,8 @@ class LoginDialog extends Component {
|
|||
Phonenumberisnotco: undefined,
|
||||
Phonenumberisnotcobool: false,
|
||||
weixinlogin: false,
|
||||
qqlogin: false
|
||||
qqlogin: false,
|
||||
settings:undefined,
|
||||
};
|
||||
}
|
||||
enter = (num) => {
|
||||
|
@ -324,7 +325,9 @@ class LoginDialog extends Component {
|
|||
//true为PC端,false为手机端
|
||||
let flag = this.IsPC();
|
||||
this.setState({
|
||||
isphone: flag
|
||||
isphone: flag,
|
||||
//查询第三方登录信息
|
||||
settings: JSON.parse(localStorage.getItem("chromesetting")),
|
||||
})
|
||||
|
||||
if (this.props.isRender != undefined) {
|
||||
|
@ -393,7 +396,8 @@ class LoginDialog extends Component {
|
|||
isRender: false
|
||||
})
|
||||
this.props.Modifyloginvalue(response.data);
|
||||
window.location.reload();
|
||||
this.props.goPage ? window.location.href = this.props.goPage : window.location.reload()
|
||||
// window.location.reload();
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
|
@ -454,8 +458,7 @@ class LoginDialog extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { login, isGoing, isGoingValue, disabled , Phonenumberisnotco , dialogBox, isRender, weixinlogin } = this.state;
|
||||
let { settings } = this.props;
|
||||
let { login, isGoing, isGoingValue, disabled , Phonenumberisnotco , dialogBox, isRender, weixinlogin, settings } = this.state;
|
||||
|
||||
if (isRender === undefined) {
|
||||
isRender = false
|
||||
|
|
|
@ -9,18 +9,15 @@ import './LoginRegisterPage.scss';
|
|||
function Login(props){
|
||||
const [message,setMessage] = useState();
|
||||
const [setting, setSetting] = useState(undefined);
|
||||
const {form} = props;
|
||||
const {form, location} = props;
|
||||
const {getFieldDecorator } = form;
|
||||
const {search} = location;
|
||||
|
||||
useEffect(()=>{
|
||||
//控制密码输入框在DOM不可见value
|
||||
clear;
|
||||
//请求settings.json接口获取第三方登录平台信息
|
||||
axios.get(`/setting.json`).then((response) => {
|
||||
if (response && response.data) {
|
||||
setSetting(response.data.setting);
|
||||
}
|
||||
})
|
||||
//获取第三方登录平台信息
|
||||
setSetting(JSON.parse(localStorage.getItem("chromesetting")));
|
||||
},[])
|
||||
|
||||
// 登录表单提交
|
||||
|
@ -37,6 +34,12 @@ function Login(props){
|
|||
} else {
|
||||
//判断用户是否选择【下次自动登录】
|
||||
cookie.save('autologin',values.remember);
|
||||
if(search){
|
||||
const searchParams = new URLSearchParams(search.substring(1));
|
||||
const goPage = searchParams.get("go_page");
|
||||
goPage && (window.location.href = goPage+'?type=feedback');
|
||||
return;
|
||||
}
|
||||
window.location.href = "/"+response.data.login;
|
||||
}
|
||||
}).catch((error) => {
|
||||
|
|
Loading…
Reference in New Issue