parent
72bc2e0f5e
commit
92e403fe67
@ -0,0 +1,23 @@
|
||||
//蒲公英API文档地址 -> https://static.pgyer.com/doc/view/api#installApp
|
||||
|
||||
import {
|
||||
request
|
||||
} from '@/utils/pgyRequest.js' //导入封装好的js文件
|
||||
|
||||
|
||||
//获取App是否有更新
|
||||
export function getAppCheck(data) {
|
||||
return request({
|
||||
url: '/app/check',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//获取APP详细信息
|
||||
export function getAppInfo(data) {
|
||||
return request({
|
||||
url: '/app/view',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
const BASE_URL = 'http://www.pgyer.com/apiv2'
|
||||
export const request = (options) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 获取用户令牌
|
||||
let token = ''
|
||||
// 设置请求头
|
||||
const header = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
// Authorization: `Bearer ${token}`,
|
||||
...options.header // 可以传入额外的请求头参数
|
||||
}
|
||||
// ⭐在发送请求之前执行拦截操作
|
||||
options.data._api_key = '0b9b69b071c1baa43015b841534e9001'
|
||||
uni.request({
|
||||
url: BASE_URL + options.url, //接收请求的API
|
||||
method: options.method || 'GET', //接收请求的方式,如果不传默认为GET
|
||||
data: options.data || {}, //接收请求的data,不传默认为空
|
||||
header: header, //接收请求的header
|
||||
success(res) {
|
||||
resolve(res.data) // 使用resolve将数据传递出去
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in new issue