diff --git a/components/stationItem/stationItem.vue b/components/stationItem/stationItem.vue index 801a414..f02cbc4 100644 --- a/components/stationItem/stationItem.vue +++ b/components/stationItem/stationItem.vue @@ -57,7 +57,7 @@ }; }, created() { - console.log(this.data.tags, 'data.tags') + // console.log(this.data.tags, 'data.tags') }, methods: { goDetails() { diff --git a/pages/index/index.vue b/pages/index/index.vue index 23d6150..db78035 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -17,7 +17,7 @@ import ChargingStation from "../ChargingStation/index.vue" import order from "../order/index.vue" import personal from "../personal/index.vue" - import x from "./index.js" + import x from "./index.js" export default { components: { tabBar, @@ -36,69 +36,71 @@ } }, watch: { - tabBarIndex(n,o) { + tabBarIndex(n, o) { let that = this - if(n==1){ + if (n == 1) { this.$refs.ChargingStation.onshow() - }else if(n==2){ + } else if (n == 2) { this.readyScanCode({ - success(){ + success() { that.scanCode(); }, - fail(){ - if(n!==o) that.tabBarIndex = o; - if(n==o) that.tabBarIndex=0; + fail() { + if (n !== o) that.tabBarIndex = o; + if (n == o) that.tabBarIndex = 0; } }) - - } + + } } }, created() { this.init() }, onLoad() { - this.onOrderUpdate(); + this.onOrderUpdate(); }, - onShow() { + onShow() { this.showInit() }, methods: { - readyScanCode({success,fail}){ - if(!this.user){ + readyScanCode({ + success, + fail + }) { + if (!this.user) { uni.showModal({ title: '提示', content: '登录后才可扫码下单哦', - confirmText:'去登陆', - success: function (res) { - if (res.confirm) { + confirmText: '去登陆', + success: function(res) { + if (res.confirm) { uni.reLaunch({ url: '/pages/login/index' }) - } else if (res.cancel) { + } else if (res.cancel) { fail() } } - }); + }); return } - try{ + try { success() - }catch(e){ - fail() + } catch (e) { + fail() } }, async scanCode() { - - let res = await this.tool.scanCode().catch(err=>{ - console.log('取消'); - this.tabBarIndex = 0 + let res = await this.tool.scanCode().catch(err => { + // console.log('取消'); + this.tabBarIndex = 0 }); - if (res?.result) { - let routingParameter = this.tool.routingParameterGeneration({ - type:'qrCode', - qrCode:encodeURIComponent(res.result), - pointTo:'activeScanCode' + if (res?.result) { + let routingParameter = this.tool.routingParameterGeneration({ + type: 'qrCode', + qrCode: encodeURIComponent(res.result), + pointTo: 'activeScanCode' }) uni.navigateTo({ url: `/ChargingStation/pages/placeOrder/index${routingParameter}` @@ -114,8 +116,8 @@ }) }, showInit() { - this.tool.getCards(); - if(this.tabBarIndex==2){ + this.tool.getCards(); + if (this.tabBarIndex == 2) { this.tabBarIndex = 0 } }, diff --git a/pages/startPage/index.vue b/pages/startPage/index.vue index 93fbb23..36f0335 100644 --- a/pages/startPage/index.vue +++ b/pages/startPage/index.vue @@ -16,12 +16,12 @@ this.init(e) }, created() { - this.imgURL = `${this.baseImgURL}/start.png` + this.imgURL = `${this.baseImgURL}/start-color.png` }, methods: { Interceptor(id) { let taht = this - console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px'); + // console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px'); wxCode.getQrCodeType({ qrCode: id }).then(res => { @@ -46,6 +46,7 @@ uni.redirectTo({ url:'/pages/index/index' }) + // uni.redirectTo({ // url:'/pages/login/index' // }) diff --git a/static/Scan.png b/static/Scan.png index cc6ff9e..5489fff 100644 Binary files a/static/Scan.png and b/static/Scan.png differ diff --git a/static/logo.png b/static/logo.png index 99cbbd7..9a2bb06 100644 Binary files a/static/logo.png and b/static/logo.png differ diff --git a/static/select-ChargingStation.png b/static/select-ChargingStation.png index 4b5da58..f0aee8b 100644 Binary files a/static/select-ChargingStation.png and b/static/select-ChargingStation.png differ diff --git a/static/select-Personal.png b/static/select-Personal.png index b043d5b..f2e70bc 100644 Binary files a/static/select-Personal.png and b/static/select-Personal.png differ diff --git a/static/select-home.png b/static/select-home.png index 52ea3eb..925e86f 100644 Binary files a/static/select-home.png and b/static/select-home.png differ diff --git a/static/select-order.png b/static/select-order.png index aec63a1..426c6d9 100644 Binary files a/static/select-order.png and b/static/select-order.png differ diff --git a/utils/tool.js b/utils/tool.js index df3cc49..d62d72a 100644 --- a/utils/tool.js +++ b/utils/tool.js @@ -15,7 +15,7 @@ class Anticorrosive { this.configure = configure; return this.chenk(); } - + // 递归 生成数据结构 generate(data, configure) { // 通过传入的源数据生成相应的数据结构 @@ -101,19 +101,19 @@ class Anticorrosive { export default { Anticorrosive, - getPhone(e){ - return new Promise((re,rj)=>{ + getPhone(e) { + return new Promise((re, rj) => { const data1 = { ...e.detail, sessionKey: uni.getStorageSync('sessionKey'), unionId: uni.getStorageSync('unionid'), openId: uni.getStorageSync('openid'), appId: 'wxed3e2914d6aa4d52' - }; - oilIdentityApi.ackPhone(data1).then(resj => { + }; + oilIdentityApi.ackPhone(data1).then(resj => { re(resj.data) }); - }) + }) }, async WXlogin(e) { return new Promise((re, rj) => { @@ -141,16 +141,16 @@ export default { title: '微信登录失败提醒', content: `${res.msg}如有疑问,请联系客服处理` }) - + } }).catch(err => { uni.showToast({ title: '登陆失败', icon: 'none' }) - + }) - + }, fail: err => {}, }) @@ -216,11 +216,12 @@ export default { } } }, - userLocationChenk(){ - return new Promise((re,rj)=>{ + userLocationChenk() { + return new Promise((re, rj) => { wx.getSetting({ success(res) { - if (typeof(res.authSetting['scope.userLocation']) != 'undefined' && !res.authSetting[ + if (typeof(res.authSetting['scope.userLocation']) != 'undefined' && !res + .authSetting[ 'scope.userLocation']) { // 用户没有授权 uni.showModal({ @@ -246,41 +247,41 @@ export default { rj('openSetting调用失败') } }) - }else{ + } else { rj('取消授权') } } }) - }else{ + } else { re() } }, - fail(err){ + fail(err) { rj(err) } }) - }) + }) }, - ReverseAddress(latitude,longitude){ + ReverseAddress(latitude, longitude) { const qqmapsdk = new QQMapWX({ key: 'NYEBZ-YURY3-XTU3N-YBR54-PKW6E-ROB2F' }); - return new Promise((re,rj)=>{ + return new Promise((re, rj) => { qqmapsdk.reverseGeocoder({ location: { - latitude:latitude, + latitude: latitude, longitude: longitude }, - success(addressRes){ - re(addressRes) + success(addressRes) { + re(addressRes) }, - fail(err){ + fail(err) { rj(err) } }) }) - - + + }, getLocation() { return new Promise((re, rj) => { @@ -296,16 +297,16 @@ export default { latitude: res.latitude, longitude: res.longitude }, - success(addressRes){ - var address = addressRes.result.formatted_addresses.recommend; - let location = { - ...res, - address - } - uni.setStorageSync('location',location ); - re(location) + success(addressRes) { + var address = addressRes.result.formatted_addresses.recommend; + let location = { + ...res, + address + } + uni.setStorageSync('location', location); + re(location) }, - fail(err){ + fail(err) { rj(err) } }) @@ -318,33 +319,33 @@ export default { }) }, - routingParameterGeneration(parameter){ - if(parameter==null||parameter==undefined) return; + routingParameterGeneration(parameter) { + if (parameter == null || parameter == undefined) return; const parameterType = typeof parameter; - if( parameterType== 'string'){ + if (parameterType == 'string') { let obj = {}; - let splitParameter = parameter.split('?'); - if(splitParameter.length<=1){ + let splitParameter = parameter.split('?'); + if (splitParameter.length <= 1) { console.warn("暂无路径参数"); return - } - splitParameter[1].split('&').forEach(item=>{ - if(item.indexOf('=')!==-1){ - let splitItem = item.split('=') - obj[splitItem[0]] = splitItem[1] - }else{ - console.warn("error"); - console.log(item) + } + splitParameter[1].split('&').forEach(item => { + if (item.indexOf('=') !== -1) { + let splitItem = item.split('=') + obj[splitItem[0]] = splitItem[1] + } else { + console.warn("routingParameterGeneration error", item); + // console.log(item) } }) - return obj - }else if(parameterType == 'object'){ - let stringParameter = '?' + return obj + } else if (parameterType == 'object') { + let stringParameter = '?' let parameterEntries = Object.entries(parameter); - parameterEntries.forEach((key,index)=>{ + parameterEntries.forEach((key, index) => { let itemString = `${key[0]}=${key[1]}${ parameterEntries.length-1==index?'':'&' }`; stringParameter += itemString - }) + }) return stringParameter } }, @@ -359,7 +360,7 @@ export default { rj(err) } }); - }) + }) }, loginOut() { return new Promise((re, rj) => { @@ -523,7 +524,7 @@ export default { getnum(num, size = 2) { if (String(num).indexOf('.') == -1 || String(num).split('.')[1].length < 2) return Number(num).toFixed(size); var s = num.toString(); - var result = s.substring(0, s.indexOf(".") + 1 + size); + var result = s.substring(0, s.indexOf(".") + 1 + size); return result }, //数据转为两位小数