意见反馈功能+未登录状态显示创建issue按钮

This commit is contained in:
谢思 2021-11-17 14:03:10 +08:00
parent 12ce0aa4f5
commit 387387108a
7 changed files with 115 additions and 40 deletions

View File

@ -74,23 +74,14 @@ function SiderBar() {
</div> </div>
} }
//意见反馈
function feedback(){
console.log('login',login);
if(login){//登录状态
window.location.href= `/jasder/forgeplus/issues/new`;
}else{
//未登录状态跳转到登录页面
window.location.href = `/login`;
}
}
return ( return (
<div className={"-task-sidebar"} > <div className={"-task-sidebar"} >
{/* 平台反馈 */} {/* 平台反馈 */}
<Tooltip title="意见反馈" placement={"left"} overlayClassName="tooltipBox" onClick={feedback}> <Tooltip title="意见反馈" placement={"left"} overlayClassName="tooltipBox">
<div className="consult"> <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> </div>
</Tooltip> </Tooltip>

View File

@ -23,6 +23,7 @@ import Nodata from '../Nodata';
import Invite from './sub/Invite'; import Invite from './sub/Invite';
import CheckProfile from '../Component/ProfileModal/Profile'; import CheckProfile from '../Component/ProfileModal/Profile';
import RenderHtml from '../../components/render-html'; import RenderHtml from '../../components/render-html';
import LoginDialog from '../../modules/login/LoginDialog'
/** /**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能) * projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/ */
@ -69,6 +70,7 @@ function CoderDepot(props){
const [ pullsFlag , setPullsFlag ] = useState(true); const [ pullsFlag , setPullsFlag ] = useState(true);
const [ issuesFlag , setIssuesFlag ] = useState(true); const [ issuesFlag , setIssuesFlag ] = useState(true);
const [ releaseVersions , setReleaseVersions] = useState(undefined); const [ releaseVersions , setReleaseVersions] = useState(undefined);
const [ isRender , setIsRender] = useState(false);//
const owner = props.match.params.owner; const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId; 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; let n = fileInfo && fileInfo.name;
const mdFlag = n && n.substring(n.length-3,n.length) === ".md"; const mdFlag = n && n.substring(n.length-3,n.length) === ".md";
@ -347,6 +363,12 @@ function CoderDepot(props){
return( return(
<WhiteBack> <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}/> <UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
{ {
@ -422,16 +444,16 @@ function CoderDepot(props){
</AlignCenter> </AlignCenter>
<AlignCenter className="depotBtn"> <AlignCenter className="depotBtn">
{ {
(baseOperate || baseOper) &&
<div className="addOptionBtn"> <div className="addOptionBtn">
{ {
baseOperate && baseOperate &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile> <CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile>
} }
{ <a onClick={createIssue}>+ 易修</a>
{/* {
baseOper && baseOper &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 易修</CheckProfile> <CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 易修</CheckProfile>
} } */}
</div> </div>
} }
{ fileOperate && { fileOperate &&

View File

@ -2,9 +2,23 @@
import React, { Component } from "react"; import React, { Component } from "react";
import OrderForm from './order_form' import OrderForm from './order_form'
class New extends Component { 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() { render() {
return ( return (
<OrderForm form_type="new" {...this.props}></OrderForm> <OrderForm form_type={this.state.type ? this.state.type : "new"} {...this.props}></OrderForm>
) )
} }
} }

View File

@ -7,6 +7,7 @@ import moment from 'moment';
import NoneData from "../Nodata"; import NoneData from "../Nodata";
import OrderItem from "./OrderItem"; import OrderItem from "./OrderItem";
import CheckProfile from '../Component/ProfileModal/Profile'; import CheckProfile from '../Component/ProfileModal/Profile';
import LoginDialog from '../../modules/login/LoginDialog';
import axios from "axios"; import axios from "axios";
@ -72,6 +73,7 @@ class order extends Component {
page: 1, page: 1,
limit: 15, limit: 15,
}, },
isRender:false,//是否显示登录弹框
}; };
} }
@ -346,18 +348,29 @@ class order extends Component {
islogin=()=>{ islogin=()=>{
this.props.showLoginDialog(); this.props.showLoginDialog();
} }
renderNew =()=>{
createIssue = () => {
const { data } = this.state; const { data } = this.state;
const { projectsId , owner } = this.props.match.params;
if(data && data.user_admin_or_member){ if(data && data.user_admin_or_member){
const { projectsId , owner } = this.props.match.params; window.open(`/${owner}/${projectsId}/issues/new`,'_blank')
return( }else{
<CheckProfile {...this.props} className="topWrapper_btn ml10" sureFunc={()=>{window.open(`/${owner}/${projectsId}/issues/new`,'_blank')}}> console.log('aaa');
+&nbsp;创建易修 this.setState({
</CheckProfile> isRender:true,
) })
} }
} }
renderNew =()=>{
return(
// <CheckProfile {...this.props} className="topWrapper_btn ml10" sureoncFunc={()=>{createIssue()}}>
// +&nbsp;创建易修
// </CheckProfile>
<a className="topWrapper_btn ml10" onClick={this.createIssue}>+&nbsp;创建易修</a>
)
}
// 修改开始时间 // 修改开始时间
changeBeginTime = (data, value) => { changeBeginTime = (data, value) => {
const { status_type } = this.state; const { status_type } = this.state;
@ -507,8 +520,16 @@ class order extends Component {
</Menu> </Menu>
); );
//修改登录方法
Modifyloginvalue = () => {
this.setState({
isRender: false,
})
}
render() { render() {
const { current_user } = this.props; const { current_user } = this.props;
const { projectsId , owner } = this.props.match.params;
const { const {
issue_chosen, issue_chosen,
issues, issues,
@ -525,6 +546,12 @@ class order extends Component {
return ( return (
<div className="main" style={{padding:"0px"}}> <div className="main" style={{padding:"0px"}}>
<div style={{padding:"10px 20px 0px 20px"}}> <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" }}> <div className="topWrapper" style={{ paddingTop: "10px" }}>
<ul className="topWrapper_type"> <ul className="topWrapper_type">
<li> <li>

View File

@ -99,7 +99,22 @@ class order_form extends Component {
isSpin:false 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(); this.get_detail();
}else{ }else{
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
@ -310,7 +325,7 @@ class order_form extends Component {
<div className="list-right"> <div className="list-right">
<div className="pd20"> <div className="pd20">
<h3 className="mb15"> <h3 className="mb15">
{form_type === "new" ? "新建" :( form_type === "copy" ? "复制" : "编辑")}易修 {form_type === "edit" ? "编辑" :( form_type === "copy" ? "复制" : "新建")}易修
</h3> </h3>
<Form.Item> <Form.Item>
{getFieldDecorator("subject", { {getFieldDecorator("subject", {
@ -363,14 +378,14 @@ class order_form extends Component {
onClick={this.handleSubmit} onClick={this.handleSubmit}
> >
<span className="plr10"> <span className="plr10">
{form_type === "new" ? "创建" : "提交"} {form_type === "new" || form_type === "feedback" ? "创建" : "提交"}
</span> </span>
</Button> </Button>
<Button <Button
type="default" type="default"
className="ml30" className="ml30"
onClick={()=> 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> <span className="plr10">取消</span>
</Button> </Button>

View File

@ -102,7 +102,8 @@ class LoginDialog extends Component {
Phonenumberisnotco: undefined, Phonenumberisnotco: undefined,
Phonenumberisnotcobool: false, Phonenumberisnotcobool: false,
weixinlogin: false, weixinlogin: false,
qqlogin: false qqlogin: false,
settings:undefined,
}; };
} }
enter = (num) => { enter = (num) => {
@ -324,7 +325,9 @@ class LoginDialog extends Component {
//true为PC端false为手机端 //true为PC端false为手机端
let flag = this.IsPC(); let flag = this.IsPC();
this.setState({ this.setState({
isphone: flag isphone: flag,
//查询第三方登录信息
settings: JSON.parse(localStorage.getItem("chromesetting")),
}) })
if (this.props.isRender != undefined) { if (this.props.isRender != undefined) {
@ -393,7 +396,8 @@ class LoginDialog extends Component {
isRender: false isRender: false
}) })
this.props.Modifyloginvalue(response.data); 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) => { }).catch((error) => {
console.log(error) console.log(error)
@ -454,8 +458,7 @@ class LoginDialog extends Component {
} }
render() { render() {
let { login, isGoing, isGoingValue, disabled , Phonenumberisnotco , dialogBox, isRender, weixinlogin } = this.state; let { login, isGoing, isGoingValue, disabled , Phonenumberisnotco , dialogBox, isRender, weixinlogin, settings } = this.state;
let { settings } = this.props;
if (isRender === undefined) { if (isRender === undefined) {
isRender = false isRender = false

View File

@ -9,18 +9,15 @@ import './LoginRegisterPage.scss';
function Login(props){ function Login(props){
const [message,setMessage] = useState(); const [message,setMessage] = useState();
const [setting, setSetting] = useState(undefined); const [setting, setSetting] = useState(undefined);
const {form} = props; const {form, location} = props;
const {getFieldDecorator } = form; const {getFieldDecorator } = form;
const {search} = location;
useEffect(()=>{ useEffect(()=>{
//DOMvalue //DOMvalue
clear; clear;
//settings.json //
axios.get(`/setting.json`).then((response) => { setSetting(JSON.parse(localStorage.getItem("chromesetting")));
if (response && response.data) {
setSetting(response.data.setting);
}
})
},[]) },[])
// //
@ -37,6 +34,12 @@ function Login(props){
} else { } else {
// //
cookie.save('autologin',values.remember); 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; window.location.href = "/"+response.data.login;
} }
}).catch((error) => { }).catch((error) => {