Commit a908ee3d authored by 李超鹏's avatar 李超鹏

增加接口

parent f445953e
...@@ -4,11 +4,19 @@ const db = uniCloud.database({ ...@@ -4,11 +4,19 @@ const db = uniCloud.database({
let cloudRulesApiFun = function(vm){ let cloudRulesApiFun = function(vm){
/* 通过unionid查询用户 */ /* 查询所有产品*/
let getAllBrand = async () => await db.collection("config").where({type: "brand"}).get(); let getAllProduct = async () => await db.collection("product").get();
/* 查询产品下的品牌 {product_code:"P0001"}*/
let getBrand = async (params = {}) => await db.collection("brand").where(params).get();
/* 查询规范项目 {product_code:"P0001"}*/
let getstandard = async (params = {}) => await db.collection("standard").where(params).get();
const rulesApi = { const rulesApi = {
getAllBrand, getAllProduct,
getBrand,
getstandard,
} }
return rulesApi return rulesApi
} }
......
...@@ -178,12 +178,20 @@ ...@@ -178,12 +178,20 @@
// }); // });
}, },
onShow() { async onShow() {
//this.getWorkerType() //this.getWorkerType()
//this.getPerson() //this.getPerson()
console.log('onShow') console.log('onShow')
this.$u.cloudApi.getAllBrand().then(res =>{ this.$u.cloudApi.getAllProduct().then(res =>{
console.log(res,"执行") console.log(res,"产品")
}
)
this.$u.cloudApi.getBrand({product_code:"P0001"}).then(res =>{
console.log(res,"品牌")
}
)
this.$u.cloudApi.getstandard({brand_code:"B0001"}).then(res =>{
console.log(res,"规范标准")
} }
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment