|
|
@ -18,16 +18,6 @@ String.prototype.trim=function(){ |
|
|
|
return this.replace(/(^s*)|(s*$)/g, ""); |
|
|
|
} |
|
|
|
|
|
|
|
const NODE_ENV = 'development'; |
|
|
|
// const NODE_ENV = 'production';
|
|
|
|
if(NODE_ENV == 'development'){ |
|
|
|
Vue.prototype.cssUrl = '/static/images/frontend/'; |
|
|
|
Vue.prototype.request_domain = "http://jasonyizherenxin.checkcopy.com/"; |
|
|
|
}else{ |
|
|
|
Vue.prototype.cssUrl = '/static/images/frontend/'; |
|
|
|
Vue.prototype.request_domain = "http://api.yizherenxin.cn/"; |
|
|
|
} |
|
|
|
|
|
|
|
try{ |
|
|
|
var res = uni.getSystemInfoSync(), |
|
|
|
platform = res.platform.toLowerCase(), |
|
|
@ -162,6 +152,26 @@ try{ |
|
|
|
Vue.prototype.isMobile = isMobile(); |
|
|
|
} |
|
|
|
|
|
|
|
const NODE_ENV = 'development'; |
|
|
|
// const NODE_ENV = 'production';
|
|
|
|
if(Vue.prototype.provider == Vue.prototype.provider_weixin){ |
|
|
|
if (NODE_ENV == "development") { |
|
|
|
Vue.prototype.request_domain = 'http://jasonyizherenxin.checkcopy.com/'; |
|
|
|
Vue.prototype.cssUrl = "/static/images/frontend/"; |
|
|
|
} else { |
|
|
|
Vue.prototype.request_domain = 'https://api.yizherenxin.cn/'; |
|
|
|
Vue.prototype.cssUrl = "/static/images/frontend/"; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(NODE_ENV == 'development'){ |
|
|
|
Vue.prototype.request_domain = "http://jasonyizherenxin.checkcopy.com/"; |
|
|
|
Vue.prototype.cssUrl = '/static/images/frontend/'; |
|
|
|
}else{ |
|
|
|
Vue.prototype.request_domain = "http://api.yizherenxin.cn/"; |
|
|
|
Vue.prototype.cssUrl = '/static/images/frontend/'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Vue.prototype.appid = ''; |
|
|
|
Vue.prototype.USER_SOURCE_WX_XCX = 1; |
|
|
|
Vue.prototype.USER_SOURCE_WX_H5 = 2; |
|
|
@ -251,6 +261,14 @@ function req(url, data={}, method = 'POST', header={}) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if(data.xcx_scource == Vue.prototype.USER_SOURCE_WX_XCX && !data.repeat && rdata.code==CODE_LOGIN_EXIPRE && url != '/api/common/xcx_login'){ |
|
|
|
removeLogin(); |
|
|
|
xcx_login(url, data, method).then(data=>{ |
|
|
|
return resolve(data); |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
uni.showModal({ |
|
|
|
title: '提示', |
|
|
|
showCancel: false, |
|
|
@ -278,10 +296,12 @@ function req(url, data={}, method = 'POST', header={}) { |
|
|
|
return resolve(res.data.data); |
|
|
|
} |
|
|
|
}catch(e){ |
|
|
|
console.log(e) |
|
|
|
|
|
|
|
uni.showModal({ |
|
|
|
title: '提示', |
|
|
|
showCancel: false, |
|
|
|
content: '请求数据出错|f', |
|
|
|
content: '请求数据出错8|f', |
|
|
|
success: function (rs) { |
|
|
|
return resolve("-1"); |
|
|
|
} |
|
|
@ -307,15 +327,24 @@ function xcx_login(url, eqdata={}, method = 'POST') { |
|
|
|
wx.login({ |
|
|
|
success (res) { |
|
|
|
if (res.code) { |
|
|
|
var pdata = new Object(); |
|
|
|
pdata.code = res.code; |
|
|
|
req('client/user/login', pdata, 'POST').then(data=>{ |
|
|
|
setToken(data.token) |
|
|
|
eqdata.repeat = 1; |
|
|
|
req(url, eqdata, method).then(data=>{ |
|
|
|
var pdata = new Object(); |
|
|
|
pdata.code = res.code; |
|
|
|
var doctor_id = uni.getStorageSync('doctor_id'); |
|
|
|
pdata.state = 'user-'+doctor_id; |
|
|
|
|
|
|
|
req('/api/common/xcx_login', pdata).then(data=>{ |
|
|
|
var udata = data |
|
|
|
if(udata && udata.jwttoken) { |
|
|
|
setToken(udata.jwttoken) |
|
|
|
setUinfo(JSON.stringify(udata)) |
|
|
|
} |
|
|
|
|
|
|
|
pdata.repeat = 1; |
|
|
|
req(url, pdata, method).then(data=>{ |
|
|
|
return resolve(data); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@ -348,9 +377,9 @@ function toPage(path){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function navToPath(path) { |
|
|
|
function navToPath(path, isreLaunch = false) { |
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
if(path.indexOf('/pages/index/index') == -1){ |
|
|
|
if(path.indexOf('/pages/index/index') == -1 && !isreLaunch){ |
|
|
|
wx.navigateTo({ |
|
|
|
url: path |
|
|
|
}); |
|
|
@ -364,7 +393,6 @@ function navToPath(path) { |
|
|
|
// #ifdef H5
|
|
|
|
location.href = path; |
|
|
|
// #endif
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function modelShow(content, path="",title="提示") { |
|
|
@ -416,7 +444,8 @@ function setTitlefFunc(title) { |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: title || '' |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
Vue.prototype.$setTitle = {setTitlefFunc} |
|
|
|
Vue.prototype.$pop = {modelShow} |
|
|
|
Vue.prototype.$func = {toPage} |
|
|
|