Files
frontend-app/utils/login.js
T
2026-08-29 13:02:46 +08:00

41 lines
722 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { wechatLogin } from "@/api/auth.js";
// 服务端接口 - 获取手机号
function getPhoneNumberFn(code,phoneCode ) {
return new Promise(resolve => {
wechatLogin({
mobile:'',
smscode:'',
phoneCode:phoneCode,
token:code,
type:1,
isValid: true,
}).then(res => {
resolve(res)
})
.catch(err => {
console.log('获取手机号失败2:', err);
})
})
}
// 微信api : 微信登录
function loginFn() {
return new Promise((resolve, reject) => {
uni.login({
success: async (res) => {
// 第一遍code
resolve(res)
},
fail: (err) => {
console.log('login fail:', err);
}
})
})
}
export {
loginFn,
getPhoneNumberFn
}