refactor, fix bug and update template i18n, to be continue

pull/680/head
shiqstone 2021-04-16 12:46:43 +08:00
parent 26a7793dd8
commit c4e6ada23a
4 changed files with 71 additions and 119 deletions

View File

@ -8,7 +8,7 @@
|:---- |:---|:----- |----- |
|2.1.0 |Ben |2021-04-15 | xxxx-xx-xx |
#### 请求URL:
#### Request URL:
- http://xx.com/api/login

View File

@ -2,29 +2,29 @@
[![Build Status](https://travis-ci.org/lifei6671/mindoc.svg?branch=master)](https://travis-ci.org/lifei6671/mindoc)
MinDoc 是一款针对IT团队开发的简单好用的文档管理系统。
MinDoc is a simple and easy-to-use document management system developed for IT teams.
MinDoc 的前身是 SmartWiki 文档系统。SmartWiki 是基于 PHP 框架 laravel 开发的一款文档管理系统。因 PHP 的部署对普通用户来说太复杂,所以改用 Golang 开发。可以方便用户部署和实用。
MinDoc The predecessor of Mindoc was the SmartWiki documentation system. SmartWiki is a document management system developed based on the PHP framework laravel. Because the deployment of PHP is too complicated for ordinary users, it is convenient for users to deploy and use Golang instead.
开发缘起是公司IT部门需要一款简单实用的项目接口文档管理和分享的系统。其功能和界面源于 kancloud 。
The origin of the development is that the companys IT department needs a simple and practical system for project interface document management and sharing. Its function and interface are derived from kancloud.
可以用来储存日常接口文档,数据库字典,手册说明等文档。内置项目管理,用户管理,权限管理等功能,能够满足大部分中小团队的文档管理需求。
It can be used to store API documents, database dictionaries, manual instructions and other documents. Built-in project management, user management, authority management and other functions can meet the document management needs of most small and medium-sized teams.
演示站点: [http://doc.iminho.me](http://doc.iminho.me)
Demo site: [http://doc.iminho.me](http://doc.iminho.me)
# Installation and use
**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下键名为 ZONEINFO值为MinDoc跟目录下的/lib/time/zoneinfo.zip 。**
**If the golang is not installed on your server, please manually set an environment variable as follows: the key name is ZONEINFO, and the value is MinDoc and /lib/time/zoneinfo.zip in the directory.**
**Windows tutorial:** [https://github.com/mindoc-org/mindoc/blob/master/README_WIN.md](docs/README_WIN.md)
**Linux 教程:**  [https://github.com/mindoc-org/mindoc/blob/master/README_LINUX.md](docs/README_LINUX.md)
**Linux tutorial:**  [https://github.com/mindoc-org/mindoc/blob/master/README_LINUX.md](docs/README_LINUX.md)
**PDF 导出配置教程**  [https://github.com/mindoc-org/mindoc/blob/master/docs/README_LINUX.md](docs/WKHTMLTOPDF.md)
**PDF Export configuration tutorial**  [https://github.com/mindoc-org/mindoc/blob/master/docs/README_LINUX.md](docs/WKHTMLTOPDF.md)
对于没有Golang使用经验的用户可以从 [https://github.com/mindoc-org/mindoc/releases](https://github.com/mindoc-org/mindoc/releases) 这里下载编译完的程序。
For users without Golang experience, you can download the compiled program from here. [https://github.com/mindoc-org/mindoc/releases](https://github.com/mindoc-org/mindoc/releases)
如果有Golang开发经验建议通过编译安装。
If you have Golang development experience, it is recommended to compile and install.
```bash
git clone https://github.com/mindoc-org/mindoc.git
@ -35,174 +35,126 @@ go build -ldflags "-w"
```
MinDoc 使用MySQL储存数据且编码必须是`utf8mb4_general_ci`。请在安装前,把数据库配置填充到项目目录下的 conf/app.conf 中。
MinDoc uses MySQL to store data, and the encoding must be `utf8mb4_general_ci`.
如果conf目录下不存在 app.conf 请重命名 app.conf.example 为 app.conf。
Please Change database config locate in `conf/app.conf` before install.
如果 MinDoc 根目录下存在 install.lock 文件表示已经初始化过数据库,想要重新初始化数据库,只需要删除该文件重新启动程序即可。
If `app.conf` does not exist in the conf directory, please rename `app.conf.example` to `app.conf`.
**默认程序会自动创建表同时初始化一个超级管理员用户admin 密码123456 。请登录后重新设置密码。**
If the install.lock file exists in the root directory, it means that the database has been initialized. If you want to reinitialize the database, delete the file and restart the program.
## Linux Background process
**The default program will automatically create the table and initialize a super administrator user: admin password: 123456. Please reset your password after logging in.**
在 Linux 如果想让程序后台运行可以执行如下命令:
## Linux Running in Background
If you want the program to run in the background, you can execute the following command:
```bash
#使程序后台运行
nohup ./godoc &
```
该命令会使程序后台执行,但是服务器重启后不会自动启动服务。
This command will make the program execute in the background, but the service will not start automatically after the server restarts.
使用 supervisor 做服务,可以使服务器重启后自动重启 MinDoc。
Using supervisor as a service can automatically restart MinDoc after the server restarts.
## Windows 下后台运行
## Windows Running in Background
Windows 下后台运行需要借助 CMD 命令行命令
Running in the background under Windows requires the help of CMD command line commands
```bash
#在MinDoc跟目录下新建一个slave.vbs文件
# Create slave.vbs file in the MinDoc root directory:
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c start.bat",vbhide
#再建一个start.bat文件
# Create start.bat file:
@echo off
godoc_windows_amd64.exe
```
启动时双击slave.vbs即可等待程序初始化完数据库会在该目录下创建一个install.lock文件标识已安装成功。
Double-click slave.bat to start, After the program initializes the database, an install.lock file will be created in this directory, indicating that the installation has been successful.
如果是自己编译可以用以下命令即可编译出不依赖cmd命令的后台运行的程序
If you compile it yourself, you can use the following command to compile a program that does not rely on the cmd command to run in the background:
```bash
go build -ldflags "-H=windowsgui"
```
通过该命令编译的Golang程序在Windows上默认后台运行。
Compiled by this command runs in the background by default on Windows.
请将将 MinDoc 加入开机启动列表,使程序开机启动。
Please add MinDoc to the boot list.
## 密码找回功能
## Password retrieval
The password retrieval function depends on the mail service. Therefore, you need to configure the mail service to use this function. The configuration is located in `conf/app.conf`
密码找回功能依赖邮件服务,因此,需要配置邮件服务才能使用该功能,该配置位于 `conf/app.conf` 中:
```bash
#邮件配置
#是否启用邮件
#mail service configuration
enable_mail=true
#smtp服务器的账号
smtp_user_name=admin@iminho.me
#smtp服务器的地址
smtp_host=smtp.ym.163.com
#密码
smtp_password=1q2w3e__ABC
#端口号
smtp_port=25
#邮件发送人的地址
form_user_name=admin@iminho.me
#邮件有效期30分钟
mail_expired=30
```
# 使用Docker部署
# Use Docker deployment
如果是Docker用户可参考项目内置的Dockerfile文件编译镜像。
Refer to the built-in Dockerfile project files to compile the mirror.
在启动镜像时需要提供如下的环境变量:
The following environment variables need to be provided when starting the mirror:
```ini
MYSQL_PORT_3306_TCP_ADDR MySQL地址
MYSQL_PORT_3306_TCP_PORT MySQL端口号
MYSQL_INSTANCE_NAME MySQL数据库名称
MYSQL_USERNAME MySQL账号
MYSQL_PASSWORD MySQL密码
HTTP_PORT 程序监听的端口号
MYSQL_PORT_3306_TCP_ADDR MySQL Address
MYSQL_PORT_3306_TCP_PORT MySQL Port
MYSQL_INSTANCE_NAME MySQL Database name
MYSQL_USERNAME MySQL Username
MYSQL_PASSWORD MySQL Password
HTTP_PORT Listen Port
```
举个栗子
For Example
```bash
docker run -p 8181:8181 -e MYSQL_PORT_3306_TCP_ADDR=127.0.0.1 -e MYSQL_PORT_3306_TCP_PORT=3306 -e MYSQL_INSTANCE_NAME=mindoc_db -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=123456 -e httpport=8181 -d daocloud.io/lifei6671/mindoc:latest
```
# 项目截图
**创建项目**
![创建项目](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501204438.png)
**项目列表**
![项目列表](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501203542.png)
**项目概述**
![项目概述](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501203619.png)
**项目成员**
![项目成员](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501203637.png)
**项目设置**
![项目设置](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501203656.png)
**基于Editor.md开发的Markdown编辑器**
![基于Editor.md开发的Markdown编辑器](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501203854.png)
**基于wangEditor开发的富文本编辑器**
![基于wangEditor开发的富文本编辑器](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501204651.png)
**项目预览**
![项目预览](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501204609.png)
**超级管理员后台**
![超级管理员后台](https://raw.githubusercontent.com/lifei6671/mindoc/master/uploads/20170501204710.png)
# 使用的技术
# Technology used
- beego 1.8.1
- mysql 5.6
- editor.md
- bootstrap 3.2
- jquery 库
- layer 弹出层框架
- webuploader 文件上传框架
- Nprogress 库
- jstree 树状结构库
- font awesome 字体库
- cropper 图片剪裁库
- layer 弹出层框架
- highlight 代码高亮库
- to-markdown HTML转Markdown库
- wangEditor 富文本编辑器
- jquery
- layer
- webuploader
- Nprogress
- jstree
- font awesome
- cropper
- highlight
- to-markdown
- wangEditor
# 主要功能
# Main function
- 项目管理,可以对项目进行编辑更改,成员添加等。
- 文档管理,添加和删除文档等。
- 评论管理,可以管理文档评论和自己发布的评论。
- 用户管理,添加和禁用用户,个人资料更改等。
- 用户权限管理 实现用户角色的变更。
- 项目加密可以设置项目公开状态私有项目需要通过Token访问。
- 站点配置,可开启匿名访问、验证码等。
- Project management, you can edit the project, add members, etc.
- Document management, adding and deleting documents, etc.
- Comment management, you can manage document comments and comments posted by yourself.
- User management, adding and disabling users, changing personal information, etc.
- User authority management, change user roles.
- Project encryption, you can set the public status of the project, and private projects need to be accessed through Token.
- Site configuration, anonymous access, verification code, etc.
# 参与开发
# Contributing
我们欢迎您在 MinDoc 项目的 GitHub 上报告 issue 或者 pull request。
We welcome you to report issue or pull request on the GitHub.
如果您还不熟悉GitHub的Fork and Pull开发模式您可以阅读GitHub的文档https://help.github.com/articles/using-pull-requests 获得更多的信息。
If you are not familiar with GitHub's Fork and Pull development model, you can read the GitHub documentation (https://help.github.com/articles/using-pull-requests) for more information.
# 关于作者
一个不纯粹的PHPer一个不自由的 gopher 。

View File

@ -61,7 +61,7 @@ nohup ./godoc &
Windows 下后台运行需要借助 CMD 命令行命令:
```bash
#在MinDoc目录下新建一个slave.vbs文件
#在MinDoc目录下新建一个slave.vbs文件
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c start.bat",vbhide

View File

@ -3,11 +3,11 @@
<thead>
<tr>
<td>#</td>
<td class="col-sm-3">{{i18n $.Lang "doc.tpl_name"}}</td>
<td class="col-sm-2">{{i18n $.Lang "doc.tpl_name"}}</td>
<td class="col-sm-2">{{i18n $.Lang "doc.tpl_type"}}</td>
<td class="col-sm-2">{{i18n $.Lang "doc.creator"}}</td>
<td class="col-sm-3">{{i18n $.Lang "doc.create_time"}}</td>
<td class="col-sm-2">{{i18n $.Lang "doc.operation"}}</td>
<td class="col-sm-3">{{i18n $.Lang "doc.operation"}}</td>
</tr>
</thead>
<tbody>
@ -20,15 +20,15 @@
<tr>
<td>{{$item.TemplateId}}</td>
<td>{{$item.TemplateName}}</td>
<td>{{if $item.IsGlobal}}{{i18n .Lang "doc.global_tpl"}}{{else}}{{i18n .Lang "doc.project_tpl"}}{{end}}</td>
<td>{{if $item.IsGlobal}}{{i18n $.Lang "doc.global_tpl"}}{{else}}{{i18n $.Lang "doc.project_tpl"}}{{end}}</td>
<td>{{$item.CreateName}}</td>
<td>{{date_format $item.CreateTime "2006-01-02 15:04:05"}}</td>
<td>
<button class="btn btn-primary btn-sm btn-insert" data-id="{{$item.TemplateId}}">
{{i18n .Lang "doc.insert"}}
{{i18n $.Lang "doc.insert"}}
</button>
<button class="btn btn-danger btn-sm btn-delete" data-id="{{$item.TemplateId}}" data-loading-text="删除中...">
{{i18n .Lang "doc.delete"}}
{{i18n $.Lang "doc.delete"}}
</button>
</td>
</tr>