From 810de72fbd8f60ae2e6618852952e2403cc738a4 Mon Sep 17 00:00:00 2001 From: kuaileWu <1432334894@qq.com> Date: Wed, 21 May 2025 13:54:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=92=8C=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 40 ++++++++++++++++++- components/header.vue | 8 ++-- components/listBox.vue | 40 +++++++++++-------- components/tabbar.vue | 47 ++++++++++++---------- components/visitorAccount.vue | 2 +- components/visitorList.vue | 2 +- main.js | 71 +++++++++++++++++++++++---------- manifest.json | 15 ++++--- pages/book_detail/book_detail.vue | 4 +- pages/index/index.vue | 60 +++++++++++++--------------- pages/modify_visitor/modify_visitor.vue | 4 +- pages/prebook/prebook.vue | 11 ++--- pages/prebook_list/prebook_list.vue | 2 +- pages/user_modify/user_modify.vue | 4 +- pages/usercenter/usercenter.vue | 2 +- pages/visit_detail/visit_detail.vue | 8 ++-- pages/visitors/visitors.vue | 8 ++-- pages/waiting_method/waiting_method.vue | 4 +- 18 files changed, 207 insertions(+), 125 deletions(-) diff --git a/App.vue b/App.vue index c12e006..d9c57c2 100644 --- a/App.vue +++ b/App.vue @@ -7,6 +7,8 @@ onLaunch: function(option) { console.log(option,'option===='); var did = false + + // #ifdef H5 try { const pathParts = location.pathname.split('/'); const paramIndex = pathParts.indexOf('did'); @@ -16,6 +18,25 @@ } } catch (e) { } + // #endif + + // #ifdef MP-WEIXIN + if(option.query && option.query.did) did = option.query.did + + if(option.query && option.query.scene) { + var scene = decodeURIComponent(option.query.scene) + const params = {}; + scene.split('&').forEach(item => { + const pair = item.split('='); + if (pair.length === 2) { + params[pair[0]] = pair[1]; + } + }); + if(params['depart_id']) did = params['depart_id']; + option.query.logintype = params['logintype']; + uni.clearStorageSync() + } + // #endif if(option.query && option.query.checkin_depart_id) { uni.setStorageSync('checkin_depart_id', option.query.checkin_depart_id) @@ -26,15 +47,32 @@ if(doctor_id){ this.globalData.doctorId = doctor_id }else{ + + // #ifdef H5 document.getElementsByTagName('body')[0].innerHTML = "" setTimeout(function(){ alert('请扫描二维码或点击分享网站链接进入'); - },500) + }, 500) + // #endif + + // #ifdef MP-WEIXIN + uni.showModal({ + title: '请扫描小程序二维码进入', + content: '', + showCancel: false, + success: ({ confirm, cancel }) => {} + }) + // #endif + } }else{ this.globalData.doctorId = did uni.setStorageSync(this.globalData.doctoridStorageKey, did) + + // #ifdef H5 location.href = '/' + // #endif + } }, onShow: function() {}, diff --git a/components/header.vue b/components/header.vue index 2353387..bf060a3 100644 --- a/components/header.vue +++ b/components/header.vue @@ -5,7 +5,7 @@ - + 管理员 @@ -19,7 +19,7 @@ - + - + + diff --git a/components/tabbar.vue b/components/tabbar.vue index 6b5ee43..f9a4ea4 100644 --- a/components/tabbar.vue +++ b/components/tabbar.vue @@ -8,7 +8,7 @@ {{leftButtonText}} - + @@ -61,7 +61,7 @@ }, methods: { async initWxConfig() { - await this.$http.req('user/get_wx_jssdk_config', {url:location.href}, 'POST').then(data=>{ + await this.$http.req('api/user/get_wx_jssdk_config', {url:location.href}, 'POST').then(data=>{ if(data == -1) return this.wxConfig = data try { @@ -82,6 +82,21 @@ }); }, async scanCode() { + // #ifdef MP-WEIXIN + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: (res) => { + console.log('扫码结果:', res.result); + }, + fail: (err) => { + console.error('扫码失败:', err); + uni.showToast({ title: '扫码失败', icon: 'none' }); + } + }); + // #endif + + // #ifdef H5 if(!this.isWechat) { uni.showToast({ title: '请在微信浏览器中打开', @@ -96,7 +111,7 @@ }) return } - + wx.scanQRCode({ needResult: 1, scanType: ["qrCode","barCode"], @@ -111,6 +126,8 @@ }) } }) + // #endif + }, handleScanResult(result) { // uni.showModal({ @@ -122,20 +139,6 @@ this.$func.toPage('/pages/edit/edit'); }, jumpto(event) { - if(event == '/pages/vip/vip' && this.isIos && this.xcxtype == 0){ - this.$http.req('get_aixcx_audit').then(data=>{ - if(data == -1) return; - if(data.isopen) { - uni.reLaunch({ - url:event - }) - return; - } - this.$nav.navToPath('/pages/nonsupport/nonsupport'); - }); - return; - } - if(event == '/pages/vip/vip') uni.setStorageSync('pagetype', 'vip'); uni.reLaunch({ url:event }) @@ -178,8 +181,8 @@ padding-left: 127rpx; padding-right: 127rpx; justify-content: space-between; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box; z-index: 8; margin: 0 auto; @@ -203,7 +206,7 @@ position: absolute; bottom: 0rpx; } - + .scan_wrapper{ width: 100rpx; height: 100rpx; @@ -236,14 +239,14 @@ width: 60rpx; height: 60rpx; } - + .tabbar_item view view:last-of-type,.scantxt{ height: 34rpx; line-height: 34rpx; font-size: 24rpx; letter-spacing: 0.3rpx; } - + .tabbarNone{ color: #666666; text-align: center; diff --git a/components/visitorAccount.vue b/components/visitorAccount.vue index 7d46329..a753d92 100644 --- a/components/visitorAccount.vue +++ b/components/visitorAccount.vue @@ -101,7 +101,7 @@ export default { obj.visitor_id = this.visitor_id if(this.visit_record) obj.visit_record = 1 if(this.visit_id) obj.visit_id = this.visit_id - await this.$http.req('user/get_visitor_info', obj, 'POST').then(data=>{ + await this.$http.req('api/user/get_visitor_info', obj, 'POST').then(data=>{ if(data == -1) return this.visitorInfo = data; if((this.visitorInfo.single_items && this.visitorInfo.single_items.length > 0) || (this.visitorInfo.treatment_package && Object.keys(this.visitorInfo.treatment_package).length > 0)) { diff --git a/components/visitorList.vue b/components/visitorList.vue index 8836180..69b6b8e 100644 --- a/components/visitorList.vue +++ b/components/visitorList.vue @@ -48,7 +48,7 @@ export default { var obj = new Object() if (this.visitor_id != 0) obj.visitor_id = this.visitor_id - this.$http.req('user/get_visitors', obj, 'POST').then(data => { + this.$http.req('api/user/get_visitors', obj, 'POST').then(data => { if (data == -1) return this.vistors = data this.$emit('dataEvent', this.vistors) diff --git a/main.js b/main.js index 0308903..d52acd3 100644 --- a/main.js +++ b/main.js @@ -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} diff --git a/manifest.json b/manifest.json index a47267f..390de08 100644 --- a/manifest.json +++ b/manifest.json @@ -50,9 +50,15 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wxba76fd01dab5e1d8", + "appid" : "wxd82211a91abc5a3e", + "permission": { + "scope.userLocation": { "desc": "定位权限说明" }, + "scope.camera": { "desc": "需要访问相机以完成扫码" } + }, "setting" : { - "urlCheck" : false + "urlCheck" : false, + "minified" : true, + "es6" : true }, "usingComponents" : true }, @@ -69,9 +75,8 @@ "uniStatistics" : { "enable" : false }, - "vueVersion" : "2", - /* "target" : "http://jasonyizherenxin.checkcopy.com",*/ - /* "target" : "http://api.yizherenxin.cn",*/ + "vueVersion" : "2", + /* "target" : "http://jasonyizherenxin.checkcopy.com",*//* "target" : "http://api.yizherenxin.cn",*/ "h5" : { "router" : { "mode" : "history", diff --git a/pages/book_detail/book_detail.vue b/pages/book_detail/book_detail.vue index 2ab8d26..85eb62d 100644 --- a/pages/book_detail/book_detail.vue +++ b/pages/book_detail/book_detail.vue @@ -114,7 +114,7 @@ content:'确认取消预约?', success(res) { if(!res.confirm) return - that.$http.req('user/cancel_appoint', { + that.$http.req('api/user/cancel_appoint', { appoint_id:that.bookId, depart_id:that.depart_id }, @@ -142,7 +142,7 @@ this.$func.toPage('/pages/index/index') }, getBookDetail(){ - this.$http.req('user/get_appoint_detail', {appoint_id:this.bookId,depart_id:this.depart_id}, 'POST').then(data=>{ + this.$http.req('api/user/get_appoint_detail', {appoint_id:this.bookId,depart_id:this.depart_id}, 'POST').then(data=>{ if(data == -1) { this.bookInfo = false return diff --git a/pages/index/index.vue b/pages/index/index.vue index a49a068..5ee6b4c 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -42,6 +42,7 @@ {{item.hospital_name}} + 医保定点 {{item.address}} @@ -62,7 +63,7 @@ 出诊:{{ item.workdate_desc }} - + @@ -91,7 +92,7 @@ - + @@ -152,6 +153,26 @@ }, methods: { toLocation(hospital){ + + // #ifdef MP-WEIXIN + var lngLat = hospital.hospital_pos.toString().split(',') + var lng = Number(lngLat[0]) + , lat = Number(lngLat[1]) + + if (typeof wx !== 'undefined' && wx.openLocation) { + wx.openLocation({ + latitude: lat, + longitude: lng, + name: hospital.hospital_name || '目的地', + address: hospital.address || '', + scale: 15, + success: () => console.log('打开成功'), + fail: (err) => console.error('失败', err) + }); + } + // #endif + + // #ifdef H5 var that = this uni.showActionSheet({ itemList: ['腾讯地图', '百度地图', '高德地图'], @@ -167,34 +188,12 @@ 'http://api.map.baidu.com/marker?location='+baiduLngLat.lat+','+baiduLngLat.lng+'&title='+hospital.hospital_name+'&content=即将前往目的地&output=html&src=webapp.baidu.openAPIdemo', 'https://m.amap.com/share/index/lnglat='+hospital.hospital_pos+'&name='+hospital.hospital_name+'&src=uriapi&innersrc=uriapi', ] - // location.href(mapList[res.tapIndex]) - // 判断是否在小程序环境 - if (typeof wx !== 'undefined' && wx.openLocation) { - // 小程序环境 - // 跳不过去?? lat?问题? - // wx.openLocation({ - // latitude: lat, - // longitude: lng, - // name: hospital.hospital_name || '目的地', - // address: hospital.address || '', - // scale: 18 - // }); - wx.openLocation({ - latitude: baiduLngLat.lat, - longitude: baiduLngLat.lng, - name: hospital.hospital_name || '目的地', - address: hospital.address || '', - scale: 18 - }); - } - // 判断是否微信浏览器 - else if (/MicroMessenger/i.test(navigator.userAgent)) { - location.href = mapList[res.tapIndex]; - } + location.href(mapList[res.tapIndex]) }, fail: function (res) { } }); + // #endif }, copyAddress(address){ uni.setClipboardData({ @@ -204,14 +203,11 @@ } }); }, - changeCollapse(e) { - console.log(e); - }, setLoginUserInfo(info) { this.$setuinfo.setUinfo(JSON.stringify(info)) }, login() { - this.$http.req('common/get_user_info', {code:this.code,state:this.state}, 'POST').then(data=>{ + this.$http.req('api/common/get_user_info', {code:this.code,state:this.state}, 'POST').then(data=>{ if(data == -1) return this.$settoken.setToken(data.jwttoken) @@ -228,7 +224,7 @@ }, async getDoctorInfo() { - await this.$http.req('user/index_info', {}, 'GET').then(data=>{ + await this.$http.req('api/user/index_info', {}, 'GET').then(data=>{ if(data == -1) return // var data = JSON.parse(uni.getStorageSync('doctor_info')); @@ -264,7 +260,7 @@ }else{ visitFlag = false; } - + this.hospital_departs = this.doctorInfo.hospital_departs.map((item,index)=>{ item.workdate_desc = this.doctorInfo.workdate_desc[item.depart_id] return item diff --git a/pages/modify_visitor/modify_visitor.vue b/pages/modify_visitor/modify_visitor.vue index b40901b..1ad7f3f 100644 --- a/pages/modify_visitor/modify_visitor.vue +++ b/pages/modify_visitor/modify_visitor.vue @@ -74,11 +74,11 @@ that.adding = false }, 5000); - var req = 'user/add_visitor' + var req = 'api/user/add_visitor' var method = 'POST' if(this.vid){ param.id = this.vid - req = 'user/update_visitor' + req = 'api/user/update_visitor' } this.$http.req(req, param, method, true).then(data=>{ diff --git a/pages/prebook/prebook.vue b/pages/prebook/prebook.vue index a3b0cd5..84c60a8 100644 --- a/pages/prebook/prebook.vue +++ b/pages/prebook/prebook.vue @@ -112,6 +112,7 @@ }, tips(){ uni.removeStorageSync('active_visitors') + var that = this uni.showToast({ title:"成功预约"+this.chooseVisitorCount+"人", mask:true, @@ -119,7 +120,7 @@ times:false, success() { setTimeout(function(){ - this.$nav.navToPath("/pages/prebook_list/prebook_list") + that.$nav.navToPath("/pages/prebook_list/prebook_list") }, 1500) } }) @@ -129,7 +130,7 @@ depart_id:this.departId, date:date?date:'' } - this.$http.req('/user/get_appoint_times',param, 'POST').then(data=>{ + this.$http.req('api/user/get_appoint_times',param, 'POST').then(data=>{ let date2work = data.date2work let regxp = /^0/; for(let key in date2work){ @@ -179,7 +180,7 @@ param.time_interval = this.times.time_interval; param.date = this.times.date; this.chooseVisitorCount = uids.length - this.$http.req('user/appoint', param,'POST').then(data=>{ + this.$http.req('api/user/appoint', param,'POST').then(data=>{ if(data == -1) return this.tips() }); @@ -191,13 +192,13 @@ for (var i = 0; i < this.activeVisitors.length; i++) { visitor_ids.push(this.activeVisitors[i].id) } - + param.visitor_ids = this.visitor_ids = visitor_ids; this.times = param; this.times.date = times.date; this.times.time_desc = '下午'; if(times.type == 1) this.times.time_desc = '上午'; - this.$http.req('user/check_appoint_nums', param,'POST').then(data=>{ + this.$http.req('api/user/check_appoint_nums', param,'POST').then(data=>{ if(data.remain < this.activeVisitors.length){ this.needSelectMembers = true this.$set(this.times, 'remain', data.remain) diff --git a/pages/prebook_list/prebook_list.vue b/pages/prebook_list/prebook_list.vue index 7729ef4..bc07235 100644 --- a/pages/prebook_list/prebook_list.vue +++ b/pages/prebook_list/prebook_list.vue @@ -40,7 +40,7 @@ var timerobj = setTimeout(function(){ uni.hideLoading() }, 3000) - this.$http.req('user/get_appoints', param, 'POST', true).then(data=>{ + this.$http.req('api/user/get_appoints', param, 'POST', true).then(data=>{ clearTimeout(timerobj) uni.hideLoading() if(data == -1) return diff --git a/pages/user_modify/user_modify.vue b/pages/user_modify/user_modify.vue index cc80124..2275da8 100644 --- a/pages/user_modify/user_modify.vue +++ b/pages/user_modify/user_modify.vue @@ -48,7 +48,7 @@ }, methods: { getUser(){ - this.$http.req('user/get_user_info', {}, 'GET').then(data=>{ + this.$http.req('api/user/get_user_info', {}, 'GET').then(data=>{ if(data == -1) return this.uinfo = data this.nick = this.uinfo.nick @@ -199,7 +199,7 @@ } } } - + } } .submit-blank{ diff --git a/pages/usercenter/usercenter.vue b/pages/usercenter/usercenter.vue index 6c970ca..ad26624 100644 --- a/pages/usercenter/usercenter.vue +++ b/pages/usercenter/usercenter.vue @@ -39,7 +39,7 @@ }, methods: { getUser(){ - this.$http.req('user/get_user_info', {}, 'POST').then(data=>{ + this.$http.req('api/user/get_user_info', {}, 'POST').then(data=>{ if(data == -1) return this.uinfo = data }); diff --git a/pages/visit_detail/visit_detail.vue b/pages/visit_detail/visit_detail.vue index dba6f0a..061d998 100644 --- a/pages/visit_detail/visit_detail.vue +++ b/pages/visit_detail/visit_detail.vue @@ -1,9 +1,11 @@