diff --git a/src/api/user.js b/src/api/user.js index f3f71f5..22aafa0 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -37,8 +37,8 @@ export function getAuthMenu(token) { export function getMsg(param) { return request({ url: '/api/admin/auth/send-sms', - method: 'get', - params:param, + method: 'post', + data: param, isLoading: false }) } @@ -46,8 +46,8 @@ export function getMsg(param) { export function loginMsg(param) { return request({ url: '/api/admin/auth/sms-login', - method: 'get', - params:param, + method: 'post', + data: param, isLoading: false }) } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index d269186..b91e85b 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,14 +76,16 @@ const actions = { loginMsg({ commit }, userInfo) { - const { - mobile, - code + const { + mobile, + code, + challenge_id } = userInfo return new Promise((resolve, reject) => { loginMsg({ - mobile: mobile, - code: code + mobile: mobile, + code: code, + challenge_id: challenge_id }).then(response => { console.log(response) const { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index a17ec28..74d590c 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -96,9 +96,12 @@ hasSend: false, count: 60, sendTimer: null, - loginForm: { - username: '', - password: '' + loginForm: { + username: '', + password: '', + mobile: '', + code: '', + challenge_id: '' }, loginRules: { username: [{ @@ -168,7 +171,8 @@ getMsg({ mobile: this.loginForm.mobile }).then(res => { - this.base.showMessage("发送成功",'success') + this.base.showMessage("发送成功",'success') + this.loginForm.challenge_id = res.challenge_id // this.$Message.success('发送成功') // 短信发送后 60s this.hasSend = true @@ -194,6 +198,10 @@ this.base.showMessage("请输入验证码",'error') return } + if (this.base.isNull(this.loginForm.challenge_id)) { + this.base.showMessage("请先获取验证码",'error') + return + } this.loading = true let that = this this.$store.dispatch('user/loginMsg', this.loginForm).then(() => { diff --git a/vue.config.js b/vue.config.js index 04f5077..c6d3ff5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -32,7 +32,7 @@ module.exports = { // outputDir: '/Users/mac/Documents/朗业/2024/s-苏州科技商学院/wx.sstbc.com/public/admin', // 测试 // outputDir: '/Users/mac/Documents/朗业/2025/s-苏州科技商学院/wx.sstbc.com/public/admin', - outputDir: '/Users/mac/Documents/朗业/2026/s-苏州科技商学院/code/wx.sstbc.com/public/admin', + outputDir: '../backend/public/admin', assetsDir: 'static', css: { loaderOptions: { // 向 CSS 相关的 loader 传递选项