# Thank **Repository Path**: charlesgao/Thank ## Basic Information - **Project Name**: Thank - **Description**: ThankDemo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-09-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 开发中,未完成 ## 介绍 恒开鑫网站及接口 * [vue 2](https://vuejs.org/) * [spring boot](https://spring.io/guides/gs/spring-boot/) * [webpack](https://webpack.js.org/) * [git](https://git-scm.com/) ## 文件及目录结构 ### module structure ``` project ├── api: 后台服务,提交调用方法,接口。 ├── web: 网站的前台页面模块. ├── admin: 网站的后台管理 ├── adroid: 安卓 ├── ios: iphone ``` ### web project structure. ``` hkx ├── web │ ├── build: web pack build script │ ├── build.js │ ├── dev-client.js │ ├── dev-server.js │ ├── utils.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ ├── webpack.prod.conf.js │ ├── config: Configuration for environments │ ├── dev.env.js │ ├── index.js │ ├── prod.env.js │ ├── test.env.js │ ├── node: maven plugin will install node here. │ ├── node_modules: npm dependencies. Will download once you run npm install. │ ├── src │ ├── assets: image videos audios etc. │ ├── components: vue components │ ├── router: vue router │ ├── App.vue: main vue instance. │ ├── main.js: application enterence. │ ├── static │ ├── css │ ├── fonts │ ├── less │ ├── scss │ ├── test webpack automation testing forlder │ ├── .babelrc: Babel specific used in webpack to turn es2015/es2016 code to ES5 code for older browsers to use │ ├── .editorconfig:webstorm IDE configuration │ ├── .gitignore: Specify files in here for git to ignore │ ├── package.json: Frontend dependency manager similar to pom.xml but for managing javascript apps │ ├── pom.xml web module build dependency management ├── pom.xml parent build dependency management ``` ## 安装 ### 软件需求 1.JDK6+ 2.maven 3.x+ ''nodejs.也是需要安装的,但我们已将nodejs下载安装集成在maven中自动安装。 ### 开始 下载完代码后进入hkx目录运行 ####编译 ``` mvn install ``` 第一次运行,将下载各种java,javascript的依赖库,过程稍显漫长,亲耐心等待。 #### NPM 镜像配置 我们已将node仓库换成国内镜像。如果你安装顺利以下步骤你可掠过 ``` config set registry https://registry.npmjs.org ``` Config to taobao repository if you are locating at China. ``` config set registry http://registry.npm.taobao.org/ ``` ####运行 ``` cd api && mvn spring-boot:run ``` 在浏览器输入: http://localhost/api ## 开发调试 我们已经把前后端开发完全分离了。 如需在没有启动后台服务器的情况下调试前端代码: ``` # 安装前端依赖库(如果你已经运行了上一步的mvn install,则无需此步骤) npm install # 马上开始开发前端代码?只需要运行如下命令来启动前端热加载服务,我们默认端口8081 npm run dev ``` ### 如果你很幸运的有CI和auto testing团队,那么下面可能是他们关心的。 ``` # build for production with minification - this will produce a dist/ folder. npm run build [dev|prod] # run unit tests npm run unit # run e2e tests - selenium npm run e2e # run all tests npm test ``` ### 后台服务已经有了? 如果你已经有了后台API服务,你不需要框架中的api模块,也就是你只想把前端集成到现有的后端服务中。那么你需要配置一下proxyTable,以便链接调试后台API。例如你的后台服务器地址是192.168.100.188,端口8080。 找到 web/config/index.js ``` dev: { env: require('./dev.env'), host: 'localhost', port: 8082, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: { '/api': { target: 'http://192.168.100.188:8080', changeOrigin: true } }, ``` ###关于开发工具 前端开发我们强烈推荐使用 JetBrains WebStorm。 后端开发根据你的习惯,Idea 和 eclipse都很好。单团队内部要统一使用某个IDE,以便更好的使用代码自动格式化,集成各类代码工具等。 如何配置Intellij idea: * Run > Edit Configurations... > hit the plus sign to create a new entry > select maven * Name the new entry as ```spring-boot:run``` * Set Working Directory to ```/Users//IdeaProjects/app``` * Set Command Line to ```-projects backend spring-boot:run``` 如果你的Idea不是社区乞丐版,大可以使用Idea提供的Spring-boot插件来启动/调式项目: * Run > Edit Configurations... > hit the plus sign to create a new entry > select Spring-Boot * Name the new entry as ```runApplication``` * Set MainClass to ```com.fc.hkx.Application``` * Set JRE to your JRE. * Click OK 如何配置eclipse: * Run > Run Configurations... > Click the [Maven Build] at left list > Click [New] button(+) * Name the new entry as ```RunBackend``` * Set Base Directory to ```${workspace_loc:/backend}``` * Set Command Line to ```spring-boot:run```