1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- // app.js
- const login = require("./utils/login.js");
- const request = require("./utils/request.js");
- App({
- onLaunch() {
- // 自动登录
- login.autoLogin()
- this.getDistrictData()
- this.getNavBarInfo()
- },
- getDistrictData() {
- let that = this;
- request.getData(
- 'app/district/list',{},
- res => {
- wx.setStorageSync('districtData', res.data.data)
- }
- )
- },
- getNavBarInfo() {
- const that = this;
- // 获取系统信息
- const systemInfo = wx.getSystemInfoSync();
- // 胶囊按钮位置信息
- const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
- // 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
- that.globalData.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight;
- that.globalData.menuTop = menuButtonInfo.top;
- that.globalData.menuHeight = menuButtonInfo.height;
- },
- globalData: {
- navBarHeight: 0, // 导航栏高度
- menuTop: 0, // 胶囊距顶部间距(保持顶部间距一致)
- menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
- userInfo: null,
- content: '',
- imgList: [],
- selectedTagList: [],
- env: {
- uploadImageUrl: 'https://toktok-beer.oss-cn-shenzhen.aliyuncs.com/',
- AccessKeySecret: '',
- OSSAccessKeyId: '',
- securityToken: '',
- timeout: 87600
- },
- adress_select: {}
- }
- })
|