1234567891011121314151617181920 |
- const { baseUrl } = require('./env').intell
- module.exports = {
- intell:function(url , type , key ,data = {}){
- let fullUrl = `${baseUrl}${url}`
- return new Promise((resolve,reject)=>{
- wx.request({url: fullUrl,method:type,data,header: {"api-key":key},
- success(res){
- resolve(res)
- },
- fail(){
- wx.showToast({
- title: '接口请求错误',
- icon:'none'
- })
- reject('接口请求错误')
- }
- })
- })
- }
- }
|