diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 8d19cd7..bdae802 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,26 +1,6 @@ const install = (Vue, vm) => { - - // Vue.prototype.$u.http.setConfig({ - - // baseURL: 'https://yruibao.com/admin', - - // // baseUrl: 'http://192.168.10.104:8088', - // method: 'POST', - // // 设置为json,返回后会对数据进行一次JSON.parse() - // dataType: 'json', - // showLoading: true, // 是否显示请求中的loading - // loadingText: '...', // 请求loading中的文字提示 - // loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms - // originalData: false, // 是否在拦截器中返回服务端的原始数据 - // loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透 - // // 配置请求头信息 - // header: { - // 'content-type': 'application/json;charset=UTF-8', - - // }, - // }); Vue.prototype.$u.http.setConfig({ - baseUrl: 'http://192.168.2.23/dev-api', + baseUrl: 'http://192.168.2.243:3100/dev-api', // baseUrl: 'https://znb.ccttiot.com', loadingText: '努力加载中~', loadingTime: 800, @@ -34,23 +14,7 @@ const install = (Vue, vm) => { // 请求拦截部分,如配置,每次请求前都会执行 Vue.prototype.$u.http.interceptor.request = (config) => { - // 引用token - // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式 - // 见:https://uviewui.com/components/globalVariable.html - // config.header.token = vm.token; - - // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 - // config.header.token = vm.$store.state.token; - - // 方式三,如果token放在了globalData,通过getApp().globalData获取 - - // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 - // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 const token = uni.getStorageSync('token'); - - // const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImE1ZmE2YzM0LWM0Y2YtNGEwMS05YjY2LTE1M2M4YWY1YzU1YSJ9.Wze_tAjY7cCfw2K6mtDpTSd-QFLRF4A49Fx7bq7g2tVLKL4v5bqqHfpG0VQy7_a_CUQch5RPBTBIKMVCDupIqg" - - // console.log("我是token", token) config.header.Authorization = token; // config.header.Tenant-Id=1 // #ifdef H5 @@ -67,42 +31,10 @@ const install = (Vue, vm) => { // 响应拦截,如配置,每次请求结束都会执行本方法 Vue.prototype.$u.http.interceptor.response = (res) => { - // if(res.code == 10022 || res.code == 10023) { - // // res为服务端返回值,可能有code,result等字段 - // // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 - // // 如果配置了originalData为true,请留意这里的返回值 - // uni.redirectTo({ - // url:"/pages/login/login", - // fail:function(mes){ - // console.log(mes) - // }, - // success:function(mes){ - // console.log(mes) - // } - // }) - // // return res.result; - // } if(res.code == 401) { - // res为服务端返回值,可能有code,result等字段 - // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 - // 如果配置了originalData为true,请留意这里的返回值 - - // return res.result; - uni.login({ success: function(ret) { console.log("main.js==>res", ret) - // vm.$u.post('/user/login',{"js_code": ret.code}).then(res=>{ - // if (res.code == 10003) { - // // console.log("新用户登录") - // uni.setStorageSync('token', res.data); - - // } else if (res.code == 200) { - // // console.log("老用户登录",res.data) - // uni.setStorageSync('token', res.data); - - // } - // }); } }); wx.login({ @@ -134,19 +66,6 @@ const install = (Vue, vm) => { } return res; - // else if(res.code == 201) { - // // 假设201为token失效,这里跳转登录 - // vm.$u.toast('验证失败,请重新登录'); - // setTimeout(() => { - // // 此为uView的方法,详见路由相关文档 - // vm.$u.route('/pages/user/login') - // }, 1500) - // return false; - // } else { - // // 如果返回false,则会调用Promise的reject回调, - // // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 - // return false; - // } } } diff --git a/manifest.json b/manifest.json index 58d727e..69005af 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,13 @@ "delay" : 0 }, /* 模块配置 */ - "modules" : {}, + "modules" : { + "Geolocation" : {}, + "Maps" : {}, + "Payment" : {}, + "Barcode" : {}, + "Camera" : {} + }, /* 应用发布信息 */ "distribute" : { /* android打包配置 */ @@ -43,7 +49,28 @@ /* ios打包配置 */ "ios" : {}, /* SDK配置 */ - "sdkConfigs" : {} + "sdkConfigs" : { + "geolocation" : { + "baidu" : { + "__platform__" : [ "ios", "android" ], + "appkey_ios" : "", + "appkey_android" : "" + } + }, + "maps" : { + "baidu" : { + "appkey_ios" : "", + "appkey_android" : "" + } + }, + "payment" : { + "weixin" : { + "__platform__" : [ "ios", "android" ], + "appid" : "wx0fec9148db16a4bc", + "UniversalLinks" : "" + } + } + } } }, /* 快应用特有相关 */ @@ -51,9 +78,10 @@ /* 小程序特有相关 */ "mp-weixin" : { "libVersion" : "latest", - "appid" : "wx3914d4d7441fb438", + "appid" : "wxbbe52b5414ab65ac", "setting" : { - "urlCheck" : false + "urlCheck" : false, + "minified" : true }, "usingComponents" : true, "optimization" : { @@ -63,7 +91,8 @@ "scope.userLocation" : { "desc" : "获取位置查看周围的充电宝设备" } - } + }, + "requiredPrivateInfos" : [ "getLocation", "chooseAddress", "chooseLocation" ] }, "mp-alipay" : { "usingComponents" : true diff --git a/page_user/about.vue b/page_user/about.vue new file mode 100644 index 0000000..27033f8 --- /dev/null +++ b/page_user/about.vue @@ -0,0 +1,92 @@ + + + + + \ No newline at end of file diff --git a/page_user/ditu.vue b/page_user/ditu.vue new file mode 100644 index 0000000..dcbe8a5 --- /dev/null +++ b/page_user/ditu.vue @@ -0,0 +1,393 @@ + + + + + \ No newline at end of file diff --git a/page_user/hezuo/index.vue b/page_user/hezuo/index.vue new file mode 100644 index 0000000..a726edf --- /dev/null +++ b/page_user/hezuo/index.vue @@ -0,0 +1,155 @@ + + + + + \ No newline at end of file diff --git a/page_user/jifei.vue b/page_user/jifei.vue new file mode 100644 index 0000000..8eac787 --- /dev/null +++ b/page_user/jifei.vue @@ -0,0 +1,249 @@ + + + + + \ No newline at end of file diff --git a/page_user/shopdetail.vue b/page_user/shopdetail.vue new file mode 100644 index 0000000..5bcfc67 --- /dev/null +++ b/page_user/shopdetail.vue @@ -0,0 +1,228 @@ + + + + + \ No newline at end of file diff --git a/page_user/shopedit.vue b/page_user/shopedit.vue new file mode 100644 index 0000000..57ae2ce --- /dev/null +++ b/page_user/shopedit.vue @@ -0,0 +1,164 @@ + + + + + \ No newline at end of file diff --git a/page_user/shuju/index.vue b/page_user/shuju/index.vue index 4162608..24c238f 100644 --- a/page_user/shuju/index.vue +++ b/page_user/shuju/index.vue @@ -8,10 +8,10 @@ 流水分析 - + 门店收益 @@ -33,11 +33,15 @@ methods: { btnpage(num){ if(num == 1){ - + uni.navigateTo({ + url:'/page_user/shuju/lsfx' + }) }else if(num == 2){ }else if(num == 3){ - + uni.navigateTo({ + url:'/pages/income/index' + }) } } } @@ -66,13 +70,14 @@ background: #FFFFFF; border-radius: 24rpx 24rpx 24rpx 24rpx; display: flex; - justify-content: space-between; + // justify-content: space-between; padding: 54rpx 78rpx; box-sizing: border-box; margin: auto; .lisy_val{ width: 94rpx; text-align: center; + margin-right: 60rpx; image{ width: 48rpx; height: 48rpx; diff --git a/page_user/shuju/lsfx.vue b/page_user/shuju/lsfx.vue new file mode 100644 index 0000000..fe2a4b8 --- /dev/null +++ b/page_user/shuju/lsfx.vue @@ -0,0 +1,209 @@ + + + + + \ No newline at end of file diff --git a/page_user/yajin/index.vue b/page_user/yajin/index.vue new file mode 100644 index 0000000..7f9c9b3 --- /dev/null +++ b/page_user/yajin/index.vue @@ -0,0 +1,395 @@ + + + + + \ No newline at end of file diff --git a/pages.json b/pages.json index da42899..93e504d 100644 --- a/pages.json +++ b/pages.json @@ -406,10 +406,68 @@ "enablePullDownRefresh": false, "navigationStyle": "custom" } + },{ + "path": "shuju/lsfx", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "ditu", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "yajin/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "shopdetail", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "shopedit", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "jifei", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "hezuo/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + },{ + "path": "about", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } } + + // 其他 userpages 目录下的页面... ] } diff --git a/pages/agentpages/shopguanli/myshop/index.vue b/pages/agentpages/shopguanli/myshop/index.vue index 4aeaaf9..e47bbbc 100644 --- a/pages/agentpages/shopguanli/myshop/index.vue +++ b/pages/agentpages/shopguanli/myshop/index.vue @@ -10,17 +10,17 @@ - + 星途自助台球棋 牌室 - + + 计费规则 - + @@ -64,7 +64,16 @@ } }, methods: { - + btnxq(){ + uni.navigateTo({ + url:'/page_user/shopdetail' + }) + }, + btnjifei(){ + uni.navigateTo({ + url:'/page_user/jifei' + }) + } } } @@ -164,7 +173,7 @@ padding-bottom: 12rpx; box-sizing: border-box; .tit{ - width: 236rpx; + width: 350rpx; background: #DBFAED; border-radius: 16rpx 16rpx 16rpx 16rpx; font-weight: 600; @@ -174,7 +183,7 @@ box-sizing: border-box; } .bd{ - margin-top: 28rpx; + margin-top: 18rpx; height:100%; font-size: 20rpx; color: #FFFFFF; @@ -184,7 +193,7 @@ border-radius: 6rpx 6rpx 6rpx 6rpx; } .yuan{ - margin-top: 20rpx; + margin-top: 10rpx; } } } diff --git a/pages/agentpages/user/index.vue b/pages/agentpages/user/index.vue index 9f4c681..fe6b332 100644 --- a/pages/agentpages/user/index.vue +++ b/pages/agentpages/user/index.vue @@ -50,14 +50,14 @@ - + @@ -249,7 +249,7 @@ margin: auto; padding: 18rpx 54rpx; box-sizing: border-box; - height: 290rpx; + height: 240rpx; background: #FFFFFF; box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); border-radius: 34rpx 34rpx 34rpx 34rpx; diff --git a/pages/income/index.vue b/pages/income/index.vue index 3d5c2f4..cdd4d5f 100644 --- a/pages/income/index.vue +++ b/pages/income/index.vue @@ -23,7 +23,8 @@ 店铺名称 - ¥收益金额(元) + ¥收益金额(元) + diff --git a/pages/index/index.vue b/pages/index/index.vue index 34d73c5..ce500c0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -9,8 +9,8 @@ - + @@ -33,7 +33,7 @@ - + 扫码充电 @@ -57,12 +57,34 @@ }, dateindex: 1, - latitude: 27.109017527965676, // 初始纬度 - longitude: 120.25287434763894, // 初始经度 + latitude: '', // 初始纬度 + longitude: '', // 初始经度 covers: [], // 覆盖物数组 + jinweidu: '' }; }, methods: { + scanQRCode() { + uni.navigateTo({ + url: '/page_user/yajin/index' + }) + // uni.scanCode({ + // onlyFromCamera: true, + // scanType: ['qrCode'], + // success: res => { + // console.log('扫描结果:', res); + // }, + // fail: err => { + // console.error('扫描失败:', err); + // uni.showToast({ + // title: '扫描失败', + // icon: 'none' + // }); + // } + // }); + }, + + btnindex(num) { if (num == 2) { uni.navigateTo({ @@ -91,86 +113,74 @@ } else if (num == 4) { - } + } }, getMyLocation() { - const self = this; uni.getLocation({ type: 'wgs84', success: (res) => { console.log('我的位置:', res); - self.latitude = res.latitude; - self.longitude = res.longitude; - // 创建表示当前位置的覆盖物对象 - const myLocationCover = { - latitude: res.latitude, - longitude: res.longitude, - width: 20, - height: 40, - iconPath: '../../static/image/icon1.png' // 替换为你的图标路径 - }; - // 将当前位置的覆盖物添加到covers数组中 - self.covers.push(myLocationCover); - // 如果需要刷新地图或覆盖物,可以在这里调用相应的方法 + this.latitude = res.latitude; + this.longitude = res.longitude; + this.jinweidu = this.longitude + ',' + this.latitude; + // 请求附近的店铺 + this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then( + res => { + if (res.code == 200) { + res.data.forEach(item => { + const shopCover = { + id: parseFloat(item.storeId), + latitude: item.lat, + longitude: item.lng, + width: 25, + height: 30, + iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uI3B6yPwtiUBD3vafLtw' + }; + this.covers.push(shopCover); + }); + } + }) }, fail: (err) => { console.error('获取位置失败:', err); } }); }, - // 假设这个方法用于初始化其他覆盖物(如充电宝图标) - initOtherCovers() { - this.covers = [{ - latitude: 27.1040175279, - longitude: 120.22287435634, - width: 40, - height: 50, - iconPath: '../../static/image/tb.png' + // 未登录调静默获取token + jmlogin() { + let taht = this + wx.login({ + success(res) { + if (res.code) { + let data = { + loginCode: res.code, + }; + taht.$u.post('/app/auth/wxLogin', data).then(res => { + if (res.code == 10003) { + // uni.navigateTo({ + // url: '/pages/login/login' + // }) + } else if (res.code == 200) { + uni.setStorageSync('token', res.token); + taht.getMyLocation() + } + }); + } }, - { - latitude: 27.10801752796, - longitude: 120.26287434763, - width: 40, - height: 50, - iconPath: '../../static/image/tb.png' - } - ]; + }) }, - handleMapClick(e) { - const { - latitude, - longitude - } = e.detail; - const clickedCover = this.covers.find(cover => { - // 假设覆盖物是以其中心点为基准的矩形 - const left = cover.longitude - cover.width / 2; - const right = cover.longitude + cover.width / 2; - const top = cover.latitude + cover.height / 2; - const bottom = cover.latitude - cover.height / 2; - - // 检查点击的经纬度是否在覆盖物的矩形范围内 - return longitude >= left && longitude <= right && latitude >= bottom && latitude <= top; - }); - - if (clickedCover) { - uni.showToast({ - title: `点击了店铺`, - icon: 'success', - duration: 2000 - }); - } else { - uni.showToast({ - title: '点击了地图其他位置', - icon: 'none', - duration: 2000 - }); - } + handleMapClick(event) { + console.log(event); + const markerId = event.markerId; + uni.navigateTo({ + url: '/page_user/ditu?markerId=' + markerId + }) }, + }, mounted() { - this.initOtherCovers(); // 初始化其他覆盖物 this.getMyLocation(); // 获取并设置自身位置的覆盖物 } }; diff --git a/pages/login/login.vue b/pages/login/login.vue index 3c311d6..c970629 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -10,7 +10,10 @@ 授权登录 - + + + + 我已同意并阅读《服务条款》《法律条款及隐私政策》 @@ -21,12 +24,13 @@ data() { return { bgc: { - backgroundColor: "#fff", + backgroundColor: "#25CE88", }, tittxt:"登录", chooseType:true, usertype:'', - login:false + login:false, + checked:false } }, methods: { @@ -49,8 +53,7 @@ if (res.code) { console.log('登录!', res); let data = { - wxOpenId: res.code, - userType: that.usertype, + loginCode: res.code, mobileCode: e.detail.code, }; resolve(data); @@ -67,14 +70,8 @@ wxLoginAsync() .then(async (data) => { this.$u.post("/app/auth/wxLogin",data).then((res) => { - - - - - // this.$forceUpdate() if (res.code == 200) { - console.log(res,'resres'); - wx.setStorageSync('token', res.token); + uni.setStorageSync('token', res.token); that.ceshi() } }); @@ -84,7 +81,7 @@ console.error(err); }); }, - async ceshi() { + ceshi() { this.$u.get("/app/user/userInfo").then((res) => { console.log('进入跳转'); uni.switchTab({ @@ -119,7 +116,7 @@ margin-top: 200rpx; width: 586rpx; height: 90rpx; - background: #4C97E7; + background: #25CE88; border-radius: 54rpx 54rpx 54rpx 54rpx; font-weight: 500; font-size: 40rpx; @@ -132,12 +129,8 @@ align-items: center; justify-content: center; font-weight: 400; - font-size: 20rpx; + font-size: 24rpx; color: #979797; - image{ - width: 26rpx; - height: 26rpx; - } } diff --git a/pages/nearbystores/index.vue b/pages/nearbystores/index.vue index 73c7423..78d29b3 100644 --- a/pages/nearbystores/index.vue +++ b/pages/nearbystores/index.vue @@ -1,34 +1,31 @@