Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ser163 committed May 26, 2021
0 parents commit b6fa158
Show file tree
Hide file tree
Showing 49 changed files with 22,634 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

module.exports = {
env: {
"mocha": true,
"es6": true
},
extends: [
'@webank/eslint-config-webank/vue',
],
globals: {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
// Vue: false
},
rules: {
'no-plusplus': 'off',
'no-bitwise': 'off',
'vue/comment-directive': 'off'
}
};
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.idea
.git
.vscode
.cache
.coverage
/dist
.history
/node_modules
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-present webank

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Tole 密码树洞
===============

> 运行环境要求npm 6.14.12+ vue 2.x fes.js 2.x
>
> tole-front
## 主要新特性

* 角色分离
* 简单易用
* 前后端分离
* 适合中小企业
* Vue 支持更佳快速
* 使用Fes.js技术支持
* 操作简单,上手容易
* 字段级加密,更安全
* 对企业用户更佳友好
* 更好的团队合作,及时共享
* 最新ThinkPHP v6.0 框架支持

## 架构
* vue + fes.js
* thinkphp + Redis

## 项目名称
本项目名称为密码树洞,项目名称是Tree Hole的简写Tole。

树洞就是一个可以放心倾诉心事和秘密的地方,而且不用担心秘密会被泄漏。

## 安装

### clone源码
```shell
git clone https://github.com/ser163/tole-front
```

### 配置
修改`fes.config.js`文件中的,env下的local地址,为本地测试环境。prod为正式地址。

### 运行

```bash
npm run dev
```
### 编译

```bash
npm run build
```

修改里面相应配置。`TOKEN` 是测试环境下的通用key,可以自行设置。
`SITE_URL` 为站点的外部名称。此地址是为了用户下载使用。

## 源码托管
GitHub:
>server: [https://github.com/ser163/tole](https://github.com/ser163/tole)
>
> front: [https://github.com/ser163/tole-front](https://github.com/ser163/tole-front)
Gitee:
> server: [https://gitee.com/ser163/tole](https://gitee.com/ser163/tole)
>
> front: [https://gitee.com/ser163/tole-front](https://gitee.com/ser163/tole-front)
### 请我喝杯茶🍵
如果你觉得此项目,对你有帮助,可以请我喝杯茶。


![支付宝](src/static/alipay.png "支付宝")                     ![微信](src/static/weixin.png "支付宝")


## 版权信息

源码仅授权给个人使用,不允许进行商业分发。如果商用,二次开发请联系作者授权!

122 changes: 122 additions & 0 deletions fes.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
module.exports = {
// 可选有vertical、horizontal,默认vertical
mode: 'vertical',
// 可选有blue、dark,默认blue
theme: 'blue',
// 项目名称
fesName: '密码树洞',
favicon: 'static/favicon.ico', // 图标
lazyRouter: true,
// 环境变量配置, 默认使用local环境
env: {
// 本地开发环境
local: {
api: 'http://pw.com/'
},
// 测试环境 --env=sit 触发使用
develop: {
api: 'http://pw.com/'
},
// 生产环境 --env=sit 触发使用
prod: {
api: 'http://pw.com/'
}
},
// 配置角色-路由访问权限,使用FesApp.setRole('unLogin')来修改当前用户的角色,控制路由访问权限
roles: {
unLogin: ['/'],
admins: ['/dashboard/console', '*'],
users: ['/dashboard/console',
'/my',
'/hole/new',
'/hole/find']
},
// map
map: {
level: [['1', '青铜'], ['2', '白银'], ['3', '黄金'], ['4', '铂金']]
},
// 左侧菜单配置
menu: [
{
title: '工作台',
subMenu: [
{
title: '工作台',
path: '/dashboard/console'
},
{
title: '用户管理',
path: '/dashboard/user'
},
{
title: '用户角色',
path: '/dashboard/role'
},
{
title: '用户登录记录',
path: '/dashboard/ulogs'
},
{
title: '用户操作记录',
path: '/dashboard/history'
},
{
title: '组织架构',
path: '/dashboard/depart'
}
]
},
{
title: '树洞',
subMenu: [
{
title: '新建密码',
path: '/hole/new'
}
]
},
{
title: '规则',
subMenu: [
{
title: '规则列表',
path: '/rules/list'
}
]
},
{
title: '关于',
path: '/about'
}
],
i18n: {
// default zh-cn
locale: 'zh-cn',
messages: {
'zh-cn': {
menu: {
internationalization: '国际化'
},
overview: '概述',
i18n: {
internationalization: '国际化,基于',
achieve: '实现。',
ui: 'UI组件'
},
title: '密码树洞'
},
en: {
menu: {
internationalization: 'internationalization'
},
overview: 'Overview',
i18n: {
internationalization: 'internationalization,base on',
achieve: 'to achieve.',
ui: 'UI components'
},
title: 'PW hole'
}
}
}
};
4 changes: 4 additions & 0 deletions karma.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
test: ['test/**/*.spec.js'],
coverage: ['src/components/**/*', 'src/helpers/**/*']
};
113 changes: 113 additions & 0 deletions mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
module.exports = (cgiMock, Mock) => {
const { Random } = Mock;

// 前缀,全局(可选)
// cgiMock.prefix = '';

// 返回一个数字
cgiMock('/number', 123);

// 返回一个json
cgiMock({
url: '/json',
result: {
code: '400101', msg: "不合法的请求:Missing cookie 'wb_app_id' for method parameter of type String", transactionTime: '20170309171146', success: false
}
});

// 利用mock.js 产生随机文本
cgiMock('/text', Random.cparagraph());

// 返回一个字符串 利用mock.js 产生随机字符
cgiMock('/string', Mock.mock({
'string|1-10': '★'
}));


// 正则匹配url, 返回一个字符串
cgiMock(/\/abc|\/xyz/, 'regexp test!');

// option.result 参数如果是一个函数, 可以实现自定义返回内容, 接收的参数是是经过 express 封装的 req 和 res 对象.
cgiMock(/\/function$/, (req, res) => {
res.send('function test');
});

// 返回文本 fs.readFileSync
// cgiMock('/file', cgiMock.file('./test.json'));

// 更复杂的规则配置
cgiMock({
url: /\/who/,
method: 'GET',
result(req, res) {
if (req.query.name === 'kwan') {
res.json({ kwan: '孤独患者' });
} else {
res.send('Nooooooooooo');
}
},
headers: {
'Content-Type': 'text/plain',
'Content-Length': '123',
ETag: '12345'
},
cookies: [
{
name: 'myname', value: 'kwan', maxAge: 900000, httpOnly: true
}
],
// 接口随机延迟
timeout: Mock.mock({
'number|1000-5000': 1000
}).number
});
// 登录
cgiMock('/login', (req, res) => {
res.send(JSON.stringify({
code: '0',
msg: '',
result: {
username: '万纯(harrywan)',
roleName: '管理员'
}
}));
});

cgiMock('/getTestList', (req, res) => {
const list = [];
for (let i = 0; i < req.body.pageSize; i++) {
list.push({
a: i
});
}
res.send(JSON.stringify({
code: '0',
msg: 'this is message',
result: {
list,
page: {
pageSize: req.body.pageSize,
currentPage: req.body.currentPage,
totalPage: 1000
}
}

}));
});

cgiMock('/getNumber', (req, res) => {
res.send(JSON.stringify({
code: '0',
msg: 'this is message',
result: 4
}));
});

cgiMock('/getRoleName', (req, res) => {
res.send(JSON.stringify({
code: '0',
msg: 'this is message',
result: 'admin'
}));
});
};
Loading

0 comments on commit b6fa158

Please sign in to comment.