|
|
@ -22,7 +22,7 @@ const NODE_ENV = 'development'; |
|
|
|
// const NODE_ENV = 'production';
|
|
|
|
if(NODE_ENV == 'development'){ |
|
|
|
Vue.prototype.cssUrl = '/static/images/frontend/'; |
|
|
|
Vue.prototype.request_domain = "http://api.checkcopy.com/"; |
|
|
|
Vue.prototype.request_domain = "http://jasonyizherenxin.checkcopy.com/"; |
|
|
|
}else{ |
|
|
|
Vue.prototype.cssUrl = '/static/images/frontend/'; |
|
|
|
Vue.prototype.request_domain = "http://api.yizherenxin.cn/"; |
|
|
@ -183,8 +183,13 @@ Vue.prototype.edit_preview = 2; |
|
|
|
Vue.prototype.add_preview = 3; |
|
|
|
Vue.prototype.edit_album = 4; |
|
|
|
|
|
|
|
// function removeLogin() {
|
|
|
|
// uni.removeStorageSync('token');
|
|
|
|
// }
|
|
|
|
|
|
|
|
function removeLogin() { |
|
|
|
uni.removeStorageSync('token'); |
|
|
|
uni.removeStorageSync("token"); |
|
|
|
uni.removeStorageSync("uinfo"); |
|
|
|
} |
|
|
|
|
|
|
|
function req(url, data={}, method = 'POST', header={}) { |
|
|
@ -193,7 +198,7 @@ function req(url, data={}, method = 'POST', header={}) { |
|
|
|
data.appid = Vue.prototype.appid; |
|
|
|
data.xcx_scource = Vue.prototype.USER_SOURCE_WX_XCX; |
|
|
|
}else{ |
|
|
|
domain = '/api/user/'; |
|
|
|
domain = '/api/'; |
|
|
|
if(Vue.prototype.isMobile){ |
|
|
|
data.xcx_scource = Vue.prototype.USER_SOURCE_H5; |
|
|
|
if(Vue.prototype.env_val.indexOf('weixin') > -1) data.xcx_scource = Vue.prototype.USER_SOURCE_WX_H5; |
|
|
@ -202,17 +207,16 @@ function req(url, data={}, method = 'POST', header={}) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var getWxH5LoginConfigUri = 'common/wxh5_login' |
|
|
|
var noNeedLoginFunc = [ |
|
|
|
'client/common/mp/config', |
|
|
|
getWxH5LoginConfigUri, |
|
|
|
'client/user/login' |
|
|
|
] |
|
|
|
var isNeedLogin = !noNeedLoginFunc.includes(url); |
|
|
|
|
|
|
|
var headerObj = {'content-type': 'application/x-www-form-urlencoded'}; |
|
|
|
var token = uni.getStorageSync('token'); |
|
|
|
if(token) headerObj.Authorization = token |
|
|
|
|
|
|
|
var getWxH5LoginConfigUri = 'client/common/mp/config' |
|
|
|
if(token) headerObj.AUTH = token |
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
uni.request({ |
|
|
@ -225,20 +229,23 @@ function req(url, data={}, method = 'POST', header={}) { |
|
|
|
try{ |
|
|
|
var rdata = res.data; |
|
|
|
if(rdata.code != CODE_SUCCESS) { |
|
|
|
if((rdata.code==CODE_LOGIN_EXIPRE || rdata.msg.indexOf('Signature verification failed')>-1 || rdata.msg.indexOf('身份认证信息未提供')>-1) && data.xcx_scource == Vue.prototype.USER_SOURCE_WX_H5 && url != getWxH5LoginConfigUri && data.repeat != 1){ |
|
|
|
if(rdata.code==CODE_LOGIN_EXIPRE && data.xcx_scource == Vue.prototype.USER_SOURCE_WX_H5 && url != getWxH5LoginConfigUri && data.repeat != 1){ |
|
|
|
removeLogin(); |
|
|
|
|
|
|
|
var logindatac = new Object(); |
|
|
|
logindatac.host = location.host; |
|
|
|
logindatac.redirect_uri = location.origin; |
|
|
|
logindatac.state = 'user'; |
|
|
|
|
|
|
|
const pagesc = getCurrentPages(); |
|
|
|
const currentPagec = pagesc[pagesc.length - 1]; |
|
|
|
var pageUrlc = '/'+currentPagec.route; |
|
|
|
uni.setStorageSync('rebackPagePath', pageUrlc); |
|
|
|
location.href = Vue.prototype.request_domain+'api/common/wxh5_login/?state=user' |
|
|
|
// req(getWxH5LoginConfigUri, logindatac, 'GET').then(data=>{
|
|
|
|
// if(data == -1 || !data.user_authorize_url) return;
|
|
|
|
// location.href = data.user_authorize_url;
|
|
|
|
// });
|
|
|
|
|
|
|
|
var doctor_id = uni.getStorageSync('doctor_id'); |
|
|
|
req(getWxH5LoginConfigUri+'/?did='+doctor_id, logindatac, 'POST').then(data=>{ |
|
|
|
if(data == -1 || !data.authurl) return; |
|
|
|
location.href = data.authurl; |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -247,7 +254,7 @@ function req(url, data={}, method = 'POST', header={}) { |
|
|
|
showCancel: false, |
|
|
|
content: rdata.msg ? rdata.msg+'|'+rdata.code : '网络错误,请重试|'+res.statusCode, |
|
|
|
success: function (rs) { |
|
|
|
if (rs.confirm && (rdata.code==CODE_LOGIN_EXIPRE || rdata.msg.indexOf('Signature verification failed')>-1 || rdata.msg.indexOf('身份认证信息未提供')>-1)) { |
|
|
|
if (rs.confirm && rdata.code==CODE_LOGIN_EXIPRE) { |
|
|
|
removeLogin(); |
|
|
|
const pages = getCurrentPages(); |
|
|
|
const currentPage = pages[pages.length - 1]; |
|
|
|