From 38712ae83223cb244020e255fc37e1ce35775c45 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 09 四月 2026 13:53:40 +0800
Subject: [PATCH] 优化
---
src/views/h5/login/index.vue | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/views/h5/login/index.vue b/src/views/h5/login/index.vue
index befa9ae..86af36f 100644
--- a/src/views/h5/login/index.vue
+++ b/src/views/h5/login/index.vue
@@ -1,5 +1,5 @@
<template>
- <div class="login">
+ <div class="login" v-if="loginType == 'mobilePhone'">
<el-form ref="form" :model="form">
<el-form-item :rules="[$rules.required('璇疯緭鍏ユ墜鏈哄彿') , $rules.phone()]" prop="mobile">
<el-input v-model="form.mobile" placeholder="璇疯緭鍏ユ墜鏈哄彿" style="width: 100%" size="large" />
@@ -32,9 +32,17 @@
</template>
<script>
import { tokenUtils } from '@/utils/axios.js';
+import { useLoginStore } from '@/stores/login.js'
+import { storeToRefs } from 'pinia';
+import { isWeixin } from '@/utils/UA.js'
export default {
+ setup() {
+ const { lastRouteInfo } = storeToRefs(useLoginStore())
+ return { lastRouteInfo }
+ },
data() {
return {
+ loginType: '', //mobilePhone銆亀eixin
form: {
mobile: '',
code: '',
@@ -46,7 +54,14 @@
}
},
created() {
+
tokenUtils.clearTokens()
+ this.loginType = isWeixin ? 'weixin' : 'mobilePhone'
+ if (isWeixin) {
+ this.loginType = 'weixin'
+ localStorage.removeItem('weChatRedirectCount')
+ this.$router.replace({ path: '/h5/redirect' })
+ }
},
computed: {
appId() {
@@ -79,7 +94,7 @@
const data = {
captchaVerification: '',
mobile: this.form.mobile,
- scene: 21,
+ scene: 31,
}
this.sendCodeLoading = true
this.$axios.post('/system/auth/send-sms-code', data).then(res => {
@@ -104,20 +119,18 @@
if (res.data.code == 0) {
const resData = res.data.data
tokenUtils.setTokens(resData.accessToken, resData.refreshToken)
- this.$router.replace({ path: '/h5/verify', query: { appId: this.appId } })
+ this.$message.success('鐧诲綍鎴愬姛')
+ const path = localStorage.getItem('verify_url')
+ if (path) {
+ this.$router.replace(path)
+ }
} else {
- this.$message.error(res.data.msg)
+ this.$message.error(res.data.msg || '鐧诲綍澶辫触')
}
}).finally(() => {
this.loginLoading = false
})
},
- verify() {
- this.$router.push('/h5/verify')
- },
- signup() {
- this.$router.push('/h5/signup')
- }
}
}
</script>
--
Gitblit v1.8.0