nps调研丰富选项、修复创建项目、issue未触发弹窗bug

This commit is contained in:
谢思 2025-01-23 10:29:38 +08:00
parent cab19f6a46
commit d3cb74b7f6
5 changed files with 46 additions and 25 deletions

View File

@ -59,7 +59,7 @@ function Details(props){
const permission = props && props.projectDetail && props.projectDetail.permission;
let colors = ["#1abcb1","#28be6c","#e67e22","#db3d1d"];
const {projectDetail , open_blockchain ,current_user } = props;
const {projectDetail , open_blockchain ,current_user, showNpsModal } = props;
useEffect(()=>{
if(pathname === `/${owner}/${projectsId}/issues/${index}/copy`){
setEdit(true);
@ -284,6 +284,7 @@ function Details(props){
setEdit(false);
//
setCommentReload(Math.random());
showNpsModal("submitIssue", 1);
}
}).catch(error=>{})
}else{
@ -310,6 +311,7 @@ function Details(props){
window.scrollTo(0,0);
props.showNotification("疑修复制成功!");
props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`);
showNpsModal("createIssue", 1);
}
}).catch(error=>{})
}

View File

@ -10,7 +10,7 @@ import axios from 'axios';
function New(props){
// history search
const {location:{search}, projectDetail} = props;
const {location:{search}, projectDetail, showNpsModal} = props;
const feedBack = search && search.indexOf('type=feedback') !== -1;
// id
const milepostId = props.match.params.milepostId;
@ -200,6 +200,7 @@ function New(props){
window.scrollTo(0,0);
props.showNotification("疑修创建成功!");
props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`);
showNpsModal("createIssue", 1);
}
}).catch(error=>{})
}

View File

@ -1,4 +1,4 @@
import { Button, Checkbox, Input, Modal } from 'antd';
import { Button, Checkbox, Divider, Input, Modal } from 'antd';
import axios from 'axios';
import React, { useState } from 'react';
@ -12,16 +12,20 @@ function NpmModal(props){
//
const [disabled, setDisabled] = useState(false);
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const list = [
"代码库基本功能", "疑修", "合并请求", "流水线引擎", "维基Wiki", "数据集", "特色专区", "BOT功能", "跨平台同步服务", "代码溯源及扫描服务", "开源软件健康度量服务", "HiAgent", "非常满意,没有需要吐槽的功能"
]
//
function submit(){
setDisabled(true);
axios.post(`/nps.json`,{
const params = {
action_type: npsActionType,
action_id: npsActionId,
score: activeGrade,
memo:`${checkGroupValue && checkGroupValue.length !== 0 ? checkGroupValue.toString() + "。" : ''}${inputValue ? inputValue : ''}`
}).then((response) => {
}
axios.post(`/nps.json`, params).then((response) => {
if (response.data) {
setVisible(false);
setSuccess(true);
@ -44,20 +48,21 @@ function NpmModal(props){
footer={(activeGrade || activeGrade === 0) ? <Button type='primary' style={{width:180}} onClick={submit} disabled={disabled}>提交</Button> : null}
>
<div className='mt40 font-18'>您向朋友或同事推荐GitLink平台的可能性有多大</div>
<div className='gradeBox font-16'>
<div className='mt30 font-16'>
<span>不可能</span>
{arr.map(item=>{return <span key={item} className={`oneGradeItem font-18 ml10 ${item<=5? 'grade1' : item<=8? 'grade2' : 'grade3'} ${item === activeGrade ? 'active' : ''}`} onClick={()=>{setActiveGrade(item)}}>{item}</span>})}
<span className='ml10'>极有可能</span>
</div>
{(activeGrade || activeGrade === 0) && <div>
<div className='font-16 mb15'>您觉得以下哪些我们可以做的更好选填</div>
{(activeGrade || activeGrade === 0) && <div className='npsContent'>
<Divider dashed/>
<div className='font-16 mb15'>选填你最想吐槽GitLink以下的哪个功能欢迎勾选下方想要吐槽的选项并留言</div>
<Checkbox.Group className='gradeCheckbox' onChange={(e)=>{setCheckGroupValue(e)}}>
<Checkbox value="期待更加丰富的功能">期待更加丰富的功能</Checkbox>
<Checkbox value="部分功能不会用,希望有新手引导">部分功能不会用希望有新手引导</Checkbox>
<Checkbox value="已有的功能模块,用户体验需进一步提升">已有的功能模块用户体验需进一步提升</Checkbox>
<Checkbox value="其他">其他</Checkbox>
{list.map(item=><Checkbox value={item}>{item}</Checkbox>)}
</Checkbox.Group>
<Input.TextArea placeholder='欢迎您填写宝贵建议(选填)' autoSize={{minRows: 6}} maxLength={500} className='gradeInput' onChange={(e)=>{setInputValue(e.target.value);}}/>
<div className='npsFeedBackBox'>
<Input.TextArea autoSize={{minRows: 6}} placeholder='欢迎您填写宝贵建议(选填)' className='gradeInput' maxLength={500} value={inputValue} onChange={(e)=>{setInputValue(e.target.value);}}/>
<span className='countNumBox'><span>{(inputValue && inputValue.length) || 0}</span>/500</span>
</div>
</div>}
</Modal>
<Modal

View File

@ -338,9 +338,9 @@ body>.-task-title {
font-size: 22px;
}
.npmModal .ant-modal-content, .npmSuccessModal .ant-modal-content{
background-image:linear-gradient(359.37deg,#ebf3ff 0%,#f1f6ff 21.88%,#c1ceff 100%);
background: linear-gradient( 359deg, #EBF3FF 0%, #F4F5FE 22%, #F2F4FF 82%, #D4DDFF 100%);
border:1.5px solid#ffffff;
min-height: 280px;
min-height: 230px;
}
.npmModal .ant-modal-body, .npmModal .ant-modal-footer, .npmSuccessModal .ant-modal-body, .npmSuccessModal .ant-modal-footer{
background-color: rgba(0, 0, 0, 0);
@ -351,9 +351,6 @@ body>.-task-title {
background-repeat: no-repeat;
color:#202d40;
}
.npmSuccessModal .ant-modal-content{
background-image:linear-gradient(359.37deg,#ebf3ff 0%,#f1f6ff 21.88%,#c1ceff 100%);
}
.npmSuccessModal .ant-modal-body{
background-image: url('../../images/nps2.png');
height: 300px;
@ -364,9 +361,6 @@ body>.-task-title {
text-align: center;
padding-bottom: 30px;
}
.gradeBox{
margin: 30px 0;
}
.oneGradeItem{
width:36px;
height:36px;
@ -381,11 +375,16 @@ body>.-task-title {
background-size: 100% 100%;
cursor: pointer;
}
.npmModal .gradeCheckbox{
display: flex;
flex-wrap: wrap;
}
.npmModal .gradeCheckbox .ant-checkbox-wrapper{
display: block;
margin: 0 0 15px 0;
font-size: 16px;
color: #3f4e64;
width: 50%;
}
.gradeInput{
background-color:rgba(255, 255, 255, 0.31) !important;
@ -417,3 +416,17 @@ body>.-task-title {
font-size: 25px;
color: white;
}
.npmModal{
.npsFeedBackBox{
position: relative;
background-color: white;
}
.countNumBox{
position: absolute;
bottom: 2px;
right: 10px;
span{
color: #466AFF;
}
}
}

View File

@ -259,9 +259,9 @@ export function TPMIndexHOC(WrappedComponent) {
npsActionType:type,
npsActionId: index
})
setTimeout(() => {
const {current_user} = this.state;
current_user && current_user.nps && setTimeout(() => {
this.setState({npsModalVisible: true})
current_user && current_user.nps && this.setState({npsModalVisible: true})
}, 500)
}