Browse Source

修改登录注册接口,添加国家区号

milestone-20251031-简版功能开发
wangyi 3 weeks ago
parent
commit
687fc828bc
  1. 1
      components/login-prompt.vue
  2. 21
      pages/start/Registration/Registration.vue
  3. 9
      pages/start/login/login.vue
  4. 1341
      pages/start/recoverPassword/list.js
  5. 12
      pages/start/recoverPassword/recoverPassword.vue

1
components/login-prompt.vue

@ -109,6 +109,7 @@ const continueAsVisitor = async () => {
const res = await LoginApi({
loginType: "VISITOR", //EMAIL,PHONE,DCCODE,APPLE,GOOGLE,VISITOR
account: "", // //dccode
phoneCountry: "", //
verifyCode: "", //
password: "", //
useCode: "", //使 true/false

21
pages/start/Registration/Registration.vue

@ -189,7 +189,7 @@
<script setup>
import { ref } from "vue";
//
import countryList from "../login/list";
import countryList from "../Registration/list";
import footerBar from "../../../components/footerBar";
import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import { verificationPhone, verificationEmail } from "../login/verification";
@ -198,12 +198,13 @@ import {
SendEmailCodeApi,
SendPhoneCodeApi,
} from "../../../api/start/login";
import { useDeviceStore} from "../../../stores/modules/deviceInfo"
import { useUserStore} from "../../../stores/modules/userInfo"
import { useDeviceStore } from "../../../stores/modules/deviceInfo";
import { useUserStore } from "../../../stores/modules/userInfo";
const type = ref("");
const email = ref("");
const password = ref("");
const deepChartID = ref("");
const phone = ref("");
const country = ref("+86");
const agreed = ref(false);
@ -241,6 +242,7 @@ function showCountryPicker() {
),
success: function (res) {
selectedCountry.value = countries.value[res.tapIndex];
country.value = selectedCountry.value.code;
},
});
}
@ -253,7 +255,7 @@ function goToIndex() {
}
function goToService() {
//
//
uni.navigateTo({
url: "/pages/customerServicePlatform/csPlatformIndex",
});
@ -281,14 +283,15 @@ async function register() {
const registerType = changeLoginType();
isLoading.value = true;
const deviceStore = useDeviceStore()
const deviceStore = useDeviceStore();
const res = await registerApi({
registerType: registerType,
phoneCountry: country.value, //
account: account,
verifyCode: verifyCode.value,
agree: agreed.value,
deviceId:deviceStore.deviceInfo.deviceId
deviceId: deviceStore.deviceInfo.deviceId,
});
isLoading.value = false;
@ -326,7 +329,7 @@ function changeAccount() {
}
if (switchType.value === "Phone") {
account.value = `${country.value}-${phone.value}`;
account.value = phone.value;
}
if (switchType.value === "Email") {
account.value = email.value;
@ -511,9 +514,9 @@ async function sendCode() {
if (switchType.value === "Phone") {
//
const phoneAll = `${country.value}-${phone.value}`;
const res = await SendPhoneCodeApi({
phone: phoneAll,
phoneCountry: country.value, //
phone: phone.value,
});
console.log("手机验证码:", res.message);

9
pages/start/login/login.vue

@ -377,6 +377,7 @@ async function Login() {
isLoading.value = true;
const res = await LoginApi({
loginType: loginType,
phoneCountry: country.value, //
account: account,
verifyCode: verifyCode.value,
password: password.value,
@ -442,8 +443,6 @@ function basicVerification() {
return false;
}
const phoneAll = `${country.value}${phone.value}`;
console.log("完整手机号" + phoneAll);
if (!validatePhoneNumber(country.value, phone.value)) {
return false;
}
@ -551,7 +550,7 @@ function changeAccount() {
}
if (switchType.value === "Phone") {
account.value = `${country.value}-${phone.value}`;
account.value = phone.value;
}
if (switchType.value === "Email") {
account.value = email.value;
@ -667,9 +666,9 @@ async function sendCode() {
if (switchType.value === "Phone") {
//
const phoneAll = `${country.value}-${phone.value}`;
const res = await SendPhoneCodeApi({
phone: phoneAll,
phoneCountry: country.value, //
phone: phone.value,
});
console.log("手机验证码:", res.message);

1341
pages/start/recoverPassword/list.js
File diff suppressed because it is too large
View File

12
pages/start/recoverPassword/recoverPassword.vue

@ -232,7 +232,7 @@
<script setup>
import { ref } from "vue";
//
import countryList from "../login/list";
import countryList from "../recoverPassword/list";
import footerBar from "../../../components/footerBar";
import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import { verificationPhone, verificationEmail } from "../login/verification";
@ -248,6 +248,7 @@ const email = ref("");
const password = ref("");
const newPasswordFirst = ref("");
const newPasswordSecond = ref("");
const deepChartID = ref("");
const phone = ref("");
const country = ref("+86");
const agreed = ref(false);
@ -287,6 +288,7 @@ function showCountryPicker() {
),
success: function (res) {
selectedCountry.value = countries.value[res.tapIndex];
country.value = selectedCountry.value.code;
},
});
}
@ -429,6 +431,7 @@ async function register() {
const res = await verifyCodeApi({
loginType: loginType, //EMAIL,PHONE
phoneCountry: country.value, //
account: account, // /
verifyCode: verifyCode.value,
});
@ -451,7 +454,7 @@ function changeAccount() {
}
if (switchType.value === "Phone") {
account.value = `${country.value}-${phone.value}`;
account.value = phone.value;
}
if (switchType.value === "Email") {
account.value = email.value;
@ -570,10 +573,9 @@ function sendCode() {
}
}
if (switchType.value === "Phone") {
const phoneAll = `${country.value}-${phone.value}`;
const res = SendPhoneCodeApi({
phone: phoneAll,
phoneCountry: country.value, //
phone: phone.value,
});
if (!res) {
uni.showToast({

Loading…
Cancel
Save