# 更新日志
<span style="color:red;">更新日志在这里倒序添加</span>

- `1.0.53-beta` JyJin 2021年8月26日 15:35:00
 
    删除微软Office的预览组件

    增加onlyOffice预览组件

- `1.0.52-beta` JyJin 2021年7月6日 14:00:00
 
    修复预览不支持后缀名大写

    增加mov格式视频文件的预览

- `1.0.51` JyJin 2021年6月29日 16:28:19
 
    增加开发环境内存为3g

    增加编译环境内容为4g

- `1.0.47 ~ 1.0.50-beta` QyYu 2021年4月14日 17:28:19

    消息中心接口修改

    修复1.0.47版本代码编译问题

- `1.0.44` shuangYe 2021年01月13日 18:55:04

    修复全文搜索知识，点击知识400bug

- `1.0.41-beta ~ 1.0.43-beta ~ 1.0.43` kcLiu 2020年10月28日 13:55:04

    消息弹窗优化,NPM发包找不到

- `1.0.37-beta~1.0.40-beta` MlWu 2020年10月27日 17:08:17

   设置泛域名

- `1.0.36-beta` kcLiu 2020年10月27日 16:36:17

    消息弹窗新增公告类型

- `1.0.34-beta 1.0.35-beta 1.0.35` kcLiu 2020年09月15日 14:50:00

   工作台代办新增刷新按钮

- `1.0.33-beta` ZqSong 2020年08月20日 14:50:00

   state=1修复

- `1.0.32-beta` mlGao 2020年08月14日 11:00:00

   新增导入导出功能

- `1.0.31-beta` mlGao 2020年08月14日 10:30:00

   新增导入导出功能

- `1.0.30-beta` 2020年08月013日 10:30:00

   全文搜索在知识库未搜索出内容时的白屏修复

- `1.0.29-beta` 2020年08月011日 10:30:00

   默认logo替换

- `1.0.28` 2020年08月07日 21:47:00

   重新发布一下

- `1.0.27` 2020年08月07日 17:55:00 ci不通过 不可用

   1.任务中心下载文件功能逻辑优化 
   
   2.登出、切租户清空页面个性化缓存

- `1.0.27-beta` mlGao 2020年08月07日 16:55:00
   任务中心下载文件功能逻辑优化

- `1.0.25-beta ~ 1.0.26-beta` JyJin 2020年08月7日 15:03:00

  - 登出、切租户清空页面个性化缓存
  - boot代码详细注释整理

- `1.0.24 ~ 1.0.25` MlWu 2020年07月18日 00:00:01

  待办事项增加懒加载

- `1.0.22 ~ 1.0.23` XhZhao 2020年07月17日 00:00:01

  待办事项

- `1.0.19-beta ~ 1.0.21-beta` MlGao 2020年07月15日 00:00:01

  修改问答库切换分页
  待办事项查询数据量太大导致页面崩溃

- `1.0.17-beta ~ 1.0.18-beta` ZqSong 2020年07月08日 00:00:01

  智能客服展示权限控制

- `1.0.14-beta ~ 1.0.16-beta` KcLiu 2020年06月22日 00:00:01

  登录认证

- `1.0.13-beta` JyJin 2020年06月22日 00:00:01

  顶栏颜色渐变色

- `1.0.9-beta ~ 1.0.12-beta` ZqSong 2020年06月19日 00:00:01

  用户头像展示


# Choerodon Boot


Choerodon front boot is a toolkit about front end package management, startup, compilation. It is mainly used to provide custom some configurations file to create a project of React that can be modified to some extent.

The construction project can be used on `macOS`, `Windows` or `Linux`. Teams can be developed in modules, greatly speeding up development.

 * The project uses `webpack` for construction.
 * `React` and `Mobx` are used as the main development technology.

## Install

```bash
$ npm install choerodon-front-boot -S
```

## Configuration

* Create a configuration file named `config.js`

```js
import autoprefixer from 'autoprefixer';
// default config of Choerodon
const config = {
  port: 9090,
  output: './dist',
  htmlTemplate: 'index.template.html',
  devServerConfig: {},
  postcssConfig: {
    plugins: [
      autoprefixer({
        browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'],
      }),
    ],
  },
  babelConfig(config, mode, env) {
    return config;
  },
  webpackConfig(config, mode, env) {
    return config;
  },
  enterPoints(mode, env) {
    // By default, it returns empty object.
    // In javascript files, words `process.env.XXX` will be replaced with the key of returned map object like `XXX` from this function .
    // e.g.
    // development env
    if (mode === 'start' || env === 'development') {
      return {
        API_HOST: 'http://api.example.org', // The `server` property of root config will be overwritten by this.
      }
    }
    // production env
    if (mode === 'build' || env === 'production') {
      return {
        API_HOST: 'an `enterpoint` placeholder string', // Reference to `enterpoint.sh`
      }
    }
  },
  entryName: 'index',
  root: '/',
  // By default, The property `routes` is null and we use property `main` as path of router component and use the last word of property `name` what be split by char `-` as router path in package.json
  routes: {
    'iam': 'src/app/iam/containers/IAMIndex.js', // For e.g.
  },
  // By default, dashboard is false.
  // The keys of dashboard are namespaces, and entries are Component paths.
  dashboard: {
    'choerodon-front-iam': 'src/dashboard/*', //  For e.g., use glob pattern
    'choerodon-front-devops': [
      'src/dashboard/Test', //  For e.g., use dir path
      'src/dashboard/Test2.js', //  For e.g., use file path
    ],
  },
  server: 'http://api.example.com', // API server
  fileServer: 'http://file.example.com', // File server
  clientid: 'localhost',
  titlename: 'Choerodon', // HTML title
  favicon: 'favicon.ico', // Page favicon
  theme: { // less/sass modify vars
    'primary-color': '#2196f3',
  },
}
```

## Run

```
$choerodon-front-boot start --config config.js
```

Once running, open http://localhost:9090

## Dist

```
$choerodon-front-boot build --config config.js
```

## Init Menu

First, you should make sure that you have `Menu.yml` under `./{1}/src/app/{1}/config/Menu.yml`. And also should have `language/en.yml & language/zh.yml`。

A `Menu.yml` file like this:

``` yml
#Menu.yml
"iam": code
  icon: IAM  # icon ode
  sort: 1  # sort
  delete: "true"  # Whether it should be deleted
  site:  # menu level
    - "organization": # code
        sort: 1  # sort
        Routes: /iam/organization  # route
        icon: manage_organization  # icon
        permission:  # permissions
          - 'iam-service.organization.enableOrganization'
```
A `language/en.yml` file like this:

``` yml
#language/en.yml
"iam": "platform settings"
# site
"iam.organization": "Organization"
```

Then, you can run the script to initialize the menu.
```
$python ./{1}/node_modules/choerodon-front-boot/structure/configAuto.py {1}
$python ./{1}/node_modules/choerodon-front-boot/structure/sql.py [-i HOST] [-p PORT] [-u USER] [-s PASSWD] [-a ATTRS] [-d DELETE]
```
`{1}` is your module name.


## Dependencies

 * Node environment (6.9.0+)
 * Git environment
 * Python environment(2.7)

## Related documents and information

* [React](https://reactjs.org)
* [Mobx](https://github.com/mobxjs/mobx)
* [webpack](https://webpack.docschina.org)
* [gulp](https://gulpjs.com)

## Reporting Issues
If you find any shortcomings or bugs, please describe them in the  [issue](https://github.com/choerodon/choerodon/issues/new?template=issue_template.md).

## How to Contribute
Pull requests are welcome! [Follow](https://github.com/choerodon/choerodon/blob/master/CONTRIBUTING.md) to know for more information on how to contribute.
