From 0d626ae57149d5ed40a32bd8b808ca6069aa6d5e Mon Sep 17 00:00:00 2001 From: gaosp <gaosp> Date: 星期日, 14 一月 2024 16:35:08 +0800 Subject: [PATCH] update --- src/store/modules/user.js | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 70c6499..865590e 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -60,7 +60,6 @@ actions: { // 鐧诲綍 Login({ commit, store }, userInfo) { - debugger const username = userInfo.username.trim() return new Promise((resolve, reject) => { login(username, userInfo.password).then(response => { @@ -88,10 +87,10 @@ if (data.result === 'SUCCESS') { commit('SET_USER_INFO',data.data) this.dispatch('GetPlanList') - resolve({ code: 1, data: data }) + resolve({ code: 1, result: 'SUCCESS',data: data }) }else { removeToken() - resolve({ code: 0, msg: '鐢变簬鎮ㄩ暱鏃堕棿娌℃湁鎿嶄綔锛岃閲嶆柊鐧诲綍锛�' }) + resolve({ code: 0,result: 'SUCCESS', msg: '鐢变簬鎮ㄩ暱鏃堕棿娌℃湁鎿嶄綔锛岃閲嶆柊鐧诲綍锛�' }) } }).catch(() => { removeToken() @@ -101,11 +100,16 @@ }) }, GetPlanList ({ commit, store }) { - return getPlanList().then(data => { - if (data.result === 'SUCCESS') { - commit('SET_WORKSHOP_LIST', data.data || []) - } - return data + return new Promise((resolve,reject) => { + getPlanList().then(data => { + if (data.result === 'SUCCESS') { + commit('SET_WORKSHOP_LIST', data.data || []) + resolve({ code: 1,result: 'SUCCESS',data: data }) + } + }) + .catch(() => { + reject(error) + }) }) }, // 鐧诲嚭 -- Gitblit v1.9.3