diff --git a/main.js b/main.js index e1141ac..0308903 100644 --- a/main.js +++ b/main.js @@ -44,6 +44,7 @@ try{ }catch(e){ } + Vue.prototype.env_val = 'xcx'; Vue.prototype.is_pc = false; Vue.prototype.isMobile = false; @@ -244,7 +245,8 @@ function req(url, data={}, method = 'POST', header={}) { 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; + // location.href = data.authurl; + this.$nav.navToPath(data.authurl) }); return; } @@ -260,9 +262,10 @@ function req(url, data={}, method = 'POST', header={}) { const currentPage = pages[pages.length - 1]; let pageUrl = '/'+currentPage.route; if(data.xcx_scource == Vue.prototype.USER_SOURCE_WX_H5){ - uni.navigateTo({ - url: '/pages/index/index' - }); + // uni.navigateTo({ + // url: '/pages/index/index' + // }); + this.$nav.navToPath('/pages/index/index') }else{ } return; @@ -345,6 +348,25 @@ function toPage(path){ } } +function navToPath(path) { + // #ifdef MP-WEIXIN + if(path.indexOf('/pages/index/index') == -1){ + wx.navigateTo({ + url: path + }); + }else{ + wx.reLaunch({ + url: path + }); + } + // #endif + + // #ifdef H5 + location.href = path; + // #endif + +} + function modelShow(content, path="",title="提示") { uni.showModal({ title: title, @@ -403,6 +425,7 @@ Vue.prototype.$trim = {trim} Vue.prototype.$token = {getToken} Vue.prototype.$settoken = {setToken} Vue.prototype.$setuinfo = {setUinfo} +Vue.prototype.$nav = { navToPath }; app.$mount() // #endif