index.js
1.61 KB
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
var base = require('./public/base');
var Login = require('./public/login');
var Goto = require('./public/goto');
var wxCtrl = require('./public/share');
var lazyLoad = require('./public/lazyLoad');
var common = require('./utils/common');
var dialoger = require('./utils/dialoger');
var Promotion = require('./public/promotion');
var node = require('./utils/element');
var indiv = require('./public/individuation');
require('./css/featuretip.scss'); //eslint-disable-line
var env = base.env();
var loginUrl = base.loginUrl();
var login = new Login({loginUrl: loginUrl, env: env});
var goto = new Goto(env);
var wx = new wxCtrl();
var authList = document.querySelectorAll('.auth');
var couponList = document.querySelectorAll('.yoho-conpon');
var redList = document.querySelectorAll('.yoho-redenvelope');
var source = document.querySelectorAll('.product-source');
if (authList.length || couponList.length || redList.length) {
base.getUser().then(function (user) {
authList.length && login.auth(authList, user);
couponList.length && Promotion.Coupon(couponList, user);
redList.length && Promotion.RedEnvelope(redList, user);
source.length && indiv(source, user, env);
})
}
module.exports = {
goLogin: login.goLogin.bind(login),
getUser: base.getUser,
env: env,
link: goto.link.bind(goto),
goBack: goto.goBack.bind(goto),
wxShare: wx.wxShare.bind(wx),
wxSignature: wx.wxSignature,
getQueryObj: common.getQueryObj,
invokeMethod: common.invokeMethod,
lazyload: lazyLoad,
tip: dialoger.showTip,
toast: dialoger.toast,
favourite: Promotion.favourite,
$: node
};