uniapp-提交订单时取消订单,提示错误
uniapp-购物车编辑数量后未更新数量统计 uniapp-token失效未进行重新登录 uniapp-查看物流-点标识太大 造成部分物流信息被遮挡
This commit is contained in:
@ -113,16 +113,18 @@ export const copyClipboard = (data) => {
|
||||
export const replaceLogin = (msg) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
title: '重新登录中...',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
// 这里代表已经失去登录状态以及401强制推出登录了
|
||||
store.commit('LOGOUT')
|
||||
console.log('如果是微信小程序,跳转到授权页', Vue.prototype.$deviceType, msg)
|
||||
if (Vue.prototype.$deviceType == 'routine') {
|
||||
// 如果是微信小程序,跳转到授权页
|
||||
login({
|
||||
fail: () => {
|
||||
console.log('如果是微信小程序,跳转到授权页')
|
||||
replace({
|
||||
path: '/pages/authorization/index',
|
||||
query: {
|
||||
@ -174,6 +176,10 @@ export const authorize = (authorizeStr) => {
|
||||
resolve('获取授权成功')
|
||||
},
|
||||
fail() {
|
||||
switchTab({
|
||||
path: '/pages/home/index',
|
||||
// query
|
||||
});
|
||||
reject('获取授权失败')
|
||||
}
|
||||
})
|
||||
@ -250,13 +256,14 @@ export const login = (option) => {
|
||||
|
||||
export const handleGetUserInfo = () => {
|
||||
getUser().then(res => {
|
||||
console.log('获取用户信息')
|
||||
store.dispatch('setUserInfo', res.data)
|
||||
var pages = getCurrentPages() //获取加载的页面
|
||||
|
||||
var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
||||
let url = "/pages/home/index"
|
||||
let query = {}
|
||||
|
||||
console.log('currentPage')
|
||||
if (currentPage) {
|
||||
// 获取到最后一个页面
|
||||
if (
|
||||
@ -276,16 +283,21 @@ export const handleGetUserInfo = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(url)
|
||||
if (url == '/pages/home/index' || url == '/pages/shop/GoodsClass/index' || url == '/pages/shop/ShoppingCart/index' || url == '/pages/user/User/index') {
|
||||
switchTab({
|
||||
path: `${url}`,
|
||||
query
|
||||
});
|
||||
} else {
|
||||
push({
|
||||
path: `${url}`,
|
||||
query
|
||||
})
|
||||
switchTab({
|
||||
path: '/pages/home/index',
|
||||
// query
|
||||
});
|
||||
// push({
|
||||
// path: `${url}`,
|
||||
// query
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -10,10 +10,12 @@ fly.config.baseURL = VUE_APP_API_URL
|
||||
|
||||
fly.interceptors.response.use(
|
||||
response => {
|
||||
console.log(response)
|
||||
// 定时刷新access-token
|
||||
return response;
|
||||
},
|
||||
error => {
|
||||
console.log(error)
|
||||
if (error.toString() == 'Error: Network Error') {
|
||||
toLogin();
|
||||
return Promise.reject({ msg: "未登录", toLogin: true });
|
||||
@ -47,18 +49,15 @@ function baseRequest(options) {
|
||||
// 提示错误信息
|
||||
return Promise.reject({ msg: "未登录", toLogin: true });
|
||||
}
|
||||
console.log(options)
|
||||
// 结构请求需要的参数
|
||||
const { url, params, data, login, ...option } = options
|
||||
|
||||
// 发起请求
|
||||
return fly.request(url, params || data, {
|
||||
...option
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
}).then(res => {
|
||||
const data = res.data || {};
|
||||
if (res.status !== 200) {
|
||||
|
||||
return Promise.reject({ msg: "请求失败", res, data });
|
||||
}
|
||||
if ([410000, 410001, 410002].indexOf(data.status) !== -1) {
|
||||
|
Reference in New Issue
Block a user