Commit 328da2b2 authored by verestrasz's avatar verestrasz

update

parent 4aa5bae5
...@@ -50,14 +50,21 @@ export default { ...@@ -50,14 +50,21 @@ export default {
// 拿着code去获取openId // 拿着code去获取openId
// console.log(window.location) // console.log(window.location)
// 清除code 防止转发自动添加code // 清除code 防止转发自动添加code
// window.location.search="" // window.location.search=window.location.search+"&isUse=1"
if(!localStorage.getItem('openId')) { if(!localStorage.getItem('openId')) {
this.$api({ this.$api({
apiName: 'getWxOpenId', apiName: 'getWxOpenId',
postData: {code:this.code}, postData: {code:this.code},
success: (res) => { success: (res) => {
localStorage.setItem('openId',res) localStorage.setItem('openId',res)
} },
error: () => {
// console.log(error)
if(sysInfo.isWechat) {
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_base&state=1#wechat_redirect`;
}
this.code=''
},
}) })
} }
} }
......
...@@ -71,7 +71,8 @@ class MFetch { ...@@ -71,7 +71,8 @@ class MFetch {
requireAuth = true, requireAuth = true,
isUpload = false, isUpload = false,
onUploadProgress, onUploadProgress,
header={} header={},
errorMsg = true
} = config } = config
if (!type || !this.httpMap[type]) { if (!type || !this.httpMap[type]) {
...@@ -126,7 +127,7 @@ class MFetch { ...@@ -126,7 +127,7 @@ class MFetch {
} else { } else {
let alertServerErrMsg = this.alertServerErrMsg let alertServerErrMsg = this.alertServerErrMsg
let clearAdminInfo = this.clearAdminInfo let clearAdminInfo = this.clearAdminInfo
return this.verify({ res, success, error, alertServerErrMsg, clearAdminInfo, url }) return this.verify({ res, success, error, alertServerErrMsg, clearAdminInfo, url, errorMsg })
} }
}) })
.catch(e => { .catch(e => {
......
...@@ -4,7 +4,7 @@ const SUCCESS_CODE = '00000' ...@@ -4,7 +4,7 @@ const SUCCESS_CODE = '00000'
const TOKEN_ERR_CODE = '' const TOKEN_ERR_CODE = ''
function apiVerify ({res, success, error, alertServerErrMsg, clearAdminInfo}){ function apiVerify ({res, success, error, alertServerErrMsg, clearAdminInfo,errorMsg}){
let {code, data, msg} = res.data let {code, data, msg} = res.data
if(SUCCESS_CODE === code){ if(SUCCESS_CODE === code){
success(data) success(data)
...@@ -12,8 +12,10 @@ function apiVerify ({res, success, error, alertServerErrMsg, clearAdminInfo}){ ...@@ -12,8 +12,10 @@ function apiVerify ({res, success, error, alertServerErrMsg, clearAdminInfo}){
} else if(TOKEN_ERR_CODE === code){ } else if(TOKEN_ERR_CODE === code){
} else { } else {
alertServerErrMsg(msg) error && error(res.data)
error && error() if (errorMsg) {
alertServerErrMsg(msg)
}
} }
} }
......
...@@ -19,6 +19,7 @@ export const submitPay = { ...@@ -19,6 +19,7 @@ export const submitPay = {
// 获取openId // 获取openId
export const getWxOpenId = { export const getWxOpenId = {
url: '/wxpay/without/getOpenId', url: '/wxpay/without/getOpenId',
errorMsg:false,
dealReqData: ( {code}) => { dealReqData: ( {code}) => {
return {code} return {code}
} }
......
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