index.page.js
2.47 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
common = require('../common'),
dialog = require('../plugins/dialog');
var _dialog = dialog.Dialog,
_alert = dialog.Alert,
_confirm = dialog.Confirm;
var cascadingAddress = require('../plugins/cascading-address');
var tips = $('#tips');
var change = $('#change');
var show = false;
require('yoho-jquery-qrcode');
require('yoho-jquery-nanoscroller');
require('../plugins/tips');
require('../plugins/check');
require('../plugins/share');
$('.nano').nanoScroller();
$('.alert-btn').click(function() {
new _alert('购买成功<br>进入 个人中心>我的订单<br>查看门票信息').show();
});
$('.confirm-btn').click(function() {
new _confirm({
content: '确定要删除?',
cb: function() {
console.log('您点击了confirm确认');
}
}).show();
});
$('.dialog-btn').click(function() {
var tip = new _dialog({
className: 'settled-success',
content: '<h1 class="main-title">恭喜您已提交成功</h1><h2 class="sub-title">我们将尽快与您联系</h2>',
btns: [
{
id: 'apply',
btnClass: ['apply'],
name: '订阅',
cb: function() {
tip.close();
}
},
{
id: 'cancel',
btnClass: ['cancel'],
name: '取消订阅',
cb: function() {
tip.close();
}
}
]
}).show();
});
lazyLoad($('img.lazy'));
change.click(function() {
'use strict';
if (show) {
tips.tips('hide');
show = false;
} else {
tips.tips('show', '×该用户已存在');
show = true;
}
});
// check
$('.input-radio').check({
type: 'radio',
group: 'gender',
onChange: function(ele, checked, value) {
$('.check-msg').html((checked ? '选中' : '取消选中') + ': ' + value);
}
});
$('.input-checkbox').check({
type: 'checkbox',
group: 'gender2',
onChange: function() {
var checked = $('.input-checkbox').check('getChecked');
$('.check-msg').html('选中: ' + JSON.stringify(checked.values));
}
});
$(function() {
// 运行此demo
// 1. 安装 npm i -g json-server
// 2. json-server --watch mock/address.json
common.setCookie('uid', '8050484');
window.add = cascadingAddress({el: '#address'});
});