diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index a34e8a511..5e78a465c 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -442,6 +442,7 @@ class Detail extends Component { .catch(error => { console.log(error); }); + !flag && this.props.showNpsModal("indexProject", 1); } // 点赞和取消点赞 @@ -460,6 +461,7 @@ class Detail extends Component { .catch(error => { console.log(error); }); + !flag && this.props.showNpsModal("indexProject", 2); } setWatchersCount = (count, is_watched) => { @@ -494,6 +496,7 @@ class Detail extends Component { } this.props.history.push(`/${current_user && current_user.login}/${result.data.identifier}`); this.props.showNotification(result.data.message); + this.props.showNpsModal("indexProject", 3); } this.setState({ forkSpin: false @@ -669,7 +672,7 @@ class Detail extends Component { urlFlag={urlFlag} showNotification={this.props.showNotification} current_user={current_user} - isManager={isManager} + showNpsModal={this.props.showNpsModal} /> } diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx index 679f7aacb..9ef750918 100644 --- a/src/forge/Main/sub/DetailBanner.jsx +++ b/src/forge/Main/sub/DetailBanner.jsx @@ -5,9 +5,18 @@ import { numFormat } from 'educoder'; import QuitBox from './quit'; import axios from 'axios'; -function DetailBanner({ history,list , owner , projectsId ,showNotification , url , pathname , state , urlFlag , projectDetail , platform ,open_devops ,current_user, isManager }){ +function DetailBanner({ history,list , owner , projectsId ,showNotification , url , pathname , state , urlFlag , projectDetail , platform ,open_devops ,current_user, showNpsModal }){ const [ menuName , setMenuName ] = useState(undefined); const [ visible , setVisible ] = useState(false); + + useEffect(()=>{ + const {location} = history; + const {query} = location; + if(query && query.showNps){ + showNpsModal("createProject", 1); + } + },[]) + useEffect(()=>{ if(Array.isArray(list)){ // 没有资源库banner但是通过连接进资源库页面时 diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 8fa5e3b55..e8bca6ada 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -50,6 +50,12 @@ class MessageCount extends Component { this.getDetail(); // this.clickBody(); + // 监听路由query传参,实现nps调研效果 + const {location, showNpsModal} = this.props; + const {query} = location; + if(query && query.showNps){ + showNpsModal("createPullRequest", 1); + } }; bindFootRef = (footRef) => { @@ -119,6 +125,7 @@ class MessageCount extends Component { }); console.log(error); }); + this.props.showNpsModal("auditPullRequest", 2); }; //合并请求 @@ -157,6 +164,7 @@ class MessageCount extends Component { }); console.log(error); }); + this.props.showNpsModal("auditPullRequest", 1); }; changtitlepr = (e) => { diff --git a/src/forge/Merge/merge_form.js b/src/forge/Merge/merge_form.js index b02b9a049..130e93bf9 100644 --- a/src/forge/Merge/merge_form.js +++ b/src/forge/Merge/merge_form.js @@ -168,7 +168,7 @@ class MergeForm extends Component { isSpin: false, }); const { pull_request_number } = result.data; - this.props.history.push(`/${owner}/${projectsId}/pulls/${pull_request_number}`); + this.props.history.push({pathname: `/${owner}/${projectsId}/pulls/${pull_request_number}`, query:{showNps: true}}); const { getDetail } = this.props; getDetail && getDetail(); } else { @@ -197,9 +197,8 @@ class MergeForm extends Component { this.setState({ isSpin: false, }); - this.props.history.push( - `/${owner}/${projectsId}/pulls/${mergeId}` - ); + // , query:{showNps: true} + this.props.history.push({pathname: `/${owner}/${projectsId}/pulls/${mergeId}`}); } else { this.setState({ isSpin: false, diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 0898683f5..4e1fb100a 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -187,7 +187,6 @@ class Index extends Component { subMitFrom = () => { this.props.form.validateFieldsAndScroll((err, values) => { - console.log(values); if (!err) { this.setState({ isSpin: true @@ -212,7 +211,7 @@ class Index extends Component { }).then((result) => { if (result && result.data.id) { projectsType && projectsType !== "mirror" && this.props.showNotification(`项目创建成功!`); - this.props.history.push(`/${result.data.login}/${result.data.identifier}`); + this.props.history.push({pathname: `/${result.data.login}/${result.data.identifier}`, query:{showNps: true}}); } this.setState({ isSpin: false diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index a3452c348..3cb3f07f2 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -212,6 +212,7 @@ class order_form extends Component { this.props.history.push(`/${owner}/${projectsId}/issues/${result.data.id}`); const { getDetail } = this.props; getDetail && getDetail(); + this.props.showNpsModal("createIssue", 1); } this.setState({ isSpin: false, @@ -238,6 +239,7 @@ class order_form extends Component { this.props.showNotification("任务更新成功!"); const { getDetail } = this.props; getDetail && getDetail(); + this.props.showNpsModal("submitIssue", 1); } this.setState({ isSpin: false diff --git a/src/forge/Server/data.jsx b/src/forge/Server/data.jsx index fc6a87b4b..d0680e5e4 100644 --- a/src/forge/Server/data.jsx +++ b/src/forge/Server/data.jsx @@ -162,7 +162,7 @@ function Data(props) { repeatBranch={repeatBranch} />
欢迎使用跨平台代码同步
-欢迎使用跨平台代码同步服务
+