mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-23 23:53:55 +08:00
优化登录注册流程,跑通注册登录、接口
This commit is contained in:
@@ -7,9 +7,9 @@ import user from './module/user.js'
|
||||
* 如果你想调用8002端口,就用'/xiaozhi-esp32-api/api/v1',请与vue.config.js的devServer配置相结合,方便跨域请求
|
||||
*
|
||||
*/
|
||||
const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default'
|
||||
// const DEV_API_SERVICE = 'https://apifoxmock.com/m1/5931378-5618560-default'
|
||||
// 8002开发完成完成后使用这个
|
||||
// const DEV_API_SERVICE = '/xiaozhi-esp32-api/api/v1'
|
||||
const DEV_API_SERVICE = '/xiaozhi-esp32-api'
|
||||
|
||||
/**
|
||||
* 根据开发环境返回接口url
|
||||
|
||||
@@ -75,7 +75,8 @@ export default {
|
||||
form: {
|
||||
username: '',
|
||||
password: '',
|
||||
captcha: ''
|
||||
captcha: '',
|
||||
captchaId: ''
|
||||
},
|
||||
captchaUuid: '',
|
||||
captchaUrl: ''
|
||||
@@ -114,6 +115,7 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
this.form.captchaId = this.captchaUuid
|
||||
Api.user.login(this.form, ({data}) => {
|
||||
showSuccess('登陆成功!')
|
||||
goToPage('/home')
|
||||
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
captcha: '',
|
||||
uuid: ''
|
||||
captchaId: ''
|
||||
},
|
||||
captchaUrl: ''
|
||||
}
|
||||
@@ -106,8 +106,8 @@ export default {
|
||||
methods: {
|
||||
// 复用验证码获取方法
|
||||
fetchCaptcha() {
|
||||
this.form.uuid = Date.now().toString()
|
||||
Api.user.getCaptcha(this.form.uuid, (res) => {
|
||||
this.form.captchaId = Date.now().toString()
|
||||
Api.user.getCaptcha(this.form.captchaId, (res) => {
|
||||
if (res.status === 200) {
|
||||
const blob = new Blob([res.data], {type: res.data.type});
|
||||
this.captchaUrl = URL.createObjectURL(blob);
|
||||
|
||||
Reference in New Issue
Block a user