Commit eaed5c4b by wangzhihui

fixed

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