forked from EastWorld/wechat-app-mall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.js
executable file
·70 lines (69 loc) · 1.63 KB
/
start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const WXAPI = require('apifm-wxapi')
const CONFIG = require('../../config.js')
//获取应用实例
var app = getApp();
Page({
data: {
banners:[],
swiperMaxNumber: 0,
swiperCurrent: 0,
height: wx.getSystemInfoSync().windowHeight
},
onLoad:function(){
const _this = this
wx.setNavigationBarTitle({
title: wx.getStorageSync('mallName')
})
const app_show_pic_version = wx.getStorageSync('app_show_pic_version')
if (app_show_pic_version && app_show_pic_version == CONFIG.version) {
wx.switchTab({
url: '/pages/index/index',
});
} else {
// 展示启动页
WXAPI.banners({
type: 'app'
}).then(function (res) {
if (res.code == 700) {
wx.switchTab({
url: '/pages/index/index',
});
} else {
_this.setData({
banners: res.data,
swiperMaxNumber: res.data.length
});
}
}).catch(function (e) {
wx.switchTab({
url: '/pages/index/index',
});
})
}
},
onShow:function(){
},
swiperchange: function (e) {
//console.log(e.detail.current)
this.setData({
swiperCurrent: e.detail.current
})
},
goToIndex: function (e) {
WXAPI.addTempleMsgFormid(wx.getStorageSync('token'), 'form', e.detail.formId)
if (app.globalData.isConnected) {
wx.setStorage({
key: 'app_show_pic_version',
data: CONFIG.version
})
wx.switchTab({
url: '/pages/index/index',
});
} else {
wx.showToast({
title: '当前无网络',
icon: 'none',
})
}
}
});