|
|
@ -204,17 +204,22 @@ export const authorize = (authorizeStr) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const login = () => { |
|
|
|
export const login = () => { |
|
|
|
|
|
|
|
debugger; |
|
|
|
console.log(Vue.prototype) |
|
|
|
console.log(Vue.prototype) |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (Vue.prototype.$deviceType == 'weixin') { |
|
|
|
if (Vue.prototype.$deviceType == 'weixin') { |
|
|
|
// 微信授权登录
|
|
|
|
// 微信授权登录
|
|
|
|
const { code } = parseQuery() |
|
|
|
const { code } = parseQuery() |
|
|
|
|
|
|
|
debugger; |
|
|
|
if (code) { |
|
|
|
if (code) { |
|
|
|
auth(code) |
|
|
|
auth(code) |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
// location.replace(
|
|
|
|
// location.replace(
|
|
|
|
// decodeURIComponent(decodeURIComponent(this.$route.params.url))
|
|
|
|
// decodeURIComponent(decodeURIComponent(this.$route.params.url))
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
|
|
|
|
let redirect = cookie.get('redirect') |
|
|
|
|
|
|
|
console.log(redirect) |
|
|
|
|
|
|
|
debugger; |
|
|
|
location.href = decodeURIComponent( |
|
|
|
location.href = decodeURIComponent( |
|
|
|
decodeURIComponent(this.$route.params.url) |
|
|
|
decodeURIComponent(this.$route.params.url) |
|
|
|
); |
|
|
|
); |
|
|
@ -275,7 +280,7 @@ export const login = () => { |
|
|
|
console.log('登录接口调用成功') |
|
|
|
console.log('登录接口调用成功') |
|
|
|
console.log('开始检查用户信息授权') |
|
|
|
console.log('开始检查用户信息授权') |
|
|
|
let code = loginRes.code; |
|
|
|
let code = loginRes.code; |
|
|
|
cookie.set('wxLoginCode',loginRes.code) |
|
|
|
cookie.set('wxLoginCode', loginRes.code) |
|
|
|
// 检查授权, 检查用户信息授权
|
|
|
|
// 检查授权, 检查用户信息授权
|
|
|
|
authorize('userInfo').then(() => { |
|
|
|
authorize('userInfo').then(() => { |
|
|
|
console.log('授权通过') |
|
|
|
console.log('授权通过') |
|
|
@ -857,14 +862,19 @@ export const handleLoginFailure = () => { |
|
|
|
console.log('————————') |
|
|
|
console.log('————————') |
|
|
|
|
|
|
|
|
|
|
|
store.commit("logout"); |
|
|
|
store.commit("logout"); |
|
|
|
|
|
|
|
// 改为授权取消
|
|
|
|
store.commit("updateAuthorization", false); |
|
|
|
store.commit("updateAuthorization", false); |
|
|
|
|
|
|
|
|
|
|
|
let currentPageUrl = getCurrentPageUrl() |
|
|
|
let currentPageUrl = getCurrentPageUrl() |
|
|
|
|
|
|
|
debugger |
|
|
|
if (store.state.$deviceType == 'weixin') { |
|
|
|
if (store.state.$deviceType == 'weixin') { |
|
|
|
if (store.getters.isAuthorizationPage){ |
|
|
|
// 如果不是授权页面,
|
|
|
|
|
|
|
|
if (!store.getters.isAuthorizationPage) { |
|
|
|
|
|
|
|
// 标识当前为授权页面
|
|
|
|
|
|
|
|
store.commit("updateAuthorizationPage", true); |
|
|
|
toAuth() |
|
|
|
toAuth() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// token 失效
|
|
|
|
// token 失效
|
|
|
|
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
|
|
|
|
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
|
|
|
@ -895,7 +905,7 @@ export const handleLoginFailure = () => { |
|
|
|
console.log('————————') |
|
|
|
console.log('————————') |
|
|
|
if (qrCode.pinkId) { |
|
|
|
if (qrCode.pinkId) { |
|
|
|
path = parseUrl({ |
|
|
|
path = parseUrl({ |
|
|
|
path: `/${currentPageUrl}`, |
|
|
|
path: `/ ${currentPageUrl} `, |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: qrCode.pinkId, |
|
|
|
id: qrCode.pinkId, |
|
|
|
} |
|
|
|
} |
|
|
@ -917,7 +927,7 @@ export const handleLoginFailure = () => { |
|
|
|
|
|
|
|
|
|
|
|
if (qrCode.bargainId) { |
|
|
|
if (qrCode.bargainId) { |
|
|
|
path = parseUrl({ |
|
|
|
path = parseUrl({ |
|
|
|
path: `/${currentPageUrl}`, |
|
|
|
path: `/ ${currentPageUrl} `, |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: qrCode.bargainId, |
|
|
|
id: qrCode.bargainId, |
|
|
|
partake: qrCode.uid |
|
|
|
partake: qrCode.uid |
|
|
@ -939,7 +949,7 @@ export const handleLoginFailure = () => { |
|
|
|
|
|
|
|
|
|
|
|
if (qrCode.productId) { |
|
|
|
if (qrCode.productId) { |
|
|
|
path = parseUrl({ |
|
|
|
path = parseUrl({ |
|
|
|
path: `/${currentPageUrl}`, |
|
|
|
path: `/ ${currentPageUrl} `, |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: qrCode.productId, |
|
|
|
id: qrCode.productId, |
|
|
|
} |
|
|
|
} |
|
|
@ -988,7 +998,7 @@ export function chooseImage(callback) { |
|
|
|
console.log(image); |
|
|
|
console.log(image); |
|
|
|
uni.showLoading({ title: "图片上传中", mask: true }); |
|
|
|
uni.showLoading({ title: "图片上传中", mask: true }); |
|
|
|
uni.uploadFile({ |
|
|
|
uni.uploadFile({ |
|
|
|
url: `${VUE_APP_API_URL}/api/upload`, |
|
|
|
url: `${VUE_APP_API_URL} /api/upload`, |
|
|
|
file: image, |
|
|
|
file: image, |
|
|
|
filePath: image.path, |
|
|
|
filePath: image.path, |
|
|
|
header: { |
|
|
|
header: { |
|
|
|