Commit 2a7cba6a by 颜景龙

gift领取礼物

parent 512b8d9c
......@@ -85,7 +85,7 @@
background-size: cover;
flex-direction: column;
background-position: center;
/* background-image: url(./banner.png); */
background-image: url(./banner.png);
}
.clearfix:after {
......@@ -207,6 +207,93 @@
margin-top: 1.2rem;
}
.rDialog {
position: fixed;
_position: absolute;
}
.rDialog-wrap {
position: relative;
background: #000;
opacity: .7;
background-clip: padding-box;
border-radius: 10px;
-moz-border-radius: 10px;
-o-border-radius: 10px;
-webkit-border-radius: 10px;
box-shadow: 1px 1px 1px #000;
padding: 1em 1em;
}
.rDialog-header-load {
text-align: center;
background: url("./alert-loading.gif");
background-repeat: no-repeat;
background-position: 0 0;
background-size: 100%;
width: 50px;
height: 53px;
margin: auto;
}
.rDialog-header-alert,.rDialog-header-ok {
text-align: center;
background: url("./alert-icons.png");
background-repeat: no-repeat;
background-size: 100%;
width: 50px;
height: 53px;
margin: auto;
}
.rDialog-header-alert{
background-position: 0 -53px;
}
.rDialog-header-ok {
background-position: 0 0;
}
.rDialog-content {
padding: 1em 1em;
font-size: 0.8em;
color: #FFF;
overflow: hidden;
text-align: center;
}
.rDialog-footer {
padding-left: 15px;
text-align: center;
}
.rDialog-footer a {
display: inline-block;
margin: 0 15px 15px 0;
height: 32px;
line-height: 32px;
padding: 0 30px;
font-size: 0.8em;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.rDialog-footer a: link, .rDialog-footer a: visited, .rDialog-footer a: hover {
color: #fff;
text-decoration: none;
}
.rDialog-ok,.rDialog-ok:hover {
background: #FBA733;
color: #fff;
}
.rDialog-cancel,.rDialog-cancel:hover {
background: #E6E6E6;
color: #A7A7A7;
}
.rDialog-mask {
position: fixed;
_position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: #000;
filter: alpha(opacity=30);
opacity: .3;
}
</style>
</head>
<body>
......@@ -304,7 +391,9 @@
<script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>
<script src="../js/zepto-mvalidate.js"></script>
<script type="text/javascript">
<script src="../js/zepto.alert.js"></script>
<script type="text/javascript">
var HTTP_URL = 'http://192.168.31.182:8080/wedo-fit';
//var HTTP_URL = 'http://192.168.31.217:8080/wedo';
......@@ -380,7 +469,7 @@
$('#customerUserId').val(customerUserId);
var data = result.data;
initGiftList(data.giftInfo);
$('.class-banner').css({'background-image': `url(${HTTP_URL}${data.imgPath})`});
//$('.class-banner').css({'background-image': `url(${HTTP_URL}${data.imgPath})`});
}
},
error: function(xhr, type){
......@@ -419,9 +508,19 @@
success: function(result){
if (result.code == 0) {
$("#uploadForm")[0].reset();
location.href="ydl://goback";
$.dialog({
content : '礼物领取成功',
title: 'ok',
width: 600,
time : 2000
});
} else {
alert(result.data);
$.dialog({
content : result.data,
title: 'alert',
width: 600,
time : 2000
});
}
},
error: function(xhr, type){
......
......@@ -60,6 +60,7 @@
margin: 0.5rem;
margin-top: 1.2rem;
}
</style>
</head>
<body>
......
;(function($, window, undefined) {
var win = $(window),
doc = $(document),
count = 1,
isLock = false;
var Dialog = function(options) {
this.settings = $.extend({}, Dialog.defaults, options);
this.init();
}
Dialog.prototype = {
/**
* 初始化
*/
init : function() {
this.create();
if (this.settings.lock) {
this.lock();
}
if (!isNaN(this.settings.time)&&this.settings.time!=null) {
this.time();
}
},
/**
* 创建
*/
create : function() {
var divHeader = (this.settings.title==null)?'':'<div class="rDialog-header-'+ this.settings.title +'"></div>';
// HTML模板
var templates = '<div class="rDialog-wrap">' +
divHeader +
'<div class="rDialog-content">'+ this.settings.content +'</div>' +
'<div class="rDialog-footer"></div>' +
'</div>';
// 追回到body
this.dialog = $('<div>').addClass('rDialog').css({ zIndex : this.settings.zIndex + (count++) }).html(templates).prependTo('body');
// 设置ok按钮
if ($.isFunction(this.settings.ok)) {
this.ok();
}
// 设置cancel按钮
if ($.isFunction(this.settings.cancel)) {
this.cancel();
}
// 设置大小
this.size();
// 设置位置
this.position();
},
/**
* ok
*/
ok : function() {
var _this = this,
footer = this.dialog.find('.rDialog-footer');
$('<a>', {
href : 'javascript:;',
text : this.settings.okText
}).on("click", function() {
var okCallback = _this.settings.ok();
if (okCallback == undefined || okCallback) {
_this.close();
}
}).addClass('rDialog-ok').prependTo(footer);
},
/**
* cancel
*/
cancel : function() {
var _this = this,
footer = this.dialog.find('.rDialog-footer');
$('<a>', {
href : 'javascript:;',
text : this.settings.cancelText
}).on("click",function() {
var cancelCallback = _this.settings.cancel();
if (cancelCallback == undefined || cancelCallback) {
_this.close();
}
}).addClass('rDialog-cancel').appendTo(footer);
},
/**
* 设置大小
*/
size : function() {
var content = this.dialog.find('.rDialog-content'),
wrap = this.dialog.find('.rDialog-wrap');
content.css({
width : this.settings.width,
height : this.settings.height
});
//wrap.width(content.width());
},
/**
* 设置位置
*/
position : function() {
var _this = this,
winWidth = win.width(),
winHeight = win.height(),
scrollTop = 0;
this.dialog.css({
left : (winWidth - _this.dialog.width()) / 2,
top : (winHeight - _this.dialog.height()) / 2 + scrollTop
});
},
/**
* 设置锁屏
*/
lock : function() {
if (isLock) return;
this.lock = $('<div>').css({ zIndex : this.settings.zIndex }).addClass('rDialog-mask');
this.lock.appendTo('body');
isLock = true;
},
/**
* 关闭锁屏
*/
unLock : function() {
if (this.settings.lock) {
if (isLock) {
this.lock.remove();
isLock = false;
}
}
},
/**
* 关闭方法
*/
close : function() {
this.dialog.remove();
this.unLock();
},
/**
* 定时关闭
*/
time : function() {
var _this = this;
this.closeTimer = setTimeout(function() {
_this.close();
}, this.settings.time);
}
}
/**
* 默认配置
*/
Dialog.defaults = {
// 内容
content: '加载中...',
// 标题
title: 'load',
// 宽度
width: 'auto',
// 高度
height: 'auto',
// 确定按钮回调函数
ok: null,
// 取消按钮回调函数
cancel: null,
// 确定按钮文字
okText: '确定',
// 取消按钮文字
cancelText: '取消',
// 自动关闭时间(毫秒)
time: null,
// 是否锁屏
lock: true,
// z-index值
zIndex: 9999
}
var rDialog = function(options) {
return new Dialog(options);
}
window.rDialog = $.rDialog = $.dialog = rDialog;
})(window.jQuery || window.Zepto, window);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此消息的编辑!
注册登录 后发表评论