Commit eaed5c4b by wangzhihui

fixed

1 parent 1551b877
...@@ -56,6 +56,7 @@ async function handleWwLogin({ commit }) { ...@@ -56,6 +56,7 @@ async function handleWwLogin({ commit }) {
if (userInfo && userInfo.timestamp) { if (userInfo && userInfo.timestamp) {
if (Date.now() - userInfo.timestamp <= 1000 * 60 * 1440) { if (Date.now() - userInfo.timestamp <= 1000 * 60 * 1440) {
if (userInfo.phone) util.setLocalStorage('ww_params_phone', userInfo.phone)
commit('SET_AUTHORIZE_PAGE', true) commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true) commit('SET_SHOW_WINDOW', true)
return return
...@@ -66,8 +67,6 @@ async function handleWwLogin({ commit }) { ...@@ -66,8 +67,6 @@ async function handleWwLogin({ commit }) {
const res = await ssoApi.login({ code: wwCode, corpId, getUserInfoFlag: false }) const res = await ssoApi.login({ code: wwCode, corpId, getUserInfoFlag: false })
const { code, data, message } = res const { code, data, message } = res
if (code == '0') { if (code == '0') {
commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true)
const hrefUrl = window.location.href const hrefUrl = window.location.href
const newUrl = hrefUrl.replace(/([?&])code=[^&]*/, (match, prefix) => (prefix === '?' ? '?' : '')) const newUrl = hrefUrl.replace(/([?&])code=[^&]*/, (match, prefix) => (prefix === '?' ? '?' : ''))
window.history.replaceState({}, '', newUrl) window.history.replaceState({}, '', newUrl)
...@@ -78,6 +77,8 @@ async function handleWwLogin({ commit }) { ...@@ -78,6 +77,8 @@ async function handleWwLogin({ commit }) {
if (loginUserInfo.phone) util.setLocalStorage('ww_params_phone', loginUserInfo.phone) if (loginUserInfo.phone) util.setLocalStorage('ww_params_phone', loginUserInfo.phone)
loginUserInfo.timestamp = Date.now() loginUserInfo.timestamp = Date.now()
util.setLocalStorage('ww_userInfo', loginUserInfo) util.setLocalStorage('ww_userInfo', loginUserInfo)
commit('SET_AUTHORIZE_PAGE', true)
commit('SET_SHOW_WINDOW', true)
return return
} }
} }
......
...@@ -118,6 +118,8 @@ export default { ...@@ -118,6 +118,8 @@ export default {
data() { data() {
return { return {
orderCode: '', orderCode: '',
phone: '',
userInfo: {},
orderInfo: {}, orderInfo: {},
showPopup: false, showPopup: false,
popupInfo: {}, popupInfo: {},
...@@ -181,9 +183,8 @@ export default { ...@@ -181,9 +183,8 @@ export default {
immediate: true, immediate: true,
handler(val) { handler(val) {
if (val && this.orderCode) { if (val && this.orderCode) {
console.log(this.phone, '$store.state.app.authorizePag')
this.loadOrderDetail(this.orderCode) this.loadOrderDetail(this.orderCode)
// this.loadStaffInfoByPhone(this.phone) this.loadStaffInfoByPhone()
} }
} }
} }
...@@ -194,16 +195,17 @@ export default { ...@@ -194,16 +195,17 @@ export default {
if (orderCode) this.setLocalStorage('ww_orderCode', orderCode) if (orderCode) this.setLocalStorage('ww_orderCode', orderCode)
// 授权回调后 URL 可能只剩 code,从缓存读取 // 授权回调后 URL 可能只剩 code,从缓存读取
this.orderCode = this.getLocalStorage('ww_orderCode') || '' this.orderCode = this.getLocalStorage('ww_orderCode') || ''
this.phone = this.getLocalStorage('ww_params_phone') || ''
console.log(this.phone, 'this.phone')
if (this.phone) {
this.loadStaffInfoByPhone(this.phone)
}
// this.loadOrderDetail(this.orderCode)
}, },
loadStaffInfoByPhone(phone) { getLoginPhone() {
orderApprovalApi.getStaffInfoByPhone({ phone }).then(res => { const phone = this.getLocalStorage('ww_params_phone')
console.log(res) if (phone) return phone
const loginUser = this.getLocalStorage('ww_userInfo') || {}
return loginUser.phone || ''
},
loadStaffInfoByPhone() {
this.phone = this.getLoginPhone()
if (!this.phone) return
orderApprovalApi.getStaffInfoByPhone({ phone: this.phone }).then(res => {
this.userInfo = res.data this.userInfo = res.data
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!