ll
liukangdong
2024-12-27 7df781c76f651d21cac02bcdae7f7b3f9e41e275
h5/utils/service.js
@@ -18,7 +18,7 @@
            method: options.method || 'GET',
            header: options.header || {
               // 根据实际接口设计 key 取 token 或者 authorization
               dm_user_token: token,
               dm_user_token: token || '',
               "content-type": 'application/json'
            },
            success: (res) => {
@@ -34,11 +34,13 @@
                        duration: 2000
                     })
                  })
               }
               if (data.code === 5112) {
                  uni.navigateTo({
                     url: '/pages/staffLogin/login'
                  })
                  if (data.code === 500 || data.code === 5112) {
                     uni.clearStorageSync()
                     return uni.navigateTo({
                        url: '/pages/login/login'
                     })
                  }
                  return resolve(data)
               }
               resolve(data)
               // return response.data
@@ -46,7 +48,8 @@
            fail: (err) => {
               // 页面中弹框显示失败
               uni.showToast({
                  title: '请求接口失败'
                  title: '请求接口失败',
                  icon:"none"
               })
               // 返回错误消息