xuxueyang
2024-09-11 999c2811465079edb5f1337ab593f93a5915d525
update 禁用用户问题
已修改1个文件
35 ■■■■■ 文件已修改
plugins/http.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
plugins/http.js
@@ -52,7 +52,7 @@
                dataType: options.dataType ? options.dataType : 'json',
                data: options.data || null,
                header,
                success: (res) => {
                success: async (res) => {
                    if (!options.ignore) {
                        message.hideLoading()
                    }
@@ -87,13 +87,13 @@
                                    validmsg = res.data.msg
                                    message.showToast(res.data.data)
                                }
                                if(validmsg){
                                if (validmsg) {
                                    //兼容安卓手机提醒过快问题
                                    setTimeout(() => {
                                        message.showToast(validmsg)
                                    }, 200)
                                }
                                reject({
@@ -107,13 +107,10 @@
                            } else if (res.data.code === '401' || res.data && res.data.code &&
                                res.data.code.startsWith('401')) {
                                console.log('resp', res)
                                // storage.removeItem('token')
                                await store.dispatch('logout')
                                message.showToast('登录信息失效')
                                storage.removeItem('token')
                                reject({
                                    data: null,
                                    code: 401,
                                    msg: 'Unauthorized'
                                })
                                // #ifdef PUB_CUSTOMER
                                uni.reLaunch({
                                    url: '/pages/user/supplier-user'
@@ -124,6 +121,11 @@
                                    url: '/pages/login/supplier-login'
                                })
                                // #endif
                                reject({
                                    data: null,
                                    code: 401,
                                    msg: 'Unauthorized'
                                })
                            } else {
                                if (res.data.data && typeof res.data.data === 'string') {
@@ -148,13 +150,11 @@
                        // commit('updat')
                        // store.commit('updateLogin', false)
                        console.log('401', res)
                        message.showToast('登录信息失效')
                        storage.removeItem('token')
                        reject({
                            data: null,
                            code: 401,
                            msg: 'Unauthorized'
                        })
                        await store.dispatch('logout')
                        message.showToast('登录信息失效')
                        // #ifdef PUB_CUSTOMER
                        uni.reLaunch({
                            url: '/pages/user/supplier-user'
@@ -165,6 +165,11 @@
                            url: '/pages/login/supplier-login'
                        })
                        // #endif
                        reject({
                            data: null,
                            code: 401,
                            msg: 'Unauthorized'
                        })
                    } else if (res.statusCode === 403) {
                        message.showToast('请求被拒绝')