Commit c8f885be by 潘琦

去掉链接中#号,解决部分手机重定向鉴权白板问题;

parent 17b44a31
...@@ -15,15 +15,13 @@ router.beforeEach((to, from, next) => { ...@@ -15,15 +15,13 @@ router.beforeEach((to, from, next) => {
let storecode = store.getters.code let storecode = store.getters.code
if (!storecode || storecode === '') { if (!storecode || storecode === '') {
let params = getParamsByUrl(window.location.href) let params = getParamsByUrl(window.location.href)
if (params.code) { if (params.code && params.code !== 'undefined') {
store.dispatch('setCode', params.code) store.dispatch('setCode', params.code)
getOauthFn(() => { getOauthFn(() => {
next() next()
}) })
} else { } else {
getWXOauth(() => { getWXOauth()
next()
})
} }
} else { } else {
next() next()
...@@ -57,7 +55,7 @@ router.beforeEach((to, from, next) => { ...@@ -57,7 +55,7 @@ router.beforeEach((to, from, next) => {
// store.dispatch('setToken', '490cd9b7-dca7-4cc3-87e9-5eacbb5a5d77') // store.dispatch('setToken', '490cd9b7-dca7-4cc3-87e9-5eacbb5a5d77')
}) })
let getWXOauth = (callback) => { let getWXOauth = () => {
let url = removeUrlParam('code') let url = removeUrlParam('code')
// store.dispatch('setCode', '') // store.dispatch('setCode', '')
let authId = '' let authId = ''
...@@ -65,13 +63,8 @@ let getWXOauth = (callback) => { ...@@ -65,13 +63,8 @@ let getWXOauth = (callback) => {
authId = '&auth_id=' + getParamsByUrl(window.location.href).auth_id authId = '&auth_id=' + getParamsByUrl(window.location.href).auth_id
store.dispatch('setAuthId', getParamsByUrl(window.location.href).auth_id) store.dispatch('setAuthId', getParamsByUrl(window.location.href).auth_id)
} }
// window.location.reload(defaultUrl + '/wxoauth/route?redirect_uri=' + encodeURIComponent(url) + authId + '&auth_scene=voucher&v=' + timeStamp)
window.location.href = defaultUrl + '/wxoauth/route?redirect_uri=' + encodeURIComponent(url) + authId + '&auth_scene=voucher' window.location.href = defaultUrl + '/wxoauth/route?redirect_uri=' + encodeURIComponent(url) + authId + '&auth_scene=voucher'
const u = navigator.userAgent
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 // g
// const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // ios终端
if (isAndroid) {
callback()
}
} }
let getOauthFn = (callback) => { let getOauthFn = (callback) => {
......
...@@ -4,6 +4,8 @@ import Router from 'vue-router' ...@@ -4,6 +4,8 @@ import Router from 'vue-router'
Vue.use(Router) Vue.use(Router)
export default new Router({ export default new Router({
mode: 'history',
base: '/voucher/',
routes: [ routes: [
{ {
path: '/', path: '/',
...@@ -145,6 +147,5 @@ export default new Router({ ...@@ -145,6 +147,5 @@ export default new Router({
} }
] ]
} }
], ]
base: '/voucher/'
}) })
...@@ -272,6 +272,7 @@ export default { ...@@ -272,6 +272,7 @@ export default {
getTipsByVoucherId(this.voucherId).then(res => { getTipsByVoucherId(this.voucherId).then(res => {
this.$Indicator.close() this.$Indicator.close()
if (res && res.msg === 'success') { if (res && res.msg === 'success') {
if (res.data) {
this.tipsPopupVisible = true this.tipsPopupVisible = true
this.tipsData = res.data this.tipsData = res.data
this.tipsData.tipsDetailed = this.tipsData.tipsDetailed.replace(/[\r\n]/g, '<br>') this.tipsData.tipsDetailed = this.tipsData.tipsDetailed.replace(/[\r\n]/g, '<br>')
...@@ -282,6 +283,13 @@ export default { ...@@ -282,6 +283,13 @@ export default {
duration: 3000 duration: 3000
}) })
} }
} else {
this.$toast({
message: '该服务券还没有小贴士噢!',
position: 'center',
duration: 3000
})
}
}).catch((error) => { }).catch((error) => {
console.log(error.message) console.log(error.message)
this.$toast({ this.$toast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment