From 80256c7069d2c4bf1dcce89d9267e3f2cd3790a1 Mon Sep 17 00:00:00 2001 From: "Mr.jiang" <714156421@qq.com> Date: Tue, 25 Jun 2024 20:23:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config.js | 6 +- common/queue.js | 4 +- manifest.json | 4 +- pages/index/index.vue | 257 ++++++++++++++++++++++++--- pages/index/index2.vue | 1 + pages/my/serviceOderDrtail.vue | 6 +- pages/public/login.vue | 5 +- pages/therapist/therapistDingdan.vue | 2 +- uview-ui/libs/request/index.js | 2 +- 9 files changed, 251 insertions(+), 36 deletions(-) diff --git a/common/config.js b/common/config.js index 15b0486..087a908 100644 --- a/common/config.js +++ b/common/config.js @@ -6,6 +6,10 @@ const ROOTPATH3 = "wss://192.168.2.222:8187/wss/websocket/"; const ROOTPATH = "http://192.168.2.222:8187/sqx_fast"; const ROOTPATH1 = "http://192.168.2.222:8187/sqx_fast"; +// const ROOTPATH3 = "wss://47.75.182.93:8090/wss/websocket/"; +// const ROOTPATH = "http://47.75.182.93:8090/sqx_fast"; +// const ROOTPATH1 = "http://47.75.182.93:8090/sqx_fast"; + // const ROOTPATH = "http://192.168.2.13:8187/sqx_fast"; // const ROOTPATH1 = "http://192.168.2.13:8187/sqx_fast"; @@ -40,7 +44,7 @@ const TX_MAP_KEY = 'VIWBZ-5OM3F-CV7JZ-NLKJY-AXSYV-TMFM6'; //const TX_MAP_KEY = '55UBZ-STNK4-DSNUM-F4A75-Q7BC5-FRBMS'; //ws基础连接地址 -// const WS_BASE_PATH = 'ws://192.168.2.13:8187/sqx_fast/'; +// const WS_BASE_PATH = 'ws://47.75.182.93:8090/sqx_fast/'; const WS_BASE_PATH = 'ws://192.168.2.222:8187/sqx_fast/'; // const WS_BASE_PATH = 'ws://120.46.52.165/sqx_fast/'; // const WS_BASE_PATH = 'wss://admin.sjajk.com/sqx_fast/';//生产需替换 diff --git a/common/queue.js b/common/queue.js index 371436b..a420c58 100644 --- a/common/queue.js +++ b/common/queue.js @@ -21,14 +21,14 @@ module.exports = { // return 'https://admin.sjajk.com'//生产需替换 // return 'http://120.46.52.165' return 'http://192.168.2.222:8187' - // return 'http://192.168.2.13:8187' + // return 'http://47.75.182.93:8090:8187' }, //全局域名 部分html中需要单独替换 需要修改config中的网络请求域名 publicYuMingApp() { // return 'https://wx.sjajk.com'//生产需替换 // return 'http://120.46.52.165' return 'http://192.168.2.222:8187' - // return 'http://192.168.2.13:8187' + // return 'http://47.75.182.93:8090:8187' }, logout() { this.remove("token"); diff --git a/manifest.json b/manifest.json index ffc0e01..632d7a6 100644 --- a/manifest.json +++ b/manifest.json @@ -185,8 +185,8 @@ "securityJsCode" : "2b07c8496878c327a8ae7a19de33e2a7", // "serviceHost" : "http://wx.sjajk.com/_AMapService"//生产需替换 // "serviceHost" : "http://120.46.52.165/_AMapService" - "serviceHost" : "http://192.168.2.222:8187/_AMapService" - // "serviceHost" : "http://192.168.2.13:8187/_AMapService" + "serviceHost" : "http://192.168.2.222:8187/_AMapService" + // "serviceHost" : "http://47.75.182.93:8090/_AMapService" } } }, diff --git a/pages/index/index.vue b/pages/index/index.vue index bdd334c..9f76044 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -236,9 +236,10 @@ import * as webMap from 'utils/webMap.js'; + import permision from "@/components/permission.js"; // 调用手机系统权限 // #ifdef APP-PLUS - import permision from "@/components/permission.js"; + // import permision from "@/components/permission.js"; // #endif export default { data() { @@ -318,42 +319,247 @@ classifyId: '', page:1, limit:10, + arr: [], + txAppKey: '', + tpSel: 0, + tpCount: 0, } }, - onLoad() { + onShareAppMessage(res) { //发送给朋友 + return { + title: this.tuiguang, + path: '/pages/index/index?invitation=' + this.invitationCode, + imageUrl: this.tuiguangImg, + } + }, + onShareTimeline(res) { //分享到朋友圈 + return { + title: this.tuiguang, + path: '/pages/index/index?invitation=' + this.invitationCode, + imageUrl: this.tuiguangImg, + } + }, + onLoad(e) { let that = this that.getBannerList() - that.getHomeArtificerList() - // that.getKTCityList(); that.remen() + that.getKTCityList(); + // 获取邀请码保存到本地 + if (e.invitation) { + that.$queue.setData('inviterCode', e.invitation); + } + // #ifdef MP-WEIXIN + if (e.scene) { + const scene = decodeURIComponent(e.scene); + this.$queue.setData('inviterCode', scene.split(',')[0]); + } + // #endif + + that.$Request.getT('/app/common/type/250').then(res => { //理疗师完成通知 + if (res.code == 0) { + if (res.data && res.data.value) { + that.arr.push(res.data.value) + } + } + }) + + that.$Request.getT('/app/common/type/248').then(res => { //理疗师取消通知 + if (res.code == 0) { + if (res.data && res.data.value) { + that.arr.push(res.data.value) + } + } + }) + that.$Request.getT('/app/common/type/217').then(res => { //腾讯地图key + if (res.code == 0) { + if (res.data && res.data.value) { + that.txAppKey = res.data.value; + } + } + }) + console.log(11) + uni.getLocation({ + type: 'gcj02', + geocode: true, //设置该参数为true可直接获取经纬度及城市信息 + success: function(res) { + console.log(res, '地理位置') + that.latitude = res.latitude + that.longitude = res.longitude + uni.setStorageSync('latitude', res.latitude) + uni.setStorageSync('longitude', res.longitude) + + // #ifdef APP-PLUS + that.city = res.address.city + that.selectCity(that.longitude, that.latitude); + uni.setStorageSync('city', res.address.city) + // that.page = 1 + // that.getorderlist('') + that.getKTCityList(); + // #endif + + // #ifdef H5 + that.selectCity(that.longitude, that.latitude); + // #endif + + // #ifdef MP-WEIXIN + uni.request({ + url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + that.latitude + + ',' + that.longitude + '&key=' + that.txAppKey, + success(re) { + if (re.statusCode === 200) { + let citydata = re.data.result.address_component.city + // console.log("获取城市名称成功", citydata)/ + that.city = citydata ? citydata : '未知' + uni.setStorageSync('city', citydata) + that.getKTCityList(); + // that.page = 1 + // that.getorderlist('') + } else { + console.log("获取信息失败,请重试!") + } + } + }); + // #endif + }, + fail: function() { + // #ifdef APP-PLUS + that.checkPermission(); + // #endif + } + }) }, onShow() { let that = this that.XCXIsSelect = this.$queue.getData("XCXIsSelect"); - that.city = uni.getStorageSync('city') ? uni.getStorageSync('city') : '请选择城市' - that.token = uni.getStorageSync('token'); - that.getKTCityList(); - if (uni.getStorageSync('token')) { - uni.getLocation({ - type: 'gcj02', - geocode: true, //设置该参数为true可直接获取经纬度及城市信息 - // geocode: true, //设置该参数为true可直接获取经纬度及城市信息 - success: function(res) { - console.log('地理位置',res) - that.city=res.address.city - that.latitude = res.latitude - that.longitude = res.longitude - that.getBannerList() - that.getHomeArtificerList() - }, - fail: function() { - console.log('获取地址失败2') - } - }) + let userId = uni.getStorageSync('userId') + if (userId) { + this.getTpMy(); + this.getTpCount(); + // this.checkNewUser(); + // #ifdef MP-WEIXIN + //订阅 + if (this.showModal) { + this.openMsg() + } + // #endif + this.city = uni.getStorageSync('city') + console.log(this.city) + this.getKTCityList(); + this.getHomeArtificerList(); + this.latitude = uni.getStorageSync('latitude') + this.longitude = uni.getStorageSync('longitude') } - // that.myId = uni.getStorageSync('userId') + that.token = uni.getStorageSync('token'); + // that.getKTCityList(); + // if (uni.getStorageSync('token')) { + // console.log(22) + // if (that.latitude && that.longitude) { + // that.page = 1 + // that.getHomeArtificerList() + // } else { + // console.log(33) + // uni.getLocation({ + // type: 'wgs84', + // // highAccuracyExpireTime: 500, + // geocode: true, //设置该参数为true可直接获取经纬度及城市信息 + // success: function(res) { + // console.log(44) + // console.log( '------>地理位置',res) + // that.latitude = res.latitude + // that.longitude = res.longitude + // that.page = 1 + // that.getHomeArtificerList() + // }, + // fail: function() { + // console.log(55) + // console.log('获取地址失败2') + // } + // }) + // } + // } }, methods: { + // 开启订阅消息 + openMsg() { + console.log('订阅消息') + var that = this + uni.getSetting({ + withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回 + success(ret) { + console.log(ret.subscriptionsSetting, '------------------') + // if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) { + if (ret.subscriptionsSetting.itemSettings) { + uni.setStorageSync('sendMsg', true) + uni.openSetting({ // 打开设置页 + success(rea) { + console.log(rea.authSetting) + } + }); + } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息 + uni.setStorageSync('sendMsg', false) + uni.showModal({ + title: '提示', + content: '为了更好的体验,请绑定消息推送', + confirmText: '确定', + cancelText: '取消', + success: function(res) { + if (res.confirm) { + wx.requestSubscribeMessage({ + tmplIds: that.arr, + success(re) { + var datas = JSON.stringify(re); + if (datas.indexOf("accept") != -1) { + console.log(re) + // uni.setStorageSync('sendMsg', true) + } + }, + fail: (res) => { + console.log(res) + } + }) + // uni.setStorageSync('sendMsg', true) + + that.showModal = false + } else if (res.cancel) { + console.log('取消') + // uni.setStorageSync('sendMsg', false) + that.showModal = true + } + } + }) + } + } + }) + }, + getTpCount() { + this.$Request.getT('/app/message/selectCityCount?city=' + this.city).then(res => { + if (res.code == 0) { + this.tpCount = res.data ? res.data : 0; + } + }); + }, + getTpMy() { + this.$Request.getT('/app/message/selectMessageByUserId?page=1&limit=1&state=11').then(res => { + if (res.code == 0) { + if (res.data && res.data.list && res.data.list.length > 0) { + this.tpSel = 1; + } else { + this.tpSel = 2; + } + } + }); + }, + selectCity(longitude, latitude) { + this.$Request.get('/app/Login/selectCity?lat=' + latitude + '&lng=' + longitude).then(res => { + if (res.code == 0) { + this.city = res.data.city ? res.data.city : '未知' + uni.setStorageSync('city', res.data.city) + this.page = 1 + this.getorderlist('') + this.getKTCityList(); + } + }); + }, chaoji(){//超级满减 uni.navigateTo({ url:'/my/wallet/index' @@ -453,6 +659,7 @@ url:'/pages/therapist/therapist' }) }, + getCity(e) { console.log("得到的城市-------------》",e[0].label); this.city = e[0].label; diff --git a/pages/index/index2.vue b/pages/index/index2.vue index 460ed7f..15ceadd 100644 --- a/pages/index/index2.vue +++ b/pages/index/index2.vue @@ -357,6 +357,7 @@ } // #endif this.city = uni.getStorageSync('city') + console.log(this.city) this.getKTCityList(); this.latitude = uni.getStorageSync('latitude') this.longitude = uni.getStorageSync('longitude') diff --git a/pages/my/serviceOderDrtail.vue b/pages/my/serviceOderDrtail.vue index 74bac95..ccf4f5b 100644 --- a/pages/my/serviceOderDrtail.vue +++ b/pages/my/serviceOderDrtail.vue @@ -236,8 +236,10 @@ let data = { userId: uni.getStorageSync('userId'), couponId: that.couponId, - oldSumMoney: that.mainData.oldPrice*that.detailData.length, - sumMoney: that.mainData.price*that.detailData.length, + oldSumMoney: that.mainData.oldPrice, + sumMoney: that.mainData.price, + // oldSumMoney: that.mainData.oldPrice*that.detailData.length, + // sumMoney: that.mainData.price*that.detailData.length, ordersPackageList:[ {packageId: that.mainData.id,num: that.detailData.length}, ] diff --git a/pages/public/login.vue b/pages/public/login.vue index 931e124..1aefe43 100644 --- a/pages/public/login.vue +++ b/pages/public/login.vue @@ -50,8 +50,9 @@ - - + + +