├── .babelrc ├── .gitignore ├── LICENSE ├── README.md ├── client ├── common │ ├── externals │ │ ├── ts-helpers.js │ │ └── ts-helpers.ts │ ├── libs │ │ ├── css │ │ │ ├── config.css │ │ │ ├── config.less │ │ │ ├── formConfig.less │ │ │ ├── pintuer.bak.css │ │ │ └── pintuer.css │ │ ├── fonts │ │ │ ├── font_1463992151_360388.ttf │ │ │ ├── font_1463992151_360388.woff │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── images │ │ │ ├── 404-error.png │ │ │ ├── 500-error.png │ │ │ ├── Thumbs.db │ │ │ ├── alert.png │ │ │ ├── blog │ │ │ │ ├── blog-avatar-2.jpg │ │ │ │ ├── blog-avatar.jpg │ │ │ │ ├── blog-sm-img.jpg │ │ │ │ ├── blog-thumb-2.jpg │ │ │ │ ├── blog-thumb-3.jpg │ │ │ │ ├── blog-wide-img.jpg │ │ │ │ ├── image2.jpg │ │ │ │ └── image3.jpg │ │ │ ├── details_close.png │ │ │ ├── details_open.png │ │ │ ├── error.png │ │ │ ├── favicon.ico │ │ │ ├── favicon1.ico │ │ │ ├── input-spinner.gif │ │ │ ├── lockscreen-bg.jpg │ │ │ ├── login-bg.jpg │ │ │ ├── logo.bak.png │ │ │ ├── logo.png │ │ │ ├── logos.png │ │ │ ├── minus.png │ │ │ ├── photos │ │ │ │ ├── user2.png │ │ │ │ ├── user3.png │ │ │ │ └── user4.png │ │ │ ├── plus-white.png │ │ │ └── plus.png │ │ └── ueditor │ │ │ ├── themes │ │ │ ├── default │ │ │ │ ├── css │ │ │ │ │ ├── ueditor.css │ │ │ │ │ └── ueditor.min.css │ │ │ │ ├── dialogbase.css │ │ │ │ └── images │ │ │ │ │ ├── anchor.gif │ │ │ │ │ ├── arrow.png │ │ │ │ │ ├── arrow_down.png │ │ │ │ │ ├── arrow_up.png │ │ │ │ │ ├── button-bg.gif │ │ │ │ │ ├── cancelbutton.gif │ │ │ │ │ ├── charts.png │ │ │ │ │ ├── cursor_h.gif │ │ │ │ │ ├── cursor_h.png │ │ │ │ │ ├── cursor_v.gif │ │ │ │ │ ├── cursor_v.png │ │ │ │ │ ├── dialog-title-bg.png │ │ │ │ │ ├── filescan.png │ │ │ │ │ ├── highlighted.gif │ │ │ │ │ ├── icons-all.gif │ │ │ │ │ ├── icons.gif │ │ │ │ │ ├── icons.png │ │ │ │ │ ├── loaderror.png │ │ │ │ │ ├── loading.gif │ │ │ │ │ ├── lock.gif │ │ │ │ │ ├── neweditor-tab-bg.png │ │ │ │ │ ├── pagebreak.gif │ │ │ │ │ ├── scale.png │ │ │ │ │ ├── sortable.png │ │ │ │ │ ├── spacer.gif │ │ │ │ │ ├── sparator_v.png │ │ │ │ │ ├── table-cell-align.png │ │ │ │ │ ├── tangram-colorpicker.png │ │ │ │ │ ├── toolbar_bg.png │ │ │ │ │ ├── unhighlighted.gif │ │ │ │ │ ├── upload.png │ │ │ │ │ ├── videologo.gif │ │ │ │ │ ├── word.gif │ │ │ │ │ └── wordpaste.png │ │ │ └── iframe.css │ │ │ ├── ueditor.all.min.js │ │ │ ├── ueditor.config.js │ │ │ └── zh-cn.js │ └── service │ │ ├── userService.js │ │ └── userService.ts ├── public │ ├── css │ │ ├── config.less │ │ ├── weui_font.less │ │ └── weui_icon_font.less │ └── img │ │ ├── 1481469229.png │ │ ├── add.png │ │ ├── collect.png │ │ ├── collect_select.png │ │ ├── collect_yes.png │ │ ├── drug_ico.png │ │ ├── more_right.png │ │ ├── package.png │ │ ├── radio-checked.png │ │ └── search.png └── src │ ├── api │ ├── blog │ │ ├── blogService.js │ │ └── blogService.ts │ ├── menu │ │ ├── menuService.js │ │ └── menuService.ts │ └── user │ │ ├── userManageService.js │ │ └── userManageService.ts │ ├── component │ ├── abstract │ │ ├── CreateFormComponent.js │ │ ├── CreateFormComponent.tsx │ │ ├── FilterPropsComponent.js │ │ ├── FilterPropsComponent.tsx │ │ ├── GenericComponent.js │ │ └── GenericComponent.tsx │ ├── common │ │ ├── ControlComponent.js │ │ ├── ControlComponent.tsx │ │ ├── Icon.js │ │ ├── Icon.tsx │ │ ├── Mask.js │ │ ├── Mask.tsx │ │ ├── Modal.js │ │ ├── Modal.ts │ │ ├── NotFound.js │ │ ├── NotFound.tsx │ │ ├── PageProgress.js │ │ ├── PageProgress.tsx │ │ ├── PageToast.js │ │ ├── PageToast.tsx │ │ ├── SMessage.js │ │ ├── SMessage.ts │ │ ├── SModal.js │ │ ├── SModal.ts │ │ ├── TablePageContainer.js │ │ ├── TablePageContainer.tsx │ │ ├── Toast.js │ │ ├── Toast.tsx │ │ ├── Tombstone.js │ │ ├── Tombstone.ts │ │ ├── VButton.js │ │ ├── VButton.tsx │ │ ├── VDatePicker.js │ │ ├── VDatePicker.tsx │ │ ├── VInput.js │ │ ├── VInput.tsx │ │ ├── VModal.js │ │ ├── VModal.tsx │ │ ├── VMonthPicker.js │ │ ├── VMonthPicker.tsx │ │ ├── VRangePicker.js │ │ ├── VRangePicker.tsx │ │ ├── VUeditor.js │ │ ├── VUeditor.tsx │ │ ├── VUpload.js │ │ ├── VUpload.tsx │ │ ├── VUploadBottonStyle.js │ │ ├── VUploadBottonStyle.tsx │ │ └── css │ │ │ ├── VModal.less │ │ │ ├── VUpload.less │ │ │ ├── errorPage.less │ │ │ ├── mask.less │ │ │ └── toast.less │ ├── form │ │ ├── Captcha.js │ │ ├── Captcha.tsx │ │ ├── CreateFormFactory.js │ │ ├── CreateFormFactory.tsx │ │ ├── FormControls.js │ │ ├── FormControls.tsx │ │ ├── FormDatePicker.js │ │ ├── FormDatePicker.tsx │ │ ├── FormEditor.js │ │ ├── FormEditor.tsx │ │ ├── FormInput.js │ │ ├── FormInput.tsx │ │ ├── FormPassWordInput.js │ │ ├── FormPassWordInput.js.map │ │ ├── FormPassWordInput.tsx │ │ ├── FormSelect.js │ │ ├── FormSelect.tsx │ │ ├── FormSubmitButton.js │ │ ├── FormSubmitButton.tsx │ │ ├── FormUpload.js │ │ ├── FormUpload.tsx │ │ ├── OldCreateFormFactory.js │ │ ├── OldCreateFormFactory.tsx │ │ ├── OldVFormInput.js │ │ ├── OldVFormInput.js.map │ │ ├── OldVFormInput.tsx │ │ ├── VCascader.js │ │ └── VCascader.tsx │ ├── ico │ │ ├── ICon.js │ │ └── ICon.tsx │ ├── layout │ │ ├── VCol.js │ │ ├── VCol.tsx │ │ ├── VRow.js │ │ └── VRow.tsx │ ├── menu │ │ ├── LeftNavMenu.js │ │ ├── LeftNavMenu.tsx │ │ ├── TopNavMenu.js │ │ └── TopNavMenu.tsx │ ├── modal │ │ ├── ModalMessage.js │ │ └── ModalMessage.tsx │ ├── regist │ │ ├── RegistSubmitFormIndex.js │ │ └── RegistSubmitFormIndex.tsx │ ├── select │ │ ├── VOptGroup.js │ │ ├── VOption.js │ │ ├── VSelect.js │ │ └── VSelect.tsx │ └── table │ │ ├── BasicTable.js │ │ └── BasicTable.tsx │ ├── config │ ├── routeConfig.js │ └── routeConfig.tsx │ ├── container │ ├── admin │ │ ├── AdminManage.js │ │ ├── AdminManage.tsx │ │ ├── blog │ │ │ ├── CatePageManage.js │ │ │ ├── CatePageManage.tsx │ │ │ ├── CateTablePageContainer.js │ │ │ ├── CateTablePageContainer.tsx │ │ │ ├── ContentList.js │ │ │ ├── ContentList.tsx │ │ │ ├── ContentPageListContainer.js │ │ │ ├── ContentPageListContainer.tsx │ │ │ ├── EditCateModal.js │ │ │ ├── EditCateModal.tsx │ │ │ ├── EditContent.js │ │ │ ├── EditContent.tsx │ │ │ ├── TagPageManage.js │ │ │ ├── TagPageManage.tsx │ │ │ ├── css │ │ │ │ ├── cate.less │ │ │ │ └── content.less │ │ │ └── form │ │ │ │ ├── EditContentFormFilter.js │ │ │ │ ├── EditContentFormFilter.ts │ │ │ │ ├── editCateFormFilter.js │ │ │ │ └── editCateFormFilter.ts │ │ ├── menu │ │ │ ├── SetCurrentMenu.js │ │ │ └── SetCurrentMenu.tsx │ │ └── user │ │ │ ├── RegistComponent.bak.js │ │ │ ├── RegistComponent.bak.tsx │ │ │ ├── RegistUser.bak.js │ │ │ ├── RegistUser.bak.tsx │ │ │ ├── RegistUser.js │ │ │ ├── RegistUser.tsx │ │ │ ├── UserIndex.js │ │ │ ├── UserIndex.tsx │ │ │ ├── UserLogin.bak.js │ │ │ ├── UserLogin.bak.tsx │ │ │ ├── UserLogin.js │ │ │ ├── UserLogin.tsx │ │ │ ├── css │ │ │ ├── login.less │ │ │ └── regist.less │ │ │ └── form │ │ │ ├── loginFormFilter.js │ │ │ ├── loginFormFilter.ts │ │ │ ├── registFormFilter.js │ │ │ └── registFormFilter.ts │ └── common │ │ ├── App.js │ │ ├── App.tsx │ │ ├── Overview.js │ │ ├── Overview.tsx │ │ └── css │ │ └── Overview.css │ ├── index.html │ ├── index.js │ ├── index.tsx │ ├── model │ ├── blog │ │ ├── ContentEntity.js │ │ ├── ContentEntity.ts │ │ ├── cateTableEntity.js │ │ └── cateTableEntity.ts │ ├── common │ │ ├── commonResult.js │ │ ├── commonResult.ts │ │ ├── errorEntity.js │ │ ├── errorEntity.ts │ │ ├── successEntity.js │ │ └── successEntity.ts │ ├── menu │ │ ├── currentMenu.js │ │ └── currentMenu.ts │ ├── propsType.js │ ├── propsType.ts │ ├── user │ │ ├── VAuthEntity.js │ │ ├── VAuthEntity.ts │ │ ├── userLoginEntity.js │ │ └── userLoginEntity.ts │ ├── userRegistInfo.js │ ├── userRegistInfo.js.map │ └── userRegistInfo.ts │ ├── public │ └── css │ │ └── config.less │ ├── redux │ ├── actions │ │ ├── blog │ │ │ ├── blogIndex.js │ │ │ └── blogIndex.ts │ │ ├── menu │ │ │ ├── menuIndex.js │ │ │ └── menuIndex.ts │ │ ├── system │ │ │ ├── route.js │ │ │ ├── route.ts │ │ │ ├── routesPath.js │ │ │ └── routesPath.ts │ │ └── user │ │ │ ├── userIndex.js │ │ │ └── userIndex.ts │ └── reducers │ │ ├── blog │ │ ├── blogIndex.js │ │ └── blogIndex.ts │ │ ├── common │ │ ├── app.js │ │ └── app.ts │ │ ├── menu │ │ ├── menuIndex.js │ │ └── menuIndex.ts │ │ ├── rootReducer.js │ │ ├── rootReducer.ts │ │ └── user │ │ ├── userIndex.js │ │ └── userIndex.ts │ ├── store │ ├── configureStore.js │ ├── configureStore.ts │ ├── index.js │ └── index.ts │ ├── tsconfig.json │ ├── typings │ ├── antd │ │ └── antd.d.ts │ ├── bluebird │ │ └── bluebird.d.ts │ ├── body-parser │ │ └── body-parser.d.ts │ ├── chai │ │ └── chai.d.ts │ ├── classnames │ │ └── classnames.d.ts │ ├── cors │ │ └── cors.d.ts │ ├── custom-antd │ │ └── index.d.ts │ ├── errorhandler │ │ └── errorhandler.d.ts │ ├── es6-promise │ │ └── es6-promise.d.ts │ ├── express-serve-static-core │ │ └── express-serve-static-core.d.ts │ ├── express-timeout-handler │ │ └── index.d.ts │ ├── express │ │ └── express.d.ts │ ├── fastclick │ │ └── fastclick.d.ts │ ├── form-data │ │ └── form-data.d.ts │ ├── globals │ │ └── globals.d.ts │ ├── isomorphic-fetch │ │ └── isomorphic-fetch.d.ts │ ├── lodash │ │ └── lodash.d.ts │ ├── mime │ │ └── mime.d.ts │ ├── morgan │ │ └── morgan.d.ts │ ├── node-notifier │ │ └── node-notifier.d.ts │ ├── node │ │ └── node.d.ts │ ├── object-assign │ │ └── object-assign.d.ts │ ├── object-hash │ │ └── object-hash.d.ts │ ├── react-progress-2 │ │ └── index.d.ts │ ├── react-redux │ │ └── react-redux.d.ts │ ├── react-router-redux │ │ └── react-router-redux.d.ts │ ├── react-router │ │ ├── history.d.ts │ │ └── react-router.d.ts │ ├── react-tappable │ │ └── react-tappable.d.ts │ ├── react │ │ ├── react-addons-css-transition-group.d.ts │ │ ├── react-addons-transition-group.d.ts │ │ ├── react-dom.d.ts │ │ └── react.d.ts │ ├── redux-async-connect │ │ └── index.d.ts │ ├── redux-thunk │ │ └── redux-thunk.d.ts │ ├── redux │ │ └── redux.d.ts │ ├── request │ │ └── request.d.ts │ ├── serve-favicon │ │ └── serve-favicon.d.ts │ ├── serve-static │ │ └── serve-static.d.ts │ ├── source-map │ │ └── source-map.d.ts │ ├── superagent │ │ └── superagent.d.ts │ ├── tsd.d.ts │ ├── uglify-js │ │ └── uglify-js.d.ts │ └── webpack │ │ └── webpack.d.ts │ └── utils │ ├── EnumTool.js │ ├── EnumTool.ts │ ├── application.js │ ├── application.ts │ ├── cookie.js │ ├── cookie.ts │ ├── device.js │ ├── device.ts │ ├── fetchRequest.js │ ├── fetchRequest.ts │ ├── format.js │ ├── format.js.map │ ├── format.ts │ ├── general.js │ ├── general.ts │ ├── hash.js │ ├── hash.js.map │ ├── hash.ts │ ├── icon.js │ ├── icon.ts │ ├── logger.js │ ├── logger.ts │ ├── page.js │ ├── page.tsx │ ├── redux.js │ ├── redux.js.map │ ├── redux.ts │ ├── regex.js │ ├── regex.js.map │ ├── regex.ts │ ├── request.js │ ├── request.js.map │ ├── request.ts │ ├── requestFactory.js │ ├── requestFactory.ts │ ├── resources.js │ ├── resources.ts │ ├── route-state.js │ ├── route-state.js.map │ ├── route-state.ts │ ├── route.js │ ├── route.tsx │ ├── ueditor.js │ ├── ueditor.ts │ ├── userLoginCookie.js │ ├── userLoginCookie.ts │ ├── wexin.js │ └── wexin.ts ├── context.json ├── dominSite.config.js ├── dominSite.config.ts ├── favicon.ico ├── gif └── 3404488244.gif ├── npm-debug.log ├── npm-debug.log.2379601508 ├── package.json ├── server.js ├── server.ts ├── server ├── ResponseModel.js ├── ResponseModel.ts ├── api │ ├── Authorization │ │ ├── requireAuthorization.js │ │ └── requireAuthorization.ts │ └── user │ │ ├── blogControl.js │ │ ├── blogControl.ts │ │ ├── chkUserLogin.js │ │ ├── chkUserLogin.ts │ │ ├── login.js │ │ ├── login.ts │ │ ├── regist.js │ │ ├── regist.ts │ │ ├── registTest.js │ │ ├── registTest.ts │ │ ├── userControl.js │ │ └── userControl.ts ├── common │ ├── EnumTool.js │ ├── EnumTool.ts │ ├── ResponseTool.js │ ├── ResponseTool.ts │ ├── cookie.js │ ├── cookie.ts │ ├── cookieKey.js │ ├── cookieKey.ts │ ├── general.js │ ├── general.ts │ ├── keyMemberCK.js │ ├── keyMemberCK.ts │ ├── pageQueryHelper.js │ ├── pageQueryHelper.ts │ ├── stringTool.js │ ├── stringTool.ts │ ├── uuid.js │ └── uuid.ts ├── configs │ ├── bearcatConfig.js │ ├── bearcatConfig.ts │ ├── bundlerConfig.js │ ├── bundlerConfig.ts │ ├── error-parser.js │ ├── error-parser.ts │ ├── parserInit.js │ ├── parserInit.ts │ ├── server-config.js │ ├── server-config.ts │ ├── staticConfig.js │ ├── staticConfig.ts │ ├── timeout-parser.js │ ├── timeout-parser.ts │ ├── webpackInit.js │ ├── webpackInit.ts │ ├── whmConfig.js │ └── whmConfig.ts ├── dataBaseConnect.js ├── dataBaseConnect.ts ├── models │ ├── BlogCateEntity.js │ ├── BlogCateEntity.ts │ ├── ContentEntity.js │ ├── ContentEntity.ts │ ├── SysMenu.js │ ├── SysMenu.ts │ ├── UserInfo.js │ ├── UserInfo.ts │ ├── commonResult.js │ ├── commonResult.ts │ ├── pageListEntity.js │ └── pageListEntity.ts ├── mongoserver │ ├── BlogCateService.js │ ├── BlogCateService.ts │ ├── ContentService.js │ ├── ContentService.ts │ ├── SystemMenuService.js │ ├── SystemMenuService.ts │ ├── UserInfoServer.js │ ├── UserInfoServer.ts │ ├── UserInfoService.js │ ├── UserInfoService.ts │ └── beans.json ├── routes │ ├── AuthorizationInit.js │ ├── AuthorizationInit.ts │ ├── app.js │ ├── app.ts │ ├── bearcat.js │ ├── bearcat.ts │ ├── blogRouteInit.js │ ├── blogRouteInit.ts │ ├── error-handler.js │ ├── error-handler.ts │ ├── image-proxy.js │ ├── image-proxy.ts │ ├── index.js │ ├── index.ts │ ├── routeConfig.js │ ├── routeConfig.ts │ ├── routeInit.js │ ├── routeInit.ts │ ├── test.js │ └── test.ts ├── schema │ ├── BlogCateSchema.js │ ├── BlogCateSchema.ts │ ├── ContentSchema.js │ ├── ContentSchema.ts │ ├── SystemMenuSchema.js │ ├── SystemMenuSchema.ts │ ├── UserSchema.js │ ├── UserSchema.ts │ └── beans.json ├── server-config.json ├── serverConfigInit.js ├── serverConfigInit.ts ├── testServer │ ├── Car.js │ ├── CarFactory.js │ ├── CarFactory.ts │ ├── CarServer.js │ ├── CarServer.ts │ ├── aspect.js │ ├── beans.json │ ├── engine.js │ ├── find.js │ ├── insert.js │ ├── mongodb.js │ └── wheel.js └── upload │ └── blog │ ├── 1236979572000.png │ ├── 1464008202251.png │ └── out.png ├── tsconfig.json ├── tsd.json ├── typings ├── antd │ └── antd.d.ts ├── bluebird │ └── bluebird.d.ts ├── body-parser │ └── body-parser.d.ts ├── chai │ └── chai.d.ts ├── classnames │ └── classnames.d.ts ├── cookie-parser │ └── cookie-parser.d.ts ├── cors │ └── cors.d.ts ├── custom-antd │ └── index.d.ts ├── errorhandler │ └── errorhandler.d.ts ├── es6-promise │ └── es6-promise.d.ts ├── es6-shim │ └── es6-shim.d.ts ├── express-serve-static-core │ └── express-serve-static-core.d.ts ├── express-timeout-handler │ └── index.d.ts ├── express │ └── express.d.ts ├── fastclick │ └── fastclick.d.ts ├── form-data │ └── form-data.d.ts ├── globals │ └── globals.d.ts ├── isomorphic-fetch │ └── isomorphic-fetch.d.ts ├── lodash │ └── lodash.d.ts ├── mime │ └── mime.d.ts ├── morgan │ └── morgan.d.ts ├── node-notifier │ └── node-notifier.d.ts ├── node │ └── node.d.ts ├── object-assign │ └── object-assign.d.ts ├── object-hash │ └── object-hash.d.ts ├── react-progress-2 │ └── index.d.ts ├── react-redux │ └── react-redux.d.ts ├── react-router-redux │ └── react-router-redux.d.ts ├── react-router │ ├── history.d.ts │ └── react-router.d.ts ├── react-tappable │ └── react-tappable.d.ts ├── react │ ├── react-addons-css-transition-group.d.ts │ ├── react-addons-transition-group.d.ts │ ├── react-dom.d.ts │ └── react.d.ts ├── redux-thunk │ └── redux-thunk.d.ts ├── redux │ └── redux.d.ts ├── request │ └── request.d.ts ├── serve-favicon │ └── serve-favicon.d.ts ├── serve-static │ └── serve-static.d.ts ├── source-map │ └── source-map.d.ts ├── superagent │ └── superagent.d.ts ├── tsd.d.ts ├── uglify-js │ └── uglify-js.d.ts └── webpack │ └── webpack.d.ts ├── webpack-dev-server.js ├── webpack-dev-server.ts ├── webpack.config.js ├── webpack.config.ts ├── webpack.prod.config.js └── webpack.prod.config.ts /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "react", 5 | "stage-0" 6 | ], 7 | "plugins": [ 8 | 9 | [ 10 | "import", 11 | { 12 | "libraryName": "antd", 13 | "css": true, 14 | "style": true 15 | } 16 | ] 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ##git忽略 2 | #webstorm配置文件 3 | /.idea 4 | #编译文件 5 | /dist 6 | 7 | #参考例子 8 | /examples 9 | 10 | #外部包 11 | /node_modules 12 | 13 | #K+配置文件 14 | /k+.config.** 15 | 16 | #单元测试报告 17 | /__test__/reports 18 | 19 | #设计文件(由于git空间限制在100M) 20 | /__design__ 21 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 duanguang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-node-cms 2 | 这是一个简单的CMS Demo,前后端分离,前端 技术栈react+redux+antd,服务端使用nodejs,数据库mongodb,redux部分使用相当灵活,大多数痛点在此都有解决 3 | 4 | use:npm install 5 | 前端:npm run dev 6 |   服务端:npm run start 7 |   登录帐号:admin 密码:kad2015 8 | ![alt tag](/gif/3404488244.gif) 9 | -------------------------------------------------------------------------------- /client/common/libs/css/config.css: -------------------------------------------------------------------------------- 1 | /*********** screen配置 ***********/ 2 | .display-box-hor-justify { 3 | -moz-box-pack: justify; 4 | -webkit-box-pack: justify; 5 | -o-box-pack: justify; 6 | box-pack: justify; 7 | } 8 | -------------------------------------------------------------------------------- /client/common/libs/fonts/font_1463992151_360388.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/fonts/font_1463992151_360388.ttf -------------------------------------------------------------------------------- /client/common/libs/fonts/font_1463992151_360388.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/fonts/font_1463992151_360388.woff -------------------------------------------------------------------------------- /client/common/libs/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /client/common/libs/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /client/common/libs/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /client/common/libs/images/404-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/404-error.png -------------------------------------------------------------------------------- /client/common/libs/images/500-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/500-error.png -------------------------------------------------------------------------------- /client/common/libs/images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/Thumbs.db -------------------------------------------------------------------------------- /client/common/libs/images/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/alert.png -------------------------------------------------------------------------------- /client/common/libs/images/blog/blog-avatar-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/blog-avatar-2.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/blog-avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/blog-avatar.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/blog-sm-img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/blog-sm-img.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/blog-thumb-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/blog-thumb-2.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/blog-thumb-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/blog-thumb-3.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/blog-wide-img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/blog-wide-img.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/image2.jpg -------------------------------------------------------------------------------- /client/common/libs/images/blog/image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/blog/image3.jpg -------------------------------------------------------------------------------- /client/common/libs/images/details_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/details_close.png -------------------------------------------------------------------------------- /client/common/libs/images/details_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/details_open.png -------------------------------------------------------------------------------- /client/common/libs/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/error.png -------------------------------------------------------------------------------- /client/common/libs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/favicon.ico -------------------------------------------------------------------------------- /client/common/libs/images/favicon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/favicon1.ico -------------------------------------------------------------------------------- /client/common/libs/images/input-spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/input-spinner.gif -------------------------------------------------------------------------------- /client/common/libs/images/lockscreen-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/lockscreen-bg.jpg -------------------------------------------------------------------------------- /client/common/libs/images/login-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/login-bg.jpg -------------------------------------------------------------------------------- /client/common/libs/images/logo.bak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/logo.bak.png -------------------------------------------------------------------------------- /client/common/libs/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/logo.png -------------------------------------------------------------------------------- /client/common/libs/images/logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/logos.png -------------------------------------------------------------------------------- /client/common/libs/images/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/minus.png -------------------------------------------------------------------------------- /client/common/libs/images/photos/user2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/photos/user2.png -------------------------------------------------------------------------------- /client/common/libs/images/photos/user3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/photos/user3.png -------------------------------------------------------------------------------- /client/common/libs/images/photos/user4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/photos/user4.png -------------------------------------------------------------------------------- /client/common/libs/images/plus-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/plus-white.png -------------------------------------------------------------------------------- /client/common/libs/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/images/plus.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/anchor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/anchor.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/arrow.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/arrow_down.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/arrow_up.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/button-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/button-bg.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/cancelbutton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/cancelbutton.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/charts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/charts.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/cursor_h.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/cursor_h.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/cursor_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/cursor_h.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/cursor_v.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/cursor_v.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/cursor_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/cursor_v.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/dialog-title-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/dialog-title-bg.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/filescan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/filescan.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/highlighted.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/highlighted.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/icons-all.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/icons-all.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/icons.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/icons.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/loaderror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/loaderror.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/loading.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/lock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/lock.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/neweditor-tab-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/neweditor-tab-bg.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/pagebreak.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/pagebreak.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/scale.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/sortable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/sortable.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/spacer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/spacer.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/sparator_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/sparator_v.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/table-cell-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/table-cell-align.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/tangram-colorpicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/tangram-colorpicker.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/toolbar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/toolbar_bg.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/unhighlighted.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/unhighlighted.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/upload.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/videologo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/videologo.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/word.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/word.gif -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/default/images/wordpaste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/common/libs/ueditor/themes/default/images/wordpaste.png -------------------------------------------------------------------------------- /client/common/libs/ueditor/themes/iframe.css: -------------------------------------------------------------------------------- 1 | /*可以在这里添加你自己的css*/ 2 | -------------------------------------------------------------------------------- /client/common/service/userService.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/16. 3 | */ 4 | -------------------------------------------------------------------------------- /client/common/service/userService.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/16. 3 | */ 4 | -------------------------------------------------------------------------------- /client/public/img/1481469229.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/1481469229.png -------------------------------------------------------------------------------- /client/public/img/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/add.png -------------------------------------------------------------------------------- /client/public/img/collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/collect.png -------------------------------------------------------------------------------- /client/public/img/collect_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/collect_select.png -------------------------------------------------------------------------------- /client/public/img/collect_yes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/collect_yes.png -------------------------------------------------------------------------------- /client/public/img/drug_ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/drug_ico.png -------------------------------------------------------------------------------- /client/public/img/more_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/more_right.png -------------------------------------------------------------------------------- /client/public/img/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/package.png -------------------------------------------------------------------------------- /client/public/img/radio-checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/radio-checked.png -------------------------------------------------------------------------------- /client/public/img/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/client/public/img/search.png -------------------------------------------------------------------------------- /client/src/api/menu/menuService.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/17. 3 | */ 4 | export function getCurrentMenu(currentMenu) { 5 | return new Promise((resolve) => { 6 | resolve(currentMenu); 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /client/src/api/menu/menuService.ts: -------------------------------------------------------------------------------- 1 | import {CurrentMenu} from "../../model/menu/currentMenu"; 2 | import {resolve} from "url"; 3 | /** 4 | * Created by xiaoduan on 2016/11/17. 5 | */ 6 | 7 | export function getCurrentMenu(currentMenu:CurrentMenu){ 8 | return new Promise((resolve)=>{ 9 | resolve(currentMenu); 10 | }); 11 | } -------------------------------------------------------------------------------- /client/src/component/abstract/FilterPropsComponent.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | export default class FilterPropsComponent extends React.Component { 3 | getFilterProps() { 4 | let newProps = {}; 5 | for (let key in this.props) { 6 | const targetValue = this.props[key]; 7 | if (typeof targetValue != 'undefined' || key === 'value') { 8 | newProps[key] = targetValue; 9 | } 10 | } 11 | return newProps; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /client/src/component/abstract/FilterPropsComponent.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/12/2. 3 | */ 4 | import * as React from 'react'; 5 | export default class FilterPropsComponent extends React.Component{ 6 | protected getFilterProps() { 7 | let newProps = {} as Props; 8 | for (let key in this.props) { 9 | const targetValue = this.props[key]; 10 | if (typeof targetValue != 'undefined'||key==='value') { 11 | newProps[key] = targetValue; 12 | } 13 | } 14 | return newProps 15 | } 16 | } -------------------------------------------------------------------------------- /client/src/component/common/Icon.js: -------------------------------------------------------------------------------- 1 | import "../../../public/css/weui_icon_font.less"; 2 | import * as React from 'react'; 3 | import classNames from "classnames"; 4 | export default class Icon extends React.Component { 5 | constructor(props, context) { 6 | super(props, context); 7 | } 8 | render() { 9 | const { value, size } = this.props; 10 | const cls = classNames({ 11 | ['weui_icon_' + value]: true, 12 | weui_icon_msg: size === 'large', 13 | }); 14 | if (value === 'loading') { 15 | let icons = []; 16 | for (let i = 0; i < 12; i++) { 17 | icons.push(React.createElement("div", {key: i, className: `weui_loading_leaf weui_loading_leaf_${i}`})); 18 | } 19 | return (React.createElement("div", {className: "weui_loading"}, icons)); 20 | } 21 | else { 22 | return (React.createElement("i", {className: cls})); 23 | } 24 | } 25 | } 26 | Icon.defaultProps = { 27 | value: 'success', 28 | size: 'small' 29 | }; 30 | -------------------------------------------------------------------------------- /client/src/component/common/Icon.tsx: -------------------------------------------------------------------------------- 1 | import "../../../public/css/weui_icon_font.less"; 2 | 3 | import * as React from 'react'; 4 | import classNames from "classnames"; 5 | 6 | export interface IIconProps { 7 | value:string; 8 | size:string; 9 | } 10 | 11 | export default class Icon extends React.Component { 12 | static defaultProps = { 13 | value: 'success', 14 | size: 'small' 15 | }; 16 | 17 | constructor(props, context) { 18 | super(props, context); 19 | } 20 | 21 | render() { 22 | const {value, size} = this.props; 23 | const cls = classNames({ 24 | ['weui_icon_' + value]: true, 25 | weui_icon_msg: size === 'large', 26 | // [className]: className 27 | }); 28 | if (value === 'loading') { 29 | let icons = []; 30 | for(let i = 0;i<12;i++){ 31 | icons.push(
); 32 | } 33 | return ( 34 |
35 | {icons} 36 |
37 | ); 38 | } 39 | else { 40 | return ( 41 | 42 | ); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /client/src/component/common/Mask.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import './css/mask.less'; 3 | import classNames from "classnames"; 4 | export default class Mask extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | } 8 | render() { 9 | const transparent = this.props.transparent; 10 | const className = classNames({ 11 | 'kad_mask': !transparent, 12 | 'kad_mask_transparent': transparent 13 | }); 14 | return (React.createElement("div", {className: className})); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /client/src/component/common/Mask.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import './css/mask.less'; 3 | import classNames from "classnames"; 4 | 5 | export interface IMaskProps{ 6 | transparent:boolean; 7 | } 8 | 9 | export default class Mask extends React.Component{ 10 | constructor(props){ 11 | super(props); 12 | } 13 | 14 | render(){ 15 | const transparent = this.props.transparent; 16 | const className = classNames({ 17 | 'kad_mask': !transparent, 18 | 'kad_mask_transparent': transparent 19 | }); 20 | 21 | return ( 22 |
23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /client/src/component/common/Modal.js: -------------------------------------------------------------------------------- 1 | export const OKButton = 'OK'; 2 | export function open(opt) { 3 | window.layer.open(opt); 4 | } 5 | export function info(content, opt) { 6 | opt = Object.assign({}, { 7 | content: content, 8 | btn: [OKButton] 9 | }, opt); 10 | debugger; 11 | open(opt); 12 | } 13 | export function warning(content, opt) { 14 | opt = Object.assign({}, { 15 | content: content, 16 | btn: [OKButton] 17 | }, opt); 18 | open(opt); 19 | } 20 | export function error(content, opt) { 21 | opt = Object.assign({}, { 22 | content: content, 23 | btn: [OKButton] 24 | }, opt); 25 | open(opt); 26 | } 27 | -------------------------------------------------------------------------------- /client/src/component/common/Modal.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export type IModalButton = 'OK' 3 | export const OKButton:IModalButton = 'OK'; 4 | 5 | interface IModalOption { 6 | content?:string; 7 | btn?:IModalButton[]; 8 | end?:()=>void; 9 | } 10 | 11 | interface IModal { 12 | open(opt:IModalOption):void; 13 | } 14 | 15 | declare global { 16 | interface Window { 17 | layer:IModal 18 | } 19 | } 20 | 21 | export function open(opt:IModalOption) { 22 | window.layer.open(opt); 23 | } 24 | 25 | export function info(content:string, opt?:IModalOption) { 26 | opt = Object.assign({}, { 27 | content: content, 28 | btn: [OKButton] 29 | }, opt); 30 | debugger; 31 | open(opt); 32 | } 33 | 34 | export function warning(content:string, opt?:IModalOption) { 35 | opt = Object.assign({}, { 36 | content: content, 37 | btn: [OKButton] 38 | }, opt); 39 | open(opt); 40 | } 41 | 42 | export function error(content:string, opt?:IModalOption) { 43 | opt = Object.assign({}, { 44 | content: content, 45 | btn: [OKButton] 46 | }, opt); 47 | open(opt); 48 | } -------------------------------------------------------------------------------- /client/src/component/common/NotFound.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/15. 3 | */ 4 | import * as React from 'react'; 5 | import { Link } from 'react-router'; 6 | import 'css/errorPage.less'; 7 | export default class NotFound extends React.Component { 8 | constructor(...args) { 9 | super(...args); 10 | this.basCls = `Error-Page`; 11 | } 12 | render() { 13 | return (React.createElement("div", {className: this.basCls}, React.createElement("section", null, React.createElement("div", {className: `${this.basCls}-container`}, React.createElement("section", {className: "error-wrapper text-center"}, React.createElement("h1", null, React.createElement("img", {alt: "", src: "common/libs/images/404-error.png"})), React.createElement("h2", null, "抱歉!页面无法访问……"), React.createElement("p", null, "可能因为:"), React.createElement("h3", null, "网址有错误>请检查地址是否完整或存在多余字符"), React.createElement(Link, {to: 'user-login', className: "back-btn"}, "Back To Login")))))); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /client/src/component/common/NotFound.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/15. 3 | */ 4 | 5 | import * as React from 'react'; 6 | import {Link} from 'react-router'; 7 | import 'css/errorPage.less'; 8 | export default class NotFound extends React.Component{ 9 | private basCls=`Error-Page`; 10 | render(){ 11 | return( 12 |
13 |
14 |
15 | 16 |
17 |

18 |

抱歉!页面无法访问……

19 |

可能因为:

20 |

网址有错误>请检查地址是否完整或存在多余字符

21 | Back To Login 22 |
23 | 24 |
25 |
26 |
27 | ) 28 | } 29 | } -------------------------------------------------------------------------------- /client/src/component/common/PageProgress.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/13. 3 | */ 4 | import * as React from 'react'; 5 | import Progress from 'react-progress-2'; 6 | /*import {IStoreState} from "../../redux/reducers/rootReducer";*/ 7 | import {page, IPageContextProps} from "../../utils/page"; 8 | interface IPageProgressStateProps extends IPageContextProps{ 9 | // loaded?: boolean; 10 | } 11 | /*@connect( 12 | (state: IStoreState): IPageProgressStateProps => { 13 | return {loaded: state.reduxAsyncConnect.loaded} 14 | } 15 | )*/ 16 | @page() 17 | export class PageProgress extends React.Component{ 18 | private isMount = false; 19 | constructor(props, context) { 20 | super(props, context); 21 | } 22 | public handleVisibility(){ 23 | const {progress} = this.props.page; 24 | return progress ? Progress.show() : Progress.hide(); 25 | } 26 | 27 | public componentDidMount(){ 28 | this.isMount = true; 29 | } 30 | 31 | render() { 32 | this.isMount && this.handleVisibility(); 33 | return ( 34 | 35 | ) 36 | } 37 | } -------------------------------------------------------------------------------- /client/src/component/common/PageToast.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import {IPageContextProps, page} from "../../utils/page"; 3 | import Toast from "./Toast"; 4 | 5 | interface IPageToastProps extends IPageContextProps { 6 | 7 | } 8 | 9 | @page() 10 | export default class PageToast extends React.Component { 11 | constructor(props, context) { 12 | super(props, context); 13 | } 14 | 15 | render() { 16 | const {loading, submitting} = this.props.page; 17 | 18 | return ( 19 | 20 | { submitting ? '数据提交中' : '数据加载中'} 21 | 22 | ); 23 | } 24 | } -------------------------------------------------------------------------------- /client/src/component/common/SMessage.js: -------------------------------------------------------------------------------- 1 | import { message } from 'antd'; 2 | export var SMessage; 3 | (function (SMessage) { 4 | SMessage.info = (messageInfo) => { 5 | message.info(messageInfo); 6 | }; 7 | SMessage.success = (messageInfo) => { 8 | message.success(messageInfo); 9 | }; 10 | SMessage.error = (messageInfo) => { 11 | message.error(messageInfo); 12 | }; 13 | SMessage.warning = (messageInfo) => { 14 | message.warning(messageInfo); 15 | }; 16 | SMessage.loading = (messageInfo) => { 17 | const hide = message.loading(messageInfo, 0); 18 | // 异步手动移除 19 | setTimeout(hide, 2500); 20 | }; 21 | })(SMessage || (SMessage = {})); 22 | -------------------------------------------------------------------------------- /client/src/component/common/SMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/12/7. 3 | */ 4 | import { message } from 'antd'; 5 | 6 | export module SMessage{ 7 | export const info=(messageInfo:string)=>{ 8 | message.info(messageInfo); 9 | } 10 | 11 | export const success =(messageInfo:string)=>{ 12 | message.success(messageInfo); 13 | } 14 | 15 | export const error =(messageInfo:string)=>{ 16 | message.error(messageInfo); 17 | } 18 | 19 | export const warning =(messageInfo:string)=>{ 20 | message.warning(messageInfo); 21 | } 22 | 23 | export const loading =(messageInfo:string)=>{ 24 | const hide = message.loading(messageInfo,0); 25 | // 异步手动移除 26 | setTimeout(hide, 2500); 27 | } 28 | } -------------------------------------------------------------------------------- /client/src/component/common/SModal.js: -------------------------------------------------------------------------------- 1 | import { Modal } from 'antd'; 2 | const confirm = Modal.confirm; 3 | export function showDeleteModal(onConfirmCb) { 4 | confirm({ 5 | title: `您确定要执行删除操作吗?`, 6 | content: `一旦删除将无法恢复`, 7 | onOk: onConfirmCb 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /client/src/component/common/SModal.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/28. 3 | */ 4 | import {Modal} from 'antd'; 5 | const confirm = Modal.confirm; 6 | 7 | export function showDeleteModal(onConfirmCb: ()=>void) { 8 | confirm({ 9 | title: `您确定要执行删除操作吗?`, 10 | content: `一旦删除将无法恢复`, 11 | onOk: onConfirmCb 12 | }); 13 | } -------------------------------------------------------------------------------- /client/src/component/common/TablePageContainer.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { BasicTable } from "../table/BasicTable"; 3 | export default class TablePageContainer extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | this.state = { 7 | selectedRowKeys: [] 8 | }; 9 | } 10 | render() { 11 | const { source, isLoading, pagination, columns } = this.props; 12 | return (React.createElement(BasicTable, {columns: columns, dataSource: source, onChange: this.props.onChange.bind(this), pagination: pagination, loading: isLoading})); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /client/src/component/common/TablePageContainer.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/28. 3 | */ 4 | import * as React from 'react'; 5 | import {IColumn,BasicTable} from "../table/BasicTable"; 6 | interface ICatePageTableProps { 7 | source?: Array; 8 | isLoading?: boolean; 9 | pagination?:Object; 10 | onChange?:Function; 11 | columns:IColumn[]; 12 | } 13 | interface ICatePageTableStates { 14 | selectedRowKeys: Array; 15 | } 16 | 17 | export default class TablePageContainer extends React.Component { 18 | 19 | public constructor(props: ICatePageTableProps) { 20 | super(props); 21 | this.state = { 22 | selectedRowKeys: [] 23 | } 24 | } 25 | 26 | public render() { 27 | const {source, isLoading,pagination,columns} = this.props; 28 | return ( 29 | 34 | ) 35 | } 36 | } -------------------------------------------------------------------------------- /client/src/component/common/Toast.js: -------------------------------------------------------------------------------- 1 | import "./css/toast.less"; 2 | import * as React from "react"; 3 | import Icon from "./Icon"; 4 | import Mask from "./Mask"; 5 | export default class Toast extends React.Component { 6 | constructor(props, context) { 7 | super(props, context); 8 | } 9 | render() { 10 | const { icon, show, children, iconSize } = this.props; 11 | return (React.createElement("div", {className: icon === 'loading' ? 'weui_loading_toast' : '', style: { display: show ? 'block' : 'none' }}, React.createElement(Mask, {transparent: true}), React.createElement("div", {className: "weui_toast"}, React.createElement(Icon, {value: icon, size: iconSize}), React.createElement("p", {className: "weui_toast_content"}, children)))); 12 | } 13 | } 14 | Toast.defaultProps = { 15 | icon: 'toast', 16 | show: false, 17 | }; 18 | -------------------------------------------------------------------------------- /client/src/component/common/Toast.tsx: -------------------------------------------------------------------------------- 1 | import "./css/toast.less" 2 | 3 | import * as React from "react"; 4 | import Icon from "./Icon"; 5 | import Mask from "./Mask"; 6 | 7 | export interface IToastProps { 8 | icon?:string; 9 | iconSize?:string; 10 | show:boolean; 11 | } 12 | 13 | export default class Toast extends React.Component { 14 | constructor(props, context) { 15 | super(props, context); 16 | } 17 | 18 | static defaultProps = { 19 | icon: 'toast', 20 | show: false, 21 | }; 22 | 23 | render() { 24 | const {icon, show, children, iconSize} = this.props; 25 | 26 | return ( 27 |
28 | 29 |
30 | 31 |

{children}

32 |
33 |
34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /client/src/component/common/Tombstone.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | export default class TombstoneComponent extends React.Component { 3 | store() { 4 | this.props.storeModel && this.props.storeModel(this.state); 5 | this.$tombstone = true; 6 | } 7 | restore() { 8 | return this.props.$$state; 9 | } 10 | routerWillLeave(nextLocation) { 11 | if (!this.$tombstone) { 12 | this.props.clearModel && this.props.clearModel(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /client/src/component/common/Tombstone.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export interface ITombstoneProps { 4 | $$state:TState; 5 | storeModel:(state:TState)=>void; 6 | clearModel:()=>void; 7 | } 8 | 9 | export default class TombstoneComponent,TState> extends React.Component { 10 | private $tombstone:boolean; 11 | 12 | store() { 13 | this.props.storeModel && this.props.storeModel(this.state); 14 | this.$tombstone = true; 15 | } 16 | 17 | restore():TState { 18 | return this.props.$$state; 19 | } 20 | 21 | routerWillLeave(nextLocation) { 22 | if(!this.$tombstone){ 23 | this.props.clearModel && this.props.clearModel(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /client/src/component/common/VButton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/21. 3 | */ 4 | import * as React from 'react'; 5 | import { Button } from 'antd'; 6 | export default class VButton extends React.Component { 7 | constructor(...args) { 8 | super(...args); 9 | this.baseCls = 'btn'; 10 | } 11 | handleClick() { 12 | this.props.onClick && this.props.onClick(); 13 | } 14 | render() { 15 | const { onClick, children, className } = this.props; 16 | return (React.createElement(Button, {className: `${this.baseCls} ${className}`, type: this.props.type ? this.props.type : 'primary', size: this.props.size, onClick: this.handleClick.bind(this)}, children)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /client/src/component/common/VButton.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/21. 3 | */ 4 | 5 | import * as React from 'react'; 6 | import {Button} from 'antd'; 7 | 8 | interface IButtonProps{ 9 | onClick?:Function; 10 | className?:string; 11 | type?:'primary'|'ghost'|'dashed'; 12 | size?:"large"|"small"; 13 | } 14 | 15 | interface IButtonStates{ 16 | 17 | } 18 | 19 | export default class VButton extends React.Component{ 20 | private baseCls='btn'; 21 | handleClick(){ 22 | this.props.onClick&&this.props.onClick() 23 | } 24 | public render(){ 25 | const {onClick,children,className}=this.props; 26 | return( 27 | 33 | ) 34 | } 35 | } -------------------------------------------------------------------------------- /client/src/component/common/VDatePicker.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { DatePicker } from 'antd'; 3 | import FilterPropsComponent from "../abstract/FilterPropsComponent"; 4 | export default class VDatePicker extends FilterPropsComponent { 5 | constructor(props) { 6 | super(props); 7 | this.state = { 8 | value: '' 9 | }; 10 | } 11 | handelChange(dateArr, stringDateArr) { 12 | this.props.onChange && this.props.onChange(dateArr, stringDateArr); 13 | console.log(typeof stringDateArr); 14 | /*this.setState({ 15 | value:stringDateArr 16 | })*/ 17 | } 18 | render() { 19 | const newProps = super.getFilterProps(); 20 | return (React.createElement(DatePicker, React.__spread({}, newProps))); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /client/src/component/common/VInput.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Input } from 'antd'; 3 | export default class VInput extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | } 7 | render() { 8 | const { clear, onPressEnter, disabled, addonAfter, addonBefore, autosize, type, placeholder, id } = this.props; 9 | return (React.createElement(Input, React.__spread({placeholder: placeholder, id: id, type: type, onPressEnter: onPressEnter, disabled: disabled, addonAfter: addonAfter, addonBefore: addonBefore, autosize: autosize}, this.props))); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /client/src/component/common/VInput.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/30. 3 | */ 4 | import * as React from 'react'; 5 | import {Input} from 'antd'; 6 | import {IAntdProps} from "custom-antd"; 7 | 8 | export interface IVInputProps { 9 | clear?:boolean; 10 | onPressEnter?:()=>void; 11 | disabled?:boolean; 12 | addonAfter?:JSX.Element; 13 | addonBefore?:JSX.Element; 14 | autosize?:boolean|Object;//自适应内容高度,只对 type="textarea" 有效 true or { minRows: 2, maxRows: 6 } 默认false 15 | } 16 | 17 | export default class VInput extends React.Component{ 18 | constructor(props){ 19 | super(props); 20 | } 21 | public render(){ 22 | const {clear,onPressEnter,disabled,addonAfter,addonBefore,autosize,type,placeholder,id}=this.props; 23 | return( 24 | 34 | ); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /client/src/component/common/VMonthPicker.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { MonthPicker } from 'antd'; 3 | import FilterPropsComponent from "../abstract/FilterPropsComponent"; 4 | export default class VMonthPicker extends FilterPropsComponent { 5 | constructor(props) { 6 | super(props); 7 | } 8 | render() { 9 | const newProps = super.getFilterProps(); 10 | return (React.createElement(MonthPicker, React.__spread({}, newProps))); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/component/common/VMonthPicker.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/12/1. 3 | */ 4 | import * as React from 'react'; 5 | import {MonthPicker} from 'antd'; 6 | import {IAntdProps} from "custom-antd"; 7 | import FilterPropsComponent from "../abstract/FilterPropsComponent"; 8 | 9 | export interface IVMonthPickerProps { 10 | onChange?: (dateArr: Date, stringDateArr: string)=>void; // 时间发生变化的回调,发生在用户选择时间时 11 | disabledDate?:(currDate:Date)=>void;//不可选择的日期 12 | disabled?:boolean;//禁用 13 | style?:Object;//自定义输入框样式{} 14 | size?:'large'|'small';//输入框大小,large 高度为 32px,small 为 22px,默认是 28px 15 | format?: string; // 展示的日期格式 default:"yyyy-MM-dd HH:mm:ss" 16 | } 17 | 18 | export default class VMonthPicker extends FilterPropsComponent{ 19 | constructor(props){ 20 | super(props); 21 | } 22 | public render(){ 23 | const newProps=super.getFilterProps(); 24 | 25 | return( 26 | 29 | ); 30 | } 31 | } -------------------------------------------------------------------------------- /client/src/component/common/VRangePicker.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { DatePicker } from 'antd'; 3 | import FilterPropsComponent from "../abstract/FilterPropsComponent"; 4 | const RangePicker = DatePicker.RangePicker; 5 | export default class VMonthPicker extends FilterPropsComponent { 6 | constructor(props) { 7 | super(props); 8 | } 9 | render() { 10 | const newProps = super.getFilterProps(); 11 | ; 12 | return (React.createElement(RangePicker, React.__spread({}, newProps))); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /client/src/component/common/VRangePicker.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/12/1. 3 | */ 4 | import * as React from 'react'; 5 | import {DatePicker} from 'antd'; 6 | import {IAntdProps} from "custom-antd"; 7 | import FilterPropsComponent from "../abstract/FilterPropsComponent"; 8 | const RangePicker = DatePicker.RangePicker; 9 | 10 | export interface IVRangePickerProps { 11 | onChange?: (dateArr: Date[], stringDateArr: string[])=>void; // 时间发生变化的回调,发生在用户选择时间时 12 | showTime?: boolean|Object; //增加时间选择功能 refer to TimePicker Options 13 | disabledDate?:(currDate:Date)=>void;//不可选择的日期 14 | disabled?:boolean;//禁用 15 | style?:Object;//自定义输入框样式 16 | size?:'large'|'small';//输入框大小,large 高度为 32px,small 为 22px,默认是 28px 17 | open?:boolean;//控制弹层是否展开 18 | toggleOpen?:(open:boolean)=>void;//弹出日历和关闭日历的回调 19 | format?: string; // 展示的日期格式 default:"yyyy-MM-dd HH:mm:ss" 20 | } 21 | 22 | export default class VMonthPicker extends FilterPropsComponent{ 23 | constructor(props){ 24 | super(props); 25 | } 26 | public render(){ 27 | const newProps=super.getFilterProps();; 28 | return( 29 | 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /client/src/component/common/VUeditor.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { ueditor } from "../../utils/ueditor"; 3 | export default class VUeditor extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | } 7 | initEditor() { 8 | var ue = ueditor(this.props.id); 9 | this.editor = ue; 10 | var me = this; 11 | this.editor.ready(function (ueditor) { 12 | if (!ueditor) { 13 | UE.delEditor(me.props.id); 14 | me.initEditor(); 15 | } 16 | /*var value = me.props.value?me.props.value:'

'; 17 | console.log(me) 18 | editor.setContent(value);*/ 19 | }); 20 | } 21 | componentDidMount() { 22 | this.initEditor(); 23 | } 24 | render() { 25 | return (React.createElement("script", {id: this.props.id, name: "content", type: "text/plain"})); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /client/src/component/common/VUeditor.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/12/3. 3 | */ 4 | import * as React from 'react'; 5 | import {IAntdProps} from "custom-antd"; 6 | import {ueditor} from "../../utils/ueditor"; 7 | 8 | export interface IVUeditorProps{ 9 | } 10 | 11 | export default class VUeditor extends React.Component{ 12 | private editor; 13 | constructor(props) { 14 | super(props); 15 | } 16 | initEditor(){ 17 | var ue=ueditor(this.props.id); 18 | this.editor = ue; 19 | var me = this; 20 | this.editor.ready( function( ueditor ) { 21 | if(!ueditor){ 22 | UE.delEditor(me.props.id); 23 | me.initEditor(); 24 | } 25 | /*var value = me.props.value?me.props.value:'

'; 26 | console.log(me) 27 | editor.setContent(value);*/ 28 | }); 29 | } 30 | componentDidMount(){ 31 | this.initEditor(); 32 | } 33 | render() { 34 | return ( 35 | 38 | ) 39 | } 40 | } -------------------------------------------------------------------------------- /client/src/component/common/VUploadBottonStyle.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { ICon } from "../ico/ICon"; 3 | import VButton from "./VButton"; 4 | export const VCardUpload = (props) => { 5 | return (React.createElement("div", null, React.createElement(ICon, {type: "plus"}), React.createElement("div", {className: "ant-upload-text"}, "上传照片"))); 6 | }; 7 | export const VTextUpload = (props) => { 8 | return (React.createElement(VButton, {type: "ghost"}, React.createElement(ICon, {type: "upload"}), " 点击上传")); 9 | }; 10 | -------------------------------------------------------------------------------- /client/src/component/common/VUploadBottonStyle.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/12/2. 3 | */ 4 | import * as React from 'react'; 5 | import {ICon} from "../ico/ICon"; 6 | import VButton from "./VButton"; 7 | export const VCardUpload=(props)=>{ 8 | return( 9 |
10 | 11 |
上传照片
12 |
13 | ) 14 | } 15 | export const VTextUpload=(props)=>{ 16 | return( 17 | 18 | 点击上传 19 | 20 | ) 21 | } -------------------------------------------------------------------------------- /client/src/component/common/css/VModal.less: -------------------------------------------------------------------------------- 1 | @import (reference) "../../../../public/css/config"; 2 | 3 | @VModal: v-modal; 4 | 5 | .@{VModal} { 6 | 7 | } -------------------------------------------------------------------------------- /client/src/component/common/css/VUpload.less: -------------------------------------------------------------------------------- 1 | /* 加几行样式将上传项变成平铺样式 */ 2 | .upload-list-inline .ant-upload-list-item { 3 | display: inline-block; 4 | width: 200px; 5 | margin-right: 8px; 6 | } 7 | 8 | /* 配合样式可以做出上传按钮和示例效果 */ 9 | .ant-upload-select-picture-card i { 10 | font-size: 28px; 11 | color: #999; 12 | } 13 | 14 | .ant-upload-select-picture-card .ant-upload-text { 15 | margin-top: 8px; 16 | font-size: 12px; 17 | color: #666; 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /client/src/component/common/css/errorPage.less: -------------------------------------------------------------------------------- 1 | @import (reference) '../../../../public/css/config.less'; 2 | 3 | @ErrorPage:Error-Page; 4 | .@{ErrorPage}{ 5 | background: #6bc5a4; 6 | height: 100%; 7 | width: 100%; 8 | margin: 0 auto; 9 | &-container{ 10 | margin-right: auto; 11 | margin-left: auto; 12 | padding-left: 15px; 13 | padding-right: 15px; 14 | } 15 | } -------------------------------------------------------------------------------- /client/src/component/common/css/mask.less: -------------------------------------------------------------------------------- 1 | @import (reference) "../../../../public/css/config"; 2 | 3 | .kad_mask { 4 | position: fixed; 5 | z-index: 1000; 6 | width: 100%; 7 | height: 100%; 8 | .top(0); 9 | .left(0); 10 | //transform: translate(-50%,-50%); 11 | background-color: #222; 12 | opacity: .6; 13 | } 14 | 15 | .kad_mask_transparent { 16 | position: fixed; 17 | z-index: 1000; 18 | width: 100%; 19 | height: 100%; 20 | .top(0); 21 | .left(0); 22 | } -------------------------------------------------------------------------------- /client/src/component/form/FormSelect.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Form } from 'antd'; 3 | import ControlComponent from "../common/ControlComponent"; 4 | import { default as VSelect } from "../select/VSelect"; 5 | const FormItem = Form.Item; 6 | export class LabelWithSelectModel { 7 | constructor(iAntdProps, rules, iFormWithSelect) { 8 | this.iAntdProps = iAntdProps; 9 | this.rules = rules; 10 | this.iFormWithSelect = iFormWithSelect; 11 | } 12 | } 13 | export default class FormSelect extends ControlComponent { 14 | constructor(props) { 15 | super(props); 16 | } 17 | render() { 18 | const { form, iAntdProps, iFormWithSelect, children, rules } = this.props; 19 | const { getFieldError, isFieldValidating } = form; 20 | let { label, labelCol, wrapperCol, help } = iFormWithSelect; 21 | return (React.createElement(FormItem, {id: iAntdProps.id, key: iAntdProps.id, hasFeedback: true, help: isFieldValidating(iAntdProps.name) ? help : (getFieldError(iAntdProps.name) || []).join(', '), className: iAntdProps.className, label: label, labelCol: labelCol, wrapperCol: wrapperCol}, React.createElement(VSelect, React.__spread({}, form.getFieldProps(iAntdProps.name, super.getFieldDecoratorOpts(this.props)), iFormWithSelect)), children)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /client/src/component/form/FormSubmitButton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/24. 3 | */ 4 | import * as React from 'react'; 5 | import { Form, Button } from 'antd'; 6 | const FormItem = Form.Item; 7 | export class AntButtonModel { 8 | constructor(text, onSubmitClick, className) { 9 | this.text = text; 10 | this.onSubmitClick = onSubmitClick; 11 | this.className = className; 12 | } 13 | } 14 | export const FormSubmitButton = (props) => { 15 | const antdButton = props.antdButton; 16 | const onSubmitClick = antdButton.onSubmitClick.bind(this); 17 | const { text, className } = antdButton; 18 | const form = props.form; 19 | return (React.createElement(FormItem, {key: "search-btn"}, React.createElement(Button, {type: "primary", className: className, onClick: () => { 20 | onSubmitClick(form); 21 | }}, text))); 22 | }; 23 | -------------------------------------------------------------------------------- /client/src/component/form/FormSubmitButton.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/24. 3 | */ 4 | 5 | import * as React from 'react'; 6 | import {Form,Button} from 'antd'; 7 | import {IAntButton} from 'custom-antd'; 8 | import CreateFormOptions = Antd.CreateFormOptions; 9 | import * as classNames from 'classnames'; 10 | const FormItem = Form.Item; 11 | 12 | export class AntButtonModel implements IAntButton { 13 | constructor(public text: string, 14 | public onSubmitClick: (fields: Form) => void, 15 | public className?:string){ 16 | } 17 | } 18 | interface ISubmitButton{ 19 | antdButton:IAntButton; 20 | form: CreateFormOptions; 21 | } 22 | 23 | export const FormSubmitButton=(props:ISubmitButton)=>{ 24 | const antdButton=props.antdButton; 25 | const onSubmitClick=antdButton.onSubmitClick.bind(this); 26 | const {text,className}=antdButton; 27 | const form=props.form; 28 | return( 29 | 30 | 35 | 36 | ) 37 | 38 | } -------------------------------------------------------------------------------- /client/src/component/form/OldVFormInput.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Form, Input } from 'antd'; 3 | const FormItem = Form.Item; 4 | export class OldLabelWithInputModel { 5 | constructor(id, name, labelName, placeholder, options, value, type, help) { 6 | this.id = id; 7 | this.name = name; 8 | this.labelName = labelName; 9 | this.placeholder = placeholder; 10 | this.options = options; 11 | this.value = value; 12 | this.type = type; 13 | this.help = help; 14 | } 15 | } 16 | export const OldVFormVInput = (props) => { 17 | const iAntdProps = props.iAntdProps; 18 | const form = props.form; 19 | const help = props.help; 20 | let type = (iAntdProps.type == '' || iAntdProps.type == undefined) ? 'text' : iAntdProps.type; 21 | return (React.createElement(FormItem, {id: iAntdProps.id, key: iAntdProps.id, hasFeedback: true, help: help}, React.createElement(Input, React.__spread({placeholder: iAntdProps.placeholder}, form.getFieldProps(iAntdProps.name, props.options), {type: type})))); 22 | }; 23 | -------------------------------------------------------------------------------- /client/src/component/form/OldVFormInput.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"OldVInput.js","sourceRoot":"","sources":["OldVInput.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,IAAY,KAAK,WAAM,OAAO,CAAC,CAAA;AAC/B,qBAAyB,MAAM,CAAC,CAAA;AAGhC,IAAM,QAAQ,GAAG,WAAI,CAAC,IAAI,CAAC;AAE3B;IACI,gCAAmB,EAAU,EACV,IAAY,EACZ,SAAiB,EACjB,WAAmB,EACnB,OAAe,EACf,KAAa,EACb,IAAY,EACZ,IAAY;QAPZ,OAAE,GAAF,EAAE,CAAQ;QACV,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAQ;QACjB,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAQ;QACf,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAQ;IAC/B,CAAC;IACL,6BAAC;AAAD,CAAC,AAVD,IAUC;AAVY,8BAAsB,yBAUlC,CAAA;AASY,iBAAS,GAAC,UAAC,KAAoB;IACxC,IAAM,UAAU,GAAC,KAAK,CAAC,UAAU,CAAC;IAClC,IAAM,IAAI,GAAC,KAAK,CAAC,IAAI,CAAC;IACtB,IAAM,IAAI,GAAC,KAAK,CAAC,IAAI,CAAC;IACtB,IAAI,IAAI,GAAC,CAAC,UAAU,CAAC,IAAI,IAAE,EAAE,IAAE,UAAU,CAAC,IAAI,IAAE,SAAS,CAAC,GAAC,MAAM,GAAC,UAAU,CAAC,IAAI,CAAC;IAClF,MAAM,CAAA,CACF,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAE,GAAG,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,WAAW,CACnD,IAAI,CAAC,CAAC,IAAI,CAAC,CAEjB;YAAA,CAAC,YAAK,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,aAAa,CAAkB,UAAU,CAAC,IAAI,EAAC,KAAK,CAAC,OAAO,CAAC,EAC3G,IAAI,CAAC,CAAC,IAAI,CAAC,EAItB;;QAAA,EAAE,QAAQ,CAAC,CACd,CAAC;AACN,CAAC,CAAA"} -------------------------------------------------------------------------------- /client/src/component/form/VCascader.js: -------------------------------------------------------------------------------- 1 | import { Form } from 'antd'; 2 | const FormItem = Form.Item; 3 | //export class FormWithCascaderModel implements 4 | -------------------------------------------------------------------------------- /client/src/component/form/VCascader.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/16. 3 | */ 4 | import * as React from 'react'; 5 | import {Form,Cascader} from 'antd'; 6 | import CreateFormOptions=Antd.CreateFormOptions; 7 | const FormItem=Form.Item; 8 | 9 | //export class FormWithCascaderModel implements -------------------------------------------------------------------------------- /client/src/component/ico/ICon.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Icon } from 'antd'; 3 | export const ICon = (props) => { 4 | let { className, type } = props; 5 | if (type) { 6 | return (React.createElement(Icon, {className: className, type: type})); 7 | } 8 | else { 9 | return null; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /client/src/component/ico/ICon.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/10/29. 3 | */ 4 | import * as React from 'react'; 5 | import {Icon} from 'antd'; 6 | 7 | interface IIConProps{ 8 | className?:string; 9 | type:string; 10 | } 11 | 12 | export const ICon=(props:IIConProps)=>{ 13 | let {className,type}=props; 14 | if(type){ 15 | return( 16 | 17 | ); 18 | } 19 | else { 20 | return null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /client/src/component/layout/VCol.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Col } from 'antd'; 3 | export const VCol = (props) => { 4 | return (React.createElement(Col, {span: props.span, order: props.order, offset: props.offset, push: props.push, pull: props.pull, className: props.className}, props.children)); 5 | }; 6 | -------------------------------------------------------------------------------- /client/src/component/layout/VCol.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/21. 3 | */ 4 | import * as React from 'react'; 5 | import {Col} from 'antd'; 6 | 7 | import ColProps=Antd.ColProps; 8 | import ReactNode=__React.ReactNode; 9 | interface IColProps extends ColProps{ 10 | span?:number; 11 | order?:number; 12 | offset?:number; 13 | push?:number; 14 | pull?:number; 15 | className?: string; 16 | children?:ReactNode; 17 | } 18 | 19 | export const VCol=(props:IColProps)=>{ 20 | return( 21 | 28 | {props.children} 29 | 30 | ) 31 | } -------------------------------------------------------------------------------- /client/src/component/layout/VRow.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Row } from 'antd'; 3 | export const VRow = (props) => { 4 | return (React.createElement(Row, {type: props.type, gutter: props.gutter, align: props.align, className: props.className, justify: props.justify}, props.children)); 5 | }; 6 | -------------------------------------------------------------------------------- /client/src/component/layout/VRow.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/21. 3 | */ 4 | import * as React from 'react'; 5 | import {Row} from 'antd'; 6 | 7 | import RowProps=Antd.RowProps; 8 | import ReactNode=__React.ReactNode; 9 | interface IRowProps extends RowProps{ 10 | type?:'flex'; 11 | gutter?:number; 12 | justify?:'start'|'end'|'center'|'space-around'|'space-between'; 13 | align?:'top'|'middle'|'bottom'; 14 | className?:string; 15 | children?:ReactNode; 16 | } 17 | export const VRow=(props:IRowProps)=>{ 18 | return( 19 | 25 | {props.children} 26 | 27 | ) 28 | } -------------------------------------------------------------------------------- /client/src/component/select/VOptGroup.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Select } from 'antd'; 3 | const OptGroup = Select.OptGroup; 4 | export default class VOptGroup extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | } 8 | render() { 9 | const { label, children } = this.props; 10 | return (React.createElement(OptGroup, {label: label}, children)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/component/select/VOption.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Select } from 'antd'; 3 | const Option = Select.Option; 4 | export default class VOption extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | } 8 | render() { 9 | const { value, text, disabled, key } = this.props; 10 | return (React.createElement(Option, {value: value, disabled: disabled}, text)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/component/select/VSelect.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Select } from 'antd'; 3 | import FilterPropsComponent from "../abstract/FilterPropsComponent"; 4 | const Option = Select.Option; 5 | const OptGroup = Select.OptGroup; 6 | export default class VSelect extends FilterPropsComponent { 7 | constructor(props) { 8 | super(props); 9 | } 10 | renderOption() { 11 | let { vOptGroupProps, isSelectGroup, options } = this.props; 12 | let { label } = vOptGroupProps; 13 | if (isSelectGroup != undefined && isSelectGroup) { 14 | return options && options.map((option, key) => { 15 | const { value, text } = option; 16 | return (React.createElement(OptGroup, {label: label, key: key.toString()}, React.createElement(Option, {value: value, key: key.toString()}, text))); 17 | }); 18 | } 19 | return options && options.map((option, key) => { 20 | const { value, text } = option; 21 | return (React.createElement(Option, {value: value, key: key.toString()}, text)); 22 | }); 23 | } 24 | render() { 25 | const newProps = super.getFilterProps(); 26 | return (React.createElement(Select, React.__spread({}, newProps), this.renderOption())); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /client/src/container/admin/blog/EditCateModal.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { FilterForm } from "../../../component/form/CreateFormFactory"; 3 | import { getEditCateFromFilterProps } from "./form/editCateFormFilter"; 4 | import VModal from "../../../component/common/VModal"; 5 | import VButton from "../../../component/common/VButton"; 6 | export default class EditCateModal extends React.Component { 7 | render() { 8 | const { editCateModalVisibility, onCancelModalClick } = this.props; 9 | return (React.createElement(VModal, {className: '11', title: "编辑分类信息", handleCancel: onCancelModalClick, visible: editCateModalVisibility, footer: [ 10 | React.createElement(VButton, {key: "back", type: "ghost", size: "large", onClick: onCancelModalClick}, "取消") 11 | ]}, React.createElement(FilterForm, {controls: getEditCateFromFilterProps(this.props)}))); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /client/src/container/admin/blog/css/cate.less: -------------------------------------------------------------------------------- 1 | @import (reference) '../../../../public/css/config.less'; 2 | 3 | @CATE:cate; 4 | .@{CATE}{ 5 | &-btnNoBorder{ 6 | border: none; 7 | } 8 | } -------------------------------------------------------------------------------- /client/src/container/admin/blog/css/content.less: -------------------------------------------------------------------------------- 1 | @import (reference) '../../../../public/css/config.less'; 2 | 3 | @ContentForm:Content-form; 4 | .@{ContentForm}{ 5 | &-icon{ 6 | position: absolute; 7 | left: 5px; 8 | top:5px; 9 | font-size: 20px; 10 | } 11 | &-title{ 12 | padding-top: 15px; 13 | } 14 | } -------------------------------------------------------------------------------- /client/src/container/admin/user/UserIndex.js: -------------------------------------------------------------------------------- 1 | import { connect } from 'react-redux'; 2 | import RegistUser from "./RegistUser"; 3 | export default connect((state) => { 4 | return {}; 5 | })(RegistUser); 6 | -------------------------------------------------------------------------------- /client/src/container/admin/user/UserIndex.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/12. 3 | */ 4 | import * as React from 'react'; 5 | import {connect} from 'react-redux'; 6 | import RegistUser from "./RegistUser"; 7 | 8 | export default connect( 9 | (state)=>{ 10 | return{}; 11 | } 12 | )(RegistUser); -------------------------------------------------------------------------------- /client/src/container/admin/user/css/login.less: -------------------------------------------------------------------------------- 1 | @import (reference) '../../../../public/css/config.less'; 2 | 3 | @REGIST_WIDTH:1190PX; 4 | 5 | @LoginForm:Login-form; 6 | 7 | .@{LoginForm}{ 8 | width: 100%; 9 | margin: 0 auto; 10 | background: #65cea7 url("../../../../../common/libs/images/login-bg.jpg") no-repeat fixed; 11 | background-size: cover; 12 | height: 100%; 13 | padding: 80px 5px; 14 | &-icon{ 15 | position: absolute; 16 | left: 5px; 17 | top:5px; 18 | font-size: 20px; 19 | } 20 | &-user { 21 | input { 22 | font-size: 14px; 23 | padding-left: 30px; 24 | } 25 | } 26 | &-captcha{ 27 | overflow: hidden; 28 | font-size: 0; 29 | } 30 | &-captcha-input{ 31 | display: inline-block; 32 | vertical-align: top; 33 | input{ 34 | font-size: 14px; 35 | width: 100px; 36 | } 37 | } 38 | &-captcha-img{ 39 | vertical-align: top; 40 | width: 60px; 41 | display: inline-block; 42 | margin: 5px 10px; 43 | } 44 | &-captcha-link { 45 | vertical-align: top; 46 | font-size: 14px; 47 | text-align: center; 48 | text-decoration: underline; 49 | display: inline-block; 50 | } 51 | } -------------------------------------------------------------------------------- /client/src/container/admin/user/css/regist.less: -------------------------------------------------------------------------------- 1 | /* 2 | body{ 3 | background: #65cea7 url("../../../../../common/libs/images/login-bg.jpg") no-repeat fixed; 4 | background-size: cover; 5 | width: 100%; 6 | height: 100%; 7 | }*/ 8 | @import (reference) '../../../../public/css/config.less'; 9 | .min-width{ 10 | width: 1190px; 11 | margin: auto; 12 | 13 | } 14 | 15 | @REGIST_WIDTH:1190PX; 16 | 17 | @RegistForm:regist-form; 18 | 19 | .@{RegistForm}{ 20 | width: 100%; 21 | margin: 0 auto; 22 | background: #65cea7 url("../../../../../common/libs/images/login-bg.jpg") no-repeat fixed; 23 | background-size: cover; 24 | height: 100%; 25 | padding: 80px 5px; 26 | &-icon{ 27 | position: absolute; 28 | left: 5px; 29 | top:5px; 30 | font-size: 20px; 31 | } 32 | &-user { 33 | input { 34 | font-size: 14px; 35 | padding-left: 30px; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /client/src/container/common/Overview.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import './css/Overview.css'; 3 | import { Link } from 'react-router'; 4 | import GenericComponent from "../../component/abstract/GenericComponent"; 5 | export default class Overview extends GenericComponent { 6 | constructor(props) { 7 | super(props); 8 | this.basCls = `overview`; 9 | } 10 | replaceParamPath(path) { 11 | if (!path) { 12 | return path; 13 | } 14 | return path.replace(/(:.*)/g, "0"); 15 | } 16 | renderItems() { 17 | return this.props.routes[0].childRoutes.map((childRoute, index) => { 18 | console.log(childRoute.path); 19 | return (React.createElement("li", {className: `${this.basCls}-item`, key: index}, React.createElement(Link, {to: this.replaceParamPath(childRoute.path)}, childRoute['title']))); 20 | }); 21 | } 22 | render() { 23 | return (React.createElement("ul", {className: this.basCls}, this.renderItems())); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/src/container/common/css/Overview.css: -------------------------------------------------------------------------------- 1 | .overview { 2 | padding: 30px; 3 | } 4 | .overview-item { 5 | font-size: 32px; 6 | line-height: 1.5; 7 | } 8 | .overview-item a { 9 | color: #010101; 10 | } -------------------------------------------------------------------------------- /client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | manage 10 | 11 | 12 | 13 | 14 |
15 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill'; 2 | import * as ReactDOM from 'react-dom'; 3 | import { routes } from "./config/routeConfig"; 4 | ReactDOM.render(routes, document.getElementById('app')); 5 | -------------------------------------------------------------------------------- /client/src/index.tsx: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill'; 2 | import * as React from 'react'; 3 | import * as ReactDOM from 'react-dom'; 4 | /*import 'antd/dist/antd.min.css';*/ 5 | import {routes} from "./config/routeConfig"; 6 | 7 | 8 | ReactDOM.render( 9 | routes, 10 | document.getElementById('app') 11 | ); -------------------------------------------------------------------------------- /client/src/model/common/errorEntity.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/14. 3 | */ 4 | import {JsonProperty, deserialize} from 'json-typescript-mapper'; 5 | import {StateEnumResult} from "commonResult"; 6 | export class ErrorEntity{ 7 | @JsonProperty('Code') 8 | public code:string; 9 | 10 | @JsonProperty('Message') 11 | public message:string; 12 | 13 | 14 | public constructor(){ 15 | this.code=void 0; 16 | this.message=void 0; 17 | } 18 | } 19 | export class ErrorPageEntity{ 20 | public data:ErrorEntity; 21 | public state:StateEnumResult; 22 | public constructor(json?){ 23 | json = json || {}; 24 | this.state=json.state; 25 | this.data=this.parseErrorEntities(json.result); 26 | } 27 | private parseErrorEntities(error: ErrorEntity): ErrorEntity { 28 | error = error || new ErrorEntity(); 29 | return deserialize(ErrorEntity, error); 30 | } 31 | } -------------------------------------------------------------------------------- /client/src/model/common/successEntity.js: -------------------------------------------------------------------------------- 1 | export class SuccessEntity { 2 | constructor() { 3 | this.message = void 0; 4 | } 5 | } 6 | export class SuccessPageEntity { 7 | constructor(json) { 8 | json = json || {}; 9 | this.state = json.state; 10 | let info = new SuccessEntity(); 11 | info.message = json.result; 12 | this.data = info; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /client/src/model/common/successEntity.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/24. 3 | */ 4 | import {StateEnumResult} from "commonResult"; 5 | export class SuccessEntity{ 6 | public message:string; 7 | public constructor(){ 8 | this.message=void 0; 9 | } 10 | } 11 | export class SuccessPageEntity{ 12 | public data:SuccessEntity; 13 | public state:StateEnumResult; 14 | public constructor(json?){ 15 | json = json || {}; 16 | this.state=json.state; 17 | let info=new SuccessEntity(); 18 | info.message=json.result; 19 | this.data=info; 20 | } 21 | } -------------------------------------------------------------------------------- /client/src/model/menu/currentMenu.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/9. 3 | */ 4 | export class CurrentMenu { 5 | constructor() { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /client/src/model/menu/currentMenu.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/9. 3 | */ 4 | export class CurrentMenu{ 5 | key:string; 6 | path:string; 7 | title:string; 8 | parentTitle:string; 9 | parentKey:string; 10 | constructor(){ 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /client/src/model/propsType.js: -------------------------------------------------------------------------------- 1 | export class PropsType { 2 | constructor() { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /client/src/model/propsType.ts: -------------------------------------------------------------------------------- 1 | export class PropsType{ 2 | value:string; 3 | required:boolean; 4 | name:string; 5 | errorMsg:string; 6 | constructor(){ 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /client/src/model/user/VAuthEntity.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/16. 3 | */ 4 | import {JsonProperty, deserialize} from 'json-typescript-mapper'; 5 | import {StateEnumResult} from "common/commonResult"; 6 | 7 | export class VAuthEntity{ 8 | 9 | @JsonProperty('Message') 10 | public message:string; 11 | 12 | @JsonProperty('Token') 13 | public token:string; 14 | 15 | public constructor(){ 16 | this.token=void 0; 17 | this.message=void 0; 18 | } 19 | } 20 | 21 | export class VAuthPageEntity{ 22 | public data:VAuthEntity; 23 | public state:StateEnumResult; 24 | public constructor(json?){ 25 | json = json || {}; 26 | this.state=json.state; 27 | this.data=this.parseUserLoginEntities(json.result); 28 | } 29 | private parseUserLoginEntities(info: VAuthEntity): VAuthEntity { 30 | info = info || new VAuthEntity(); 31 | return deserialize(VAuthEntity, info); 32 | } 33 | } -------------------------------------------------------------------------------- /client/src/model/user/userLoginEntity.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/14. 3 | */ 4 | import {JsonProperty, deserialize} from 'json-typescript-mapper'; 5 | import {StateEnumResult} from "common/commonResult"; 6 | export class UserLoginEntity{ 7 | 8 | @JsonProperty('Message') 9 | public message:string; 10 | 11 | @JsonProperty('MemberCK') 12 | public memberCK:string; 13 | 14 | public constructor(){ 15 | this.memberCK=void 0; 16 | this.message=void 0; 17 | } 18 | } 19 | 20 | export class UserLoginPageEntity{ 21 | public data:UserLoginEntity; 22 | public state:StateEnumResult; 23 | public constructor(json?){ 24 | json = json || {}; 25 | this.state=json.state; 26 | this.data=this.parseUserLoginEntities(json.result); 27 | } 28 | private parseUserLoginEntities(info: UserLoginEntity): UserLoginEntity { 29 | info = info || new UserLoginEntity(); 30 | return deserialize(UserLoginEntity, info); 31 | } 32 | } -------------------------------------------------------------------------------- /client/src/model/userRegistInfo.js: -------------------------------------------------------------------------------- 1 | export class UserRegistInfo { 2 | constructor() { 3 | } 4 | } 5 | export class UserFormLogin { 6 | constructor() { 7 | this.userName = ''; 8 | this.userPassword = ''; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /client/src/model/userRegistInfo.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"userRegistInfo.js","sourceRoot":"","sources":["userRegistInfo.ts"],"names":[],"mappings":";AACA;IAOI;IAEA,CAAC;IACL,qBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,sBAAc,iBAU1B,CAAA;AACD;IAGI;QACI,IAAI,CAAC,QAAQ,GAAC,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAC,EAAE,CAAC;IACzB,CAAC;IACL,oBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,qBAAa,gBAOzB,CAAA"} -------------------------------------------------------------------------------- /client/src/model/userRegistInfo.ts: -------------------------------------------------------------------------------- 1 | 2 | export class UserRegistInfo{ 3 | userPassword:string; 4 | trueName:string; 5 | email:string; 6 | userName:string; 7 | mobile:string; 8 | reUserPassword:string; 9 | constructor(){ 10 | 11 | } 12 | } 13 | export class UserFormLogin{ 14 | userName:string; 15 | userPassword:string; 16 | constructor(){ 17 | this.userName=''; 18 | this.userPassword=''; 19 | } 20 | } -------------------------------------------------------------------------------- /client/src/public/css/config.less: -------------------------------------------------------------------------------- 1 | .before-vc{ 2 | height: 100%; 3 | &:before{ 4 | content:''; 5 | display: inline-block; 6 | height: 100%; 7 | vertical-align: middle; 8 | } 9 | } 10 | 11 | .before-vc-after{ 12 | height: 100%; 13 | &:after{ 14 | content: ''; 15 | display: inline-block; 16 | height: 100%; 17 | vertical-align: middle; 18 | } 19 | } -------------------------------------------------------------------------------- /client/src/redux/actions/menu/menuIndex.js: -------------------------------------------------------------------------------- 1 | import { PromiseActionType, PromiseAction } from "../../../utils/redux"; 2 | import * as menuService from '../../../api/menu/menuService'; 3 | /** 4 | * Created by xiaoduan on 2016/11/17. 5 | */ 6 | export const GET_CURRENT_MENU = new PromiseActionType('menu/menuIndex/GET_CURRENT_MENU'); 7 | export function getCurrentMenu(currentMenu) { 8 | return (dispatch, getState) => { 9 | let currentMenuProps = getState().menuIndex.currentMenu.data; 10 | if (!currentMenuProps || (currentMenuProps && currentMenuProps.key !== currentMenu.key)) { 11 | dispatch(new PromiseAction(() => menuService.getCurrentMenu(currentMenu), GET_CURRENT_MENU.types)); 12 | } 13 | }; 14 | } 15 | export function getCurrentMenuProps() { 16 | return (dispatch, getState) => { 17 | let currentMenuProps = getState().menuIndex.currentMenu.data; 18 | if (currentMenuProps) { 19 | dispatch(new PromiseAction(() => { 20 | return new Promise((resolve) => { 21 | resolve(getState().menuIndex.currentMenu); 22 | }); 23 | }, GET_CURRENT_MENU.types)); 24 | } 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /client/src/redux/actions/system/route.js: -------------------------------------------------------------------------------- 1 | import * as routeActions from 'react-router-redux'; 2 | export function go(num) { 3 | return routeActions.go(num); 4 | } 5 | export function goBack() { 6 | return routeActions.goBack(); 7 | } 8 | export function push(path) { 9 | return routeActions.push(path); 10 | } 11 | export function replace(path) { 12 | return routeActions.replace(path); 13 | } 14 | -------------------------------------------------------------------------------- /client/src/redux/actions/system/route.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/16. 3 | */ 4 | import * as routeActions from 'react-router-redux'; 5 | import LocationDescriptor = HistoryModule.LocationDescriptor; 6 | 7 | export function go(num: number) { 8 | return routeActions.go(num); 9 | } 10 | 11 | export function goBack() { 12 | return routeActions.goBack(); 13 | } 14 | 15 | export function push(path:LocationDescriptor) { 16 | return routeActions.push(path); 17 | } 18 | 19 | export function replace(path:LocationDescriptor) { 20 | return routeActions.replace(path); 21 | } -------------------------------------------------------------------------------- /client/src/redux/actions/system/routesPath.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/16. 3 | */ 4 | import {push} from "route"; 5 | export module RoutesPath{ 6 | 7 | export const RoutePath = { 8 | blogCate: ()=>'/admin/cate', 9 | blogTag:()=>'/admin/tag', 10 | blogAddContent:()=>'/admin/content/add', 11 | blogContentList:()=>'/admin/content/list', 12 | userLogin:()=>'/user/login', 13 | userReg:()=>'/user/reg', 14 | oldUserReg:()=>'/user/old/reg', 15 | adminIndex:()=>'/admin/index', 16 | notFound:()=>'/404', 17 | wareSearch: (keyWord:string)=>`/ware/search/${keyWord}` 18 | }; 19 | export let menu={ 20 | blog: 21 | { 22 | title:'MyBlog', 23 | key:'blog', 24 | children: { 25 | cate: {title:'分类信息',key:RoutePath.blogCate()}, 26 | tag: {title:'标签信息',key:RoutePath.blogTag()}, 27 | addContent:{title:'发布信息',key:RoutePath.blogAddContent()}, 28 | contentList:{title:'信息列表',key:RoutePath.blogContentList()} 29 | } 30 | 31 | } 32 | }; 33 | export function goUserLogin(){ 34 | return push(RoutePath.userLogin()); 35 | } 36 | export function goAdminManageCate(){ 37 | return push(RoutePath.blogCate()); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /client/src/redux/actions/user/userIndex.js: -------------------------------------------------------------------------------- 1 | import { PromiseActionType, PromiseAction } from '../../../utils/redux'; 2 | import * as userManageService from '../../../api/user/userManageService'; 3 | export const REGIST_USER_INFO = new PromiseActionType('user/userIndex/REGIST_USER_INFO'); 4 | export const USER_LOGIN = new PromiseActionType('user/userIndex/USER_LOGIN'); 5 | export const RESET = 'user/userIndex/RESET'; 6 | export const DECRYPT_MEMBER_CK = new PromiseActionType('user/userIndex/DECRYPT_MEMBER_CK'); 7 | export function submitRegist(userRegistInfo) { 8 | return (dispatch) => { 9 | dispatch(new PromiseAction(() => userManageService.registUser(userRegistInfo), REGIST_USER_INFO.types)); 10 | }; 11 | } 12 | export function userLogin(userName, userPassWord, code) { 13 | return (dispatch, getState) => { 14 | dispatch(new PromiseAction(() => userManageService.userLogin(userName, userPassWord, code), USER_LOGIN.types)); 15 | }; 16 | } 17 | export function isUserLogin(memberCk) { 18 | return (dispatch, getState) => { 19 | dispatch(new PromiseAction(() => userManageService.isUserLogin(memberCk), DECRYPT_MEMBER_CK.types)); 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /client/src/redux/reducers/common/app.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | const initState = { 3 | user: null, 4 | modal: null, 5 | loading: 0 6 | }; 7 | function user(state = initState.user, action) { 8 | return state; 9 | } 10 | function modal(state = initState.modal, action) { 11 | return state; 12 | } 13 | function loading(state = initState.loading, action) { 14 | return state; 15 | } 16 | export default combineReducers({ 17 | user, 18 | modal, 19 | loading 20 | }); 21 | -------------------------------------------------------------------------------- /client/src/redux/reducers/common/app.ts: -------------------------------------------------------------------------------- 1 | import {IAction, combineReducers} from 'redux'; 2 | 3 | 4 | export interface IAppReducer { 5 | user:any; 6 | modal:any; 7 | loading:number; 8 | } 9 | 10 | const initState:IAppReducer = { 11 | user: null, 12 | modal: null, 13 | loading: 0 14 | }; 15 | 16 | function user(state = initState.user, action:IAction) { 17 | return state; 18 | } 19 | 20 | function modal(state = initState.modal, action:IAction) { 21 | return state; 22 | } 23 | 24 | function loading(state = initState.loading, action:IAction) { 25 | return state; 26 | } 27 | 28 | export default combineReducers({ 29 | user, 30 | modal, 31 | loading 32 | }) -------------------------------------------------------------------------------- /client/src/redux/reducers/menu/menuIndex.js: -------------------------------------------------------------------------------- 1 | import { PromiseState, promiseReducer } from "../../../utils/redux"; 2 | import { combineReducers } from "redux"; 3 | import * as ActionTypes from 'actions/menu/menuIndex'; 4 | const initState = { 5 | currentMenu: new PromiseState() 6 | }; 7 | export default combineReducers({ 8 | currentMenu: promiseReducer(ActionTypes.GET_CURRENT_MENU, initState.currentMenu) 9 | }); 10 | -------------------------------------------------------------------------------- /client/src/redux/reducers/menu/menuIndex.ts: -------------------------------------------------------------------------------- 1 | import {PromiseState, promiseReducer} from "../../../utils/redux"; 2 | import {CurrentMenu} from "../../../model/menu/currentMenu"; 3 | import {combineReducers} from "redux"; 4 | import * as ActionTypes from 'actions/menu/menuIndex'; 5 | /** 6 | * Created by xiaoduan on 2016/11/17. 7 | */ 8 | 9 | export interface IMenuIndexStore{ 10 | menuIndex:IMenuReducer; 11 | } 12 | 13 | export interface IMenuReducer{ 14 | currentMenu:PromiseState; 15 | } 16 | 17 | const initState:IMenuReducer={ 18 | currentMenu:new PromiseState() 19 | } 20 | 21 | export default combineReducers({ 22 | currentMenu:promiseReducer(ActionTypes.GET_CURRENT_MENU,initState.currentMenu) 23 | }) -------------------------------------------------------------------------------- /client/src/redux/reducers/rootReducer.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | import { routerReducer } from 'react-router-redux'; 3 | import app from 'common/app'; 4 | import userIndex from './user/userIndex'; 5 | import { reducer as reduxAsyncConnect } from 'redux-async-connect'; 6 | import menuIndex from './menu/menuIndex'; 7 | import blogIndex from './blog/blogIndex'; 8 | export const rootReducer = combineReducers({ 9 | app, 10 | userIndex, 11 | menuIndex, 12 | blogIndex, 13 | reduxAsyncConnect: reduxAsyncConnect, 14 | routing: routerReducer, 15 | }); //合并Reducer 16 | -------------------------------------------------------------------------------- /client/src/redux/reducers/rootReducer.ts: -------------------------------------------------------------------------------- 1 | import {combineReducers} from 'redux'; 2 | 3 | import {routerReducer} from 'react-router-redux'; 4 | import app, {IAppReducer} from 'common/app'; 5 | import userIndex,{IUserReducer} from './user/userIndex'; 6 | import {reducer as reduxAsyncConnect, IReduxAsyncConnect} from 'redux-async-connect'; 7 | import menuIndex,{IMenuReducer} from './menu/menuIndex'; 8 | import blogIndex,{IBlogIndexReducer} from './blog/blogIndex'; 9 | 10 | export interface IStoreState{ 11 | app:IAppReducer; 12 | userIndex:IUserReducer; 13 | menuIndex:IMenuReducer; 14 | reduxAsyncConnect: IReduxAsyncConnect; 15 | blogIndex:IBlogIndexReducer; 16 | } 17 | export const rootReducer=combineReducers({ 18 | app, 19 | userIndex, 20 | menuIndex, 21 | blogIndex, 22 | reduxAsyncConnect: reduxAsyncConnect, 23 | routing: routerReducer, 24 | });//合并Reducer -------------------------------------------------------------------------------- /client/src/store/configureStore.js: -------------------------------------------------------------------------------- 1 | import { createStore, applyMiddleware, compose } from 'redux'; 2 | import thunkMiddleware from 'redux-thunk'; 3 | import { hashHistory } from 'react-router'; 4 | import { rootReducer } from './../redux/reducers/rootReducer'; 5 | import { routerMiddleware } from 'react-router-redux'; 6 | import { promiseMiddleware } from '../utils/redux'; 7 | import { syncRouteState } from "../utils/route-state"; 8 | export const history = hashHistory; 9 | const reduxRouterMiddleware = routerMiddleware(hashHistory); 10 | let createStoreWithMiddleware; 11 | if (process.env.NODE_ENV === __DEV__) { 12 | const devFuncs = [ 13 | window.devToolsExtension ? window.devToolsExtension() : f => f 14 | ]; 15 | createStoreWithMiddleware = compose(applyMiddleware(reduxRouterMiddleware, thunkMiddleware, promiseMiddleware), ...devFuncs)(createStore); //调用 applyMiddleware,使用 middleware 增强 createStore: 16 | } 17 | else { 18 | createStoreWithMiddleware = compose(applyMiddleware(reduxRouterMiddleware, thunkMiddleware, promiseMiddleware))(createStore); //从右到左来组合多个函数。 19 | } 20 | export default function configureStore(initialState) { 21 | // return createStoreWithMiddleware(rootReducer, initialState) 22 | const store = createStoreWithMiddleware(rootReducer, initialState); 23 | syncRouteState(history, store); 24 | return store; 25 | } 26 | -------------------------------------------------------------------------------- /client/src/store/index.js: -------------------------------------------------------------------------------- 1 | import configureStore from 'store/configureStore'; 2 | /*const state = (window).__initialState__ || undefined;*/ 3 | export const store = configureStore({}); 4 | -------------------------------------------------------------------------------- /client/src/store/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/16. 3 | */ 4 | import configureStore from 'store/configureStore'; 5 | /*const state = (window).__initialState__ || undefined;*/ 6 | export const store = configureStore({}); -------------------------------------------------------------------------------- /client/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "buildOnSave": true, 4 | "compilerOptions": { 5 | "target": "es6", 6 | //"module": "commonjs", 7 | "noImplicitAny": false, 8 | // "noEmitOnError": true, 9 | "allowSyntheticDefaultImports": true, 10 | "jsx": "react", 11 | "sourceMap": false, 12 | "experimentalDecorators": true, 13 | "emitDecoratorMetadata": true, 14 | "noResolve": true, 15 | "moduleResolution": "classic", 16 | // "moduleResolution": "node" 17 | // "noEmitHelpers": true 18 | "pretty": true 19 | }, 20 | "filesGlob": [ 21 | "**/*.ts", 22 | "**/*.tsx", 23 | "!node_modules/**/*.ts" 24 | ], 25 | "exclude": [ 26 | "dist", 27 | "node_modules", 28 | "examples" 29 | ] 30 | } -------------------------------------------------------------------------------- /client/src/typings/classnames/classnames.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for classnames 2 | // Project: https://github.com/JedWatson/classnames 3 | // Definitions by: Dave Keen , Adi Dahiya , Jason Killian 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | declare type ClassValue = string | number | ClassDictionary | ClassArray; 7 | 8 | interface ClassDictionary { 9 | [id: string]: boolean; 10 | } 11 | 12 | interface ClassArray extends Array { } 13 | 14 | interface ClassNamesFn { 15 | (...classes: ClassValue[]): string; 16 | } 17 | 18 | declare var classNames: ClassNamesFn; 19 | 20 | declare module "classnames" { 21 | export = classNames 22 | } 23 | -------------------------------------------------------------------------------- /client/src/typings/cors/cors.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for cors 2 | // Project: https://github.com/troygoode/node-cors/ 3 | // Definitions by: Mihhail Lapushkin 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare module "cors" { 9 | import express = require('express'); 10 | 11 | namespace e { 12 | interface CorsOptions { 13 | origin?: any; 14 | methods?: any; 15 | allowedHeaders?: any; 16 | exposedHeaders?: any; 17 | credentials?: boolean; 18 | maxAge?: number; 19 | preflightContinue?: boolean; 20 | } 21 | } 22 | 23 | function e(options?: e.CorsOptions): express.RequestHandler; 24 | export = e; 25 | } 26 | -------------------------------------------------------------------------------- /client/src/typings/errorhandler/errorhandler.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for errorhandler 2 | // Project: https://github.com/expressjs/errorhandler 3 | // Definitions by: Santi Albo 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare module "errorhandler" { 9 | import * as express from 'express'; 10 | 11 | function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler; 12 | 13 | namespace errorHandler { 14 | interface LoggingCallback { 15 | (err: Error, str: string, req: express.Request, res: express.Response): void; 16 | } 17 | 18 | interface Options { 19 | /** 20 | * Defaults to true. 21 | * 22 | * Possible values: 23 | * true : Log errors using console.error(str). 24 | * false : Only send the error back in the response. 25 | * A function : pass the error to a function for handling. 26 | */ 27 | log: boolean | LoggingCallback; 28 | } 29 | } 30 | 31 | export = errorHandler; 32 | } 33 | -------------------------------------------------------------------------------- /client/src/typings/form-data/form-data.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for form-data 2 | // Project: https://github.com/felixge/node-form-data 3 | // Definitions by: Carlos Ballesteros Velasco 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | // Imported from: https://github.com/soywiz/typescript-node-definitions/form-data.d.ts 7 | 8 | declare module "form-data" { 9 | export class FormData { 10 | append(key: string, value: any, options?: any): FormData; 11 | getHeaders(): Object; 12 | // TODO expand pipe 13 | pipe(to: any): any; 14 | submit(params: string|Object, callback: (error: any, response: any) => void): any; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /client/src/typings/globals/globals.d.ts: -------------------------------------------------------------------------------- 1 | /*import ComponentClass = __React.ComponentClass;*/ 2 | import ReactElement = __React.ReactElement; 3 | import RouteProps = ReactRouter.RouteProps; 4 | 5 | declare var __DEV__:boolean; 6 | declare var __PRODUCTION__; 7 | interface window extends Window { 8 | __initialState__:any; 9 | devToolsExtension:Function; 10 | opera:any; 11 | } 12 | 13 | interface ITargetInst { 14 | _currentElement:ReactElement; 15 | } 16 | 17 | interface IReactMouseEvent extends MouseEvent { 18 | _targetInst:ITargetInst 19 | } 20 | 21 | interface WXRouteProps extends RouteProps { 22 | title?:string; 23 | } 24 | 25 | type IPromise = Promise; 26 | -------------------------------------------------------------------------------- /client/src/typings/mime/mime.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for mime 2 | // Project: https://github.com/broofa/node-mime 3 | // Definitions by: Jeff Goddard 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | // Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts 7 | 8 | declare module "mime" { 9 | export function lookup(path: string): string; 10 | export function extension(mime: string): string; 11 | export function load(filepath: string): void; 12 | export function define(mimes: Object): void; 13 | 14 | interface Charsets { 15 | lookup(mime: string): string; 16 | } 17 | 18 | export var charsets: Charsets; 19 | export var default_type: string; 20 | } 21 | -------------------------------------------------------------------------------- /client/src/typings/object-assign/object-assign.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for object-assign 4.0.1 2 | // Project: https://github.com/sindresorhus/object-assign 3 | // Definitions by: Christopher Brown 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | declare module "object-assign" { 7 | function objectAssign(target: T, source: U): T & U; 8 | function objectAssign(target: T, source1: U, source2: V): T & U & V; 9 | function objectAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; 10 | function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; 11 | function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R; 12 | function objectAssign(target: any, ...sources: any[]): any; 13 | namespace objectAssign { } 14 | export = objectAssign; 15 | } 16 | -------------------------------------------------------------------------------- /client/src/typings/react-progress-2/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module "react-progress-2" { 2 | namespace RP2 { 3 | export const Component: any; 4 | export const show: ()=>void; 5 | export const hide: ()=>void; 6 | export const hideAll: ()=>void; 7 | export const isVisible: ()=>boolean; 8 | } 9 | export = RP2; 10 | } -------------------------------------------------------------------------------- /client/src/typings/react-tappable/react-tappable.d.ts: -------------------------------------------------------------------------------- 1 | import React = __React; 2 | 3 | declare module "react-tappable" { 4 | export = class Tappable extends React.Component { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /client/src/typings/react/react-addons-transition-group.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-transition-group) 2 | // Project: http://facebook.github.io/react/ 3 | // Definitions by: Asana , AssureSign , Microsoft 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare namespace __React { 9 | 10 | interface TransitionGroupProps { 11 | component?: ReactType; 12 | className?: string; 13 | childFactory?: (child: ReactElement) => ReactElement; 14 | } 15 | 16 | type TransitionGroup = ComponentClass; 17 | 18 | namespace __Addons { 19 | export var TransitionGroup: __React.TransitionGroup; 20 | } 21 | } 22 | 23 | declare module "react-addons-transition-group" { 24 | var TransitionGroup: __React.TransitionGroup; 25 | type TransitionGroup = __React.TransitionGroup; 26 | export = TransitionGroup; 27 | } 28 | -------------------------------------------------------------------------------- /client/src/typings/redux-async-connect/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xd on 2016/11/13 0013. 3 | */ 4 | 5 | declare module "redux-async-connect" { 6 | import {Reducer} from 'redux'; 7 | import React = __React; 8 | namespace RAC { 9 | import Component = ReactRouter.Component; 10 | export class ReduxAsyncConnect extends React.Component { 11 | } 12 | export const reducer: Reducer; 13 | export const asyncConnect: (item: Object)=>any; 14 | interface IReduxAsyncConnect { 15 | loaded: boolean 16 | } 17 | } 18 | export = RAC; 19 | } -------------------------------------------------------------------------------- /client/src/typings/redux-thunk/redux-thunk.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for redux-thunk v2.0.1 2 | // Project: https://github.com/gaearon/redux-thunk 3 | // Definitions by: Qubo 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare namespace ReduxThunk { 9 | export interface Thunk extends Redux.Middleware {} 10 | export interface ThunkInterface { 11 | (dispatch: Redux.Dispatch, getState?: () => T): any; 12 | } 13 | } 14 | 15 | declare module "redux-thunk" { 16 | var thunk: ReduxThunk.Thunk; 17 | export default thunk; 18 | } 19 | -------------------------------------------------------------------------------- /client/src/typings/serve-favicon/serve-favicon.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for serve-favicon 2.2.0 2 | // Project: https://github.com/expressjs/serve-favicon 3 | // Definitions by: Uros Smolnik 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /* =================== USAGE =================== 7 | 8 | import serveFavicon = require('serve-favicon'); 9 | app.use(serveFavicon(__dirname + '/public/favicon.ico')); 10 | 11 | =============================================== */ 12 | 13 | /// 14 | 15 | declare module "serve-favicon" { 16 | import express = require('express'); 17 | 18 | /** 19 | * Node.js middleware for serving a favicon. 20 | */ 21 | function serveFavicon(path: string, options?: { 22 | /** 23 | * The cache-control max-age directive in ms, defaulting to 1 day. This can also be a string accepted by the ms module. 24 | */ 25 | maxAge?: number; 26 | }): express.RequestHandler; 27 | 28 | namespace serveFavicon{} 29 | 30 | export = serveFavicon; 31 | } -------------------------------------------------------------------------------- /client/src/utils/EnumTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/24. 3 | */ 4 | export enum DeleteEnum{ 5 | //未删除 6 | NotDel=0, 7 | //已删除 8 | IsDel=1 9 | } 10 | 11 | export function getDeleteEnumDisplayName(deleteEnum:DeleteEnum){ 12 | return { 13 | [DeleteEnum.IsDel]:'已删', 14 | [DeleteEnum.NotDel]:'未删' 15 | }[deleteEnum] 16 | } 17 | 18 | 19 | export enum CheckEnum 20 | { 21 | /// 22 | /// 未通过:2 23 | /// 24 | UnPass = 2, 25 | 26 | /// 未审核:0 27 | Waiting = 0, 28 | 29 | /// 30 | /// 已审核:1 31 | /// 32 | Pass = 1, 33 | } 34 | export enum UseStateEnum 35 | { 36 | /// 37 | /// 启用1 38 | /// 39 | Enable = 1, 40 | /// 41 | /// 停用0 42 | /// 43 | Disable = 0 44 | } 45 | 46 | export enum SexEnum 47 | { 48 | /// 49 | /// 未知0 50 | /// 51 | Unknown = 0, 52 | /// 53 | /// 男1 54 | // / 55 | Man = 1, 56 | /// 57 | /// 女2 58 | /// 59 | Woman = 2 60 | 61 | } 62 | export enum FormsRole 63 | { 64 | /// 65 | /// 管理员 66 | /// 67 | Admin=0, 68 | 69 | /// 70 | /// 网站用户 71 | /// 72 | Member=1 73 | } 74 | -------------------------------------------------------------------------------- /client/src/utils/application.js: -------------------------------------------------------------------------------- 1 | export function isDev() { 2 | return process.env.NODE_ENV !== 'production'; 3 | } 4 | -------------------------------------------------------------------------------- /client/src/utils/application.ts: -------------------------------------------------------------------------------- 1 | 2 | export function isDev(){ 3 | return process.env.NODE_ENV !== 'production'; 4 | } -------------------------------------------------------------------------------- /client/src/utils/cookie.js: -------------------------------------------------------------------------------- 1 | export function set(key, value, options = {}) { 2 | options = Object.assign({}, options); 3 | if (value === null || value === undefined) { 4 | options.expires = -1; 5 | } 6 | if (typeof options.expires === 'number') { 7 | var days = options.expires, t = options.expires = new Date(); 8 | t.setDate(t.getDate() + days); 9 | } 10 | value = String(value); 11 | return (document.cookie = [ 12 | encodeURIComponent(key), '=', 13 | options.raw ? value : encodeURIComponent(value), 14 | options.expires ? '; expires=' + options.expires.toUTCString() : '', 15 | options.path ? '; path=' + options.path : '', 16 | options.domain ? '; domain=' + options.domain : '', 17 | options.secure ? '; secure' : '' 18 | ].join('')); 19 | } 20 | export function get(key, options = {}) { 21 | var result, decode = options.raw ? function (s) { 22 | return s; 23 | } : decodeURIComponent; 24 | return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 25 | } 26 | export function clear(key) { 27 | return set(key, '', { expires: -1 }); 28 | } 29 | -------------------------------------------------------------------------------- /client/src/utils/cookie.ts: -------------------------------------------------------------------------------- 1 | export function set(key, value, options:any = {}) { 2 | options = Object.assign({}, options); 3 | 4 | if (value === null || value === undefined) { 5 | options.expires = -1; 6 | } 7 | 8 | if (typeof options.expires === 'number') { 9 | var days = options.expires, t = options.expires = new Date(); 10 | t.setDate(t.getDate() + days); 11 | } 12 | 13 | value = String(value); 14 | 15 | return (document.cookie = [ 16 | encodeURIComponent(key), '=', 17 | options.raw ? value : encodeURIComponent(value), 18 | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 19 | options.path ? '; path=' + options.path : '', 20 | options.domain ? '; domain=' + options.domain : '', 21 | options.secure ? '; secure' : '' 22 | /* options.httpOnly?'; httpOnly='+true:true*/ 23 | ].join('')); 24 | } 25 | 26 | export function get(key, options:any = {}) { 27 | var result, decode = options.raw ? function (s) { 28 | return s; 29 | } : decodeURIComponent; 30 | return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 31 | } 32 | 33 | export function clear(key){ 34 | return set(key,'',{expires: -1}); 35 | } -------------------------------------------------------------------------------- /client/src/utils/device.js: -------------------------------------------------------------------------------- 1 | const iOS = 'iOS'; 2 | const ANDROID = 'ANDROID'; 3 | const BLACKBERRY = 'BLACKBERRY'; 4 | const UNKNOWN = 'UNKNOWN'; 5 | export class DeviceUtil { 6 | static getPlatform() { 7 | if (!DeviceUtil.devicePlatForm) { 8 | var userAgent = navigator.userAgent || navigator.vendor || window.opera; 9 | if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) { 10 | DeviceUtil.devicePlatForm = iOS; 11 | } 12 | else if (userAgent.match(/Android/i)) { 13 | DeviceUtil.devicePlatForm = ANDROID; 14 | } 15 | else if (userAgent.match(/BlackBerry/i)) { 16 | DeviceUtil.devicePlatForm = BLACKBERRY; 17 | } 18 | else { 19 | DeviceUtil.devicePlatForm = UNKNOWN; 20 | } 21 | } 22 | return DeviceUtil.devicePlatForm; 23 | } 24 | static isAndroid() { 25 | return DeviceUtil.getPlatform() === ANDROID; 26 | } 27 | static isIOS() { 28 | return DeviceUtil.getPlatform() === iOS; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/src/utils/device.ts: -------------------------------------------------------------------------------- 1 | const iOS = 'iOS'; 2 | const ANDROID = 'ANDROID'; 3 | const BLACKBERRY = 'BLACKBERRY'; 4 | const UNKNOWN = 'UNKNOWN'; 5 | 6 | export class DeviceUtil { 7 | private static devicePlatForm:string; 8 | 9 | private static getPlatform():string { 10 | if (!DeviceUtil.devicePlatForm) { 11 | var userAgent = navigator.userAgent || navigator.vendor || (window).opera; 12 | if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) { 13 | DeviceUtil.devicePlatForm = iOS; 14 | } 15 | else if (userAgent.match(/Android/i)) { 16 | DeviceUtil.devicePlatForm = ANDROID; 17 | } 18 | else if (userAgent.match(/BlackBerry/i)) { 19 | DeviceUtil.devicePlatForm = BLACKBERRY; 20 | } 21 | else { 22 | DeviceUtil.devicePlatForm = UNKNOWN; 23 | } 24 | } 25 | return DeviceUtil.devicePlatForm; 26 | } 27 | 28 | public static isAndroid():boolean { 29 | return DeviceUtil.getPlatform() === ANDROID; 30 | } 31 | 32 | public static isIOS():boolean { 33 | return DeviceUtil.getPlatform() === iOS; 34 | } 35 | } -------------------------------------------------------------------------------- /client/src/utils/hash.js: -------------------------------------------------------------------------------- 1 | import * as objectHash from 'object-hash'; 2 | import { isTargetType } from "./general"; 3 | class MD5Hash { 4 | hash(data) { 5 | if (isTargetType(data, "Null", "Undefined")) { 6 | return void 0; 7 | } 8 | if (data === "") { 9 | return ""; 10 | } 11 | return objectHash.keysMD5(data); 12 | } 13 | } 14 | export let md5Hash = new MD5Hash(); 15 | -------------------------------------------------------------------------------- /client/src/utils/hash.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"hash.js","sourceRoot":"","sources":["hash.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,IAAY,UAAU,WAAM,aAAa,CAAC,CAAA;AAC1C,wBAA2B,WAAW,CAAC,CAAA;AAMvC;IAAA;IAUA,CAAC;IATU,sBAAI,GAAX,UAAY,IAAQ;QAChB,EAAE,CAAA,CAAC,sBAAY,CAAC,IAAI,EAAC,MAAM,EAAC,WAAW,CAAC,CAAC,CAAA,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QACD,EAAE,CAAA,CAAC,IAAI,KAAG,EAAE,CAAC,CAAA,CAAC;YACV,MAAM,CAAC,EAAE,CAAC;QACd,CAAC;QACD,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACL,cAAC;AAAD,CAAC,AAVD,IAUC;AACU,eAAO,GAAC,IAAI,OAAO,EAAE,CAAC"} -------------------------------------------------------------------------------- /client/src/utils/hash.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/10. 3 | */ 4 | import * as objectHash from 'object-hash'; 5 | import {isTargetType} from "./general"; 6 | 7 | export interface IHash{ 8 | hash(data:string|any):string; 9 | } 10 | 11 | class MD5Hash implements IHash{ 12 | public hash(data:any):string{ 13 | if(isTargetType(data,"Null","Undefined")){ 14 | return void 0; 15 | } 16 | if(data===""){ 17 | return ""; 18 | } 19 | return objectHash.keysMD5(data); 20 | } 21 | } 22 | export let md5Hash=new MD5Hash(); -------------------------------------------------------------------------------- /client/src/utils/icon.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/30. 3 | */ 4 | class ICon { 5 | getIConUser() { 6 | return 'user'; 7 | } 8 | getIConMail() { 9 | return 'mail'; 10 | } 11 | getIConMobile() { 12 | return 'mobile'; 13 | } 14 | getIConTeam() { 15 | return 'team'; 16 | } 17 | getIConLock() { 18 | return 'lock'; 19 | } 20 | getIConEdit() { 21 | return 'edit'; 22 | } 23 | } 24 | export let icon = new ICon(); 25 | -------------------------------------------------------------------------------- /client/src/utils/icon.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/30. 3 | */ 4 | 5 | class ICon{ 6 | public getIConUser(){ 7 | return 'user'; 8 | } 9 | 10 | public getIConMail(){ 11 | return 'mail'; 12 | } 13 | 14 | public getIConMobile(){ 15 | return 'mobile'; 16 | } 17 | 18 | public getIConTeam(){ 19 | return 'team'; 20 | } 21 | 22 | public getIConLock() { 23 | return 'lock'; 24 | } 25 | 26 | public getIConEdit(){ 27 | return 'edit'; 28 | } 29 | } 30 | export let icon=new ICon(); -------------------------------------------------------------------------------- /client/src/utils/logger.js: -------------------------------------------------------------------------------- 1 | export function logger(error, type = 'info') { 2 | console.error(error); 3 | } 4 | -------------------------------------------------------------------------------- /client/src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/12. 3 | */ 4 | type LoggerType = 'info' | 'fatal'; 5 | 6 | export function logger(error: Error, type = 'info') { 7 | console.error(error); 8 | } -------------------------------------------------------------------------------- /client/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import * as request from 'superagent'; 2 | const DefaultOption = { 3 | processData: false, 4 | dataType: 'json', 5 | contentType: 'application/json' 6 | }; 7 | export function post(url, data, option) { 8 | return new Promise((resolve, reject) => { 9 | request.post(url) 10 | .set(option == undefined ? DefaultOption : option) 11 | .send(data) 12 | .withCredentials() 13 | .end(function (err, res) { 14 | if (err) { 15 | reject(err); 16 | return; 17 | } 18 | resolve(res.body); 19 | }); 20 | }); 21 | } 22 | export function get(url, data, option) { 23 | return new Promise((resolve, reject) => { 24 | request.get(url) 25 | .set(DefaultOption) 26 | .query(data) 27 | .end(function (err, res) { 28 | if (err) { 29 | reject(err); 30 | return; 31 | } 32 | resolve(res.body); 33 | }); 34 | }); 35 | } 36 | -------------------------------------------------------------------------------- /client/src/utils/request.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"request.js","sourceRoot":"","sources":["request.ts"],"names":[],"mappings":";AAAA,IAAY,OAAO,WAAM,YAAY,CAAC,CAAA;AAEtC,IAAM,aAAa,GAAG;IAClB,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,kBAAkB;CAClC,CAAC;AAMF,cAAqB,GAAU,EAAE,IAAY,EAAE,MAAsB;IACjE,MAAM,CAAC,IAAI,OAAO,CAAM,UAAC,OAAO,EAAE,MAAM;QACpC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ,GAAG,CAAC,aAAa,CAAC;aAElB,IAAI,CAAC,IAAI,CAAC;aACV,GAAG,CAAC,UAAU,GAAG,EAAE,GAAG;YACnB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;gBACZ,MAAM,CAAC;YACX,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAA;IACV,CAAC,CAAC,CAAC;AACP,CAAC;AAde,YAAI,OAcnB,CAAA;AAED,aAAoB,GAAU,EAAE,IAAY,EAAE,MAAsB;IAChE,MAAM,CAAC,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;aACX,GAAG,CAAC,aAAa,CAAC;aAElB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,UAAU,GAAG,EAAE,GAAG;YACnB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;gBACZ,MAAM,CAAC;YACX,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AAde,WAAG,MAclB,CAAA"} -------------------------------------------------------------------------------- /client/src/utils/request.ts: -------------------------------------------------------------------------------- 1 | import * as request from 'superagent'; 2 | 3 | const DefaultOption = { 4 | processData: false, 5 | dataType: 'json', 6 | contentType: 'application/json' 7 | }; 8 | 9 | export interface IRequestOption { 10 | 11 | } 12 | 13 | export function post(url:string, data?:Object, option?:IRequestOption):Promise { 14 | return new Promise((resolve, reject) => { 15 | request.post(url) 16 | .set(option==undefined?DefaultOption:option) 17 | //.set(option) 18 | .send(data) 19 | .withCredentials() 20 | .end(function (err, res) { 21 | if (err) { 22 | reject(err); 23 | return; 24 | } 25 | resolve(res.body); 26 | }) 27 | }); 28 | } 29 | 30 | export function get(url:string, data?:Object, option?:IRequestOption):Promise { 31 | return new Promise((resolve, reject) => { 32 | request.get(url) 33 | .set(DefaultOption) 34 | //.set(option) 35 | .query(data) 36 | .end(function (err, res) { 37 | if (err) { 38 | reject(err); 39 | return; 40 | } 41 | resolve(res.body); 42 | }); 43 | }); 44 | } -------------------------------------------------------------------------------- /client/src/utils/requestFactory.js: -------------------------------------------------------------------------------- 1 | import { logger } from './logger'; 2 | import { StateEnumResult } from "../model/common/commonResult"; 3 | import { Modal } from 'antd'; 4 | export var requestFactory; 5 | (function (requestFactory) { 6 | function emitErrorHandler(response) { 7 | if (!response.result) { 8 | logger(new Error(JSON.stringify(response)), 'fatal'); 9 | return; 10 | } 11 | if (response.state === StateEnumResult.AuthFail) { 12 | rejectLogin(); 13 | } 14 | /*else if (response.isCommonErrorStatus()) { 15 | message.error(response.message); 16 | }*/ 17 | } 18 | requestFactory.emitErrorHandler = emitErrorHandler; 19 | function rejectLogin(message) { 20 | Modal.warning({ 21 | title: '请先登录', 22 | content: '您的帐号还未登录', 23 | onOk() { 24 | setTimeout(() => { 25 | window.location.hash = '#user/login'; 26 | }, 1000); 27 | }, 28 | }); 29 | } 30 | })(requestFactory || (requestFactory = {})); 31 | -------------------------------------------------------------------------------- /client/src/utils/requestFactory.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/12. 3 | */ 4 | import {IResponseModel} from './fetchRequest'; 5 | import {logger} from './logger'; 6 | import {StateEnumResult} from "../model/common/commonResult"; 7 | import {Modal} from 'antd'; 8 | export module requestFactory{ 9 | export function emitErrorHandler(response: IResponseModel) { 10 | if (!response.result) { 11 | logger(new Error(JSON.stringify(response)), 'fatal'); 12 | return; 13 | } 14 | if (response.state===StateEnumResult.AuthFail) { 15 | rejectLogin(); 16 | } 17 | /*else if (response.isCommonErrorStatus()) { 18 | message.error(response.message); 19 | }*/ 20 | } 21 | function rejectLogin(message?: string) { 22 | Modal.warning({ 23 | title: '请先登录', 24 | content: '您的帐号还未登录', 25 | onOk() { 26 | setTimeout(()=>{ 27 | window.location.hash = '#user/login' 28 | },1000) 29 | 30 | }, 31 | } as any); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /client/src/utils/resources.js: -------------------------------------------------------------------------------- 1 | import { isDev } from './application'; 2 | const ResourcesHost = isDev() ? 'tstres.360kad.com' : 'res.360kad.com'; 3 | export function url(path) { 4 | return `http://${ResourcesHost}${path}`; 5 | } 6 | -------------------------------------------------------------------------------- /client/src/utils/resources.ts: -------------------------------------------------------------------------------- 1 | import {isDev} from './application'; 2 | 3 | const ResourcesHost = isDev() ? 'tstres.360kad.com' : 'res.360kad.com'; 4 | 5 | export function url(path) { 6 | return `http://${ResourcesHost}${path}` 7 | } -------------------------------------------------------------------------------- /client/src/utils/route.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { Router } from 'react-router'; 3 | import { WXUtil } from './wexin'; 4 | import { ReduxAsyncConnect } from 'redux-async-connect'; 5 | export function createElement(Component, props) { 6 | WXUtil.setWxTitle(props.route.title); 7 | return (React.createElement(Component, React.__spread({}, props))); 8 | } 9 | export class WXRouter extends Router { 10 | render() { 11 | let props = Object.assign({}, this.props, { 12 | createElement: createElement, 13 | //render: applyRouterMiddleware(useScroll()) 14 | render: (props) => React.createElement(ReduxAsyncConnect, React.__spread({}, props)) 15 | }); 16 | return (React.createElement(Router, React.__spread({}, props))); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /client/src/utils/route.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {Router} from 'react-router'; 3 | import RouteProps = ReactRouter.RouteProps; 4 | //import {Router, applyRouterMiddleware} from 'react-router'; 5 | //import useScroll from 'react-router-scroll' 6 | import {WXUtil} from './wexin'; 7 | import {ReduxAsyncConnect} from 'redux-async-connect'; 8 | interface WXRouteProps extends RouteProps { 9 | title?:string; 10 | } 11 | 12 | export function createElement(Component, props) { 13 | WXUtil.setWxTitle(props.route.title); 14 | return ( 15 | 16 | ) 17 | } 18 | 19 | export class WXRouter extends Router { 20 | render() { 21 | let props = Object.assign({}, this.props, { 22 | createElement: createElement, 23 | //render: applyRouterMiddleware(useScroll()) 24 | render:(props) => 25 | }); 26 | return ( 27 | 28 | ) 29 | } 30 | } -------------------------------------------------------------------------------- /client/src/utils/userLoginCookie.js: -------------------------------------------------------------------------------- 1 | import { set, get, clear } from 'utils/cookie'; 2 | export function insertUserLoginCookie(memberCK) { 3 | var value = getUserLoginCookie('MemberCK'); 4 | if (value === '' || value === null) { 5 | return set('MemberCK', memberCK, { expires: 15 }); 6 | } 7 | } 8 | export function getUserLoginCookie(key) { 9 | return get(key); 10 | } 11 | export function clearUserLoginCookie(key) { 12 | return clear(key); 13 | } 14 | -------------------------------------------------------------------------------- /client/src/utils/userLoginCookie.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/2. 3 | */ 4 | import {set,get,clear} from 'utils/cookie'; 5 | export function insertUserLoginCookie(memberCK:string){ 6 | var value= getUserLoginCookie('MemberCK'); 7 | if(value===''||value===null) { 8 | return set('MemberCK', memberCK, {expires: 15}); 9 | } 10 | } 11 | export function getUserLoginCookie(key:string){ 12 | return get(key); 13 | } 14 | export function clearUserLoginCookie(key:string){ 15 | return clear(key); 16 | } -------------------------------------------------------------------------------- /client/src/utils/wexin.js: -------------------------------------------------------------------------------- 1 | import { DeviceUtil } from './device'; 2 | export class WXUtil { 3 | static setWxTitle(title) { 4 | if (title) { 5 | document.title = title; 6 | if (DeviceUtil.isIOS()) { 7 | var iframe = document.createElement("iframe"); 8 | iframe.setAttribute("src", "/favicon.ico"); 9 | iframe.setAttribute("style", "display:none;"); 10 | iframe.addEventListener('load', function () { 11 | setTimeout(() => { 12 | iframe.removeEventListener('load', null); 13 | document.body.removeChild(iframe); 14 | }, 0); 15 | }); 16 | document.body.appendChild(iframe); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /client/src/utils/wexin.ts: -------------------------------------------------------------------------------- 1 | import {DeviceUtil} from './device'; 2 | export class WXUtil { 3 | public static setWxTitle(title:string):void { 4 | if (title) { 5 | document.title = title; 6 | if (DeviceUtil.isIOS()) { 7 | var iframe = document.createElement("iframe"); 8 | iframe.setAttribute("src", "/favicon.ico"); 9 | iframe.setAttribute("style", "display:none;"); 10 | iframe.addEventListener('load', function () { 11 | setTimeout(()=> { 12 | iframe.removeEventListener('load', null); 13 | document.body.removeChild(iframe); 14 | }, 0); 15 | }); 16 | document.body.appendChild(iframe); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /context.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websolution", 3 | "scan": "server", 4 | "imports": [ 5 | "server/testServer/beans.json", 6 | "server/schema/beans.json", 7 | "server/mongoserver/beans.json" 8 | ], 9 | "beans": [{ 10 | "id":"dataBaseConnect", 11 | "func": "server/dataBaseConnect", 12 | "scope": "singleton" 13 | }] 14 | } -------------------------------------------------------------------------------- /dominSite.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/7/12. 4 | */ 5 | var Platform; 6 | (function (Platform) { 7 | Platform.open = "demo"; 8 | Platform.admin = "src"; 9 | })(Platform = exports.Platform || (exports.Platform = {})); 10 | exports.compilePath = './client/' + Platform.admin + "/index"; 11 | exports.serverProtocol = "http"; 12 | exports.serverHost = "127.0.0.1"; 13 | exports.serverPort = 3006; 14 | exports.serverUri = exports.serverProtocol + "://" + exports.serverHost + ":" + exports.serverPort; 15 | exports.serverHostClient = "127.0.0.1"; 16 | exports.serverPortClient = 3008; 17 | exports.serverUriClient = exports.serverProtocol + "://" + exports.serverHostClient + ":" + exports.serverPortClient; 18 | exports.hotReloadServerProtocol = 'http'; 19 | exports.hotReloadServerHost = '127.0.0.1'; 20 | exports.hotReloadServerPort = 3007; 21 | exports.hotReloadServerUri = exports.hotReloadServerProtocol + "://" + exports.hotReloadServerHost + ":" + exports.hotReloadServerPort; 22 | -------------------------------------------------------------------------------- /dominSite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/12. 3 | */ 4 | export module Platform{ 5 | export var open="demo"; 6 | export var admin="src"; 7 | } 8 | export const compilePath='./client/'+Platform.admin+"/index"; 9 | export const serverProtocol="http"; 10 | 11 | export const serverHost="127.0.0.1"; 12 | export const serverPort=3006; 13 | export const serverUri=serverProtocol+"://"+serverHost+":"+serverPort; 14 | 15 | export const serverHostClient="127.0.0.1"; 16 | export const serverPortClient=3008; 17 | export const serverUriClient=serverProtocol+"://"+serverHostClient+":"+serverPortClient; 18 | 19 | export const hotReloadServerProtocol = 'http'; 20 | export const hotReloadServerHost = '127.0.0.1'; 21 | export const hotReloadServerPort = 3007; 22 | export const hotReloadServerUri = hotReloadServerProtocol + "://" + hotReloadServerHost + ":" + hotReloadServerPort; -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/favicon.ico -------------------------------------------------------------------------------- /gif/3404488244.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/gif/3404488244.gif -------------------------------------------------------------------------------- /npm-debug.log.2379601508: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/npm-debug.log.2379601508 -------------------------------------------------------------------------------- /server/ResponseModel.ts: -------------------------------------------------------------------------------- 1 | export enum ApiStateEnum{ 2 | Success = 1, 3 | Empty = 0, 4 | Error = -1, 5 | AuthFail=2, 6 | Timeout=-1000, 7 | NotFound=-404, 8 | ServerError=500 9 | } 10 | 11 | export interface ErrorResponseInnerModel { 12 | Message:string; 13 | Code:string; 14 | } 15 | 16 | 17 | export class ResponseModel { 18 | public Result:any|ErrorResponseInnerModel; 19 | public State:ApiStateEnum; 20 | 21 | // public static getEmptyResponseModel(errMessage:string) { 22 | // let responseModel = new ResponseModel(); 23 | // responseModel.Result = {Message: errMessage}; 24 | // responseModel.State = ApiStateEnum.Empty; 25 | // return responseModel; 26 | // } 27 | 28 | public static getSuccessResponseModel(content:any) { 29 | let responseModel = new ResponseModel(); 30 | responseModel.Result = content; 31 | responseModel.State = ApiStateEnum.Success; 32 | return responseModel; 33 | } 34 | 35 | public static getErrorResponseModel(errMessage,state?:ApiStateEnum) { 36 | let responseModel = new ResponseModel(); 37 | responseModel.Result = {Message: errMessage,Code:""}; 38 | responseModel.State =state?state:ApiStateEnum.Error; 39 | return responseModel; 40 | } 41 | } -------------------------------------------------------------------------------- /server/api/Authorization/requireAuthorization.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/11/23. 4 | */ 5 | var express = require('express'); 6 | var cookieKey_1 = require("../../common/cookieKey"); 7 | var keyMemberCK_1 = require("../../common/keyMemberCK"); 8 | var cookie_1 = require("../../common/cookie"); 9 | var ResponseTool_1 = require("../../common/ResponseTool"); 10 | var ResponseModel_1 = require("../../ResponseModel"); 11 | exports.requireAuthorization = express.Router(); 12 | exports.requireAuthorization.use(function (req, res, next) { 13 | try { 14 | var result = keyMemberCK_1.keyMemberCK().decrypt(cookie_1.getCookie(cookieKey_1.MemberCK, req), 'utf-8'); 15 | if (result) { 16 | next(); 17 | } 18 | } 19 | catch (e) { 20 | cookie_1.clearCookie(cookieKey_1.MemberCK, res); 21 | ResponseTool_1.response(res, JSON.stringify(ResponseModel_1.ResponseModel.getErrorResponseModel('请先登录', ResponseModel_1.ApiStateEnum.AuthFail)), 401); 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /server/api/Authorization/requireAuthorization.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/23. 3 | */ 4 | import * as express from 'express'; 5 | import {Request, Response} from 'express'; 6 | import {MemberCK} from "../../common/cookieKey"; 7 | import {keyMemberCK} from "../../common/keyMemberCK"; 8 | import {getCookie, clearCookie} from "../../common/cookie"; 9 | import {response} from "../../common/ResponseTool"; 10 | import {ResponseModel, ApiStateEnum} from "../../ResponseModel"; 11 | 12 | export let requireAuthorization = express.Router(); 13 | requireAuthorization.use((req: Request, res: Response, next: Function) => { 14 | try{ 15 | let result=keyMemberCK().decrypt(getCookie(MemberCK,req),'utf-8'); 16 | if(result){//中间件拦截验证调用API权限 验证通过进入下一方法 17 | next(); 18 | } 19 | }catch (e){ 20 | clearCookie(MemberCK,res); 21 | response(res,JSON.stringify(ResponseModel.getErrorResponseModel('请先登录',ApiStateEnum.AuthFail)),401); 22 | } 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /server/api/user/regist.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var Bearcat = require('bearcat'); 5 | var UserInfo_1 = require('../../models/UserInfo'); 6 | var url = require('url'); 7 | router.post('/regist', function (req, res) { 8 | var info = new UserInfo_1.UserInfo(); 9 | // info.UserId=1; 10 | info.TrueName = req.body.trueName; 11 | info.Email = req.body.email; 12 | info.IsDelete = 0; 13 | info.Mobile = req.body.mobile; 14 | info.UserName = req.body.userName; 15 | info.UserPassword = req.body.userPassword; 16 | info.CreateDate = new Date().toDateString(); 17 | var UserInfoServer = Bearcat.getBean('UserInfoService'); 18 | UserInfoServer.InsertUser(info).then(function (result) { 19 | console.log(result); 20 | res.writeHead(200, { 'Content-Type': 'application/json' }); 21 | // res.end(JSON.stringify(result)); 22 | //console.log(result) 23 | res.end(result); 24 | return; 25 | }); 26 | }); 27 | module.exports = router; 28 | -------------------------------------------------------------------------------- /server/api/user/regist.ts: -------------------------------------------------------------------------------- 1 | import express = require('express'); 2 | import * as path from 'path'; 3 | let router = express.Router(); 4 | var Bearcat = require('bearcat'); 5 | import {UserInfo} from '../../models/UserInfo'; 6 | var url=require('url'); 7 | 8 | 9 | router.post('/regist',(req:express.Request, res:express.Response)=> { 10 | 11 | var info=new UserInfo(); 12 | // info.UserId=1; 13 | info.TrueName=req.body.trueName; 14 | info.Email=req.body.email; 15 | info.IsDelete=0; 16 | info.Mobile=req.body.mobile; 17 | info.UserName=req.body.userName; 18 | info.UserPassword=req.body.userPassword; 19 | info.CreateDate=new Date().toDateString(); 20 | var UserInfoServer=Bearcat.getBean('UserInfoService'); 21 | UserInfoServer.InsertUser(info).then((result)=>{ 22 | console.log(result); 23 | res.writeHead(200, {'Content-Type': 'application/json'}); 24 | // res.end(JSON.stringify(result)); 25 | //console.log(result) 26 | res.end(result); 27 | return; 28 | }); 29 | 30 | }); 31 | 32 | export = router; 33 | -------------------------------------------------------------------------------- /server/api/user/registTest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var Bearcat = require('bearcat'); 5 | var UserInfo_1 = require('../../models/UserInfo'); 6 | var url = require('url'); 7 | router.post('/registTest', function (req, res) { 8 | var info = new UserInfo_1.UserInfo(); 9 | // info.UserId=1; 10 | info.TrueName = req.body.TrueName; 11 | info.Email = req.body.Email; 12 | info.IsDelete = 0; 13 | info.Mobile = req.body.Mobile; 14 | info.UserName = req.body.UserName; 15 | info.UserPassword = req.body.UserPassword; 16 | info.CreateDate = new Date().toDateString(); 17 | var UserInfoServer = Bearcat.getBean('UserInfoService'); 18 | // UserInfoServer.InsertUser(info); 19 | console.log(req.body); 20 | // console.log(url.parse('http://www.mgenware.com/a/b/c')) 21 | res.writeHead(200, { 'Content-Type': 'application/json' }); 22 | res.end(JSON.stringify("1")); 23 | }); 24 | module.exports = router; 25 | -------------------------------------------------------------------------------- /server/api/user/registTest.ts: -------------------------------------------------------------------------------- 1 | import express = require('express'); 2 | import * as path from 'path'; 3 | let router = express.Router(); 4 | var Bearcat = require('bearcat'); 5 | import {UserInfo} from '../../models/UserInfo'; 6 | var url=require('url'); 7 | router.post('/registTest', (req:express.Request, res:express.Response)=> { 8 | 9 | var info=new UserInfo(); 10 | // info.UserId=1; 11 | info.TrueName=req.body.TrueName; 12 | info.Email=req.body.Email; 13 | info.IsDelete=0; 14 | info.Mobile=req.body.Mobile; 15 | info.UserName=req.body.UserName; 16 | info.UserPassword=req.body.UserPassword; 17 | info.CreateDate=new Date().toDateString(); 18 | var UserInfoServer=Bearcat.getBean('UserInfoService'); 19 | // UserInfoServer.InsertUser(info); 20 | console.log(req.body) 21 | // console.log(url.parse('http://www.mgenware.com/a/b/c')) 22 | res.writeHead(200, {'Content-Type': 'application/json'}); 23 | res.end(JSON.stringify("1")); 24 | }); 25 | 26 | export = router; 27 | -------------------------------------------------------------------------------- /server/common/EnumTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/24. 3 | */ 4 | export enum DeleteEnum{ 5 | //未删除 6 | NotDel=0, 7 | //已删除 8 | IsDel=1 9 | } 10 | export enum CheckEnum 11 | { 12 | /// 13 | /// 未通过:2 14 | /// 15 | UnPass = 2, 16 | 17 | /// 未审核:0 18 | Waiting = 0, 19 | 20 | /// 21 | /// 已审核:1 22 | /// 23 | Pass = 1, 24 | } 25 | export enum UseStateEnum 26 | { 27 | /// 28 | /// 启用1 29 | /// 30 | Enable = 1, 31 | /// 32 | /// 停用0 33 | /// 34 | Disable = 0 35 | } 36 | 37 | export enum SexEnum 38 | { 39 | /// 40 | /// 未知0 41 | /// 42 | Unknown = 0, 43 | /// 44 | /// 男1 45 | // / 46 | Man = 1, 47 | /// 48 | /// 女2 49 | /// 50 | Woman = 2 51 | 52 | } 53 | export enum FormsRole 54 | { 55 | /// 56 | /// 管理员 57 | /// 58 | Admin=0, 59 | 60 | /// 61 | /// 网站用户 62 | /// 63 | Member=1 64 | } 65 | 66 | export enum StringComparison{ 67 | 68 | //忽略大小写 69 | OrdinalIgnoreCase=0 70 | } 71 | -------------------------------------------------------------------------------- /server/common/ResponseTool.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function response(res, result, statusCode, headers) { 3 | var defaultHeaders = { 4 | 'Content-Type': 'application/json' 5 | }; 6 | var defaultStatusCode = 200; 7 | res.writeHead(statusCode ? statusCode : defaultStatusCode, headers ? headers : defaultHeaders); 8 | res.end(result); 9 | } 10 | exports.response = response; 11 | -------------------------------------------------------------------------------- /server/common/ResponseTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/16. 3 | */ 4 | import express=require('express'); 5 | 6 | export function response(res:express.Response,result:string,statusCode?:number,headers?: any){ 7 | let defaultHeaders={ 8 | 'Content-Type': 'application/json' 9 | }; 10 | let defaultStatusCode=200; 11 | res.writeHead(statusCode?statusCode:defaultStatusCode,headers?headers:defaultHeaders); 12 | res.end(result); 13 | } -------------------------------------------------------------------------------- /server/common/cookie.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/9/16. 4 | */ 5 | function setCookie(key, value, res, options) { 6 | var DefaultOption = { 7 | expires: 15, path: '/', httpOnly: true, secure: false 8 | }; 9 | options = options ? options : DefaultOption; 10 | options = Object.assign({}, options); 11 | if (value === null || value === undefined) { 12 | options.expires = -1; 13 | } 14 | if (typeof options.expires === 'number') { 15 | var days = options.expires, t = options.expires = new Date(); 16 | t.setDate(t.getDate() + days); 17 | } 18 | value = String(value); 19 | res.cookie(key, value, options); 20 | } 21 | exports.setCookie = setCookie; 22 | function getCookie(key, req) { 23 | var cookieValue = req.cookies[key]; 24 | return cookieValue ? decodeURIComponent(cookieValue) : null; 25 | } 26 | exports.getCookie = getCookie; 27 | function clearCookie(key, res) { 28 | res.clearCookie(key, null); 29 | } 30 | exports.clearCookie = clearCookie; 31 | -------------------------------------------------------------------------------- /server/common/cookie.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/16. 3 | */ 4 | export function setCookie(key,value,res:any,options?:any){ 5 | const DefaultOption = { 6 | expires:15,path:'/',httpOnly:true,secure:false 7 | }; 8 | options=options?options:DefaultOption; 9 | 10 | options=Object.assign({},options); 11 | if(value===null||value===undefined){ 12 | options.expires=-1; 13 | } 14 | if(typeof options.expires==='number'){ 15 | var days=options.expires,t=options.expires=new Date(); 16 | t.setDate(t.getDate()+days); 17 | } 18 | value=String(value); 19 | 20 | res.cookie(key,value,options); 21 | } 22 | 23 | export function getCookie(key,req:any){ 24 | let cookieValue=req.cookies[key]; 25 | return cookieValue?decodeURIComponent(cookieValue):null; 26 | } 27 | 28 | export function clearCookie(key:string,res:any){ 29 | res.clearCookie(key,null); 30 | } -------------------------------------------------------------------------------- /server/common/cookieKey.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by xiaoduan on 2016/11/7. 4 | */ 5 | exports.ValidateCodeKey = 'ValidateCode'; 6 | exports.MemberCK = 'MemberCK'; 7 | -------------------------------------------------------------------------------- /server/common/cookieKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/7. 3 | */ 4 | export const ValidateCodeKey='ValidateCode'; 5 | export const MemberCK='MemberCK'; -------------------------------------------------------------------------------- /server/common/general.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/9/10. 4 | */ 5 | var protoObj2String = function (val) { return Object.prototype.toString.call(val); }; 6 | function getType(val) { 7 | return protoObj2String(val).replace(/^\[object (\w+)\]$/ig, '$1').toLowerCase(); 8 | } 9 | exports.getType = getType; 10 | function isTargetType(val) { 11 | var targetArr = []; 12 | for (var _i = 1; _i < arguments.length; _i++) { 13 | targetArr[_i - 1] = arguments[_i]; 14 | } 15 | return targetArr.some(function (target) { 16 | return protoObj2String(val) === "[object " + target + "]"; 17 | }); 18 | } 19 | exports.isTargetType = isTargetType; 20 | function isUndefined(val) { 21 | return typeof val === 'undefined'; 22 | } 23 | exports.isUndefined = isUndefined; 24 | function isString(val) { 25 | return typeof val === 'string'; 26 | } 27 | exports.isString = isString; 28 | -------------------------------------------------------------------------------- /server/common/general.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/10. 3 | */ 4 | const protoObj2String:Function=(val:any)=>Object.prototype.toString.call(val); 5 | type VariableType = "Object"|"Number"|"Null"|"String"|"Boolean"|"Undefined"|"Array"; 6 | 7 | export function getType(val):string{ 8 | return protoObj2String(val).replace(/^\[object (\w+)\]$/ig,'$1').toLowerCase(); 9 | } 10 | 11 | export function isTargetType(val:any,...targetArr:VariableType[]){ 12 | return targetArr.some((target:VariableType)=>{ 13 | return protoObj2String(val) ===`[object ${target}]`; 14 | }) 15 | } 16 | 17 | export function isUndefined(val:any):boolean{ 18 | return typeof val==='undefined'; 19 | } 20 | 21 | export function isString(val:any):boolean{ 22 | return typeof val==='string'; 23 | } -------------------------------------------------------------------------------- /server/common/keyMemberCK.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/9/16. 4 | */ 5 | var NodeRSA = require('node-rsa'); 6 | /*export var keyMemberCK=function () { 7 | console.log(keyMemberCK); 8 | if(!keyMemberCK){ 9 | return new NodeRSA({b:512}); 10 | } 11 | return keyMemberCK; 12 | }*/ 13 | /* 14 | export var keyMemberCK=new NodeRSA({b:512});*/ 15 | /*module.exports=keyMemberCK;*/ 16 | exports.keyMemberCK = function () { 17 | var unique; 18 | function getInstance() { 19 | if (unique === undefined) { 20 | unique = new NodeRSA({ b: 512 }, '', { environment: 'node', encryptionScheme: 'pkcs1', signingScheme: 'pss-sha1' }); 21 | } 22 | return unique; 23 | } 24 | return getInstance; 25 | }(); 26 | -------------------------------------------------------------------------------- /server/common/keyMemberCK.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/9/16. 3 | */ 4 | var NodeRSA=require('node-rsa'); 5 | /*export var keyMemberCK=function () { 6 | console.log(keyMemberCK); 7 | if(!keyMemberCK){ 8 | return new NodeRSA({b:512}); 9 | } 10 | return keyMemberCK; 11 | }*/ 12 | /* 13 | export var keyMemberCK=new NodeRSA({b:512});*/ 14 | /*module.exports=keyMemberCK;*/ 15 | export var keyMemberCK=function () { 16 | var unique; 17 | function getInstance(){ 18 | if(unique === undefined){ 19 | unique=new NodeRSA({b:512},'',{environment:'node',encryptionScheme:'pkcs1',signingScheme:'pss-sha1'}); 20 | } 21 | return unique; 22 | } 23 | return getInstance; 24 | }() 25 | -------------------------------------------------------------------------------- /server/common/stringTool.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var EnumTool_1 = require("./EnumTool"); 3 | /** 4 | * Created by xiaoduan on 2016/11/7. 5 | */ 6 | function equal(a, b, stringComparison) { 7 | switch (stringComparison) { 8 | case EnumTool_1.StringComparison.OrdinalIgnoreCase: 9 | if (b.toLowerCase() === a.toLowerCase()) { 10 | return true; 11 | } 12 | default: 13 | if (a === b) { 14 | return true; 15 | } 16 | } 17 | return false; 18 | } 19 | exports.equal = equal; 20 | -------------------------------------------------------------------------------- /server/common/stringTool.ts: -------------------------------------------------------------------------------- 1 | import {StringComparison} from "./EnumTool"; 2 | /** 3 | * Created by xiaoduan on 2016/11/7. 4 | */ 5 | export function equal(a:string,b:string,stringComparison?:StringComparison){ 6 | switch (stringComparison){ 7 | case StringComparison.OrdinalIgnoreCase: 8 | if(b.toLowerCase()===a.toLowerCase()){ 9 | return true; 10 | } 11 | default: 12 | if(a===b){ 13 | return true; 14 | } 15 | } 16 | return false; 17 | } -------------------------------------------------------------------------------- /server/common/uuid.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by xiaoduan on 2016/11/23. 4 | */ 5 | var UUID = require('uuid-js'); 6 | function generateUUID() { 7 | return UUID.create().toString(); 8 | } 9 | exports.generateUUID = generateUUID; 10 | -------------------------------------------------------------------------------- /server/common/uuid.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/23. 3 | */ 4 | const UUID = require('uuid-js'); 5 | 6 | export function generateUUID(): string { 7 | return UUID.create().toString(); 8 | } -------------------------------------------------------------------------------- /server/configs/bearcatConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/7/22. 4 | */ 5 | var Bearcat = require('bearcat'); 6 | var contextPath = require.resolve('../../context.json'); 7 | //export const bearcatRosolve=Bearcat.createApp([contextPath]); 8 | Bearcat.createApp([contextPath]); 9 | exports.bearcatConfig = function (app) { 10 | Bearcat.start(function () { 11 | //var car = Bearcat.getBean('car'); // get bean 示例 12 | // console.log(bearcat.getModel('car')); 13 | //car.run(); // call the method 14 | var dataBaseConnects = Bearcat.getBean('dataBaseConnect'); 15 | dataBaseConnects.connect(); 16 | var UserSchema = Bearcat.getBean('UserSchema'); 17 | UserSchema.connect(); 18 | }); 19 | }; 20 | exports.bearcatInit = function (app) { 21 | Bearcat.start(function () { 22 | var dataBaseConnects = Bearcat.getBean('dataBaseConnect'); 23 | }); 24 | }; 25 | -------------------------------------------------------------------------------- /server/configs/bearcatConfig.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/22. 3 | */ 4 | var Bearcat = require('bearcat'); 5 | var contextPath = require.resolve('../../context.json'); 6 | //export const bearcatRosolve=Bearcat.createApp([contextPath]); 7 | Bearcat.createApp([contextPath]); 8 | export const bearcatConfig=(app)=>{ 9 | Bearcat.start(function(){ 10 | //var car = Bearcat.getBean('car'); // get bean 示例 11 | // console.log(bearcat.getModel('car')); 12 | //car.run(); // call the method 13 | var dataBaseConnects=Bearcat.getBean('dataBaseConnect'); 14 | dataBaseConnects.connect(); 15 | var UserSchema=Bearcat.getBean('UserSchema'); 16 | UserSchema.connect(); 17 | }); 18 | }; 19 | export const bearcatInit=(app)=>{ 20 | Bearcat.start(function(){ 21 | var dataBaseConnects=Bearcat.getBean('dataBaseConnect'); 22 | }); 23 | } -------------------------------------------------------------------------------- /server/configs/bundlerConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.bundlerConfig = function (app) { 3 | // We require the bundler inside the if block because 4 | // it is only needed in a development environment. Later 5 | // you will see why this is a good idea 6 | require('../../webpack-dev-server')(app); 7 | }; 8 | -------------------------------------------------------------------------------- /server/configs/bundlerConfig.ts: -------------------------------------------------------------------------------- 1 | export const bundlerConfig = (app)=> { 2 | // We require the bundler inside the if block because 3 | // it is only needed in a development environment. Later 4 | // you will see why this is a good idea 5 | require('../../webpack-dev-server')(app); 6 | }; -------------------------------------------------------------------------------- /server/configs/error-parser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var errorHandler = require('errorhandler'); 6 | var notifier = require('node-notifier'); 7 | var app_1 = require('../routes/app'); 8 | var server_config_1 = require('../configs/server-config'); 9 | function errorNotification(err, str, req, res) { 10 | var title = 'Error in' + req.method + '' + req.url; 11 | notifier.notify({ 12 | title: title, 13 | message: str 14 | }); 15 | } 16 | ; 17 | exports.init = function () { 18 | if (server_config_1.SERVER_CONFIG.env == server_config_1.DEV) { 19 | app_1.app.use(errorHandler({ log: errorNotification })); 20 | } 21 | exports.init = function () { 22 | throw new Error('timeout-parser.ts: Timeout parser has been initialized.'); 23 | }; 24 | }; 25 | -------------------------------------------------------------------------------- /server/configs/error-parser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import * as errorHandler from 'errorhandler'; 5 | import * as notifier from 'node-notifier'; 6 | import {app} from '../routes/app'; 7 | 8 | import {Response,Request} from 'express'; 9 | import {DEV,SERVER_CONFIG} from '../configs/server-config'; 10 | function errorNotification(err:Error,str:string,req:Request,res:Response){ 11 | const title='Error in'+req.method+''+req.url; 12 | notifier.notify({ 13 | title:title, 14 | message:str 15 | }); 16 | }; 17 | export let init=()=>{ 18 | if(SERVER_CONFIG.env==DEV){ 19 | app.use(errorHandler({log:errorNotification})); 20 | } 21 | init=()=>{ 22 | throw new Error('timeout-parser.ts: Timeout parser has been initialized.'); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /server/configs/server-config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | exports.PROD = "prod"; 6 | exports.DEV = 'dev'; 7 | exports.SERVER_CONFIG = require('../server-config.json'); 8 | -------------------------------------------------------------------------------- /server/configs/server-config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | export const PROD="prod"; 5 | export const DEV='dev'; 6 | interface IserverConfig{ 7 | timeout:number; 8 | port:number; 9 | env:"prod"|"dev"; 10 | } 11 | export const SERVER_CONFIG:IserverConfig=require('../server-config.json'); -------------------------------------------------------------------------------- /server/configs/staticConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var express = require('express'); 3 | var path = require('path'); 4 | var app_1 = require('../routes/app'); 5 | var baseDir = path.resolve('.'); 6 | /* node路由,允许访问的路径*/ 7 | exports.staticConfig = function (app) { 8 | app.use("/common", express.static(baseDir + '/client/common/')); 9 | app.use("/client", express.static(baseDir + '/client')); 10 | app.use("/static", express.static(baseDir + '/static')); 11 | app.use("/favicon.ico", express.static(baseDir + '/favicon.ico')); 12 | }; 13 | exports.staticResourceInit = function () { 14 | app_1.app.use(express.static(path.join(__dirname, 'public'))); //允许public文件资源被访问 15 | app_1.app.use("/common", express.static(baseDir + '/client/common/')); 16 | app_1.app.use("/upload", express.static(baseDir + '/server/upload/')); 17 | app_1.app.use("/static", express.static(baseDir + '/static')); 18 | app_1.app.use("/favicon.ico", express.static(baseDir + '/favicon.ico')); 19 | exports.staticResourceInit = function () { 20 | throw new Error("static-resource.ts: Static resources have been initialized."); 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /server/configs/staticConfig.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import * as path from 'path'; 3 | import {app} from '../routes/app'; 4 | const baseDir = path.resolve('.'); 5 | /* node路由,允许访问的路径*/ 6 | export const staticConfig = (app)=> { 7 | app.use("/common", express.static(baseDir + '/client/common/')); 8 | app.use("/client", express.static(baseDir + '/client')); 9 | app.use("/static", express.static(baseDir + '/static')); 10 | app.use("/favicon.ico", express.static(baseDir + '/favicon.ico')); 11 | }; 12 | export let staticResourceInit=()=>{ 13 | app.use(express.static(path.join(__dirname, 'public')));//允许public文件资源被访问 14 | app.use("/common", express.static(baseDir + '/client/common/')); 15 | app.use("/upload", express.static(baseDir + '/server/upload/')); 16 | app.use("/static", express.static(baseDir + '/static')); 17 | app.use("/favicon.ico", express.static(baseDir + '/favicon.ico')); 18 | staticResourceInit = ()=> { 19 | throw new Error("static-resource.ts: Static resources have been initialized."); 20 | } 21 | }; -------------------------------------------------------------------------------- /server/configs/timeout-parser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var timeout = require('express-timeout-handler'); 6 | var app_1 = require('../routes/app'); 7 | var options = { 8 | timeout: 10000, 9 | onTimeout: function (req, res) { 10 | res.json({ status: "timeout" }); 11 | } 12 | }; 13 | exports.init = function () { 14 | app_1.app.use(timeout.handler(options)); 15 | exports.init = function () { 16 | throw new Error('timeout-parser.ts: Timeout parser has been initialized.'); 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /server/configs/timeout-parser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import * as timeout from 'express-timeout-handler'; 5 | import {app} from '../routes/app'; 6 | import {IExpressTimeoutHandlerOption} from "express-timeout-handler"; 7 | const options:IExpressTimeoutHandlerOption={ 8 | timeout:10000, 9 | onTimeout:function (req,res) { 10 | res.json({status:"timeout"}); 11 | } 12 | }; 13 | export let init=()=>{ 14 | app.use(timeout.handler(options)); 15 | init=()=>{ 16 | throw new Error('timeout-parser.ts: Timeout parser has been initialized.'); 17 | } 18 | } -------------------------------------------------------------------------------- /server/configs/webpackInit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/8/27. 4 | */ 5 | var routeConfig_1 = require('../routes/routeConfig'); 6 | var staticConfig_1 = require('./staticConfig'); 7 | var whmConfig_1 = require('./whmConfig'); 8 | var bundlerConfig_1 = require('./bundlerConfig'); 9 | var app_1 = require('../routes/app'); 10 | exports.webpackInit = function () { 11 | bundlerConfig_1.bundlerConfig(app_1.app); 12 | whmConfig_1.whmConfig(app_1.app); 13 | staticConfig_1.staticResourceInit(); 14 | routeConfig_1.routeConfig(app_1.app); 15 | exports.webpackInit = function () { 16 | throw new Error('server/index.ts: server has been initialised.'); 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /server/configs/webpackInit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/8/27. 3 | */ 4 | import {routeConfig} from '../routes/routeConfig'; 5 | import {staticResourceInit,staticConfig} from './staticConfig'; 6 | import {whmConfig} from './whmConfig'; 7 | import {bundlerConfig} from './bundlerConfig'; 8 | import {app} from '../routes/app'; 9 | export let webpackInit=()=>{ 10 | 11 | bundlerConfig(app); 12 | whmConfig(app); 13 | staticResourceInit(); 14 | routeConfig(app); 15 | 16 | webpackInit = ()=> { 17 | throw new Error('server/index.ts: server has been initialised.'); 18 | } 19 | } -------------------------------------------------------------------------------- /server/configs/whmConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var webpack = require('webpack'); 3 | var config = require('../../webpack.config'); 4 | var compiler = webpack(config); 5 | exports.whmConfig = function (app) { 6 | app.use(require('webpack-hot-middleware')(compiler)); 7 | }; 8 | -------------------------------------------------------------------------------- /server/configs/whmConfig.ts: -------------------------------------------------------------------------------- 1 | import * as webpack from 'webpack'; 2 | import * as config from '../../webpack.config'; 3 | let compiler = webpack(config); 4 | export const whmConfig = (app)=> { 5 | app.use(require('webpack-hot-middleware')(compiler)); 6 | }; -------------------------------------------------------------------------------- /server/models/SysMenu.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by xiaoduan on 2016/10/16. 4 | */ 5 | var SysMenu = (function () { 6 | function SysMenu() { 7 | } 8 | return SysMenu; 9 | }()); 10 | exports.SysMenu = SysMenu; 11 | -------------------------------------------------------------------------------- /server/models/SysMenu.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/16. 3 | */ 4 | export class SysMenu{ 5 | 6 | public MenuId:number; 7 | 8 | public UpperId:number; 9 | 10 | public DeepIndex:number; 11 | 12 | public MenuPath:string; 13 | 14 | public ClassName:string; 15 | 16 | public Title:string; 17 | 18 | public LinkUrl:string; 19 | 20 | public Status:number; 21 | 22 | public CreateDate:string; 23 | 24 | public UpdateDate:string; 25 | 26 | public OrderIndex:number; 27 | 28 | constructor(){ 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /server/models/UserInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/7/24. 4 | */ 5 | var UserInfo = (function () { 6 | function UserInfo() { 7 | // this.UpdateDate=new Date().getTime().toString(); 8 | } 9 | return UserInfo; 10 | }()); 11 | exports.UserInfo = UserInfo; 12 | -------------------------------------------------------------------------------- /server/models/UserInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/24. 3 | */ 4 | export class UserInfo{ 5 | public UserId:number; 6 | public UserName:String; 7 | public UserPassword:String; 8 | public TrueName:String; 9 | //性别 10 | public Sex:number; 11 | //电话 12 | public Tel:String; 13 | //手机号 14 | public Mobile:String; 15 | //邮箱 16 | public Email:String; 17 | 18 | public QQ:String; 19 | 20 | //头像 21 | public Photo:String; 22 | 23 | //权限 24 | public Power:String; 25 | 26 | //审核状态 27 | public ChkState:number; 28 | 29 | //是否删除 30 | public IsDelete:number; 31 | 32 | //使用状态(启用,冻结) 33 | public UseStata:number; 34 | 35 | //帐号类型 36 | public SuperAdminType:number; 37 | 38 | //最后一次登录 39 | public LastLoginDate:String; 40 | 41 | //创建时间 42 | public CreateDate:String; 43 | 44 | //最后一次更新时间 45 | public UpdateDate:String; 46 | 47 | constructor(){ 48 | // this.UpdateDate=new Date().getTime().toString(); 49 | } 50 | } -------------------------------------------------------------------------------- /server/models/pageListEntity.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/11/24. 4 | */ 5 | var PageListEntity = (function () { 6 | function PageListEntity() { 7 | } 8 | return PageListEntity; 9 | }()); 10 | exports.PageListEntity = PageListEntity; 11 | -------------------------------------------------------------------------------- /server/models/pageListEntity.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/24. 3 | */ 4 | export class PageListEntity{ 5 | public Total:number; 6 | public PageSize:number; 7 | public PageIndex:number; 8 | public TotalPage:number; 9 | public Data:any; 10 | constructor(){ 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /server/mongoserver/SystemMenuService.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by xiaoduan on 2016/10/16. 4 | */ 5 | var ResponseModel_1 = require('../ResponseModel'); 6 | var Promise = require('bluebird'); 7 | var Bearcat = require('bearcat'); 8 | var SystemMenuService = function () { 9 | var dateBaseConnect = Bearcat.getBean('dataBaseConnect'); 10 | var db = dateBaseConnect.createConnection(); 11 | var SystemMenuSchema = Bearcat.getBean('SystemMenuSchema'); 12 | this.SystemMenuMongo = SystemMenuSchema.createConnection(db); 13 | }; 14 | SystemMenuService.prototype.InsertSysMenu = function (info) { 15 | var infoModel = new this.SystemMenuMongo(info); 16 | var query = this.SystemMenuMongo.findOne({ 'Title': info.Title }); 17 | return query.exec().then(function (result) { 18 | if (result) { 19 | return Promise.resolve(JSON.stringify(ResponseModel_1.ResponseModel.getErrorResponseModel('菜单已经存在,请重新添加'))); 20 | } 21 | else { 22 | return infoModel.save().then(function (result, state, err) { 23 | return Promise.resolve(JSON.stringify(ResponseModel_1.ResponseModel.getErrorResponseModel('添加成功'))); 24 | }); 25 | } 26 | }, function (err) { 27 | return Promise.reject(JSON.stringify(ResponseModel_1.ResponseModel.getErrorResponseModel('添加系统菜单失败,请重试'))); 28 | }); 29 | }; 30 | -------------------------------------------------------------------------------- /server/mongoserver/SystemMenuService.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/16. 3 | */ 4 | import {ResponseModel} from '../ResponseModel'; 5 | import Promise=require('bluebird'); 6 | import {SysMenu} from '../models/SysMenu'; 7 | var Bearcat=require('bearcat'); 8 | var SystemMenuService=function () { 9 | let dateBaseConnect=Bearcat.getBean('dataBaseConnect'); 10 | let db=dateBaseConnect.createConnection(); 11 | let SystemMenuSchema=Bearcat.getBean('SystemMenuSchema'); 12 | this.SystemMenuMongo=SystemMenuSchema.createConnection(db); 13 | }; 14 | 15 | SystemMenuService.prototype.InsertSysMenu=function (info:SysMenu):Promise { 16 | var infoModel=new this.SystemMenuMongo(info); 17 | var query=this.SystemMenuMongo.findOne({'Title':info.Title}); 18 | return query.exec().then(function (result) { 19 | if(result){ 20 | return Promise.resolve(JSON.stringify(ResponseModel.getErrorResponseModel('菜单已经存在,请重新添加'))); 21 | } 22 | else { 23 | return infoModel.save().then(function (result,state,err) { 24 | return Promise.resolve(JSON.stringify(ResponseModel.getErrorResponseModel('添加成功'))) 25 | }) 26 | } 27 | },function (err) { 28 | return Promise.reject(JSON.stringify(ResponseModel.getErrorResponseModel('添加系统菜单失败,请重试'))) 29 | }); 30 | } -------------------------------------------------------------------------------- /server/mongoserver/UserInfoServer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/7/24. 4 | */ 5 | var mongoose = require('mongoose'); // 6 | var UserInfoServer = function () { 7 | }; 8 | UserInfoServer.prototype.InsertUser = function (info) { 9 | //var ObjectId = mongoose.Schema.Types.ObjectId; 10 | /*var UserSchema=new mongoose.Schema({ 11 | UserId:Numb, 12 | QQ:String 13 | }); 14 | var UserInfoMongo= mongoose.model('User',UserSchema);*/ 15 | var UserInfoMongo = mongoose.model('User'); 16 | var infoMoel = new UserInfoMongo(info); 17 | infoMoel.find({ "UserName": info.UserName }, function (err) { 18 | console.log('find status:', err ? 'failed' : '已存在'); 19 | }); 20 | infoMoel.save(function (err) { 21 | console.log('save status:', err ? 'failed' : 'success1'); 22 | }); 23 | }; 24 | module.exports = UserInfoServer; 25 | -------------------------------------------------------------------------------- /server/mongoserver/UserInfoServer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/24. 3 | */ 4 | var mongoose=require('mongoose');// 5 | //import {UserSchema} from './UserSchema'; 6 | import {UserInfo} from '../models/UserInfo'; 7 | var UserInfoServer=function () { 8 | } 9 | UserInfoServer.prototype.InsertUser=function (info:UserInfo) { 10 | //var ObjectId = mongoose.Schema.Types.ObjectId; 11 | /*var UserSchema=new mongoose.Schema({ 12 | UserId:Numb, 13 | QQ:String 14 | }); 15 | var UserInfoMongo= mongoose.model('User',UserSchema);*/ 16 | var UserInfoMongo=mongoose.model('User'); 17 | var infoMoel=new UserInfoMongo(info); 18 | infoMoel.find({"UserName":info.UserName},function (err) { 19 | console.log('find status:',err ? 'failed' : '已存在'); 20 | }); 21 | infoMoel.save(function (err) { 22 | console.log('save status:',err ? 'failed' : 'success1'); 23 | }); 24 | 25 | }; 26 | module.exports=UserInfoServer; 27 | -------------------------------------------------------------------------------- /server/mongoserver/beans.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongodb", 3 | "scan": "", 4 | "beans": [{ 5 | "id":"UserInfoServer", 6 | "func": "UserInfoServer", 7 | "scope": "singleton", 8 | "lazy":true 9 | },{ 10 | "id":"UserInfoService", 11 | "func": "UserInfoService", 12 | "scope": "singleton", 13 | "lazy":true 14 | },{ 15 | "id":"SystemMenuService", 16 | "func":"SystemMenuService", 17 | "scope":"singleton", 18 | "lazy":true 19 | },{ 20 | "id":"BlogCateService", 21 | "func":"BlogCateService", 22 | "scope":"singleton", 23 | "lazy":true 24 | }, 25 | { 26 | "id":"ContentService", 27 | "func":"ContentService", 28 | "scope":"singleton", 29 | "lazy":true 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /server/routes/AuthorizationInit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/11/23. 4 | */ 5 | var app_1 = require('./app'); 6 | var requireAuthorization_1 = require("../api/Authorization/requireAuthorization"); 7 | var blogRouteInit_1 = require("./blogRouteInit"); 8 | exports.AuthorizationInit = function () { 9 | app_1.app.use(requireAuthorization_1.requireAuthorization); 10 | blogRouteInit_1.blogRouteInit(); 11 | }; 12 | -------------------------------------------------------------------------------- /server/routes/AuthorizationInit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/23. 3 | */ 4 | import {app} from './app'; 5 | import {requireAuthorization} from "../api/Authorization/requireAuthorization"; 6 | import {blogRouteInit} from "./blogRouteInit"; 7 | export let AuthorizationInit=()=>{ 8 | app.use(requireAuthorization); 9 | blogRouteInit(); 10 | } -------------------------------------------------------------------------------- /server/routes/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var express = require('express'); 6 | exports.app = express(); 7 | -------------------------------------------------------------------------------- /server/routes/app.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import * as express from 'express'; 5 | export let app = express(); -------------------------------------------------------------------------------- /server/routes/bearcat.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by XD on 2016/7/22. 4 | */ 5 | var express = require('express'); 6 | var path = require('path'); 7 | var baseDir = path.resolve('.'); 8 | var router = express.Router(); 9 | var Bearcat = require('bearcat'); 10 | var UserInfo_1 = require('../models/UserInfo'); 11 | router.get('/bearcat', function (req, res) { 12 | var car = Bearcat.getBean('car'); // get bean 13 | var car1 = Bearcat.getBean('car'); 14 | car.run(); 15 | var info = new UserInfo_1.UserInfo(); 16 | // info.UserId=1; 17 | info.QQ = '123456'; 18 | info.CreateDate = new Date().toDateString(); 19 | var UserInfoServer = Bearcat.getBean('UserInfoService'); 20 | UserInfoServer.InsertUser(info); 21 | console.log(new Date().toDateString()); 22 | res.send(car === car1); 23 | // res.sendFile(path.join(baseDir, compilePath + '.html')); 24 | }); 25 | module.exports = router; 26 | -------------------------------------------------------------------------------- /server/routes/bearcat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/22. 3 | */ 4 | import express = require('express'); 5 | import * as path from 'path'; 6 | import {compilePath} from '../../dominSite.config'; 7 | 8 | const baseDir = path.resolve('.'); 9 | let router = express.Router(); 10 | var Bearcat = require('bearcat'); 11 | import {UserInfo} from '../models/UserInfo'; 12 | router.get('/bearcat', (req:express.Request, res:express.Response)=> { 13 | var car = Bearcat.getBean('car'); // get bean 14 | var car1=Bearcat.getBean('car'); 15 | 16 | car.run(); 17 | var info=new UserInfo(); 18 | // info.UserId=1; 19 | info.QQ='123456'; 20 | info.CreateDate=new Date().toDateString(); 21 | var UserInfoServer=Bearcat.getBean('UserInfoService'); 22 | UserInfoServer.InsertUser(info); 23 | console.log(new Date().toDateString()); 24 | res.send(car===car1); 25 | // res.sendFile(path.join(baseDir, compilePath + '.html')); 26 | }); 27 | 28 | export = router; -------------------------------------------------------------------------------- /server/routes/blogRouteInit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/11/23. 4 | */ 5 | var app_1 = require('./app'); 6 | exports.blogRouteInit = function () { 7 | app_1.app.get('/blog/GetPageCateList', require('../api/user/blogControl')); 8 | app_1.app.get('/blog/GetContentPageList', require('../api/user/blogControl')); 9 | app_1.app.get('/blog/deleteCate', require('../api/user/blogControl')); 10 | app_1.app.post('/blog/addCate', require('../api/user/blogControl')); 11 | app_1.app.post('/blog/editCate', require('../api/user/blogControl')); 12 | app_1.app.post('/blog/addContent', require('../api/user/blogControl')); 13 | }; 14 | -------------------------------------------------------------------------------- /server/routes/blogRouteInit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/11/23. 3 | */ 4 | import {app} from './app'; 5 | 6 | export let blogRouteInit=()=>{ 7 | app.get('/blog/GetPageCateList',require('../api/user/blogControl')); 8 | app.get('/blog/GetContentPageList', require('../api/user/blogControl')); 9 | app.get('/blog/deleteCate', require('../api/user/blogControl')); 10 | app.post('/blog/addCate', require('../api/user/blogControl')); 11 | app.post('/blog/editCate', require('../api/user/blogControl')); 12 | app.post('/blog/addContent', require('../api/user/blogControl')); 13 | } -------------------------------------------------------------------------------- /server/routes/error-handler.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var express = require('express'); 6 | exports.errRouter = express.Router(); 7 | exports.errRouter.use(function (req, res, next) { 8 | var err = new Error('Not Found所有错误暂时指向404'); 9 | err.status = 404; //所有错误暂时指向 10 | next(err); 11 | }); 12 | exports.errRouter.use(function (err, req, res) { 13 | //TODO: err type should not be any 14 | res.status(err.status || 500); 15 | res.render('error'); 16 | }); 17 | -------------------------------------------------------------------------------- /server/routes/error-handler.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import * as express from 'express'; 5 | import {Request, Response} from 'express'; 6 | 7 | export let errRouter = express.Router(); 8 | errRouter.use((req: Request, res: Response, next: Function) => { 9 | var err: any = new Error('Not Found所有错误暂时指向404'); 10 | err.status = 404;//所有错误暂时指向 11 | next(err); 12 | }); 13 | 14 | errRouter.use((err: any, req: Request, res: Response)=> { 15 | //TODO: err type should not be any 16 | res.status(err.status || 500); 17 | res.render('error'); 18 | }); 19 | -------------------------------------------------------------------------------- /server/routes/image-proxy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var express = require('express'); 3 | var request = require('request'); 4 | var router = express.Router(); 5 | router.get('/image-proxy', function (req, res) { 6 | var path = decodeURIComponent(req.query.path); 7 | path ? request(path).pipe(res) : res.end(); 8 | }); 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /server/routes/image-proxy.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import {Request, Response} from 'express'; 3 | import * as request from 'request'; 4 | 5 | let router = express.Router(); 6 | 7 | router.get('/image-proxy', (req:Request, res:Response)=> { 8 | var path = decodeURIComponent(req.query.path); 9 | path ? request(path).pipe(res) : res.end(); 10 | }); 11 | 12 | export = router; 13 | -------------------------------------------------------------------------------- /server/routes/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var express = require('express'); 3 | var path = require('path'); 4 | var dominSite_config_1 = require('../../dominSite.config'); 5 | var baseDir = path.resolve('.'); 6 | var router = express.Router(); 7 | router.get('*', function (req, res) { 8 | res.sendFile(path.join(baseDir, dominSite_config_1.compilePath + '.html')); 9 | }); 10 | module.exports = router; 11 | -------------------------------------------------------------------------------- /server/routes/index.ts: -------------------------------------------------------------------------------- 1 | import express = require('express'); 2 | import * as path from 'path'; 3 | import {compilePath} from '../../dominSite.config'; 4 | 5 | const baseDir = path.resolve('.'); 6 | 7 | let router = express.Router(); 8 | 9 | router.get('*', (req:express.Request, res:express.Response)=> { 10 | res.sendFile(path.join(baseDir, compilePath + '.html')); 11 | }); 12 | 13 | export = router; -------------------------------------------------------------------------------- /server/routes/routeConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var error_handler_1 = require("./error-handler"); 3 | exports.routeConfig = function (app) { 4 | app.get('/image-proxy', require('./image-proxy')); 5 | app.get('/', require('./index')); 6 | //app.get('*', require('./index')); 7 | app.get("/bearcat", require("./bearcat")); 8 | app.post("/regist", require("../api/user/regist")); 9 | app.post("/registTest", require("../api/user/registTest")); 10 | app.use(error_handler_1.errRouter); 11 | }; 12 | -------------------------------------------------------------------------------- /server/routes/routeConfig.ts: -------------------------------------------------------------------------------- 1 | 2 | import {errRouter} from "./error-handler"; 3 | export const routeConfig = (app)=> { 4 | app.get('/image-proxy', require('./image-proxy')); 5 | app.get('/', require('./index')); 6 | //app.get('*', require('./index')); 7 | app.get("/bearcat",require("./bearcat")); 8 | app.post("/regist",require("../api/user/regist")) 9 | app.post("/registTest",require("../api/user/registTest")); 10 | app.use(errRouter); 11 | }; -------------------------------------------------------------------------------- /server/routes/routeInit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var app_1 = require('./app'); 6 | var error_handler_1 = require('./error-handler'); 7 | var test_1 = require('./test'); 8 | var AuthorizationInit_1 = require("./AuthorizationInit"); 9 | //the current using 10 | exports.routesInit = function () { 11 | app_1.app.get('/image-proxy', require('./image-proxy')); 12 | app_1.app.get('/', require('./index')); 13 | //app.get('*', require('./index')); 14 | app_1.app.get("/bearcat", require("./bearcat")); 15 | app_1.app.get("/ValidateCode", require('../api/user/userControl')); 16 | app_1.app.get("/chkUserIsRegist", require('../api/user/userControl')); 17 | app_1.app.post("/regist", require("../api/user/regist")); 18 | app_1.app.post("/login", require('../api/user/login')); 19 | app_1.app.post("/chkUserLogin", require('../api/user/chkUserLogin')); 20 | app_1.app.post("/registTest", require("../api/user/registTest")); 21 | app_1.app.get('/test', test_1.testRouter); 22 | AuthorizationInit_1.AuthorizationInit(); //权限认证中间件 23 | app_1.app.use(error_handler_1.errRouter); 24 | exports.routesInit = function () { 25 | throw new Error('route/index.ts: routes have been initialised.'); 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /server/routes/routeInit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import {app} from './app'; 5 | import {errRouter} from './error-handler'; 6 | import {testRouter} from './test'; 7 | import {AuthorizationInit} from "./AuthorizationInit"; 8 | //the current using 9 | export let routesInit = ()=> { 10 | app.get('/image-proxy', require('./image-proxy')); 11 | app.get('/', require('./index')); 12 | //app.get('*', require('./index')); 13 | app.get("/bearcat",require("./bearcat")); 14 | app.get("/ValidateCode",require('../api/user/userControl')); 15 | app.get("/chkUserIsRegist",require('../api/user/userControl')); 16 | app.post("/regist",require("../api/user/regist")); 17 | app.post("/login",require('../api/user/login')); 18 | app.post("/chkUserLogin",require('../api/user/chkUserLogin')); 19 | app.post("/registTest",require("../api/user/registTest")); 20 | 21 | app.get('/test', testRouter); 22 | AuthorizationInit();//权限认证中间件 23 | app.use(errRouter); 24 | routesInit = ()=> { 25 | throw new Error('route/index.ts: routes have been initialised.') 26 | }; 27 | }; -------------------------------------------------------------------------------- /server/routes/test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var express = require('express'); 6 | exports.testRouter = express.Router(); 7 | exports.testRouter.get('/test', function (req, res) { 8 | res.json({ test: "Test" }); 9 | }); 10 | -------------------------------------------------------------------------------- /server/routes/test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import * as express from 'express'; 5 | 6 | export let testRouter = express.Router(); 7 | 8 | testRouter.get('/test', (req: express.Request, res: express.Response)=> { 9 | res.json({test: "Test"}); 10 | }); -------------------------------------------------------------------------------- /server/schema/BlogCateSchema.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/22. 3 | */ 4 | var mongoose = require('mongoose'); 5 | var BlogCateSchema = function () { 6 | }; 7 | BlogCateSchema.prototype.createConnection = function (db) { 8 | var info = new mongoose.Schema({ 9 | CateId: Number, 10 | CateCode: String, 11 | CateName: String, 12 | IsDelete: Number, 13 | CreateDate: String, 14 | UpdateDate: String, 15 | OrderIndex: Number 16 | }); 17 | return db.model('BlogCate', info); 18 | }; 19 | module.exports = BlogCateSchema; 20 | -------------------------------------------------------------------------------- /server/schema/BlogCateSchema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/11/22. 3 | */ 4 | var mongoose=require('mongoose'); 5 | var BlogCateSchema=function () { 6 | 7 | }; 8 | BlogCateSchema.prototype.createConnection=function (db) { 9 | var info=new mongoose.Schema({ 10 | CateId:Number, 11 | CateCode:String, 12 | CateName:String, 13 | IsDelete:Number, 14 | CreateDate:String, 15 | UpdateDate:String, 16 | OrderIndex:Number 17 | }); 18 | return db.model('BlogCate',info); 19 | } 20 | module.exports= BlogCateSchema; -------------------------------------------------------------------------------- /server/schema/ContentSchema.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/12/6. 3 | */ 4 | var mongoose = require('mongoose'); 5 | var ContentSchema = function () { 6 | }; 7 | ContentSchema.prototype.createConnection = function (db) { 8 | var info = new mongoose.Schema({ 9 | Title: String, 10 | Author: String, 11 | Summary: String, 12 | SaveFolder: String, 13 | ImageName: String, 14 | Content: String, 15 | UserId: String, 16 | UserName: String, 17 | ReadCount: Number, 18 | CreateDate: String, 19 | UpdateDate: String, 20 | CateId: { type: mongoose.Schema.ObjectId, ref: 'BlogCate' } 21 | }); 22 | return db.model('Content', info); 23 | }; 24 | module.exports = ContentSchema; 25 | -------------------------------------------------------------------------------- /server/schema/ContentSchema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/12/6. 3 | */ 4 | var mongoose=require('mongoose'); 5 | var ContentSchema=function () { 6 | 7 | }; 8 | 9 | ContentSchema.prototype.createConnection=function (db) { 10 | var info=new mongoose.Schema({ 11 | Title:String, 12 | Author:String, 13 | Summary:String, 14 | SaveFolder:String, 15 | ImageName:String, 16 | Content:String, 17 | UserId:String, 18 | UserName:String, 19 | ReadCount:Number, 20 | CreateDate:String, 21 | UpdateDate:String, 22 | CateId:{type:mongoose.Schema.ObjectId,ref:'BlogCate'} 23 | }); 24 | return db.model('Content',info); 25 | } 26 | module.exports= ContentSchema; -------------------------------------------------------------------------------- /server/schema/SystemMenuSchema.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/16. 3 | */ 4 | var mongoose = require('mongoose'); 5 | var SystemMenuSchema = function () { 6 | }; 7 | SystemMenuSchema.prototype.createConnection = function (db) { 8 | var info = new mongoose.Schema({ 9 | MenuId: Number, 10 | UpperId: Number, 11 | DeepIndex: Number, 12 | MenuPath: String, 13 | ClassName: String, 14 | Title: String, 15 | LinkUrl: String, 16 | Status: Number, 17 | CreateDate: String, 18 | UpdateDate: String, 19 | OrderIndex: Number 20 | }); 21 | return db.model('SystemMenu', info); 22 | }; 23 | module.exports = SystemMenuSchema; 24 | -------------------------------------------------------------------------------- /server/schema/SystemMenuSchema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by xiaoduan on 2016/10/16. 3 | */ 4 | var mongoose=require('mongoose'); 5 | var SystemMenuSchema=function () { 6 | 7 | }; 8 | 9 | SystemMenuSchema.prototype.createConnection=function (db) { 10 | var info=new mongoose.Schema({ 11 | MenuId:Number, 12 | UpperId:Number, 13 | DeepIndex:Number, 14 | MenuPath:String, 15 | ClassName:String, 16 | Title:String, 17 | LinkUrl:String, 18 | Status:Number, 19 | CreateDate:String, 20 | UpdateDate:String, 21 | OrderIndex:Number 22 | }); 23 | return db.model('SystemMenu',info); 24 | }; 25 | module.exports= SystemMenuSchema; 26 | -------------------------------------------------------------------------------- /server/schema/beans.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "schema", 3 | "scan": "", 4 | "beans": [{ 5 | "id":"UserSchema", 6 | "func": "UserSchema", 7 | "scope": "singleton", 8 | "lazy":true 9 | },{ 10 | "id":"BlogCateSchema", 11 | "func":"BlogCateSchema", 12 | "scope":"singleton", 13 | "lazy":true 14 | },{ 15 | "id":"ContentSchema", 16 | "func":"ContentSchema", 17 | "scope":"singleton", 18 | "lazy":true 19 | }] 20 | } -------------------------------------------------------------------------------- /server/server-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "env":"dev", 3 | "timeout":10000, 4 | "port":3006 5 | } -------------------------------------------------------------------------------- /server/serverConfigInit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * Created by DuanG on 2016/8/26. 4 | */ 5 | var routeInit_1 = require('./routes/routeInit'); 6 | var parserInit_1 = require('./configs/parserInit'); 7 | var staticConfig_1 = require('./configs/staticConfig'); 8 | var bearcatConfig_1 = require('./configs/bearcatConfig'); 9 | var app_1 = require('./routes/app'); 10 | exports.serverInit = function () { 11 | parserInit_1.parserInit(); 12 | staticConfig_1.staticResourceInit(); 13 | routeInit_1.routesInit(); 14 | bearcatConfig_1.bearcatInit(app_1.app); 15 | exports.serverInit = function () { 16 | throw new Error('server/index.ts: server has been initialised.'); 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /server/serverConfigInit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/8/26. 3 | */ 4 | import {routesInit} from './routes/routeInit'; 5 | import {parserInit} from './configs/parserInit'; 6 | import {staticResourceInit} from './configs/staticConfig'; 7 | import {bearcatInit} from './configs/bearcatConfig'; 8 | import {app} from './routes/app'; 9 | export let serverInit=()=>{ 10 | parserInit(); 11 | staticResourceInit(); 12 | routesInit(); 13 | bearcatInit(app); 14 | serverInit = ()=> { 15 | throw new Error('server/index.ts: server has been initialised.'); 16 | } 17 | } -------------------------------------------------------------------------------- /server/testServer/Car.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/22. 3 | */ 4 | var Car = function(engine) { 5 | this.engine = engine; 6 | this.wheel = null; 7 | } 8 | Car.prototype.init=function () { 9 | //this.engine.init(); 10 | //this.wheel(); 11 | //console.log('init car...'); 12 | } 13 | Car.prototype.run = function() { 14 | this.engine.run(); 15 | this.wheel.run(); 16 | console.log('run car...'); 17 | } 18 | 19 | module.exports = Car; -------------------------------------------------------------------------------- /server/testServer/CarFactory.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/7/27. 3 | */ 4 | var carServer = require('./CarServer'); 5 | var CarFactory = function () { }; 6 | CarFactory.prototype.createCar = function () { 7 | console.log('CarFactory createCar1...'); 8 | return new carServer(); 9 | }; 10 | module.exports = CarFactory; 11 | -------------------------------------------------------------------------------- /server/testServer/CarFactory.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/7/27. 3 | */ 4 | var carServer =require('./CarServer'); 5 | 6 | var CarFactory = function() {} 7 | 8 | CarFactory.prototype.createCar = function() { 9 | console.log('CarFactory createCar1...'); 10 | return new carServer(); 11 | } 12 | 13 | module.exports = CarFactory; -------------------------------------------------------------------------------- /server/testServer/CarServer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/7/27. 3 | */ 4 | /*export class CarServer{ 5 | public addNumber():void{ 6 | console.log("addNumber"); 7 | } 8 | }*/ 9 | var CarServer = function () { 10 | }; 11 | CarServer.prototype.addNumber = function () { 12 | console.log("addNumber"); 13 | }; 14 | module.exports = CarServer; 15 | -------------------------------------------------------------------------------- /server/testServer/CarServer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/7/27. 3 | */ 4 | /*export class CarServer{ 5 | public addNumber():void{ 6 | console.log("addNumber"); 7 | } 8 | }*/ 9 | var CarServer =function() { 10 | 11 | }; 12 | CarServer.prototype.addNumber=function ():void { 13 | console.log("addNumber"); 14 | }; 15 | module.exports=CarServer; -------------------------------------------------------------------------------- /server/testServer/aspect.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/23. 3 | */ 4 | var Aspect = function() { 5 | this.$id = "aspect"; 6 | this.$aop = true; 7 | this.$wheel = null; 8 | } -------------------------------------------------------------------------------- /server/testServer/beans.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "scan": "", 4 | "beans": [{ 5 | "id": "car", 6 | "func": "car", 7 | "scope": "singleton", 8 | "init":"init", 9 | "props": [{ 10 | "name": "wheel", 11 | "ref": "wheel" 12 | }], 13 | "args": [{ 14 | "name": "engine", 15 | "ref": "engine" 16 | }] 17 | }, { 18 | "id": "wheel", 19 | "func": "wheel" 20 | }, { 21 | "id": "engine", 22 | "func": "engine" 23 | }] 24 | } -------------------------------------------------------------------------------- /server/testServer/engine.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/22. 3 | */ 4 | var engine = function() {} 5 | 6 | engine.prototype.init = function(cb) { 7 | console.log('init engine...'); 8 | setTimeout(function() { 9 | console.log('asyncInit setTimeout'); 10 | cb(); 11 | }, 1000); 12 | } 13 | 14 | engine.prototype.run = function() { 15 | console.log('run engine...'); 16 | return 'engine'; 17 | } 18 | 19 | module.exports = engine; -------------------------------------------------------------------------------- /server/testServer/find.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/4/14. 3 | */ 4 | 5 | /*var mongoose = require('mongoose'); 6 | require('./mongodb'); 7 | 8 | var Person = mongoose.model('Person'); 9 | 10 | /!* 11 | 12 | find参数: 13 | 1.mongodb selector 14 | 2.err:错误信息,results:查询结果 15 | *!/ 16 | 17 | /!*Person.find({}, function (err,results) { 18 | if(err){ 19 | console.log('error message',err); 20 | return; 21 | } 22 | // console.log('results',results); 23 | });*!/*/ 24 | -------------------------------------------------------------------------------- /server/testServer/insert.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/4/14. 3 | */ 4 | /*var mongoose = require('mongoose'); 5 | require('./mongodb.js'); 6 | var Person = mongoose.model('Person');//Book 为model name 7 | 8 | var Person = new Person({ 9 | username: 'MEAN Web Development1', 10 | name: 'trigkit6', 11 | password: "123456" 12 | }); 13 | 14 | Person.save(function (err) { 15 | console.log('save status:',err ? 'failed' : 'success1'); 16 | });*/ 17 | -------------------------------------------------------------------------------- /server/testServer/mongodb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by DuanG on 2016/4/14. 3 | */ 4 | /*var mongoose = require('mongoose'); 5 | var uri = 'mongodb://sa:15874728903@119.147.101.74:27017/Mongo_SysLogdb'; 6 | //mongoose.connect(uri); 7 | var db=mongoose.createConnection(uri); 8 | var PersonSchema=new mongoose.Schema({ 9 | username:String, 10 | name:String, 11 | password:String 12 | }); 13 | //module .exports=UserSchema; 14 | //mongoose.model('Person',PersonSchema);//将该Schema发布为Model 15 | db.model('Person',PersonSchema)*/ 16 | -------------------------------------------------------------------------------- /server/testServer/wheel.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by XD on 2016/7/22. 3 | */ 4 | var Wheel = function() {} 5 | 6 | Wheel.prototype.init = function(cb) { 7 | console.log('init wheel...'); 8 | setTimeout(function() { 9 | console.log('asyncInit setTimeout'); 10 | cb(); 11 | }, 1000); 12 | } 13 | 14 | Wheel.prototype.run = function() { 15 | console.log('run wheel...'); 16 | return 'wheel'; 17 | } 18 | 19 | module.exports = Wheel; -------------------------------------------------------------------------------- /server/upload/blog/1236979572000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/server/upload/blog/1236979572000.png -------------------------------------------------------------------------------- /server/upload/blog/1464008202251.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/server/upload/blog/1464008202251.png -------------------------------------------------------------------------------- /server/upload/blog/out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duanguang/react-node-cms/89c295ad5635391cacc8d99e0b651673adb2b5af/server/upload/blog/out.png -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "buildOnSave": true, 4 | "compilerOptions": { 5 | "target": "es5", 6 | "module": "commonjs", 7 | "noImplicitAny": false, 8 | // "noEmitOnError": true, 9 | "allowSyntheticDefaultImports": true, 10 | "jsx": "react", 11 | "sourceMap": false, 12 | "experimentalDecorators": true, 13 | "emitDecoratorMetadata": true, 14 | "noResolve": true, 15 | "moduleResolution": "classic", 16 | // "moduleResolution": "node" 17 | // "noEmitHelpers": true 18 | "pretty": true 19 | }, 20 | "filesGlob": [ 21 | "**/*.ts", 22 | "**/*.tsx", 23 | "!node_modules/**/*.ts" 24 | ], 25 | "exclude": [ 26 | "dist", 27 | "node_modules", 28 | "examples", 29 | "client/src" 30 | ] 31 | } -------------------------------------------------------------------------------- /typings/classnames/classnames.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for classnames 2 | // Project: https://github.com/JedWatson/classnames 3 | // Definitions by: Dave Keen , Adi Dahiya , Jason Killian 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | declare type ClassValue = string | number | ClassDictionary | ClassArray; 7 | 8 | interface ClassDictionary { 9 | [id: string]: boolean; 10 | } 11 | 12 | interface ClassArray extends Array { } 13 | 14 | interface ClassNamesFn { 15 | (...classes: ClassValue[]): string; 16 | } 17 | 18 | declare var classNames: ClassNamesFn; 19 | 20 | declare module "classnames" { 21 | export = classNames 22 | } 23 | -------------------------------------------------------------------------------- /typings/cookie-parser/cookie-parser.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for cookie-parser v1.3.4 2 | // Project: https://github.com/expressjs/cookie-parser 3 | // Definitions by: Santi Albo 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare module "cookie-parser" { 9 | import express = require('express'); 10 | function e(secret?: string, options?: any): express.RequestHandler; 11 | namespace e{} 12 | export = e; 13 | } -------------------------------------------------------------------------------- /typings/cors/cors.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for cors 2 | // Project: https://github.com/troygoode/node-cors/ 3 | // Definitions by: Mihhail Lapushkin 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare module "cors" { 9 | import express = require('express'); 10 | 11 | namespace e { 12 | interface CorsOptions { 13 | origin?: any; 14 | methods?: any; 15 | allowedHeaders?: any; 16 | exposedHeaders?: any; 17 | credentials?: boolean; 18 | maxAge?: number; 19 | preflightContinue?: boolean; 20 | } 21 | } 22 | 23 | function e(options?: e.CorsOptions): express.RequestHandler; 24 | export = e; 25 | } 26 | -------------------------------------------------------------------------------- /typings/errorhandler/errorhandler.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for errorhandler 2 | // Project: https://github.com/expressjs/errorhandler 3 | // Definitions by: Santi Albo 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare module "errorhandler" { 9 | import * as express from 'express'; 10 | 11 | function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler; 12 | 13 | namespace errorHandler { 14 | interface LoggingCallback { 15 | (err: Error, str: string, req: express.Request, res: express.Response): void; 16 | } 17 | 18 | interface Options { 19 | /** 20 | * Defaults to true. 21 | * 22 | * Possible values: 23 | * true : Log errors using console.error(str). 24 | * false : Only send the error back in the response. 25 | * A function : pass the error to a function for handling. 26 | */ 27 | log: boolean | LoggingCallback; 28 | } 29 | } 30 | 31 | export = errorHandler; 32 | } 33 | -------------------------------------------------------------------------------- /typings/form-data/form-data.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for form-data 2 | // Project: https://github.com/felixge/node-form-data 3 | // Definitions by: Carlos Ballesteros Velasco 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | // Imported from: https://github.com/soywiz/typescript-node-definitions/form-data.d.ts 7 | 8 | declare module "form-data" { 9 | export class FormData { 10 | append(key: string, value: any, options?: any): FormData; 11 | getHeaders(): Object; 12 | // TODO expand pipe 13 | pipe(to: any): any; 14 | submit(params: string|Object, callback: (error: any, response: any) => void): any; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typings/globals/globals.d.ts: -------------------------------------------------------------------------------- 1 | /*import ComponentClass = __React.ComponentClass;*/ 2 | import ReactElement = __React.ReactElement; 3 | import RouteProps = ReactRouter.RouteProps; 4 | 5 | declare var __DEV__:boolean; 6 | interface window extends Window { 7 | __initialState__:any; 8 | devToolsExtension:Function; 9 | opera:any; 10 | } 11 | 12 | interface ITargetInst { 13 | _currentElement:ReactElement; 14 | } 15 | 16 | interface IReactMouseEvent extends MouseEvent { 17 | _targetInst:ITargetInst 18 | } 19 | 20 | interface WXRouteProps extends RouteProps { 21 | title?:string; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /typings/mime/mime.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for mime 2 | // Project: https://github.com/broofa/node-mime 3 | // Definitions by: Jeff Goddard 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | // Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts 7 | 8 | declare module "mime" { 9 | export function lookup(path: string): string; 10 | export function extension(mime: string): string; 11 | export function load(filepath: string): void; 12 | export function define(mimes: Object): void; 13 | 14 | interface Charsets { 15 | lookup(mime: string): string; 16 | } 17 | 18 | export var charsets: Charsets; 19 | export var default_type: string; 20 | } 21 | -------------------------------------------------------------------------------- /typings/object-assign/object-assign.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for object-assign 4.0.1 2 | // Project: https://github.com/sindresorhus/object-assign 3 | // Definitions by: Christopher Brown 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | declare module "object-assign" { 7 | function objectAssign(target: T, source: U): T & U; 8 | function objectAssign(target: T, source1: U, source2: V): T & U & V; 9 | function objectAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; 10 | function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; 11 | function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R; 12 | function objectAssign(target: any, ...sources: any[]): any; 13 | namespace objectAssign { } 14 | export = objectAssign; 15 | } 16 | -------------------------------------------------------------------------------- /typings/react-progress-2/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module "react-progress-2" { 2 | namespace RP2 { 3 | export const Component: any; 4 | export const show: ()=>void; 5 | export const hide: ()=>void; 6 | export const hideAll: ()=>void; 7 | export const isVisible: ()=>boolean; 8 | } 9 | export = RP2; 10 | } -------------------------------------------------------------------------------- /typings/react-tappable/react-tappable.d.ts: -------------------------------------------------------------------------------- 1 | import React = __React; 2 | 3 | declare module "react-tappable" { 4 | export = class Tappable extends React.Component { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /typings/react/react-addons-transition-group.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-transition-group) 2 | // Project: http://facebook.github.io/react/ 3 | // Definitions by: Asana , AssureSign , Microsoft 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare namespace __React { 9 | 10 | interface TransitionGroupProps { 11 | component?: ReactType; 12 | className?: string; 13 | childFactory?: (child: ReactElement) => ReactElement; 14 | } 15 | 16 | type TransitionGroup = ComponentClass; 17 | 18 | namespace __Addons { 19 | export var TransitionGroup: __React.TransitionGroup; 20 | } 21 | } 22 | 23 | declare module "react-addons-transition-group" { 24 | var TransitionGroup: __React.TransitionGroup; 25 | type TransitionGroup = __React.TransitionGroup; 26 | export = TransitionGroup; 27 | } 28 | -------------------------------------------------------------------------------- /typings/redux-thunk/redux-thunk.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for redux-thunk v2.0.1 2 | // Project: https://github.com/gaearon/redux-thunk 3 | // Definitions by: Qubo 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /// 7 | 8 | declare namespace ReduxThunk { 9 | export interface Thunk extends Redux.Middleware {} 10 | export interface ThunkInterface { 11 | (dispatch: Redux.Dispatch, getState?: () => T): any; 12 | } 13 | } 14 | 15 | declare module "redux-thunk" { 16 | var thunk: ReduxThunk.Thunk; 17 | export default thunk; 18 | } 19 | -------------------------------------------------------------------------------- /typings/serve-favicon/serve-favicon.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for serve-favicon 2.2.0 2 | // Project: https://github.com/expressjs/serve-favicon 3 | // Definitions by: Uros Smolnik 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | /* =================== USAGE =================== 7 | 8 | import serveFavicon = require('serve-favicon'); 9 | app.use(serveFavicon(__dirname + '/public/favicon.ico')); 10 | 11 | =============================================== */ 12 | 13 | /// 14 | 15 | declare module "serve-favicon" { 16 | import express = require('express'); 17 | 18 | /** 19 | * Node.js middleware for serving a favicon. 20 | */ 21 | function serveFavicon(path: string, options?: { 22 | /** 23 | * The cache-control max-age directive in ms, defaulting to 1 day. This can also be a string accepted by the ms module. 24 | */ 25 | maxAge?: number; 26 | }): express.RequestHandler; 27 | 28 | namespace serveFavicon{} 29 | 30 | export = serveFavicon; 31 | } --------------------------------------------------------------------------------