|
@@ -44,20 +44,18 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <v-snackbar v-model="tips.show" :color="tips.color" :timeout="1500" location="top">{{ tips.text }}</v-snackbar>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { ref, reactive } from 'vue'
|
|
|
|
|
|
+import { ref } from 'vue'
|
|
import passwordFrom from './components/passwordPage.vue'
|
|
import passwordFrom from './components/passwordPage.vue'
|
|
import phoneFrom from '@/components/VerificationCode'
|
|
import phoneFrom from '@/components/VerificationCode'
|
|
import qrCode from './components/qrCode.vue'
|
|
import qrCode from './components/qrCode.vue'
|
|
|
|
|
|
import { userLocaleStore } from '@/store/user'
|
|
import { userLocaleStore } from '@/store/user'
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
-// import Confirm from '@/plugins/confirm'
|
|
|
|
-// import Snackbar from '@/plugins/snackbar'
|
|
|
|
|
|
+import Snackbar from '@/plugins/snackbar'
|
|
defineOptions({ name: 'login-index' })
|
|
defineOptions({ name: 'login-index' })
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
@@ -76,11 +74,6 @@ const phoneRef = ref()
|
|
const passRef = ref()
|
|
const passRef = ref()
|
|
const loginLoading = ref(false)
|
|
const loginLoading = ref(false)
|
|
const userStore = userLocaleStore()
|
|
const userStore = userLocaleStore()
|
|
-const tips = reactive({
|
|
|
|
- show: false,
|
|
|
|
- color: '',
|
|
|
|
- text: ''
|
|
|
|
-})
|
|
|
|
const handleLogin = async () => {
|
|
const handleLogin = async () => {
|
|
const { valid } = tab.value === 1 ? await phoneRef.value.phoneForm.validate() : await passRef.value.passwordForm.validate()
|
|
const { valid } = tab.value === 1 ? await phoneRef.value.phoneForm.validate() : await passRef.value.passwordForm.validate()
|
|
if (!valid) return
|
|
if (!valid) return
|
|
@@ -91,13 +84,10 @@ const handleLogin = async () => {
|
|
} else {
|
|
} else {
|
|
await userStore.handlePasswordLogin(passRef.value.loginData)
|
|
await userStore.handlePasswordLogin(passRef.value.loginData)
|
|
}
|
|
}
|
|
- tips.color = 'success'
|
|
|
|
- tips.text = '登录成功'
|
|
|
|
- tips.show = true
|
|
|
|
|
|
+ Snackbar.success('登录成功')
|
|
router.push({ path: '/home' })
|
|
router.push({ path: '/home' })
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.log(error, 'error-login')
|
|
|
|
- alert(error.msg)
|
|
|
|
|
|
+ Snackbar.error(error.msg)
|
|
} finally {
|
|
} finally {
|
|
loginLoading.value = false
|
|
loginLoading.value = false
|
|
}
|
|
}
|