1.0.4 • Published 1 year ago
donut-plugin v1.0.4
donut框架介绍
donut是一款由华医卫仕前端团队开发的一款速搭建app、小程序、H5移动端和pc端项目的插件。
功能组成
1、通过配置接口列表实现接口调用;
2、集成了前端开发的常用工具,如date(日期时间格式处理)、validator(表单验证)、websocket(实时通信)等等...
配置文件 请将配置文件
donut.config.js
放在项目根目录下
export default {
config: {
platform:'APP',
host: {
production:'www.hokos.cn',
dev:'www.hokos.cn'
},
loginPage:'/',
sslOn:true,
credentialsOn:false, //请求接口是否发送用户凭证 如果发送凭证 后端 response中的Access-Control-Allow-Origin要指定为当前项目的域名
apis: [{
group: 'user',
name: 'add',
contentType: 'application/json;charset=utf-8',
url: '/hywshi-xxx-xxx/user/add',
method: 'POST'
},
{
group: 'user',
name: 'save',
contentType: 'application/json;charset=utf-8',
url: '/hywshi-xxx-xxx/user/save',
method: 'POST'
},
{
group: 'user',
name: 'delete',
contentType: 'application/json;charset=utf-8',
url: '/hywshi-xxx-xxx/user/delete',
method: 'POST'
},
{
group: 'goods',
name: 'add',
contentType: 'application/json;charset=utf-8',
url: '/hywshi-xxx-xxx/goods/add',
method: 'POST'
},
{
group: 'user',
name: 'update',
contentType: 'application/json;charset=utf-8',
url: '/hywshi-xxx-xxx/user/update',
method: 'POST'
},
],
header:{
token:{
key:'Authorization',
keyValuePrefix:'Hywshi_Platform ',
apiResponseKey:'token'
}
},
resourceUrl:{
imagePath:'/hywshi-platform-oss/oss/preview?filePath='
},
websocket:{
url:`/wsv1?token=`,
port:8443
}
},
project:{
loginPage:'/',
errCode:{noLogin:401,sessionTimeout:409,systemException:444}
},
form:{
validate:{
inqueryForm:{'populationId': '选择成员', 'inspectionType': '选择报告类型', 'materials': '上传报告材料'},
addUser:{'name':'填写姓名','phone':'填写手机号'}
}
}
}
如何使用
使用接口
this.API.组名.接口名({data:{}}) 如:this.API.user.add({data:this.user})
使用资源接口
tihs.resource.imagePath 此处的imagePath位于配置文件的resourceUrl节点下的imagePath
使用常用工具
this.Tools.date.getTimeStamp("2023-01-01 08:00:00")
获取websocket链接
this.ws_url