index.page.js
2.63 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
103
104
105
106
107
108
109
110
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
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('../plugins/tips');
require('../plugins/check');
$('.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',
onChange: function(ele, checked, value) {
$('.check-msg').html((checked ? '选中' : '取消选中') + ': ' + value);
}
});
$('.input-checkbox').check({
type: 'checkbox',
onChange: function(ele, checked, value) {
$('.check-msg').html((checked ? '选中' : '取消选中') + ': ' + value);
}
});
$(function() {
// 运行此demo
// 1. 安装 npm i -g json-server
// 2. json-server --watch mock/address.json
cascadingAddress({
el: '#address',
url: 'http://localhost:3000/areas/0',
resource: 'areas'
});
});
$('.weixin').click(function() {
if ($('.weixin-share-box').hasClass('hide')) {
$('.weixin-share-box').removeClass('hide');
} else {
$('.weixin-share-box').addClass('hide');
}
});
$('.code').qrcode({
render: 'canvas', // table方式
size: 140, // 高度
text: $('.code').data('url')// 任意内容
});