| | |
| | | "use strict"; |
| | | Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); |
| | | const common_vendor = require("./common/vendor.js"); |
| | | const api_index = require("./api/index.js"); |
| | | if (!Math) { |
| | | "./pages/index/index.js"; |
| | | "./pages/login/index.js"; |
| | | "./pages/userInfo/index.js"; |
| | | "./pages/functionList/balanceRecord/index.js"; |
| | | "./pages/functionList/paymentRecord/index.js"; |
| | | "./pages/functionList/rechargeRecord/index.js"; |
| | | "./pages/functionList/share/cardShare/index.js"; |
| | | "./pages/functionList/share/shareConfirm/index.js"; |
| | | "./pages/functionList/share/shareList/index.js"; |
| | | "./pages/scanWater/index.js"; |
| | | "./pages/recharge/index.js"; |
| | | "./pages/sendWater/index.js"; |
| | | "./pages/preSendWater/index.js"; |
| | | "./pages/address/index.js"; |
| | | "./pages/addressLocate/index.js"; |
| | | "./pages/success/index.js"; |
| | | "./pages/facilityList/index.js"; |
| | | "./pages/station/index.js"; |
| | | "./pages/infoBreakdown/index.js"; |
| | | "./pages/scanRecharge/index.js"; |
| | | "./pages/scanSuccess/index.js"; |
| | | "./pages/counterRecharge/index.js"; |
| | | } |
| | | const _sfc_main = { |
| | | __name: "App", |
| | | setup(__props) { |
| | | common_vendor.onLaunch(() => { |
| | | console.log("App Launch"); |
| | | function wxLogin() { |
| | | if (!common_vendor.index.getStorageSync("openId")) { |
| | | common_vendor.wx$1.login({ |
| | | success: async (res1) => { |
| | | common_vendor.index.setStorageSync("code", res1.code); |
| | | await api_index.wxLoginApi({ code: res1.code }).then((res2) => { |
| | | common_vendor.index.setStorageSync("openId", res2.data.userId); |
| | | common_vendor.index.setStorageSync("token", res2.data.token); |
| | | }); |
| | | }, |
| | | fail: (e) => { |
| | | common_vendor.index.showToast({ |
| | | title: "登录失败,请退出重试!", |
| | | duration: 2e3 |
| | | }); |
| | | console.log(e); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | let userLocation = { |
| | | lat: "", |
| | | lon: "" |
| | | }; |
| | | function getUserLocation() { |
| | | common_vendor.index.authorize({ |
| | | scope: "scope.userLocation", |
| | | success() { |
| | | console.log("成功授权位置信息1"); |
| | | storageLocation(); |
| | | }, |
| | | fail() { |
| | | console.log("用户拒绝授权位置信息,再次提示用户授权"); |
| | | showToast(); |
| | | } |
| | | }); |
| | | function storageLocation() { |
| | | common_vendor.index.getLocation({ |
| | | type: "gcj02", |
| | | isHighAccuracy: true, |
| | | success: (res) => { |
| | | userLocation.lat = res.latitude; |
| | | userLocation.lon = res.longitude; |
| | | common_vendor.index.setStorageSync("userLocation", JSON.stringify(userLocation)); |
| | | }, |
| | | fail: () => { |
| | | showToast(); |
| | | } |
| | | }); |
| | | } |
| | | function showToast() { |
| | | common_vendor.index.showModal({ |
| | | title: "请求授权当前位置", |
| | | content: "我们需要获取地理位置信息,为您获取附近站点信息!", |
| | | confirmText: "前往设置", |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | common_vendor.index.openSetting({ |
| | | success: (res1) => { |
| | | if (res1.authSetting["scope.userLocation"]) { |
| | | console.log("用户二次授权成功"); |
| | | storageLocation(); |
| | | } else { |
| | | showToast(); |
| | | console.log("用户拒绝授权"); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | common_vendor.index.showToast({ |
| | | title: "请先授权!", |
| | | duration: 2e3, |
| | | icon: "none" |
| | | }); |
| | | showToast(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | common_vendor.onLaunch(async () => { |
| | | await wxLogin(); |
| | | await getUserLocation(); |
| | | }); |
| | | common_vendor.onShow(() => { |
| | | console.log("App Show"); |
| | |
| | | }; |
| | | } |
| | | }; |
| | | const navbar = () => "./components/navbar/navbar.js"; |
| | | const DaTree = () => "./components/da-tree/index.js"; |
| | | function createApp() { |
| | | const app = common_vendor.createSSRApp(_sfc_main); |
| | | app.component("navbar", navbar).component("DaTree", DaTree); |
| | | return { |
| | | app |
| | | }; |