合并冲突

This commit is contained in:
gaoxs
2020-05-11 09:42:51 +08:00
12 changed files with 920 additions and 847 deletions

View File

@ -114,17 +114,19 @@ export const replaceLogin = (msg) => {
uni.hideLoading();
if (msg) {
uni.showToast({
title: msg,
title: '重新登录中...',
icon: 'none',
duration: 2000
});
}
// 这里代表已经失去登录状态以及401强制退出登录了
// 这里代表已经失去登录状态以及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: {
@ -176,6 +178,10 @@ export const authorize = (authorizeStr) => {
resolve('获取授权成功')
},
fail() {
switchTab({
path: '/pages/home/index',
// query
});
reject('获取授权失败')
}
})
@ -252,13 +258,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 (
@ -278,16 +285,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
// })
}
})
}

View File

@ -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) {