123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- // app.js
- App({
- onLaunch() {
- // 展示本地存储能力
- const logs = wx.getStorageSync('logs') || []
- logs.unshift(Date.now())
- wx.setStorageSync('logs', logs)
-
- // 登录
- wx.login({
- success: res => {
- // 发送 res.code 到后台换取 openId, sessionKey, unionId
- }
- })
- },
- globalData: {
- userInfo: null,
- openid: "",
- appid: "",
- sessionKey: "",
- suiteCode: "",
- customerId: "",
- },
- // mangerUrl: 'http://test2.hhrchina.com',
- mangerUrl: "http://192.168.18.156",
- // mangerUrl: "https://www.hhrchina.com",
- // mangerUrlPath: "https://www.hhrchina.com",
-
- // 自定义显示tabbar
- onTabBar: function (key) {
- var _curPageArr = getCurrentPages();
- var _curPage = _curPageArr[_curPageArr.length - 1];
- var _pagePath = _curPage.__route__;
- if (_pagePath.indexOf('/') != 0) {
- _pagePath = '/' + _pagePath;
- }
- var tabBar = this.tabBarData[key];
- for (var i = 0; i < tabBar.list.length; i++) {
- tabBar.list[i].active = false;
- if (tabBar.list[i].pagePath == _pagePath) {
- tabBar.list[i].active = true; // 根据页面地址设置当前页面状态
- }
- }
- _curPage.setData({
- tabBar: tabBar
- });
- },
- })
|