소스 검색

请求地址

Xiao_123 1 년 전
부모
커밋
4af801ee49
2개의 변경된 파일5개의 추가작업 그리고 15개의 파일을 삭제
  1. 1 1
      src/config/axios/config.js
  2. 4 14
      src/views/login/index.vue

+ 1 - 1
src/config/axios/config.js

@@ -2,7 +2,7 @@ const config = {
   /**
    * api请求基础路径
    */
-  base_url: import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL,
+  base_url: import.meta.env.VITE_BASE_URL,
   /**
    * 接口成功返回状态码
    */

+ 4 - 14
src/views/login/index.vue

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