This commit is contained in:
仲么了
2023-10-26 09:03:16 +08:00
parent 9b6ba745f2
commit 89d3d78f22
16 changed files with 209 additions and 76 deletions

View File

@@ -5,17 +5,20 @@ export default (options = {}) => {
if (options.data == undefined) {
options.data = {}
}
options.debounce = options.debounce === undefined ? true : options.debounce
// 防止接口重复点击
if (arr.indexOf(options.url) === -1) {
arr.push(options.url)
} else {
return new Promise((resolve, reject) => {
reject({
code: -1,
msg: '请勿重复提交',
data:options.url
if (options.debounce) {
if (arr.indexOf(options.url) === -1) {
arr.push(options.url)
} else {
return new Promise((resolve, reject) => {
reject({
code: -1,
msg: '请勿重复提交',
data: options.url,
})
})
})
}
}
return new Promise((reslove, reject) => {
let url = options.url.indexOf('http') === -1 ? config.domain + options.url : options.url
@@ -70,7 +73,7 @@ export default (options = {}) => {
* @param {Number} code 错误码
*/
function errHandler(res) {
console.log(res);
console.log(res)
switch (res.code) {
case 'A0024':
uni.reLaunch({ url: '/pages/user/login' })