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'}); });