|
|
@@ -21,7 +21,9 @@
|
|
|
<script setup>
|
|
|
import DarkMode from '@/components/DarkMode.vue'
|
|
|
import Account from '@/domain/account'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
import { inject } from 'vue'
|
|
|
+import { onBeforeRouteLeave } from 'vue-router'
|
|
|
|
|
|
const http = inject('http')
|
|
|
|
|
|
@@ -31,10 +33,19 @@ const account2 = new Account('17601545948', '123456')
|
|
|
account2.login()
|
|
|
|
|
|
const init = async () => {
|
|
|
- await http.login('15077886171', 'x1ongDrew')
|
|
|
- await http.get('/user/my')
|
|
|
+ try {
|
|
|
+ await http.login('150778861711', 'x1ongDrew')
|
|
|
+ await http.get('/user/my')
|
|
|
+ } catch (e) {
|
|
|
+ ElMessage.error(e.error || '登录失败')
|
|
|
+ }
|
|
|
}
|
|
|
init()
|
|
|
+
|
|
|
+const timer = setInterval(() => {}, 3000)
|
|
|
+onBeforeRouteLeave(() => {
|
|
|
+ clearInterval(timer)
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|