开始做登录
This commit is contained in:
@@ -164,4 +164,35 @@ export const alertError = (message) => {
|
||||
title: message,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
export const loadingFunc = async callback => {
|
||||
if (typeof callback !== "function") {
|
||||
return
|
||||
}
|
||||
await showLoading()
|
||||
try {
|
||||
await callback()
|
||||
} catch(err) {
|
||||
|
||||
} finally {
|
||||
await hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
export const wxLogin = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.login({
|
||||
success (res) {
|
||||
if (res.code) {
|
||||
resolve(res.code)
|
||||
return
|
||||
}
|
||||
reject()
|
||||
},
|
||||
fail: err => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
@@ -95,7 +95,7 @@ const parseResponse = function (response) {
|
||||
}
|
||||
|
||||
if (response.data.code !== 0) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
return response.data;
|
||||
@@ -150,5 +150,6 @@ export default {
|
||||
DELETE,
|
||||
SERVER,
|
||||
RAW_SERVER,
|
||||
api
|
||||
api,
|
||||
OK: ok
|
||||
};
|
||||
|
Reference in New Issue
Block a user