diff --git a/package-lock.json b/package-lock.json index 71642d3f3..ec37523eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7245,7 +7245,8 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "optional": true }, "aproba": { "version": "1.2.0", @@ -7662,7 +7663,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7718,6 +7720,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7761,12 +7764,14 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "optional": true }, "yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "optional": true } } }, diff --git a/src/AppConfig.js b/src/AppConfig.js index f771b9eab..a55649ce0 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index c49f876c5..ea6dc4143 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -438,6 +438,7 @@ class Detail extends Component { .catch(error => { console.log(error); }); + !flag && this.props.showNpsModal("indexProject", 1); } // 点赞和取消点赞 @@ -456,6 +457,7 @@ class Detail extends Component { .catch(error => { console.log(error); }); + !flag && this.props.showNpsModal("indexProject", 2); } setWatchersCount = (count, is_watched) => { @@ -490,6 +492,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 @@ -665,7 +668,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 45fab93b8..8370ae0c2 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 955209c11..4a66bb314 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} />
欢迎使用跨平台代码同步
-欢迎使用跨平台代码同步服务
+