Compare commits

...

30 Commits

Author SHA1 Message Date
baladiwei ca9a606e53 Merge pull request 'pre-release merge' (#29) from pre_develop_dev into pre_develop 2021-08-30 10:26:54 +08:00
baladiwei 8adf7f8de6 Merge pull request '优化日期显示' (#31) from tongChong/forgeplus-react:pre_develop_dev into pre_develop_dev 2021-08-27 16:33:43 +08:00
何童崇 349c2a6f35 修改返回日期的显示 2021-08-27 16:31:15 +08:00
baladiwei f096d6db6e Merge pull request '注释资源库,wiki修改显示' (#30) from tongChong/forgeplus-react:pre_develop_dev into pre_develop_dev 2021-08-27 16:10:00 +08:00
何童崇 492e8e067f 注释资源库,wiki修改显示 2021-08-27 16:07:21 +08:00
baladiwei 95ae2bbd46 Merge pull request '组织团队权限-测试通过版' (#28) from caishi/forgeplus-react:pre_develop into pre_develop_dev 2021-08-27 15:01:47 +08:00
caishi a1b5395b8c 合并请求-判断条件改成user_admin_or_member 2021-08-27 14:04:27 +08:00
caishi dee7b23f3e 转移到组织-提示文案 2021-08-27 11:44:41 +08:00
caishi f7dd67d41a merge 2021-08-27 10:54:55 +08:00
caishi e7fd980116 组织团队权限 2021-08-27 10:53:00 +08:00
caishi d8ab7c0759 权限问题测试版-第二版 2021-08-26 17:38:56 +08:00
caishi d64eb738f7 团队权限分支 2021-08-26 17:38:56 +08:00
jasder 55080f93c1 Merge pull request '镜像问题websocket失败兼容' (#27) from tongChong/forgeplus-react:hotfix_websocket into pre_develop_dev 2021-08-26 17:35:00 +08:00
caishi 7851785335 团队权限分支 2021-08-25 14:25:35 +08:00
何童崇 52e08e77e5 修改websocket问题 2021-08-25 11:52:52 +08:00
baladiwei fcac8c782a Merge pull request '组织团队(新增和设置)权限' (#21) from caishi/forgeplus-react:pre_develop into pre_develop_dev 2021-08-25 11:03:30 +08:00
caishi 061fa0ee71 组织团队设置:增加可选访问单元wiki 2021-08-24 16:25:55 +08:00
caishi 5d465ec782 组织团队设置:可以设置版本库权限,允许设置访问项目单元 2021-08-24 16:25:47 +08:00
baladiwei 39fef1ce3c Merge pull request '修改头像的bug,提取copyUrl组件,优化函数式模态框组件' (#20) from tongChong/forgeplus-react:feature_wikis into pre_develop_dev 2021-08-23 11:47:44 +08:00
何童崇 d1a3c7b9c3 优化删除函数组件 2021-08-23 09:41:57 +08:00
何童崇 ba263a28f1 修改头像,增加复制toolTip组件,优化组件代码 2021-08-20 14:45:16 +08:00
jasder fb872f3a3d change request url 2021-08-20 09:06:57 +08:00
何童崇 19ef012a0e 修改指向路径 2021-08-20 09:01:40 +08:00
jasder b3d62b9cf1 FIX bug 2021-08-19 21:54:56 +08:00
何童崇 d988c4ea5f 兼容页面刷新时的id新增 2021-08-19 21:23:48 +08:00
caishi 313f1edc71 镜像问题websocket传值
镜像问题websocket传值
2021-08-19 17:44:13 +08:00
caishi 8adc662e9b wiki功能分支合并
wiki功能分支合并
2021-08-19 17:31:36 +08:00
何童崇 ff75065a0a 新增wiki模块 2021-08-19 17:21:18 +08:00
何童崇 6e74f88d9e 紧急修复镜像bug 2021-08-19 10:40:44 +08:00
caishi 3294d99516 href 2021-08-09 11:03:49 +08:00
47 changed files with 2943 additions and 621 deletions

54
package-lock.json generated
View File

@ -1273,7 +1273,7 @@
}, },
"babel-cli": { "babel-cli": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-cli/download/babel-cli-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz",
"integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", "integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1296,7 +1296,7 @@
"dependencies": { "dependencies": {
"chokidar": { "chokidar": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npm.taobao.org/chokidar/download/chokidar-1.7.0.tgz?cache=0&sync_timestamp=1602585438968&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchokidar%2Fdownload%2Fchokidar-1.7.0.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz",
"integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -1314,7 +1314,7 @@
}, },
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true "dev": true
} }
@ -1413,7 +1413,7 @@
}, },
"babel-helper-bindify-decorators": { "babel-helper-bindify-decorators": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-helper-bindify-decorators/download/babel-helper-bindify-decorators-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz",
"integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1476,7 +1476,7 @@
}, },
"babel-helper-explode-class": { "babel-helper-explode-class": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-helper-explode-class/download/babel-helper-explode-class-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz",
"integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1676,7 +1676,7 @@
}, },
"babel-plugin-syntax-async-generators": { "babel-plugin-syntax-async-generators": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "https://registry.npm.taobao.org/babel-plugin-syntax-async-generators/download/babel-plugin-syntax-async-generators-6.13.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz",
"integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=",
"dev": true "dev": true
}, },
@ -1687,7 +1687,7 @@
}, },
"babel-plugin-syntax-decorators": { "babel-plugin-syntax-decorators": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "https://registry.npm.taobao.org/babel-plugin-syntax-decorators/download/babel-plugin-syntax-decorators-6.13.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz",
"integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=",
"dev": true "dev": true
}, },
@ -1723,7 +1723,7 @@
}, },
"babel-plugin-transform-async-generator-functions": { "babel-plugin-transform-async-generator-functions": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-plugin-transform-async-generator-functions/download/babel-plugin-transform-async-generator-functions-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz",
"integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1755,7 +1755,7 @@
}, },
"babel-plugin-transform-decorators": { "babel-plugin-transform-decorators": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-plugin-transform-decorators/download/babel-plugin-transform-decorators-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz",
"integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -2060,7 +2060,7 @@
}, },
"babel-plugin-transform-runtime": { "babel-plugin-transform-runtime": {
"version": "6.23.0", "version": "6.23.0",
"resolved": "https://registry.npm.taobao.org/babel-plugin-transform-runtime/download/babel-plugin-transform-runtime-6.23.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz",
"integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=", "integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=",
"requires": { "requires": {
"babel-runtime": "^6.22.0" "babel-runtime": "^6.22.0"
@ -2077,7 +2077,7 @@
}, },
"babel-polyfill": { "babel-polyfill": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-polyfill/download/babel-polyfill-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"requires": { "requires": {
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
@ -2087,7 +2087,7 @@
"dependencies": { "dependencies": {
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.10.5", "version": "0.10.5",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.10.5.tgz?cache=0&sync_timestamp=1595456367497&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.10.5.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=" "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
} }
} }
@ -2131,7 +2131,7 @@
}, },
"babel-preset-es2015": { "babel-preset-es2015": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-preset-es2015/download/babel-preset-es2015-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
"integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -2179,7 +2179,7 @@
}, },
"babel-preset-react": { "babel-preset-react": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-preset-react/download/babel-preset-react-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.24.1.tgz",
"integrity": "sha1-umnfrqRfw+xjm2pOzqbhdwLJE4A=", "integrity": "sha1-umnfrqRfw+xjm2pOzqbhdwLJE4A=",
"requires": { "requires": {
"babel-plugin-syntax-jsx": "^6.3.13", "babel-plugin-syntax-jsx": "^6.3.13",
@ -2212,7 +2212,7 @@
}, },
"babel-preset-stage-2": { "babel-preset-stage-2": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-preset-stage-2/download/babel-preset-stage-2-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz",
"integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -2224,7 +2224,7 @@
}, },
"babel-preset-stage-3": { "babel-preset-stage-3": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npm.taobao.org/babel-preset-stage-3/download/babel-preset-stage-3-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz",
"integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -3507,7 +3507,7 @@
}, },
"code-prettify": { "code-prettify": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npm.taobao.org/code-prettify/download/code-prettify-0.1.0.tgz", "resolved": "https://registry.npmjs.org/code-prettify/-/code-prettify-0.1.0.tgz",
"integrity": "sha1-RocMyMGlDQm61TmzOpg9vUqjSx4=" "integrity": "sha1-RocMyMGlDQm61TmzOpg9vUqjSx4="
}, },
"codemirror": { "codemirror": {
@ -4885,7 +4885,7 @@
}, },
"dom-closest": { "dom-closest": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npm.taobao.org/dom-closest/download/dom-closest-0.2.0.tgz", "resolved": "https://registry.npmjs.org/dom-closest/-/dom-closest-0.2.0.tgz",
"integrity": "sha1-69n5HRvyLo1vR3h2u80+yQIWwM8=", "integrity": "sha1-69n5HRvyLo1vR3h2u80+yQIWwM8=",
"requires": { "requires": {
"dom-matches": ">=1.0.1" "dom-matches": ">=1.0.1"
@ -4929,7 +4929,7 @@
}, },
"dom-matches": { "dom-matches": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/dom-matches/download/dom-matches-2.0.0.tgz", "resolved": "https://registry.npmjs.org/dom-matches/-/dom-matches-2.0.0.tgz",
"integrity": "sha1-0nKLQWqHUzmA6wibhI0lPPI6dYw=" "integrity": "sha1-0nKLQWqHUzmA6wibhI0lPPI6dYw="
}, },
"dom-scroll-into-view": { "dom-scroll-into-view": {
@ -5187,7 +5187,7 @@
}, },
"enquire.js": { "enquire.js": {
"version": "2.1.6", "version": "2.1.6",
"resolved": "https://registry.npm.taobao.org/enquire.js/download/enquire.js-2.1.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fenquire.js%2Fdownload%2Fenquire.js-2.1.6.tgz", "resolved": "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz",
"integrity": "sha1-PoeAybi4NQhMP2DhZtvDwqPImBQ=" "integrity": "sha1-PoeAybi4NQhMP2DhZtvDwqPImBQ="
}, },
"entities": { "entities": {
@ -5706,7 +5706,7 @@
}, },
"eventlistener": { "eventlistener": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npm.taobao.org/eventlistener/download/eventlistener-0.0.1.tgz", "resolved": "https://registry.npmjs.org/eventlistener/-/eventlistener-0.0.1.tgz",
"integrity": "sha1-7Suqu4UiJ68rz4iRUscsY8pTLrg=" "integrity": "sha1-7Suqu4UiJ68rz4iRUscsY8pTLrg="
}, },
"events": { "events": {
@ -8040,7 +8040,7 @@
}, },
"hammerjs": { "hammerjs": {
"version": "2.0.8", "version": "2.0.8",
"resolved": "https://registry.npm.taobao.org/hammerjs/download/hammerjs-2.0.8.tgz", "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz",
"integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=" "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE="
}, },
"handle-thing": { "handle-thing": {
@ -8881,7 +8881,7 @@
}, },
"immutable": { "immutable": {
"version": "3.7.6", "version": "3.7.6",
"resolved": "https://registry.npm.taobao.org/immutable/download/immutable-3.7.6.tgz", "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.7.6.tgz",
"integrity": "sha1-E7TTyxK++hVIKib+Gy665kAHHks=" "integrity": "sha1-E7TTyxK++hVIKib+Gy665kAHHks="
}, },
"import-fresh": { "import-fresh": {
@ -10486,7 +10486,7 @@
}, },
"lodash.throttle": { "lodash.throttle": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npm.taobao.org/lodash.throttle/download/lodash.throttle-4.1.1.tgz", "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" "integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ="
}, },
"lodash.uniq": { "lodash.uniq": {
@ -11673,7 +11673,7 @@
}, },
"output-file-sync": { "output-file-sync": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/output-file-sync/download/output-file-sync-1.1.2.tgz", "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz",
"integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -19100,7 +19100,7 @@
}, },
"user-home": { "user-home": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/user-home/download/user-home-1.1.1.tgz", "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz",
"integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=",
"dev": true "dev": true
}, },
@ -19157,7 +19157,7 @@
}, },
"v8flags": { "v8flags": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npm.taobao.org/v8flags/download/v8flags-2.1.1.tgz?cache=0&sync_timestamp=1590964281452&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fv8flags%2Fdownload%2Fv8flags-2.1.1.tgz", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz",
"integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=",
"dev": true, "dev": true,
"requires": { "requires": {

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 2340181 */ font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1627870211301') format('woff2'), src: url('iconfont.woff2?t=1628841816999') format('woff2'),
url('iconfont.woff?t=1627870211301') format('woff'), url('iconfont.woff?t=1628841816999') format('woff'),
url('iconfont.ttf?t=1627870211301') format('truetype'); url('iconfont.ttf?t=1628841816999') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,150 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-xinjian2:before {
content: "\e8b0";
}
.icon-xieyiicon:before {
content: "\e870";
}
.icon-neicunicon:before {
content: "\e891";
}
.icon-zishuwenjian_icon:before {
content: "\e8a6";
}
.icon-dianzan_icon:before {
content: "\e8ba";
}
.icon-quxiaoguanzhu:before {
content: "\e8bb";
}
.icon-daimakuicon:before {
content: "\e8a9";
}
.icon-zhuyeicon:before {
content: "\e884";
}
.icon-biaoqianicon:before {
content: "\e882";
}
.icon-a-bianji:before {
content: "\e883";
}
.icon-cangkushezhiicon:before {
content: "\e885";
}
.icon-fuzhiicon:before {
content: "\e886";
}
.icon-lianjieicon:before {
content: "\e887";
}
.icon-hebingqingqiuicon:before {
content: "\e888";
}
.icon-lichengbeiicon:before {
content: "\e889";
}
.icon-gongzuoliuicon:before {
content: "\e88a";
}
.icon-dongtaiicon:before {
content: "\e88b";
}
.icon-morendianzan_icon:before {
content: "\e88e";
}
.icon-muluicon:before {
content: "\e894";
}
.icon-a-shezhi:before {
content: "\e899";
}
.icon-wenjian5:before {
content: "\e89a";
}
.icon-tijiaoicon:before {
content: "\e89e";
}
.icon-morenguanzhu_ICON:before {
content: "\e89f";
}
.icon-wenjianjia3:before {
content: "\e8a2";
}
.icon-xialaanniu1:before {
content: "\e8a4";
}
.icon-zuohuaicon:before {
content: "\e8b5";
}
.icon-master_icon:before {
content: "\e8b6";
}
.icon-morenfuke_icon:before {
content: "\e8b7";
}
.icon-a-wikiicon:before {
content: "\e8b8";
}
.icon-yixiuicon:before {
content: "\e8b9";
}
.icon-suofang:before {
content: "\e87f";
}
.icon-fangdaicon:before {
content: "\e881";
}
.icon-sousuo_icon1:before {
content: "\e873";
}
.icon-huanying_icon:before {
content: "\e878";
}
.icon-wenjianjia2:before {
content: "\e879";
}
.icon-shanchuicon1:before {
content: "\e87a";
}
.icon-qingqiuicon:before { .icon-qingqiuicon:before {
content: "\e871"; content: "\e871";
} }
@ -49,10 +193,6 @@
content: "\e898"; content: "\e898";
} }
.icon-xialaanniu_icon:before {
content: "\e89a";
}
.icon-weixuanzhongqingqiuicon:before { .icon-weixuanzhongqingqiuicon:before {
content: "\e89b"; content: "\e89b";
} }
@ -61,10 +201,6 @@
content: "\e8a1"; content: "\e8a1";
} }
.icon-xuanzhongxiangyingicon:before {
content: "\e8a2";
}
.icon-xuanzhongfenzhiicon:before { .icon-xuanzhongfenzhiicon:before {
content: "\e8a3"; content: "\e8a3";
} }
@ -81,18 +217,6 @@
content: "\e8af"; content: "\e8af";
} }
.icon-xinzengmulu_xuantingicon:before {
content: "\e884";
}
.icon-xinzengyemian_morenicon:before {
content: "\e885";
}
.icon-zhankai_morenicon:before {
content: "\e889";
}
.icon-shanchu_tc_icon:before { .icon-shanchu_tc_icon:before {
content: "\e88c"; content: "\e88c";
} }
@ -101,26 +225,14 @@
content: "\e88d"; content: "\e88d";
} }
.icon-xinzengyemian_shubiaodianjiicon:before {
content: "\e88e";
}
.icon-daorumoban_icon:before { .icon-daorumoban_icon:before {
content: "\e86f"; content: "\e86f";
} }
.icon-daochu_xuanfu:before {
content: "\e870";
}
.icon-cuowu:before { .icon-cuowu:before {
content: "\e872"; content: "\e872";
} }
.icon-chenggong1:before {
content: "\e873";
}
.icon-gengduo_icon:before { .icon-gengduo_icon:before {
content: "\e874"; content: "\e874";
} }
@ -137,18 +249,6 @@
content: "\e877"; content: "\e877";
} }
.icon-a-lajitong_icon3x:before {
content: "\e878";
}
.icon-shouqi_morenicon:before {
content: "\e879";
}
.icon-huanying_icon:before {
content: "\e87a";
}
.icon-sousuo_shanchuicon:before { .icon-sousuo_shanchuicon:before {
content: "\e87b"; content: "\e87b";
} }
@ -161,22 +261,10 @@
content: "\e87e"; content: "\e87e";
} }
.icon-wenjianjia_icon:before {
content: "\e87f";
}
.icon-xialaanniu:before { .icon-xialaanniu:before {
content: "\e880"; content: "\e880";
} }
.icon-xinzengmulu_morenicon:before {
content: "\e882";
}
.icon-xinzengmulu_shubiaodianjiicon:before {
content: "\e883";
}
.icon-erciqueren_icon:before { .icon-erciqueren_icon:before {
content: "\e867"; content: "\e867";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,258 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "23572260",
"name": "新建",
"font_class": "xinjian2",
"unicode": "e8b0",
"unicode_decimal": 59568
},
{
"icon_id": "23567674",
"name": "协议icon",
"font_class": "xieyiicon",
"unicode": "e870",
"unicode_decimal": 59504
},
{
"icon_id": "23567675",
"name": "内存icon",
"font_class": "neicunicon",
"unicode": "e891",
"unicode_decimal": 59537
},
{
"icon_id": "23567676",
"name": "自述文件_icon",
"font_class": "zishuwenjian_icon",
"unicode": "e8a6",
"unicode_decimal": 59558
},
{
"icon_id": "23492900",
"name": "点赞_icon",
"font_class": "dianzan_icon",
"unicode": "e8ba",
"unicode_decimal": 59578
},
{
"icon_id": "23492901",
"name": "取消关注",
"font_class": "quxiaoguanzhu",
"unicode": "e8bb",
"unicode_decimal": 59579
},
{
"icon_id": "23473151",
"name": "代码库icon",
"font_class": "daimakuicon",
"unicode": "e8a9",
"unicode_decimal": 59561
},
{
"icon_id": "23473104",
"name": "主页icon",
"font_class": "zhuyeicon",
"unicode": "e884",
"unicode_decimal": 59524
},
{
"icon_id": "23472253",
"name": "标签icon",
"font_class": "biaoqianicon",
"unicode": "e882",
"unicode_decimal": 59522
},
{
"icon_id": "23472254",
"name": "编 辑",
"font_class": "a-bianji",
"unicode": "e883",
"unicode_decimal": 59523
},
{
"icon_id": "23472256",
"name": "仓库设置icon",
"font_class": "cangkushezhiicon",
"unicode": "e885",
"unicode_decimal": 59525
},
{
"icon_id": "23472257",
"name": "复制icon",
"font_class": "fuzhiicon",
"unicode": "e886",
"unicode_decimal": 59526
},
{
"icon_id": "23472258",
"name": "链接icon",
"font_class": "lianjieicon",
"unicode": "e887",
"unicode_decimal": 59527
},
{
"icon_id": "23472259",
"name": "合并请求icon",
"font_class": "hebingqingqiuicon",
"unicode": "e888",
"unicode_decimal": 59528
},
{
"icon_id": "23472260",
"name": "里程碑icon",
"font_class": "lichengbeiicon",
"unicode": "e889",
"unicode_decimal": 59529
},
{
"icon_id": "23472261",
"name": "工作流icon",
"font_class": "gongzuoliuicon",
"unicode": "e88a",
"unicode_decimal": 59530
},
{
"icon_id": "23472262",
"name": "动态icon",
"font_class": "dongtaiicon",
"unicode": "e88b",
"unicode_decimal": 59531
},
{
"icon_id": "23472263",
"name": "默认点赞_icon",
"font_class": "morendianzan_icon",
"unicode": "e88e",
"unicode_decimal": 59534
},
{
"icon_id": "23472265",
"name": "目录icon",
"font_class": "muluicon",
"unicode": "e894",
"unicode_decimal": 59540
},
{
"icon_id": "23472267",
"name": "设 置",
"font_class": "a-shezhi",
"unicode": "e899",
"unicode_decimal": 59545
},
{
"icon_id": "23472268",
"name": "文件",
"font_class": "wenjian5",
"unicode": "e89a",
"unicode_decimal": 59546
},
{
"icon_id": "23472269",
"name": "提交icon",
"font_class": "tijiaoicon",
"unicode": "e89e",
"unicode_decimal": 59550
},
{
"icon_id": "23472270",
"name": "默认关注_ICON",
"font_class": "morenguanzhu_ICON",
"unicode": "e89f",
"unicode_decimal": 59551
},
{
"icon_id": "23472271",
"name": "文件夹",
"font_class": "wenjianjia3",
"unicode": "e8a2",
"unicode_decimal": 59554
},
{
"icon_id": "23472272",
"name": "下拉按钮",
"font_class": "xialaanniu1",
"unicode": "e8a4",
"unicode_decimal": 59556
},
{
"icon_id": "23472276",
"name": "左滑icon",
"font_class": "zuohuaicon",
"unicode": "e8b5",
"unicode_decimal": 59573
},
{
"icon_id": "23472277",
"name": "master_icon",
"font_class": "master_icon",
"unicode": "e8b6",
"unicode_decimal": 59574
},
{
"icon_id": "23472278",
"name": "默认复刻_icon",
"font_class": "morenfuke_icon",
"unicode": "e8b7",
"unicode_decimal": 59575
},
{
"icon_id": "23472279",
"name": "wiki icon",
"font_class": "a-wikiicon",
"unicode": "e8b8",
"unicode_decimal": 59576
},
{
"icon_id": "23472280",
"name": "易修icon",
"font_class": "yixiuicon",
"unicode": "e8b9",
"unicode_decimal": 59577
},
{
"icon_id": "23436350",
"name": "缩放",
"font_class": "suofang",
"unicode": "e87f",
"unicode_decimal": 59519
},
{
"icon_id": "23436351",
"name": "放大icon",
"font_class": "fangdaicon",
"unicode": "e881",
"unicode_decimal": 59521
},
{
"icon_id": "23384231",
"name": "搜索_icon",
"font_class": "sousuo_icon1",
"unicode": "e873",
"unicode_decimal": 59507
},
{
"icon_id": "23384232",
"name": "欢迎_icon",
"font_class": "huanying_icon",
"unicode": "e878",
"unicode_decimal": 59512
},
{
"icon_id": "23384233",
"name": "文件夹",
"font_class": "wenjianjia2",
"unicode": "e879",
"unicode_decimal": 59513
},
{
"icon_id": "23384234",
"name": "删除icon",
"font_class": "shanchuicon1",
"unicode": "e87a",
"unicode_decimal": 59514
},
{ {
"icon_id": "23261798", "icon_id": "23261798",
"name": "请求icon", "name": "请求icon",
@ -68,13 +320,6 @@
"unicode": "e898", "unicode": "e898",
"unicode_decimal": 59544 "unicode_decimal": 59544
}, },
{
"icon_id": "23144154",
"name": "下拉按钮_icon",
"font_class": "xialaanniu_icon",
"unicode": "e89a",
"unicode_decimal": 59546
},
{ {
"icon_id": "23144155", "icon_id": "23144155",
"name": "未选中请求icon", "name": "未选中请求icon",
@ -89,13 +334,6 @@
"unicode": "e8a1", "unicode": "e8a1",
"unicode_decimal": 59553 "unicode_decimal": 59553
}, },
{
"icon_id": "23144159",
"name": "选中响应icon",
"font_class": "xuanzhongxiangyingicon",
"unicode": "e8a2",
"unicode_decimal": 59554
},
{ {
"icon_id": "23144160", "icon_id": "23144160",
"name": "选中分支icon", "name": "选中分支icon",
@ -124,27 +362,6 @@
"unicode": "e8af", "unicode": "e8af",
"unicode_decimal": 59567 "unicode_decimal": 59567
}, },
{
"icon_id": "23046282",
"name": "新增目录_悬停icon",
"font_class": "xinzengmulu_xuantingicon",
"unicode": "e884",
"unicode_decimal": 59524
},
{
"icon_id": "23046283",
"name": "新增页面_默认icon",
"font_class": "xinzengyemian_morenicon",
"unicode": "e885",
"unicode_decimal": 59525
},
{
"icon_id": "23046287",
"name": "展开_默认icon",
"font_class": "zhankai_morenicon",
"unicode": "e889",
"unicode_decimal": 59529
},
{ {
"icon_id": "23046290", "icon_id": "23046290",
"name": "shanchu_tc_icon", "name": "shanchu_tc_icon",
@ -159,13 +376,6 @@
"unicode": "e88d", "unicode": "e88d",
"unicode_decimal": 59533 "unicode_decimal": 59533
}, },
{
"icon_id": "23046311",
"name": "新增页面_鼠标点击icon",
"font_class": "xinzengyemian_shubiaodianjiicon",
"unicode": "e88e",
"unicode_decimal": 59534
},
{ {
"icon_id": "23046244", "icon_id": "23046244",
"name": "导入模版_icon", "name": "导入模版_icon",
@ -173,13 +383,6 @@
"unicode": "e86f", "unicode": "e86f",
"unicode_decimal": 59503 "unicode_decimal": 59503
}, },
{
"icon_id": "23046247",
"name": "导出_悬浮",
"font_class": "daochu_xuanfu",
"unicode": "e870",
"unicode_decimal": 59504
},
{ {
"icon_id": "23046252", "icon_id": "23046252",
"name": "错误", "name": "错误",
@ -187,13 +390,6 @@
"unicode": "e872", "unicode": "e872",
"unicode_decimal": 59506 "unicode_decimal": 59506
}, },
{
"icon_id": "23046254",
"name": "成功",
"font_class": "chenggong1",
"unicode": "e873",
"unicode_decimal": 59507
},
{ {
"icon_id": "23046255", "icon_id": "23046255",
"name": "更多_icon", "name": "更多_icon",
@ -222,27 +418,6 @@
"unicode": "e877", "unicode": "e877",
"unicode_decimal": 59511 "unicode_decimal": 59511
}, },
{
"icon_id": "23046269",
"name": "垃圾桶_icon@3x",
"font_class": "a-lajitong_icon3x",
"unicode": "e878",
"unicode_decimal": 59512
},
{
"icon_id": "23046270",
"name": "收起_默认icon",
"font_class": "shouqi_morenicon",
"unicode": "e879",
"unicode_decimal": 59513
},
{
"icon_id": "23046271",
"name": "欢迎_icon",
"font_class": "huanying_icon",
"unicode": "e87a",
"unicode_decimal": 59514
},
{ {
"icon_id": "23046273", "icon_id": "23046273",
"name": "搜索_删除icon", "name": "搜索_删除icon",
@ -264,13 +439,6 @@
"unicode": "e87e", "unicode": "e87e",
"unicode_decimal": 59518 "unicode_decimal": 59518
}, },
{
"icon_id": "23046277",
"name": "文件夹_icon",
"font_class": "wenjianjia_icon",
"unicode": "e87f",
"unicode_decimal": 59519
},
{ {
"icon_id": "23046278", "icon_id": "23046278",
"name": "下拉按钮", "name": "下拉按钮",
@ -278,20 +446,6 @@
"unicode": "e880", "unicode": "e880",
"unicode_decimal": 59520 "unicode_decimal": 59520
}, },
{
"icon_id": "23046280",
"name": "新增目录_默认icon",
"font_class": "xinzengmulu_morenicon",
"unicode": "e882",
"unicode_decimal": 59522
},
{
"icon_id": "23046281",
"name": "新增目录_鼠标点击icon",
"font_class": "xinzengmulu_shubiaodianjiicon",
"unicode": "e883",
"unicode_decimal": 59523
},
{ {
"icon_id": "22906287", "icon_id": "22906287",
"name": "二次确认_icon", "name": "二次确认_icon",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -82,10 +82,14 @@ const Search = Loadable({
loader: () => import('./modules/search/'), loader: () => import('./modules/search/'),
loading: Loading, loading: Loading,
}) })
const WikiPreview = Loadable({
loader: () => import('./forge/Wiki/Preview'),
loading: Loading,
})
const ProjectIndex = Loadable({ const ProjectIndex = Loadable({
loader: () => import("./forge/Index"), loader: () => import("./forge/Index"),
loading: Loading, loading: Loading,
}); });
class App extends Component { class App extends Component {
constructor(props) { constructor(props) {
@ -199,9 +203,16 @@ class App extends Component {
<ConfigProvider locale={zhCN}> <ConfigProvider locale={zhCN}>
<MuiThemeProvider theme={theme}> <MuiThemeProvider theme={theme}>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog> <LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
<SiderBar/> <SiderBar />
<Router> <Router>
<Switch> <Switch>
{/* wiki预览 */}
<Route path="/projects/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
(props) => {
return (<WikiPreview {...this.props} {...props} {...this.state} />)
}
} />
{/*项目*/} {/*项目*/}
<Route <Route
path={"/projects/:owner/:projectId/devops/:opsId/detail"} path={"/projects/:owner/:projectId/devops/:opsId/detail"}
@ -253,20 +264,21 @@ class App extends Component {
{/* 查询 */} {/* 查询 */}
<Route path="/search" component={Search} /> <Route path="/search" component={Search} />
{/* 个人主页 */} {/* 个人主页 */}
<Route path="/users/:username" <Route path="/users/:username"
render={ render={
(props) => { (props) => {
return (<InfosIndex {...this.props} {...this.state} />) return (<InfosIndex {...this.props} {...this.state} />)
} }
}></Route> }></Route>
<Route exact path="/" <Route exact path="/"
render={ render={
(props) => ( (props) => (
personal && personal.length > 0 ? personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} /> <InfosIndex {...this.props} {...props} />
: :
<ProjectIndex {...this.props} {...props} /> <ProjectIndex {...this.props} {...props} />
) )
} }
/> />

View File

@ -1,4 +1,5 @@
import moment from "moment"; import moment from "moment";
import { number } from "prop-types";
// 处理整点 半点 // 处理整点 半点
// 取传入时间往后的第一个半点 // 取传入时间往后的第一个半点
@ -97,3 +98,41 @@ export function formatDuring(mss){
} }
return days + "天" + hours + "小时" + minutes + "分"; return days + "天" + hours + "小时" + minutes + "分";
} }
/*
返回多久以前
backDate以前的某个日期
*/
export function timeAgo(backDate) {
try {
moment(backDate);
} catch (e) {
return '刚刚';
}
if(typeof backDate ==='number'){
backDate=backDate*1000
}else{
backDate= moment(backDate);
}
let time = new Date() - backDate;
var days = Math.floor(time / (1000 * 60 * 60 * 24));
var hours = Math.floor((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((time % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((time % (1000 * 60 * 60)) / 1000);
if (time <= 0) {
return "刚刚";
}
if (days) {
return days + "天前";
}
if (hours) {
return hours + "小时前";
}
if (minutes) {
return minutes + "分前";
}
if (seconds) {
return seconds + "秒前";
}
return "刚刚";
}

View File

@ -27,7 +27,7 @@ export {
markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension, markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension,
downloadFile, sortDirections, validateLength, mdJSONParse, exportMdtoHtml downloadFile, sortDirections, validateLength, mdJSONParse, exportMdtoHtml
} from './TextUtil' } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment, formatDuring, formatSeconds } from './DateUtil' export { handleDateString, getNextHalfHourOfMoment, formatDuring, formatSeconds ,timeAgo} from './DateUtil'
export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil' export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil'

View File

@ -55,6 +55,7 @@ function AddGroup({organizeId,getGroupID}){
function addCollaborator(){ function addCollaborator(){
getGroupID && getGroupID(id); getGroupID && getGroupID(id);
setID(undefined);
} }
return( return(

View File

@ -0,0 +1,44 @@
import React, { useState, useCallback, memo } from 'react';
import { Tooltip } from 'antd';
CopyTool.defaultProps = {
beforeText: '复制', //
afterText: '复制成功', //
className: '', //svgclass
inputId: 'copyText', //ID
};
function CopyTool({ beforeText, afterText, className,inputId }) {
const [title, setTitle] = useState(() => {
return beforeText;
});
//
const copyUrl = useCallback(() => {
let inputDom = document.getElementById(inputId);
if (!inputDom) {
console.error("您的CopyTool未设置正确的inputId");
return;
}
inputDom.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
}
setTitle(afterText);
inputDom.blur();
}, []);
return (
<Tooltip
placement="top"
title={title}
onVisibleChange={() => { setTitle(beforeText) }}
>
<i className={`iconfont icon-fuzhiicon ${className}`} style={{ color: '#466aff' }} onClick={copyUrl}></i>
</Tooltip>
);
}
export default memo(CopyTool);

View File

@ -104,7 +104,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
</ul> </ul>
: :
<ul className="descUl"> <ul className="descUl">
<li>仓库仅可以转移到您已经加入的组织中不可以转移到未加入的组织中</li> <li>仓库仅可以转移到您具有管理权限的组织中</li>
<li>涉及到仓库改名操作请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li> <li>涉及到仓库改名操作请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li>
<li>转移仓库到组织后你和组织创建者/管理员同时拥有对该仓库的管理操作</li> <li>转移仓库到组织后你和组织创建者/管理员同时拥有对该仓库的管理操作</li>
</ul> </ul>

View File

@ -147,6 +147,7 @@ function CoderDepot(props){
setReadme(result.data.readme); setReadme(result.data.readme);
setEditReadme(false); setEditReadme(false);
setHide(true); setHide(true);
console.log("dddd:",result.data.entries);
} }
setTimeout(function(){setIsSpin(false);},500); setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);}) }).catch(error=>{setIsSpin(false);})
@ -383,7 +384,7 @@ function CoderDepot(props){
</AlignCenter> </AlignCenter>
</FlexAJ> </FlexAJ>
{ {
dirInfo || fileInfo ? (dirInfo && dirInfo.length>0) || fileInfo ?
<div className="listtable"> <div className="listtable">
{ {
lastCommit && lastCommit &&
@ -441,7 +442,7 @@ function CoderDepot(props){
: "" : ""
} }
{ {
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :"" (dirInfo && dirInfo.length === 0) && !fileInfo ? <Nodata _html="暂未发现文件"/> :""
} }
{/* readme文件显示(显示文件详情时不显示readme文件) */} {/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" } { dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
@ -511,11 +512,11 @@ function CoderDepot(props){
} }
{/* 贡献者 */} {/* 贡献者 */}
{ {
projectDetail && projectDetail.contributors && projectDetail && projectDetail.contributors && projectDetail.contributors.length >0 &&
<Contributors contributors={projectDetail && projectDetail.contributors} owner={owner} projectsId={projectsId} /> <Contributors contributors={projectDetail && projectDetail.contributors} owner={owner} projectsId={projectsId} />
} }
{/* 语言 */} {/* 语言 */}
{ projectDetail && projectDetail.languages && { projectDetail && projectDetail.languages && projectDetail.languages.length >0 &&
<React.Fragment> <React.Fragment>
<Divider /> <Divider />
<LanguagePower languages={projectDetail.languages}/> <LanguagePower languages={projectDetail.languages}/>

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Spin, Tooltip , Button } from 'antd'; import { Spin, Tooltip, Button } from 'antd';
import { Link, Route, Switch } from 'react-router-dom'; import { Link, Route, Switch } from 'react-router-dom';
import { Content , AlignTop } from '../Component/layout'; import { Content, AlignTop } from '../Component/layout';
import DetailBanner from './sub/DetailBanner'; import DetailBanner from './sub/DetailBanner';
import '../css/index.scss' import '../css/index.scss'
import './list.css'; import './list.css';
@ -103,12 +103,12 @@ const Contribute = Loadable({
}) })
const CoderRootCommit = Loadable({ const CoderRootCommit = Loadable({
loader: () => import('./CoderRootCommit'), loader: () => import('./CoderRootCommit'),
loading: Loading, loading: Loading,
}) })
const CoderDepot = Loadable({ const CoderDepot = Loadable({
loader: () => import('./CoderDepot'), loader: () => import('./CoderDepot'),
loading: Loading, loading: Loading,
}) })
const TrendsIndex = Loadable({ const TrendsIndex = Loadable({
@ -127,30 +127,40 @@ const Source = Loadable({
const DevIndex = Loadable({ const DevIndex = Loadable({
loader: () => import('../DevOps/Index'), loader: () => import('../DevOps/Index'),
loading: Loading, loading: Loading,
}) });
const Wiki = Loadable({
loader: () => import('../Wiki/Index'),
loading: Loading,
});
const WikiEdit = Loadable({
loader: () => import('../Wiki/EditWiki'),
loading: Loading,
});
/** /**
* permissionManager:管理员Reporter报告人员(只有读取权限)Developer开发人员除不能设置仓库信息外 * permissionManager:管理员Reporter报告人员(只有读取权限)Developer开发人员除不能设置仓库信息外
*/ */
function checkPathname(projectsId,owner,pathname){ function checkPathname(projectsId, owner, pathname) {
let name = ""; let name = "";
if(pathname && pathname !== `/projects/${owner}/${projectsId}`){ if (pathname && pathname !== `/projects/${owner}/${projectsId}`) {
let url = pathname.split(`/projects/${owner}/${projectsId}`)[1]; let url = pathname.split(`/projects/${owner}/${projectsId}`)[1];
if(url.indexOf("/about")>-1){ if (url.indexOf("/about") > -1) {
name="about" name = "about"
}else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){ } else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) {
name = "issues"; name = "issues";
}else if(url.indexOf("/pulls")>-1){ } else if (url.indexOf("/pulls") > -1) {
name="pulls" name = "pulls"
}else if(url.indexOf("/milestones")>-1){ } else if (url.indexOf("/milestones") > -1) {
name="milestones" name = "milestones"
}else if(url.indexOf("/activity")>-1){ } else if (url.indexOf("/activity") > -1) {
name="activity" name = "activity"
}else if(url.indexOf("/setting")>-1){ } else if (url.indexOf("/setting") > -1) {
name="setting" name = "setting"
}else if(url.indexOf(`/devops`)>-1){ } else if (url.indexOf(`/devops`) > -1) {
name="devops" name = "devops"
}else if(url.indexOf(`/source`)>-1){ } else if (url.indexOf(`/source`) > -1) {
name="source" name = "source"
} else if (url.indexOf(`/wiki`) > -1) {
name = "wiki"
} }
} }
return name; return name;
@ -173,15 +183,15 @@ class Detail extends Component {
branchs: undefined, branchs: undefined,
branchList: undefined, branchList: undefined,
project: null, project: null,
firstSync:false, firstSync: false,
secondSync:false, secondSync: false,
open_devops:false, open_devops: false,
forkSpin:false, forkSpin: false,
// 默认分支 // 默认分支
defaultBranch:undefined, defaultBranch: undefined,
// 非本平台项目 // 非本平台项目
platform:false platform: false
} }
} }
@ -198,36 +208,38 @@ class Detail extends Component {
} }
getProject = (num) => { getProject = (num) => {
const { projectsId , owner } = this.props.match.params; const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/simple.json`; const url = `/${owner}/${projectsId}/simple.json`;
axios.get(url).then((result) => { axios.get(url).then((result) => {
if (result && result.data) { if (result && result.data) {
this.setState({ this.setState({
project: result.data, project: result.data,
open_devops:result.data.open_devops, open_devops: result.data.open_devops,
platform:result.data.platform && result.data.platform !== 'educoder' platform: result.data.platform && result.data.platform !== 'educoder'
}) })
if (result.data.type !== 0 && result.data.mirror_status === 1) { if (result.data.type !== 0 && result.data.mirror_status === 1) {
console.log("--------start channel --------"); console.log("--------start channel --------");
// 是镜像项目,且未完成迁移 // 是镜像项目,且未完成迁移
this.canvasChannel(); this.canvasChannel();
if(num){ if (num) {
this.setState({ this.setState({
secondSync:true, secondSync: true,
firsrtSync:false firstSync: false
}) })
}else{ } else {
this.setState({ this.setState({
firstSync:true, firstSync: true,
secondSync:false secondSync: false
}) })
} }
}else{ } else if (result.data.mirror_status === 2) {
this.deleteProjectBack();
} else {
this.getDetail(); this.getDetail();
this.setState({ this.setState({
firsrtSync:false, firstSync: false,
secondSync:false secondSync: false
}) })
} }
} }
@ -235,9 +247,9 @@ class Detail extends Component {
} }
// 工作流激活后修改状态 // 工作流激活后修改状态
changeOpenDevops=(flag)=>{ changeOpenDevops = (flag) => {
this.setState({ this.setState({
open_devops:flag open_devops: flag
}) })
} }
canvasChannel = () => { canvasChannel = () => {
@ -247,7 +259,7 @@ class Detail extends Component {
var cable = actioncable.createConsumer(`wss://${name}/cable`); var cable = actioncable.createConsumer(`wss://${name}/cable`);
this.canvasChannel1 = cable.subscriptions.create({ this.canvasChannel1 = cable.subscriptions.create({
channel: `MirrorProjectChannel`, channel: `MirrorProjectChannel`,
id: project && project.identifier id: project && project.id
}, { }, {
connected: () => { connected: () => {
console.log("###### channel connected! ######"); console.log("###### channel connected! ######");
@ -255,16 +267,41 @@ class Detail extends Component {
disconnected: () => { }, disconnected: () => { },
received: data => { received: data => {
console.log(`###### ---received data--- ######`); console.log(`###### ---received data--- ######`);
console.log(data);
if (data) { if (data) {
if ( data.project && data.project.mirror_status === 2) {
this.deleteProjectBack();
}
this.getDetail(); this.getDetail();
this.setState({
firstSync: false,
secondSync: false
});
cable.subscriptions.consumer.disconnect(); cable.subscriptions.consumer.disconnect();
} }
} }
}) })
} }
deleteProjectBack = () => {
const { history } = this.props;
const { projectsId, owner } = this.props.match.params;
axios.delete(`/${owner}/${projectsId}.json`).then(res => {
let hash = '/projects/mirror/new';
if (res && res.data) {
history.push({
pathname: hash,
mirror_status: 2
});
}
else {
window.location.hash = hash;
}
});
}
getDetail = () => { getDetail = () => {
const { projectsId , owner } = this.props.match.params; const { projectsId, owner } = this.props.match.params;
this.getBanner(); this.getBanner();
const url = `/${owner}/${projectsId}/detail.json`; const url = `/${owner}/${projectsId}/detail.json`;
axios.get(url).then((result) => { axios.get(url).then((result) => {
@ -281,29 +318,29 @@ class Detail extends Component {
watchers_count: result.data.watchers_count, watchers_count: result.data.watchers_count,
praises_count: result.data.praises_count, praises_count: result.data.praises_count,
forked_count: result.data.forked_count, forked_count: result.data.forked_count,
defaultBranch:result.data.default_branch defaultBranch: result.data.default_branch
}) })
} }
}).catch((error) => { }) }).catch((error) => { })
} }
// 获取动态导航栏菜单 // 获取动态导航栏菜单
getBanner(){ getBanner() {
const { projectsId , owner } = this.props.match.params; const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/menu_list.json`; const url = `/${owner}/${projectsId}/menu_list.json`;
axios.get(url).then(result=>{ axios.get(url).then(result => {
if(result){ if (result) {
this.setState({ this.setState({
bannerList:result.data bannerList: result.data
}) })
} }
}).catch(error=>{}) }).catch(error => { })
} }
// 关注和取消关注 // 关注和取消关注
focusFunc = (flag) => { focusFunc = (flag) => {
const { platform } = this.state; const { platform } = this.state;
if(!platform)return; if (!platform) return;
const { project_id } = this.state; const { project_id } = this.state;
axios({ axios({
@ -318,15 +355,15 @@ class Detail extends Component {
this.setWatchersCount(result.data.watchers_count, result.data.watched); this.setWatchersCount(result.data.watchers_count, result.data.watched);
} }
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
}); });
} }
// 点赞和取消点赞 // 点赞和取消点赞
pariseFunc = (flag) => { pariseFunc = (flag) => {
const { platform } = this.state; const { platform } = this.state;
if(!platform)return; if (!platform) return;
const { project_id } = this.state; const { project_id } = this.state;
axios({ axios({
method: flag ? 'delete' : 'post', method: flag ? 'delete' : 'post',
@ -336,9 +373,9 @@ class Detail extends Component {
this.setPraisesCount(result.data.praises_count, result.data.praised) this.setPraisesCount(result.data.praises_count, result.data.praised)
} }
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
}); });
} }
setWatchersCount = (count, is_watched) => { setWatchersCount = (count, is_watched) => {
@ -358,12 +395,12 @@ class Detail extends Component {
// fork项目 // fork项目
forkFunc = () => { forkFunc = () => {
const { platform } = this.state; const { platform } = this.state;
if(!platform)return; if (!platform) return;
this.setState({ this.setState({
forkSpin:true forkSpin: true
}) })
const { current_user } = this.props const { current_user } = this.props
const { projectsId , owner } = this.props.match.params; const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/forks.json`; const url = `/${owner}/${projectsId}/forks.json`;
axios.post(url).then(result => { axios.post(url).then(result => {
if (result && result.data.status === 0) { if (result && result.data.status === 0) {
@ -371,11 +408,11 @@ class Detail extends Component {
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
} }
this.setState({ this.setState({
forkSpin:false forkSpin: false
}) })
}).catch(error => { }).catch(error => {
this.setState({ this.setState({
forkSpin:false forkSpin: false
}) })
}) })
} }
@ -383,8 +420,8 @@ class Detail extends Component {
// 同步镜像 // 同步镜像
synchronismMirror = () => { synchronismMirror = () => {
const { platform } = this.state; const { platform } = this.state;
if(!platform)return; if (!platform) return;
const { projectsId , owner } = this.props.match.params; const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/sync_mirror.json`; const url = `/${owner}/${projectsId}/sync_mirror.json`;
axios.post(url).then(result => { axios.post(url).then(result => {
if (result && result.data && result.data.status === 0) { if (result && result.data && result.data.status === 0) {
@ -398,326 +435,344 @@ class Detail extends Component {
}) })
} }
textFunc = (forked_from_project_id,fork_info)=>{ textFunc = (forked_from_project_id, fork_info) => {
let type = fork_info && fork_info.fork_project_user_type; let type = fork_info && fork_info.fork_project_user_type;
return forked_from_project_id && fork_info ? return forked_from_project_id && fork_info ?
<div className="color-grey-9 df"> <div className="color-grey-9 df">
<span>复刻自</span> <span>复刻自</span>
<Link to={`${type ==="Organization" ? "/organize":'/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link> <Link to={`${type === "Organization" ? "/organize" : '/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
<span> / </span> <span> / </span>
<Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{maxWidth:"400px"}} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link> <Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{ maxWidth: "400px" }} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
</div> : "" </div> : ""
} }
render() { render() {
const { projectDetail, watchers_count, praises_count, const { projectDetail, watchers_count, praises_count,
forked_count, firstSync , secondSync , forked_count, firstSync, secondSync,
isManager, watched, praised, isManager, watched, praised,
project , open_devops , platform , defaultBranch , bannerList , forkSpin } = this.state; project, open_devops, platform, defaultBranch, bannerList, forkSpin } = this.state;
const url = this.props.history.location.pathname; const url = this.props.history.location.pathname;
const urlArr = url.split("/"); const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3); const urlFlag = (urlArr.length === 3);
const { projectsId , owner } = this.props.match.params; const { projectsId, owner } = this.props.match.params;
const { current_user } = this.props; const { current_user } = this.props;
let pathname = checkPathname(projectsId,owner,url); let pathname = checkPathname(projectsId, owner, url);
const { state } = this.props.history.location; const { state } = this.props.history.location;
const common = { const common = {
getDetail: this.getDetail, getDetail: this.getDetail,
changeOpenDevops:this.changeOpenDevops, changeOpenDevops: this.changeOpenDevops,
defaultBranch defaultBranch
} }
return ( return (
<div> <div>
<div className="detailHeader-wrapper"> <div className="detailHeader-wrapper">
<div className="normal"> <div className="normal">
<AlignTop style={{padding:"20px 0px 10px",justifyContent:"space-between"}}> <AlignTop style={{ padding: "20px 0px 10px", justifyContent: "space-between" }}>
<div> <div>
<AlignTop> <AlignTop>
<div className="projectallName"> <div className="projectallName">
{project && project.author && {project && project.author &&
<Link to={`${project.author.type ==="Organization" ? "/organize":'/users'}/${project.author.login}`}>{project.author.name}</Link> <Link to={`${project.author.type === "Organization" ? "/organize" : '/users'}/${project.author.login}`}>{project.author.name}</Link>
} }
<span className="ml5 mr5">/</span> <span className="ml5 mr5">/</span>
<Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link> <Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
</div> </div>
{ projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>} {projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>}
</AlignTop> </AlignTop>
<div className="mt8"> <div className="mt8">
{ {
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ? projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
this.textFunc(projectDetail.forked_from_project_id,projectDetail.fork_info) this.textFunc(projectDetail.forked_from_project_id, projectDetail.fork_info)
:"" : ""
} }
{ {
projectDetail && projectDetail.type && projectDetail.type !== 0 ? projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">镜像自 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span> <span className="color-grey-9">镜像自 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
:"" : ""
} }
</div> </div>
</div> </div>
<div> <div>
{ {
firstSync ? "": firstSync ? "" :
<span className="df"> <span className="df">
{
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
}
<Button className="detail_tag_btn">
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.focusFunc(watched)}>
<i className={watched ? "iconfont icon-shixing color-orange font-16 mr3":"iconfont icon-kongxing color-grey-9 font-16 mr3"}></i>
<span>{watched ? '取消关注' : '关注'}</span>
</a>
{ {
watchers_count > 0 ? ((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
platform ? <a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
<Link className="detail_tag_btn_count" style={{color:`${watched?"#2878FF":"#666"}`}} to={platform?{ pathname: `/projects/${owner}/${projectsId}/watchers`, state }:""}>
{watchers_count}
</Link>
:
<span className="detail_tag_btn_count">{watchers_count}</span>
:""
} }
</Button> <Button className="detail_tag_btn">
<Button className="detail_tag_btn"> <a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={() => this.focusFunc(watched)}>
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.pariseFunc(praised)}> <i className={watched ? "iconfont icon-shixing color-orange font-16 mr3" : "iconfont icon-kongxing color-grey-9 font-16 mr3"}></i>
<i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3":"iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i> <span>{watched ? '取消关注' : '关注'}</span>
<span>{praised ? '取消点赞' : '点赞'}</span>
</a>
{
praises_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{color:`${praised?"#2878FF":"#666"}`}} to={{ pathname: `/projects/${owner}/${projectsId}/stargazers`, state }}>
{praises_count}
</Link>:
<span className="detail_tag_btn_count">{praises_count}</span>
:""
}
</Button>
<Button className="detail_tag_btn" loading={forkSpin}>
<Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom">
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={this.forkFunc}>
<i className="iconfont icon-fork color-grey-9 mr3"></i>
</a> </a>
</Tooltip> {
{ watchers_count > 0 ?
forked_count > 0 ? platform ?
platform ? <Link className="detail_tag_btn_count" style={{ color: `${watched ? "#2878FF" : "#666"}` }} to={platform ? { pathname: `/projects/${owner}/${projectsId}/watchers`, state } : ""}>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/fork_users`, state }}> {watchers_count}
{forked_count} </Link>
</Link> :
: <span className="detail_tag_btn_count">{watchers_count}</span>
<span className="detail_tag_btn_count">{forked_count}</span> : ""
:"" }
} </Button>
</Button> <Button className="detail_tag_btn">
</span> <a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={() => this.pariseFunc(praised)}>
<i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3" : "iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i>
<span>{praised ? '取消点赞' : '点赞'}</span>
</a>
{
praises_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{ color: `${praised ? "#2878FF" : "#666"}` }} to={{ pathname: `/projects/${owner}/${projectsId}/stargazers`, state }}>
{praises_count}
</Link> :
<span className="detail_tag_btn_count">{praises_count}</span>
: ""
}
</Button>
<Button className="detail_tag_btn" loading={forkSpin}>
<Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom">
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={this.forkFunc}>
<i className="iconfont icon-fork color-grey-9 mr3"></i>
</a>
</Tooltip>
{
forked_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/fork_users`, state }}>
{forked_count}
</Link>
:
<span className="detail_tag_btn_count">{forked_count}</span>
: ""
}
</Button>
</span>
} }
</div> </div>
</AlignTop> </AlignTop>
{ {
firstSync ? "" : firstSync ? "" :
<DetailBanner <DetailBanner
history={this.props.history} history={this.props.history}
list={bannerList} list={bannerList}
owner={owner} owner={owner}
projectsId={projectsId} projectsId={projectsId}
pathname={pathname} pathname={pathname}
state={state} state={state}
projectDetail={projectDetail} projectDetail={projectDetail}
open_devops={open_devops} open_devops={open_devops}
platform={platform} platform={platform}
urlFlag={urlFlag} urlFlag={urlFlag}
isManager={isManager} isManager={isManager}
/> />
} }
</div> </div>
</div> </div>
{ {
firstSync ? firstSync ?
<Content className="spincontent"> <Content className="spincontent">
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" /> <Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
</Content> </Content>
: :
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large"> <Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
<Switch {...this.props}> <Switch {...this.props}>
{/* 资源 */} {/* 资源 */}
<Route path="/projects/:owner/:projectsId/source" <Route path="/projects/:owner/:projectsId/source"
render={ render={
() => (<Source {...this.props} {...this.state} {...common} />) () => (<Source {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 主页 */} {/* 主页 */}
<Route path="/projects/:owner/:projectsId/about" <Route path="/projects/:owner/:projectsId/about"
render={ render={
() => (<DevAbout {...this.props} {...this.state} {...common} />) () => (<DevAbout {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 工作流 */} {/* wiki新增文件 */}
<Route path="/projects/:owner/:projectsId/devops" <Route path="/projects/:owner/:projectsId/wiki/add"
render={ render={
() => (<DevIndex {...this.props} {...this.state} {...common} />) () => (<WikiEdit {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 标签列表 */} {/* wiki编辑文件 */}
<Route path="/projects/:owner/:projectsId/issues/tags" <Route path="/projects/:owner/:projectsId/wiki/edit/:wikiName"
render={ render={
(props) => (<TagList {...this.props} {...props} {...this.state} {...common} />) () => (<WikiEdit {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 仓库设置 */} {/* wiki */}
<Route path="/projects/:owner/:projectsId/setting" <Route path="/projects/:owner/:projectsId/wiki"
render={ render={
(props) => (<Setting {...this.props} {...props} {...this.state} {...common} />) () => (<Wiki {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 任务详情 */} {/* 工作流 */}
<Route path="/projects/:owner/:projectsId/issues/:orderId/detail" <Route path="/projects/:owner/:projectsId/devops"
render={ render={
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />) () => (<DevIndex {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/*修改里程碑*/} {/* 标签列表 */}
<Route path="/projects/:owner/:projectsId/milestones/:meilid/edit" <Route path="/projects/:owner/:projectsId/issues/tags"
render={ render={
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />) (props) => (<TagList {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 新建里程碑 */} {/* 仓库设置 */}
<Route path="/projects/:owner/:projectsId/milestones/new" <Route path="/projects/:owner/:projectsId/setting"
render={ render={
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />) (props) => (<Setting {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/*里程碑详情*/} {/* 任务详情 */}
<Route path="/projects/:owner/:projectsId/milestones/:meilid" <Route path="/projects/:owner/:projectsId/issues/:orderId/detail"
render={ render={
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
} }
></Route> ></Route>
{/* 里程碑 */} {/*修改里程碑*/}
<Route path="/projects/:owner/:projectsId/milestones" <Route path="/projects/:owner/:projectsId/milestones/:meilid/edit"
render={ render={
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 里程碑页面新建任务 */} {/* 新建里程碑 */}
<Route path="/projects/:owner/:projectsId/issues/:milepostId/new" <Route path="/projects/:owner/:projectsId/milestones/new"
render={ render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 新建任务 */} {/*里程碑详情*/}
<Route path="/projects/:owner/:projectsId/issues/new" <Route path="/projects/:owner/:projectsId/milestones/:meilid"
render={ render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />) (props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 修改详情 */} {/* 里程碑 */}
<Route path="/projects/:owner/:projectsId/issues/:orderId/updatedetail" <Route path="/projects/:owner/:projectsId/milestones"
render={ render={
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 复制详情 */} {/* 里程碑页面新建任务 */}
<Route path="/projects/:owner/:projectsId/issues/:orderId/copyetail" <Route path="/projects/:owner/:projectsId/issues/:milepostId/new"
render={ render={
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 动态 */} {/* 新建任务 */}
<Route path="/projects/:owner/:projectsId/activity" <Route path="/projects/:owner/:projectsId/issues/new"
render={ render={
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 代码Index */} {/* 修改详情 */}
<Route path="/projects/:owner/:projectsId/issues" <Route path="/projects/:owner/:projectsId/issues/:orderId/updatedetail"
render={ render={
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />) (props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 新建合并请求 */} {/* 复制详情 */}
<Route path="/projects/:owner/:projectsId/pulls/new/:branch" <Route path="/projects/:owner/:projectsId/issues/:orderId/copyetail"
render={ render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />) (props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId/pulls/new" {/* 动态 */}
render={ <Route path="/projects/:owner/:projectsId/activity"
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />) render={
} (props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
></Route> }
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/UpdateMerge" ></Route>
render={ {/* 代码Index */}
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />) <Route path="/projects/:owner/:projectsId/issues"
} render={
></Route> (props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/Messagecount" }
render={ ></Route>
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />) {/* 新建合并请求 */}
} <Route path="/projects/:owner/:projectsId/pulls/new/:branch"
></Route> render={
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/MergeSubmit" (props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
render={ }
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />) ></Route>
} <Route path="/projects/:owner/:projectsId/pulls/new"
></Route> render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
render={
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/Messagecount"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/MergeSubmit"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls" <Route path="/projects/:owner/:projectsId/pulls"
render={ render={
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />) (props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId/watchers" <Route path="/projects/:owner/:projectsId/watchers"
render={ render={
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />) (props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId/stargazers" <Route path="/projects/:owner/:projectsId/stargazers"
render={ render={
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />) (props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId/fork_users" <Route path="/projects/:owner/:projectsId/fork_users"
render={ render={
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />) (props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 贡献者列表 */} {/* 贡献者列表 */}
<Route path="/projects/:owner/:projectsId/contribute" <Route path="/projects/:owner/:projectsId/contribute"
render={ render={
() => (<Contribute {...this.props} {...this.state} {...common} />) () => (<Contribute {...this.props} {...this.state} {...common} />)
} }
></Route> ></Route>
{/* 代码库----详情页面 */} {/* 代码库----详情页面 */}
<Route path="/projects/:owner/:projectsId/commits/branch/:branchName" <Route path="/projects/:owner/:projectsId/commits/branch/:branchName"
render={ render={
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} {...common}/>) (props) => (<CoderRootCommit {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId/tree/:branchName" <Route path="/projects/:owner/:projectsId/tree/:branchName"
render={ render={
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common}/>) (props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId/:subIndex" <Route path="/projects/:owner/:projectsId/:subIndex"
render={ render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
<Route path="/projects/:owner/:projectsId" <Route path="/projects/:owner/:projectsId"
render={ render={
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common}/>) (props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common} />)
} }
></Route> ></Route>
</Switch> </Switch>
</Spin> </Spin>
} }
</div> </div>
) )

View File

@ -22,9 +22,9 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
menuName && projectDetail ? menuName && projectDetail ?
<ul className="headerMenu-wrapper"> <ul className="headerMenu-wrapper">
{ {
menuName.map((item,key)=>{ Array.isArray(menuName)&& menuName.map((item,key)=>{
return( return(
<React.Fragment> <React.Fragment key={item.menu_name}>
{ {
item.menu_name === "home" && item.menu_name === "home" &&
<li className={pathname==="about" ? "active" : ""}> <li className={pathname==="about" ? "active" : ""}>
@ -65,6 +65,15 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</Link> </Link>
</li>:"" </li>:""
} }
{
item.menu_name === "wiki" &&
<li className={pathname === "wiki" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/wiki`, state }}>
<i className={pathname==="wiki" ? "iconfont icon-wiki_icon color-grey-3 mr5 font-14":"iconfont icon-wiki_icon color-grey-6 font-14 mr5"}></i>
<span>Wiki</span>
</Link>
</li>
}
{ {
item.menu_name === "devops" && platform ? item.menu_name === "devops" && platform ?
<li className={pathname==="devops" ? "active" : ""}> <li className={pathname==="devops" ? "active" : ""}>
@ -76,14 +85,14 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
:"" :""
} }
{ {
item.menu_name === "resources" && // item.menu_name === "resources" &&
<li className={pathname==="source" ? "active" : ""}> // <li className={pathname==="source" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/source`, state }}> // <Link to={{ pathname: `/projects/${owner}/${projectsId}/source`, state }}>
<i className={pathname==="source" ? "iconfont icon-ziyuanpaihanghetuijian color-grey-3 mr5 font-14":"iconfont icon-ziyuanpaihanghetuijian color-grey-6 font-14 mr5"}></i> // <i className={pathname==="source" ? "iconfont icon-ziyuanpaihanghetuijian color-grey-3 mr5 font-14":"iconfont icon-ziyuanpaihanghetuijian color-grey-6 font-14 mr5"}></i>
<span>资源库</span> // <span></span>
{projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""} // {projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""}
</Link> // </Link>
</li> // </li>
} }
{ {
item.menu_name === "versions" && item.menu_name === "versions" &&

View File

@ -49,7 +49,7 @@ class MergeItem extends Component {
}; };
render() { render() {
const { issues, project_name, project_author_name , user_admin_or_member} = this.props; const { issues, project_name, project_author_name , user_admin_or_developer} = this.props;
const { projectsId , owner } = this.props.match.params; const { projectsId , owner } = this.props.match.params;
const { current_user } = this.props; const { current_user } = this.props;
const renderList = () => { const renderList = () => {
@ -183,7 +183,7 @@ class MergeItem extends Component {
) : ( ) : (
"" ""
)} )}
{user_admin_or_member && item.pull_request_status === 0 ? ( {user_admin_or_developer && item.pull_request_status === 0 ? (
<div <div
className="milepostleft" className="milepostleft"
style={{ style={{

View File

@ -4,7 +4,7 @@ import "./merge.css";
import "../Order/order.css"; import "../Order/order.css";
import "../Order/index.scss"; import "../Order/index.scss";
import NoneData from "./no_data"; import NoneData from "./no_data";
import OrderItem from "./MergeItem"; import MergeItem from "./MergeItem";
import './Index.scss'; import './Index.scss';
import axios from "axios"; import axios from "axios";
@ -255,7 +255,7 @@ class merge extends Component {
/> />
</div> </div>
{ {
data && data.user_admin_or_member && data && data.user_admin_or_developer &&
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}> <a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
+&nbsp;新建合并请求 +&nbsp;新建合并请求
</a> </a>
@ -387,7 +387,7 @@ class merge extends Component {
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
{data && data.search_count && data.search_count > 0 ? ( {data && data.search_count && data.search_count > 0 ? (
<div> <div>
<OrderItem <MergeItem
issues={issues} issues={issues}
search_count={search_count} search_count={search_count}
page={select_params.page} page={select_params.page}
@ -396,8 +396,8 @@ class merge extends Component {
project_author_name={data.project_author_name} project_author_name={data.project_author_name}
{...this.props} {...this.props}
{...this.state} {...this.state}
user_admin_or_member={data && data.user_admin_or_member} user_admin_or_developer={data && data.user_admin_or_developer}
></OrderItem> ></MergeItem>
</div> </div>
):""} ):""}
{search_count > select_params.limit ? ( {search_count > select_params.limit ? (

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete } from 'antd'; import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd';
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import '../css/index.scss'; import '../css/index.scss';
@ -58,6 +58,8 @@ class Index extends Component {
this.getGitignore(); this.getGitignore();
// 获取开源许可证 // 获取开源许可证
this.getLicenses(); this.getLicenses();
//判断是否为删除新建项目失败后返回,并执行对应逻辑
this.isDeleteProjectBack();
} }
componentDidUpdate=(prevPros)=>{ componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && !this.props.checkIfLogin()){ if(prevPros && this.props && !this.props.checkIfLogin()){
@ -69,6 +71,7 @@ class Index extends Component {
getOwner=()=>{ getOwner=()=>{
const { OIdentifier } = this.props.match.params; const { OIdentifier } = this.props.match.params;
const { user_id } = this.props && this.props.current_user; const { user_id } = this.props && this.props.current_user;
const url = `/owners.json`; const url = `/owners.json`;
axios.get(url).then(result=>{ axios.get(url).then(result=>{
if(result && result.data){ if(result && result.data){
@ -77,16 +80,13 @@ class Index extends Component {
OwnerList: owner, OwnerList: owner,
}) })
if(OIdentifier){ if(OIdentifier){
owner = owner.filter(item=>item.name === OIdentifier); owner = owner.filter(item=>item.login === OIdentifier);
this.props.form.setFieldsValue({
user_id:OIdentifier
})
}else if(user_id){ }else if(user_id){
owner = owner.filter(item=>item.id === user_id); owner = owner.filter(item=>item.id === user_id);
this.props.form.setFieldsValue({
user_id:owner && owner[0].name
})
} }
this.props.form.setFieldsValue({
user_id:owner && owner[0].name
})
owner && this.setState({ owner && this.setState({
owners_id:owner[0].id, owners_id:owner[0].id,
owners_name:owner[0].name owners_name:owner[0].name
@ -144,6 +144,31 @@ class Index extends Component {
}).catch((error) => { }) }).catch((error) => { })
} }
isDeleteProjectBack = () => {
let mirror_status = this.props.history.location.mirror_status;
if (mirror_status === 2 && sessionStorage.newProjectValue) {
Modal.warning({
title: '警告',
content: '镜像项目创建失败!请按操作规范重新创建项目!',
});
let newProjectValue = JSON.parse(sessionStorage.newProjectValue);
if (newProjectValue) {
this.setState({
project_language_id: newProjectValue.project_language_id,
project_category_id: newProjectValue.project_category_id,
license_id: newProjectValue.license_id,
ignore_id: newProjectValue.ignore_id
});
delete newProjectValue.project_language_id;
delete newProjectValue.project_category_id;
delete newProjectValue.license_id;
delete newProjectValue.ignore_id;
this.props.form.setFieldsValue(newProjectValue);
}
}
}
// 设置option // 设置option
setOptionsList = (data, _head, name) => { setOptionsList = (data, _head, name) => {
if (data && data.length > 0) { if (data && data.length > 0) {
@ -172,6 +197,8 @@ class Index extends Component {
const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state; const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state;
const decoderPass = Base64.encode(values.password); const decoderPass = Base64.encode(values.password);
const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json"; const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json";
// 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值
sessionStorage.newProjectValue=JSON.stringify({...values,project_language_id,project_category_id,license_id,ignore_id});
axios.post(url, { axios.post(url, {
...values, ...values,
auth_password:decoderPass, auth_password:decoderPass,
@ -185,7 +212,7 @@ class Index extends Component {
this.setState({ this.setState({
isSpin: false isSpin: false
}) })
this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`); projectsType && projectsType !== "mirror" && this.props.showNotification(`托管项目创建成功!`);
this.props.history.push(`/projects/${result.data.login}/${result.data.identifier}`); this.props.history.push(`/projects/${result.data.login}/${result.data.identifier}`);
} }
}).catch((error) => { }).catch((error) => {
@ -337,7 +364,9 @@ class Index extends Component {
{ {
projectsType && projectsType === "mirror" && projectsType && projectsType === "mirror" &&
<React.Fragment> <React.Fragment>
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i></p> <p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>
需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i>
<span className="ml20 font-12 color-red">如果源项目为公有仓库禁止填写用户名密码如果源项目为私有仓库则必须填写正确的用户名和密码!</span></p>
{ {
mirrorCheck && mirrorCheck &&
<div className="df mb20" style={{alignItems:'center'}}> <div className="df mb20" style={{alignItems:'center'}}>

View File

@ -70,9 +70,9 @@ function Index(props){
function deleteEvent(type,count) { function deleteEvent(type,count) {
let c = count; let c = count;
if(type==="apply"){ if(type==="apply"){
setTransferCount(transferCount-count);
}else if(type==="undo"){
setApplyCount(applyCount-count); setApplyCount(applyCount-count);
}else if(type==="undo"){
setTransferCount(transferCount-count);
}else{ }else{
setMessagesCount(0); setMessagesCount(0);
c = messagesCount; c = messagesCount;

View File

@ -53,7 +53,7 @@ function UndoEvent(props){
Axios.post(url).then(result=>{ Axios.post(url).then(result=>{
if(result && result.data){ if(result && result.data){
getList(); getList();
props && props.deleteEvent("apply",1); props && props.deleteEvent("undo",1);
} }
}).catch(error=>{}) }).catch(error=>{})
} }

View File

@ -1,4 +1,4 @@
import React, { useState } from "react"; import React, { useState , useRef } from "react";
import {WhiteBack} from '../Component/layout'; import {WhiteBack} from '../Component/layout';
import AddMember from '../Component/AddMember'; import AddMember from '../Component/AddMember';
import AddGroup from '../Component/AddGroup'; import AddGroup from '../Component/AddGroup';
@ -8,9 +8,11 @@ import Group from './CollaboratorGroup';
function Collaborator(props){ function Collaborator(props){
const [ nav , setNav] = useState("1"); const [ nav , setNav] = useState("1");
const [ newId , setNewId] = useState(undefined); const [ newId , setNewId] = useState(undefined);
const [ addOperation , setAddOperation] = useState(true);
const [ newGroupId , setNewGroupId] = useState(undefined); const [ newGroupId , setNewGroupId] = useState(undefined);
const {projectsId ,owner} = props.match.params; const {projectsId ,owner} = props.match.params;
const author = props && props.projectDetail && props.projectDetail.author; const author = props && props.projectDetail && props.projectDetail.author;
function getID(id){ function getID(id){
@ -20,6 +22,7 @@ function Collaborator(props){
setNewGroupId(id); setNewGroupId(id);
} }
return ( return (
<WhiteBack> <WhiteBack>
<div className="flex-a-center baseForm bbr"> <div className="flex-a-center baseForm bbr">
@ -27,15 +30,17 @@ function Collaborator(props){
author && author.type === "Organization" ? author && author.type === "Organization" ?
<span> <span>
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>{setNav("1");setNewId(undefined)}}>协作者管理</span> <span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>{setNav("1");setNewId(undefined)}}>协作者管理</span>
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined)}}>团队管理</span> <span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined);setNewGroupId(undefined)}}>团队管理</span>
</span> </span>
: :
<span className="font-18 text-black">协作者管理</span> <span className="font-18 text-black">协作者管理</span>
} }
{ {
nav === "1" ? nav === "1" &&
<AddMember getID={getID} login showNotification={props.showNotification}/> <AddMember getID={getID} login showNotification={props.showNotification}/>
: }
{
(nav !== "1" && addOperation) &&
<AddGroup getGroupID={getGroupID} organizeId={owner}/> <AddGroup getGroupID={getGroupID} organizeId={owner}/>
} }
</div> </div>
@ -44,7 +49,7 @@ function Collaborator(props){
nav === "1" ? nav === "1" ?
<Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/> <Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/>
: :
<Group owner={owner} projectsId={projectsId} newGroupId={newGroupId}/> <Group setAddOperation={setAddOperation} owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
} }
</div> </div>
</WhiteBack> </WhiteBack>

View File

@ -10,7 +10,7 @@ const roles = {
read: "报告者", read: "报告者",
}; };
const limit = 15; const limit = 15;
function CollaboratorGroup({ newGroupId, owner, projectsId }) { function CollaboratorGroup({ newGroupId, owner, projectsId , setAddOperation }) {
const [list, setList] = useState(undefined); const [list, setList] = useState(undefined);
const [isSpin, setIsSpin] = useState(true); const [isSpin, setIsSpin] = useState(true);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
@ -34,6 +34,7 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
setList(result.data.teams); setList(result.data.teams);
setTotal(result.data.total_count); setTotal(result.data.total_count);
setIsSpin(false); setIsSpin(false);
setAddOperation(result.data.can_add);
} }
}) })
.catch((error) => {}); .catch((error) => {});
@ -47,16 +48,15 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
// //
function addGroup(id) { function addGroup(id) {
const url = `/${owner}/${projectsId}/teams.json`; const url = `/${owner}/${projectsId}/teams.json`;
axios axios.post(url, {
.post(url, { team_id: id,
team_id: id, })
}) .then((result) => {
.then((result) => { if (result && result.data) {
if (result && result.data) { getData();
getData(); }
} })
}) .catch((error) => {});
.catch((error) => {});
} }
// //
@ -77,7 +77,11 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
title: "团队名", title: "团队名",
dataIndex: "name", dataIndex: "name",
render: (value, item) => { render: (value, item) => {
return <Link to={`/organize/${owner}/group/${item.id}`}>{value}</Link>; if(item.is_admin || item.is_member){
return <Link to={`/organize/${owner}/group/${item.id}`}>{value}</Link>;
}else{
return <span>{value}</span>;
}
}, },
}, },
{ {

View File

@ -80,7 +80,7 @@ export default Form.create()(
[], [],
<Input type="password" /> <Input type="password" />
)} )}
<p className="font-12 mt10 pb15" style={{borderBottom:"1px solid #eee"}}>推送创建删除分支事件白名单支持匹配符如果为空或者 *所有分支的事件均被触发<br/>语法参见 <Link to="github.com/gobwas/glob" className="color-blue" target="_blank">github.com/gobwas/glob</Link> 示例 Master, ${'{master,release*}'}</p> <p className="font-12 mt10 pb15" style={{borderBottom:"1px solid #eee"}}>推送创建删除分支事件白名单支持匹配符如果为空或者 *所有分支的事件均被触发<br/>语法参见 <a href="http://github.com/gobwas/glob" className="color-blue" target="_blank">github.com/gobwas/glob</a> 示例 Master, ${'{master,release*}'}</p>
{helper( {helper(
"", "",
"active", "active",

View File

@ -14,8 +14,9 @@ const menu = [
{name:"代码库",index:"code"}, {name:"代码库",index:"code"},
{name:"易修 (Issue)",index:"issues"}, {name:"易修 (Issue)",index:"issues"},
{name:"合并请求",index:"pulls"}, {name:"合并请求",index:"pulls"},
{name:"Wiki",index:"wiki"},
{name:"工作流(beta版)",index:"devops"}, {name:"工作流(beta版)",index:"devops"},
{name:"资源库",index:"resources"}, // {name:"资源库",index:"resources"},
{name:"里程碑",index:"versions"}, {name:"里程碑",index:"versions"},
{name:"动态",index:"activity"}, {name:"动态",index:"activity"},
] ]

View File

@ -302,7 +302,7 @@ function New({ form , match , showNotification , history }) {
<Form.Item <Form.Item
label="分支过滤" label="分支过滤"
className="topLine" className="topLine"
help={<span>推送创建删除分支事件的分支白名单使用 glob 模式匹配指定若为空或 *则将报告所有分支的事件语法文档见<a href="github.com/gobwas/glob" target="_blank" className="hoverLine color-blue">github.com/gobwas/glob</a>示例master,{'{'}master,release*{'}'}</span>} help={<span>推送创建删除分支事件的分支白名单使用 glob 模式匹配指定若为空或 *则将报告所有分支的事件语法文档见<a href="http://github.com/gobwas/glob" target="_blank" className="hoverLine color-blue">github.com/gobwas/glob</a>示例master,{'{'}master,release*{'}'}</span>}
colon={false} colon={false}
style={{marginTop:'15px'}} style={{marginTop:'15px'}}
> >

View File

@ -24,21 +24,32 @@ export default Form.create()(
const [check_box, setCheckBox] = useState(false); const [check_box, setCheckBox] = useState(false);
const [switch_box, setSwtichBox] = useState([]); const [switch_box, setSwtichBox] = useState([]);
const [onwers, setOnwers] = useState(false); const [onwers, setOnwers] = useState(false);
const [auth, setAuth] = useState("");
const [ descNum , setDescNum ] = useState(0); const [ descNum , setDescNum ] = useState(0);
const [switch_box_code, setSwtichBoxCode] = useState(false); const [switch_box_code, setSwtichBoxCode] = useState(false);
const [switch_box_pull, setSwtichBoxPull] = useState(false); const [switch_box_pull, setSwtichBoxPull] = useState(false);
const [switch_box_issue, setSwtichBoxIssue] = useState(false); const [switch_box_issue, setSwtichBoxIssue] = useState(false);
const [switch_box_release, setSwtichBoxRelease] = useState(false); const [switch_box_release, setSwtichBoxRelease] = useState(false);
const [switch_box_wiki, setSwtichBoxWiki] = useState(false);
const { getFieldDecorator, validateFields, setFieldsValue } = form; const { getFieldDecorator, validateFields, setFieldsValue } = form;
const { OIdentifier, groupId } = match.params; const { OIdentifier, groupId } = match.params;
useEffect(()=>{
setFieldsValue({
authorize:"read",
includes_all_project:0
})
},[])
useEffect(() => { useEffect(() => {
if (GroupDetail) { if (GroupDetail) {
setOnwers(GroupDetail.authorize === "owner"); setOnwers(GroupDetail.authorize === "owner");
setAuth(GroupDetail.authorize);
setCheckBox(GroupDetail.can_create_org_project) setCheckBox(GroupDetail.can_create_org_project)
setSwtichBox(GroupDetail.units) setSwtichBox(GroupDetail.units)
setFieldsValue({ setFieldsValue({
...GroupDetail ...GroupDetail,
includes_all_project:GroupDetail.includes_all_project ? 1 :0
}) })
setDescNum(GroupDetail.description ? GroupDetail.description.length : 0); setDescNum(GroupDetail.description ? GroupDetail.description.length : 0);
} }
@ -50,6 +61,7 @@ export default Form.create()(
setSwtichBoxPull(switch_checked("pulls")) setSwtichBoxPull(switch_checked("pulls"))
setSwtichBoxIssue(switch_checked("issues")) setSwtichBoxIssue(switch_checked("issues"))
setSwtichBoxRelease(switch_checked("releases")) setSwtichBoxRelease(switch_checked("releases"))
setSwtichBoxWiki(switch_checked("wiki"))
} }
}, [switch_box]) }, [switch_box])
@ -68,11 +80,13 @@ export default Form.create()(
setIsSpin(true) setIsSpin(true)
validateFields((error, values) => { validateFields((error, values) => {
if (!error) { if (!error) {
values.unit_types = switch_box // values.unit_types = switch_box
values.unit_types = ['code','pulls','issues','releases','wiki'];
if (groupId) { // if (groupId) { //
const url = `/organizations/${OIdentifier}/teams/${groupId}.json`; const url = `/organizations/${OIdentifier}/teams/${groupId}.json`;
axios.put(url, { axios.put(url, {
...values ...values,
includes_all_project:values.includes_all_project === 1?true:false
}).then(result => { }).then(result => {
if (result && result.data) { if (result && result.data) {
showNotification("基本设置更新成功!"); showNotification("基本设置更新成功!");
@ -82,7 +96,8 @@ export default Form.create()(
} else { } else {
const url = `/organizations/${OIdentifier}/teams.json`; const url = `/organizations/${OIdentifier}/teams.json`;
axios.post(url, { axios.post(url, {
...values ...values,
includes_all_project:values.includes_all_project === 1?true:false
}).then(result => { }).then(result => {
if (result && result.data) { if (result && result.data) {
showNotification("团队创建成功!"); showNotification("团队创建成功!");
@ -132,6 +147,11 @@ export default Form.create()(
setSwtichBoxRelease(checked) setSwtichBoxRelease(checked)
} }
function switch_wiki_types(checked, event) {
switch_unit_types(checked, "wiki");
setSwtichBoxWiki(checked);
}
function cancelEdit(){ function cancelEdit(){
if(groupId){ if(groupId){
history.push(`/organize/${OIdentifier}/group/${groupId}`); history.push(`/organize/${OIdentifier}/group/${groupId}`);
@ -140,6 +160,9 @@ export default Form.create()(
} }
} }
function changeAuth(params) {
setAuth(params.target.value)
}
function checkname(rule, value, callback){ function checkname(rule, value, callback){
if(!value){ if(!value){
@ -192,8 +215,8 @@ export default Form.create()(
"includes_all_project", "includes_all_project",
[], [],
<Radio.Group> <Radio.Group>
<Radio value={false} style={addStyle}>指定项目<span className="color-grey-8 ml10">(团队成员将只能访问添加到团队的项目 选择此项 <span className="color-grey-3">将不会</span> 自动删除已经添加的项目)</span></Radio> <Radio value={0} style={addStyle}>指定项目<span className="color-grey-8 ml10">(团队成员将只能访问添加到团队的项目 选择此项 <span className="color-grey-3">将不会</span> 自动删除已经添加的项目)</span></Radio>
<Radio value={true} style={OptionStyle}>所有项目<span className="color-grey-8 ml10">(团队可以访问所有项目选择此选项将 <span className="color-grey-3">添加所有现有的</span> 项目到指定团队)</span></Radio> <Radio value={1} style={OptionStyle}>所有项目<span className="color-grey-8 ml10">(团队可以访问所有项目选择此选项将 <span className="color-grey-3">添加所有现有的</span> 项目到指定团队)</span></Radio>
</Radio.Group>, false, 0,onwers ? "hide":"" </Radio.Group>, false, 0,onwers ? "hide":""
)} )}
{helper( {helper(
@ -202,37 +225,42 @@ export default Form.create()(
[], [],
<Checkbox checked={check_box} onChange={change_check_box_status} style={OptionStyle}>新建项目<span className="color-grey-8 ml10">(成员可以在组织中新建项目创建者将自动获得新建的项目的管理员权限)</span></Checkbox>, false, 20,onwers ? "hide":"" <Checkbox checked={check_box} onChange={change_check_box_status} style={OptionStyle}>新建项目<span className="color-grey-8 ml10">(成员可以在组织中新建项目创建者将自动获得新建的项目的管理员权限)</span></Checkbox>, false, 20,onwers ? "hide":""
)} )}
{/* {helper( {helper(
'版本库权限:', '版本库权限:',
"authorize", "authorize",
[], [],
<Radio.Group> <Radio.Group onChange={changeAuth}>
<Radio value="read" style={addStyle}>读取权限<span className="color-grey-8 ml10">(成员可以查看和克隆团队项目)</span></Radio> <Radio value="read" style={addStyle}>读取权限<span className="color-grey-8 ml10">(成员可以查看和克隆团队项目)</span></Radio>
<Radio value="write" style={addStyle}>写入权限<span className="color-grey-8 ml10">(成员可以查看和推送提交到团队项目)</span></Radio> <Radio value="write" style={addStyle}>写入权限<span className="color-grey-8 ml10">(成员可以查看和推送提交到团队项目)</span></Radio>
<Radio value="admin" style={OptionStyle}>管理员权限<span className="color-grey-8 ml10">(成员可以拉取和推送到团队项目同时可以添加协作者)</span></Radio> <Radio value="admin" style={OptionStyle}>管理员权限<span className="color-grey-8 ml10">(成员可以拉取和推送到团队项目同时可以添加协作者)</span></Radio>
</Radio.Group>, false, 20,onwers ? "hide":"" </Radio.Group>, false, 20,onwers ? "hide":""
)} */} )}
</Form> </Form>
{/* <p className="required">访</p> {/* <div className={(auth!=="owner" && auth !=="admin") ? "" :"hide"}>
<AlignCenter className="mb10"> <p className="required">允许访问项目单元</p>
<Switch checked={switch_box_code} onClick={switch_code_types} /> <AlignCenter className="mb10">
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码文件提交和分支)</span></span> <Switch checked={switch_box_code} onClick={switch_code_types} />
</AlignCenter> <span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码文件提交和分支)</span></span>
<AlignCenter className="mb10"> </AlignCenter>
<Switch checked={switch_box_issue} onClick={switch_issue_types} /> <AlignCenter className="mb10">
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告任务和里程碑)</span></span> <Switch checked={switch_box_issue} onClick={switch_issue_types} />
</AlignCenter> <span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告任务和里程碑)</span></span>
<AlignCenter className="mb10"> </AlignCenter>
<Switch checked={switch_box_pull} onClick={switch_pull_types} /> <AlignCenter className="mb10">
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span> <Switch checked={switch_box_pull} onClick={switch_pull_types} />
</AlignCenter> <span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
<AlignCenter className="mb20"> </AlignCenter>
<Switch checked={switch_box_release} onClick={switch_releas_types} /> <AlignCenter className="mb10">
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span> <Switch checked={switch_box_release} onClick={switch_releas_types} />
</AlignCenter> <span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
*/} </AlignCenter>
<AlignCenter className="mb20">
<Switch checked={switch_box_wiki} onClick={switch_wiki_types} />
<span className="ml30 color-grey-3">wiki<span className="color-grey-8 ml15">(编辑此仓库的相关文档说明)</span></span>
</AlignCenter>
</div> */}
<Button type={"primary"} onClick={saveGroupFrom}>{groupId ? "更新团队设置" : "新建团队"}</Button> <Button type={"primary"} onClick={saveGroupFrom}>{groupId ? "更新团队设置" : "新建团队"}</Button>
<Cancel className="ml30" onClick={() => cancelEdit()}><span className="pl30 pr30">取消</span></Cancel> <Cancel className="ml30" onClick={() => cancelEdit()}><span>取消</span></Cancel>
</Div> </Div>
</WhiteBack> </WhiteBack>
</Spin> </Spin>

View File

@ -368,5 +368,5 @@
} }
} }
.hide{ .hide{
display: hidden; display: none;
} }

View File

@ -75,7 +75,7 @@ function List(props){
<Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/> <Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/>
</div> </div>
<p> <p>
{ organizeDetail && organizeDetail.is_admin ? { organizeDetail && organizeDetail.can_create_project ?
<Sort menu={menu_new}> <Sort menu={menu_new}>
<a className="addBtn mr30">+&nbsp;新建项目</a> <a className="addBtn mr30">+&nbsp;新建项目</a>
</Sort> </Sort>

View File

@ -97,7 +97,12 @@ function RightBox({ OIdentifier , history , admin }) {
return( return(
<div className="teammembers" key={key}> <div className="teammembers" key={key}>
<div> <div>
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link> {
(item.is_admin || item.is_member) ?
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
:
<ColorListName>{item.name}</ColorListName>
}
<Align> <Align>
<Span>{item.num_users}名成员</Span> <Span>{item.num_users}名成员</Span>
<Span>{item.num_projects}个仓库</Span> <Span>{item.num_projects}个仓库</Span>

View File

@ -168,7 +168,7 @@ export default Form.create()(
'权限:', '权限:',
"repo_admin_change_team_access", "repo_admin_change_team_access",
[], [],
<Checkbox style={radioStyle}>仓库管理员可以添加或移除团队的访问权限</Checkbox>,false,true <Checkbox style={radioStyle}>项目管理员可以添加或移除团队的访问权限</Checkbox>,false,true
)} )}
<Divider/> <Divider/>
{helper( {helper(

View File

@ -75,7 +75,12 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
return( return(
<div key={key}> <div key={key}>
<p className="g-head"> <p className="g-head">
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link> {
(item.is_admin || item.is_member) ?
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
:
<span className="color-grey-3 font-16">{item.nickname}</span>
}
<span> <span>
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>} { item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>} { item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}

223
src/forge/Wiki/EditWiki.jsx Normal file
View File

@ -0,0 +1,223 @@
import React, { useEffect, useCallback, useState } from 'react';
import { Button, Checkbox, Form, Icon, Radio, Input, message } from 'antd';
import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor";
import DelModal from './components/ModalFun';
import { weekModal, monthModal } from './components/config';
import { getWiki, wikiPages, addWiki, updateWiki } from './api';
import './Index.scss';
export default Form.create()(({ form, history, showNotification, projectDetail, match, project }) => {
// const permission = projectDetail && projectDetail.permission !== "Reporter";
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
const { getFieldDecorator, validateFields, setFieldsValue } = form;
const [fileArrInit, setFileArrInit] = useState(null);
let projectsId = match.params.projectsId;
let owner = match.params.owner;
let wikiName = history.location.pathname.split('/').pop();
if (wikiName === 'add') {
wikiName = '';
}
const [content, setContent] = useState(undefined);
const [modal, setModal] = useState(false);
const [modalType, setModalType] = useState();
useEffect(() => {
wikiName && project && getWiki({
owner,
repo: projectsId,
pagename: wikiName,
projectId: project.id
}).then(res => {
if (res && res.data) {
setContent(res.data.md_content);
setFieldsValue({
name: res.data.name,
content: res.data.md_content,
});
}
});
}, [owner, wikiName]);
// wiki
useEffect(() => {
project && wikiPages({
owner: owner,
repo: projectsId,
projectId: project.id
}).then(res => {
if (res && res.message === "200" && Array.isArray(res.data)) {
setFileArrInit(res.data);
} else {
setFileArrInit([]);
}
});
}, [project]);
const helper = useCallback(
(label, name, rules, widget, initialValue, rightComponent) => (
<Form.Item label={label} className="mb0">
{getFieldDecorator(name, { rules, initialValue, validateFirst: true, })(widget)}
{rightComponent}
</Form.Item>
), []);
function onContentChange(value) {
setContent(value);
setFieldsValue({
content: value
});
};
// wiki
function saveFile() {
validateFields((err, values) => {
if (!err) {
let regEn = /[\[\]`\/:*?''<>|%-+_]/g;
if (regEn.test(values.name)) {
message.error('文件名不能有特殊字符');
return;
}
if (wikiName) {
updateWiki({
owner,
repo: projectsId,
projectId: project.id,
pagename: wikiName,
...values,
commit_message: '',
}).then(res => dealRes(res));
} else {
if (Array.isArray(fileArrInit)) {
for (const item of fileArrInit) {
if (item.name === values.name) {
message.error('不能与已有文件标题相同');
return false;
}
}
}
addWiki({
owner,
repo: projectsId,
projectId: project.id,
pagename: values.name,
...values,
commit_message: '',
}).then(res => dealRes(res));
}
}
})
}
function dealRes(res) {
if (res && res.message === "200") {
showNotification("操作成功");
goBack();
} else if (res && res.message === "500") {
message.error('请检查格式是否正确或文件名是否重复');
} else {
showNotification(res.message || "操作失败");
}
}
function goBack() {
history.push(`/projects/${owner}/${projectsId}/wiki`);
}
function changeModal(e) {
setModal(e.target.checked);
if (!e.target.checked) {
setModalType();
}
}
function changeModalType(e) {
let value = e.target.value;
if (!content) {
setModalContent(value);
return;
}
DelModal({
title: '添加模版',
contentTitle: `您确定要添加“${value}”模板吗`,
content: `此操作会将“${value}”模板替换编辑栏内所有内容,请确认以防文件的丢失`,
okText: '确认添加',
onOk: () => {
setModalType(value);
setModal(true);
setModalContent(value);
}
});
}
function setModalContent(value) {
if (value === '周报') {
setContent(weekModal);
setFieldsValue({
content: weekModal
});
} else if (value === '月报') {
setContent(monthModal);
setFieldsValue({
content: monthModal
});
}
}
return (
<div className="wiki-main">
<div className="wiki-head">
<span className="head-title"><span className="back-wiki" onClick={goBack}>Wiki</span> <Icon type="right" /> 编辑页面</span>
</div>
<div >
<h4 className="mt20 mb0">标题</h4>
{helper(
"",
"name",
[
{ required: true, message: "请输入标题" },
// { pattern: /[^`\[\]\/:*?''<>|%-+_]/g, message: '' }
],
<Input
placeholder={"请输入标题"}
className="contact-input"
maxLength={50}
/>
)}
<Form.Item className="mb0">
<MDEditor
placeholder={"请输入wiki内容"}
height={500}
mdID={"order-new-description"}
initValue={content}
onChange={onContentChange}
className="mt20"
></MDEditor>
{getFieldDecorator('content', {
rules: [{ required: true, message: "请输入wiki内容" }],
validateFirst: true
})(<Input style={{ display: 'none' }} />)}
</Form.Item>
<Checkbox checked={modal} onChange={changeModal}>添加模版</Checkbox>
<Radio.Group onChange={changeModalType} value={modalType}>
<Radio value='周报'>周报</Radio>
<Radio value='月报'>月报</Radio>
</Radio.Group>
</div>
{permission && <Button className="mt25" type="primary" onClick={saveFile}>保存</Button>}
</div>
)
})

283
src/forge/Wiki/Index.jsx Normal file
View File

@ -0,0 +1,283 @@
import React, { useEffect, useCallback, useState } from 'react';
import { Button, Dropdown, Icon, Input, Menu, Tooltip, Select, Upload, message, Spin } from 'antd';
import { getImageUrl, timeAgo } from 'educoder';
import cookie from 'react-cookies';
import CopyTool from '../Component/CopyTool';
import DelModal from './components/ModalFun';
import Welcome from './Welcome';
import { wikiPages, getWiki, deleteWiki } from './api';
import { httpUrl, TokenKey } from './fetch';
import './Index.scss';
import { isArray } from 'lodash';
const Search = Input.Search;
const InputGroup = Input.Group;
const { Option } = Select;
export default (props) => {
const { match, history, showNotification, project, projectDetail } = props;
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
let projectsId = match.params.projectsId;
let owner = match.params.owner;
const [fileArrInit, setFileArrInit] = useState(null);
const [checkItem, setCheckItem] = useState({});
const [itemDetail, setItemDetail] = useState({});
const [fileArr, setFileArr] = useState([]);
const [reload, setReload] = useState();
const [urlType, setUrlType] = useState('HTTPS');
// wiki
useEffect(() => {
project && wikiPages({
owner: owner,
repo: projectsId,
projectId: project.id
}).then(res => {
if (res && res.message === "200" && isArray(res.data)) {
setFileArr(res.data);
setFileArrInit(res.data);
if (res.data.length) {
setCheckItem(res.data[0]);
};
} else {
setFileArr([]);
setFileArrInit([]);
}
});
}, [project, reload])
// wiki
useEffect(() => {
project && checkItem.name && getWiki({
owner: owner,
repo: projectsId,
pagename: checkItem.name,
projectId: project.id
}).then(res => {
if (res && res.message === "200") {
setItemDetail(res.data);
} else {
showNotification("加载失败")
}
});
}, [project, checkItem]);
function changeSearchValue(e) {
let value = e.target.value;
let newFileArr = [];
for (const item of fileArrInit) {
if (item.name.indexOf(value) > -1) {
newFileArr.push(item);
}
}
setFileArr(newFileArr);
}
// wiki
function deleteFileModal(e, item) {
e.stopPropagation();
DelModal({
title: '删除页面',
contentTitle: `您确定要删除“${item.name}”此页面吗?`,
content: '此操作将删除该页面,请进行确认以防文件的丢失',
onOk: () => {
deleteWiki({
owner: owner,
repo: projectsId,
pagename: item.name,
projectId: project.id
}).then(res => {
if (res && res.message === "200") {
message.success('删除成功');
setReload(Math.random());
} else {
message.error('删除失败');
}
});
}
});
}
function goUser(login) {
window.location.href = `/users/${login}`;
}
function addFile() {
history.push(`/projects/${owner}/${projectsId}/wiki/add`);
}
function goEdit() {
history.push(`/projects/${owner}/${projectsId}/wiki/edit/${encodeURI(checkItem.name)}`);
}
function preview() {
window.open(`/projects/${owner}/${projectsId}/wiki/preview/${encodeURI(project.name)}/${project.id}`);
}
// MarkdownHtmlPdf
const menu = (
<Menu >
<Menu.Item key="1" onClick={() => { downloadWiki('markdown') }}>
Markdown
</Menu.Item>
<Menu.Item key="2" onClick={() => { downloadWiki('html') }}>
HTML
</Menu.Item>
<Menu.Item key="3" onClick={() => { downloadWiki('pdf') }}>
PDF
</Menu.Item>
</Menu>
);
function downloadWiki(type) {
window.open(`${httpUrl}/api/wikiExport/wikiExport-wrapper?repoName=${projectsId}&owner=${owner}&type=${type}&projectName=${project.name}&projectId=${project.id}`);
}
function beforeUpload(file) {
if (!['md', 'txt'].includes(file.name.split('.').pop())) {
message.error('只能上传md、txt文件');
return false;
}
let regEn = /[\[\]`\/:*?''<>|%-+_]/g;
if (regEn.test(file.name)) {
message.error('文件名不能有特殊字符');
return;
}
for (const item of fileArrInit) {
if (item.name === file.name) {
message.error('不能上传与已有文件相同文件名的文件');
return false;
}
}
const isLt100M = file.size / 1024 / 1024 < 100;
if (!isLt100M) {
showNotification(`文件大小必须小于${100}MB!`);
}
return isLt100M;
}
const uploadProps = {
name: 'multipartFile',
withCredentials: true,
action: `${httpUrl}/api/wikiExport/uploadWiki/${owner}/${projectsId}/${project && project.id}`, //?token=${sessionStorage.taskToken}
showUploadList: false,
headers: {
Authorization: cookie.load(TokenKey) || sessionStorage.taskToken,
},
beforeUpload: beforeUpload,
onChange(info) {
if (info.file.status === 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
if (info.file.response.message === '200') {
message.success(`${info.file.name} 上传成功`);
setReload(Math.random());
} else if (info.file.response.message === '500') {
let data = JSON.parse(info.file.response.data);
message.error(data && data.message ? data.message : '文件上传失败');
} else {
message.error('文件上传失败');
}
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败`);
}
},
};
return (
< Spin spinning={!fileArrInit} className="opacitySpin">
{fileArrInit && fileArrInit.length ?
<div className="wiki-main">
<div className="wiki-head">
<span className="head-title">
{
permission ?
<Button type="default" onClick={addFile}><Icon type="plus" />新增页面</Button>
: "Wiki文档"
}
</span>
<div>
{
permission &&
<Upload {...uploadProps}>
<Tooltip placement="top" title={'支持导入txt、markdown格式文件'}>
<Button type="default" className="ml10"><Icon type="plus" />导入模板</Button>
</Tooltip>
</Upload>
}
<Dropdown overlay={menu}>
<Button type="default" className="ml10">导出<Icon type="caret-down" /></Button>
</Dropdown>
<Button type="default" className="ml10" onClick={preview}>预览</Button>
</div>
</div>
<div className="wiki-body">
<div className="wiki-nav-parent">
<div className="wiki-nav">
<Search
// allowClear
placeholder="输入关键字搜索文件"
className="wiki-search"
onChange={changeSearchValue}
/>
{
fileArr.map(item => {
return <div className="wiki-nav-title-parent" key={item.name}>
<div className={`wiki-nav-title ${item.name === checkItem.name ? 'active' : ''}`} onClick={() => { setCheckItem(item) }}>
<div className="nav-title-left">
<i className="iconfont icon-wenjianjia2 mr3"></i>
<span className="nav-title-left-text">{item.name}</span>
</div>
{permission && <i className="iconfont icon-shanchuicon1 delete-title-icon color-grey-6" onClick={(e) => { deleteFileModal(e, item) }}></i>}
</div>
</div>
})
}
</div>
{checkItem.wiki_clone_link && <InputGroup className="copy-url" compact>
<Select dropdownClassName="wiki-url-type" defaultValue="HTTPS" onChange={(v) => { setUrlType(v) }}>
<Option value="HTTPS">HTTPS</Option>
<Option value="SSH">SSH</Option>
</Select>
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
<CopyTool className="copy-wiki" inputId="wikiUrl" />
</InputGroup>}
</div>
<div className="wiki-content">
<div className="wiki-content-head">
<div className="wiki-content-head-left">
<h3 className="wiki-detail-title">{checkItem.name}</h3>
<span className="user-box mr10" onClick={() => { checkItem.commit && goUser(checkItem.commit.author.name) }}>
{itemDetail.image_url && <img alt="头像" className="head-log-small" src={getImageUrl(`/${itemDetail.image_url}`)} />}
<span >{itemDetail.userName}</span>
</span>
<span className="time-ago">上次修改于{checkItem.commit ? timeAgo(checkItem.commit.author.when):'刚刚'}</span>
</div>
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
</div>
<div className="wiki-content-detail editor-content-panel markdown-body" dangerouslySetInnerHTML={{ __html: itemDetail && itemDetail.simple_content }} ></div>
</div>
</div>
</div >
:
<Welcome {...props} reloadList={setReload} />
}
</Spin>
)
}

381
src/forge/Wiki/Index.scss Normal file
View File

@ -0,0 +1,381 @@
$wikiColor: #466aff;
$primaryBtnHover: #6482ff;
body {
width: 100% !important;
}
.ant-spin-nested-loading > div > .ant-spin.opacitySpin{
max-height: 100vh;
background: rgba(255,255,255,1);
}
.wiki-main {
width: 1200px;
min-height: 400px;
margin: 20px auto;
.ant-btn-primary {
background-color: $wikiColor;
border-color: $wikiColor;
&:hover,
&:focus,
&:active {
background-color: $primaryBtnHover;
}
}
.ant-btn-default:hover,
.ant-btn-default:active,
.ant-btn-default:focus {
background: #f3f4f6;
color: #333;
border-color: #d0d0d0;
}
.wiki-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
height: 64px;
background: #fafcff;
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.13);
border-radius: 4px;
border-bottom-left-radius: 0;
.ant-btn .anticon {
margin: 0 -3px 0 0;
}
}
.head-title {
font-size: 20px;
color: #05101a;
line-height: 30px;
font-weight: 500;
.anticon-right {
color: #666;
font-size: 0.9rem;
}
}
.back-wiki {
color: $wikiColor;
cursor: pointer;
&:hover {
color: $primaryBtnHover;
}
}
.head-log-middle {
width: 3rem;
height: 3rem;
margin-right: 0.35rem;
border-radius: 50%;
}
.head-log-small {
width: 1.25rem;
height: 1.25rem;
margin-right: 0.35rem;
border-radius: 50%;
}
.user-box {
font-size: 12px;
font-family: "PingFangSC-Medium";
color: $wikiColor;
cursor: pointer;
&:hover {
color: $primaryBtnHover;
}
.head-log-small {
position: relative;
top: -2px;
}
}
.time-ago {
font-size: 12px;
color: #333;
letter-spacing: 0;
line-height: 17px;
font-weight: 400;
font-family: "PingFangSC-Regular";
}
.has-error .ant-form-explain,
.has-error .ant-form-split {
position: absolute;
}
.wiki-nav {
max-height: 60vh;
.wiki-search {
padding: 0 14px;
.ant-input {
padding-left: 30px;
}
.ant-input-suffix {
left: 26px;
right: auto;
}
&:hover .ant-input,
&:focus .ant-input {
border-color: $wikiColor !important;
}
}
}
.wiki-nav-parent {
width: 260px;
flex: none;
}
.ant-form-item-children .ant-input:hover {
border-color: $wikiColor !important;
}
.ant-checkbox-checked .ant-checkbox-inner {
background-color: $wikiColor;
border-color: $wikiColor;
}
.ant-radio-checked .ant-radio-inner,
.ant-radio-checked::after {
border-color: $wikiColor;
}
.ant-radio-inner::after {
background-color: $wikiColor;
}
.ant-radio-group {
display: block;
margin: 10px 0 0 30px;
}
.ant-radio-wrapper:hover .ant-radio,
.ant-radio:hover .ant-radio-inner,
.ant-radio-input:focus + .ant-radio-inner {
border-color: $wikiColor;
}
}
#wikiUrl:focus {
border-right: 1px solid #d9d9d9 !important;
}
.wiki-body {
display: flex;
}
.wiki-content {
flex: auto;
width: 75%;
}
.wiki-content-detail {
padding: 0 20px;
word-break: break-all;
}
.ant-input-group.ant-input-group-compact.copy-url {
display: flex;
margin-top: 20px;
.ant-select-selection__rendered {
margin: 0 14px 0 5px;
width: 3rem;
font-size: 12px;
}
.ant-select-arrow {
right: 4px;
}
.ant-input {
font-size: 12px;
font-family: "PingFangSC-Regular";
color: #666;
letter-spacing: 0;
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
.copy-wiki {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 5px;
background: #fff;
font-size: 1rem !important;
border: 1px solid #d9d9d9;
border-left: 0;
color: $wikiColor;
cursor: pointer;
}
}
.wiki-url-type {
.ant-select-dropdown-menu-item {
font-size: 12px;
}
}
.wiki-nav {
min-height: 300px;
padding: 20px 0;
background: #ffffff;
border: 1px solid rgba(153, 153, 153, 0.22);
overflow-y: scroll;
flex: none;
color: #333;
}
.wiki-nav-title {
display: flex;
justify-content: space-between;
align-items: center;
height: 50px;
padding: 0 10px 0 10px;
font-size: 14px;
letter-spacing: 0;
font-weight: 400;
font-family: "PingFangSC-Regular";
border-bottom: 1px solid #eee;
line-height: 16px;
cursor: pointer;
.delete-title-icon {
display: none;
}
&:hover {
background-color: #fbfbfb;
.delete-title-icon {
display: inline-block;
}
}
}
.wiki-nav-title-parent {
padding: 0 14px;
&:hover {
background: #fbfbfb;
}
}
.wiki-nav-title.active {
color: $wikiColor;
}
.wiki-content-head {
margin: 20px 0 20px 20px;
padding: 0 20px 20px 0;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #eee;
}
.wiki-content-head-left {
width: 90%;
}
.nav-title-left {
display: inline-flex;
max-width: 90%;
svg {
margin-right: 0.5rem;
flex: none;
}
.nav-title-left-text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.wiki-detail-title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
// 预览页面样式文件
.wiki-preview {
overflow-y: scroll;
height: 100%;
.wiki-body {
width: 90%;
}
.ant-btn-primary {
background-color: $wikiColor;
border-color: $wikiColor;
&:hover,
&:focus,
&:active {
background-color: $primaryBtnHover;
}
}
.preview-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 12rem 0 2rem;
width: 100%;
height: 80px;
background: rgb(39, 47, 76);
color: #fff;
}
.preview-head-left {
display: inline-flex;
align-items: center;
font-size: 24px;
cursor: pointer;
.icon-wendangyulan_icon {
font-size: 24px !important;
font-weight: 700;
}
}
.preview-head-right {
display: flex;
.copy-url {
margin-top: 0;
}
.copy-desc {
width: 6rem;
padding-top: 1px;
}
}
.wiki-nav-title {
padding: 0 10px 0 40px;
}
.wiki-nav-title.active {
background-color: #f3f4f6;
}
.wiki-content-head {
padding: 10px 20px 10px 20px;
}
.wiki-nav {
padding: 20px 0;
width: 20vw;
border-bottom: 0;
height: 80vh;
}
.wiki-content-detail {
padding: 0 40px;
img {
max-width: 100%;
}
}
.ant-btn:hover {
background: #f3f4f6;
color: #333;
border-color: #d0d0d0;
}
}

146
src/forge/Wiki/Preview.jsx Normal file
View File

@ -0,0 +1,146 @@
import React, { useEffect, useCallback, useState } from 'react';
import { Input, Button, Select, Dropdown, Icon, Menu, message } from 'antd';
import CopyTool from '../Component/CopyTool';
import { wikiPages, getWiki, } from './api';
import { httpUrl } from './fetch';
import './Index.scss';
const InputGroup = Input.Group;
const { Option } = Select;
export default (props) => {
const { match, history, showNotification, project, projectDetail } = props;
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
let projectsId = match.params.projectsId;
let owner = match.params.owner;
let projectName = match.params.projectName;
let projectId = match.params.projectId;
console.log('projectName:');
console.log(projectName);
const [checkItem, setCheckItem] = useState({});
const [itemDetail, setItemDetail] = useState({});
const [fileArr, setFileArr] = useState([]);
const [urlType, setUrlType] = useState('HTTPS');
useEffect(() => {
projectsId && wikiPages({
owner: owner,
repo: projectsId,
projectId: projectId,
}).then(res => {
if (res && res.message === "200") {
setFileArr(res.data);
if (res.data.length) {
setCheckItem(res.data[0]);
};
} else {
showNotification("加载失败")
}
});
}, [project])
useEffect(() => {
projectsId && checkItem.name && getWiki({
owner: owner,
repo: projectsId,
pagename: checkItem.name,
projectId: projectId,
}).then(res => {
if (res && res.message === "200") {
setItemDetail(res.data);
} else {
showNotification("加载失败")
}
});
}, [project, checkItem]);
function goEdit() {
history.push(`/projects/${owner}/${projectsId}/wiki/edit/${checkItem.name}`);
}
function goBack() {
history.push(`/projects/${owner}/${projectsId}/wiki`);
}
// MarkdownHtmlPdf
const menu = (
<Menu >
<Menu.Item key="1" onClick={() => { downloadWiki('markdown') }}>
Markdown
</Menu.Item>
<Menu.Item key="2" onClick={() => { downloadWiki('html') }}>
HTML
</Menu.Item>
<Menu.Item key="3" onClick={() => { downloadWiki('pdf') }}>
PDF
</Menu.Item>
</Menu>
);
function downloadWiki(type) {
window.open(`${httpUrl}/api/wikiExport/wikiExport-wrapper?repoName=${projectsId}&owner=${owner}&type=${type}&projectName=${projectName}&projectId=${projectId}`);
}
return (
<div className="wiki-preview">
<div className="preview-head">
<div className="preview-head-left" onClick={goBack}>
<i className="iconfont icon-wendangyulan_icon mr3"></i>
<span className="ml10">{projectName}</span>
</div>
<div className="preview-head-right">
<span className="copy-desc">克隆地址</span>
{
checkItem.wiki_clone_link && <InputGroup className="copy-url" compact>
<Select dropdownClassName="wiki-url-type" defaultValue="HTTPS" onChange={(v) => { console.log(v); setUrlType(v) }}>
<Option value="HTTPS">HTTPS</Option>
<Option value="SSH">SSH</Option>
</Select>
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
<CopyTool className="copy-wiki" inputId="wikiUrl"/>
</InputGroup>
}
<Dropdown overlay={menu}>
<Button className="ml10">导出<Icon type="caret-down" /></Button>
</Dropdown>
</div>
</div>
<div className="wiki-body">
<div className="wiki-nav">
{
fileArr.map(item => {
return <div className={`${item.name === checkItem.name ? 'active' : ''} wiki-nav-title`} key={item.name} onClick={() => { setCheckItem(item) }}>
<span className="nav-title-left" >
<i className="iconfont icon-wenjianjia2 mr3"></i>
<span className="nav-title-left-text">{item.name}</span>
</span>
</div>
})
}
</div>
<div className="wiki-content">
<div className="wiki-content-head">
<h3>{checkItem.name}</h3>
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
</div>
<div className="wiki-content-detail editor-content-panel markdown-body" dangerouslySetInnerHTML={{ __html: itemDetail && itemDetail.simple_content }} ></div>
</div>
</div>
</div>
)
}

View File

@ -0,0 +1,50 @@
import React from 'react';
import { Button } from 'antd';
// import { addWiki } from '../api';
import './index.scss';
export default ({ project, isManager, history, showNotification, match, reloadList }) => {
let projectsId = match.params.projectsId;
let owner = match.params.owner;
// function addFile() {
// addWiki({
// owner,
// repo: projectsId,
// pagename: 'Home',
// name: 'Home',
// content: 'Welcome to the wiki!',
// commit_message: '',
// }).then(res => {
// if (res.message === "200") {
// reloadList(Math.random());
// showNotification("");
// } else {
// showNotification("");
// }
// });
// }
function addFile() {
history.push(`/projects/${owner}/${projectsId}/wiki/add`);
}
return (
<div className="welcome-main">
<i className="iconfont icon-huanying_icon" ></i>
<p className="welcome-title">欢迎使用&nbsp;
<span className="wiki-title">
{project && project.name}
</span>
&nbsp;Wiki</p>
<p className="welcome-content">Wiki主要是您项目的产品设计文档描述注释等等</p>
<div className="wiki-line"></div>
{
isManager ? <Button type="primary" onClick={addFile}>创建Wiki文档</Button>
: <p className="welcome-des">该项目暂时没有创建Wiki</p>
}
</div>
)
}

View File

@ -0,0 +1,55 @@
.welcome-main {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
width: 1200px;
min-height: 400px;
padding: 20px;
margin: 20px auto;
background: rgba(250, 252, 255, 1);
font-family: "PingFangSC-Medium";
border-radius: 4px;
border: 1px solid rgba(42, 97, 255, 0.23);
.icon-huanying_icon {
font-size: 48px !important;
font-weight: 700;
}
.welcome-title {
display: inline-flex;
align-items: center;
margin: 10px 0;
font-size: 26px;
color: #333333;
font-weight: 500;
}
.wiki-title {
display: inline-block;
max-width: 20em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.welcome-content {
font-size: 14px;
color: #333333;
font-weight: 400;
}
.wiki-line {
margin: 50px 0 40px;
width: 400px;
height: 1px;
background: #eeeeee;
}
.welcome-des {
font-size: 16px;
color: #333333;
font-weight: 500;
}
}

48
src/forge/Wiki/api.js Normal file
View File

@ -0,0 +1,48 @@
import fetch from './fetch';
// import { notification } from 'antd';
// 获取wiki列表
export function wikiPages(params) {
return fetch({
url: '/api/wiki/wikiPages',
method: 'get',
params
});
}
// 获取单个wiki
export function getWiki(params) {
return fetch({
url: '/api/wiki/getWiki',
method: 'get',
params
});
}
//新增wiki
export function addWiki(data) {
return fetch({
url: '/api/wiki/createWiki',
method: 'post',
data: data
});
}
//更新wiki
export function updateWiki(data) {
return fetch({
url: '/api/wiki/updateWiki',
method: 'PUT',
data: data
});
}
//删除wiki
export function deleteWiki(data) {
return fetch({
url: '/api/wiki/deleteWiki',
method: 'DELETE',
data,
});
}

View File

@ -0,0 +1,244 @@
import * as React from 'react';
import classNames from 'classnames';
import { Icon, Tree } from 'antd';
import omit from 'omit.js';
import debounce from 'lodash/debounce';
import { conductExpandParent, convertTreeToEntities } from 'rc-tree/lib/util';
import { polyfill } from 'react-lifecycles-compat';
import { ConfigConsumer } from '../../../../../node_modules/antd/lib/config-provider';
import {
calcRangeKeys,
getFullKeyList,
convertDirectoryKeysToNodes,
getFullKeyListByTreeData,
} from '../../../../../node_modules/antd/lib/tree/util';
import { FolderSvg, FolderExpandSvg, FileSvg } from '../../Svg';
import './index.scss';
function getIcon(props) {
// console.log(props);
// console.log(props.expanded);
const { isLeaf, expanded ,selected} = props;
if (isLeaf) {
return <FileSvg color={selected ? "#2A61FF" : "#666"}/>;
}
return expanded ? <FolderExpandSvg color={"#666"}/> : <FolderSvg color={"#666"} />
// return <FolderSvg color={expanded ? "#2A61FF" : "#666"} />
}
class DirectoryTree extends React.Component {
static defaultProps = {
showIcon: true,
expandAction: 'click',
};
static getDerivedStateFromProps(nextProps) {
const newState = {};
if ('expandedKeys' in nextProps) {
newState.expandedKeys = nextProps.expandedKeys;
}
if ('selectedKeys' in nextProps) {
newState.selectedKeys = nextProps.selectedKeys;
}
return newState;
}
// state: DirectoryTreeState;
// tree: Tree;
// onDebounceExpand: (event: React.MouseEvent<HTMLElement>, node: AntTreeNode) => void;
// Shift click usage
// lastSelectedKey?: string;
// cachedSelectedKeys?: string[];
constructor(props) {
super(props);
const {
defaultExpandAll,
defaultExpandParent,
expandedKeys,
defaultExpandedKeys,
children,
} = props;
const { keyEntities } = convertTreeToEntities(children);
// Selected keys
this.state = {
selectedKeys: props.selectedKeys || props.defaultSelectedKeys || [],
};
// Expanded keys
if (defaultExpandAll) {
if (props.treeData) {
this.state.expandedKeys = getFullKeyListByTreeData(props.treeData);
} else {
this.state.expandedKeys = getFullKeyList(props.children);
}
} else if (defaultExpandParent) {
this.state.expandedKeys = conductExpandParent(
expandedKeys || defaultExpandedKeys,
keyEntities,
);
} else {
this.state.expandedKeys = expandedKeys || defaultExpandedKeys;
}
this.onDebounceExpand = debounce(this.expandFolderNode, 200, {
leading: true,
});
}
onExpand = (expandedKeys, info) => {
const { onExpand } = this.props;
this.setUncontrolledState({ expandedKeys });
// Call origin function
if (onExpand) {
return onExpand(expandedKeys, info);
}
return undefined;
};
onClick = (event, node) => {
const { onClick, expandAction } = this.props;
// Expand the tree
if (expandAction === 'click') {
this.onDebounceExpand(event, node);
}
if (onClick) {
onClick(event, node);
}
};
onDoubleClick = (event, node) => {
const { onDoubleClick, expandAction } = this.props;
// Expand the tree
if (expandAction === 'doubleClick') {
this.onDebounceExpand(event, node);
}
if (onDoubleClick) {
onDoubleClick(event, node);
}
};
onSelect = (keys, event) => {
const { onSelect, multiple, children } = this.props;
const { expandedKeys = [] } = this.state;
const { node, nativeEvent } = event;
const { eventKey = '' } = node.props;
const newState = {};
// We need wrap this event since some value is not same
const newEvent = {
...event,
selected: true, // Directory selected always true
};
// Windows / Mac single pick
const ctrlPick = nativeEvent.ctrlKey || nativeEvent.metaKey;
const shiftPick = nativeEvent.shiftKey;
// Generate new selected keys
let newSelectedKeys;
if (multiple && ctrlPick) {
// Control click
newSelectedKeys = keys;
this.lastSelectedKey = eventKey;
this.cachedSelectedKeys = newSelectedKeys;
newEvent.selectedNodes = convertDirectoryKeysToNodes(children, newSelectedKeys);
} else if (multiple && shiftPick) {
// Shift click
newSelectedKeys = Array.from(
new Set([
...(this.cachedSelectedKeys || []),
...calcRangeKeys(children, expandedKeys, eventKey, this.lastSelectedKey),
]),
);
newEvent.selectedNodes = convertDirectoryKeysToNodes(children, newSelectedKeys);
} else {
// Single click
newSelectedKeys = [eventKey];
this.lastSelectedKey = eventKey;
this.cachedSelectedKeys = newSelectedKeys;
newEvent.selectedNodes = [event.node];
}
newState.selectedKeys = newSelectedKeys;
if (onSelect) {
onSelect(newSelectedKeys, newEvent);
}
this.setUncontrolledState(newState);
};
setTreeRef = (node) => {
this.tree = node;
};
expandFolderNode = (event, node) => {
const { isLeaf } = node.props;
if (isLeaf || event.shiftKey || event.metaKey || event.ctrlKey) {
return;
}
// Get internal rc-tree
const internalTree = this.tree.tree;
// Call internal rc-tree expand function
// https://github.com/ant-design/ant-design/issues/12567
internalTree.onNodeExpand(event, node);
};
setUncontrolledState = (state) => {
const newState = omit(state, Object.keys(this.props));
if (Object.keys(newState).length) {
this.setState(newState);
}
};
renderDirectoryTree = ({ getPrefixCls }) => {
const { prefixCls: customizePrefixCls, className, ...props } = this.props;
const { expandedKeys, selectedKeys } = this.state;
const prefixCls = getPrefixCls('tree', customizePrefixCls);
const connectClassName = classNames(`${prefixCls}-directory`, className);
return (
<Tree
icon={getIcon}
ref={this.setTreeRef}
{...props}
prefixCls={prefixCls}
className={connectClassName}
expandedKeys={expandedKeys}
selectedKeys={selectedKeys}
onSelect={this.onSelect}
onClick={this.onClick}
onDoubleClick={this.onDoubleClick}
onExpand={this.onExpand}
/>
);
};
render() {
return <ConfigConsumer>{this.renderDirectoryTree}</ConfigConsumer>;
}
}
polyfill(DirectoryTree);
export default DirectoryTree;

View File

@ -0,0 +1,61 @@
.hide-file-icon.ant-tree.ant-tree-directory {
li span.ant-tree-switcher {
display: none !important;
}
// li[role="treeitem"]:hover > span.ant-tree-switcher,
// li.ant-tree-treenode-selected > span.ant-tree-switcher {
// z-index: 1000;
// display: inline-block !important;
// }
.ant-tree-node-content-wrapper{
display: inline-flex;
width: 100%;
}
.tree-title-icon{
display: none;
}
.ant-tree-node-content-wrapper:hover .tree-title-icon{
transition: all 0.3s;
display: inline-block;
}
&.ant-tree.ant-tree-directory
> li.ant-tree-treenode-selected
> span.ant-tree-node-content-wrapper::before,
&.ant-tree.ant-tree-directory
.ant-tree-child-tree
> li.ant-tree-treenode-selected
> span.ant-tree-node-content-wrapper::before {
background: #fff;
margin-top: -3px;
}
&.ant-tree.ant-tree-directory > li span.ant-tree-node-content-wrapper::before,
&.ant-tree.ant-tree-directory
.ant-tree-child-tree
> li
span.ant-tree-node-content-wrapper::before {
margin-top: -3px;
}
> li span.ant-tree-node-content-wrapper.ant-tree-node-selected,
.ant-tree-child-tree
> li
span.ant-tree-node-content-wrapper.ant-tree-node-selected {
color: #2a61ff;
}
.ant-tree-title{
display: inline-flex;
justify-content:space-between;
flex: auto;
}
}

View File

@ -0,0 +1,40 @@
import React, { useState } from 'react';
import * as ReactDOM from 'react-dom';
import LoginDialog from '../../../../modules/login/LoginDialog';
// 使
export default function Login(props) {
const div = document.createElement('div');
document.body.appendChild(div);
function destroy() {
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
div.parentNode.removeChild(div);
}
}
function render() {
setTimeout(() => {
ReactDOM.render(
<MyLoginDialog afterClose={destroy} />
,
div,
);
});
}
render();
}
function MyLoginDialog({afterClose}) {
const [isRender, setIsRender] = useState(true);
return (
<LoginDialog
isRender={isRender}
Modifyloginvalue={() => {setIsRender(false);afterClose()}}
/>
)
}

View File

@ -0,0 +1,117 @@
/* eslint-disable react/jsx-no-duplicate-props */
import React, { useState } from 'react';
import * as ReactDOM from 'react-dom';
import { Modal, Button } from 'antd';
import './index.scss';
InitModal.defaultProps = {
okText: '确认', //
cancelText: '取消', //
className: '', //
inputId: 'copyText', //ID
};
// 使
export default function DelModal(props) {
renderModal({ ...props, type: 'delete' })
}
// 使
export function Confirm(props) {
renderModal({ ...props, type: 'confirm' })
}
function renderModal(props) {
const { type, afterClose } = props;
const div = document.createElement('div');
document.body.appendChild(div);
function destroy() {
afterClose && afterClose();
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
div.parentNode.removeChild(div);
}
}
function modalType(type) {
if (type === 'delete') {
return <InitModal
title="删除"
contentTitle="确定要删除吗?"
okText="确认删除"
{...props}
afterClose={destroy}
contentTitle={<React.Fragment>
<i className="red-circle iconfont icon-shanchu_tc_icon mr3"></i>
{props.contentTitle}
</React.Fragment>}
/>
} else if (type === 'confirm') {
return <InitModal title="选择" afterClose={destroy} {...props} />
} else {
return <InitModal title="选择" afterClose={destroy} {...props} />
}
}
function render() {
setTimeout(() => {
ReactDOM.render(
modalType(type),
div,
);
});
}
render();
}
//
function InitModal({
onCancel,
onOk,
title,
contentTitle,
content,
okText,
cancelText,
afterClose,
className,
}) {
const [visible, setVisible] = useState(true);
function onCancelModal() {
setVisible(false);
onCancel && onCancel()
}
function onSuccess() {
setVisible(false);
onOk && onOk();
}
return (
<Modal
visible={visible}
onCancel={onCancelModal}
afterClose={afterClose}
title={title}
className={`myself-modal ${className}`}
centered
footer={[
<Button type="default" key="back" onClick={onCancelModal}>
{cancelText}
</Button>,
<Button className="foot-submit" key="submit" onClick={onSuccess}>
{okText}
</Button>,
]}
>
<div>
{contentTitle && <p className="content-title">{contentTitle}</p>}
<p className="content-descibe">{content}</p>
</div>
</Modal>
)
}

View File

@ -0,0 +1,63 @@
.myself-modal {
.ant-modal-header {
padding: 9px 24px;
background: #f8f8f8;
border-bottom: 1px solid #eee;
}
.ant-modal-title {
text-align: left;
}
.ant-modal-close {
top: 0px !important;
}
.ant-modal-close-x {
font-size: 24px;
}
.ant-modal-body {
text-align: center;
}
.content-title {
display: flex;
justify-content: center;
align-items: center;
margin: 2rem 0 1rem !important;
font-size: 16px;
color: #333;
letter-spacing: 0;
line-height: 29px;
font-weight: 400;
}
.red-circle {
align-self: flex-start;
color: #ca0002;
font-size: 1.5rem !important;
}
.content-descibe {
font-size: 14px;
color: #666;
line-height: 33px;
font-weight: 400;
}
.ant-modal-footer {
padding: 2rem 0;
text-align: center;
border: 0;
.ant-btn {
width: 6rem;
}
}
.foot-submit {
margin-left: 3rem;
color: #df0002;
&:hover {
border-color: #df0002;
}
}
.ant-btn-default:hover,
.ant-btn-default:active,
.ant-btn-default:focus {
background: #f3f4f6;
color: #333;
border-color: #d0d0d0;
}
}

View File

@ -0,0 +1,29 @@
import { httpUrl } from '../fetch';
export const editorConfig = {
placeholder: '请输入',
uploadImgServer: httpUrl + '/busiAttachments/upload',
uploadFileName: 'file',
uploadImgHeaders: {
'X-Requested-With': 'XMLHttpRequest'
},
excludeMenus: [
'list',
'todo',
'emoticon',
'video'
],
uploadImgHooks: {
// 图片上传并返回了结果,想要自己把图片插入到编辑器中
customInsert: function (insertImgFn, result) {
// insertImgFn 可把图片插入到编辑器,传入图片 src ,执行函数即可
if (result && result.data && result.data.id) {
insertImgFn(`${httpUrl}/busiAttachments/view/${result.data.id}`);
}
}
},
}
export const weekModal="| 工作项目 | 本周工作计划 | 本周完成情况 |下周计划 | 待协同事项 |\n| ------------ | ------------ | ------------ | ------------ | ------------ |\n| | | | | |\n| | | | | |\n| | | | | |\n| | | | | |\n\n 备注:";
export const monthModal="|工作项目 | 工作内容 | 项目进度情况 | 问题列表及解决方案| 下月工作计划 | 遗留未解决的问题 |\n| ------------ | ------------ | ------------ | ------------ | ------------ | ------------ |\n| | | | | | |\n| | | | | | |\n| | | | | | |\n| | | | | | |\n\n 月度总结:";

106
src/forge/Wiki/fetch.js Normal file
View File

@ -0,0 +1,106 @@
import { notification ,message} from 'antd';
import axios from 'axios';
import cookie from 'react-cookies';
import Login from './components/Login';
let actionUrl = '';
if (window.location.href.indexOf('localhost') > -1) {
// actionUrl = 'http://117.50.100.12:8008';
// actionUrl = 'http://192.168.31.74:8081';
actionUrl = "https://test-search.trustie.net";
} else if(window.location.href.indexOf('testforgeplus')>-1){
actionUrl = "https://test-search.trustie.net";
// actionUrl = 'https://testforgeplus.trustie.net';
axios.defaults.withCredentials = true;
}else if (window.location.href.indexOf('forgeplus') > -1) {
actionUrl = "https://wiki-api.trustie.net";
axios.defaults.withCredentials = true;
}
export const httpUrl = actionUrl;
export const TokenKey = 'autologin_trustie';
// 创建axios实例
const service = axios.create({
baseURL: httpUrl,
timeout: 10000, // 请求超时时间
});
// request拦截器
service.interceptors.request.use(config => {
if (cookie.load(TokenKey)) {
console.log(cookie.load(TokenKey));
config.headers['Authorization'] = cookie.load(TokenKey); // 让每个请求携带自定义token 请根据实际情况自行修改
}
if (window.location.port === "3007") {
// 模拟token为登录用户
const taskToken = sessionStorage.taskToken;
if (config.url.indexOf('?') === -1) {
config.url = `${config.url}?token=${taskToken}`;
} else {
config.url = `${config.url}&token=${taskToken}`;
}
}
return config;
}, error => {
// Do something with request error
console.log(error); // for debug
// Promise.reject(error);
});
// respone拦截器
service.interceptors.response.use(
response => {
const res = response||{};
if (res.status === 400) {
message.error(res.data.message || '操作失败');
return Promise.reject('error');
}
if (res.status === 401) {
message.error(res.data.message || '登录信息已过期');
return Promise.reject('error');
}
if (res.status === 403) {
message.error(res.data.message || '无权限!');
return Promise.reject('error');
}
if (res.status === 40001) {
notification.open({
message: "提示",
description: '账户或密码错误!',
});
return Promise.reject('error');
}
if (response.status !== 200 && res.status !== 200) {
notification.open({
message: "提示",
description: res.message,
});
} else {
return response.data;
}
},
error => {
console.log(error);
let res = error.response||{};
if (res.status === 400) {
message.error(res.data.message || '操作失败');
return Promise.reject('error');
}
if (res.status === 401) {
message.error(res.data.message || '登录信息已过期');
Login();
return Promise.reject('error');
}
if (res.status === 403) {
message.error(res.data.message || '无权限!');
return Promise.reject('error');
}
notification.open({
message: "提示",
description: error.message,
});
return Promise.reject(error);
}
);
export default service;

View File

@ -5,6 +5,7 @@ import Search from '../Component/Search';
import Item from './Team-item'; import Item from './Team-item';
import Nodata from '../Nodata'; import Nodata from '../Nodata';
import axios from 'axios'; import axios from 'axios';
import { Link } from 'react-router-dom';
const limit = 15; const limit = 15;
function Team(props){ function Team(props){
@ -14,7 +15,7 @@ function Team(props){
const [ sort_direction , setSort_direction ] = useState("asc"); const [ sort_direction , setSort_direction ] = useState("asc");
const [ sort_by ,setSort_by ] = useState("created_at"); const [ sort_by ,setSort_by ] = useState("created_at");
const [ search ,setSearch ] = useState(undefined); const [ search ,setSearch ] = useState(undefined);
const { checkIfLogin , showLoginDialog } = props;
const { username } = props.match.params; const { username } = props.match.params;
useEffect(()=>{ useEffect(()=>{
if(username){ if(username){
@ -47,14 +48,6 @@ function Team(props){
</Menu> </Menu>
) )
function newFunc() {
const { checkIfLogin , showLoginDialog } = props;
if(checkIfLogin()){
props.history.push(`/organize/new`);
}else{
showLoginDialog && showLoginDialog();
}
}
return( return(
<div> <div>
<div className="headerbox"> <div className="headerbox">
@ -62,7 +55,10 @@ function Team(props){
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/> <Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
</div> </div>
<p> <p>
<a onClick={newFunc}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</a> {
checkIfLogin() &&
<Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>
}
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a> <a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
</Dropdown> </Dropdown>