Commit 328da2b2 authored by verestrasz's avatar verestrasz

update

parent 4aa5bae5
......@@ -50,14 +50,21 @@ export default {
// 拿着code去获取openId
// console.log(window.location)
// 清除code 防止转发自动添加code
// window.location.search=""
// window.location.search=window.location.search+"&isUse=1"
if(!localStorage.getItem('openId')) {
this.$api({
apiName: 'getWxOpenId',
postData: {code:this.code},
success: (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 {
requireAuth = true,
isUpload = false,
onUploadProgress,
header={}
header={},
errorMsg = true
} = config
if (!type || !this.httpMap[type]) {
......@@ -126,7 +127,7 @@ class MFetch {
} else {
let alertServerErrMsg = this.alertServerErrMsg
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 => {
......
......@@ -4,7 +4,7 @@ const SUCCESS_CODE = '00000'
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
if(SUCCESS_CODE === code){
success(data)
......@@ -12,8 +12,10 @@ function apiVerify ({res, success, error, alertServerErrMsg, clearAdminInfo}){
} else if(TOKEN_ERR_CODE === code){
} else {
error && error(res.data)
if (errorMsg) {
alertServerErrMsg(msg)
error && error()
}
}
}
......
......@@ -19,6 +19,7 @@ export const submitPay = {
// 获取openId
export const getWxOpenId = {
url: '/wxpay/without/getOpenId',
errorMsg:false,
dealReqData: ( {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