import http from "/utils/request.js";
// 获取验证码
let sendCode = (data) => http.post('/oa/code/sendCode', data);
// 验证码登录
let codeLogin = (data) => http.post('/codeLogin', data);
// 微信一键登录
let wxgetLogin = (data) => http.post('/xcxLogin', data);
// 退出登录
let logout = (data) => http.post('/logout', data);
// 获取用户信息
let getUserInfo = (data) => http.get('/home/user/enter/userInfo', data);
// 一键登录获取code
let wxLogin = () => {
  return new Promise((resolve, reject) => {
    uni.login({
      success(res) {
        uni.setStorageSync('code', res.code)
        resolve(res.code)
      },
      fail() {
        reject(new Error('获取微信登录码失败'))
      }
    })
  })
};
export {
  sendCode,
  codeLogin,
  wxgetLogin,
  logout,
  getUserInfo,
  wxLogin
};