lifanagju_citu 11 månader sedan
förälder
incheckning
77004eff58
5 ändrade filer med 34 tillägg och 11 borttagningar
  1. 1 1
      components.d.ts
  2. 17 0
      src/api/common/index.js
  3. 2 2
      src/layout/personal/navBar.vue
  4. 5 3
      src/store/user.js
  5. 9 5
      src/views/login/index.vue

+ 1 - 1
components.d.ts

@@ -20,7 +20,7 @@ declare module 'vue' {
     CtPagination: typeof import('./src/components/CtPagination/index.vue')['default']
     CtSearch: typeof import('./src/components/CtSearch/index.vue')['default']
     CtTextField: typeof import('./src/components/CtVuetify/CtTextField/index.vue')['default']
-    DatePicker: typeof import('./src/components/FormUI/datePicker/index.vue')['default']
+    DatePicker: typeof import('./src/components/DatePicker/index.vue')['default']
     Details: typeof import('./src/components/Enterprise/details.vue')['default']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']

+ 17 - 0
src/api/common/index.js

@@ -8,6 +8,23 @@ export const sendSmsCode = async (data) => {
   })
 }
 
+// 企业-验证码登录
+export const smsLoginOfEnterprise = async (data) => {
+  return await request.post({
+    url: '/app-api/menduner/system/auth/sms-login',
+    data
+  })
+}
+
+
+// 企业-密码登录
+export const passwordLoginOfEnterprise = async (data) => {
+  return await request.post({
+    url: '/app-api/menduner/system/auth/login',
+    data
+  })
+}
+
 // 验证码登录
 export const smsLogin = async (data) => {
   return await request.post({

+ 2 - 2
src/layout/personal/navBar.vue

@@ -148,10 +148,10 @@ const handleToPersonalCenter = () => {
 }
 
 // 退出登录
-const handleLogout = async (index) => {
+const handleLogout = async (num = 0) => {
   // try {
     await userStore.userLogout()
-    if (index) router.push({ name: 'login', query: { loginType: index } })
+    if (num === 330) router.push({ name: 'login', query: { loginType: num } })
     else router.push({ path: '/login' })
   // } catch (error) {
   //   console.log(error, 'error')

+ 5 - 3
src/store/user.js

@@ -1,7 +1,7 @@
 import { defineStore } from 'pinia'
 import { reactive } from 'vue'
 import { setToken, removeToken } from '@/utils/auth'
-import { smsLogin, passwordLogin, getBaseInfo } from '@/api/common/index'
+import { smsLogin, passwordLogin, smsLoginOfEnterprise, passwordLoginOfEnterprise, getBaseInfo } from '@/api/common/index'
 import { logout } from '@/api/common/index'
 import { getUserInfo } from '@/api/personal/user'
 import Snackbar from '@/plugins/snackbar'
@@ -18,7 +18,8 @@ export const useUserStore = defineStore('user',
     // 短信登录
     const handleSmsLogin = async (data) => {
       return new Promise((resolve, reject) => {
-        smsLogin(data).then(res => {
+        const loginApi = data.type === 330 ? smsLoginOfEnterprise : smsLogin
+        loginApi(data).then(res => {
           console.log(res, 'login-phone')
           setToken(res.accessToken)
           accountInfo = res
@@ -34,7 +35,8 @@ export const useUserStore = defineStore('user',
     // 密码登录
     const handlePasswordLogin = async (data) => {
       return new Promise((resolve, reject) => {
-        passwordLogin(data).then(res => {
+        const loginApi = data.type === 330 ? passwordLoginOfEnterprise : passwordLogin
+        loginApi(data).then(res => {
           console.log(res, 'login-password')
           setToken(res.accessToken)
           accountInfo = res

+ 9 - 5
src/views/login/index.vue

@@ -82,10 +82,11 @@ const handleLogin = async () => {
   if (!valid) return
   loginLoading.value = true
   try {
+    const type = loginType.value
     if (tab.value === 1) {
-      await userStore.handleSmsLogin(phoneRef.value.loginData)
+      await userStore.handleSmsLogin({ ...phoneRef.value.loginData, type })
     } else {
-      await userStore.handlePasswordLogin(passRef.value.loginData)
+      await userStore.handlePasswordLogin({ ...passRef.value.loginData, type })
     }
     Snackbar.success('登录成功')
     router.push({ path: '/home' })
@@ -107,11 +108,14 @@ const handlePrivacyPolicy = () => {
 <style lang="scss" scoped>
 .loginType {
   position: absolute;
-  right: 65px;
+  top: 10px;
+  right: 0;
+  // width: 100%;
   color: #fff;
-  padding: 2px 12px;
-  border-radius: 8px;
+  padding: 10px 30px;
+  border-radius: 8px 0 0 8px;
   background-color: #ffba5d;
+  font-size: 16px;
 }
 .login-box {
   position: relative;