Skip to content

Commit

Permalink
fix(SPA): 修复在 hash 模式下无法微信登录的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jan 31, 2019
1 parent ecba261 commit 5b5281c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/spa/src/page/wechat/WechatSignin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default {
let accessToken = this.$lstore.getData('H5_WECHAT_MP_ASTOKEN')
if (!accessToken || !openId) {
const { data } = await this.$http.get(`socialite/getAccess/${code}`, { validateStatus: s => s === 200 })
const { data } = await this.$http.get(`/socialite/getAccess/${code}`, { validateStatus: s => s === 200 })
const { access_token: newAccessToken, openid: newOpenId } = data
accessToken = newAccessToken
openId = newOpenId
Expand Down
4 changes: 3 additions & 1 deletion resources/spa/src/util/wechat.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import api from '@/api/api'

export const signinByWechat = () => {
const redirectUrl = window.location.origin + process.env.BASE_URL + 'wechat/'
let redirectUrl = window.location.origin + process.env.BASE_URL
if (process.env.VUE_APP_ROUTER_MODE === 'hash') redirectUrl += '#/'
redirectUrl += 'wechat/'
api
.post(
'socialite/getOriginUrl',
Expand Down

0 comments on commit 5b5281c

Please sign in to comment.