wupengfei
9 天以前 88550d6f43aece6e20c7a52b6e47aff638fb02f3
apps/underTakeMiniApp/src/subpackages/login/loginByForm/accountLoginForm.vue
@@ -76,6 +76,7 @@
const formRef = ref(null);
const isAccount = ref(false);
const wxMiniAppUserLoginRes = ref<API.LoginCommandCallback>();
const loginRes = ref(null);
const form = reactive({
  loading: false,
@@ -88,7 +89,7 @@
  userPassword: [{ required: true, message: '请输入密码' }],
});
async function handleLoginByHasAccount() {
function handleLoginByHasAccount() {
  try {
    if (props.policyChecked) {
      userStore.loginSuccess(wxMiniAppUserLoginRes.value);
@@ -101,7 +102,6 @@
async function handleLogin() {
  try {
    let loginRes = await Taro.login();
    if (props.policyChecked) {
      const { valid } = await formRef.value.validate();
      if (valid) {
@@ -109,7 +109,7 @@
        await userStore.loginByPassword({
          userName: form.userName,
          password: form.userPassword,
          code: loginRes.code,
          code: loginRes.value?.code,
        });
        handleLoginSuccess();
      }
@@ -166,9 +166,9 @@
onMounted(async () => {
  try {
    let loginRes = await Taro.login();
    loginRes.value = await Taro.login();
    const params: API.WxmpLoginCommand = {
      code: loginRes.code,
      code: loginRes.value?.code,
      type: AppLocalConfig.userType,
      enterpriseType: AppLocalConfig.enterpriseType,
    };
@@ -182,6 +182,8 @@
    if (error?.info?.errorCode == 's401') {
      isAccount.value = false;
    }
  } finally {
    loginRes.value = await Taro.login();
  }
});
</script>