feat: alipay login
This commit is contained in:
@@ -1,30 +1,53 @@
|
||||
export const wxLogin = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.login({
|
||||
success: res => {
|
||||
success: (res) => {
|
||||
if (res.code) {
|
||||
resolve(res.code)
|
||||
resolve(res.code);
|
||||
} else {
|
||||
reject('登录失败:code为空')
|
||||
reject("登录失败:code为空");
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const alipayLogin = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// #ifdef MP-ALIPAY
|
||||
my.getAuthCode({
|
||||
scopes: "auth_user",
|
||||
success: (res) => {
|
||||
if (res.authCode) {
|
||||
resolve(res.authCode);
|
||||
} else {
|
||||
reject("登录失败:authCode为空");
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
// #ifndef MP-ALIPAY
|
||||
reject("当前非支付宝环境");
|
||||
// #endif
|
||||
});
|
||||
};
|
||||
|
||||
export const wxGetUserProfile = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善用户信息',
|
||||
success: res => {
|
||||
resolve(res)
|
||||
desc: "用于完善用户信息",
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: err => {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const BASE_URL = "https://api.ai-meng.com";
|
||||
// const BASE_URL = "https://api.ai-meng.com";
|
||||
// const BASE_URL = 'http://127.0.0.1:3999'
|
||||
// const BASE_URL = "http://192.168.1.3:3999";
|
||||
const BASE_URL = "http://192.168.1.3:3999";
|
||||
// const BASE_URL = "http://192.168.31.253:3999";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user