xuxueyang
2024-09-13 731b3a23a6369aaef5c4fdc0ff4524eb6a7f3642
plugins/http.js
@@ -52,6 +52,7 @@
            dataType: options.dataType ? options.dataType : 'json',
            data: options.data || null,
            header,
            timeout: 30000,
            success: async (res) => {
               if (!options.ignore) {
                  message.hideLoading()
@@ -108,8 +109,10 @@
                        res.data.code.startsWith('401')) {
                        console.log('resp', res)
                        // storage.removeItem('token')
                        await store.dispatch('logout')
                        message.showToast('登录信息失效')
                        // await store.dispatch('logout')
                        store.commit('updateLogin', false)
                        await message.showToast('登录信息失效')
                        // #ifdef PUB_CUSTOMER
                        uni.reLaunch({
@@ -150,9 +153,10 @@
                  // commit('updat')
                  // store.commit('updateLogin', false)
                  console.log('401', res)
                  storage.removeItem('token')
                  await store.dispatch('logout')
                  message.showToast('登录信息失效')
                  // storage.removeItem('token')
                  // await store.dispatch('logout')
                  store.commit('updateLogin', false)
                  await message.showToast('登录信息失效')
                  // #ifdef PUB_CUSTOMER
@@ -219,6 +223,7 @@
               if (!options.ignore) {
                  message.hideLoading()
               }
               message.showToast('网络异常')
               reject({
                  data: null,
                  code: 9999,