删除调试代码
This commit is contained in:
@@ -231,12 +231,8 @@ const validateForm = () => {
|
|||||||
|
|
||||||
// 微信小程序授权前的检查
|
// 微信小程序授权前的检查
|
||||||
const checkBeforeWxAuth = (e) => {
|
const checkBeforeWxAuth = (e) => {
|
||||||
console.log('checkBeforeWxAuth called, canSubmit:', canSubmit.value);
|
|
||||||
console.log('userType:', userType.value, 'agreedToAgreement:', agreedToAgreement.value);
|
|
||||||
|
|
||||||
// 验证表单
|
// 验证表单
|
||||||
if (!validateForm()) {
|
if (!validateForm()) {
|
||||||
console.log('Validation failed, preventing wx auth');
|
|
||||||
// 阻止微信授权流程
|
// 阻止微信授权流程
|
||||||
if (e && e.preventDefault) {
|
if (e && e.preventDefault) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -249,23 +245,16 @@ const checkBeforeWxAuth = (e) => {
|
|||||||
|
|
||||||
// 微信获取手机号
|
// 微信获取手机号
|
||||||
const onWxGetPhoneNumber = async (e) => {
|
const onWxGetPhoneNumber = async (e) => {
|
||||||
console.log('onWxGetPhoneNumber called, event:', e);
|
const { encryptedData, iv } = e.detail;
|
||||||
console.log('userType:', userType.value, 'agreedToAgreement:', agreedToAgreement.value);
|
|
||||||
|
|
||||||
// 使用通用验证函数
|
// 使用通用验证函数
|
||||||
if (!validateForm()) {
|
if (!validateForm()) {
|
||||||
console.log('Validation failed in onWxGetPhoneNumber');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Validation passed, proceeding with wx auth');
|
|
||||||
|
|
||||||
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||||
uni.login({
|
uni.login({
|
||||||
provider: 'weixin',
|
provider: 'weixin',
|
||||||
success: (loginRes) => {
|
success: (loginRes) => {
|
||||||
console.log('微信登录code获取成功:', loginRes.code);
|
|
||||||
const { encryptedData, iv } = e.detail;
|
|
||||||
const code = loginRes.code;
|
const code = loginRes.code;
|
||||||
|
|
||||||
// 调用接口 /app/appWxphoneSmsCode
|
// 调用接口 /app/appWxphoneSmsCode
|
||||||
@@ -279,9 +268,6 @@ const onWxGetPhoneNumber = async (e) => {
|
|||||||
orgType: orgType.value
|
orgType: orgType.value
|
||||||
}, 'post').then((resData) => {
|
}, 'post').then((resData) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
console.log('获取验证码接口返回:', resData);
|
|
||||||
console.log('接口返回的所有字段:', Object.keys(resData));
|
|
||||||
|
|
||||||
// 检查可能的手机号字段
|
// 检查可能的手机号字段
|
||||||
const possiblePhoneFields = ['phone', 'mobile', 'phoneNumber', 'tel', 'mobilePhone'];
|
const possiblePhoneFields = ['phone', 'mobile', 'phoneNumber', 'tel', 'mobilePhone'];
|
||||||
let phoneValue = '';
|
let phoneValue = '';
|
||||||
@@ -317,7 +303,6 @@ const onWxGetPhoneNumber = async (e) => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取微信登录code失败:', err);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '获取登录信息失败,请重试',
|
title: '获取登录信息失败,请重试',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -342,17 +327,11 @@ const onWxGetPhoneNumber = async (e) => {
|
|||||||
|
|
||||||
// H5/App 微信登录(暂保持原有逻辑,后续可调整)
|
// H5/App 微信登录(暂保持原有逻辑,后续可调整)
|
||||||
const wxLogin = () => {
|
const wxLogin = () => {
|
||||||
console.log('wxLogin called');
|
|
||||||
console.log('userType:', userType.value, 'agreedToAgreement:', agreedToAgreement.value);
|
|
||||||
|
|
||||||
// 使用通用验证函数
|
// 使用通用验证函数
|
||||||
if (!validateForm()) {
|
if (!validateForm()) {
|
||||||
console.log('Validation failed in wxLogin');
|
console.log('Validation failed in wxLogin');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Validation passed, proceeding with H5/App login');
|
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// H5端跳转到H5登录页面
|
// H5端跳转到H5登录页面
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -415,17 +394,11 @@ const wxLogin = () => {
|
|||||||
|
|
||||||
// 测试账号登录(仅开发环境)
|
// 测试账号登录(仅开发环境)
|
||||||
const testLogin = () => {
|
const testLogin = () => {
|
||||||
console.log('testLogin called');
|
|
||||||
console.log('userType:', userType.value, 'agreedToAgreement:', agreedToAgreement.value);
|
|
||||||
|
|
||||||
// 使用通用验证函数
|
// 使用通用验证函数
|
||||||
if (!validateForm()) {
|
if (!validateForm()) {
|
||||||
console.log('Validation failed in testLogin');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Validation passed, proceeding with test login');
|
|
||||||
|
|
||||||
uni.showLoading({ title: '登录中...' });
|
uni.showLoading({ title: '登录中...' });
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
|||||||
Reference in New Issue
Block a user