diff --git a/App.vue b/App.vue index 48a6792..1fbcc6f 100644 --- a/App.vue +++ b/App.vue @@ -5,15 +5,15 @@ // brestUrl: 'http://192.168.3.4:9302/brest', // imgUrl: 'https://192.168.3.4:9301/filesystem/', //正式 - url: 'https://hsg.dctpay.com/crest', - imgUrl: 'https://hsg.dctpay.com/filesystem/', - brestUrl : 'https://hsg.dctpay.com/brest', - imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', + // url: 'https://hsg.dctpay.com/crest', + // imgUrl: 'https://hsg.dctpay.com/filesystem/', + // brestUrl : 'https://hsg.dctpay.com/brest', + // imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', //测试 - // url: 'https://hsgcs.dctpay.com/crest', - // brestUrl : 'https://hsgcs.dctpay.com/brest', - // imgUrl: 'https://hsgcs.dctpay.com/filesystem/', - // imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', + url: 'https://hsgcs.dctpay.com/crest', + brestUrl : 'https://hsgcs.dctpay.com/brest', + imgUrl: 'https://hsgcs.dctpay.com/filesystem/', + imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', userInfo: "", brestUserInfo : '', openId: '', diff --git a/pages.json b/pages.json index 186da6c..9afd50f 100644 --- a/pages.json +++ b/pages.json @@ -332,12 +332,7 @@ "onReachBottomDistance": 50, "app-plus": { "titleNView": false, //禁用原生导航栏 - "softinputNavBar": "none", - "subNVues": [{ - "id": "homeTitleNvue", // 唯一标识 - "path": "pages/tabBar/home/subNvue/homeTitleNvue", // 页面路径 - "type": "navigationBar" - }] + "softinputNavBar": "none" } } diff --git a/pages/login/resetpasswd.vue b/pages/login/resetpasswd.vue index da7329c..0a74c7f 100644 --- a/pages/login/resetpasswd.vue +++ b/pages/login/resetpasswd.vue @@ -8,13 +8,13 @@ - + - + - + 重置密码 @@ -154,7 +154,7 @@ let datas = { userId: app.globalData.brestUserInfo.id, oldPassword: this.phoneNumber, - password : this.passwd + newPassword : this.passwd } sendUserPass(datas).then(res => { if (res.return_code == '000000') { diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue index b1d0229..a8706cf 100644 --- a/pages/tabBar/home/home.vue +++ b/pages/tabBar/home/home.vue @@ -91,6 +91,7 @@ + @@ -113,10 +114,12 @@ findByLatAndLng } from "../../../Utils/Api.js"; //您的api路径 import wybPopup from '../../../components/wyb-popup/wyb-popup.vue'; + import mumuGetlocation from '@/uni_modules/mumu-getlocation/components/mumu-getlocation/mumu-getlocation.vue'; let app = getApp(); export default { components: { - wybPopup + wybPopup, + mumuGetlocation }, data() { return { @@ -162,7 +165,8 @@ homeCateList: [], //切换状态 cpStuats: 1, - jumpType: '' + jumpType: '', + locationRef: null, // 用于接收定位对象 }; }, @@ -198,7 +202,7 @@ app.globalData.h5code = arr2[1]; } else { // 获取openid - this.jumpcdx(); + that.jumpcdx(); uni.setStorage({ key: "accountId", data: arr2[1] @@ -210,7 +214,7 @@ } if (app.globalData.h5code) { - this.getH5AccessToken(); + that.getH5AccessToken(); } // #endif // #ifdef MP @@ -234,8 +238,51 @@ }, }) // #endif + // #ifdef H5 + // 使用 $nextTic 等待组件加载完成调用 + this.$nextTick(() => { + // 在检测用户是否开启定位权限需要一个过程,推荐使用 login 提示一下 + // 初始化组件,并且检测是否开启与授权定位 + this.$refs.muLocation.__init().then(location => { + // 用户授权了和开启了定位,把定位对象保存到 data 中 + this.locationRef = location; + this.getLocation(); + }, err => { + this.city = '重庆市'; + app.globalData.cityName = '重庆市'; + app.globalData.cityId = '500000'; + // 用户拒绝了定位请求,获取系统没有开启定位功能 + if (err.code === 1) { + uni.showModal({ + title: '获取定位权限失败,默认城市重庆', + content: '你拒绝了位置授权服务。请允许当前页面获取定位授权,后刷新页面。' + }) + this.getCouponListArea(); + this.getCouponListgold(); + this.getCmsContent(); + this.getCmsAactibity(); + this.getCmsContentcmshome(); + this.getCmsContentcmsContent(); + } else { + uni.showModal({ + title: '获取定位权限失败,默认城市重庆', + content: '请确定手机定位已打开,并且当前浏览器允许获取定位,都开启后请刷新页面。' + }) + this.getCouponListArea(); + this.getCouponListgold(); + this.getCmsContent(); + this.getCmsAactibity(); + this.getCmsContentcmshome(); + this.getCmsContentcmsContent(); + } + }) + + }) + // #endif + // #ifdef MP //定位 - this.postionIng(); + that.postionIng(); + // #endif uni.getStorage({ key: "user", success(e) { @@ -265,7 +312,7 @@ methods: { jumpcdx() { location.href = - 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsg.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'; + 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'; }, //获取首页功能 getCmsContentcmsContent() { @@ -372,33 +419,6 @@ app.globalData.longitude = res.longitude; uni.hideLoading(); that.findByLatAndLng(res.longitude, res.latitude); - // that.getUserLocation(res.longitude, res.latitude); - // uni.request({ - // url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + - // ',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB', - // data: {}, - // success: function(res) { - // // that.city = res.data.result.address_component.city.replace(/市/g, - // // ''); - // that.city = res.data.result.address_component.province; - // app.globalData.cityName = res.data.result.address_component - // .province; - // app.globalData.cityId = res.data.result.ad_info.adcode; - // uni.hideLoading(); - // if (res.data.result.ad_info.adcode) { - // that.getCouponListArea(); - // that.getCouponListgold(); - // that.getCmsContent(); - // that.getCmsAactibity(); - // that.getCmsContentcmshome(); - // that.getCmsContentcmsContent(); - // } - - // }, - // fail(err) { - // uni.hideLoading() - // } - // }) }, fail: (err) => { if (err.errCode == 2) { @@ -411,6 +431,21 @@ } }) }, + // 获取精准定位 + getLocation() { + uni.showLoading({ + title: '加载中' + }) + let that = this; + that.locationRef.getLocation() // 调用 getLocation 方法获取精准定位 + .then(res => { + uni.hideLoading(); + // res 就是返回的数据 + app.globalData.latitude = res.lat; + app.globalData.longitude = res.lng; + that.findByLatAndLng(res.lng, res.lat); + }) + }, //经纬度转换 findByLatAndLng(item, item1) { let that = this; @@ -467,58 +502,6 @@ } }); }, - //H5金纬度转 - getUserLocation(long, lat) { - let that = this; - let url = - 'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1'; - let locationObj = lat + ',' + long; - this.$jsonp(url, { - key: '7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB', - location: locationObj - }) - .then(res => { - // vm.city = res.result.address_component.city.replace(/市/g, ''); - // app.globalData.cityName = res.result.address_component.city.replace(/市/g, ''); - // app.globalData.cityId = res.result.ad_info.adcode; - // vm.getCouponListArea(); - // vm.getCouponListgold(); - // uni.hideLoading() - uni.hideLoading(); - that.city = res.result.address_component.city; - app.globalData.cityName = res.result.address_component - .city; - app.globalData.cityId = res.result.ad_info.adcode; - if (res.result.ad_info.adcode) { - // app.globalData.cityId = '500100'; - that.getCouponListArea(); - that.getCouponListgold(); - that.getCmsContent(); - that.getCmsAactibity(); - that.getCmsContentcmshome(); - that.getCmsContentcmsContent(); - } - uni.getStorage({ - key: 'accountType', - success(e) { - if (e.data) { - app.globalData.accountType = e.data; - if (e.data == '000000#/' && app.globalData.h5code) { - uni.navigateTo({ - url: '../../goods/refuel-details/refuel-details' - }) - } - - } - } - }) - - }) - .catch(err => { - uni.hideLoading() - }); - }, - //搜索跳转 toSearch() { uni.navigateTo({ diff --git a/subPages/recharge-centre/recharge-centre.vue b/subPages/recharge-centre/recharge-centre.vue index 77f30e5..244b67e 100644 --- a/subPages/recharge-centre/recharge-centre.vue +++ b/subPages/recharge-centre/recharge-centre.vue @@ -28,82 +28,11 @@ 充值说明: - - - 1: - - 此业务为话费慢充。日常5个工作日内到账,如遇月初、月末运营商高峰期或系统更新,到账时间会有一定延迟,敬请谅解。充值失败后系统会自动为您退款至原账户。急单请选择“6小时到账”充值端口,感谢您的支持! - - - - 2: - 慢充话费与营业厅充值一样,只是到账时间稍长。充值过程中可能出现分批到账的情况,但是总金额不会少,请耐心等待。 - - - 3: - - 目前仅支持(移动、联通、电信三网号段),运营商黑名单号码(长期欠费或非实名制认证)携号转网空号、虚拟卡(如165167170171162等等虚拟号段)副卡号码或做过某些特殊套餐绑定的卡暂不支持充值,请勿下单。 - - - - 4: - 停机号码需要额外补缴欠费后,慢充话费才能到账。此服务为虚拟充值类服务,无特殊情况不支持退款,下单前请确认充值的号码无误。 - - - 5: - 空号、错号充值后不支持退款,请您务必核对确认号码无误后再进行充值。非空号欠费可充,欠费1个月导致空号的不能充值,损失自负无法退款。 - - - - 6: - 本充值业务不提供发票。如需发票请在运营商手机客户端储开取电子发票,也可以凭身份证到运营商实体营业厅打印发票。 - - - 7: - 如遇系统维护充值失败,将72小时后原路退款到付款账户。 - - - 8: - 请登录所属运营商app(手机营业厅)查看充值号码的到账情况,如金额有出入或未到账,请截图充值记录明细反馈给客服。录明细反馈给客服。 - + + - - - 1: - - 充值后6小时内到账,请耐心等待;如遇月初、月末运营商充值压力大,充值失败后,系统会为您自动再提交一次,如二次充值仍然失败,系统将会自动为您退款至原账户,请悉知。 - - - - 2: - - 目前仅支持(移动、联通、电信三网号段),运营商黑名单号码(长期欠费或非实名制认证)携号转网空号、虚拟卡(如165167170171162等等虚拟号段)副卡号码或做过某些特殊套餐绑定的卡暂不支持充值,请勿下单。 - - - - 3: - 停机号码需要额外补缴欠费后,慢充话费才能到账。此服务为虚拟充值类服务,无特殊情况不支持退款,下单前请确认充值的号码无误。 - - - 4: - 空号、错号充值后不支持退款,请您务必核对确认号码无误后再进行充值。非空号欠费可充,欠费1个月导致空号的不能充值,损失自负无法退款。 - - - 5: - 本充值业务不提供发票。如需发票请在运营商手机客户端储开取电子发票,也可以凭身份证到运营商实体营业厅打印发票。 - - - 6: - 如遇系统维护充值失败,将72小时后原路退款到付款账户。 - - - - 7: - 请登录所属运营商app(手机营业厅)查看充值号码的到账情况,如金额有出入或未到账,请截图充值记录明细反馈给客服。录明细反馈给客服。 - + + @@ -139,7 +68,10 @@ amoutstatus: '', tabs: ["5个工作日", "6小时到账"], //切换操作 current: 0, //默认 - swiperCurrent: 2 + swiperCurrent: 2, + imagewxUrl: app.globalData.imageWxImg, + image1:'telephone1.png', + image2:'telephone2.png' } }, onLoad(options) { diff --git a/subPages/unionComfirmation/unionComfirmation.vue b/subPages/unionComfirmation/unionComfirmation.vue index 1278ed4..df3a10e 100644 --- a/subPages/unionComfirmation/unionComfirmation.vue +++ b/subPages/unionComfirmation/unionComfirmation.vue @@ -326,7 +326,6 @@ this.rechangeload(); if (this.memDiscountId == item.id) { // 如果已经选中,则取消选中 this.memDiscountId = ''; - this.reload(); this.deductionPrice = '0.00'; this.priceCaluc(this.saveprice); @@ -360,16 +359,18 @@ let pprice = parseFloat(item * 100).toFixed(0); let payprice = parseFloat(item * 100 * zkprice).toFixed(0); if (payprice > this.user.gold) { - this.availIntegal = this.user.gold; - if (this.availIntegal < this.priceValue[1]) { - this.priceValue[1] = this.user.gold; - this.reload(); - } + this.availIntegal = this.user.gold; + this.priceValue[1] = 0; + // if (this.availIntegal < this.priceValue[1]) { + // this.priceValue[1] = this.user.gold; + // this.reload(); + // } } else { this.availIntegal = payprice; this.priceValue[1] = 0; - this.reload(); - } + // this.reload(); + } + this.reload(); this.calculatepayPrice(); }, //计算支付价格 diff --git a/uni_modules/mumu-getlocation/changelog.md b/uni_modules/mumu-getlocation/changelog.md new file mode 100644 index 0000000..b3d33e4 --- /dev/null +++ b/uni_modules/mumu-getlocation/changelog.md @@ -0,0 +1,6 @@ +## 1.0.0(2022-06-09) +1. 新增 检测用户是否授权 +2. 新增 检测设置定位服务权限是否打开 +3. 优化 组件加载 +## 0.0.1(2022-01-27) +版本上线 diff --git a/uni_modules/mumu-getlocation/components/mumu-getlocation/geolocation.min.js b/uni_modules/mumu-getlocation/components/mumu-getlocation/geolocation.min.js new file mode 100644 index 0000000..32b0882 --- /dev/null +++ b/uni_modules/mumu-getlocation/components/mumu-getlocation/geolocation.min.js @@ -0,0 +1,97 @@ +// #ifdef H5 +window.qq = window.qq || {}, qq.maps = qq.maps || {}, window.soso || (window.soso = qq), soso.maps || (soso.maps = qq + .maps), qq.maps.Geolocation = function() { + "use strict"; + var e = [], + t = null, + o = 0, + n = "_geoIframe_" + Math.ceil(1e7 * Math.random()), + i = document.createElement("iframe"), + r = null, + s = null, + a = null, + c = null, + u = function(u, l) { + if (!u) return void alert("请输入key!"); + if (!l) return void alert("请输入referer!"); + var p = document.getElementById(n); + if (!p) { + i.setAttribute("id", n), i.setAttribute("allow", "geolocation"); + var g = "https:"; + i.setAttribute("src", g + "//apis.map.qq.com/tools/geolocation?key=" + u + "&referer=" + l), i + .setAttribute("style", "display: none; width: 100%; height: 30%"), document.body ? document + .body + .appendChild(i) : document.write(i.outerHTML); + var m = this; + window.addEventListener("message", function(n) { + var i = n.data; + if (i && "geolocation" == i.module) { + if (clearTimeout(c), e.length > 0) { + var u = e.shift(); + u.sucCb && u.sucCb(i) + } + o = 2, m.executeNextGeo(), t && t(i) + } else { + s = (new Date).getTime(); + var l = s - r; + if (l >= a) { + if (e.length > 0 && "geo" === e[0].type) { + var u = e.shift(), + p = { + type: "fail", + code: 5, + message: "The request" + }; + u.errCb && u.errCb(p) + } + clearTimeout(c), o = -1, m.executeNextGeo() + } + if (e.length > 0 && "ip" === e[0].type) { + var u = e.shift(); + u.errCb && u.errCb(p) + } + } + }, !1) + } + }; + return u.prototype.executeNextGeo = function() { + 1 !== o && e.length > 0 && (o = 1, e[0].geoprocess()) + }, u.prototype.getLocation = function(t, n, i) { + if (i && i.timeout) { + var r = new RegExp("^[0-9]*$"); + if (!r.test(i.timeout)) return void alert("timeout 请输入数字") + } + if (e.length > 10) throw new Error("geolocation queue must be lass than 10"); + e.push({ + sucCb: t, + errCb: n, + option: i, + geoprocess: this.getOnceLocation, + type: "geo" + }), 1 !== o && (o = 1, this.getOnceLocation()) + }, u.prototype.getOnceLocation = function() { + var t = e[0] && e[0].option; + r = (new Date).getTime(), a = t && t.timeout ? +t.timeout : 1e4, clearTimeout(c), c = setTimeout( + function() { + if (e.length > 0) { + var t = e.shift(); + t.errCb && t.errCb() + } + }, a), document.getElementById(n).contentWindow.postMessage("getLocation", "*") + }, u.prototype.getIpLocation = function(t, n) { + if (e.length > 10) throw new Error("geolocation queue mast be lass than 10"); + e.push({ + sucCb: t, + errCb: n, + geoprocess: this.getOnceIpLocation, + type: "ip" + }), 1 !== o && (o = 1, this.getOnceIpLocation()) + }, u.prototype.getOnceIpLocation = function() { + document.getElementById(n).contentWindow.postMessage("getLocation.robust", "*") + }, u.prototype.watchPosition = function(e) { + t = e, document.getElementById(n).contentWindow.postMessage("watchPosition", "*") + }, u.prototype.clearWatch = function() { + t = null, document.getElementById(n).contentWindow.postMessage("clearWatch", "*") + }, u +}(); +// #endif diff --git a/uni_modules/mumu-getlocation/components/mumu-getlocation/mumu-getlocation.vue b/uni_modules/mumu-getlocation/components/mumu-getlocation/mumu-getlocation.vue new file mode 100644 index 0000000..ba60356 --- /dev/null +++ b/uni_modules/mumu-getlocation/components/mumu-getlocation/mumu-getlocation.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/uni_modules/mumu-getlocation/package.json b/uni_modules/mumu-getlocation/package.json new file mode 100644 index 0000000..3af941b --- /dev/null +++ b/uni_modules/mumu-getlocation/package.json @@ -0,0 +1,84 @@ +{ + "id": "mumu-getlocation", + "displayName": "h5定位组件_获取精准定位_获取ip定位(可持续定位)", + "version": "1.0.0", + "description": "不需要任何 SDK 即可简单实现获取用户位置相关信息。可直接获取城市", + "keywords": [ + "定位", + "ip位置", + "持续定位", + "获取城市", + "" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "获取定位" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "n", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "n", + "阿里": "n", + "百度": "n", + "字节跳动": "n", + "QQ": "n" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/mumu-getlocation/readme.md b/uni_modules/mumu-getlocation/readme.md new file mode 100644 index 0000000..1482b12 --- /dev/null +++ b/uni_modules/mumu-getlocation/readme.md @@ -0,0 +1,107 @@ +# 插件简绍 + +## 插件原理 + +> 对腾讯地图的前端定位组件进行二次封装。[地图组件 | 腾讯位置服务 (qq.com)](https://lbs.qq.com/webApi/component/componentGuide/componentMarker) + +## 使用环境 + +**本插件只支持H5平台。因部分浏览器调用位置需要 https 环境,推荐大家还是把 https 环境配置上。** + +## 插件使用 + +**插件已支持 uni_modules 支持组件easycom,以下代码演示的是普通使用** + +``` html + + + +``` + +``` js +import mumuGetlocation from '@/uni_modules/mumu-getlocation/components/mumu-getlocation/mumu-getlocation.vue' + export default { + components: { + mumuGetlocation + }, + data() { + return { + locationRef: null, // 用于接收定位对象 + } + }, + onLoad() { + // 使用 $nextTic 等待组件加载完成调用 + this.$nextTick(() => { + // 在检测用户是否开启定位权限需要一个过程,推荐使用 login 提示一下 + uni.showLoading({ + title: '定位组件加载中...', + mask: true + }) + // 初始化组件,并且检测是否开启与授权定位 + this.$refs.muLocation.__init().then(location => { + // 用户授权了和开启了定位,把定位对象保存到 data 中 + this.locationRef = location + uni.hideLoading() + }, err => { + // 用户拒绝了定位请求,获取系统没有开启定位功能 + uni.hideLoading() + if (err.code === 1) { + uni.showModal({ + title: '获取定位权限失败', + content: '你拒绝了位置授权服务。请允许当前页面获取定位授权,后刷新页面。' + }) + } else { + uni.showModal({ + title: '获取定位权限失败', + content: '请确定手机定位已打开,并且当前浏览器允许获取定位,都开启后请刷新页面。' + }) + } + }) + + }) + }, + methods: { + // 获取精准定位 + getLocation() { + this.locationRef.getLocation() // 调用 getLocation 方法获取精准定位 + .then(res => { + // res 就是返回的数据 + uni.showModal({ + content:JSON.stringify(res, null, 4) + }) + }) + }, + } + } +``` + +## 相关 API + +### 可传属性(Props) + +无 + +### 组件内部方法(Event) + +**通过 refs 调用** + +| 方法 | 传参 | 说明 | 返回类型 | 返回数据 | +| ------ | ---- | ------------------------------------ | -------- | -------------------------- | +| __init | 无 | 初始化组件,检测用户是否开启定位权限 | 对象 | 定位对象,用于后续方法调用 | + +**定位对象属性** + +| 方法名 | 传参 | 说明 | 返回(return) | 返回数据 | +| --------------- | -------- | ------------ | -------------- | ---------------- | +| getLocation() | 无 | 获取精准定位 | Promise | 精准定位数据 | +| getIpLocation() | 无 | 获取ip定位 | Promise | 获取ip定位数据 | +| watchPosition() | function | 持续监听定位 | 数据 | 持续监听定位数据 | +| clearWatch() | 无 | 关闭持续监听 | 无 | 无 | + +## 案例演示 + +![](https://h5plugin.mumudev.top/public/getLocation/qrcode.png) + +## 支持作者 + +![支持作者](https://student.mumudev.top/wxMP.jpg) \ No newline at end of file