text_web_demo 是一个基于node.js与vue的文本情感分析体验demo,具有登陆、注册、文本分析、反馈结果、留言等功能。
访问 http://www.bjfunlp.com/ 即可体验。
├─.babelrc -------------------- // babel配置
├─.eslintrc ------------------- // eslint配置
├─LICENSE
├─README.md
├─build ----------------------- // build相关配置
│ ├─build.js
│ ├─check-versions.js
│ ├─dev-client.js
│ ├─utils.js
│ ├─vue-loader.conf.js
│ ├─webpack.base.conf.js
│ ├─webpack.dev.conf.js
│ └─webpack.prod.conf.js
├─config ---------------------- // 配置文件
│ ├─dev.env.js
│ ├─index.js
│ └─prod.env.js
├─index.js -------------------- // 主程序
├─nodemon.json ---------------- // nodemon配置
├─package-lock.json
├─package.json ---------------- // 项目依赖
└─src
├─client -------------------- // 前端
│ ├─App.vue ----------------- // 主组件
│ ├─components -------------- // 组件
│ │ ├─Home.vue -------------- // home页面组件
│ │ ├─Login.vue ------------- // 登陆组件
│ │ ├─Readme.md
│ │ ├─Register.vue ---------- // 注册组件
│ │ ├─accountM.vue ---------- // 用户管理组件
│ │ ├─comment.vue ----------- // 留言组件
│ │ ├─commentM.vue ---------- // 留言管理组件
│ │ ├─my_text.vue ----------- // 文本分析组件
│ │ ├─mychart.vue ----------- // 图标组件
│ │ ├─notFound.vue ---------- // 404组件
│ │ └─textM.vue ------------- // 反馈管理组件
│ ├─index.js ---------------- // 前端主程序
│ ├─router ------------------ // vue-router配置文件
│ │ ├─Readme.md
│ │ └─index.js
│ ├─static ------------------ // 静态资源文件
│ │ ├─Readme.md
│ │ ├─logo1-t.png
│ │ ├─logo1.png
│ │ ├─logo2-t.png
│ │ ├─logo2.jpg
│ │ ├─logo3-t.png
│ │ ├─logo3.png
│ │ └─robot.png
│ ├─store ------------------- // vuex 配置文件
│ │ ├─Readme.md
│ │ └─store.js
│ └─views ------------------- // 拼接文件
│ └─Readme.md
└─server -------------------- // 后端
├─config ------------------ // 配置文件
│ └─Readme.md
├─data
│ ├─dao ------------------- // 数据库测试
│ │ ├─Readme.md
│ │ └─index.js
│ ├─entity ---------------- // 数据实体配置
│ │ ├─AccountSchema.js
│ │ ├─CommentSchema.js
│ │ └─TextSchema.js
│ ├─model ----------------- // 数据模型
│ │ ├─Models.js
│ │ └─Readme.md
│ └─sqlOptions.js --------- // 数据库相关配置
├─index.js ---------------- // 后端主程序
├─public ------------------ // 静态资源文件
│ ├─Readme.md
│ └─favicon.ico
├─static ------------------ // 静态文件
│ └─Readme.md
└─views ------------------- // 主页面
└─index.html
本地运行项目
$ cd web_demo
$ npm i # 安装依赖
$ npm start # visit http://localhost:80
build 前端代码
$ npm run-script build # build in ./dist/
数据库相关配置文件在/src/server/data/sqlOptions.js
中,需要先配置数据库连接的相关参数,并提前建立数据库,数据库中的表无需提前建立,项目会自动生成。
- Method: POST
- URL:
/api/register
- Headers: Content-Type:application/json
- Body:
{
”name“: name,
”email“: email,
“pwd”: pwd,
”type“: type,
}
- Body
{
"code": 200,
}
- Method: POST
- URL:
/api/login
- Headers: Content-Type:application/json
- Body:
{
”name“: name,
“pwd”: pwd,
}
- Body
{
"code": 200,
“data”:{
"id": 2,
"name": "123",
"pwd": "0",
"email": "123@123.ckm",
"type": "administrator"
}
}
- Method: POST
- URL:
/api/getSenti
- Headers: Content-Type:application/json
- Body:
{
“rurl”: “”,
“textarea”: “i love you”,
}
- Body
{
"code": 200,
“data”:[
[
0.9766928633040809,
0.023307136695919155
]
]
}
- Method: POST
- URL:
/api/save/text
- Headers: Content-Type:application/json
- Body:
{
"data": {
"content": "i love you",
"oldType": 0.9766928633040809,
"newType": 1,
"dateTime": "2020-01-06T02:18:20.186Z",
"textComment": "yes",
"account": {
"id": 6,
"name": "12345",
"pwd": "0",
"email": "321@3124.sad",
"type": "normal"
}
}
}
- Body
{
"code": 200,
“data”:{
"content": "i love you",
"oldType": 0.9766928633040809,
"newType": 1,
"dateTime": "2020-01-06T02:15:59.330Z",
"textComment": "yes",
"account": {
"id": 6,
"name": "12345",
"pwd": "0",
"email": "321@3124.sad",
"type": "normal"
},
"id": 6
}
}
- Method: POST
- URL:
/api/save/comment
- Headers: Content-Type:application/json
- Body:
{
"data": {
"content": "love",
"dateTime": "2020-01-06T02:20:51.639Z",
"account": {
"id": 6,
"name": "12345",
"pwd": "0",
"email": "321@3124.sad",
"type": "normal"
}
}
}
- Body
{
"code": 200,
“data”:{
"content": "love",
"dateTime": "2020-01-06T02:20:51.639Z",
"account": {
"id": 6,
"name": "12345",
"pwd": "0",
"email": "321@3124.sad",
"type": "normal"
},
"id": 11
}
}
- Method: POST
- URL:
/api/getAll/{type}
- Headers: Content-Type:application/json
- Body:
{
}
- Body
{
"code": 200,
“data”:[]
}