# heimatoutiao_admin
**Repository Path**: Daazzer/heimatoutiao_admin
## Basic Information
- **Project Name**: heimatoutiao_admin
- **Description**: No description available
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-10-31
- **Last Updated**: 2021-01-04
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 黑马头条后台
## 介绍
对[黑马头条前台](https://gitee.com/Daazzer/heimatoutiao)项目进行管理
- 项目页面
- 登录页面
- 欢迎页面
- 文章发布页
- 文章编辑页
- 文章表格数据页
- 项目使用技术
- [vue](https://github.com/vuejs/vue) - web 框架
- [vue-router](https://github.com/vuejs/vue-router) - 页面路由
- [element-ui](https://element.eleme.cn/#/zh-CN/) - UI 框架
- [axios](https://github.com/axios/axios) - http 请求
- [sass](https://github.com/sass/sass) - 预编译样式
- [vue-word-editor](https://github.com/hsian/vue-word-editor) - 富文本编辑
- 版本管理
- [git](https://git-scm.com/)
- 项目 `src` 目录结构
```powershell
src
├─api # 项目服务器 api
├─assets # 静态资源目录
│ └─fonts
├─components # 项目封装的组件
├─router # 视图路由
├─styles
├─utils # 通用性 js 文件
└─views # 路由视图
└─index # 首页目录
```
## 使用方法
项目依赖安装
```
npm install
```
开发服务器,编译与热重载
```
npm start
```
编译打包到生产环境
```
npm run build
```
## 项目格式化配置
自定义的 vscode 编辑器配置:`/.vscode/settings.json`
- 给函数名与函数括号之间添加一个空格
- 移除分号
```json
{
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"javascript.format.semicolons": "remove"
}
```
自定义的 .editorconfig 配置文件:[`/.editorconfig` ](.editorconfig)
[editorconfig 规范](https://editorconfig.org/)
- 默认 `utf-8` 字符集
- 空格缩进类型
- 两个缩进
- 去掉行尾空格
- 空行结束
```tex
# 这个文件可以配合 vscode 的 editorconfig 插件自动格式化你指定好的文件
# http://editorconfig.org
[*]
charset = utf-8
indent_style = space
end_of_line = lf
[*.{js,jsx,ts,tsx,vue}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
```
## 项目数据服务器
- 配置服务器基本路径:[@/utils/axios_http-config.js](src/utils/axios_http-config.js)
- 服务器 api:[@/api](src/api)
服务器基地址配置例子:
```js
import axios from 'axios'
axios.defaults.baseURL = 'http://localhost:3000'
export default axios
```
api 配置例子:
```js
import axios from '@/utils/axios_http-config'
/**
* 文章列表
* @param {Object} [params] 参数对象
* @param {number} [data.category] 栏目id
* @param {number} [data.pageIndex] 当前页码
* @param {number} [data.pageSize] 每页显示数据条数
* @returns {Promise}
*/
const getArticle = params => axios.get('/post', { params }).then(res => [null, res]).catch(err => [err])
/**
* 发布文章
* @param {Object} data 参数对象
* @param {string} data.title 文章标题
* @param {string} data.content 文章内容
* @param {Array