前后端联调测试第一个ts接口

This commit is contained in:
Guwan 2024-12-06 22:25:40 +08:00
parent 2f51cc4641
commit 2db10bf25b
5 changed files with 189 additions and 29 deletions

View File

@ -1 +1 @@
VITE_API_BASE_URL=http://localhost:8080/api VITE_API_BASE_URL=http://localhost:8084/api

152
package-lock.json generated
View File

@ -11,6 +11,7 @@
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@types/video.js": "^7.3.56", "@types/video.js": "^7.3.56",
"axios": "^1.6.7",
"echarts": "^5.5.1", "echarts": "^5.5.1",
"element-plus": "^2.8.8", "element-plus": "^2.8.8",
"pinia": "^2.1.7", "pinia": "^2.1.7",
@ -1424,6 +1425,11 @@
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz", "resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz",
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==" "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/available-typed-arrays": { "node_modules/available-typed-arrays": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@ -1439,6 +1445,16 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/axios": {
"version": "1.7.9",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
@ -1534,6 +1550,17 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/computeds": { "node_modules/computeds": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmmirror.com/computeds/-/computeds-0.0.1.tgz", "resolved": "https://registry.npmmirror.com/computeds/-/computeds-0.0.1.tgz",
@ -1696,6 +1723,14 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/dir-glob": { "node_modules/dir-glob": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz", "resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz",
@ -2317,6 +2352,25 @@
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true "dev": true
}, },
"node_modules/follow-redirects": {
"version": "1.15.9",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-each": { "node_modules/for-each": {
"version": "0.3.3", "version": "0.3.3",
"resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.3.tgz", "resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.3.tgz",
@ -2326,6 +2380,19 @@
"is-callable": "^1.1.3" "is-callable": "^1.1.3"
} }
}, },
"node_modules/form-data": {
"version": "4.0.1",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.1.tgz",
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -3164,6 +3231,25 @@
"node": ">=8.6" "node": ">=8.6"
} }
}, },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/min-document": { "node_modules/min-document": {
"version": "2.19.0", "version": "2.19.0",
"resolved": "https://registry.npmmirror.com/min-document/-/min-document-2.19.0.tgz", "resolved": "https://registry.npmmirror.com/min-document/-/min-document-2.19.0.tgz",
@ -3841,6 +3927,11 @@
"node": ">= 0.6.0" "node": ">= 0.6.0"
} }
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz",
@ -5751,6 +5842,11 @@
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz", "resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz",
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==" "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
}, },
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"available-typed-arrays": { "available-typed-arrays": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@ -5760,6 +5856,16 @@
"possible-typed-array-names": "^1.0.0" "possible-typed-array-names": "^1.0.0"
} }
}, },
"axios": {
"version": "1.7.9",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"requires": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
@ -5834,6 +5940,14 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true "dev": true
}, },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"computeds": { "computeds": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmmirror.com/computeds/-/computeds-0.0.1.tgz", "resolved": "https://registry.npmmirror.com/computeds/-/computeds-0.0.1.tgz",
@ -5949,6 +6063,11 @@
"object-keys": "^1.1.1" "object-keys": "^1.1.1"
} }
}, },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"dir-glob": { "dir-glob": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz", "resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz",
@ -6429,6 +6548,11 @@
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true "dev": true
}, },
"follow-redirects": {
"version": "1.15.9",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="
},
"for-each": { "for-each": {
"version": "0.3.3", "version": "0.3.3",
"resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.3.tgz", "resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.3.tgz",
@ -6438,6 +6562,16 @@
"is-callable": "^1.1.3" "is-callable": "^1.1.3"
} }
}, },
"form-data": {
"version": "4.0.1",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.1.tgz",
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -7040,6 +7174,19 @@
"picomatch": "^2.3.1" "picomatch": "^2.3.1"
} }
}, },
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": {
"mime-db": "1.52.0"
}
},
"min-document": { "min-document": {
"version": "2.19.0", "version": "2.19.0",
"resolved": "https://registry.npmmirror.com/min-document/-/min-document-2.19.0.tgz", "resolved": "https://registry.npmmirror.com/min-document/-/min-document-2.19.0.tgz",
@ -7503,6 +7650,11 @@
"resolved": "https://registry.npmmirror.com/process/-/process-0.11.10.tgz", "resolved": "https://registry.npmmirror.com/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
}, },
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"punycode": { "punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz",

View File

@ -67,7 +67,12 @@ export const userApi = {
// 发送验证码 // 发送验证码
sendVerifyCode(phone: string) { sendVerifyCode(phone: string) {
return request.post<ApiResponse<void>>('/auth/send-code', { phone }) return request.post<ApiResponse<void>>('/user/getEmailCode', { phone })
},
// 发送验证码
sendVerifyEmailCode(email: string) {
return request.post<ApiResponse<void>>('/user/getEmailCode', { email })
}, },
// 获取当前登录用户信息 // 获取当前登录用户信息

View File

@ -154,16 +154,16 @@ const router = createRouter({
// 修改路由守卫 // 修改路由守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const isAuthenticated = localStorage.getItem('token') const isAuthenticated = localStorage.getItem('token')
// 认证页面列表 // 认证页面列表
const authPages = ['/login', '/register', '/forgot-password'] const authPages = ['/login', '/register', '/forgot-password']
// 如果是认证页面且已登录,跳转到首页 // 如果是认证页面且已登录,跳转到首页
if (authPages.includes(to.path) && isAuthenticated) { if (authPages.includes(to.path) && isAuthenticated) {
next('/') next('/')
return return
} }
// 如果需要认证且未登录,跳转到登录页 // 如果需要认证且未登录,跳转到登录页
if (to.meta.requiresAuth && !isAuthenticated) { if (to.meta.requiresAuth && !isAuthenticated) {
next({ next({
@ -172,7 +172,7 @@ router.beforeEach((to, from, next) => {
}) })
return return
} }
next() next()
}) })

View File

@ -6,7 +6,7 @@
<div class="circle"></div> <div class="circle"></div>
</div> </div>
</div> </div>
<div class="login-content"> <div class="login-content">
<div class="login-header"> <div class="login-header">
<div class="logo-wrapper"> <div class="logo-wrapper">
@ -15,7 +15,7 @@
<h2>智慧养老服务平台</h2> <h2>智慧养老服务平台</h2>
<p class="subtitle">让生活更智慧让关爱更便捷</p> <p class="subtitle">让生活更智慧让关爱更便捷</p>
</div> </div>
<el-card class="login-card"> <el-card class="login-card">
<template #header> <template #header>
<el-tabs v-model="activeTab" class="login-tabs"> <el-tabs v-model="activeTab" class="login-tabs">
@ -34,7 +34,7 @@
class="custom-input" class="custom-input"
/> />
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input
v-model="accountForm.password" v-model="accountForm.password"
@ -63,7 +63,7 @@
:prefix-icon="Phone" :prefix-icon="Phone"
class="custom-input" class="custom-input"
/> />
<el-button <el-button
type="primary" type="primary"
:disabled="phoneCooldown > 0" :disabled="phoneCooldown > 0"
@click="sendPhoneCode" @click="sendPhoneCode"
@ -72,7 +72,7 @@
</el-button> </el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <el-form-item prop="code">
<el-input <el-input
v-model="phoneForm.code" v-model="phoneForm.code"
@ -99,7 +99,7 @@
:prefix-icon="Message" :prefix-icon="Message"
class="custom-input" class="custom-input"
/> />
<el-button <el-button
type="primary" type="primary"
:disabled="emailCooldown > 0" :disabled="emailCooldown > 0"
@click="sendEmailCode" @click="sendEmailCode"
@ -108,7 +108,7 @@
</el-button> </el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <el-form-item prop="code">
<el-input <el-input
v-model="emailForm.code" v-model="emailForm.code"
@ -123,7 +123,7 @@
<el-tab-pane label="刷脸登录" name="face"> <el-tab-pane label="刷脸登录" name="face">
<div class="face-login"> <div class="face-login">
<div class="camera-container"> <div class="camera-container">
<video <video
ref="videoRef" ref="videoRef"
class="camera-view" class="camera-view"
:class="{ 'scanning': isScanning }" :class="{ 'scanning': isScanning }"
@ -138,8 +138,8 @@
</div> </div>
</div> </div>
<div class="camera-controls"> <div class="camera-controls">
<el-button <el-button
type="primary" type="primary"
:loading="isScanning" :loading="isScanning"
@click="startFaceLogin" @click="startFaceLogin"
> >
@ -159,7 +159,7 @@
<el-checkbox v-model="rememberMe">记住我</el-checkbox> <el-checkbox v-model="rememberMe">记住我</el-checkbox>
<el-link type="primary" :underline="false" @click="forgotPassword">忘记密码</el-link> <el-link type="primary" :underline="false" @click="forgotPassword">忘记密码</el-link>
</div> </div>
<el-button <el-button
type="primary" type="primary"
class="login-button" class="login-button"
@ -168,13 +168,13 @@
> >
{{ loading ? '登录中...' : '登录' }} {{ loading ? '登录中...' : '登录' }}
</el-button> </el-button>
<div class="register-link"> <div class="register-link">
还没有账号 还没有账号
<router-link to="/register" class="register-btn">立即注册</router-link> <router-link to="/register" class="register-btn">立即注册</router-link>
</div> </div>
</el-card> </el-card>
<div class="footer"> <div class="footer">
<p>© 2024 智慧养老服务平台 All Rights Reserved</p> <p>© 2024 智慧养老服务平台 All Rights Reserved</p>
</div> </div>
@ -188,6 +188,8 @@ import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { User, Lock, Phone, Message, Key, Avatar } from '@element-plus/icons-vue' import { User, Lock, Phone, Message, Key, Avatar } from '@element-plus/icons-vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { userApi } from '@/api/user'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@ -277,7 +279,8 @@ const sendEmailCode = async () => {
ElMessage.warning('请先输入邮箱') ElMessage.warning('请先输入邮箱')
return return
} }
// TODO: API console.log(111)
await userApi.sendVerifyEmailCode(emailForm.email)
ElMessage.success('验证码已发送') ElMessage.success('验证码已发送')
startCooldown('email') startCooldown('email')
} }
@ -310,16 +313,16 @@ const handleLogin = async () => {
try { try {
// TODO: API // TODO: API
await new Promise(resolve => setTimeout(resolve, 1000)) await new Promise(resolve => setTimeout(resolve, 1000))
// token // token
localStorage.setItem('token', 'dummy-token') localStorage.setItem('token', 'dummy-token')
if (rememberMe.value) { if (rememberMe.value) {
localStorage.setItem('loginType', activeTab.value) localStorage.setItem('loginType', activeTab.value)
localStorage.setItem('loginData', JSON.stringify(formData)) localStorage.setItem('loginData', JSON.stringify(formData))
} }
ElMessage.success('登录成功') ElMessage.success('登录成功')
// //
const redirect = route.query.redirect as string const redirect = route.query.redirect as string
router.push(redirect || '/') router.push(redirect || '/')
@ -368,12 +371,12 @@ const startFaceLogin = async () => {
await initCamera() await initCamera()
return return
} }
isScanning.value = true isScanning.value = true
try { try {
// TODO: API // TODO: API
await new Promise(resolve => setTimeout(resolve, 2000)) await new Promise(resolve => setTimeout(resolve, 2000))
// //
ElMessage.success('人脸识别成功') ElMessage.success('人脸识别成功')
localStorage.setItem('token', 'dummy-token') localStorage.setItem('token', 'dummy-token')
@ -598,15 +601,15 @@ onUnmounted(() => {
.login-content { .login-content {
padding: 15px; padding: 15px;
} }
.login-header h2 { .login-header h2 {
font-size: 24px; font-size: 24px;
} }
.subtitle { .subtitle {
font-size: 14px; font-size: 14px;
} }
.logo-wrapper { .logo-wrapper {
width: 80px; width: 80px;
height: 80px; height: 80px;
@ -754,4 +757,4 @@ onUnmounted(() => {
opacity: 0.8; opacity: 0.8;
} }
} }
</style> </style>