Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

106
static/app/js/activity1.js Executable file
View File

@ -0,0 +1,106 @@
mui.plusReady(function() {
$('#bg').html('<img src="../img/activity1_head.png" />');
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), { 
data: {
typeSrc: 2
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html1 = '';
var html2 = '';
$.each(data['6'].list, function(num) {
num++;
if(num % 2 == 1) {
html1 += '<div class="bktj_b" data-goodsId="' + this.goodsId + '"><img src="../img/bktj' + num + '.png" /><div class="bktj_con clearfix"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="bktj_con_con"><p class="p3">' + this.goodsName + '</p><p class="p4">折扣到手价</p><p class="p3">¥.' + this.shopPrice + '</p><div class="ljjg_btn ljqg_btn">立即抢购</div></div></div></div>';
} else {
html1 += '<div class="bktj_b" data-goodsId="' + this.goodsId + '"><img src="../img/bktj' + num + '.png" /><div class="bktj_con clearfix"><div class="bktj_con_con"><p class="p3">' + this.goodsName + '</p><p class="p4">折扣到手价</p><p class="p3">¥.' + this.shopPrice + '</p><div class="ljjg_btn ljqg_btn">立即抢购</div></div><img src="' + hyhImgUrl(this.goodsImg) + '" /></div></div>';
}
});
$('.bktj').html(html1);
$.each(data['7'].list, function() {
html2 += '<div class="xpss_b" data-goodsId="' + this.goodsId + '"><img src="../img/xpss_bg.png" /><div class="xpss_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p5"><del>原价' + this.marketPrice + '</del>' + this.marketPrice + '</p><div class="xpss_ljqg_btn">立即抢购</div></div></div>'
});
$('.xpss').html(html2);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
//跳商品页面
$('.bktj').on('tap', '.bktj_b', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.xpss').on('tap', '.xpss_b', function() {
var goodsId = $(this).attr('data-goodsId');
console.log(goodsId)
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

0
static/app/js/activity10.js Executable file
View File

145
static/app/js/activity2.js Executable file
View File

@ -0,0 +1,145 @@
$('.title p').html('');
mui.plusReady(function() {
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), { 
data: {
typeSrc: 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html1 = '';
var html2 = '';
var html3 = '';
$.each(data['1'].list, function() {
html1 += '<div class="gchh_block" data-goodsId="' + this.goodsId + '"><img class="gchh_b_bg" src="../img/guochan_con_bg.png" /><div class="gchh_b_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div></div>'
});
$('.gchh').html(html1);
$('.title').eq(0).children('p').html(data['title_1'].name);
$.each(data['2'].list, function() {
html2 += '<div class="zdzb_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_zdzb_bg.png" /><div class="zdzb_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>' + this.goodsName + '</p><b>¥</b><span class="cost">' + this.shopPrice + '</span><div class="zdzb_btn">立即购买</div></div><img class="zdzb_zzc" src="../img/ac2_zdzb_zzc.png" /></div>'
});
$('.zdzb').html(html2);
$('.title').eq(1).children('p').html(data['title_2'].name);
$.each(data['3'].list, function() {
html3 += '<div class="zdzb3_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_ac3_bg.png" /><div class="zdzb3_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>RMB ' + this.shopPrice + '</p><img class="sanjiao" src="../img/ac2_sanjiao.png" /></div></div>';
});
$('.zdzb3').html(html3)
$('.title').eq(2).children('p').html(data['title_3'].name);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
//跳商品页面
$('.gchh').on('tap', '.gchh_block', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳商品页面
$('.zdzb').on('tap', '.zdzb_block', function() {
var goodsId = $(this).attr('data-goodsId');
console.log(goodsId)
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳商品页面
$('.zdzb3').on('tap', '.zdzb3_block', function() {
var goodsId = $(this).attr('data-goodsId');
console.log(goodsId)
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

164
static/app/js/activity3.js Executable file
View File

@ -0,0 +1,164 @@
$('.jggcj').css('display','none');
$('.time').css('display','none');
$('.title').eq(0).css('display','none');
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), { 
data: {
typeSrc: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html1 = '';
var html2 = '';
$.each(data['4'].list, function() {
html1 += '<div class="list_block" data-goodsId="' + this.goodsId + '"><img class="list_block_bg" src="../img/ac3_bg5.png" /><div class="list_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p3">' + this.goodsName + '</p><p class="p4">¥' + this.shopPrice + '</p></div></div>';
});
$('#list1').html(html1);
$.each(data['5'].list, function() {
html2 += '<div class="list_block" data-goodsId="' + this.goodsId + '"><img class="list_block_bg" src="../img/ac3_bg5.png" /><div class="list_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p3">' + this.goodsName + '</p><p class="p4">¥' + this.shopPrice + '</p></div></div>';
});
$('#list2').html(html2);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui.ajax(hyhUrl('addon/hyhlucky-Hyhlucky-getLuckyPrize'), { 
data: {
draw_id: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html = '<div class="content content-1" data-id="' + data.prize_list[0].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[0].prize_img) + '" /></div></div><div class="content content-2" data-id="' + data.prize_list[1].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[1].prize_img) + '" /></div></div><div class="content content-3" data-id="' + data.prize_list[2].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[2].prize_img) + '" /></div></div><div class="content content-8" data-id="' + data.prize_list[7].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[7].prize_img) + '" /></div></div><div class="content content-click"><div id="text"><img src="../img/ac3_button1.png" /></div></div><div class="content content-4" data-id="' + data.prize_list[3].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[3].prize_img) + '" /></div></div><div class="content content-7" data-id="' + data.prize_list[6].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[6].prize_img) + '" /></div></div><div class="content content-6" data-id="' + data.prize_list[5].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[5].prize_img) + '" /></div></div><div class="content content-5" data-id="' + data.prize_list[4].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[4].prize_img) + '" /></div></div>'
$('.cj_con').html(html);
$('.num .number').html(data.max_num)
$('.content').height($('.content').width() * 123 / 165 + 'px')
$(window).resize(function() {
$('.content').height($('.content').width() + 'px')
})
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
// $('.content').height($('.content').width() * 123 / 165 + 'px')
// $(window).resize(function() {
// $('.content').height($('.content').width() + 'px')
// })
function time(a) {
return function() {
if(a > 8) {
a = parseInt(a % 8)
if(a == 0) {
a = 8;
}
}
$('.content').removeClass('active');
$('.content-' + a).addClass('active');
$('.zz_img').toggleClass('on');
}
}
// 在旋转的时候不能再次被点击
var t = true
$('.cj_con').on('tap', '.content-click', function() {
console.log(token)
if(t) {
t = false;
// 产生随机数
var prize;
var msg = '';
mui.ajax(hyhUrl('addon/hyhlucky-Hyhlucky-luckyDraw'), {
headers: { 
"HYH-Token": token
},
data: {
draw_id: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功; 
var data = toJson(data);
console.log(data.msg)
if(data.status == 1) {
if($('.number').html() > 0) {
data = data.data;
prize = data.v;
msg = data.yes;
$('.number').html($('.number').html() - 1)
// 默认先转3圈
prize += 32
for(var i = 1; i <= prize; i++) {
setTimeout(time(i), 6 * i * i);
}
setTimeout(function() {
t = true;
alert(msg);
}, 6 * prize * prize)
} else {
alert('您没有抽奖机会了');
}
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
})
//跳商品页面
$('.list').on('tap', '.list_block', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

186
static/app/js/activity4.js Executable file
View File

@ -0,0 +1,186 @@
var scroll = mui('.con').scroll();
mui.plusReady(function() {
var autoCatId;
var num = 1;
var isOver = 1;
mui.ajax(hyhUrl('addon/hyhbrandsrec-hyhBrandsrec-getBrandList'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
var html1 = '';
$.each(data.brandlist_rec, function() {
html += '<div class="scroll_top_block" data-brandId="' + this.brandId + '"><img src="' + chengUrl(this.brandImg) + '" /><p>' + this.brandName + '</p></div>';
});
autoCatId = data.brand_list[0].catId;
$.each(data.brand_list, function() {
html1 += '<a class="mui-control-item" data-catId="' + this.catId + '">' + this.catName + '</a>';
});
$('.scroll_top').html(html);
$('.nav').html(html1);
document.getElementsByClassName('mui-control-item')[0].classList.add('mui-active')
$('.scroll_top_block').height($('.scroll_top_block').width());
$('.scroll_top_block img').height($('.scroll_top_block img').width());
getData(autoCatId, 6, 1);
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
function getData(catIdNum, pageSizeNum, pageNum) {
if(isOver == 1) {
isOver = 0;
} else {
return;
}
var autoData = {
catId: catIdNum,
pageSize: pageSizeNum ? pageSizeNum : 6,
page: pageNum ? pageNum : 1
}
mui.ajax(chengUrl('addon/hyhbrandsrec-hyhBrandsrec-getBrandCatList'), { 
data: autoData,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
if(data.Rows == '' && pageNum > 1) {
$('.scroll_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
return;
} else if(data.Rows == '') {
$('.scroll_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有商品</p>');
return;
}
$.each(data.Rows, function() {
html += '<div class="scroll_con_block" id="' + num + '"><div class="scb_title" data-shopId="' + this.shopId + '"><img src="' + chengUrl(this.shopImg) + '" /><p>' + this.shopName + '</p><span class="s1">官方旗舰店</span><span class="s2">进店看看</span></div><div class="scroll_con_con clearfix">';
$.each(this.list, function() {
html += '<div class="scc_block" data-goodsId="' + this.goodsId + '"><img src="' + this.goodsImg + '" /><p>' + this.goodsName + '</p><span>¥' + this.shopPrice + '</span></div>'
});
html += '</div></div>'
});
if(pageNum == 1) {
$('.scroll_con').html(html);
} else {
$('.scroll_con').append(html);
}
$('.scc_block img').height($('.scc_block img').width());
isOver = 1;
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
document.querySelector('.con').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isOver == 1) {
num += 1;
getData(autoCatId, 6, num);
}
}
})
mui('.nav').on('tap', '.mui-control-item', function() {
autoCatId = $(this).attr('data-catId');
num = 1;
isOver = 1;
getData(autoCatId, 6, num);
})
//跳商店页面
$('.con').on('tap', '.scb_title', function() {
var shopId = $(this).attr('data-shopId');
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html'+shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳商品页面
$('.con').on('tap', '.scc_block', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

11
static/app/js/activity5.js Executable file
View File

@ -0,0 +1,11 @@
mui.init()
mui('.con').scroll({
deceleration: 0.0005 //flick 减速系数系数越大滚动速度越慢滚动距离越小默认值0.0006
});
var slider = mui("#slider");
slider.slider({
interval: 5000
});
$('.con_o .img').height($('.con_o .img').width())
$('.con_t_block img').height($('.con_t_block img').width())

143
static/app/js/activity6.js Executable file
View File

@ -0,0 +1,143 @@
mui.plusReady(function() {
mui.ajax(chengUrl('addon/hyhactive-Hyhactive-getGoodsList'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html1 = '';
var html2 = '';
var html3 = '';
$.each(data[0].goodsInfo, function() {
html1 += '<div class="gchh_block" data-goodsId="' + this.goodsId + '"><img class="gchh_b_bg" src="../img/guochan_con_bg.png" /><div class="gchh_b_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div></div>'
});
$('#tt1 p').html(data[0].activeTypeName);
$('.gchh').html(html1);
$.each(data[1].goodsInfo, function() {
html2 += '<div class="zdzb_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_zdzb_bg.png" /><div class="zdzb_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>' + this.goodsName + '</p><b>¥</b><span class="cost">' + this.shopPrice + '</span><div class="zdzb_btn">立即购买</div></div><img class="zdzb_zzc" src="../img/ac2_zdzb_zzc.png" /></div>'
});
$('#tt2 p').html(data[1].activeTypeName);
$('.zdzb').html(html2);
$.each(data[2].goodsInfo, function() {
html3 += '<div class="zdzb3_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_ac3_bg.png" /><div class="zdzb3_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>RMB ' + this.shopPrice + '</p><img class="sanjiao" src="../img/ac2_sanjiao.png" /></div></div>';
});
$('#tt3 p').html(data[2].activeTypeName);
$('.zdzb3').html(html3)
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
//跳商品页面
$('.gchh').on('tap', '.gchh_block', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳商品页面
$('.zdzb').on('tap', '.zdzb_block', function() {
var goodsId = $(this).attr('data-goodsId');
console.log(goodsId)
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳商品页面
$('.zdzb3').on('tap', '.zdzb3_block', function() {
var goodsId = $(this).attr('data-goodsId');
console.log(goodsId)
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

281
static/app/js/activity7.js Executable file
View File

@ -0,0 +1,281 @@
$('.mui-title').html('ECT专区');
var ect_top = '<div class="ect_top"><p class="ect_m">最新价</p><p class="ect_m">24H成交量</p><img src="http://img.heyuanhui.cn/Upload/app/icon/star.png" /><p class="ect_m" id="last"></p><p class="ect_m" id="vol"></p></div>';
$('header').before(ect_top);
var time_ = '距活动开始还有<span id="_d"></span>天';
$('.mui-scroll-wrapper').removeClass('scroll_out1').addClass('scroll_out3');
var info = '<img src="http://img.heyuanhui.cn/Upload/app/icon/info.png" class="tanhao" />';
$('header').append(info);
var nav = '<div class="nav clearfix"></div>';
$('.ect_top').before(nav);
var html_con = '<div class="ten clearfix"></div><div class="title_img"></div><div class="time_"></div><div class="con_"></div>'
$('.con').html(html_con);
$('.time_').html(time_);
var nav_data = [];
var secTypeId = 0;
var timestamp1 = Date.parse(new Date());
if(timestamp1 >= 1537027200000) {
secTypeId = 4;
nav_data = [{
"secTypeId": 4,
"name": "海鲜大咖"
}, {
"secTypeId": 5,
"name": "为您推荐"
}];
} else {
secTypeId = 1;
nav_data = [{
"secTypeId": 1,
"name": "9.15元专区"
}, {
"secTypeId": 2,
"name": "满199减100"
}, {
"secTypeId": 3,
"name": "买二赠一专区"
}, {
"secTypeId": 4,
"name": "海鲜大咖"
}, {
"secTypeId": 5,
"name": "为您推荐"
}];
}
var issx = 0;
var doller = 0;
function getData(secTypeId) {
// mui('').pullRefresh().scroll(0, 0, 0);
backTop();
var data_set = {
secTypeId: secTypeId,
topTypeId: 1
};
mui.ajax(llUrl('addon/hyhlimitactive-Hyhlimitactive-frontList'), { 
data: data_set,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data, 1);
if(data.status == 1) {
data = data.data;
var html_ = '';
var htmlcon = '';
doller = data.doller;
if(data.secTypeId == 5 || data.secTypeId == 4) {
htmlcon = '<div class="ect_activity"><img src="http://img.heyuanhui.cn/static/app/img/e' + secTypeId + '.png" class="ect_hd" /></div>'
} else {
htmlcon = ''
html_ = '<div class="day"><p>此活动仅限14-15号两天</p></div>';
}
$.each(data.list, function() {
htmlcon += '<div class="ect_com" data-id="' + this.goodsId + '"><div class="com_img1" ><img src="' + hyhImgUrl(this.goodsImg) + '" /></div><p class="p1"><img src="http://img.heyuanhui.cn/static/app/img/ectb.png" class="com_img2" />' + this.goodsName + '</p><p class="p3"><l></l>CNY <o>' + this.shopPrice + '</o></p>' + html_ + '</div>';
});
$('.con_').html(htmlcon);
setTimeout(function() {
$('.com_img1').height($('.com_img1').width());
}, 200)
countTime();
} else {
console.log(data);
}
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type);      
}
}); 
}
function countTime() {
//获取当前时间
var date = new Date();
var now = date.getTime();
//设置截止时间
var endDate = new Date("2018/10/01 00:00:00");
var end = endDate.getTime();
//时间差
var leftTime = end - now;
//定义变量 d,h,m,s保存倒计时的时间
var h, m, s;
if(leftTime >= 0) {
d = Math.floor(leftTime / 1000 / 60 / 60 /24);
h = Math.floor(leftTime / 1000 / 60 / 60);
m = Math.floor(leftTime / 1000 / 60 % 60);
s = Math.floor(leftTime / 1000 % 60);
//将倒计时赋值到div中
if(d < 10) {
d = "0" + d;
}
if(h < 10) {
h = "0" + h;
}
if(m < 10) {
m = "0" + m;
}
if(s < 10) {
s = "0" + s;
}
document.getElementById("_d").innerHTML = d;
// document.getElementById("_h").innerHTML = h;
// document.getElementById("_m").innerHTML = m;
// document.getElementById("_s").innerHTML = s;
}
//递归每秒调用countTime方法显示动态时间效果
setTimeout(countTime, 1000);
}
mui.plusReady(function() {
window.addEventListener('refresh', function(e) { //执行刷新
location.reload();
});
getData(secTypeId);
var html = '';
$.each(nav_data, function() {
if(timestamp1 >= 1537027200000) {
html += '<div class="nav_block" style="width:50%;" data-secTypeId="' + this.secTypeId + '">' + this.name + '</div>';
} else {
html += '<div class="nav_block" data-secTypeId="' + this.secTypeId + '">' + this.name + '</div>';
}
});
$('.nav').html(html);
$('.nav_block').eq(0).addClass('on');
setInterval(function() {
mui.ajax('https://api.tokencan.com/exchange-open-api/open/api/get_ticker?symbol=ectusdt&random=' + Math.random(), { 
dataType: 'json', //服务器返回json格式数据
type: 'get', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
// var data = toJson(data, 1);
$('#last').html(Math.floor((+data.data.last) * doller * 100) / 100);
$('#vol').html(data.data.vol);
$('.p3').each(function(num) {
$(this).children('l').html('ECT ' + (Math.floor(+$(this).children('o').html() / (+data.data.last) / (+doller) * 100)) / 100 + '≈');
})
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type);      
}
});
}, 2000)
mui("body").on('tap', '.nav_block', function() {
secTypeId = this.attributes["data-secTypeId"].nodeValue;
$(this).addClass('on').siblings().removeClass('on');
getData(secTypeId)
})
mui(".con").on('tap', '.ect_com', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
var data_id = this.attributes["data-id"].nodeValue;
var isEct = 1;
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'details.html',
id: 'details.html' + data_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id,
isEct: isEct
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
// if(isjiazai == 1) {
// page++;
// }
} else if(scroll.y > 100 && issx == 0) {
issx = 1;
setTimeout(function() {
location.reload()
}, 1000)
}
})
$('header').on('tap', '.tanhao', function() {
mui.openWindow({
url: 'activity8.html',
id: 'activity8.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
});
})

31
static/app/js/activity8.js Executable file
View File

@ -0,0 +1,31 @@
$('.mui-title').html('活动规则');
var html = `<p class="rul_p">ECT专区9月14-15日活动规则</p>
<div class="rul_div">
<p class="rul_p1">满199-100</p>
<p class="rul_p2">活动规则</p>
<p class="rul_p2">1、参加活动产品享受此优惠</p>
<p class="rul_p2">2、此活动不叠加使用</p>
<p class="rul_p2">3、活动日期2018-9-14 0000至2018-9-15 23:59:59</p>
<p class="rul_p2">4、此活动不兑换现金、不兑换券</p>
<p class="rul_p2">5、ECT专区单品与普通单品分开结账</p>
</div>
<div class="rul_div">
<p class="rul_p1">满二赠一</p>
<p class="rul_p2">活动规则</p>
<p class="rul_p2">1、仅限同款产品满二赠一</p>
<p class="rul_p2">2、仅限参加活动产品享受此优惠</p>
<p class="rul_p2">3、此活动不叠加使用每单仅限使用一次</p>
<p class="rul_p2">4、活动时间2018-9-14 0000至2018-9-15 23:59:59</p>
<p class="rul_p2">5、此活动不兑换现金、不兑换券</p>
<p class="rul_p2">6、ECT专区单品与普通单品分开结账</p>
</div>
<div class="rul_div">
<p class="rul_p1">9.15元</p>
<p class="rul_p2">活动规则</p>
<p class="rul_p2">1、此专区产品每人仅限购买四件</p>
<p class="rul_p2">2、活动时间2018-9-14 0000至2018-9-15 23:59:59</p>
<p class="rul_p2">3、此活动不兑换现金、不兑换券</p>
<p class="rul_p2">4、ECT专区单品与普通单品分开结账</p>
</div>`;
$('.con').html(html)

0
static/app/js/activity9.js Executable file
View File

303
static/app/js/appraise.js Executable file
View File

@ -0,0 +1,303 @@
var isjiazai = 1;
var type = '';
var page = 1
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var data_id = self.data_id;
// console.log(data_id)
function getData(page, pagesize, type) {
var set_data = {
goodsId: data_id,
type: type ? type : '',
page: page ? page : 1,
pagesize: pagesize ? pagesize : 10
}
if(isjiazai == 1) {
isjiazai = 0
} else {
return;
}
mui.ajax(hyhUrl('app/goodsappraises/getById'), { 
data: set_data,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
var html = '';
if(data.status == 1) {
data = data.data;
$('#sum').html('全部(' + data.sum + ')');
$('#pic').html('有图(' + data.picNum + ')');
$('#bad').html('差评(' + data.badNum + ')');
$('#good').html('中评(' + data.goodNum + ')');
$('#best').html('好评(' + data.bestNum + ')');
if(data.Rows == '') {
$('.pj_list').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多评价</p>');
isjiazai = 0;
return;
}
$.each(data.Rows, function() {
html += '<div class="pj_breviary"><div class="pjbtitle clearfix"><img src="' + hyhImgUrl(this.userPhoto) + '" /><p>' + this.loginName + '</p></div><div class="pjbcon">' + this.content + '</div>';
if(this.shopReply != null) {
html += '<div class="zjpj"><div class="sanjiao"></div><div class="pjzhuijia">商家回复:' + this.shopReply + '</div></div>';
}
html += '<div class="pjclass">' + this.goodsSpecNames + '</div><div class="pjclass">' + this.createTime + '</div>';
if(this.images != '' && this.images != null) {
html += '<div class="gallety"><div class="my-gallery clearfix" data-pswp-uid="">';
var imgArr = this.images.split(',');
$.each(imgArr, function() {
html += '<figure><div class="img-dv"><a href="' + hyhImgUrl(this) + '/thumb512" data-size="1920x1080"><img src="' + hyhImgUrl(this) + '/thumb78"></a></div></figure>';
// console.log(hyhImgUrl(this))
});
html += '</div></div>';
}
html += '</div>';
});
if(page == 1) {
$('.pj_list').html(html);
} else {
$('.pj_list').append(html);
}
isjiazai = 1;
setTimeout(function() {
$('.img-dv a').each(function() {
var that = $(this);
var img_ = new Image()
img_.src = that.attr('href');
img_.onload = function() {
that.attr('data-size', img_.width + 'x' + img_.height);
}
});
document.addEventListener('DOMAttrModified', function() {
$('.img-dv a').each(function() {
var that = $(this);
var img_ = new Image()
img_.src = that.attr('href');
img_.onload = function() {
that.attr('data-size', img_.width + 'x' + img_.height);
}
});
}, false);
var initPhotoSwipeFromDOM = function(gallerySelector) {
// 解析来自DOM元素幻灯片数据URL标题大小...
var parseThumbnailElements = function(el) {
var thumbElements = el.childNodes,
numNodes = thumbElements.length,
items = [],
figureEl,
linkEl,
size,
item,
divEl;
for(var i = 0; i < numNodes; i++) {
figureEl = thumbElements[i]; // <figure> element
// 仅包括元素节点
if(figureEl.nodeType !== 1) {
continue;
}
divEl = figureEl.children[0];
linkEl = divEl.children[0]; // <a> element
size = linkEl.getAttribute('data-size').split('x');
// 创建幻灯片对象
item = {
src: linkEl.getAttribute('href'),
w: parseInt(size[0], 10),
h: parseInt(size[1], 10)
// w: '100%'
};
if(figureEl.children.length > 1) {
item.title = figureEl.children[1].innerHTML;
}
if(linkEl.children.length > 0) {
// <img> 缩略图节点, 检索缩略图网址
item.msrc = linkEl.children[0].getAttribute('src');
}
item.el = figureEl; // 保存链接元素 for getThumbBoundsFn
items.push(item);
}
return items;
};
// 查找最近的父节点
var closest = function closest(el, fn) {
return el && (fn(el) ? el : closest(el.parentNode, fn));
};
// 当用户点击缩略图触发
var onThumbnailsClick = function(e) {
e = e || window.event;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
var eTarget = e.target || e.srcElement;
var clickedListItem = closest(eTarget, function(el) {
return(el.tagName && el.tagName.toUpperCase() === 'FIGURE');
});
if(!clickedListItem) {
return;
}
var clickedGallery = clickedListItem.parentNode,
childNodes = clickedListItem.parentNode.childNodes,
numChildNodes = childNodes.length,
nodeIndex = 0,
index;
for(var i = 0; i < numChildNodes; i++) {
if(childNodes[i].nodeType !== 1) {
continue;
}
if(childNodes[i] === clickedListItem) {
index = nodeIndex;
break;
}
nodeIndex++;
}
if(index >= 0) {
openPhotoSwipe(index, clickedGallery);
}
return false;
};
var photoswipeParseHash = function() {
var hash = window.location.hash.substring(1),
params = {};
if(hash.length < 5) {
return params;
}
var vars = hash.split('&');
for(var i = 0; i < vars.length; i++) {
if(!vars[i]) {
continue;
}
var pair = vars[i].split('=');
if(pair.length < 2) {
continue;
}
params[pair[0]] = pair[1];
}
if(params.gid) {
params.gid = parseInt(params.gid, 10);
}
return params;
};
var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
var pswpElement = document.querySelectorAll('.pswp')[0],
gallery,
options,
items;
items = parseThumbnailElements(galleryElement);
// 这里可以定义参数
options = {
barsSize: {
top: 100,
bottom: 100
},
fullscreenEl: false,
shareButtons: [{
id: 'wechat',
label: '分享微信',
url: '#'
},
{
id: 'weibo',
label: '新浪微博',
url: '#'
},
{
id: 'download',
label: '保存图片',
url: '{{raw_image_url}}',
download: true
}
],
galleryUID: galleryElement.getAttribute('data-pswp-uid'),
getThumbBoundsFn: function(index) {
var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
rect = thumbnail.getBoundingClientRect();
return {
x: rect.left,
y: rect.top + pageYScroll,
w: rect.width
};
}
};
if(fromURL) {
if(options.galleryPIDs) {
for(var j = 0; j < items.length; j++) {
if(items[j].pid == index) {
options.index = j;
break;
}
}
} else {
options.index = parseInt(index, 10) - 1;
}
} else {
options.index = parseInt(index, 10);
}
if(isNaN(options.index)) {
return;
}
if(disableAnimation) {
options.showAnimationDuration = 0;
}
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
};
var galleryElements = document.querySelectorAll(gallerySelector);
for(var i = 0, l = galleryElements.length; i < l; i++) {
galleryElements[i].setAttribute('data-pswp-uid', i + 1);
galleryElements[i].onclick = onThumbnailsClick;
}
var hashData = photoswipeParseHash();
if(hashData.pid && hashData.gid) {
openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
}
};
initPhotoSwipeFromDOM('.my-gallery');
}, 500)
} else {
console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
} 
})
}
getData(1, 10)
$('.nav').on('tap', '.nav_', function() {
$(this).addClass('on').siblings().removeClass('on');
type = $(this).attr('id');
page = 1;
isjiazai = 1;
getData(page, 10, type)
})
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
getData(page, 10, type)
}
}
})
})

287
static/app/js/binaryajax.js Executable file
View File

@ -0,0 +1,287 @@
/*
* Binary Ajax 0.1.10
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
* Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
*/
var BinaryFile = function(strData, iDataOffset, iDataLength) {
var data = strData;
var dataOffset = iDataOffset || 0;
var dataLength = 0;
this.getRawData = function() {
return data;
}
if (typeof strData == "string") {
dataLength = iDataLength || data.length;
this.getByteAt = function(iOffset) {
return data.charCodeAt(iOffset + dataOffset) & 0xFF;
}
this.getBytesAt = function(iOffset, iLength) {
var aBytes = [];
for (var i = 0; i < iLength; i++) {
aBytes[i] = data.charCodeAt((iOffset + i) + dataOffset) & 0xFF
}
;
return aBytes;
}
} else if (typeof strData == "unknown") {
dataLength = iDataLength || IEBinary_getLength(data);
this.getByteAt = function(iOffset) {
return IEBinary_getByteAt(data, iOffset + dataOffset);
}
this.getBytesAt = function(iOffset, iLength) {
return new VBArray(IEBinary_getBytesAt(data, iOffset + dataOffset, iLength)).toArray();
}
}
this.getLength = function() {
return dataLength;
}
this.getSByteAt = function(iOffset) {
var iByte = this.getByteAt(iOffset);
if (iByte > 127)
return iByte - 256;
else
return iByte;
}
this.getShortAt = function(iOffset, bBigEndian) {
var iShort = bBigEndian ?
(this.getByteAt(iOffset) << 8) + this.getByteAt(iOffset + 1)
: (this.getByteAt(iOffset + 1) << 8) + this.getByteAt(iOffset)
if (iShort < 0)
iShort += 65536;
return iShort;
}
this.getSShortAt = function(iOffset, bBigEndian) {
var iUShort = this.getShortAt(iOffset, bBigEndian);
if (iUShort > 32767)
return iUShort - 65536;
else
return iUShort;
}
this.getLongAt = function(iOffset, bBigEndian) {
var iByte1 = this.getByteAt(iOffset),
iByte2 = this.getByteAt(iOffset + 1),
iByte3 = this.getByteAt(iOffset + 2),
iByte4 = this.getByteAt(iOffset + 3);
var iLong = bBigEndian ?
(((((iByte1 << 8) + iByte2) << 8) + iByte3) << 8) + iByte4
: (((((iByte4 << 8) + iByte3) << 8) + iByte2) << 8) + iByte1;
if (iLong < 0)
iLong += 4294967296;
return iLong;
}
this.getSLongAt = function(iOffset, bBigEndian) {
var iULong = this.getLongAt(iOffset, bBigEndian);
if (iULong > 2147483647)
return iULong - 4294967296;
else
return iULong;
}
this.getStringAt = function(iOffset, iLength) {
var aStr = [];
var aBytes = this.getBytesAt(iOffset, iLength);
for (var j = 0; j < iLength; j++) {
aStr[j] = String.fromCharCode(aBytes[j]);
}
return aStr.join("");
}
this.getCharAt = function(iOffset) {
return String.fromCharCode(this.getByteAt(iOffset));
}
this.toBase64 = function() {
return window.btoa(data);
}
this.fromBase64 = function(strBase64) {
data = window.atob(strBase64);
}
}
var BinaryAjax = (function() {
function createRequest() {
var oHTTP = null;
if (window.ActiveXObject) {
oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
oHTTP = new XMLHttpRequest();
}
return oHTTP;
}
function getHead(strURL, fncCallback, fncError) {
var oHTTP = createRequest();
if (oHTTP) {
if (fncCallback) {
if (typeof(oHTTP.onload) != "undefined") {
oHTTP.onload = function() {
if (oHTTP.status == "200") {
fncCallback(this);
} else {
if (fncError)
fncError();
}
oHTTP = null;
};
} else {
oHTTP.onreadystatechange = function() {
if (oHTTP.readyState == 4) {
if (oHTTP.status == "200") {
fncCallback(this);
} else {
if (fncError)
fncError();
}
oHTTP = null;
}
};
}
}
oHTTP.open("HEAD", strURL, true);
oHTTP.send(null);
} else {
if (fncError)
fncError();
}
}
function sendRequest(strURL, fncCallback, fncError, aRange, bAcceptRanges, iFileSize) {
var oHTTP = createRequest();
if (oHTTP) {
var iDataOffset = 0;
if (aRange && !bAcceptRanges) {
iDataOffset = aRange[0];
}
var iDataLen = 0;
if (aRange) {
iDataLen = aRange[1] - aRange[0] + 1;
}
if (fncCallback) {
if (typeof(oHTTP.onload) != "undefined") {
oHTTP.onload = function() {
if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") {
oHTTP.binaryResponse = new BinaryFile(oHTTP.responseText, iDataOffset, iDataLen);
oHTTP.fileSize = iFileSize || oHTTP.getResponseHeader("Content-Length");
fncCallback(oHTTP);
} else {
if (fncError)
fncError();
}
oHTTP = null;
};
} else {
oHTTP.onreadystatechange = function() {
if (oHTTP.readyState == 4) {
if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") {
// IE6 craps if we try to extend the XHR object
var oRes = {
status: oHTTP.status,
// IE needs responseBody, Chrome/Safari needs responseText
binaryResponse: new BinaryFile(
typeof oHTTP.responseBody == "unknown" ? oHTTP.responseBody : oHTTP.responseText, iDataOffset, iDataLen
),
fileSize: iFileSize || oHTTP.getResponseHeader("Content-Length")
};
fncCallback(oRes);
} else {
if (fncError)
fncError();
}
oHTTP = null;
}
};
}
}
oHTTP.open("GET", strURL, true);
if (oHTTP.overrideMimeType)
oHTTP.overrideMimeType('text/plain; charset=x-user-defined');
if (aRange && bAcceptRanges) {
oHTTP.setRequestHeader("Range", "bytes=" + aRange[0] + "-" + aRange[1]);
}
oHTTP.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 1970 00:00:00 GMT");
oHTTP.send(null);
} else {
if (fncError)
fncError();
}
}
return function(strURL, fncCallback, fncError, aRange) {
if (aRange) {
getHead(
strURL,
function(oHTTP) {
var iLength = parseInt(oHTTP.getResponseHeader("Content-Length"), 10);
var strAcceptRanges = oHTTP.getResponseHeader("Accept-Ranges");
var iStart, iEnd;
iStart = aRange[0];
if (aRange[0] < 0)
iStart += iLength;
iEnd = iStart + aRange[1] - 1;
sendRequest(strURL, fncCallback, fncError, [iStart, iEnd], (strAcceptRanges == "bytes"), iLength);
}
);
} else {
sendRequest(strURL, fncCallback, fncError);
}
}
}());
/*
document.write(
"<script type='text/vbscript'>\r\n"
+ "Function IEBinary_getByteAt(strBinary, iOffset)\r\n"
+ " IEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\n"
+ "End Function\r\n"
+ "Function IEBinary_getLength(strBinary)\r\n"
+ " IEBinary_getLength = LenB(strBinary)\r\n"
+ "End Function\r\n"
+ "</script>\r\n"
);
*/
document.write(
"<script type='text/vbscript'>\r\n"
+ "Function IEBinary_getByteAt(strBinary, iOffset)\r\n"
+ " IEBinary_getByteAt = AscB(MidB(strBinary, iOffset + 1, 1))\r\n"
+ "End Function\r\n"
+ "Function IEBinary_getBytesAt(strBinary, iOffset, iLength)\r\n"
+ " Dim aBytes()\r\n"
+ " ReDim aBytes(iLength - 1)\r\n"
+ " For i = 0 To iLength - 1\r\n"
+ " aBytes(i) = IEBinary_getByteAt(strBinary, iOffset + i)\r\n"
+ " Next\r\n"
+ " IEBinary_getBytesAt = aBytes\r\n"
+ "End Function\r\n"
+ "Function IEBinary_getLength(strBinary)\r\n"
+ " IEBinary_getLength = LenB(strBinary)\r\n"
+ "End Function\r\n"
+ "</script>\r\n"
);

344
static/app/js/canvasResize.js Executable file
View File

@ -0,0 +1,344 @@
/*
*
* canvasResize
*
* Version: 1.2.0
* Date (d/m/y): 02/10/12
* Update (d/m/y): 14/05/13
* Original author: @gokercebeci
* Licensed under the MIT license
* - This plugin working with binaryajax.js and exif.js
* (It's under the MPL License http://www.nihilogic.dk/licenses/mpl-license.txt)
* Demo: http://canvasResize.gokercebeci.com/
*
* - I fixed iOS6 Safari's image file rendering issue for large size image (over mega-pixel)
* using few functions from https://github.com/stomita/ios-imagefile-megapixel
* (detectSubsampling, )
* And fixed orientation issue by using https://github.com/jseidelin/exif-js
* Thanks, Shinichi Tomita and Jacob Seidelin
*/
(function($) {
var pluginName = 'canvasResize',
methods = {
newsize: function(w, h, W, H, C) {
var c = C ? 'h' : '';
if ((W && w > W) || (H && h > H)) {
var r = w / h;
if ((r >= 1 || H === 0) && W && !C) {
w = W;
h = (W / r) >> 0;
} else if (C && r <= (W / H)) {
w = W;
h = (W / r) >> 0;
c = 'w';
} else {
w = (H * r) >> 0;
h = H;
}
}
return {
'width': w,
'height': h,
'cropped': c
};
},
dataURLtoBlob: function(data) {
var mimeString = data.split(',')[0].split(':')[1].split(';')[0];
var byteString = atob(data.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
var bb = (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder);
if (bb) {
// console.log('BlobBuilder');
bb = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder)();
bb.append(ab);
return bb.getBlob(mimeString);
} else {
// console.log('Blob');
bb = new Blob([ab], {
'type': (mimeString)
});
return bb;
}
},
/**
* Detect subsampling in loaded image.
* In iOS, larger images than 2M pixels may be subsampled in rendering.
*/
detectSubsampling: function(img) {
var iw = img.width, ih = img.height;
if (iw * ih > 1048576) { // subsampling may happen over megapixel image
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, -iw + 1, 0);
// subsampled image becomes half smaller in rendering size.
// check alpha channel value to confirm image is covering edge pixel or not.
// if alpha value is 0 image is not covering, hence subsampled.
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
} else {
return false;
}
},
/**
* Update the orientation according to the specified rotation angle
*/
rotate: function(orientation, angle) {
var o = {
// nothing
1: {90: 6, 180: 3, 270: 8},
// horizontal flip
2: {90: 7, 180: 4, 270: 5},
// 180 rotate left
3: {90: 8, 180: 1, 270: 6},
// vertical flip
4: {90: 5, 180: 2, 270: 7},
// vertical flip + 90 rotate right
5: {90: 2, 180: 7, 270: 4},
// 90 rotate right
6: {90: 3, 180: 8, 270: 1},
// horizontal flip + 90 rotate right
7: {90: 4, 180: 5, 270: 2},
// 90 rotate left
8: {90: 1, 180: 6, 270: 3}
};
return o[orientation][angle] ? o[orientation][angle] : orientation;
},
/**
* Transform canvas coordination according to specified frame size and orientation
* Orientation value is from EXIF tag
*/
transformCoordinate: function(canvas, width, height, orientation) {
switch (orientation) {
case 5:
case 6:
case 7:
case 8:
canvas.width = height;
canvas.height = width;
break;
default:
canvas.width = width;
canvas.height = height;
}
var ctx = canvas.getContext('2d');
switch (orientation) {
case 1:
// nothing
break;
case 2:
// horizontal flip
ctx.translate(width, 0);
ctx.scale(-1, 1);
break;
case 3:
// 180 rotate left
ctx.translate(width, height);
ctx.rotate(Math.PI);
break;
case 4:
// vertical flip
ctx.translate(0, height);
ctx.scale(1, -1);
break;
case 5:
// vertical flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.scale(1, -1);
break;
case 6:
// 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(0, -height);
break;
case 7:
// horizontal flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(width, -height);
ctx.scale(-1, 1);
break;
case 8:
// 90 rotate left
ctx.rotate(-0.5 * Math.PI);
ctx.translate(-width, 0);
break;
default:
break;
}
},
/**
* Detecting vertical squash in loaded image.
* Fixes a bug which squash image vertically while drawing into canvas for some images.
*/
detectVerticalSquash: function(img, iw, ih) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = ih;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
var data = ctx.getImageData(0, 0, 1, ih).data;
// search image edge pixel position in case it is squashed vertically.
var sy = 0;
var ey = ih;
var py = ih;
while (py > sy) {
var alpha = data[(py - 1) * 4 + 3];
if (alpha === 0) {
ey = py;
} else {
sy = py;
}
py = (ey + sy) >> 1;
}
var ratio = py / ih;
return ratio === 0 ? 1 : ratio;
},
callback: function(d) {
return d;
},
extend: function() {
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
if (target.constructor === Boolean) {
deep = target;
target = arguments[1] || {};
}
if (al === 1) {
target = this;
a = 0;
}
var prop;
for (; a < al; a++)
if ((prop = arguments[a]) !== null)
for (var i in prop) {
if (target === prop[i])
continue;
if (deep && typeof prop[i] === 'object' && target[i])
methods.extend(target[i], prop[i]);
else if (prop[i] !== undefined)
target[i] = prop[i];
}
return target;
}
},
defaults = {
width: 300,
height: 0,
crop: false,
quality: 80,
rotate: 0,
'callback': methods.callback
};
function Plugin(file, options) {
this.file = file;
// EXTEND
this.options = methods.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function() {
//this.options.init(this);
var $this = this;
var file = this.file;
var reader = new plus.io.FileReader();
reader.onloadend = function(e) {
var dataURL = e.target.result;
var byteString = atob(dataURL.split(',')[1]);
var binary = new BinaryFile(byteString, 0, byteString.length);
var exif = EXIF.readFromBinaryFile(binary);
var img = new Image();
img.onload = function(e) {
var orientation = exif['Orientation'] || 1;
orientation = methods.rotate(orientation, $this.options.rotate);
// CW or CCW ? replace width and height
var size = (orientation >= 5 && orientation <= 8)
? methods.newsize(img.height, img.width, $this.options.width, $this.options.height, $this.options.crop)
: methods.newsize(img.width, img.height, $this.options.width, $this.options.height, $this.options.crop);
var iw = img.width, ih = img.height;
var width = size.width, height = size.height;
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
ctx.save();
methods.transformCoordinate(canvas, width, height, orientation);
// over image size
if (methods.detectSubsampling(img)) {
iw /= 2;
ih /= 2;
}
var d = 1024; // size of tiling canvas
var tmpCanvas = document.createElement('canvas');
tmpCanvas.width = tmpCanvas.height = d;
var tmpCtx = tmpCanvas.getContext('2d');
var vertSquashRatio = methods.detectVerticalSquash(img, iw, ih);
var sy = 0;
while (sy < ih) {
var sh = sy + d > ih ? ih - sy : d;
var sx = 0;
while (sx < iw) {
var sw = sx + d > iw ? iw - sx : d;
tmpCtx.clearRect(0, 0, d, d);
tmpCtx.drawImage(img, -sx, -sy);
var dx = Math.floor(sx * width / iw);
var dw = Math.ceil(sw * width / iw);
var dy = Math.floor(sy * height / ih / vertSquashRatio);
var dh = Math.ceil(sh * height / ih / vertSquashRatio);
ctx.drawImage(tmpCanvas, 0, 0, sw, sh, dx, dy, dw, dh);
sx += d;
}
sy += d;
}
ctx.restore();
tmpCanvas = tmpCtx = null;
// if rotated width and height data replacing issue
var newcanvas = document.createElement('canvas');
newcanvas.width = size.cropped === 'h' ? height : width;
newcanvas.height = size.cropped === 'w' ? width : height;
var x = size.cropped === 'h' ? (height - width) * .5 : 0;
var y = size.cropped === 'w' ? (width - height) * .5 : 0;
newctx = newcanvas.getContext('2d');
newctx.drawImage(canvas, x, y, width, height);
// console.log(file, file.type);
if (file.type === "image/png") {
var data = newcanvas.toDataURL(file.type);
} else {
var data = newcanvas.toDataURL("image/jpeg", ($this.options.quality * .01));
}
// CALLBACK
$this.options.callback(data, newcanvas.width, newcanvas.height);
// });
};
img.src = dataURL;
// =====================================================
};
reader.readAsDataURL(file);
//reader.readAsBinaryString(file);
}
};
$[pluginName] = function(file, options) {
// console.log(file.size);
if (typeof file === 'string')
return methods[file](options);
else
new Plugin(file, options);
};
})(window);

291
static/app/js/choiceness.js Executable file
View File

@ -0,0 +1,291 @@
$('.mui-slider-indicator').html('')
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
var count = 1;
function pullupRefresh() {
count += 1;
//console.log(count)
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
// console.log(order_class)
mui.ajax(hyhUrl('addon/hyhchosen-Hyhchosen-getChosen'), { 
data: {
page: count,
goodsSize: 3,
pagesize : 10
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
data = data.data;
if(data.Rows.length == 0) {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
return;
}
var html = ''
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.newTime + '</p><div class="btn_gz">+ 关注</div></div><div class="b_con clearfix">';
$.each(this.goods, function() {
html += '<div data-goodId="' + this.goodsId + '" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div>';
});
html += '</div></div>'
});
$('.con').append(html);
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}, 500);
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
mui.plusReady(function() {
function openAds(item) {
if(item.attr('data-adURL') == '' || item.attr('data-targetType') == 0) {
return;
}
var adURL = item.attr('data-adURL');
var targetType = '';
var data_set = {};
if(item.attr('data-targetType') == 1) {
//商品
targetType = 'details.html';
data_set = {
data_id: adURL
}
} else if(item.attr('data-targetType') == 2) {
//商家
targetType = 'storeout.html';
data_set = {
shopId: adURL
}
} else if(item.attr('data-targetType') == 3) {
//活动
targetType = adURL + '.html';
}
mui.openWindow({
url: targetType,
id: targetType + adURL,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: data_set,
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
var data = '';
mui.ajax(hyhUrl('addon/hyhchosen-Hyhchosen-getChosen'), { 
data: {
pagesize: 10,
goodsSize: 3,
page: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.newTime + '</p><div class="btn_gz">+ 关注</div></div><div class="b_con clearfix">';
$.each(this.goods, function() {
html += '<div data-goodId="' + this.goodsId + '" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div>';
});
html += '</div></div>'
});
$('.con').html(html)
if(data.chosenAdsList.length != 0) {
var html1 = '<div class="mui-slider-group mui-slider-loop"><div data-adId="' + data.chosenAdsList[data.chosenAdsList.length - 1].adId + '" class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.chosenAdsList[data.chosenAdsList.length - 1].adFile) + '"></a></div>';
var html2 = '<div class="mui-slider-indicator">';
$.each(data.chosenAdsList, function() {
html1 += '<div data-adId="' + this.adId + '"data-adURL="' + this.adURL + '"data-targetType="' + this.targetType + '" class="mui-slider-item "><a href="#"><img src="' + hyhImgUrl(this.adFile) + '"></a></div>'
html2 += '<div class="mui-indicator"></div>'
})
html2 += '</div>'
html1 += '<div data-adId="' + data.chosenAdsList[0].adId + '"data-adURL="' + data.chosenAdsList[0].adURL + '"data-targetType="' + data.chosenAdsList[0].targetType + '" class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.chosenAdsList[0].adFile) + '"></a></div></div>'
html1 += html2;
$('#slider').html(html1);
mui("#slider").slider({
interval: 5000
});
document.getElementsByClassName('mui-indicator')[0].className += ' mui-active';
}
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.con').on('tap', '.storename', function() {
var shopId = $(this).parent().attr('data-shopId');
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html' + shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.con').on('tap', '.bc_img', function() {
var goodId = $(this).attr('data-goodId');
mui.openWindow({
url: 'details.html',
id: 'details.html' + goodId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.con').on('tap', '.btn_gz', function() {
var shopId = $(this).parent().attr('data-shopId');
var that = $(this);
mui.ajax(hyhUrl('app/Favorites/add'), { 
data: {
id: shopId,
type : 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
that.html('已关注');
that.addClass('btn_gz1').removeClass('btn_gz');
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
})
//轮播图跳转
$('#slider').on('tap', '.mui-slider-item', function() {
openAds($(this));
})
})

131
static/app/js/classify.js Executable file
View File

@ -0,0 +1,131 @@
mui.init()
mui.plusReady(function() {
function classInfo(parentId) {
mui.ajax(hyhUrl('app/goodscats/getGoodsCat'), { 
data: {
parentId: parentId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
var html1 = '';
data = data.data;
$.each(data, function() {
html1 += '<div class="r_block clearfix" data-catId="' + this.catId + '"><div class="rb_title">' + this.catName + '</div></div>';
});
$('.con_right .mui-scroll').html(html1);
$('.r_block').each(function() {
var parentId2 = $(this).attr('data-catId');
var that = $(this);
mui.ajax(hyhUrl('app/goodscats/getGoodsCat'), { 
data: {
parentId: parentId2
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
data = data.data;
var html2 = '';
$.each(data, function() {
html2 += '<div class="rb_block" data-catId="' + this.catId + '"><img src="' + hyhImgUrl(this.catImg) + '" /><p>' + this.catName + '</p></div>';
});
that.append(html2);
$(this).addClass('on').siblings().removeClass('on');
$('.rb_block img').height($('.rb_block img').width())
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
$(this).addClass('on').siblings().removeClass('on');
$('.rb_block img').height($('.rb_block img').width())
$('.con_left').on('tap', '.left_row', function() {
var classify = $(this).attr('data-catId');
$(this).addClass('on').siblings().removeClass('on');
$('.rb_block img').height($('.rb_block img').width())
classInfo(classify)
})
mui.ajax(hyhUrl('app/goodscats/getGoodsCat'), { 
data: {
parentId: 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
var html = '';
data = data.data;
$.each(data, function() {
html += '<div class="left_row" data-catId="' + this.catId + '">' + this.catName + '</div>'
});
$('.con_left .mui-scroll').html(html);
document.getElementsByClassName('left_row')[0].className += ' on';
var parentId1 = document.getElementsByClassName('left_row')[0].attributes["data-catId"].nodeValue;
classInfo(parentId1)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.con_right .mui-scroll').on('tap', '.rb_block', function() {
var catId = $(this).attr('data-catId');
mui.openWindow({
url: 'goodsList.html',
id: 'goodsList.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_catId: catId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

75
static/app/js/collect.js Executable file
View File

@ -0,0 +1,75 @@
jumpPage();
function jumpPage() {
//跳转页面
var subpages = ['collect_commodity.html', 'collect_store.html'];
var subpage_style = {
top: '66px',
bottom: '0px',
scrollIndicator: 'none'
};
var aniShow = {}; //动画显示
//当前激活选项
var activeTab = subpages[0];
//选项卡点击事件
mui('.nav').on('tap', 'a', function(e) {
var targetTab = this.getAttribute('href');
if(targetTab == activeTab) {
return;
}
//显示目标选项卡
//若为iOS平台或非首次显示则直接显示
if(mui.os.ios || aniShow[targetTab]) {
plus.webview.show(targetTab);
} else {
//否则使用fade-in动画且保存变量
var temp = {};
temp[targetTab] = "true";
mui.extend(aniShow, temp);
plus.webview.show(targetTab, "fade-in", 300);
}
//隐藏当前;
plus.webview.hide(activeTab);
//更改当前活跃的选项卡
activeTab = targetTab;
if(targetTab == 'collect_commodity.html') {
document.getElementsByClassName('p1')[1].classList.remove('on')
this.classList.add('on');
}
if(targetTab == 'collect_store.html') {
document.getElementsByClassName('p1')[0].classList.remove('on')
this.classList.add('on');
}
});
//首次启动切滑效果
mui.plusReady(function() {
// launchScreen();
// plus.navigator.setStatusBarStyle('dark');
// console.log(plus.navigator.getStatusBarStyle())
var self = plus.webview.currentWebview();
for(var i = 0; i < subpages.length; i++) {
var temp = {};
//http://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.create
var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
if(i > 0) {
sub.hide();
} else {
temp[subpages[i]] = "true";
mui.extend(aniShow, temp); //合并对象
}
self.append(sub);
}
var data_href = self.data_href;
if(data_href == 'collect_store.html') {
var defaultTab = document.getElementsByClassName("p1")[1];
//模拟首页点击
mui.trigger(defaultTab, 'tap');
}
});
}

View File

@ -0,0 +1,129 @@
mui.plusReady(function() {
var page = 1;
var isjiazai = 1;
function getData(page, pagesize) {
var setdata = {
page: page,
pagesize: pagesize
}
if(isjiazai == 0) {
return;
}
isjiazai = 0;
mui.ajax(hyhUrl('app/favorites/listGoodsQuery'), { 
data: setdata,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
if(data.Rows == '') {
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
return;
}
$.each(data.Rows, function() {
html += '<div class="row clearfix"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="row_r" data-favoriteId="'+ this.favoriteId +'" data-goodsId="' + this.goodsId + '"><p class="sctitle">' + this.goodsName + '</p><div class="cost">¥' + this.shopPrice + '</div><button class="qxsc">取消收藏</button></div></div>'
});
if(page == "1") {
$('.con').html(html);
} else {
$('.con').append(html);
}
isjiazai = 1;
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}
getData(page, 10);
//下拉加载
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
getData(page, 10)
}
}
})
//商品页调转
mui(".con").on('tap', '.sctitle', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
var data_id = $(this).parent().attr('data-goodsId');
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'details.html',
id: 'details.html' + data_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//取消关注
$('.con').on('tap', '.qxsc', function() {
var favoriteId = $(this).parent().attr('data-favoriteId');
var that = $(this);
mui.ajax(hyhUrl('app/Favorites/cancel'), { 
data: {
id: favoriteId,
type : 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
alert(data.msg);
location.reload();
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
})
})

143
static/app/js/collect_store.js Executable file
View File

@ -0,0 +1,143 @@
mui.plusReady(function() {
var page = 1;
var isjiazai = 1;
function getData(page, pagesize) {
var setdata = {
page: page,
pagesize: pagesize
}
if(isjiazai == 0) {
return;
}
isjiazai = 0;
mui.ajax(hyhUrl('app/favorites/listShopQuery'), { 
data: setdata,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
if(data.Rows == '') {
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多</p>');
return;
}
$.each(data.Rows, function() {
html += '<div class="row"><div class="row_title"><img class="img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="s_t" data-shopId="' + this.shopId + '">' + this.shopName + '</p><button class="qxsc" data-favoriteId="' + this.favoriteId + '">取消收藏</button></div></div></div>';
});
if(page == "1") {
$('.con').html(html);
} else {
$('.con').append(html);
}
isjiazai = 1;
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}
getData(page, 10);
//下拉加载
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
getData(page, 10)
}
}
})
//店铺跳转
mui(".con").on('tap', '.s_t', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
var shopId = this.attributes["data-shopId"].nodeValue;
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html' + shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//取消关注
$('.con').on('tap', '.qxsc', function() {
var favoriteId = $(this).attr('data-favoriteId');
var that = $(this);
mui.ajax(hyhUrl('app/Favorites/cancel'), { 
data: {
id: favoriteId,
type : 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
alert(data.msg);
location.reload();
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
})
// mui('.con').on('tap', '.img_btn', function() {
//
// if($(this).attr('src') == '../img/sanjiaoshang.png') {
// $(this).parent().siblings('.row_con').css('display', 'none');
// $(this).attr('src', '../img/sanjiaoxia.png')
// } else {
// $(this).parent().siblings('.row_con').css('display', 'block');
// $(this).attr('src', '../img/sanjiaoshang.png')
// }
//
// })
})

98
static/app/js/common.js Executable file
View File

@ -0,0 +1,98 @@
function hyhUrl(url) {
return 'http://www.heyuanhui.cn/' + url;
}
function llUrl(url) {
return 'http://www.heyuanhui.cn/' + url;
}
function kxUrl(url) {
return 'http://www.heyuanhui.cn' + url;
}
function hyhImgUrl(url) {
return 'http://img.heyuanhui.cn/' + url;
}
function cssUrl(url) {
return '../css/' + url;
}
function toJson(str, notLimit) {
var json = {};
if(str) {
try {
if(typeof(str) == "object") {
json = str;
} else {
json = eval("(" + str + ")");
}
if(!notLimit) {
if(json.status && json.status == '-999') {
console.log(str.msg)
inLogin();
}
}
} catch(e) {
alert("系统发生错误:" + e.getMessage);
json = {};
}
return json;
} else {
return;
}
}
function backTop() {
mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 0);
}
function inLogin() {
mui.openWindow({
url: 'login.html',
id: 'login.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
var scroll = mui('.mui-scroll-wrapper').scroll();
var ua = navigator.userAgent.toLowerCase();
if(/iphone|ipad|ipod/.test(ua)) { //苹果手机
if(document.getElementsByClassName('zhe')[0]) {
document.getElementsByClassName('zhe')[0].style.display = 'none';
}
// document.getElementsByClassName('zhe')[0].style.display='none';
} else if(/android/.test(ua)) {
// document.getElementsByClassName('zhe')[0].style.display='block';
if(document.getElementsByClassName('zhe')[0]) {
document.getElementsByClassName('zhe')[0].style.display = 'none';
}
}

70
static/app/js/common_home.js Executable file
View File

@ -0,0 +1,70 @@
function hyhUrl(url) {
return 'http://www.juzi199.com/' + url;
}
function hyhImgUrl(url) {
return 'http://img.juzi199.com/' + url;
}
function chengUrl(url) {
return 'http://www.juzi199.com/' + url;
}
function toJson(str, notLimit) {
var json = {};
if(str) {
try {
if(typeof(str) == "object") {
json = str;
} else {
json = eval("(" + str + ")");
}
if(!notLimit) {
if(json.status && json.status == '-999') {
console.log(str.msg)
inLogin();
}
}
} catch(e) {
alert("系统发生错误:" + e.getMessage);
json = {};
}
return json;
} else {
return;
}
}
function inLogin() {
mui.openWindow({
url: 'login.html',
id: 'login.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}

153
static/app/js/complain.js Executable file
View File

@ -0,0 +1,153 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
var self = plus.webview.currentWebview();
var data_order_id = self.data_order_id;
mui.ajax(hyhUrl('app/Ordercomplains/getComplainCause'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
data = data.data;
var html = '<option value="0">选择投诉类型</option>';
$.each(data, function() {
html += '<option value="' + this.dataVal + '">' + this.dataName + '</option>';
})
$('select').html(html);
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
var uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight,html4',
browse_button: 'selectfiles',
//multi_selection: false,
// container: document.getElementById('container'),
flash_swf_url: '../lib/plupload-2.1.2/js/Moxie.swf',
silverlight_xap_url: '../lib/plupload-2.1.2/js/Moxie.xap',
url: 'http://oss.aliyuncs.com',
filters: {
mime_types: [ //只允许上传图片和zip,rar文件
{
title: "Image files",
extensions: "jpg,gif,png,bmp"
}
],
max_file_size: '10mb', //最大只能上传10mb的文件
prevent_duplicates: true //不允许选取重复文件
},
init: {
PostInit: function() {
document.getElementById('ossfile').innerHTML = '';
// document.getElementById('postfiles').onclick = function() {
// set_upload_param(uploader, '', false);
// return false;
// };
uploader.bind('FilesAdded', function() {
set_upload_param(uploader, '', false,'complains');
return false;
});
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('ossfile').innerHTML += '<div class="files_out" id="' + file.id + '"><b></b>' +
'<div class="progress"><div class="progress-bar" style="width: 60px"></div></div>' +
'</div>';
});
},
BeforeUpload: function(up, file) {
check_object_radio();
set_upload_param(up, file.name, true);
},
UploadProgress: function(up, file) {
var d = document.getElementById(file.id);
d.getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
var prog = d.getElementsByTagName('div')[0];
var progBar = prog.getElementsByTagName('div')[0]
progBar.style.width = 2 * file.percent + 'px';
progBar.setAttribute('aria-valuenow', file.percent);
},
FileUploaded: function(up, file, info) {
if(info.status == 200) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<img data-src="' + get_uploaded_object_name(file.name) + '" src="' + hyhImgUrl(get_uploaded_object_name(file.name))+ '" />';
} else {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = info.response;
}
},
Error: function(up, err) {
if(err.code == -600) {
alert("\n选择的文件太大了");
} else if(err.code == -601) {
alert("\n选择的文件后缀不对");
} else if(err.code == -602) {
alert("\n这个文件已经上传过一遍了");
} else {
alert("\nError xml:" + err.response);
}
}
}
});
uploader.init();
$('button').on('tap', function() {
var complainType = $('select').val();
var complainContent = $('textarea').val();
var imagesArr = [];
$('#ossfile').children('.files_out').children('b').children('img').each(function() {
imagesArr.push($(this).attr('data-src'))
})
var images = imagesArr.join(',');
if(complainType == 0) {
alert('请选择投诉原因!');
return;
}
if(complainContent.length < 5) {
alert('投诉内容不小于5个字');
return;
}
var that = $(this);
mui.ajax(hyhUrl('app/Ordercomplains/saveComplain'), { 
data: {
orderId: data_order_id,
complainType: complainType,
complainContent: complainContent,
complainAnnex: images
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
alert('提交成功!');
var targetTab = plus.webview.getWebviewById('complain.html');
mui.fire(targetTab, 'refresh');
mui.back();
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
})
})

668
static/app/js/confirmOrder.js Executable file
View File

@ -0,0 +1,668 @@
var wxChannel = null; // 微信支付
var aliChannel = null; // 支付宝支付
var channel = null; //支付通道
mui.init();
mui.plusReady(function() {
window.addEventListener('setAddress', function(e) {
var addressId = localStorage.getItem('addressId') ? localStorage.getItem('addressId') : 0;
if(addressId == 0) {
return;
}
mui.ajax(hyhUrl('app/useraddress/getById'), { 
data: {
addressId: addressId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
// for(i in data.data){
// console.log(i)
// console.log(data.data[i])
// }
var html = '<div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' + data.userName + '</div><div class="add_r_t_r">' + data.userPhone + '</div></div><div class="add_r_b">收货地址:' + data.areaName + ' ' + data.userAddress + '</div></div>';
$('.address').html(html);
$('.address').attr('data-addressId', data.addressId);
$('.address').attr('data-areaId', data.areaId2);
} else {
alert(data.msg);
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
});
$('.con').on('tap', '.address', function() {
var addressId = $(this).attr('data-addressId');
localStorage.setItem('addressId', addressId);
var isOrder = true;
mui.openWindow({
url: 'setting_address.html',
id: 'setting_address.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_addressId: addressId,
data_isOrder: isOrder
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//支付插件
plus.payment.getChannels(function(channels) {
for(var i in channels) {
if(channels[i].id == "wxpay") {
wxChannel = channels[i];
} else {
aliChannel = channels[i];
}
}
}, function(e) {
alert("获取支付通道失败:" + e.message);
});
// var ALIPAYSERVER = 'http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
var ALIPAYSERVER = hyhUrl('app/Alipays/toAlipay?isBatch=1&orderNo=');
// 2. 发起支付请求
function pay(id, orderNo) {
// 从服务器请求支付订单
var PAYSERVER = '';
if(id == 'alipay') {
PAYSERVER = ALIPAYSERVER;
channel = aliChannel;
} else if(id == 'wxpay') {
PAYSERVER = WXPAYSERVER;
channel = wxChannel;
} else {
plus.nativeUI.alert("不支持此支付通道!", null, "捐赠");
return;
}
var xhr = new XMLHttpRequest();
// var amount = 1;
xhr.onreadystatechange = function() {
switch(xhr.readyState) {
case 4:
if(xhr.status == 200) {
plus.payment.request(channel, xhr.responseText, function(result) {
plus.nativeUI.alert("支付成功!", function() {
// back();
});
}, function(error) {
// plus.nativeUI.alert("支付失败:" + error.code);
plus.webview.getWebviewById('confirmOrder.html').close();
});
} else {
alert("获取订单信息失败!");
console.log(xhr.status)
}
break;
default:
break;
}
}
xhr.open('GET', PAYSERVER + orderNo);
xhr.send();
}
var self = plus.webview.currentWebview();
var type = self.type;
var data_1 = {};
var isUseScore = 0;
var orderNo;
var priceT = 0;
var payCode = '';
// console.log(type)
mui.ajax(hyhUrl('app/carts/settlement'), { 
data: {
type: type
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
var data = toJson(data);
if(data.status == 1) {
var allallnum = 0;
data = data.data;
data_1 = data;
if(data.userAddress.addressId) {
var html = '<div class="address clearfix" data-addressId="' + data.userAddress.addressId + '" data-areaId2="' + data.userAddress.areaId2 + '"><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' + data.userAddress.userName + '</div><div class="add_r_t_r">' + data.userAddress.userPhone + '</div></div><div class="add_r_b">收货地址:' + data.userAddress.areaName + ' ' + data.userAddress.userAddress + '</div></div></div>';
} else {
var html = '<div class="address clearfix" ><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l" style="height:60px;line-height:60px;font-size:14.4px;color:black">请选择收货地址</div></div></div></div>';
}
$.each(data.carts, function() {
var allNum = 0;
html += '<div class="shop_info"><div class="row_title"><div class="store_name">' + this.shopName + '</div></div><div class="row_con clearfix">';
$.each(this.list, function() {
allNum += this.cartNum;
var price = '';
if(this.isWhsle == 1) {
price = this.whslePrice;
} else if(this.specPrice != 'null') {
price = this.shopPrice;
} else {
price = this.specPrice;
}
var specNames = '';
for(var i in this.specNames[0]) {
if(i == "catName") {
specNames = this.specNames[0][i] + ':';
} else if(i == "itemName") {
specNames += this.specNames[0][i]
}
}
html += '<div class="row_block clearfix" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">';
$.each(this.specNames, function() {
html += this.catName + ':' + this.itemName + ';';
});
html += '</p></div><div class="rcrr"><p>¥' + price + '</p><del>¥' + this.marketPrice + '</del><span>x' + this.cartNum + '</span></div></div></div>'
});
allallnum += allNum;
html += '<div class="cost"><div class="c2 clearfix"><div class="c1_l">买家留言:</div><div class="c1_r"><input class="remark" data-shopId="' + this.shopId + '" type="text" name="" id="" value="" placeholder="选填:填写内容已和卖家协商确认" /></div></div></div>';
html += '<div class="cost"><div class="c2 clearfix"><div class="c1_l">选择优惠券:</div><div class="c1_r"><select name="" data-shopId="' + this.shopId + '" class="yhq"><option value="0">不使用优惠券</option>';
$.each(this.coupons, function() {
html += '<option value="' + this.couponId + '">满' + this.useMoney + '元减' + this.couponValue + '元</option>';
});
html += '</select></div></div></div><div class="cost"><div class="c2 clearfix"><div class="c1_r">共' + allNum + '件商品 小计:<o class="on">¥' + this.goodsMoney + '</o> + 运费:<o class="on">¥' + this.shippingMoney + '</o></div></div></div></div></div>';
});
if(data.ect_pay == 0) {
html += '<div class="isHb clearfix"><div class="h_left">惠宝抵用&nbsp;&nbsp;&nbsp;&nbsp;<o id="huibao">可抵用惠宝:' + data.useOrderScore + '</o></div><div class="he_right"><div class="checkout"><div class="check_btn"></div></div></div></div>'
}
html += '<div class="jf_info clearfix"><div class="jf_jf">积分</div><div class="jf_p">奖励积分为成交价格的20%</div></div>';
priceT = (Math.floor((+data.goodsTotalMoney - (+data.promotionMoney))*100))/100;
priceT = priceT >= 0 ? priceT : 0;
var html1 = '<span>共' + allallnum + '件商品 合计:<j>¥' + priceT + '</j></span>&nbsp;&nbsp;<div class="btn_tj">提交订单</div>';
if(data.ect_pay == 1) {
var htmlpay = '<div class="row clearfix select_payway" data-payCode="ect"><p class="row_left">ECT余额<o class="userECT">' + data.userECT + '</o></p></div>';
$('.pay_info .con_1').append(htmlpay);
// $('.pay_info .con_1 .row').eq(0).attr('style','display: none;');
$('.pay_info .con_1 .row').eq(1).remove();
};
$('.con').html(html);
$('.js_r').html(html1);
$('#loginName').html(data.loginName);
$('.userMoney').html(data.userMoney);
$('#goodsTotalMoney').html(priceT);
} else {
alert(data.msg);
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.con').on('change', 'select', function() {
var couponIds = [];
$('select').each(function() {
couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
})
// var addressId = $('.address').attr('data-addressId')
var areaId2 = $('.address').attr('data-areaId2')
var couponIdsArr = couponIds.join(',');
mui.ajax(hyhUrl('app/carts/getMoney'), { 
data: {
type: type,
areaId2: addressId,
isUseScore: isUseScore,
useScore: data_1.useOrderScore,
couponIds: couponIdsArr
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
data = toJson(data);
// console.log(data.msg)
if(data.status == 1) {
$('.js_r span j').html('¥' + data.data.realTotalMoney)
$('#goodsTotalMoney').html(data.data.realTotalMoney);
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
});
$('.con').on('tap', '.checkout', function() {
$(this).toggleClass('on');
if($(this).hasClass('on')) {
isUseScore = 1;
} else {
isUseScore = 0;
}
var couponIds = [];
$('select').each(function() {
couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
})
var couponIdsArr = couponIds.join(',');
var areaId2 = $('.address').attr('data-areaId2');
// console.log(areaId2)
// console.log(couponIdsArr)
// console.log(data_1.userAddress.areaId2)
// console.log(data_1.userAddress)
mui.ajax(hyhUrl('app/carts/getMoney'), { 
data: {
type: type,
areaId2: areaId2,
isUseScore: isUseScore,
useScore: data_1.useOrderScore,
couponIds: couponIdsArr
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
data = toJson(data);
// console.log(data.msg)
if(data.status == 1) {
// console.log(data)
// console.log(data.data.shopFreight)
// for(i in data.data){
// console.log(i)
// console.log(data.data[i])
// }
$('.js_r span j').html('¥' + data.data.realTotalMoney)
$('#goodsTotalMoney').html(data.data.realTotalMoney);
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
})
$('.footer').on('tap', '.btn_tj', function() {
payCode = $('.select_payway').attr('data-payCode');
if(payCode == 'ect') {
mui.ajax(hyhUrl('app/ect/getToEctNum'), { 
data: {
total_money: priceT
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功; 
var data = toJson(data);
if(data.status == 1) {
var btnArray = ['是', '否'];
mui.confirm(data.msg, 'ECT确认支付', btnArray, function(e) {
if(e.index == 1) {
return;
} else {
var addressId = $('.address').attr('data-addressId');
if(addressId) {
$('.bg').css('display', 'block');
$(".pay").slideDown(300);
} else {
alert('未设置收货地址!')
}
}
})
} else {
alert(data.msg);
return;
}
}
})
} else {
var addressId = $('.address').attr('data-addressId');
if(addressId) {
$('.bg').css('display', 'block');
$(".pay").slideDown(300);
} else {
alert('未设置收货地址!')
}
}
})
$('.bg').on('tap', '.mui-icon-left-nav', function() {
$('.pay').css('display', 'block');
$('.pay_way').css('display', 'none');
})
$('.bg').on('tap', '.mui-icon-closeempty', function() {
$('.bg').css('display', 'none');
$(".pay").slideUp(300, function() {
});
})
$('#pay_way').on('tap', '.row', function() {
$('#pay_way .row .mui-icon').removeClass('mui-icon-checkmarkempty');
$(this).children('.mui-icon').addClass('mui-icon-checkmarkempty');
$('.select_payway .row_right o').html($(this).children('.row_left').html());
$('.select_payway').attr('data-payCode', $(this).attr('data-payCode'))
$('.pay').css('display', 'block');
$('#pay_way').css('display', 'none');
})
$('.pay').on('tap', '.select_payway', function() {
if($(this).attr('data-payCode') == 'ect') {} else {
$('.pay').css('display', 'none');
$('#pay_way').css('display', 'block');
}
})
$('.pay_btn').on('tap', function() {
var addressId = $('.address').attr('data-addressId');
var areaId = $('.address').attr('data-areaId');
var that = $(this);
payCode = $('.select_payway').attr('data-payCode');
var data_send = {
type: type,
s_addressId: addressId,
s_areaId: areaId,
payCode: payCode,
payType: 1,
isUseScore: isUseScore,
useScore: data_1.useOrderScore,
deliverType: 0,
isInvoice: 0,
invoiceId: 0,
invoiceClient: ''
}
$('.remark').each(function() {
data_send['remark_' + ($(this).attr('data-shopid'))] = $(this).val();
});
$('select').each(function() {
data_send['couponId_' + ($(this).attr('data-shopid'))] = $(this).val();
})
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/orders/submit'), { 
data: data_send,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.status)
data = toJson(data);
if(data.status == 1) {
orderNo = data.data;
if(payCode == 'wallets' || payCode == 'ect') {
//跳输入密码的页面
mui.ajax(hyhUrl('app/' + payCode + '/payment'), { 
data: {
orderNo: data.data,
isBatch: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
$('.pay').css('display', 'none');
$('#pay_pwd').css('display', 'block');
if(data.data.payPwd == '0') {
alert('还未设置支付密码请先设置支付密码!');
var url = 'setting_fogetPayPwd';
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
}); 
} else if(payCode == 'alipays') {
pay('alipay', data.data);
// plus.nativeUI.showWaiting();
// mui.post(hyhUrl('app/Alipays/payment'), {
// orderNo: data.data,
// isBatch: 1
// var ALIPAYSERVER = hyhUrl('app/Alipays/payment?orderNo=' + data.data + '&isBatch=1');
}
that.removeAttr('disabled');
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}
})
})
$('#pay_pwd').on('tap', '.p9', function() {
var url = 'setting_fogetPayPwd';
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('#pay_pwd').on('tap', '.pay_btn_pwd', function() {
var payPwd = $('#payPwd').val();
if(payPwd == '') {
alert('支付密码不能为空!');
}
var that = $(this);
that.attr('disabled', 'disabled');
var srcc = ''
if(payCode == 'ect') {
srcc = 'payByEct';
} else {
srcc = 'payByWallet';
}
mui.ajax(hyhUrl('app/' + payCode + '/' + srcc), { 
data: {
orderNo: orderNo,
isBatch: 1,
payPwd: payPwd
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
var data = toJson(data);
alert(data.msg);
if(data.status == 1) {
// mui.back();
mui.openWindow({
url: 'indent.html',
id: 'indent.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_href: 'waitDeliver'
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: false, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
setTimeout(function() {
plus.webview.getWebviewById('confirmOrder.html').close();
}, 500)
} else {
mui.openWindow({
url: 'indent.html',
id: 'indent.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_href: 'waitPay'
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: false, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
setTimeout(function() {
plus.webview.getWebviewById('confirmOrder.html').close();
}, 500)
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
alert(errorThrown);      
}
}); 
})
})

818
static/app/js/details.js Executable file
View File

@ -0,0 +1,818 @@
var shareImgThumbs = [];
var shares = null;
var Intent = null,
File = null,
Uri = null,
main = null;
// H5 plus事件处理
function plusReady() {
updateSerivces();
if(plus.os.name == "Android") {
main = plus.android.runtimeMainActivity();
Intent = plus.android.importClass("android.content.Intent");
File = plus.android.importClass("java.io.File");
Uri = plus.android.importClass("android.net.Uri");
}
}
if(window.plus) {
plusReady();
} else {
document.addEventListener("plusready", plusReady, false);
}
/**
*
* 更新分享服务
*/
function updateSerivces() {
plus.share.getServices(function(s) {
shares = {};
for(var i in s) {
var t = s[i];
shares[t.id] = t;
}
}, function(e) {
plus.nativeUI.toast("获取分享服务列表失败:" + e.message);
});
}
/**
* 分享操作
* @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService)
* @param {Boolean} bh 是否分享链接
*/
function shareAction(sb, bh) {
if(!sb || !sb.s) {
plus.nativeUI.toast("无效的分享服务!");
return;
}
var msg = {
content: sharehrefDes.value,
extra: {
scene: sb.x
}
};
if(bh) {
msg.href = sharehref.value;
if(sharehrefTitle && sharehrefTitle.value != "") {
msg.title = sharehrefTitle.value;
}
if(sharehrefDes && sharehrefDes.value != "") {
msg.content = sharehrefDes.value;
}
// msg.thumbs = ["_www/logo.png"];
msg.thumbs = $('.swiper-slide img').eq(0).attr('src') ? [$('.swiper-slide img').eq(0).attr('src') + '/thumb60'] : ["_www/logo.png"];
msg.pictures = ["_www/logo.png"];
} else {
if(pic && pic.realUrl) {
msg.pictures = [pic.realUrl];
}
}
// 发送分享
if(sb.s.authenticated) {
// plus.nativeUI.toast("---已授权---");
shareMessage(msg, sb.s);
} else {
plus.nativeUI.toast("---未授权---");
sb.s.authorize(function() {
shareMessage(msg, sb.s);
}, function(e) {
plus.nativeUI.toast("认证授权失败:" + e.code + " - " + e.message);
});
}
}
/**
* 发送分享消息
* @param {JSON} msg
* @param {plus.share.ShareService} s
*/
function shareMessage(msg, s) {
// plus.nativeUI.toast(JSON.stringify(msg));
s.send(msg, function() {
plus.nativeUI.toast("分享到\"" + s.description + "\"成功! ");
}, function(e) {
plus.nativeUI.toast("分享到\"" + s.description + "\"失败 ");
});
}
// 分析链接
function shareHref() {
var shareBts = [];
// 更新分享列表
var ss = shares['weixin'];
ss && ss.nativeClient && (shareBts.push({
title: '微信朋友圈',
s: ss,
x: 'WXSceneTimeline'
}),
shareBts.push({
title: '微信好友',
s: ss,
x: 'WXSceneSession'
}));
// 弹出分享列表
shareBts.length > 0 ? plus.nativeUI.actionSheet({
title: '分享注册链接',
cancel: '取消',
buttons: shareBts
}, function(e) {
(e.index > 0) && shareAction(shareBts[e.index - 1], true);
}) : plus.nativeUI.plus.nativeUI.toast('当前环境无法支持分享链接操作!');
}
mui.plusReady(function() {
var data = '';
var data_saleSpec = {}
var arry_str = '';
var self = plus.webview.currentWebview();
var data_id = self.data_id;
var isEct = self.isEct;
var data_bak = {};
var token = localStorage.getItem('token');
var isShowWhsle = 0;
var shopQQ = '';
var shopTle = '';
// console.log(data_id)
function whslePrice(num, arry_str) {
for(var i in data_saleSpec) {
if(i == arry_str) {
// if(num >= (+(data_saleSpec[i].initNum)) && data_saleSpec[i].whslePrice > 0) {
if(isShowWhsle == 1 && data_saleSpec[i].whslePrice > 0) {
$('.cclass_con .cc2 o').html('批发单价:¥' + data_saleSpec[i].whslePrice);
$('.cclass_con .cc2 l').html('起批数:' + data_saleSpec[i].initNum + '件');
}
}
}
for(var i in data_saleSpec) {
if(i == arry_str) {
$('.cclass_con .cc2 p').html('¥' + data_saleSpec[i].specPrice);
}
}
}
mui.ajax(hyhUrl('app/Goods/detail'), { 
data: {
goodsId: data_id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
// console.log(data.status)
if(data.status == 1) {
// mui.alert('加载失败请重试!');
data = data.data;
data_bak = data;
shopQQ = data.shop.shopQQ;
shopTel = data.shop.shopTel;
var isEct = data.isEct;
if(!shopQQ && shopTel) {
$('#lxkf').html('<a href="tel:' + shopTel + '"><img src="../img/haitunlogo.png" /><p>客服</p></a>')
}
var html = '<div class="none" style="display: none;"><p>链接地址:</p><input id="sharehref" type="url" value="'+ data.goods_url +'" /><p>链接标题:</p><input id="sharehrefTitle" type="text" value="' + data.goodsName + '" /><p>链接描述:</p><input id="sharehrefDes" type="text" value="' + data.goodsTips + '" /></br></div><div class="banner"><div class="swiper-container"><div class="swiper-wrapper">';
var html2 = '';
$.each(data.gallery, function() {
html += '<div class="swiper-slide"><img src="' + hyhImgUrl(this) + '" /></div>';
});
if(isEct==1){
html += '</div></div></div><div class="summarize"><p class="price xxl"><o>ECT专享价</o>¥' + data.shopPrice + '</p><p class="price_old">市场价 <del>¥' + data.marketPrice + '</del></p><div class="compilations"><span class="myf">';
}else{
html += '</div></div></div><div class="summarize"><p class="price">¥' + data.shopPrice + '</p><p class="price"><o>到手价</o>¥' + Math.round(data.shopPrice * 0.8 * 100) / 100 + '</p><p class="price_old">市场价 <del>¥' + data.marketPrice + '</del></p><div class="compilations"><span class="myf">';
}
if(data.isFreeShipping == '1') {
html += '免运费';
} else {
html += '不包邮';
}
html += '</span><span class="yx">月销:' + data.saleNum + '件</span><span class="dz"></span></div><p class="cname" id="shareout" style="color:black;font-size:16px"><o> ' + data.goodsName + '</o><img id="share" src="../img/share.png"/></p>'
if(data.goodsTips) {
html += '<p class="cname">' + data.goodsTips + '</p>';
}
html += '</div><div class="guarantee"><div class="row clearfix yyyhhhqqq"><img src="../img/gouwuquan.png" /><span class="text">领取优惠券</span><button class="lq">领取</button></div><div class="row clearfix"><span class="text1">积分</span><span class="text">购买后可获得成交价格20%积分</span></div>';
if(isEct!=1){
html+='<div class="row clearfix"><span class="text1">惠宝</span><span class="text">本商品可用惠宝抵扣20%</span></div>'
}else{
}
if(data.promotionList != '') {
html += '<div class="mui-table-view-cell mui-collapse row_"><a class="mui-navigate-right" href="#">促销信息 :' + data.promotionList.rewardTitle + '</a><div class="mui-collapse-content" style="width:100%">';
$.each(data.promotionList.json, function() {
html += '<h4>满' + this.orderMoney + '元</h4>';
if(this.favourableJson.chk0 == true) {
html += '<h5>减' + this.favourableJson.chk0val + '元</h5>';
}
if(this.favourableJson.chk1 == true) {
html += '<h5>送' + this.favourableJson.chk1val.text + '</h5>';
}
if(this.favourableJson.chk2 == true) {
html += '<h5>免运费</h5>';
}
if(this.favourableJson.chk3 == true) {
html += '<h5>送满' + this.favourableJson.chk3val.text + '元优惠券 满' + this.favourableJson.chk3val.data.useMoney + '元使用</h5>';
}
});
html += '</div></div>';
}
html += '<div class="row clearfix"><span class="text">正品保证 </span><button class="caidan" style="display:none"><img src="../img/menu.png"/></button></div></div><div class="guarantee" id="guarantee"><div class="row clearfix" id="changeclass"><span class="text">选择颜色分类 号码尺寸</span><button class="caidan"><img src="../img/menu.png"/></button></div></div>';
if(data.oneAppraises == '') {
} else {
html += '<div class="pjrk" style="display:block"><p class="pj_title">商品评价(' + data.appraiseNum + '</p><div class="pj_breviary"><div class="pjbtitle clearfix"><img src="' + hyhImgUrl(data.oneAppraises.userPhoto) + '" /><p>' + data.oneAppraises.loginName + '</p></div><div class="pjbcon">' + data.oneAppraises.content + '</div><div class="pjclass">' + data.oneAppraises.goodsSpecNames + '</div></div><div class="pj_all">查看全部评价</div></div>';
}
var img_data = data.goodsDesc.replace(/src=\"__ROOT__\//g, 'data-src="').replace(/data-echo=\"__ROOT__\//g, 'src="' + hyhImgUrl('')).replace(/src=\"\//g, 'src="' + hyhImgUrl(''));
// console.log(img_data)
html += '<div class="shop_info"><div class="shop_title clearfix"><img src="' + hyhImgUrl(data.shop.shopImg) + '" /><p data-shopId="' + data.shop.shopId + '">' + data.shop.shopName + '</p></div><div class="shopinfocon clearfix"><div class="sicl"><div class="sicl_p1">' + data.goodsCount + '</div><div class="sicl_p2">全部宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.newGoodsCount + '</div><div class="sicl_p2">上新宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.favoritesShopsNum + '</div><div class="sicl_p2">关注人数</div></div><div class="sicr"><div class="sicr_p">宝贝描述&nbsp;<o>' + data.shop.goodsScore + '</o></div><div class="sicr_p">卖家服务&nbsp;<o>' + data.shop.serviceScore + '</o></div><div class="sicr_p">物流服务&nbsp;<o>' + data.shop.timeScore + '</o></div></div></div></div><div class="imgcon">' + img_data + '</div>';
$('.con').html(html);
$('.cclass_con .img').html('<img src="' + hyhImgUrl(data.goodsImg) + '" />');
$('.cclass_con .cc2 p').html('¥' + data.shopPrice);
$('.cclass_con .cc2 span').html('库存' + data.goodsStock + '件');
if(data.showWhsle == 1) {
isShowWhsle = 1;
}
$('#storebtn').attr('data-shopId', data.shopId);
$('.swiper-slide img').height($('.swiper-slide img').width());
$('.swiper-slide').height($('.swiper-slide').width());
// $('.banner').height($('.banner').width());
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
paginationClickable: true,
spaceBetween: 30,
autoplay: 3000
});
var html1 = '';
// var html1 = '<div class="mui-scroll-wrapper" id="hahaha"><div class="mui-scroll">';
$.each(data.spec, function() {
html1 += '<div class="cclass1 clearfix" data-class=""><p>' + this.name + '</p>'
$.each(this.list, function() {
// console.log(this.itemId)
html1 += '<div class="block" data-itemId="' + this.itemId + '">' + this.itemName + '</div>'
});
html1 += '</div>'
});
// html1+='</div></div>'
$('.ccclass').html(html1)
// var hahaha = mui('#hahaha').scroll();
// $('.ccclass').height($('#hahaha').height())
for(var i in data.saleSpec) {
data_saleSpec[i] = data.saleSpec[i];
}
if(data.couponList == '') {
$('.yyyhhhqqq').css('display', 'none');
} else {
$.each(data.couponList, function() {
html2 += '<div class="thq_block"><img src="../img/thq_bg.png"/><p>¥' + this.couponValue + '</p><span>满' + this.useMoney + '元使用</span><button class="lq_btn" data-couponId="' + this.couponId + '">领取</button></div>';
});
$('.yhqcon').html(html2);
}
} else if(data.status == -22) {
alert(data.msg);
mui.back();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
var scroll = mui('.mui-scroll-wrapper').scroll({
deceleration: 0.002 //flick 减速系数系数越大滚动速度越慢滚动距离越小默认值0.0006
});
//导航栏渐变
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
var num;
if(scroll.y >= -387 && scroll.y < 0) {
num = scroll.y / -387;
// console.log('渐变',num)
$('.header1').css({
'display': 'block',
'opacity': num
})
$('.zhe').css({
// 'display': 'block',
'opacity': num
})
var num1 = 0.2 - num * 0.2;
// $('.header .mui-action-back').css('background', 'rgba(0,0,0,' + num1 + ')')
} else if(scroll.y >= 0) {
num = 0;
// console.log('透明',num)
$('.header1').css({
'display': 'none',
'opacity': num
})
$('.zhe').css({
// 'display': 'none',
'opacity': num
})
// $('.header .mui-action-back').css('background', 'rgba(0, 0, 0, 0.2)')
} else if(scroll.y < -387) {
num = 1;
// console.log('不透明',num)
$('.header1').css({
'display': 'block',
'opacity': num
})
$('.zhe').css({
// 'display': 'block',
'opacity': num
});
// $('.header .mui-action-back').css('background', 'rgba(0, 0, 0, 0.2)')
}
//导航栏自动切换
if($('.imgcon').offset().top >= 66) {
$('#nav1').addClass("on").siblings().removeClass('on');
} else if($('.imgcon').offset().top < 66) {
$('#nav3').addClass("on").siblings().removeClass('on');
}
})
//点击导航栏跳转
mui('.nav').on('tap', '#nav1', function() {
mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 100);
$('#nav1').addClass("on").siblings().removeClass('on');
});
mui('.nav').on('tap', '#nav2', function() {
mui.openWindow({
url: 'appraise.html',
id: 'appraise.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
});
mui('.nav').on('tap', '#nav3', function() {
mui('.mui-scroll-wrapper').scroll().scrollTo(0, -1124, 100);
$('#nav3').addClass("on").siblings().removeClass('on');
});
mui('.con').on('tap', '#changeclass', function() {
$('#changeclass_con').show();
})
//选择类型
mui('.ccclass').on('tap', '.block', function() {
$(this).addClass('on').siblings().removeClass('on');
$(this).parent().attr('data-class', $(this).attr('data-itemId'));
var data_itemId = $(this).attr('data-itemId');
// console.log(data_itemId)
$.each(data.spec, function() {
$.each(this.list, function() {
if(this.itemId == data_itemId && this.itemImg != '') {
$('.cclass_con .img').html('<img src="' + hyhImgUrl(this.itemImg) + '" />');
}
});
});
var arry = [];
$.each($('.cclass1'), function() {
arry.push($(this).attr('data-class'))
});
arry.sort(function(a, b) {
return a - b;
});
arry_str = arry.join(':');
// $.each(data.saleSpec, function() {
// if(this == arry_str) {
// $('.cclass_con .cc2 p').html(this.specPrice);
// $('.cclass_con .cc2 span').html('库存' + this.specStock + '件');
//
// }
// });
for(var i in data_saleSpec) {
if(i == arry_str) {
$('.cclass_con .cc2 p').html(data_saleSpec[i].specPrice);
$('.cclass_con .cc2 span').html('库存' + data_saleSpec[i].specStock + '件');
}
}
var num = +$('.change_num input').val();
whslePrice(num, arry_str);
})
//跳转选择类型
$('.footer').on('tap', '.btn_ljgm', function() {
$('#changeclass_con').show();
})
mui('.cc2').on('tap', '.closecclass', function() {
$('#changeclass_con').hide();
})
mui('.en').on('tap', '.engwc', function() {
$('#changeclass_con').hide();
})
//改变数量
mui('.change_num').on('tap', '.jia', function() {
// console.log($(this).siblings('input').val())
var num = +$(this).siblings('input').val() + 1;
if(num <= 0) {
alert('购买数最小为1');
return;
}
$(this).siblings('input').val(num);
whslePrice(num, arry_str)
})
mui('.change_num').on('tap', '.jian', function() {
var num = +$(this).siblings('input').val() - 1;
if(num <= 0) {
alert('购买数最小为1');
return;
}
$(this).siblings('input').val(num);
whslePrice(num, arry_str)
})
$('.change_num input').on('change', function() {
var num = +$(this).val();
whslePrice(num, arry_str);
})
//加入购物车&购买
mui('.en').on('tap', '.enarr', function() {
var that = $(this);
var goodsId = data_id;
var buyNum = $('.change_num input').val();
var isGoodsSpecId = 0;
var goodsSpecId = 0;
var url = '';
if($(this).hasClass('engwc')) {
url = 'addCart';
} else if($(this).hasClass('ensure')) {
url = 'buy';
}
// console.log(data_bak.isSpec)
for(var i in data_saleSpec) {
if(i == arry_str) {
isGoodsSpecId = 1;
goodsSpecId = data_saleSpec[i].id;
}
}
if(isGoodsSpecId == 1) {
// goodsSpecId = arry_str;
} else if(data_bak.isSpec == 0) {
goodsSpecId = 0;
} else {
alert('请选择商品分类!');
return
}
// console.log(arry_str)
// console.log(goodsSpecId)
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/' + url), { 
data: {
goodsId: goodsId,
buyNum: buyNum,
goodsSpecId: goodsSpecId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
// console.log(data.msg);
// console.log(data.status);
if(data.status == 1) {
if(url == 'buy') {
mui.openWindow({
url: 'confirmOrder.html',
id: 'confirmOrder.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_id: data_id
type: 1
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
} else if(url == 'addCart') {
alert('添加购物车成功!')
}
} else {
alert(data.msg);
//location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
//打开评价列表
mui('.con').on('tap', '.pjrk', function() {
mui.openWindow({
url: 'appraise.html',
id: 'appraise.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.footer').on('tap', '#scbtn', function() {
var goodId = data_id;
var that = $(this);
if($('#scbtn p').html() == '收藏') {
mui.ajax(hyhUrl('app/Favorites/add'), { 
data: {
id: goodId,
type : 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
$('#scbtn p').html('已收藏');
$('#scbtn p').css('color', '#E41F4A');
$('#scbtn img').attr('src', '../img/likelogo1.png');
// that.addClass('gz_btn1').removeClass('gz_btn');
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
} else {
mui.ajax(hyhUrl('app/Favorites/cancel'), { 
data: {
id: goodId,
type : 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
$('#scbtn p').html('收藏');
$('#scbtn p').css('color', '#8f8f94');
$('#scbtn img').attr('src', '../img/likelogo.png');
// that.addClass('gz_btn1').removeClass('gz_btn');
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}
})
$('.footer').on('tap', '#storebtn', function() {
var shopId = this.attributes["data-shopId"].nodeValue;
var url = 'storeout.html';
if(shopId==1){
url='self_shop.html'
}
mui.openWindow({
url: url,
id: url+shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.con').on('tap', '.shop_title p', function() {
var shopId = this.attributes["data-shopId"].nodeValue;
var url = 'storeout.html';
if(shopId==1){
url='self_shop.html'
}
mui.openWindow({
url: url,
id: url+shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//弹出优惠券
$('.con').on('tap', '.lq', function() {
$('#youhuiquan_con').css('display', 'block');
})
//关闭优惠券
$('#youhuiquan_con').on('tap', '.thq_close', function() {
$('#youhuiquan_con').css('display', 'none');
})
//领取优惠券
$('#youhuiquan_con').on('tap', '.lq_btn', function() {
var couponId = $(this).attr('data-couponId');
mui.ajax(hyhUrl('addon/coupon-Coupons-receive'), { 
headers: { 
"HYH-Token": token
},
data: {
couponId: couponId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
alert(data.msg);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
})
//联系客服
$('#lxkf').on('tap', function() {
if(shopQQ) {
// location.href="http://wpa.qq.com/msgrd?v=3&uin="+ shopQQ +"&site=qq&menu=yes";
// mui.back();
// window.open("http://wpa.qq.com/msgrd?v=3&uin="+ shopQQ +"&site=qq&menu=yes")
if(plus.os.name == "iOS") {
plus.runtime.launchApplication({
action: "mqq://im/chat?chat_type=wpa&uin=" + shopQQ + "&version=1&src_type=web"
}, function(e) {
plus.nativeUI.confirm("检查到您未安装qq请先到appstore搜索下载", function(i) {
if(i.index == 0) {
iosAppstore("itunes.apple.com/cn/app/mqq/");
}
});
});
} else if(plus.os.name == "Android") {
var Intent = plus.android.importClass('android.content.Intent');
var Uri = plus.android.importClass('android.net.Uri');
var main = plus.android.runtimeMainActivity();
var uri = Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=" + shopQQ);
main.startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
}
})
//分享
$('.con').on('tap', '#share', function() {
shareHref();
})
})
// var self = plus.webview.currentWebview();
// console.log(self.aaa)

444
static/app/js/details_ac.js Executable file
View File

@ -0,0 +1,444 @@
mui.plusReady(function() {
var data = '';
var data_saleSpec = {}
var arry_str = '';
var self = plus.webview.currentWebview();
var data_id = self.data_id;
var data_bak = {}
function whslePrice(num, arry_str) {
for(var i in data_saleSpec) {
if(i == arry_str) {
if(num >= (+(data_saleSpec[i].initNum))) {
$('.cclass_con .cc2 p').html(data_saleSpec[i].whslePrice);
}
}
}
for(var i in data_saleSpec) {
if(i == arry_str) {
if(num < (+(data_saleSpec[i].initNum))) {
$('.cclass_con .cc2 p').html(data_saleSpec[i].specPrice);
}
}
}
}
mui.ajax(hyhUrl('app/Goods/detail'), { 
data: {
goodsId: data_id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status != 1) {
mui.alert('加载失败请重试!');
}
data = data.data;
data_bak = data;
var html = '<div class="banner"><div class="swiper-container"><div class="swiper-wrapper">';
$.each(data.gallery, function() {
html += '<div class="swiper-slide"><img src="' + hyhImgUrl(this) + '" /></div>';
});
html += '</div></div></div><div class="summarize"><p class="price">¥' + data.shopPrice + '</p><p class="price_old">价格 <del>¥' + data.marketPrice + '</del></p><div class="compilations"><span class="myf">';
if(data.isFreeShipping == '1') {
html += '免运费';
} else {
html += '不包邮';
}
html += '</span><span class="yx">月销:' + data.saleNum + '件</span><span class="dz"></span></div><p class="cname">商品介绍 ' + data.goodsTips + '</p></div><div class="guarantee"><div class="row clearfix" style="display:none"><img src="../img/gouwuquan.png" /><span class="text">全合源惠实物商品通用</span><button class="lq">领取</button></div><div class="row clearfix"><img src="../img/jifen.png" /><span class="text">购买后可获得100%积分</span></div><div class="row clearfix"><span class="text">正品保证 · 公益宝贝 · 赠运险费 · 极速退款 · 七天退货</span><button class="caidan" style="display:none"><img src="../img/menu.png"/></button></div></div><div class="guarantee" id="guarantee"><div class="row clearfix" id="changeclass"><span class="text">选择颜色分类 号码尺寸</span><button class="caidan"><img src="../img/menu.png"/></button></div></div>';
if(data.oneAppraises == '') {
} else {
html += '<div class="pjrk" style="display:none"><p class="pj_title">商品评价(' + data.appraiseNum + '</p><div class="pj_breviary"><div class="pjbtitle clearfix"><img src="' + hyhImgUrl(data.oneAppraises.userPhoto) + '" /><p>' + data.oneAppraises.loginName + '</p></div><div class="pjbcon">' + data.oneAppraises.content + '</div><div class="pjclass">' + data.oneAppraises.goodsSpecNames + '</div></div><div class="pj_all">查看全部评价</div></div>';
}
html += '<div class="shop_info"><div class="shop_title clearfix"><img src="' + hyhImgUrl(data.shop.shopImg) + '" /><p>' + data.shop.shopName + '</p></div><div class="shopinfocon clearfix"><div class="sicl"><div class="sicl_p1">' + data.goodsCount + '</div><div class="sicl_p2">全部宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.newGoodsCount + '</div><div class="sicl_p2">上新宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.favoritesShopsNum + '</div><div class="sicl_p2">关注人数</div></div><div class="sicr"><div class="sicr_p">宝贝描述&nbsp;<o>' + data.shop.goodsScore + '</o></div><div class="sicr_p">卖家服务&nbsp;<o>' + data.shop.serviceScore + '</o></div><div class="sicr_p">物流服务&nbsp;<o>' + data.shop.timeScore + '</o></div></div></div></div><div class="imgcon">' + data.goodsDesc + '</div>';
$('.con').html(html);
$('.cclass_con .img').html('<img src="' + hyhImgUrl(data.goodsImg) + '" />');
$('.cclass_con .cc2 p').html(data.shopPrice);
$('.cclass_con .cc2 span').html('库存' + data.goodsStock + '件');
$('#storebtn').attr('data-shopId', data.shopId)
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
paginationClickable: true,
spaceBetween: 30,
autoplay: 3000
});
var html1 = '';
$.each(data.spec, function() {
html1 += '<div class="cclass1 clearfix" data-class=""><p>' + this.name + '</p>'
$.each(this.list, function() {
html1 += '<div class="block" data-itemId="' + this.itemId + '">' + this.itemName + '</div>'
});
html1 += '</div>'
});
$('.ccclass').html(html1)
for(var i in data.saleSpec) {
data_saleSpec[i] = data.saleSpec[i];
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
var scroll = mui('.mui-scroll-wrapper').scroll({
deceleration: 0.002 //flick 减速系数系数越大滚动速度越慢滚动距离越小默认值0.0006
});
//导航栏渐变
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
var num;
if(scroll.y >= -387 && scroll.y < 0) {
num = scroll.y / -387;
// console.log('渐变',num)
$('.header1').css({
'display': 'block',
'opacity': num
})
$('.zhe').css({
'display': 'block',
'opacity': num
})
var num1 = 0.2 - num * 0.2;
// $('.header .mui-action-back').css('background', 'rgba(0,0,0,' + num1 + ')')
} else if(scroll.y >= 0) {
num = 0;
// console.log('透明',num)
$('.header1').css({
'display': 'none',
'opacity': num
})
$('.zhe').css({
'display': 'none',
'opacity': num
})
// $('.header .mui-action-back').css('background', 'rgba(0, 0, 0, 0.2)')
} else if(scroll.y < -387) {
num = 1;
// console.log('不透明',num)
$('.header1').css({
'display': 'block',
'opacity': num
})
$('.zhe').css({
'display': 'block',
'opacity': num
});
// $('.header .mui-action-back').css('background', 'rgba(0, 0, 0, 0.2)')
}
//导航栏自动切换
if($('.imgcon').offset().top >= 66) {
$('#nav1').addClass("on").siblings().removeClass('on');
} else if($('.imgcon').offset().top < 66) {
$('#nav3').addClass("on").siblings().removeClass('on');
}
})
//点击导航栏跳转
mui('.nav').on('tap', '#nav1', function() {
mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 100);
$('#nav1').addClass("on").siblings().removeClass('on');
});
mui('.nav').on('tap', '#nav2', function() {
mui.openWindow({
url: 'appraise.html',
id: 'appraise.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
});
mui('.nav').on('tap', '#nav3', function() {
mui('.mui-scroll-wrapper').scroll().scrollTo(0, -1124, 100);
$('#nav3').addClass("on").siblings().removeClass('on');
});
mui('.con').on('tap', '#changeclass', function() {
$('#changeclass_con').show();
})
//选择类型
mui('.ccclass').on('tap', '.block', function() {
$(this).addClass('on').siblings().removeClass('on');
$(this).parent().attr('data-class', $(this).attr('data-itemId'));
var data_itemId = $(this).attr('data-itemId');
$.each(data.spec, function() {
$.each(this.list, function() {
if(this.itemId == data_itemId && this.itemImg != '') {
$('.cclass_con .img').html('<img src="' + hyhImgUrl(this.itemImg) + '" />');
}
});
});
var arry = [];
$.each($('.cclass1'), function() {
arry.push($(this).attr('data-class'))
});
arry.sort(function(a, b) {
return a - b;
});
arry_str = arry.join(':');
$.each(data.saleSpec, function() {
if(this == arry_str) {
$('.cclass_con .cc2 p').html(this.specPrice);
$('.cclass_con .cc2 span').html('库存' + this.specStock + '件');
}
});
for(var i in data_saleSpec) {
if(i == arry_str) {
$('.cclass_con .cc2 p').html(data_saleSpec[i].specPrice);
$('.cclass_con .cc2 span').html('库存' + data_saleSpec[i].specStock + '件');
}
}
var num = +$('.change_num input').val();
whslePrice(num, arry_str);
})
//跳转选择类型
$('.footer').on('tap', '.btn_ljgm', function() {
$('#changeclass_con').show();
})
mui('.cc2').on('tap', '.closecclass', function() {
$('#changeclass_con').hide();
})
mui('.en').on('tap', '.engwc', function() {
$('#changeclass_con').hide();
})
//改变数量
mui('.change_num').on('tap', '.jia', function() {
// console.log($(this).siblings('input').val())
var num = +$(this).siblings('input').val() + 1;
if(num <= 0) {
alert('购买数最小为1');
return;
}
$(this).siblings('input').val(num);
whslePrice(num, arry_str)
})
mui('.change_num').on('tap', '.jian', function() {
var num = +$(this).siblings('input').val() - 1;
if(num <= 0) {
alert('购买数最小为1');
return;
}
$(this).siblings('input').val(num);
whslePrice(num, arry_str)
})
$('.change_num input').on('change', function() {
var num = +$(this).val();
whslePrice(num, arry_str);
})
//加入购物车&购买
mui('.en').on('tap', '.enarr', function() {
var that = $(this);
var goodsId = data_id;
var buyNum = $('.change_num input').val();
var isGoodsSpecId = 0;
var goodsSpecId = 0;
var url = '';
if($(this).hasClass('engwc')) {
url = 'addCart';
} else if($(this).hasClass('ensure')) {
url = 'buy';
}
// console.log(data_bak.isSpec)
for(var i in data_saleSpec) {
if(i == arry_str) {
isGoodsSpecId = 1;
}
}
if(isGoodsSpecId == 1) {
goodsSpecId = arry_str;
} else if(data_bak.isSpec == 0) {
goodsSpecId = 0;
} else {
alert('请选择商品分类!');
return
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/' + url), { 
data: {
goodsId: goodsId,
buyNum: buyNum,
goodsSpecId: goodsSpecId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
if(url == 'buy') {
mui.openWindow({
url: 'confirmOrder.html',
id: 'confirmOrder.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_id: data_id
type: 1
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
} else if(url == 'addCart') {
alert('添加购物车成功!')
}
} else {
alert(data.msg);
//location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
//打开评价列表
mui('.con').on('tap', '.pjrk', function() {
mui.openWindow({
url: 'appraise.html',
id: 'appraise.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.footer').on('tap', '#storebtn', function() {
var shopId = this.attributes["data-shopId"].nodeValue;
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html'+shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})
// var self = plus.webview.currentWebview();
// console.log(self.aaa)

80
static/app/js/discounts.js Executable file
View File

@ -0,0 +1,80 @@
jumpPage();
function jumpPage() {
//跳转页面
var subpages = ['choiceness.html', 'dynamic.html', 'new_product.html'];
var subpage_style = {
top: '103px',
bottom: '0px',
scrollIndicator: 'none'
};
var aniShow = {}; //动画显示
//当前激活选项
var activeTab = subpages[0];
//选项卡点击事件
mui('.nav').on('tap', 'a', function(e) {
var targetTab = this.getAttribute('href');
if(targetTab == activeTab) {
return;
}
//显示目标选项卡
//若为iOS平台或非首次显示则直接显示
if(mui.os.ios || aniShow[targetTab]) {
plus.webview.show(targetTab);
} else {
//否则使用fade-in动画且保存变量
var temp = {};
temp[targetTab] = "true";
mui.extend(aniShow, temp);
plus.webview.show(targetTab, "fade-in", 300);
}
//隐藏当前;
plus.webview.hide(activeTab);
//更改当前活跃的选项卡
activeTab = targetTab;
if(targetTab == 'choiceness.html') {
document.getElementsByClassName('p1')[1].classList.remove('on')
document.getElementsByClassName('p1')[2].classList.remove('on')
this.classList.add('on');
}
if(targetTab == 'dynamic.html') {
document.getElementsByClassName('p1')[0].classList.remove('on')
document.getElementsByClassName('p1')[2].classList.remove('on')
this.classList.add('on');
}
if(targetTab == 'new_product.html') {
document.getElementsByClassName('p1')[0].classList.remove('on')
document.getElementsByClassName('p1')[1].classList.remove('on')
this.classList.add('on');
}
});
//首次启动切滑效果
mui.plusReady(function() {
window.addEventListener('refresh', function(e) {
location.reload();
})
// launchScreen();
// plus.navigator.setStatusBarStyle('dark');
// console.log(plus.navigator.getStatusBarStyle())
var self = plus.webview.currentWebview();
for(var i = 0; i < subpages.length; i++) {
var temp = {};
//http://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.create
var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
if(i > 0) {
sub.hide();
} else {
temp[subpages[i]] = "true";
mui.extend(aniShow, temp); //合并对象
}
self.append(sub);
}
});
}

171
static/app/js/dynamic.js Executable file
View File

@ -0,0 +1,171 @@
var token = localStorage.getItem('token');
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
var count = 1;
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
// console.log(order_class)
mui.ajax(hyhUrl('addon/hyhprom-Hyhpromuser-getShopPromByUser'), { 
headers: { 
"HYH-Token": token
},
data: {
page: count,
pagesize : 10
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
data = data.data;
if(data.Rows.length == 0) {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
return;
}
var html = ''
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.newTime + '</p></div><div class="b_con clearfix">' + this.promInfo + '</div></div>'
});
$('.con').append(html);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}, 500);
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
mui.plusReady(function() {
var data = '';
mui.ajax(hyhUrl('addon/hyhprom-Hyhpromuser-getShopPromByUser'), { 
data: {
pagesize: 10,
page: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
if(data.status == 1) {
data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.updateTime + '</p></div><div class="b_con clearfix">' + this.promInfo + '</div></div>'
});
$('.con').html(html);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.con').on('tap', '.b_title', function() {
var shopId = $(this).attr('data-shopId');
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html'+shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.con').on('tap', 'img[data-goodId]', function() {
var goodId = $(this).attr('data-goodId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

158
static/app/js/ect_address.js Executable file
View File

@ -0,0 +1,158 @@
mui.plusReady(function() {
// function hyhUrl(url) {
// return 'http://192.168.1.101/hyh/' + url;
// }
var token = localStorage.getItem('token');
// alert(token);
mui.ajax(hyhUrl('app/Ectwallets/listQuery'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
var html = '';
if(data.data != '') {
$.each(data.data, function() {
html += '<div class="row"><div class="r_con"><p>钱包地址 ' + this.eAddress + '</p></div><div class="r_bottom" data-eWalletId="' + this.eWalletId + '" data-isDefault="' + this.isDefault + '"><div class="default"><div class="check"></div><p>设为默认</p></div><div class="del">删除</div></div></div>';
});
$('.mui-scroll').html(html);
$('.row').each(function() {
if($(this).children('.r_bottom').attr('data-isDefault') == 1) {
$(this).children('.r_bottom').children('.default').children('.check').addClass('on');
}
})
}
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
//设为默认
$('.mui-scroll').on('tap', '.default', function() {
if($(this).parent().attr('data-isDefault') == 0) {
if(confirm('设为默认地址?')) {
var eWalletId = $(this).parent().attr('data-eWalletId');
// console.log(eWalletId)
mui.ajax(hyhUrl('app/Ectwallets/setDefault'), { 
headers: { 
"HYH-Token": token
},
data: {
eWalletId: eWalletId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
plus.nativeUI.toast(data.msg);
location.reload();
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
}
}
})
//删除地址
$('.mui-scroll').on('tap', '.del', function() {
if(confirm('删除地址?')) {
var eWalletId = $(this).parent().attr('data-eWalletId');
// console.log(eWalletId)
mui.ajax(hyhUrl('app/Ectwallets/del'), { 
headers: { 
"HYH-Token": token
},
data: {
eWalletId: eWalletId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
plus.nativeUI.toast(data.msg);
location.reload();
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
}
})
//添加地址
$('.add').on('tap', function() {
var eAddress = '';
var eAddress_ = '';
if(eAddress = prompt('请输入钱包地址')) {
if(eAddress.length != 42) {
alert('钱包地址长度必须为42位');
return;
}
// if(eAddress_ = prompt('请再次输入钱包地址')) {
// if(eAddress == eAddress_) {
var isDefault = 0;
if(confirm('是否设为默认地址?')) {
isDefault = 1;
}
mui.ajax(hyhUrl('app/Ectwallets/add'), { 
headers: { 
"HYH-Token": token
},
data: {
eAddress: eAddress,
isDefault: isDefault
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
plus.nativeUI.toast(data.msg);
location.reload();
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
// } else {
// alert('两次地址输入不一致!');
// }
// }
}
})
})

85
static/app/js/ect_index.js Executable file
View File

@ -0,0 +1,85 @@
mui.plusReady(function() {
// $('#ect_withdraw_deposit').css('display','none');
$('#ect_transfer_accounts').css('display','none');
// function hyhUrl(url) {
// return 'http://192.168.1.101/hyh/' + url;
// }
window.addEventListener('refresh', function(e) { //执行刷新
location.reload();
});
var token = localStorage.getItem('token');
// alert(token);
mui.ajax(hyhUrl('app/Ectwallets/index'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
$('.num p').html(data.data.ectNum);
if(data.data.eAddressInfo.eAddress){
$('#ect_add').html('钱包地址:' + data.data.eAddressInfo.eAddress);
}else{
$('#ect_add').html('钱包地址:未设置钱包地址' );
}
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
//跳转
$('body').on('tap', '.row', function() {
var url = $(this).attr('id')+'.html';
mui.openWindow({
url: url,
id: url,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

104
static/app/js/ect_list.js Executable file
View File

@ -0,0 +1,104 @@
mui.plusReady(function() {
var isjiazai = 1;
var page = 1;
// function hyhUrl(url) {
// return 'http://192.168.1.101/hyh/' + url;
// }
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
}
var token = localStorage.getItem('token');
// alert(token);
function getDate(page) {
var num = page;
if(isjiazai == 0) {
return;
} else {
isjiazai = 0;
}
mui.ajax(hyhUrl('app/Ectwallets/getEctLog'), { 
headers: { 
"HYH-Token": token
},
data: {
page: num
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
var html = '';
if(data.data.Rows == '') {
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多记录</p>');
isjiazai = 0;
return;
}
$.each(data.data.Rows, function() {
var ectType;
var dataSrc;
if(this.ectType == 1) {
ectType = '+';
} else {
ectType = '-';
}
if(this.dataSrc == 1) {
dataSrc = '注册赠送';
} else if(this.dataSrc == 2) {
dataSrc = '推荐赠送';
} else if(this.dataSrc == 3) {
dataSrc = '交易';
} else if(this.dataSrc == 4) {
dataSrc = '提现';
}else if(this.dataSrc == 5) {
dataSrc = '联盟积分转换';
}else if(this.dataSrc == 6) {
dataSrc = '成为商家';
}else if(this.dataSrc == 7) {
dataSrc = '推荐成为商家';
}else if(this.dataSrc == 8) {
dataSrc = '成为线上商城商家';
}else if(this.dataSrc == 9) {
dataSrc = '推荐成为线上商城商家';
}
html += '<div class="block"><img src="../img/ect_list_bg.png"/><div class="s1">ECT变动记录</div><div class="s2">' + getLocalTime(this.createTime) + '</div><div class="s3">变动数量</div><div class="s4">' + ectType + ' ' + this.ectNum + ' </div><div class="s5">变动类型:<o>' + dataSrc + '</o></div><div class="s6">备注:<o>' + this.dataRemarks + '</o></div></div>'
});
if(page == 1) {
$('.mui-scroll').html(html);
} else {
$('.mui-scroll').append(html);
}
isjiazai = 1
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
}
getDate(page);
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
getDate(page);
}
}
})
})

View File

@ -0,0 +1,138 @@
mui.plusReady(function() {
// function hyhUrl(url) {
// return 'http://192.168.1.101/hyh/' + url;
// }
var token = localStorage.getItem('token');
$('input').eq(0).attr('id','ectNum');
$('input').eq(1).attr('id','payPwd');
$('.num p').html('');
$('input').eq(0).attr('placeholder','ect数量至少为500');
// alert(token);
mui.ajax(hyhUrl('app/Ectwallets/listQuery'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
var html = '';
if(data.data != '') {
$.each(data.data, function() {
html += '<option value="' + this.eAddress + '">' + this.eAddress + '</option>'
});
$('#select').html(html);
}
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
mui.ajax(hyhUrl('app/Ectwallets/index'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
$('.num p').html(data.data.ectNum);
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
mui('body').on('tap', '.btn_ture', function() {
var eAddress = $('#select').val();
var ectNum = $('#ectNum').val();
var payPwd = $('#payPwd').val();
if(eAddress == '') {
plus.nativeUI.toast('未选择钱包地址');
return;
}
if(!(ectNum >= 500)) {
plus.nativeUI.toast('ect数量必须大于500');
return;
}
if(payPwd == '') {
plus.nativeUI.toast('未填写支付密码');
return;
}
$('.btn_ture').attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/Ectwallets/withdraw'), { 
headers: { 
"HYH-Token": token
},
data: {
eAddress: eAddress,
ectNum: ectNum,
payPwd: payPwd
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功; 
var data = toJson(data, 1);
if(data.status == 1) {
// console.log(data.data.id)
var id =data.data.id;
// $('.btn_ture').removeAttr('disabled');
mui.ajax('http://moacapi.heyuanhui.cn/api/ect/ect_transfer', { 
data: {
id:id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
var data = toJson(data, 1);
if(data.status == 1) {
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
mui.fire(plus.webview.getWebviewById('ect_index.html'), 'refresh');
alert(data.msg);
location.reload();
} else {
// console.log(data.status)
}
$('.btn_ture').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
} else {
alert(data.msg);
location.reload();
$('.btn_ture').removeAttr('disabled');
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
})
})

View File

288
static/app/js/editAddress.js Executable file
View File

@ -0,0 +1,288 @@
mui.init({
beforeback: function() {     //获得父页面的webview
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'reload');
//返回true,继续页面关闭逻辑
return true;
}
});
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var addressId = self.data_addressId ? self.data_addressId : 0;
var isParentId = 1;
var isProvince;
var isCity;
var userName = $('#userName');
var userPhone = $('#userPhone');
var province = $('#province');
var city = $('#city');
var Area = $('#area');
var Textarea = $('textarea');
var areaVal;
if(addressId != 0) {
$('.address_info').css('display', 'none');
$('.add_info').css('display', 'block');
mui.ajax(hyhUrl('app/useraddress/getById'), { 
data: {
addressId: addressId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
userName.val(data.userName)
userPhone.val(data.userPhone)
$('.add_info').html(data.areaName)
Textarea.val(data.userAddress)
areaVal = data.areaId
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
mui.ajax(hyhUrl('app/areas/listQuery'), { 
data: {
parentId: 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '<option value="">选择省</option>';
$.each(data, function() {
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
});
$('#province').html(html);
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
});
// $('.scroll_out1').on('tap', '#province', function() {
// if(isParentId == 1) {
// isParentId = 0;
// mui.ajax(hyhUrl('app/areas/listQuery'), { 
// data: {
// parentId: 0
// },
// dataType: 'json', //服务器返回json格式数据  
// type: 'post', //HTTP请求类型  
// timeout: 10000, //超时时间设置为10秒  
// success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// data = toJson(data);
// if(data.status == 1) {
// data = data.data;
// var html = '';
// $.each(data, function() {
// html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
// });
// $('#province').html(html);
// var province = data[0].areaId;
// mui.ajax(hyhUrl('app/areas/listQuery'), { 
// data: {
// parentId: province
// },
// dataType: 'json', //服务器返回json格式数据  
// type: 'post', //HTTP请求类型  
// timeout: 10000, //超时时间设置为10秒  
// success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// data = toJson(data);
// if(data.status == 1) {
// data = data.data;
// var html = '';
// $.each(data, function() {
// html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
// });
// $('#city').html(html);
// var city = data[0].areaId;
// mui.ajax(hyhUrl('app/areas/listQuery'), { 
// data: {
// parentId: city
// },
// dataType: 'json', //服务器返回json格式数据  
// type: 'post', //HTTP请求类型  
// timeout: 10000, //超时时间设置为10秒  
// success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// data = toJson(data);
// if(data.status == 1) {
// data = data.data;
// var html = '';
// $.each(data, function() {
// html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
// });
// $('#area').html(html);
// isCity = city;
// } else {
// alert('发生错误请刷新后重试!');
// // location.reload();
// }
// },
// error: function(xhr, type, errorThrown) {           //异常处理;  
// // alert(type);      
// }  
// }); 
// isProvince = province;
// } else {
// alert('发生错误请刷新后重试!');
// // location.reload();
// }
// },
// error: function(xhr, type, errorThrown) {           //异常处理;  
// // alert(type);      
// }  
// });
// } else {
// alert('发生错误请刷新后重试!');
// // location.reload();
// }
// },
// error: function(xhr, type, errorThrown) {           //异常处理;  
// // alert(type);      
// }  
// }); 
// }
//
// })
$('.scroll_out1').on('change', '#province', function() {
var province = $(this).val()
if(isProvince != province) {
mui.ajax(hyhUrl('app/areas/listQuery'), { 
data: {
parentId: province
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '<option value="">选择市</option>';
$.each(data, function() {
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
});
$('#city').html(html);
// var city = data[0].areaId;
// mui.ajax(hyhUrl('app/areas/listQuery'), { 
// data: {
// parentId: city
// },
// dataType: 'json', //服务器返回json格式数据  
// type: 'post', //HTTP请求类型  
// timeout: 10000, //超时时间设置为10秒  
// success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// data = toJson(data);
// if(data.status == 1) {
// data = data.data;
var html = '<option value="">选择区</option>';
// $.each(data, function() {
// html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
// });
$('#area').html(html);
// isCity = city;
// } else {
// alert('发生错误请刷新后重试!');
// // location.reload();
// }
// },
// error: function(xhr, type, errorThrown) {           //异常处理;  
// // alert(type);      
// }  
// }); 
isProvince = province;
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
})
$('.scroll_out1').on('change', '#city', function() {
var city = $(this).val()
if(isCity != city) {
mui.ajax(hyhUrl('app/areas/listQuery'), { 
data: {
parentId: city
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '<option value="">选择区</option>';
$.each(data, function() {
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
});
$('#area').html(html);
isCity = city;
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
})
$('.bc_btn').on('tap', function() {
var isDefault = $('input:radio[name="isDefault"]:checked').val() ? $('input:radio[name="isDefault"]:checked').val() : 0;
areaVal = $('#area').val() ? $('#area').val() : areaVal;
var data = {
isDefault: isDefault,
addressId: addressId,
userName: $('#userName').val(),
areaId: areaVal,
userPhone: $('#userPhone').val(),
userAddress: $('textarea').val(),
}
mui.ajax(hyhUrl('app/useraddress/edits'), { 
data: data,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
mui.back();
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
$('.add_info').on('tap', function() {
$('.address_info').css('display', 'block');
$('.add_info').css('display', 'none');
})
})

640
static/app/js/exif.js Executable file
View File

@ -0,0 +1,640 @@
/*
* Javascript EXIF Reader 0.1.6
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
* Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
*/
var EXIF = (function() {
var debug = false;
var ExifTags = {
// version tags
0x9000: "ExifVersion", // EXIF version
0xA000: "FlashpixVersion", // Flashpix format version
// colorspace tags
0xA001: "ColorSpace", // Color space information tag
// image configuration
0xA002: "PixelXDimension", // Valid width of meaningful image
0xA003: "PixelYDimension", // Valid height of meaningful image
0x9101: "ComponentsConfiguration", // Information about channels
0x9102: "CompressedBitsPerPixel", // Compressed bits per pixel
// user information
0x927C: "MakerNote", // Any desired information written by the manufacturer
0x9286: "UserComment", // Comments by user
// related file
0xA004: "RelatedSoundFile", // Name of related sound file
// date and time
0x9003: "DateTimeOriginal", // Date and time when the original image was generated
0x9004: "DateTimeDigitized", // Date and time when the image was stored digitally
0x9290: "SubsecTime", // Fractions of seconds for DateTime
0x9291: "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal
0x9292: "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized
// picture-taking conditions
0x829A: "ExposureTime", // Exposure time (in seconds)
0x829D: "FNumber", // F number
0x8822: "ExposureProgram", // Exposure program
0x8824: "SpectralSensitivity", // Spectral sensitivity
0x8827: "ISOSpeedRatings", // ISO speed rating
0x8828: "OECF", // Optoelectric conversion factor
0x9201: "ShutterSpeedValue", // Shutter speed
0x9202: "ApertureValue", // Lens aperture
0x9203: "BrightnessValue", // Value of brightness
0x9204: "ExposureBias", // Exposure bias
0x9205: "MaxApertureValue", // Smallest F number of lens
0x9206: "SubjectDistance", // Distance to subject in meters
0x9207: "MeteringMode", // Metering mode
0x9208: "LightSource", // Kind of light source
0x9209: "Flash", // Flash status
0x9214: "SubjectArea", // Location and area of main subject
0x920A: "FocalLength", // Focal length of the lens in mm
0xA20B: "FlashEnergy", // Strobe energy in BCPS
0xA20C: "SpatialFrequencyResponse", //
0xA20E: "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit
0xA20F: "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit
0xA210: "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
0xA214: "SubjectLocation", // Location of subject in image
0xA215: "ExposureIndex", // Exposure index selected on camera
0xA217: "SensingMethod", // Image sensor type
0xA300: "FileSource", // Image source (3 == DSC)
0xA301: "SceneType", // Scene type (1 == directly photographed)
0xA302: "CFAPattern", // Color filter array geometric pattern
0xA401: "CustomRendered", // Special processing
0xA402: "ExposureMode", // Exposure mode
0xA403: "WhiteBalance", // 1 = auto white balance, 2 = manual
0xA404: "DigitalZoomRation", // Digital zoom ratio
0xA405: "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm)
0xA406: "SceneCaptureType", // Type of scene
0xA407: "GainControl", // Degree of overall image gain adjustment
0xA408: "Contrast", // Direction of contrast processing applied by camera
0xA409: "Saturation", // Direction of saturation processing applied by camera
0xA40A: "Sharpness", // Direction of sharpness processing applied by camera
0xA40B: "DeviceSettingDescription", //
0xA40C: "SubjectDistanceRange", // Distance to subject
// other tags
0xA005: "InteroperabilityIFDPointer",
0xA420: "ImageUniqueID" // Identifier assigned uniquely to each image
};
var TiffTags = {
0x0100: "ImageWidth",
0x0101: "ImageHeight",
0x8769: "ExifIFDPointer",
0x8825: "GPSInfoIFDPointer",
0xA005: "InteroperabilityIFDPointer",
0x0102: "BitsPerSample",
0x0103: "Compression",
0x0106: "PhotometricInterpretation",
0x0112: "Orientation",
0x0115: "SamplesPerPixel",
0x011C: "PlanarConfiguration",
0x0212: "YCbCrSubSampling",
0x0213: "YCbCrPositioning",
0x011A: "XResolution",
0x011B: "YResolution",
0x0128: "ResolutionUnit",
0x0111: "StripOffsets",
0x0116: "RowsPerStrip",
0x0117: "StripByteCounts",
0x0201: "JPEGInterchangeFormat",
0x0202: "JPEGInterchangeFormatLength",
0x012D: "TransferFunction",
0x013E: "WhitePoint",
0x013F: "PrimaryChromaticities",
0x0211: "YCbCrCoefficients",
0x0214: "ReferenceBlackWhite",
0x0132: "DateTime",
0x010E: "ImageDescription",
0x010F: "Make",
0x0110: "Model",
0x0131: "Software",
0x013B: "Artist",
0x8298: "Copyright"
};
var GPSTags = {
0x0000: "GPSVersionID",
0x0001: "GPSLatitudeRef",
0x0002: "GPSLatitude",
0x0003: "GPSLongitudeRef",
0x0004: "GPSLongitude",
0x0005: "GPSAltitudeRef",
0x0006: "GPSAltitude",
0x0007: "GPSTimeStamp",
0x0008: "GPSSatellites",
0x0009: "GPSStatus",
0x000A: "GPSMeasureMode",
0x000B: "GPSDOP",
0x000C: "GPSSpeedRef",
0x000D: "GPSSpeed",
0x000E: "GPSTrackRef",
0x000F: "GPSTrack",
0x0010: "GPSImgDirectionRef",
0x0011: "GPSImgDirection",
0x0012: "GPSMapDatum",
0x0013: "GPSDestLatitudeRef",
0x0014: "GPSDestLatitude",
0x0015: "GPSDestLongitudeRef",
0x0016: "GPSDestLongitude",
0x0017: "GPSDestBearingRef",
0x0018: "GPSDestBearing",
0x0019: "GPSDestDistanceRef",
0x001A: "GPSDestDistance",
0x001B: "GPSProcessingMethod",
0x001C: "GPSAreaInformation",
0x001D: "GPSDateStamp",
0x001E: "GPSDifferential"
};
var StringValues = {
ExposureProgram: {
0: "Not defined",
1: "Manual",
2: "Normal program",
3: "Aperture priority",
4: "Shutter priority",
5: "Creative program",
6: "Action program",
7: "Portrait mode",
8: "Landscape mode"
},
MeteringMode: {
0: "Unknown",
1: "Average",
2: "CenterWeightedAverage",
3: "Spot",
4: "MultiSpot",
5: "Pattern",
6: "Partial",
255: "Other"
},
LightSource: {
0: "Unknown",
1: "Daylight",
2: "Fluorescent",
3: "Tungsten (incandescent light)",
4: "Flash",
9: "Fine weather",
10: "Cloudy weather",
11: "Shade",
12: "Daylight fluorescent (D 5700 - 7100K)",
13: "Day white fluorescent (N 4600 - 5400K)",
14: "Cool white fluorescent (W 3900 - 4500K)",
15: "White fluorescent (WW 3200 - 3700K)",
17: "Standard light A",
18: "Standard light B",
19: "Standard light C",
20: "D55",
21: "D65",
22: "D75",
23: "D50",
24: "ISO studio tungsten",
255: "Other"
},
Flash: {
0x0000: "Flash did not fire",
0x0001: "Flash fired",
0x0005: "Strobe return light not detected",
0x0007: "Strobe return light detected",
0x0009: "Flash fired, compulsory flash mode",
0x000D: "Flash fired, compulsory flash mode, return light not detected",
0x000F: "Flash fired, compulsory flash mode, return light detected",
0x0010: "Flash did not fire, compulsory flash mode",
0x0018: "Flash did not fire, auto mode",
0x0019: "Flash fired, auto mode",
0x001D: "Flash fired, auto mode, return light not detected",
0x001F: "Flash fired, auto mode, return light detected",
0x0020: "No flash function",
0x0041: "Flash fired, red-eye reduction mode",
0x0045: "Flash fired, red-eye reduction mode, return light not detected",
0x0047: "Flash fired, red-eye reduction mode, return light detected",
0x0049: "Flash fired, compulsory flash mode, red-eye reduction mode",
0x004D: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
0x004F: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
0x0059: "Flash fired, auto mode, red-eye reduction mode",
0x005D: "Flash fired, auto mode, return light not detected, red-eye reduction mode",
0x005F: "Flash fired, auto mode, return light detected, red-eye reduction mode"
},
SensingMethod: {
1: "Not defined",
2: "One-chip color area sensor",
3: "Two-chip color area sensor",
4: "Three-chip color area sensor",
5: "Color sequential area sensor",
7: "Trilinear sensor",
8: "Color sequential linear sensor"
},
SceneCaptureType: {
0: "Standard",
1: "Landscape",
2: "Portrait",
3: "Night scene"
},
SceneType: {
1: "Directly photographed"
},
CustomRendered: {
0: "Normal process",
1: "Custom process"
},
WhiteBalance: {
0: "Auto white balance",
1: "Manual white balance"
},
GainControl: {
0: "None",
1: "Low gain up",
2: "High gain up",
3: "Low gain down",
4: "High gain down"
},
Contrast: {
0: "Normal",
1: "Soft",
2: "Hard"
},
Saturation: {
0: "Normal",
1: "Low saturation",
2: "High saturation"
},
Sharpness: {
0: "Normal",
1: "Soft",
2: "Hard"
},
SubjectDistanceRange: {
0: "Unknown",
1: "Macro",
2: "Close view",
3: "Distant view"
},
FileSource: {
3: "DSC"
},
Components: {
0: "",
1: "Y",
2: "Cb",
3: "Cr",
4: "R",
5: "G",
6: "B"
}
};
function addEvent(element, event, handler) {
if (element.addEventListener) {
element.addEventListener(event, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on" + event, handler);
}
}
function imageHasData(img) {
return !!(img.exifdata);
}
function getImageData(img, callback) {
BinaryAjax(img.src, function(http) {
var data = findEXIFinJPEG(http.binaryResponse);
img.exifdata = data || {};
if (callback) {
callback.call(img)
}
});
}
function findEXIFinJPEG(file) {
if (file.getByteAt(0) != 0xFF || file.getByteAt(1) != 0xD8) {
return false; // not a valid jpeg
}
var offset = 2,
length = file.getLength(),
marker;
while (offset < length) {
if (file.getByteAt(offset) != 0xFF) {
if (debug)
console.log("Not a valid marker at offset " + offset + ", found: " + file.getByteAt(offset));
return false; // not a valid marker, something is wrong
}
marker = file.getByteAt(offset + 1);
// we could implement handling for other markers here,
// but we're only looking for 0xFFE1 for EXIF data
if (marker == 22400) {
if (debug)
console.log("Found 0xFFE1 marker");
return readEXIFData(file, offset + 4, file.getShortAt(offset + 2, true) - 2);
// offset += 2 + file.getShortAt(offset+2, true);
} else if (marker == 225) {
// 0xE1 = Application-specific 1 (for EXIF)
if (debug)
console.log("Found 0xFFE1 marker");
return readEXIFData(file, offset + 4, file.getShortAt(offset + 2, true) - 2);
} else {
offset += 2 + file.getShortAt(offset + 2, true);
}
}
}
function readTags(file, tiffStart, dirStart, strings, bigEnd) {
var entries = file.getShortAt(dirStart, bigEnd),
tags = {},
entryOffset, tag,
i;
for (i = 0; i < entries; i++) {
entryOffset = dirStart + i * 12 + 2;
tag = strings[file.getShortAt(entryOffset, bigEnd)];
if (!tag && debug)
console.log("Unknown tag: " + file.getShortAt(entryOffset, bigEnd));
tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
}
return tags;
}
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
var type = file.getShortAt(entryOffset + 2, bigEnd),
numValues = file.getLongAt(entryOffset + 4, bigEnd),
valueOffset = file.getLongAt(entryOffset + 8, bigEnd) + tiffStart,
offset,
vals, val, n,
numerator, denominator;
switch (type) {
case 1: // byte, 8-bit unsigned int
case 7: // undefined, 8-bit byte, value depending on field
if (numValues == 1) {
return file.getByteAt(entryOffset + 8, bigEnd);
} else {
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
vals = [];
for (n = 0; n < numValues; n++) {
vals[n] = file.getByteAt(offset + n);
}
return vals;
}
case 2: // ascii, 8-bit byte
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
return file.getStringAt(offset, numValues - 1);
case 3: // short, 16 bit int
if (numValues == 1) {
return file.getShortAt(entryOffset + 8, bigEnd);
} else {
offset = numValues > 2 ? valueOffset : (entryOffset + 8);
vals = [];
for (n = 0; n < numValues; n++) {
vals[n] = file.getShortAt(offset + 2 * n, bigEnd);
}
return vals;
}
case 4: // long, 32 bit int
if (numValues == 1) {
return file.getLongAt(entryOffset + 8, bigEnd);
} else {
vals = [];
for (var n = 0; n < numValues; n++) {
vals[n] = file.getLongAt(valueOffset + 4 * n, bigEnd);
}
return vals;
}
case 5: // rational = two long values, first is numerator, second is denominator
if (numValues == 1) {
numerator = file.getLongAt(valueOffset, bigEnd);
denominator = file.getLongAt(valueOffset + 4, bigEnd);
val = new Number(numerator / denominator);
val.numerator = numerator;
val.denominator = denominator;
return val;
} else {
vals = [];
for (n = 0; n < numValues; n++) {
numerator = file.getLongAt(valueOffset + 8 * n, bigEnd);
denominator = file.getLongAt(valueOffset + 4 + 8 * n, bigEnd);
vals[n] = new Number(numerator / denominator);
vals[n].numerator = numerator;
vals[n].denominator = denominator;
}
return vals;
}
case 9: // slong, 32 bit signed int
if (numValues == 1) {
return file.getSLongAt(entryOffset + 8, bigEnd);
} else {
vals = [];
for (n = 0; n < numValues; n++) {
vals[n] = file.getSLongAt(valueOffset + 4 * n, bigEnd);
}
return vals;
}
case 10: // signed rational, two slongs, first is numerator, second is denominator
if (numValues == 1) {
return file.getSLongAt(valueOffset, bigEnd) / file.getSLongAt(valueOffset + 4, bigEnd);
} else {
vals = [];
for (n = 0; n < numValues; n++) {
vals[n] = file.getSLongAt(valueOffset + 8 * n, bigEnd) / file.getSLongAt(valueOffset + 4 + 8 * n, bigEnd);
}
return vals;
}
}
}
function readEXIFData(file, start) {
if (file.getStringAt(start, 4) != "Exif") {
if (debug)
console.log("Not valid EXIF data! " + file.getStringAt(start, 4));
return false;
}
var bigEnd,
tags, tag,
exifData, gpsData,
tiffOffset = start + 6;
// test for TIFF validity and endianness
if (file.getShortAt(tiffOffset) == 0x4949) {
bigEnd = false;
} else if (file.getShortAt(tiffOffset) == 0x4D4D) {
bigEnd = true;
} else {
if (debug)
console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
return false;
}
if (file.getShortAt(tiffOffset + 2, bigEnd) != 0x002A) {
if (debug)
console.log("Not valid TIFF data! (no 0x002A)");
return false;
}
if (file.getLongAt(tiffOffset + 4, bigEnd) != 0x00000008) {
if (debug)
console.log("Not valid TIFF data! (First offset not 8)", file.getShortAt(tiffOffset + 4, bigEnd));
return false;
}
tags = readTags(file, tiffOffset, tiffOffset + 8, TiffTags, bigEnd);
if (tags.ExifIFDPointer) {
exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);
for (tag in exifData) {
switch (tag) {
case "LightSource" :
case "Flash" :
case "MeteringMode" :
case "ExposureProgram" :
case "SensingMethod" :
case "SceneCaptureType" :
case "SceneType" :
case "CustomRendered" :
case "WhiteBalance" :
case "GainControl" :
case "Contrast" :
case "Saturation" :
case "Sharpness" :
case "SubjectDistanceRange" :
case "FileSource" :
exifData[tag] = StringValues[tag][exifData[tag]];
break;
case "ExifVersion" :
case "FlashpixVersion" :
exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
break;
case "ComponentsConfiguration" :
exifData[tag] =
StringValues.Components[exifData[tag][0]]
+ StringValues.Components[exifData[tag][1]]
+ StringValues.Components[exifData[tag][2]]
+ StringValues.Components[exifData[tag][3]];
break;
}
tags[tag] = exifData[tag];
}
}
if (tags.GPSInfoIFDPointer) {
gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
for (tag in gpsData) {
switch (tag) {
case "GPSVersionID" :
gpsData[tag] = gpsData[tag][0]
+ "." + gpsData[tag][1]
+ "." + gpsData[tag][2]
+ "." + gpsData[tag][3];
break;
}
tags[tag] = gpsData[tag];
}
}
return tags;
}
function getData(img, callback) {
if (!img.complete)
return false;
if (!imageHasData(img)) {
getImageData(img, callback);
} else {
if (callback) {
callback.call(img);
}
}
return true;
}
function getTag(img, tag) {
if (!imageHasData(img))
return;
return img.exifdata[tag];
}
function getAllTags(img) {
if (!imageHasData(img))
return {};
var a,
data = img.exifdata,
tags = {};
for (a in data) {
if (data.hasOwnProperty(a)) {
tags[a] = data[a];
}
}
return tags;
}
function pretty(img) {
if (!imageHasData(img))
return "";
var a,
data = img.exifdata,
strPretty = "";
for (a in data) {
if (data.hasOwnProperty(a)) {
if (typeof data[a] == "object") {
if (data[a] instanceof Number) {
strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n";
} else {
strPretty += a + " : [" + data[a].length + " values]\r\n";
}
} else {
strPretty += a + " : " + data[a] + "\r\n";
}
}
}
return strPretty;
}
function readFromBinaryFile(file) {
return findEXIFinJPEG(file);
}
return {
readFromBinaryFile: readFromBinaryFile,
pretty: pretty,
getTag: getTag,
getAllTags: getAllTags,
getData: getData,
Tags: ExifTags,
TiffTags: TiffTags,
GPSTags: GPSTags,
StringValues: StringValues
};
})();

225
static/app/js/goodsList.js Executable file
View File

@ -0,0 +1,225 @@
var msort = 1;
var page = 1;
var condition = 2;
var desc = 0;
var catId;
var keyword;
var isjiazai = 1;
var count = 1;
function pullupRefresh() {
// setTimeout(function() {
// mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
var data_set = {
page: count,
pagesize: 10,
condition: condition,
desc: desc
}
// console.log(order_class)
if(catId) {
data_set.catId = catId;
} else if(keyword) {
data_set.keyword = keyword;
}
mui.ajax(hyhUrl('app/Goods/pageQuery'), { 
data: data_set,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
data = data.data;
var html = '';
if(data.Rows == '') {
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
return;
}
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').append(html);
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
isjiazai=1;
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
// }, 500);
}
/**
* 下拉刷新具体业务实现
*/
// function pulldownRefresh() {
// setTimeout(function() {
// window.location.reload();
// mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
// }, 1500);
// }
mui.plusReady(function() {
var costnum = 0;
var self = plus.webview.currentWebview();
catId = self.data_catId;
keyword = self.data_keyword;
$('.commoditylistnav').on('tap', '.nav_block', function() {
page = 1;
count = 1;
$(this).addClass('on').siblings().removeClass('on');
condition = $(this).attr('data-condition');
if($('#cost_btn').hasClass('on')) {
costnum += 1;
if(costnum % 2 == 1) {
$('#cost_btn').html('价格 <img src="../img/cost3.png"/>');
desc = 1;
} else if(costnum % 2 == 0) {
$('#cost_btn').html('价格 <img src="../img/cost2.png"/>');
desc = 0;
}
} else {
$('#cost_btn').html('价格 <img src="../img/cost1.png"/>')
costnum = 0;
desc = 0
}
var data = {
pagesize: 10,
page: 1,
condition: condition,
desc: desc
}
if(catId) {
data.catId = catId;
} else if(keyword) {
data.keyword = keyword;
}
mui.ajax(hyhUrl('app/Goods/pageQuery'), { 
data: data,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').html(html);
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
var data_1 = {
pagesize: 10,
page: 1,
condition: 2,
desc: 0
}
if(catId) {
data_1.catId = catId;
} else if(keyword) {
data_1.keyword = keyword;
}
mui.ajax(hyhUrl('app/Goods/pageQuery'), { 
data: data_1,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').html(html);
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.cnxh_con').on('tap', '.con_goods', function() {
var good_id = $(this).attr('data-id');
mui.openWindow({
url: 'details.html',
id: 'details.html' + good_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: good_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
// console.log(scroll.y);
// console.log(scroll.maxScrollY);
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
isjiazai = 0;
pullupRefresh()
}
}
})
})
// setInterval(function() {
// $('.cnxh_block img').height($('.cnxh_block img').width());
// $('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
// }, 100)

670
static/app/js/home.js Executable file
View File

@ -0,0 +1,670 @@
//var myDate = new Date();
//myDate.setFullYear(2018, 9, 14);
//var today = new Date();
var activity7 = ''
var timestamp1 = Date.parse( new Date());
if(timestamp1 >=1536854400000) {
$('.nav_block p').eq(3).html('ECT专区');
$('.nav_block').eq(3).attr('id', 'activity7.html');
$('.nav_block img').eq(3).attr('src', 'http://img.juzi199.com/static/app/img/ect.png');
$('.ssbd').attr('src', 'http://img.juzi199.com/Upload/app/banner/ectbanner.png');
activity7 = 'activity7.html';
}else{
activity7 = 'newuser.html';
}
function getCNXH(pageNum, pagesizeNum) {
var data_cnxh = {
page: pageNum ? pageNum : 1,
pagesize : pagesizeNum ? pagesizeNum : 10
}
mui.ajax(hyhUrl('app/Index/guess_like'), { 
data: data_cnxh,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
$.each(data.Rows, function() {
// console.log(hyhImgUrl(this.goodsImg))
html += '<div class="cnxh_block" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name"><o>推荐</o>' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
if(pageNum == 1) {
$('.cnxh_con').html(html);
} else if(pageNum > 1) {
$('.cnxh_con').append(html);
}
$('.cnxh_block img').height($('.cnxh_block img').width())
} else {
alert(data.msg);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1000);
}
var count = 1;
/**
* 上拉加载具体业务实现
*/
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 50)); //参数为true代表没有更多数据了。
getCNXH(count, 10)
}, 500);
}
mui.init({
pullRefresh: {
container: "#pullrefresh", //下拉刷新容器标识querySelector能定位的css选择器均可比如id、.class等
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
mui.plusReady(function() {
window.addEventListener('mask', function(e) { //执行刷新
var mask = mui.createMask(); //callback为用户点击蒙版时自动执行的回调
mask.show(); //显示遮罩
});
function openAds(item) {
if(item.attr('data-adURL') == '' || item.attr('data-targetType') == 0) {
return;
}
var adURL = item.attr('data-adURL');
var targetType = '';
var data_set = {};
if(item.attr('data-targetType') == 1) {
//商品
targetType = 'details.html';
data_set = {
data_id: adURL
}
} else if(item.attr('data-targetType') == 2) {
//商家
targetType = 'storeout.html';
if(adURL == 1) {
targetType = 'self_shop.html'
}
data_set = {
shopId: adURL
}
} else if(item.attr('data-targetType') == 3) {
//活动
targetType = adURL + '.html';
}
mui.openWindow({
url: targetType,
id: targetType + adURL,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: data_set,
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
getCNXH(1, 10);
mui('.mui-bar-transparent').transparent({
scroller: "#pullrefresh",
offset: 150,
});
//秒杀
var swiper = new Swiper('.time_con .swiper-container', {
pagination: '.time_con .swiper-container .swiper-pagination',
slidesPerView: 4,
paginationClickable: true,
spaceBetween: 6,
freeMode: true
});
$('#news').html(''); //先把惠员快讯清空
mui.ajax(hyhUrl('app/Articles/getIndexNews'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(news_data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var news_data = toJson(news_data);
if(news_data.status == 1) {
news_data = news_data.data;
var news = '';
$.each(news_data, function() {
// console.log(this.articleTitle)
news += '<a href="#" data-articleId="' + this.articleId + '">' + this.articleTitle + '</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
})
$('#news').html(news);
// $('#news_more').html('');
//console.log(news);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
//广告数据
var arr1 = ["../img/faxianhaohuo1.png", "../img/huiyuanzhuanhui1.png", "../img/paihangbang.png", "../img/huigou.png", "../img/xinpinshoufa.png", "../img/shangxin.png"]
mui.ajax(hyhUrl('app/Index/getIndexAds'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
var banner1 = '';
var banner2 = '';
var html1 = '';
var html2 = '';
var html3 = '';
var o = 0;
//顶部轮播图
if(data.top_img.length != 0) {
var topBanner1 = '<div class="mui-slider-group mui-slider-loop"><div data-targetType="' + data.top_img[data.top_img.length - 1].targetType + '" data-adURL="' + data.top_img[data.top_img.length - 1].adURL + '" class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.top_img[data.top_img.length - 1].adFile) + '"></a></div>';
var topBanner2 = '<div class="mui-slider-indicator">';
$.each(data.top_img, function() {
topBanner1 += '<div data-targetType="' + this.targetType + '" data-adURL="' + this.adURL + '" class="mui-slider-item "><a href="#"><img src="' + hyhImgUrl(this.adFile) + '"></a></div>'
topBanner2 += '<div class="mui-indicator"></div>'
})
topBanner2 += '</div>'
topBanner1 += '<div data-targetType="' + data.top_img[0].targetType + '" data-adURL="' + data.top_img[0].adURL + '" class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.top_img[0].adFile) + '"></a></div></div>'
topBanner1 += topBanner2;
$('#slider').html(topBanner1);
$('.mui-slider-item a img').height($('.mui-slider-item a img').width() * 188 / 375)
$('#slider').height($('.mui-slider-item a img').width() * 188 / 375)
mui("#slider").slider({
interval: 5000
});
document.getElementsByClassName('mui-indicator')[0].className += ' mui-active';
}
//广告区banner
$.each(data.cross_img.cross_top, function() {
banner1 += '<div class="swiper-slide" data-targetType="' + this.targetType + '" data-adURL="' + this.adURL + '"><img src="' + hyhImgUrl(this.adFile) + '" /></div>';
});
$('.banner .swiper-container .swiper-wrapper').html(banner1);
//banner1
var swiper = new Swiper('.banner .swiper-container', {
pagination: '.banner .swiper-container .swiper-pagination',
slidesPerView: 1,
centeredSlides: true,
paginationClickable: true,
spaceBetween: 6,
grabCursor: true
});
$.each(data.cross_img.cross_bottom, function() {
banner2 += '<div class="swiper-slide" data-targetType="' + this.targetType + '" data-adURL="' + this.adURL + '"><img src="' + hyhImgUrl(this.adFile) + '" /></div>';
});
$('.banner1 .swiper-container .swiper-wrapper').html(banner2);
//banner2
var swiper = new Swiper('.banner1 .swiper-container', {
pagination: '.banner1 .swiper-container .swiper-pagination',
slidesPerView: 1,
centeredSlides: true,
paginationClickable: true,
spaceBetween: 6,
grabCursor: true
});
$('.banner .swiper-container .swiper-wrapper .swiper-slide img').height($('.banner .swiper-container .swiper-wrapper .swiper-slide img').width() * 162 / 600);
$('.banner1 .swiper-container .swiper-wrapper .swiper-slide img').height($('.banner .swiper-container .swiper-wrapper .swiper-slide img').width() * 162 / 600);
var adsArr = [];
for(var i in data.ads) {
adsArr.push(data.ads[i]);
}
$('.box_1').each(function(num) {
$(this).children('p').html(adsArr[num].name);
$(this).children('.boxcon').children('img').eq(0).attr('src', hyhImgUrl(adsArr[num].list[0].adFile ? adsArr[num].list[0].adFile : ''));
$(this).children('.boxcon').children('img').eq(0).attr('data-adURL', adsArr[num].list[0].adURL ? adsArr[num].list[0].adURL : '');
$(this).children('.boxcon').children('img').eq(0).attr('data-targetType', adsArr[num].list[0].targetType ? adsArr[num].list[0].targetType : '');
$(this).children('.boxcon').children('img').eq(1).attr('src', hyhImgUrl(adsArr[num].list[1].adFile ? adsArr[num].list[1].adFile : ''));
$(this).children('.boxcon').children('img').eq(1).attr('data-adURL', adsArr[num].list[1].adURL ? adsArr[num].list[1].adURL : '');
$(this).children('.boxcon').children('img').eq(1).attr('data-targetType', adsArr[num].list[1].targetType ? adsArr[num].list[1].targetType : '');
})
$('.pzss1').each(function(num) {
$(this).children('.p1').html(adsArr[num + 6].name.slice(0, 4));
$(this).children('.p2').html(adsArr[num + 6].name.slice(4));
var adsList = adsArr[num + 6].list;
if(adsList.length == 0) {
adsList.push({
"adFile": "",
"adURL": "",
"targetType": 0
});
adsList.push({
"adFile": "",
"adURL": "",
"targetType": 0
});
} else if(adsList.length == 1) {
adsList.push({
"adFile": "",
"adURL": "",
"targetType": 0
});
}
$(this).children('.boxcon').children('img').eq(0).attr('src', hyhImgUrl(adsList[0].adFile));
$(this).children('.boxcon').children('img').eq(0).attr('data-adURL', adsList[0].adURL);
$(this).children('.boxcon').children('img').eq(0).attr('data-targetType', adsList[0].targetType);
$(this).children('.boxcon').children('img').eq(1).attr('src', hyhImgUrl(adsList[1].adFile));
$(this).children('.boxcon').children('img').eq(1).attr('data-adURL', adsList[1].adURL);
$(this).children('.boxcon').children('img').eq(1).attr('data-targetType', adsList[1].targetType);
})
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.msg').on('tap', function() {
mui.openWindow({
url: 'journalism.html',
id: 'journalism.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui(".cnxh_con").on('tap', '.cnxh_block', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
var data_id = this.attributes["data-id"].nodeValue;
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'details.html',
id: 'details.html' + data_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui(".nav").on('tap', '.nav_block', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
var url = this.attributes["id"].nodeValue;
//品牌街跳转
if(url == 'activity4.html') {
mui.openWindow({
url: 'self_shop.html',
id: 'self_shop.html' + 1,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: 1
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
return;
}
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: url,
id: url,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('#keyword').on('focus', function() {
$(".search button").css('display', 'block');
})
$('#keyword').on('blur', function() {
$(".search button").css('display', 'none');
})
$(".search button").on('tap', function() {
var searchName = $('#keyword').val();
var url = '';
// e.preventDefault();
// console.log(searchName)
//请求搜索接口
// console.log($('.search select').val())
if($('.search select').val() == 0) {
url = 'goodsList.html';
} else if($('.search select').val() == 1) {
url = 'shopsList.html';
}
mui.openWindow({
url: url,
id: url + searchName,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: true, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$("#keyword").on('keypress', function(e) {
var keycode = e.keyCode;
var searchName = $(this).val();
var url = '';
if(keycode == '13') {
// e.preventDefault();
// console.log(searchName)
//请求搜索接口
// console.log($('.search select').val())
if($('.search select').val() == 0) {
url = 'goodsList.html';
} else if($('.search select').val() == 1) {
url = 'shopsList.html';
}
mui.openWindow({
url: url,
id: url + searchName,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: true, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
});
$("body").on('tap', '.ssbd', function() {
mui.openWindow({
url: activity7,
id: activity7,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
});
//首页广告跳转
$('.boxcon').on('tap', 'img', function() {
openAds($(this));
})
//轮播图跳转
$('#slider').on('tap', '.mui-slider-item', function() {
openAds($(this));
})
//banner跳转
$('.banner').on('tap', '.swiper-slide', function() {
openAds($(this));
})
$('.banner1').on('tap', '.swiper-slide', function() {
openAds($(this));
})
//3.8活动页
// var btnArray = ['否', '是'];
// mui.confirm('跳转到3.8女神节活动页?', '合源惠商城', btnArray, function(e) {
// if(e.index == 1) {
// mui.openWindow({
// url: 'activity7.html',
// id: 'activity7.html',
// show: {
// aniShow: 'none'
// },
// waiting: {
// autoShow: false
// }
// })
// } else {
//
// }
// })
var isZz = localStorage.getItem('isZz') ? localStorage.getItem('isZz') : 1;
if(isZz == 1) {
localStorage.setItem('isZz', 0);
$('body').append('<div class="mui-backdrop"><img src="http://img.juzi199.com/upload/sysconfigs/tanchuang.png"/></div>');
}
$('body').on('tap', '.mui-backdrop', function() {
$(this).css('display', 'none');
mui.openWindow({
url: 'newuser.html',
id: 'newuser.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

32
static/app/js/indent.js Executable file
View File

@ -0,0 +1,32 @@
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var data_href = self.data_href;
if(data_href == 'all') {
$('#nav2').html('全部订单');
}
if(data_href == 'waitPay') {
$('#nav2').html('待付款');
}
if(data_href == 'waitDeliver') {
$('#nav2').html('待发货');
}
if(data_href == 'waitReceive') {
$('#nav2').html('待收货');
}
if(data_href == 'waitAppraise') {
$('#nav2').html('待评价');
}
if(data_href == 'abnormal') {
$('#nav2').html('退款/售后');
}
localStorage.setItem('order_class', data_href);
var sub = plus.webview.create('indentcon.html', 'indentcon.html', {
top: '66px',
bottom: '0px',
scrollIndicator: 'none'
});
self.append(sub);
})

916
static/app/js/indentcon.js Executable file
View File

@ -0,0 +1,916 @@
$('#content').after('<div class="tui"></div>');
var pay_name = 0;
var wxChannel = null; // 微信支付
var aliChannel = null; // 支付宝支付
var channel = null; //支付通道
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
var count = 1;
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
var order_class = localStorage.getItem('order_class');
var token = localStorage.getItem('token');
// console.log(order_class)
if(order_class == 'all') {
order_class = '';
}
mui.ajax(hyhUrl('app/Orders/getOrderList'), { 
headers: { 
"HYH-Token": token
},
data: {
type: order_class,
page: count,
pagesize : 5
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.data.Rows.length == 0) {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
return;
}
var html = ''
$.each(data.data.Rows, function() {
this.pay_name = 1;
html += '<div class="row" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId + '"><div class="row_title"><div class="store_name">' + this.shopName + '</div><div class="indent_status">' + this.status + '</div></div><div class="row_con clearfix" data-id="' + this.orderId + '">'
$.each(this.list, function() {
html += '<div class="row_block clearfix"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">' + this.goodsSpecNames + '</p></div><div class="rcrr"><p>¥' + this.goodsPrice + '</p><del>¥' + this.marketPrice + '</del><span>x' + this.goodsNum + '</span></div></div></div>';
})
html += '</div><div class="combination">共' + this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney + '</o>(含运费¥' + this.deliverMoney + '</div><div class="btns clearfix">';
if(this.orderStatus == -2) {
html += '<div class="btns_btn ljfk" data-payName="' + this.pay_name + '">立即付款</div><div class="btns_btn qxdd_js">取消订单</div>';
} else if(this.orderStatus == 0) {
if(this.noticeDeliver == 0) {
html += '<div class="btns_btn txfh" style="display:none;">提醒发货</div><div class="btns_btn qxdd">取消订单</div>';
} else {
html += '<div class="btns_btn " style="display:none;">已提醒</div><div class="btns_btn qxdd">取消订单</div>';
}
} else if(this.orderStatus == 1) {
html += '<div class="btns_btn qrsh">确认收货</div><div class="btns_btn ckwl">查看物流</div><div class="btns_btn qxdd_js" >拒收</div>';
} else if(this.orderStatus == 2) {
if(this.isAppraise == 0) {
html += '<div class="btns_btn ljpj" >立即评价</div>';
} else {
html += '<div class="btns_btn qxdd_js">查看评价</div>';
}
}
if(this.orderStatus != 1 && this.orderStatus != -2 && this.isComplain == 0) {
html += '<div class="btns_btn tsdd" >投诉</div>';
}
if(this.allowRefund == 1 && (this.orderStatus == -1 || this.orderStatus == -3)) {
html += '<div class="btns_btn sqtk" >申请退款</div>';
}
html += '</div></div>'
})
$('.con').append(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}
}); 
}, 500);
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
mui.plusReady(function() {
var token = localStorage.getItem('token');
var order_class = localStorage.getItem('order_class');
var token = localStorage.getItem('token');
var orderNo;
var orderId;
var getReasonUrl = '';
var priceT = 0;
var payCode = '';
window.addEventListener('refresh', function(e) { //执行刷新
location.reload();
});
//支付插件
plus.payment.getChannels(function(channels) {
for(var i in channels) {
if(channels[i].id == "wxpay") {
wxChannel = channels[i];
} else {
aliChannel = channels[i];
}
}
}, function(e) {
alert("获取支付通道失败:" + e.message);
});
// var ALIPAYSERVER = 'http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
var ALIPAYSERVER = hyhUrl('app/Alipays/toAlipay?isBatch=0&orderNo=');
// 2. 发起支付请求
function pay(id, orderNo) {
// 从服务器请求支付订单
var PAYSERVER = '';
if(id == 'alipay') {
PAYSERVER = ALIPAYSERVER;
channel = aliChannel;
} else if(id == 'wxpay') {
PAYSERVER = WXPAYSERVER;
channel = wxChannel;
} else {
plus.nativeUI.alert("不支持此支付通道!", null, "捐赠");
return;
}
var xhr = new XMLHttpRequest();
// var amount = 1;
xhr.onreadystatechange = function() {
switch(xhr.readyState) {
case 4:
if(xhr.status == 200) {
plus.payment.request(channel, xhr.responseText, function(result) {
plus.nativeUI.alert("支付成功!", function() {
// back();
var targetTab = plus.webview.getWebviewById("templete/my.html");
mui.fire(targetTab, 'refresh');
location.reload();
});
}, function(error) {
// plus.nativeUI.alert("支付失败:" + error.code);
// plus.webview.getWebviewById('confirmOrder.html').close()
});
} else {
alert("获取订单信息失败!");
console.log(xhr.status)
}
break;
default:
break;
}
}
xhr.open('GET', PAYSERVER + orderNo);
xhr.send();
}
mui.ajax(hyhUrl('/app/Users/get_name_and_money'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
data = toJson(data);
if(data.status == 1) {
$('#loginName').html(data.data.name);
$('.userMoney').html(data.data.money);
var htmlpay = '<div class="row clearfix select_payway" data-payCode="ect"><p class="row_left">ECT余额<o class="userECT">' + data.data.userECT + '</o></p></div>';
$('.pay_info .con_1').append(htmlpay);
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
})
$('.con').on('tap', '.ljfk', function() {
var that = $(this);
pay_name = $(this).attr('data-payName');
priceT = $(this).parent().siblings('.combination').children('o').html().slice(1);
$('#goodsTotalMoney').html($(this).parent().siblings('.combination').children('o').html())
orderNo = $(this).parent().parent().attr('data-orderNo');
if(pay_name == 1) {
$('.pay_info .con_1 .row').eq(1).attr('style', 'display: none;');
$('.pay_info .con_1 .row').eq(2).addClass('on');
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/ect/getToEctNum'), { 
data: {
total_money: priceT
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功; 
var data = toJson(data);
if(data.status == 1) {
var btnArray = ['是', '否'];
mui.confirm(data.msg, 'ECT确认支付', btnArray, function(e) {
if(e.index == 1) {
return;
} else {
$('.bg').css('display', 'block');
$(".pay").slideDown(300);
}
that.removeAttr('disabled');
})
} else {
alert(data.msg);
that.removeAttr('disabled');
return;
}
}
})
} else {
$('.pay_info .con_1 .row').eq(1).addClass('on');
$('.pay_info .con_1 .row').eq(2).attr('style', 'display: none;');
$('.bg').css('display', 'block');
$(".pay").slideDown(300);
}
})
$('.bg').on('tap', '.mui-icon-left-nav', function() {
$('.pay').css('display', 'block');
$('.pay_way').css('display', 'none');
})
$('.bg').on('tap', '.mui-icon-closeempty', function() {
$('.bg').css('display', 'none');
$(".pay").slideUp(300, function() {
});
})
$('#pay_way').on('tap', '.row', function() {
$('#pay_way .row .mui-icon').removeClass('mui-icon-checkmarkempty');
$(this).children('.mui-icon').addClass('mui-icon-checkmarkempty');
$('.con_1 .on .row_right o').html($(this).children('.row_left').html());
$('.con_1 .on').attr('data-payCode', $(this).attr('data-payCode'))
$('.pay').css('display', 'block');
$('#pay_way').css('display', 'none');
})
$('.pay').on('tap', '.con_1 .on', function() {
if($(this).attr('data-payCode') == 'ect') {
} else {
$('.pay').css('display', 'none');
$('#pay_way').css('display', 'block');
}
})
$('.pay_btn').on('tap', function() {
payCode = $('.con_1 .on').attr('data-payCode');
var that = $(this);
var data_ljfk = {
isBatch: 0,
orderNo: orderNo
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/orders/succeed'), { 
data: data_ljfk,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
data = toJson(data);
if(data.status == 1) {
if(payCode == 'wallets' || payCode == 'ect') {
//跳输入密码的页面
mui.ajax(hyhUrl('app/' + payCode + '/payment'), { 
data: {
orderNo: orderNo,
isBatch: 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
var data = toJson(data);
if(data.status == 1) {
$('.pay').css('display', 'none');
$('#pay_pwd').css('display', 'block');
if(data.data.payPwd == '0') {
alert('还未设置支付密码请先设置支付密码!');
var url = 'setting_fogetPayPwd';
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
}); 
} else if(payCode == 'alipays') {
pay('alipay', orderNo);
// plus.nativeUI.showWaiting();
// mui.post(hyhUrl('app/Alipays/payment'), {
// orderNo: data.data,
// isBatch: 1
// var ALIPAYSERVER = hyhUrl('app/Alipays/payment?orderNo=' + data.data + '&isBatch=1');
}
that.removeAttr('disabled');
} else {
alert('发生错误请刷新后重试!');
// location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
})
})
$('#pay_pwd').on('tap', '.p9', function() {
var url = 'setting_fogetPayPwd';
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('#pay_pwd').on('tap', '.pay_btn_pwd', function() {
var payPwd = $('#payPwd').val();
if(payPwd == '') {
alert('支付密码不能为空!');
}
var that = $(this);
that.attr('disabled', 'disabled')
var srcc = ''
if(payCode == 'ect') {
srcc = 'payByEct';
} else {
srcc = 'payByWallet';
}
mui.ajax(hyhUrl('app/' + payCode + '/' + srcc), { 
data: {
orderNo: orderNo,
isBatch: 0,
payPwd: payPwd
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
var data = toJson(data);
alert(data.msg)
if(data.status == 1) {
var targetTab = plus.webview.getWebviewById("templete/my.html");
mui.fire(targetTab, 'refresh');
location.reload();
} else {
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
}); 
})
// console.log(order_class)
if(order_class == 'all') {
order_class = '';
}
mui.ajax(hyhUrl('app/Orders/getOrderList'), { 
headers: { 
"HYH-Token": token
},
data: {
type: order_class,
page: 1,
pagesize : 5
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
var html = ''
$.each(data.data.Rows, function() {
this.pay_name = 1;
html += '<div class="row" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId + '"><div class="row_title"><div class="store_name">' + this.shopName + '</div><div class="indent_status">' + this.status + '</div></div><div class="row_con clearfix" data-id="' + this.orderId + '">'
$.each(this.list, function() {
html += '<div class="row_block clearfix"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">' + this.goodsSpecNames + '</p></div><div class="rcrr"><p>¥' + this.goodsPrice + '</p><del>¥' + this.marketPrice + '</del><span>x' + this.goodsNum + '</span></div></div></div>';
})
html += '</div><div class="combination">共' + this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney + '</o>(含运费¥' + this.deliverMoney + '</div><div class="btns clearfix">';
if(this.orderStatus == -2) {
html += '<div class="btns_btn ljfk" data-payName="' + this.pay_name + '">立即付款</div><div class="btns_btn qxdd_js">取消订单</div>';
} else if(this.orderStatus == 0) {
if(this.noticeDeliver == 0) {
html += '<div class="btns_btn txfh" style="display:none;">提醒发货</div><div class="btns_btn qxdd_js">取消订单</div>';
} else {
html += '<div class="btns_btn " style="display:none;">已提醒</div><div class="btns_btn qxdd_js">取消订单</div>';
}
} else if(this.orderStatus == 1) {
html += '<div class="btns_btn qrsh">确认收货</div><div class="btns_btn ckwl">查看物流</div><div class="btns_btn qxdd_js" >拒收</div>';
} else if(this.orderStatus == 2) {
if(this.isAppraise == 0) {
html += '<div class="btns_btn ljpj" >立即评价</div>';
} else {
html += '<div class="btns_btn ckpj">查看评价</div>';
}
}
if(this.orderStatus != 1 && this.orderStatus != -2 && this.isComplain == 0) {
html += '<div class="btns_btn tsdd" >投诉</div>';
}
if(this.allowRefund == 1 && (this.orderStatus == -1 || this.orderStatus == -3)) {
html += '<div class="btns_btn qxdd_js" >申请退款</div>';
}
html += '</div></div>'
})
$('.con').append(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.con').on('tap', '.row_con', function() {
var data_order_id = $(this).attr('data-id');
mui.openWindow({
url: 'order_out.html',
id: 'order_out.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_order_id: data_order_id
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.con').on('tap', '.ckwl', function() {
var data_order_id = $(this).parent().parent().attr('data-id'); //$(this).attr('data-id');
mui.openWindow({
url: 'logistics.html',
id: 'logistics.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_order_id: data_order_id
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.con').on('tap', '.qxdd_js', function() {
orderNo = $(this).parent().parent().attr('data-orderNo');
orderId = $(this).parent().parent().attr('data-id');
if($(this).html() == '取消订单') {
getReasonUrl = 'getCancelCause';
} else if($(this).html() == '拒收') {
getReasonUrl = 'getRejectCause';
} else if($(this).html() == '申请退款') {
getReasonUrl = 'getRefundCause';
mui.ajax(hyhUrl('/app/Orders/getRefund'), { 
data: {
id: orderId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '<input type="text" name="Tmoney" id="Tmoney" value="" placeholder="请输入退款金额"/><p class="info1">(金额不能超过<o>¥' + data.realTotalMoney + '</o>)</p><p class="info1">(' + data.useScore + '个惠宝抵扣<o>¥' + data.scoreMoney + '</o>)</p>';
$('.tui').html(html)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
$('.bg_').css('display', 'block');
$('.bg_con').css('display', 'none');
$('.bg_con').slideDown(300, function() {});
mui.ajax(hyhUrl('/app/Orders/' + getReasonUrl), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
var html = '<option value="0">未选择</option>';
$.each(data.data, function() {
html += '<option value="' + this.dataVal + '">' + this.dataName + '</option>'
});
$('#select').html(html)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
$('.bg_').on('tap', '.en_false', function() {
$('.bg_').css('display', 'none');
})
$('.bg_').on('tap', '.en_true', function() {
var setReasonUrl = '';
var content = $('#content').val();
var reason = $('#select').val();
if($('#select').val() == 0) {
alert('请选择原因!');
return;
}
if($('#select').val() == 10000 && content == '') {
alert('请输入其他原因!');
return;
}
if(getReasonUrl == 'getCancelCause') {
setReasonUrl = 'cancellation';
mui.ajax(hyhUrl('app/Orders/' + setReasonUrl), { 
data: {
reason: reason,
id: orderId,
content: content
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
alert(data.msg);
if(data.status == 1) {
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
} else if(getReasonUrl == 'getRejectCause') {
setReasonUrl = 'reject';
mui.ajax(hyhUrl('app/Orders/' + setReasonUrl), { 
data: {
reason: reason,
id: orderId,
content: content
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
alert(data.msg);
if(data.status == 1) {
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
} else if(getReasonUrl == 'getRefundCause') {
var money = $('#Tmoney').val();
if(money < 0 || money == 0) {
alert('退款金额不能为0!');
return;
} else {
mui.ajax(hyhUrl('app/Orderrefunds/refund'), { 
data: {
reason: reason,
id: orderId,
content: content,
money: money
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
alert(data.msg);
if(data.status == 1) {
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
location.reload();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
}
})
$('.con').on('tap', '.qrsh', function() {
// $('.bg_').css('display', 'block');
orderNo = $(this).parent().parent().attr('data-orderNo');
orderId = $(this).parent().parent().attr('data-id');
if(confirm('确认收货?')) {
mui.ajax(hyhUrl('/app/Orders/receive'), { 
headers: { 
"HYH-Token": token
},
data: {
id: orderId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
location.reload()
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
})
$('#select').on('change', function() {
if($(this).val() == '10000') {
$('#content').css('display', 'block');
} else {
$('#content').css('display', 'none');
}
})
//跳转到评价
mui('.con').on('tap', '.ljpj', function() {
var oId = $(this).parent().parent().attr('data-id');
mui.openWindow({
url: 'pj.html',
id: 'pj.html' + oId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_order_id: oId
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳转到评价
mui('.con').on('tap', '.ckpj', function() {
var oId = $(this).parent().parent().attr('data-id');
mui.openWindow({
url: 'pj.html',
id: 'pj.html' + oId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_order_id: oId
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳转到评价
mui('.con').on('tap', '.tsdd', function() {
var oId = $(this).parent().parent().attr('data-id');
mui.openWindow({
url: 'complain.html',
id: 'complain.html' + oId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_order_id: oId
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

109
static/app/js/index.js Executable file
View File

@ -0,0 +1,109 @@
var wgtVer = null;
alert("11111111")
console.log("1111111111");
function plusReady() { // 获取本地应用资源版本号
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
wgtVer = inf.version;
});
}
//休眠方法
var ver;
//获取数据
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while(true) {
now = new Date();
if(now.getTime() > exitTime)
return;
}
}
function init(data) {
localStorage.setItem('version', data.version ? data.version : "版本号无");
localStorage.setItem('cssUrl', data.cssUrl ? data.cssUrl:"../css/");
localStorage.setItem('jsUrl', data.jsUrl ? data.jsUrl:"../js/");
// console.log(data.apk_version)
// console.log(localStorage.getItem('jsUrl'))
apk_version = data.apk_version;
apkUrl = data.apk_down_url;
iosUrl = data.ios_down_url;
var must_update = data.must_update;
var ios_must_update = data.ios_must_update;
mui.plusReady(function() {
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
ver = inf.version;
var client;
var ua = navigator.userAgent.toLowerCase();
if(/iphone|ipad|ipod/.test(ua)) { //苹果手机
$.ajax({
type: "get",
dataType: 'json',
url: data.update_url, //获取当前上架APPStore版本信息
data: {
id: data.ios_appid //APP唯一标识ID
},
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
success: function(data) {
if(data.results[0].version > ver) {
if(ios_must_update == 0) {
if(confirm("发现新版本:V" + data.results[0].version + "是否更新")) {
document.location.href = iosUrl; //上新APPStore下载地址
}
} else {
alert("发现新版本:V" + data.results[0].version + "是否更新")
document.location.href = iosUrl; //上新APPStore下载地址
}
} else {
}
}
});
} else if(/android/.test(ua)) {
if(apk_version != ver) {
if(must_update == 0) {
if(confirm("发现新版本:V" + apk_version + "是否更新")) {
var dtask = plus.downloader.createDownload(apkUrl, {}, function(d, status) {
if(status == 200) {
plus.nativeUI.toast("正在准备环境,请稍后!");
sleep(1000);
var path = d.filename; //下载apk
plus.runtime.install(path); // 自动安装apk文件
} else {
alert('版本更新失败:' + status);
}
});
dtask.start();
}
} else {
if(confirm("发现新版本:V" + apk_version + "是否更新")) {
var dtask = plus.downloader.createDownload(apkUrl, {}, function(d, status) {
if(status == 200) {
plus.nativeUI.toast("正在准备环境,请稍后!");
sleep(1000);
var path = d.filename; //下载apk
plus.runtime.install(path); // 自动安装apk文件
} else {
alert('版本更新失败:' + status);
}
});
dtask.start();
} else {
plus.runtime.quit();
}
}
} else {
// console.log('当前版本号已是最新');
return;
}
}
})
})
};

99
static/app/js/journalism.js Executable file
View File

@ -0,0 +1,99 @@
mui.plusReady(function() {
window.addEventListener('refresh', function(e) {
location.reload();
})
var num = 1;
var isOver = 1;
function getMsg(pageNum, pagesizeNum) {
var data_msg = {
page: pageNum ? pageNum : 1,
pagesize: pagesizeNum ? pagesizeNum : 10
}
mui.ajax(hyhUrl('app/Articles/getNewsList'), { 
data: data_msg,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data,1);
if(data.status == 1) {
var html = '';
data = data.data;
if(data.Rows == '') {
$('.con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多内容</p>');
return;
}
$.each(data.Rows, function() {
var display = ''
if(this.coverImg==''){
display='none';
}else{
display='block';
}
html += '<div class="block" data-articleId="'+ this.articleId +'"><p>'+ this.articleTitle +'</p><img style="display:'+ display +'" src="'+ hyhImgUrl(this.coverImg) +'"/><span><o></o>'+ this.createTime +'</span></div>'
});
if(pageNum == 1) {
$('.con').html(html);
} else if(pageNum > 1) {
$('.con').append(html);
}
isOver = 1;
} else {
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
getMsg(1, 10);
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isOver == 1) {
isOver=0;
num += 1;
getMsg(num, 10);
}
}
})
$('.con').on('tap', '.block', function() {
var id = $(this).attr('data-articleId');
mui.openWindow({
url: 'journalism_con.html',
id: 'journalism_con.html'+id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_articleId: id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

28
static/app/js/journalism_con.js Executable file
View File

@ -0,0 +1,28 @@
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var msgId = self.data_articleId;
mui.ajax(chengUrl('app/Articles/showArticle/'), { 
data: {
articleId: msgId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data,1);
if(data.status == 1) {
data = data.data;
var html = '<div class="time">'+ data.articleTitle +'</div><div class="con_">'+ data.articleContent +'</div>';
$('.con').html(html)
} else {
console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})

4
static/app/js/jquery-3.2.1.min.js vendored Executable file

File diff suppressed because one or more lines are too long

136
static/app/js/login.js Executable file
View File

@ -0,0 +1,136 @@
mui.init({
beforeback: function() {     //获得父页面的webview
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
//返回true,继续页面关闭逻辑
return true;
}
});
mui.plusReady(function() {
mui('.down').on('tap', '.btn', function() {
var loginName = $('#loginName').val();
var loginPwd = $('#loginPwd').val();
if(loginName == '') {
alert('用户名不能为空!');
return;
}
if(loginPwd == '') {
alert('密码不能为空!');
return;
}
// var loginName = 'zxcvbn';
// var loginPwd = 'zxcvbn';
$('.btn').attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/checkLogin'), { 
data: {
loginName: loginName,
loginPwd: loginPwd,
nameType: 3
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
var token = data.data.token;
localStorage.setItem('token', token);
//console.log(data.data.token);
mui.back();
return;
} else {
alert(data.msg);
}
$('.btn').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type);      
}
}); 
})
mui('.down').on('tap', '#register', function() {
mui.openWindow({
url: 'register.html',
id: 'register.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.down').on('tap', '#fogetpsd', function() {
mui.openWindow({
url: 'setting_fogetPwd.html',
id: 'setting_fogetPwd.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

14
static/app/js/logistics.js Executable file
View File

@ -0,0 +1,14 @@
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var data_order_id = self.data_order_id;
localStorage.setItem('data_order_id', data_order_id);
var sub = plus.webview.create('logisticscon.html', 'logisticscon.html', {
top: '66px',
bottom: '0',
scrollIndicator: 'none'
});
self.append(sub);
})

44
static/app/js/logisticscon.js Executable file
View File

@ -0,0 +1,44 @@
mui.plusReady(function() {
var data_order_id = localStorage.getItem('data_order_id');
var token = localStorage.getItem('token');
mui.ajax(hyhUrl('app/Orders/findExpress'), { 
data: {
orderId: data_order_id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 200 || data.status == 1) {
var data_ = data.data;
var html = '<div class="summarize clearfix"><img src="" /><div class="summarizeinfo"><p class="pp1">物流状态: <o>' + data.express.stateTxt + '</o></p><p class="pp2">承运来源:' + data.express.expressName + '</p><p class="pp2">运单编号:' + data.express.expressNo + '</p></p></div></div><div class="track-list"><ul>';
if(data.data.length > 1) {
var d_1 = data.data[0].time;
var d_2 = data.data[data.data.length-1].time;
var e_1 = new Date(d_1).getTime();
var e_2 = new Date(d_2).getTime();
if (e_1<e_2){
data_.reverse();
}
}
$.each(data_, function() {
html += '<li><i class="node-icon"></i><p class="txt">' + this.context + '</p><p class="time">' + this.time + '</p></li>'
});
html += '</ul></div>'
$('.con').html(html);
document.getElementsByTagName('li')[0].className = 'first';
} else {
// alert(data.status);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
}); 
})

102
static/app/js/msg.js Executable file
View File

@ -0,0 +1,102 @@
mui.plusReady(function() {
window.addEventListener('refresh', function(e) {
location.reload();
})
var token = localStorage.getItem('token');
var num = 1;
var isOver = 1;
function getMsg(pageNum, pagesizeNum) {
if(isOver == 1) {
isOver = 0;
} else {
return;
}
var data_msg = {
page: pageNum ? pageNum : 1,
pagesize: pagesizeNum ? pagesizeNum : 10
}
var arr = ["普通消息", "订单", "商品", "订单投诉", "结算信息", "提现信息", "订单评价"]
mui.ajax(hyhUrl('app/messages/msglist'), { 
headers: { 
"HYH-Token": token
},
data: data_msg,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data,1);
if(data.status == 1) {
var html = '';
data = data.data;
if(data.Rows == '') {
$('.con1').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多消息</p>');
return;
}
$.each(data.Rows, function() {
html += '<div class="row clearfix" data-id="' + this.id + '"><div class="img"><img src="' + hyhImgUrl(this.img) + '" /></div><div class="r_right"><div class="r_r_top clearfix"><p class="rrt_left">' + arr[this.from] + '</p><p class="rrt_right">' + this.createTime + '</p></div><div class="r_r_con">' + this.msgContent + '</div></div></div>'
});
if(pageNum == 1) {
$('.con1').html(html)
} else if(pageNum > 1) {
$('.con1').append(html)
}
isOver = 1;
} else {
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
getMsg(1, 10);
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isOver == 1) {
num += 1;
getMsg(num, 10);
}
}
})
$('.con1').on('tap', '.row', function() {
var id = $(this).attr('data-id');
mui.openWindow({
url: 'msg_con.html',
id: 'msg_con.html'+id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_msgId: id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

31
static/app/js/msg_con.js Executable file
View File

@ -0,0 +1,31 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
var self = plus.webview.currentWebview();
var msgId = self.data_msgId;
mui.ajax(hyhUrl('app/messages/getById'), { 
headers: { 
"HYH-Token": token
},
data: {
msgId: msgId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '<div class="time">' + data.createTime + '</div><div class="con_">' + data.msgContent + '</div>';
$('.con').html(html)
} else {
console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})

8303
static/app/js/mui.js Executable file

File diff suppressed because it is too large Load Diff

9
static/app/js/mui.min.js vendored Executable file

File diff suppressed because one or more lines are too long

306
static/app/js/my.js Executable file
View File

@ -0,0 +1,306 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
// alert(token);
mui.ajax(hyhUrl('app/users/getUserInfo'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
// console.log(data.data.userPhoto)
var imgurl = data.data.userPhoto?hyhImgUrl(data.data.userPhoto):'http://heyuanhui.com.cn/Template/mobile/new/Static/images/user68.png';
var html = '<div class="header clearfix"><div class="seeting">设置</div><div class="share">分享</div></div><div class="con"><img src="' + imgurl + '" /><p>' + data.data.loginName + '</p></div><div class="hyz">惠员值0</div>';
$('.login').css('display', 'none');
$('.my').html(html);
var htmlmoney = '<div class="moneycon_"><img src="../img/yuan.png"/><p id="userMoney">'+ data.data.userMoney +'</p></div><div class="moneycon_" id="moneycon_"><img src="../img/hui.png"/><p id="userScore">'+ data.data.userScore +'</p></div><div class="moneycon_"><img src="http://img.juzi199.com/upload/sysconfigs/ect.png"/><p id="userEct">'+ data.data.userECT +'</p></div>';
$('.moneycon').html(htmlmoney);
// $('#userMoney').html('¥' + data.data.userMoney)
// $('#userScore').html('¥' + data.data.userScore)
}else{
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
mui.ajax(hyhUrl('app/users/getFavoritesNum'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
var data = toJson(data, 1);
if(data.status == 1) {
// console.log(data.data.goodsFavoritesNum)
var html = '<div class="nblock" data-href="collect_commodity.html"><p>' + data.data.goodsFavoritesNum + '</p><p>收藏夹</p></div><div class="nblock" data-href="collect_store.html"><p>' + data.data.shopFavoritesNum + '</p><p>关注店铺</p></div><div class="nblock" data-href="share_user_list.html"><p>' + data.data.shareNum + '</p><p>我的分享</p></div>';
$('.nav').html(html);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui.ajax(hyhUrl('app/users/getOrderNum'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
var data = toJson(data, 1);
if(data.status == 1) {
var html = '<div class="order_cb indent_btn" data-href="waitPay"><div class="num">' + data.data.order.waitPay + '</div><img src="../img/1.png" /><p>待付款</p></div><div class="order_cb indent_btn" data-href="waitDeliver"><div class="num">' + data.data.order.waitSend + '</div><img src="../img/2.png" /><p>待发货</p></div><div class="order_cb indent_btn" data-href="waitReceive"><div class="num">' + data.data.order.waitReceive + '</div><img src="../img/3.png" /><p>待收货</p></div><div class="order_cb indent_btn" data-href="waitAppraise"><div class="num">' + data.data.order.waitAppraise + '</div><img src="../img/4.png" /><p>待评价</p></div><div class="order_cb indent_btn" data-href="abnormal"><img src="../img/5.png" /><p>退款/售后</p></div>';
$('.order_con').html(html);
$('.num').each(function() {
if($(this).html() == '0') {
$(this).css('display', 'none');
}
})
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
window.addEventListener('refresh', function(e) { //执行刷新
location.reload();
});
mui('.my').on('tap', '.seeting', function() {
mui.openWindow({
url: 'setting.html',
id: 'setting.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.my').on('tap', '.share', function() {
mui.openWindow({
url: 'share.html',
id: 'share.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_userId: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui(".nav").on('tap', '.nblock', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
var data_href = this.attributes["data-href"].nodeValue;
var url = 'collect.html';
if(data_href=='share_user_list.html'){
url = 'share_user_list.html';
}
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: url,
id: url,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.order').on('tap', '.indent_btn', function() {
var data_href = this.attributes["data-href"].nodeValue;
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'indent.html',
id: 'indent.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.my').on('tap', '.login', function() {
mui.openWindow({
url: 'login.html',
id: 'login.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
//跳转到ect钱包
$('.moneycon').on('tap', '.moneycon_', function() {
if($(this).children('p').attr('id','userEct')){
mui.openWindow({
url: 'ect_index.html',
id: 'ect_index.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
})
})

179
static/app/js/new_product.js Executable file
View File

@ -0,0 +1,179 @@
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
var count = 1;
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
// console.log(order_class)
mui.ajax(hyhUrl('app/Shops/listShopQuery'), { 
data: {
page: count,
pagesize : 10
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
data = data.data;
if(data.Rows.length == 0) {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
return;
}
var html = ''
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.newTime + '</p></div><div class="b_con clearfix">';
$.each(this.goods, function() {
html += '<img data-goodId="' + this.goodsId + '" src="' + hyhImgUrl(this.goodsImg) + '" />'
});
html += '</div></div>'
});
$('.con').append(html);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}, 500);
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
mui.plusReady(function() {
var data = '';
mui.ajax(hyhUrl('app/Shops/listShopQuery'), { 
data: {
pagesize: 10,
page: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.newTime + '</p></div><div class="b_con clearfix">';
$.each(this.goods, function() {
html += '<img data-goodId="' + this.goodsId + '" src="' + hyhImgUrl(this.goodsImg) + '" />'
});
html += '</div></div>'
});
$('.con').html(html)
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.con').on('tap', '.b_title', function() {
var shopId = $(this).attr('data-shopId');
//console.log(shopId);
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html'+shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.con').on('tap', 'img[data-goodId]', function() {
var goodId = $(this).attr('data-goodId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

33
static/app/js/newuser.js Executable file
View File

@ -0,0 +1,33 @@
mui.plusReady(function() {
// var token = localStorage.getItem('token');
// var self = plus.webview.currentWebview();
// var msgId = self.data_msgId;
// mui.ajax(hyhUrl('app/messages/getById'), { 
// headers: { 
// "HYH-Token": token
// },
// data: {
// msgId: msgId
// },
// dataType: 'json', //服务器返回json格式数据  
// type: 'post', //HTTP请求类型  
// timeout: 10000, //超时时间设置为10秒  
// success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// var data = toJson(data);
//
// if(data.status == 1) {
// data = data.data;
// var html = '<div class="time">' + data.createTime + '</div><div class="con_">' + data.msgContent + '</div>';
// $('.con').html(html)
// } else {
// console.log(data.status)
// }
// },
// error: function(xhr, type, errorThrown) {           //异常处理;  
// // alert(type);      
// }  
// }); 
var html = '<div class="con_">1、惠宝积分的获得:1合源惠线下联盟消费者去实体店消费根据消费金额可直接获得惠宝积分 2新手注册直接送388惠宝积分 3商城消费成功购物可获得实际消费金额20%的惠宝积分</div><div class="con_">2、惠宝积分的使用惠宝积分用于商城购物在货款结算时勾选可直抵20%货款</div>';
$('.con').html(html)
})

110
static/app/js/order_con.js Executable file
View File

@ -0,0 +1,110 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
var data_order_id = localStorage.getItem('data_order_id');
// console.log(data_order_id)
mui.ajax(hyhUrl('app/Orders/getDetail'), { 
headers: { 
"HYH-Token": token
},
data: {
id: data_order_id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
var data = toJson(data);
var html = '<div class="ad"><p>' + data.status + '</p></div><div class="address clearfix"><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' + data.userName + '</div><div class="add_r_t_r">' + data.userPhone + '</div></div><div class="add_r_b">收货地址:' + data.userAddress + '</div></div></div><div class="invoice_info"><p>发票信息</p><p>发票抬头 ' + data.invoiceClient + '</p></div><div class="shop_info"><div class="row_title" data-shopId="' + data.shopId + '"><div class="store_name">' + data.shopName + '</div></div><div class="row_con clearfix">';
$.each(data.goods, function() {
html += '<div class="row_block clearfix" data-goodsId="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">' + this.goodsSpecNames + '</p></div><div class="rcrr"><p>¥' + this.goodsPrice + '</p><del>¥' + this.marketPrice + '</del><span>x' + this.goodsNum + '</span></div></div></div>'
});
html += '<div class="cost"><div class="c1 clearfix"><div class="c1_l">商品总价</div><div class="c1_r">¥' + data.goodsMoney + '</div></div><div class="c1 clearfix"><div class="c1_l">运费(快递)</div><div class="c1_r">¥' + data.deliverMoney + '</div></div><div class="c2 clearfix"><div class="c1_l">订单总价</div><div class="c1_r">¥' + data.totalMoney + '</div></div></div><div class="cost"><div class="c2 clearfix"><div class="c1_l">实付款</div><div class="c1_r on">¥' + data.realTotalMoney + '</div></div></div></div></div><div class="jf_info clearfix"><div class="jf_jf">积分</div><div class="jf_p">奖励积分<o>' + data.orderScore + '</o>点</div></div><a href="tel:' + data.shopTel + '" class="lxmj"><img src="../img/phone1.png" /><p>联系卖家 </p></a><div class="info"><p>订单编号:' + data.orderNo + '</p><p>创建时间:' + data.createTime + '</p>';
if(data.deliveryTime != 'null') {
html += '<p>发货时间:' + data.deliveryTime + '</p>'
}
if(data.deliveryTime != 'null') {
html += '<p>成交时间:' + data.receiveTime + '</p>'
}
html += '</div>';
$('.con').html(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}
}); 
$('.con').on('tap', '.row_title', function() {
var shopId = $(this).attr('data-shopId');
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html' + shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.con').on('tap', '.row_block', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html' + goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

52
static/app/js/order_out.js Executable file
View File

@ -0,0 +1,52 @@
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var data_order_id = self.data_order_id;
var sub = plus.webview.create('order_con.html', 'order_con.html', {
top: '66px',
bottom: '49px',
scrollIndicator: 'none'
});
self.append(sub);
localStorage.setItem('data_order_id', data_order_id);
if(!data_order_id) {
$('#ckwl').css('display', 'none')
}
mui(".btns").on('tap', '#ckwl', function() {
// var tj = plus.webview.create('search.html');
// tj.show();
// alert(e.target.attributes["data-id"].nodeValue);
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'logistics.html',
id: 'logistics.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_order_id: data_order_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

4
static/app/js/photoswipe-ui-default.min.js vendored Executable file

File diff suppressed because one or more lines are too long

3734
static/app/js/photoswipe.js Executable file

File diff suppressed because it is too large Load Diff

216
static/app/js/pj.js Executable file
View File

@ -0,0 +1,216 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
var self = plus.webview.currentWebview();
var data_order_id = self.data_order_id;
mui.ajax(hyhUrl('app/Orders/getOrderAppraise'), { 
headers: { 
"HYH-Token": token
},
data: {
oId: data_order_id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data
var html = '';
var i =0;
$.each(data.Rows, function() {
if(this.appraise == null) {
html += '<div class="con_1"data-goodsId="' + this.goodsId + '"data-goodsSpecId="' + this.goodsSpecId + '"data-orderId="' + this.orderId + '"data-orderGoodsId="' + this.id + '"><div class="describe"><div class="des_img"><img src="' + hyhImgUrl(this.goodsImg) + '"/></div><p>' + this.goodsName + '</p></div><div class="row"data-class="goodsScore"data-goodsScore="0"><p>商品评分</p><div class="star"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="serviceScore"data-serviceScore="0"><p>服务评分</p><div class="star"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="timeScore"data-timeScore="0"><p>时效评分</p><div class="star"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="purchase"><textarea class="content"name=""rows=""cols=""placeholder="分享你的购买心得"></textarea><div class="up_out"><div id="ossfile' + i + '" class="ossfile clearfix" data-num="' + i + '">你的浏览器不支持flash,Silverlight或者HTML5</div><div id="container' + i + '" class="container" data-num="' + i + '"><a id="selectfiles' + i + '" href="javascript:void(0);" class="btn selectfiles" data-num="' + i + '">选择图片</a></div></div></div><button class="tijiao">提交评价</button></div>'
i++;
} else {
html += '<div class="con_1"data-goodsId="' + this.goodsId + '"data-goodsSpecId="' + this.goodsSpecId + '"data-orderId="' + data.orderId + '"data-orderGoodsId="' + this.orderId + '"><div class="describe"><div class="des_img"><img src="' + hyhImgUrl(this.goodsImg) + '"/></div><p>' + this.goodsName + '</p></div><div class="row"data-class="goodsScore"data-goodsScore="' + this.appraise.goodsScore + '"><p>商品评分</p><div class="star"data-isPj="1"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="serviceScore"data-serviceScore="' + this.appraise.serviceScore + '"><p>服务评分</p><div class="star"data-isPj="1"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="timeScore"data-timeScore="' + this.appraise.timeScore + '"><p>时效评分</p><div class="star"data-isPj="1"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="purchase_"><p>' + this.appraise.content + '</p>'
$.each(this.appraise.images, function() {
html+='<img src="'+ hyhImgUrl(this) +'"/>'
});
html+='</div></div>';
}
});
$('.con').html(html)
$('.star').each(function() {
if($(this).attr('data-isPj') == 1) {
var num = +$(this).parent().attr('data-' + $(this).parent().attr('data-class')) - 1
$(this).children().eq(num).children().addClass('star_on').removeClass('star_off')
$(this).children().eq(num).prevAll().children().addClass('star_on').removeClass('star_off')
$(this).children().eq(num).nextAll().children().addClass('star_off').removeClass('star_on')
}
})
var btnArr = [];
$('.selectfiles').each(function(num) {
btnArr.push($(this).attr('id'));
})
$.each(btnArr, function(i, n) {
var self = this.toString();
var that = document.getElementById(this);
var uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight,html4',
browse_button: self,
//multi_selection: false,
// container: document.getElementById('container'),
flash_swf_url: '../lib/plupload-2.1.2/js/Moxie.swf',
silverlight_xap_url: '../lib/plupload-2.1.2/js/Moxie.xap',
url: 'http://oss.aliyuncs.com',
dir:'appraises',
filters: {
mime_types: [ //只允许上传图片和zip,rar文件
{
title: "Image files",
extensions: "jpg,gif,png,bmp"
},
{
title: "Zip files",
extensions: "zip,rar"
}
],
max_file_size: '10mb', //最大只能上传10mb的文件
prevent_duplicates: true //不允许选取重复文件
},
init: {
PostInit: function() {
document.getElementsByClassName('ossfile')[i].innerHTML = '';
// document.getElementById('postfiles').onclick = function() {
// set_upload_param(uploader, '', false);
// return false;
// };
uploader.bind('FilesAdded', function() {
set_upload_param(uploader, '', false,'appraises');
return false;
});
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementsByClassName('ossfile')[i].innerHTML += '<div class="files_out" id="'+ file.id +'"><b></b>' +
'<div class="progress"><div class="progress-bar" style="width: 60px"></div></div>' +
'</div>';
});
},
BeforeUpload: function(up, file) {
check_object_radio();
set_upload_param(up, file.name, true);
},
UploadProgress: function(up, file) {
var d = document.getElementById(file.id);
d.getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
var prog = d.getElementsByTagName('div')[0];
var progBar = prog.getElementsByTagName('div')[0]
progBar.style.width = 2 * file.percent + 'px';
progBar.setAttribute('aria-valuenow', file.percent);
},
FileUploaded: function(up, file, info) {
if(info.status == 200) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<img data-src="' + get_uploaded_object_name(file.name) + '" src="' + hyhImgUrl(get_uploaded_object_name(file.name)) + '" />';
} else {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = info.response;
}
},
Error: function(up, err) {
if(err.code == -600) {
alert("\n选择的文件太大了");
} else if(err.code == -601) {
alert("\n选择的文件后缀不对");
} else if(err.code == -602) {
alert("\n这个文件已经上传过一遍了");
} else {
alert("\nError xml:" + err.response);
}
}
}
});
uploader.init();
});
} else {
console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.con').on('tap', '.star_a', function() {
if($(this).parent().attr('data-isPj') == 1) {
return;
}
$(this).children().addClass('star_on').removeClass('star_off');
$(this).prevAll().children().addClass('star_on').removeClass('star_off');
$(this).nextAll().children().addClass('star_off').removeClass('star_on');
$(this).parent().parent().attr('data-' + $(this).parent().parent().attr('data-class'), $(this).index() + 1);
})
$('.con').on('tap', '.tijiao', function() {
var goodsId = $(this).parent().attr('data-goodsId');
var goodsSpecId = $(this).parent().attr('data-goodsSpecId');
var orderId = $(this).parent().attr('data-orderId');
var orderGoodsId = $(this).parent().attr('data-orderGoodsId');
var timeScore = $(this).siblings('.row[data-class*=timeScore]').attr('data-timeScore');
var goodsScore = $(this).siblings('.row[data-class*=goodsScore]').attr('data-goodsScore');
var serviceScore = $(this).siblings('.row[data-class*=serviceScore]').attr('data-serviceScore');
var content = $(this).siblings('.purchase').children('textarea').val();
var that = $(this);
var imagesArr=[];
$(this).siblings('.purchase').children('.up_out').children('.ossfile').children('.files_out').children('b').children('img').each(function(){
imagesArr.push($(this).attr('data-src'))
})
var images = imagesArr.join(',');
if(timeScore == 0 || serviceScore == 0 || serviceScore == 0) {
alert('评分必须1-5分之间!');
return;
}
if(content.length < 3) {
alert('评论最少3个字!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/Goodsappraises/add'), { 
headers: { 
"HYH-Token": token
},
data: {
goodsId: goodsId,
goodsSpecId: goodsSpecId,
orderId: orderId,
orderGoodsId: orderGoodsId,
timeScore: timeScore,
goodsScore: goodsScore,
serviceScore: serviceScore,
content: content,
images:images
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
alert(data.msg)
if(data.status == 1) {
location.reload();
} else {
console.log(data.status)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})

28
static/app/js/plupload.full.min.js vendored Executable file

File diff suppressed because one or more lines are too long

614
static/app/js/qrcode.js Executable file
View File

@ -0,0 +1,614 @@
/**
* @fileoverview
* - Using the 'QRCode for Javascript library'
* - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
* - this library has no dependencies.
*
* @author davidshimjs
* @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a>
* @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a>
*/
var QRCode;
(function () {
//---------------------------------------------------------------------
// QRCode for JavaScript
//
// Copyright (c) 2009 Kazuhiko Arase
//
// URL: http://www.d-project.com/
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license.php
//
// The word "QR Code" is registered trademark of
// DENSO WAVE INCORPORATED
// http://www.denso-wave.com/qrcode/faqpatent-e.html
//
//---------------------------------------------------------------------
function QR8bitByte(data) {
this.mode = QRMode.MODE_8BIT_BYTE;
this.data = data;
this.parsedData = [];
// Added to support UTF-8 Characters
for (var i = 0, l = this.data.length; i < l; i++) {
var byteArray = [];
var code = this.data.charCodeAt(i);
if (code > 0x10000) {
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
byteArray[3] = 0x80 | (code & 0x3F);
} else if (code > 0x800) {
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
byteArray[2] = 0x80 | (code & 0x3F);
} else if (code > 0x80) {
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
byteArray[1] = 0x80 | (code & 0x3F);
} else {
byteArray[0] = code;
}
this.parsedData.push(byteArray);
}
this.parsedData = Array.prototype.concat.apply([], this.parsedData);
if (this.parsedData.length != this.data.length) {
this.parsedData.unshift(191);
this.parsedData.unshift(187);
this.parsedData.unshift(239);
}
}
QR8bitByte.prototype = {
getLength: function (buffer) {
return this.parsedData.length;
},
write: function (buffer) {
for (var i = 0, l = this.parsedData.length; i < l; i++) {
buffer.put(this.parsedData[i], 8);
}
}
};
function QRCodeModel(typeNumber, errorCorrectLevel) {
this.typeNumber = typeNumber;
this.errorCorrectLevel = errorCorrectLevel;
this.modules = null;
this.moduleCount = 0;
this.dataCache = null;
this.dataList = [];
}
QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);}
return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row<this.moduleCount;row++){this.modules[row]=new Array(this.moduleCount);for(var col=0;col<this.moduleCount;col++){this.modules[row][col]=null;}}
this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(test,maskPattern);if(this.typeNumber>=7){this.setupTypeNumber(test);}
if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}
this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row<this.modules.length;row++){var y=row*cs;for(var col=0;col<this.modules[row].length;col++){var x=col*cs;var dark=this.modules[row][col];if(dark){qr_mc.beginFill(0,100);qr_mc.moveTo(x,y);qr_mc.lineTo(x+cs,y);qr_mc.lineTo(x+cs,y+cs);qr_mc.lineTo(x,y+cs);qr_mc.endFill();}}}
return qr_mc;},setupTimingPattern:function(){for(var r=8;r<this.moduleCount-8;r++){if(this.modules[r][6]!=null){continue;}
this.modules[r][6]=(r%2==0);}
for(var c=8;c<this.moduleCount-8;c++){if(this.modules[6][c]!=null){continue;}
this.modules[6][c]=(c%2==0);}},setupPositionAdjustPattern:function(){var pos=QRUtil.getPatternPosition(this.typeNumber);for(var i=0;i<pos.length;i++){for(var j=0;j<pos.length;j++){var row=pos[i];var col=pos[j];if(this.modules[row][col]!=null){continue;}
for(var r=-2;r<=2;r++){for(var c=-2;c<=2;c++){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}}}},setupTypeNumber:function(test){var bits=QRUtil.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}
for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}
this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex<data.length){dark=(((data[byteIndex]>>>bitIndex)&1)==1);}
var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}
this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}
row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;i<dataList.length;i++){var data=dataList[i];buffer.put(data.mode,4);buffer.put(data.getLength(),QRUtil.getLengthInBits(data.mode,typeNumber));data.write(buffer);}
var totalDataCount=0;for(var i=0;i<rsBlocks.length;i++){totalDataCount+=rsBlocks[i].dataCount;}
if(buffer.getLengthInBits()>totalDataCount*8){throw new Error("code length overflow. ("
+buffer.getLengthInBits()
+">"
+totalDataCount*8
+")");}
if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}
while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}
while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}
buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}
buffer.put(QRCodeModel.PAD1,8);}
return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r<rsBlocks.length;r++){var dcCount=rsBlocks[r].dataCount;var ecCount=rsBlocks[r].totalCount-dcCount;maxDcCount=Math.max(maxDcCount,dcCount);maxEcCount=Math.max(maxEcCount,ecCount);dcdata[r]=new Array(dcCount);for(var i=0;i<dcdata[r].length;i++){dcdata[r][i]=0xff&buffer.buffer[i+offset];}
offset+=dcCount;var rsPoly=QRUtil.getErrorCorrectPolynomial(ecCount);var rawPoly=new QRPolynomial(dcdata[r],rsPoly.getLength()-1);var modPoly=rawPoly.mod(rsPoly);ecdata[r]=new Array(rsPoly.getLength()-1);for(var i=0;i<ecdata[r].length;i++){var modIndex=i+modPoly.getLength()-ecdata[r].length;ecdata[r][i]=(modIndex>=0)?modPoly.get(modIndex):0;}}
var totalCodeCount=0;for(var i=0;i<rsBlocks.length;i++){totalCodeCount+=rsBlocks[i].totalCount;}
var data=new Array(totalCodeCount);var index=0;for(var i=0;i<maxDcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<dcdata[r].length){data[index++]=dcdata[r][i];}}}
for(var i=0;i<maxEcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<ecdata[r].length){data[index++]=ecdata[r][i];}}}
return data;};var QRMode={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3};var QRErrorCorrectLevel={L:1,M:0,Q:3,H:2};var QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var QRUtil={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:(1<<10)|(1<<8)|(1<<5)|(1<<4)|(1<<2)|(1<<1)|(1<<0),G18:(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<5)|(1<<2)|(1<<0),G15_MASK:(1<<14)|(1<<12)|(1<<10)|(1<<4)|(1<<1),getBCHTypeInfo:function(data){var d=data<<10;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)>=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}
return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}
return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}
return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i<errorCorrectLength;i++){a=a.multiply(new QRPolynomial([1,QRMath.gexp(i)],0));}
return a;},getLengthInBits:function(mode,type){if(1<=type&&type<10){switch(mode){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:return 8;case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+mode);}}else if(type<27){switch(mode){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+mode);}}else if(type<41){switch(mode){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+mode);}}else{throw new Error("type:"+type);}},getLostPoint:function(qrCode){var moduleCount=qrCode.getModuleCount();var lostPoint=0;for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount;col++){var sameCount=0;var dark=qrCode.isDark(row,col);for(var r=-1;r<=1;r++){if(row+r<0||moduleCount<=row+r){continue;}
for(var c=-1;c<=1;c++){if(col+c<0||moduleCount<=col+c){continue;}
if(r==0&&c==0){continue;}
if(dark==qrCode.isDark(row+r,col+c)){sameCount++;}}}
if(sameCount>5){lostPoint+=(3+sameCount-5);}}}
for(var row=0;row<moduleCount-1;row++){for(var col=0;col<moduleCount-1;col++){var count=0;if(qrCode.isDark(row,col))count++;if(qrCode.isDark(row+1,col))count++;if(qrCode.isDark(row,col+1))count++;if(qrCode.isDark(row+1,col+1))count++;if(count==0||count==4){lostPoint+=3;}}}
for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount-6;col++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row,col+1)&&qrCode.isDark(row,col+2)&&qrCode.isDark(row,col+3)&&qrCode.isDark(row,col+4)&&!qrCode.isDark(row,col+5)&&qrCode.isDark(row,col+6)){lostPoint+=40;}}}
for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount-6;row++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row+1,col)&&qrCode.isDark(row+2,col)&&qrCode.isDark(row+3,col)&&qrCode.isDark(row+4,col)&&!qrCode.isDark(row+5,col)&&qrCode.isDark(row+6,col)){lostPoint+=40;}}}
var darkCount=0;for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount;row++){if(qrCode.isDark(row,col)){darkCount++;}}}
var ratio=Math.abs(100*darkCount/moduleCount/moduleCount-50)/5;lostPoint+=ratio*10;return lostPoint;}};var QRMath={glog:function(n){if(n<1){throw new Error("glog("+n+")");}
return QRMath.LOG_TABLE[n];},gexp:function(n){while(n<0){n+=255;}
while(n>=256){n-=255;}
return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<<i;}
for(var i=8;i<256;i++){QRMath.EXP_TABLE[i]=QRMath.EXP_TABLE[i-4]^QRMath.EXP_TABLE[i-5]^QRMath.EXP_TABLE[i-6]^QRMath.EXP_TABLE[i-8];}
for(var i=0;i<255;i++){QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]]=i;}
function QRPolynomial(num,shift){if(num.length==undefined){throw new Error(num.length+"/"+shift);}
var offset=0;while(offset<num.length&&num[offset]==0){offset++;}
this.num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i++){this.num[i]=num[i+offset];}}
QRPolynomial.prototype={get:function(index){return this.num[index];},getLength:function(){return this.num.length;},multiply:function(e){var num=new Array(this.getLength()+e.getLength()-1);for(var i=0;i<this.getLength();i++){for(var j=0;j<e.getLength();j++){num[i+j]^=QRMath.gexp(QRMath.glog(this.get(i))+QRMath.glog(e.get(j)));}}
return new QRPolynomial(num,0);},mod:function(e){if(this.getLength()-e.getLength()<0){return this;}
var ratio=QRMath.glog(this.get(0))-QRMath.glog(e.get(0));var num=new Array(this.getLength());for(var i=0;i<this.getLength();i++){num[i]=this.get(i);}
for(var i=0;i<e.getLength();i++){num[i]^=QRMath.gexp(QRMath.glog(e.get(i))+ratio);}
return new QRPolynomial(num,0).mod(e);}};function QRRSBlock(totalCount,dataCount){this.totalCount=totalCount;this.dataCount=dataCount;}
QRRSBlock.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];QRRSBlock.getRSBlocks=function(typeNumber,errorCorrectLevel){var rsBlock=QRRSBlock.getRsBlockTable(typeNumber,errorCorrectLevel);if(rsBlock==undefined){throw new Error("bad rs block @ typeNumber:"+typeNumber+"/errorCorrectLevel:"+errorCorrectLevel);}
var length=rsBlock.length/3;var list=[];for(var i=0;i<length;i++){var count=rsBlock[i*3+0];var totalCount=rsBlock[i*3+1];var dataCount=rsBlock[i*3+2];for(var j=0;j<count;j++){list.push(new QRRSBlock(totalCount,dataCount));}}
return list;};QRRSBlock.getRsBlockTable=function(typeNumber,errorCorrectLevel){switch(errorCorrectLevel){case QRErrorCorrectLevel.L:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+0];case QRErrorCorrectLevel.M:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+1];case QRErrorCorrectLevel.Q:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+2];case QRErrorCorrectLevel.H:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+3];default:return undefined;}};function QRBitBuffer(){this.buffer=[];this.length=0;}
QRBitBuffer.prototype={get:function(index){var bufIndex=Math.floor(index/8);return((this.buffer[bufIndex]>>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i<length;i++){this.putBit(((num>>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}
if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}
this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];
function _isSupportCanvas() {
return typeof CanvasRenderingContext2D != "undefined";
}
// android 2.x doesn't support Data-URI spec
function _getAndroid() {
var android = false;
var sAgent = navigator.userAgent;
if (/android/i.test(sAgent)) { // android
android = true;
var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
if (aMat && aMat[1]) {
android = parseFloat(aMat[1]);
}
}
return android;
}
var svgDrawer = (function() {
var Drawing = function (el, htOption) {
this._el = el;
this._htOption = htOption;
};
Drawing.prototype.draw = function (oQRCode) {
var _htOption = this._htOption;
var _el = this._el;
var nCount = oQRCode.getModuleCount();
var nWidth = Math.floor(_htOption.width / nCount);
var nHeight = Math.floor(_htOption.height / nCount);
this.clear();
function makeSVG(tag, attrs) {
var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
for (var k in attrs)
if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
return el;
}
var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight});
svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
_el.appendChild(svg);
svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"}));
svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"}));
for (var row = 0; row < nCount; row++) {
for (var col = 0; col < nCount; col++) {
if (oQRCode.isDark(row, col)) {
var child = makeSVG("use", {"x": String(col), "y": String(row)});
child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
svg.appendChild(child);
}
}
}
};
Drawing.prototype.clear = function () {
while (this._el.hasChildNodes())
this._el.removeChild(this._el.lastChild);
};
return Drawing;
})();
var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
// Drawing in DOM by using Table tag
var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
var Drawing = function (el, htOption) {
this._el = el;
this._htOption = htOption;
};
/**
* Draw the QRCode
*
* @param {QRCode} oQRCode
*/
Drawing.prototype.draw = function (oQRCode) {
var _htOption = this._htOption;
var _el = this._el;
var nCount = oQRCode.getModuleCount();
var nWidth = Math.floor(_htOption.width / nCount);
var nHeight = Math.floor(_htOption.height / nCount);
var aHTML = ['<table style="border:0;border-collapse:collapse;">'];
for (var row = 0; row < nCount; row++) {
aHTML.push('<tr>');
for (var col = 0; col < nCount; col++) {
aHTML.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + nWidth + 'px;height:' + nHeight + 'px;background-color:' + (oQRCode.isDark(row, col) ? _htOption.colorDark : _htOption.colorLight) + ';"></td>');
}
aHTML.push('</tr>');
}
aHTML.push('</table>');
_el.innerHTML = aHTML.join('');
// Fix the margin values as real size.
var elTable = _el.childNodes[0];
var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
}
};
/**
* Clear the QRCode
*/
Drawing.prototype.clear = function () {
this._el.innerHTML = '';
};
return Drawing;
})() : (function () { // Drawing in Canvas
function _onMakeImage() {
this._elImage.src = this._elCanvas.toDataURL("image/png");
this._elImage.style.display = "block";
this._elCanvas.style.display = "none";
}
// Android 2.1 bug workaround
// http://code.google.com/p/android/issues/detail?id=5141
if (this._android && this._android <= 2.1) {
var factor = 1 / window.devicePixelRatio;
var drawImage = CanvasRenderingContext2D.prototype.drawImage;
CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
if (("nodeName" in image) && /img/i.test(image.nodeName)) {
for (var i = arguments.length - 1; i >= 1; i--) {
arguments[i] = arguments[i] * factor;
}
} else if (typeof dw == "undefined") {
arguments[1] *= factor;
arguments[2] *= factor;
arguments[3] *= factor;
arguments[4] *= factor;
}
drawImage.apply(this, arguments);
};
}
/**
* Check whether the user's browser supports Data URI or not
*
* @private
* @param {Function} fSuccess Occurs if it supports Data URI
* @param {Function} fFail Occurs if it doesn't support Data URI
*/
function _safeSetDataURI(fSuccess, fFail) {
var self = this;
self._fFail = fFail;
self._fSuccess = fSuccess;
// Check it just once
if (self._bSupportDataURI === null) {
var el = document.createElement("img");
var fOnError = function() {
self._bSupportDataURI = false;
if (self._fFail) {
self._fFail.call(self);
}
};
var fOnSuccess = function() {
self._bSupportDataURI = true;
if (self._fSuccess) {
self._fSuccess.call(self);
}
};
el.onabort = fOnError;
el.onerror = fOnError;
el.onload = fOnSuccess;
el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
return;
} else if (self._bSupportDataURI === true && self._fSuccess) {
self._fSuccess.call(self);
} else if (self._bSupportDataURI === false && self._fFail) {
self._fFail.call(self);
}
};
/**
* Drawing QRCode by using canvas
*
* @constructor
* @param {HTMLElement} el
* @param {Object} htOption QRCode Options
*/
var Drawing = function (el, htOption) {
this._bIsPainted = false;
this._android = _getAndroid();
this._htOption = htOption;
this._elCanvas = document.createElement("canvas");
this._elCanvas.width = htOption.width;
this._elCanvas.height = htOption.height;
el.appendChild(this._elCanvas);
this._el = el;
this._oContext = this._elCanvas.getContext("2d");
this._bIsPainted = false;
this._elImage = document.createElement("img");
this._elImage.alt = "Scan me!";
this._elImage.style.display = "none";
this._el.appendChild(this._elImage);
this._bSupportDataURI = null;
};
/**
* Draw the QRCode
*
* @param {QRCode} oQRCode
*/
Drawing.prototype.draw = function (oQRCode) {
var _elImage = this._elImage;
var _oContext = this._oContext;
var _htOption = this._htOption;
var nCount = oQRCode.getModuleCount();
var nWidth = _htOption.width / nCount;
var nHeight = _htOption.height / nCount;
var nRoundedWidth = Math.round(nWidth);
var nRoundedHeight = Math.round(nHeight);
_elImage.style.display = "none";
this.clear();
for (var row = 0; row < nCount; row++) {
for (var col = 0; col < nCount; col++) {
var bIsDark = oQRCode.isDark(row, col);
var nLeft = col * nWidth;
var nTop = row * nHeight;
_oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
_oContext.lineWidth = 1;
_oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
_oContext.fillRect(nLeft, nTop, nWidth, nHeight);
// 안티 앨리어싱 방지 처리
_oContext.strokeRect(
Math.floor(nLeft) + 0.5,
Math.floor(nTop) + 0.5,
nRoundedWidth,
nRoundedHeight
);
_oContext.strokeRect(
Math.ceil(nLeft) - 0.5,
Math.ceil(nTop) - 0.5,
nRoundedWidth,
nRoundedHeight
);
}
}
this._bIsPainted = true;
};
/**
* Make the image from Canvas if the browser supports Data URI.
*/
Drawing.prototype.makeImage = function () {
if (this._bIsPainted) {
_safeSetDataURI.call(this, _onMakeImage);
}
};
/**
* Return whether the QRCode is painted or not
*
* @return {Boolean}
*/
Drawing.prototype.isPainted = function () {
return this._bIsPainted;
};
/**
* Clear the QRCode
*/
Drawing.prototype.clear = function () {
this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
this._bIsPainted = false;
};
/**
* @private
* @param {Number} nNumber
*/
Drawing.prototype.round = function (nNumber) {
if (!nNumber) {
return nNumber;
}
return Math.floor(nNumber * 1000) / 1000;
};
return Drawing;
})();
/**
* Get the type by string length
*
* @private
* @param {String} sText
* @param {Number} nCorrectLevel
* @return {Number} type
*/
function _getTypeNumber(sText, nCorrectLevel) {
var nType = 1;
var length = _getUTF8Length(sText);
for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
var nLimit = 0;
switch (nCorrectLevel) {
case QRErrorCorrectLevel.L :
nLimit = QRCodeLimitLength[i][0];
break;
case QRErrorCorrectLevel.M :
nLimit = QRCodeLimitLength[i][1];
break;
case QRErrorCorrectLevel.Q :
nLimit = QRCodeLimitLength[i][2];
break;
case QRErrorCorrectLevel.H :
nLimit = QRCodeLimitLength[i][3];
break;
}
if (length <= nLimit) {
break;
} else {
nType++;
}
}
if (nType > QRCodeLimitLength.length) {
throw new Error("Too long data");
}
return nType;
}
function _getUTF8Length(sText) {
var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
return replacedText.length + (replacedText.length != sText ? 3 : 0);
}
/**
* @class QRCode
* @constructor
* @example
* new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
*
* @example
* var oQRCode = new QRCode("test", {
* text : "http://naver.com",
* width : 128,
* height : 128
* });
*
* oQRCode.clear(); // Clear the QRCode.
* oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode.
*
* @param {HTMLElement|String} el target element or 'id' attribute of element.
* @param {Object|String} vOption
* @param {String} vOption.text QRCode link data
* @param {Number} [vOption.width=256]
* @param {Number} [vOption.height=256]
* @param {String} [vOption.colorDark="#000000"]
* @param {String} [vOption.colorLight="#ffffff"]
* @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H]
*/
QRCode = function (el, vOption) {
this._htOption = {
width : 256,
height : 256,
typeNumber : 4,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRErrorCorrectLevel.H
};
if (typeof vOption === 'string') {
vOption = {
text : vOption
};
}
// Overwrites options
if (vOption) {
for (var i in vOption) {
this._htOption[i] = vOption[i];
}
}
if (typeof el == "string") {
el = document.getElementById(el);
}
if (this._htOption.useSVG) {
Drawing = svgDrawer;
}
this._android = _getAndroid();
this._el = el;
this._oQRCode = null;
this._oDrawing = new Drawing(this._el, this._htOption);
if (this._htOption.text) {
this.makeCode(this._htOption.text);
}
};
/**
* Make the QRCode
*
* @param {String} sText link data
*/
QRCode.prototype.makeCode = function (sText) {
this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
this._oQRCode.addData(sText);
this._oQRCode.make();
this._el.title = sText;
this._oDrawing.draw(this._oQRCode);
this.makeImage();
};
/**
* Make the Image from Canvas element
* - It occurs automatically
* - Android below 3 doesn't support Data-URI spec.
*
* @private
*/
QRCode.prototype.makeImage = function () {
if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
this._oDrawing.makeImage();
}
};
/**
* Clear the QRCode
*/
QRCode.prototype.clear = function () {
this._oDrawing.clear();
};
/**
* @name QRCode.CorrectLevel
*/
QRCode.CorrectLevel = QRErrorCorrectLevel;
})();

139
static/app/js/register.js Executable file
View File

@ -0,0 +1,139 @@
mui.init({
beforeback: function() {     //获得父页面的webview
var list = plus.webview.currentWebview().opener();     //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
//返回true,继续页面关闭逻辑
return true;
}
});
mui.plusReady(function() {
var wait = 120;
var html = '<div class="row"><img src="../img/icon_pwd1.png" /><span class="s1">验证码:</span><input class="tpyzm" type="text" maxlength="4" placeholder="请输入图片验证码" /><img class="yzmhh" src = "'+ hyhUrl('mobile/users/getverify?rnd='+Math.random()) +'"/></input></div>';
$('.con').append(html);
function time() {
if(wait == 0) {
$('#mobileCode').removeAttr("disabled");
$('#mobileCode').val("重新发送");
wait = 120;
} else {
$('#mobileCode').attr("disabled", true);
$('#mobileCode').val("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time()
},
1000)
}
}
mui('.row').on('tap', '#mobileCode', function() {
var loginName = $('#loginName').val();
if(loginName == '') {
alert('手机号不能为空!');
return;
}
if(!(/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/.test(loginName))) {
alert("手机号码有误,请重填!");
return;
}
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/getPhoneVerifyCode'), { 
data: {
userPhone: loginName
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
time();
} else {
alert(data.msg);
}
$('#mobileCode').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
alert(type)
// alert(type);      
}
}); 
})
mui('.down').on('tap', '.btn', function() {
var loginName = $('#loginName').val();
var mobileCode = $('.yzm').val();
var loginPwd = $('#loginPwd').val();
var reUserPwd = $('#reUserPwd').val();
var pName = $('#pName').val();
var verifyCode = $('.tpyzm').val();
if(loginName == '') {
alert('手机号不能为空!');
return;
}
if(!(/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/.test(loginName))) {
alert("手机号码有误,请重填!");
return;
}
if(mobileCode == '') {
alert('验证码不能为空!');
return;
}
if(loginPwd == '') {
alert('密码不能为空!');
return;
}
if(reUserPwd == '') {
alert('确认不能为空!');
return;
}
if(loginPwd.length < 6) {
alert('密码不能小于6位');
return;
}
if(!(loginPwd == reUserPwd)) {
alert('两次密码不一致!');
return;
}
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/register'), { 
data: {
loginName: loginName,
mobileCode: mobileCode,
loginPwd: loginPwd,
reUserPwd: reUserPwd,
pName: pName,
nameType: 3,
verifyCode: verifyCode
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
alert(data.msg);
if(data.status == 1) {
mui.back();
}else{
$('.yzmhh').attr('src',hyhUrl('mobile/users/getverify?rnd='+Math.random()));
}
$('.btn').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type);      
}
}); 
})
})

64
static/app/js/setting.js Executable file
View File

@ -0,0 +1,64 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui('.block').on('tap', '.row', function() {
var url = $(this).attr('id');
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.loginout').on('tap', function() {
//console.log(111)
mui.ajax(hyhUrl('app/users/logout'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
localStorage.removeItem("token");
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
mui.fire(plus.webview.getWebviewById('templete/shoppingcart.html'), 'refresh');
mui.back();
var data = toJson(data, 1);
if(data.status == 1) {
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})

169
static/app/js/setting_address.js Executable file
View File

@ -0,0 +1,169 @@
mui.init({
beforeback: function() {     //获得父页面的webview
     //触发父页面的自定义事件(refresh),从而进行刷新
//返回true,继续页面关闭逻辑
return true;
}
});
mui.plusReady(function() {
window.addEventListener('reload', function(e) { //执行刷新
location.reload();
});
var self = plus.webview.currentWebview();
var isOrder = self.data_isOrder;
if(isOrder == true) {
$('.con').on('tap', '.block', function() {
var addressId = $(this).attr('data-addressId');
localStorage.setItem('addressId', addressId);
var list = plus.webview.currentWebview().opener();
mui.fire(list, 'setAddress');
mui.back();
})
}
mui.ajax(hyhUrl('app/useraddress/getList'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
data = data.data;
var html = '';
$.each(data.addressList, function() {
html += '<div class="block" data-addressId="' + this.addressId + '"><p class="pname">' + this.userName + '</p><p class="pphone">' + this.userPhone + '</p><p class="paddress">' + this.areaName + ' ' + this.userAddress + '</p><hr /><div class="btnout" data-isDefault="' + this.isDefault + '"><div class="btn"></div></div><p class="p1">设为默认地址</p><button class="bj">编辑</button><button class="del">删除</button></div>'
});
$('.con').html(html)
$('.btnout').each(function(num) {
if($(this).attr('data-isDefault') == 1) {
$(this).children('.btn').addClass('on')
}
})
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.footer_btn').on('tap', function() {
mui.openWindow({
url: 'editAddress.html',
id: 'editAddress.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.con').on('tap', '.bj', function(e) {
e.stopPropagation();
var data_addressId = $(this).parent().attr('data-addressId');
mui.openWindow({
url: 'editAddress.html',
id: 'editAddress.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_addressId: data_addressId
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.con').on('tap', '.del', function() {
var data_addressId = $(this).parent().attr('data-addressId');
if(confirm('确认删除地址?')) {
mui.ajax(hyhUrl('app/Useraddress/del'), { 
data: {
id: data_addressId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
location.reload()
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
})
$('.con').on('tap', '.btnout', function() {
$('.btnout').children('.btn').removeClass('on');
$(this).children('.btn').addClass('on');
var addressId = $(this).parent().attr('data-addressId')
mui.ajax(hyhUrl('app/Useraddress/setDefault'), { 
data: {
id: addressId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
location.reload()
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})

View File

@ -0,0 +1,200 @@
$('#newPass').attr('type','text');
$('#newPass2').attr('type','text');
mui.plusReady(function() {
var token = localStorage.getItem('token');
var wait = 120;
function time() {
if(wait == 0) {
$('#mobileCode').removeAttr("disabled");
$('#mobileCode').val("重新发送");
wait = 120;
} else {
$('#mobileCode').attr("disabled", true);
$('#mobileCode').val("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time();
},
1000)
}
}
mui.ajax(hyhUrl('app/users/backPayPass'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
if(data.userPhone) {
$('#userPhone').val(data.userPhone);
$('#userPhone').attr('disabled', 'disabled');
} else {
alert('未绑定手机请先绑定手机!');
mui.openWindow({
url: 'setting_phone.html',
id: 'setting_phone.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
} else {
alert(data.msg);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.row').on('tap', '#mobileCode', function() {
var that = $(this);
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/backpayCode'), { 
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
time();
} else {
alert(data.msg)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
// alert(type);      
}
}); 
})
mui('.down').on('tap', '#true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/verifybackPay'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
$('#con1').css('display', 'none');
$('#down1').css('display', 'none');
$('#con2').css('display', 'block');
$('#down2').css('display', 'block');
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
mui('.down').on('tap', '#true2', function() {
var newPass = $('#newPass').val();
var newPass2 = $('#newPass2').val();
var that = $(this);
if(newPass == '') {
alert('支付密码不能为空!');
return;
} else if(newPass.length != 6) {
alert('支付密码为6位');
return;
} else if(newPass != newPass2) {
alert('两次支付密码不相同!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/resetbackPay'), { 
headers: { 
"HYH-Token": token
},
data: {
newPass: newPass
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})

208
static/app/js/setting_fogetPwd.js Executable file
View File

@ -0,0 +1,208 @@
mui.plusReady(function() {
var wait = 120;
function time() {
if(wait == 0) {
$('#mobileCode').removeAttr("disabled");
$('#mobileCode').val("重新发送");
wait = 120;
} else {
$('#mobileCode').attr("disabled", true);
$('#mobileCode').val("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time();
},
1000)
}
}
mui('.row').on('tap', '#mobileCode', function() {
var that = $(this);
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/getfindPhone'), { 
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
time();
} else {
alert(data.msg)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
// alert(type);      
}
}); 
})
mui('.down').on('tap', '#true0', function() {
var loginName0 = $('#loginName0').val();
var that = $(this);
if(loginName0 == '') {
alert('用户名不能为空!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/findPass'), { 
data: {
loginName: loginName0,
step: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
$('#con0').css('display', 'none');
$('#down0').css('display', 'none');
$('#con1').css('display', 'block');
$('#down1').css('display', 'block');
mui.ajax(hyhUrl('app/users/forgetPasst'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
$('#loginName').val(data.data.loginName);
$('#loginName').attr('disabled', 'disabled');
$('#userPhone').val(data.data.userPhone);
$('#userPhone').attr('disabled', 'disabled');
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
mui('.down').on('tap', '#true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/findPass'), { 
data: {
Checkcode: phoneCode,
modes: 1,
step: 2
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
//console.log(data);
//alert(1)
document.getElementById("con1").style.display = "none";
document.getElementById("down1").style.display = "none";
document.getElementById("con2").style.display = "block";
document.getElementById("down2").style.display = "block";
//$('#con1').css('display', 'none');
//$('#down1').css('display', 'none');
//$('#con2').css('display', 'block');
//$('#down2').css('display', 'block');
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
alert(type);      
}  
}); 
})
mui('.down').on('tap', '#true2', function() {
var loginPwd = $('#loginPwd').val();
var repassword = $('#repassword').val();
var that = $(this);
if(loginPwd == '') {
alert('登录密码不能为空!');
return;
} else if(loginPwd.length < 6) {
alert('登录密码最少为6位');
return;
} else if(loginPwd != repassword) {
alert('两次支付密码不相同!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/findPass'), { 
data: {
step: 3,
loginPwd: loginPwd,
repassword: repassword
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})

View File

@ -0,0 +1,34 @@
mui('.block').on('tap', '.row', function() {
var url = $(this).attr('id');
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})

58
static/app/js/setting_payPwd.js Executable file
View File

@ -0,0 +1,58 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui('.down').on('tap', '#true', function() {
var that = $(this)
var oldPass = $('#oldPass').val();
var newPass = $('#newPass').val();
var newPass2 = $('#newPass2').val();
if(oldPass == '') {
alert('原支付密码不能为空!');
return;
}
if(newPass == '') {
alert('新支付密码不能为空!');
return;
}
if(newPass.length != 6) {
alert('新支付密码长度为6位');
return;
}
if(!(newPass == newPass2)) {
alert('两次支付密码不一致!');
return;
}
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/editpayPwd'), { 
data: {
oldPass: oldPass,
newPass: newPass,
reNewPass:newPass2
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
}
}); 
})
})

256
static/app/js/setting_phone.js Executable file
View File

@ -0,0 +1,256 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
var isBang = 0;
var isOver = 1;
var wait = 120;
var wait1 = 120;
function time() {
if(wait == 0) {
$('#mobileCode').removeAttr("disabled");
$('#mobileCode').val("重新发送");
wait = 120;
} else {
$('#mobileCode').attr("disabled", true);
$('#mobileCode').val("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time();
},
1000)
}
}
function time1() {
if(wait1 == 0) {
$('#mobileCode1').removeAttr("disabled");
$('#mobileCode1').val("重新发送");
wait1 = 120;
} else {
$('#mobileCode1').attr("disabled", true);
$('#mobileCode1').val("重新发送(" + wait1 + ")");
wait1--;
setTimeout(function() {
time1();
},
1000)
}
}
mui.ajax(hyhUrl('app/users/editPhone'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
if(data.userPhone) {
isBang = 1;
$('#userPhone').val(data.userPhone);
$('#userPhone').attr('disabled', 'disabled');
$('#next_btn').css('display', 'block');
} else {
$('#true').css('display', 'block');
}
} else {
alert(data.msg);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.row').on('tap', '.codeBtn', function() {
var that = $(this)
var userPhone = $('#userPhone').val();
var url = $(this).attr('id') == 'mobileCode' ? 'sendCodeEdit' : 'sendCodeTie'
if(isBang == 0 || isOver == 0) {
if(userPhone == '') {
alert('手机号不能为空!');
return;
}
if(!(/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/.test(userPhone))) {
alert("手机号码有误,请重填!");
return;
}
} else {
userPhone = '';
}
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/' + url), { 
data: {
userPhone: userPhone
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
if(that.attr('id') == 'mobileCode') {
time();
} else if(that.attr('id') == 'mobileCode1') {
time1();
}
} else {
alert(data.msg)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
// alert(type);      
}
}); 
})
//未绑定手机
mui('.down').on('tap', '#true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/phoneEdit'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
//已绑定手机 1
mui('.down').on('tap', '#next_btn', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/phoneEdito'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
$('#next_btn').css('display', 'none');
$('#next_true').css('display', 'block');
$('#userPhone').removeAttr('disabled');
$('#userPhone').val('');
$('#phoneCode').val('');
$('#mobileCode').css('display', 'none');
$('#mobileCode1').css('display', 'block');
isOver = 0;
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
//已绑定手机 2
mui('.down').on('tap', '#next_true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/phoneEdit'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})

60
static/app/js/setting_pwd.js Executable file
View File

@ -0,0 +1,60 @@
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui('.down').on('tap', '#true', function() {
var that = $(this)
var oldPass = $('#oldPass').val();
var newPass = $('#newPass').val();
var newPass2 = $('#newPass2').val();
if(oldPass == '') {
alert('原支付密码不能为空!');
return;
}
if(newPass == '') {
alert('新支付密码不能为空!');
return;
}
if(newPass.length < 6) {
alert('新支付密码不能小于6位');
return;
}
if(!(newPass == newPass2)) {
alert('两次支付密码不一致!');
return;
}
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/editloginPwd'), { 
data: {
oldPass: oldPass,
newPass: newPass
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
console.log(data.status)
if(data.status == 1) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
// alert(type);      
}
}); 
})
})

34
static/app/js/setting_user.js Executable file
View File

@ -0,0 +1,34 @@
mui('.block').on('tap', '.row', function() {
var url = $(this).attr('id');
mui.openWindow({
url: url + '.html',
id: url + '.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_href: data_href
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})

166
static/app/js/share.js Executable file
View File

@ -0,0 +1,166 @@
var shares = null;
var Intent = null,
File = null,
Uri = null,
main = null;
// H5 plus事件处理
function plusReady() {
updateSerivces();
if(plus.os.name == "Android") {
main = plus.android.runtimeMainActivity();
Intent = plus.android.importClass("android.content.Intent");
File = plus.android.importClass("java.io.File");
Uri = plus.android.importClass("android.net.Uri");
}
}
if(window.plus) {
plusReady();
} else {
document.addEventListener("plusready", plusReady, false);
}
/**
*
* 更新分享服务
*/
function updateSerivces() {
plus.share.getServices(function(s) {
shares = {};
for(var i in s) {
var t = s[i];
shares[t.id] = t;
}
}, function(e) {
plus.nativeUI.toast("获取分享服务列表失败:" + e.message);
});
}
/**
* 分享操作
* @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService)
* @param {Boolean} bh 是否分享链接
*/
function shareAction(sb, bh) {
if(!sb || !sb.s) {
plus.nativeUI.toast("无效的分享服务!");
return;
}
var msg = {
content: sharehrefDes.value,
extra: {
scene: sb.x
}
};
if(bh) {
msg.href = sharehref.value;
if(sharehrefTitle && sharehrefTitle.value != "") {
msg.title = sharehrefTitle.value;
}
if(sharehrefDes && sharehrefDes.value != "") {
msg.content = sharehrefDes.value;
}
msg.thumbs = ["_www/logo.png"];
msg.pictures = ["_www/logo.png"];
} else {
if(pic && pic.realUrl) {
msg.pictures = [pic.realUrl];
}
}
// 发送分享
if(sb.s.authenticated) {
// plus.nativeUI.toast("---已授权---");
shareMessage(msg, sb.s);
} else {
// plus.nativeUI.toast("---未授权---");
sb.s.authorize(function() {
shareMessage(msg, sb.s);
}, function(e) {
plus.nativeUI.toast("认证授权失败:" + e.code + " - " + e.message);
// alert("认证授权失败:"+e.code+" - "+e.message );
});
}
}
/**
* 发送分享消息
* @param {JSON} msg
* @param {plus.share.ShareService} s
*/
function shareMessage(msg, s) {
// plus.nativeUI.toast(JSON.stringify(msg));
s.send(msg, function() {
plus.nativeUI.toast("分享到\"" + s.description + "\"成功! ");
}, function(e) {
plus.nativeUI.toast("分享到\"" + s.description + "\"失败 ");
// alert( "分享到\""+s.description+"\"失败: "+JSON.stringify(e) );
});
}
// 分析链接
function shareHref() {
var shareBts = [];
// 更新分享列表
var ss = shares['weixin'];
ss && ss.nativeClient && (shareBts.push({
title: '微信朋友圈',
s: ss,
x: 'WXSceneTimeline'
}),
shareBts.push({
title: '微信好友',
s: ss,
x: 'WXSceneSession'
}));
// 弹出分享列表
shareBts.length > 0 ? plus.nativeUI.actionSheet({
title: '分享注册链接',
cancel: '取消',
buttons: shareBts
}, function(e) {
(e.index > 0) && shareAction(shareBts[e.index - 1], true);
}) : plus.nativeUI.plus.nativeUI.toast('当前环境无法支持分享链接操作!');
}
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui.ajax(hyhUrl('app/Users/get_share'), { 
headers: { 
"HYH-Token": token
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
//读取成功后
var qrcode = new QRCode(document.getElementById("qrcode"), {
width: 96, //设置宽高
height: 96
});
qrcode.makeCode(data.data.url);
// console.log(hyhImgUrl(data.data.bg_share))
$('.bg').attr('src',hyhImgUrl(data.data.bg_share))
$('#sharehref').val(data.data.url)
$('#sharehrefTitle').val(data.data.title)
$('#sharehrefDes').val(data.data.desc)
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// plus.nativeUI.toast(type);    
}  
}); 
$('header').on('tap','.share',function(){
shareHref();
})
});

View File

@ -0,0 +1,99 @@
var page = 1;
var userType = 0;
var isjiazai = 1;
function getData(page, userType) {
var data_set = {
page: page ? page : 1,
userType: userType ? userType : 0
}
if(isjiazai == 0) {
return;
} else {
isjiazai = 0;
mui.ajax(hyhUrl('app/users/getShareList'), { 
// headers: { 
// "HYH-Token": token
// },
data: data_set,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
data = data.Rows;
var html = '';
if(data == '') {
isjiazai = 0;
$('.con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;padding-top: 9px;">没有更多内容</p>');
return;
}
$.each(data, function() {
var defaultImg = userType==0? 'http://heyuanhui.com.cn/Template/mobile/new/Static/images/user68.png' :'http://heyuanhui.com.cn/Template/mobile/new/Static/images/user68.png';
var userPhoto = this.userPhoto == '' ? defaultImg : hyhImgUrl(this.userPhoto);
html += '<div class="row"><div class="row_top clearfix"><img class="img" src="' + userPhoto + '"/><p>' + this.loginName + '</p><img class="btn" src="../img/xiajiantou.png"/></div><div class="row_hid" style="display: none;"><div class="row_h_r"><p>注册时间:' + this.createTime + '</p></div></div></div>'
})
if(page == 1) {
$('.con').html(html);
} else {
$('.con').append(html);
}
isjiazai = 1;
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}
}
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui('.con').on('tap', '.row_top', function() {
if($(this).children('.btn').hasClass('ani')) {
$(this).children('.btn').removeClass('ani');
$(this).siblings('.row_hid').slideUp(300);
} else {
$(this).children('.btn').addClass('ani');
$(this).siblings('.row_hid').slideDown(300);
}
})
mui('.nav').on('tap','.block',function(){
if($(this).attr('data-userType')=='users'){
userType=0;
}else{
userType=1;
}
if($(this).hasClass('on')){
return;
}else{
$(this).addClass('on').siblings().removeClass('on');
mui('#pullrefresh').scroll().scrollTo(0,0,0);
$('.con').html('');
isjiazai=1;
page=1;
getData(page,userType);
}
})
getData(1, 0);
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY&&scroll.y!=0) {
if(isjiazai == 1) {
page++;
getData(page, userType);
}
}
})
})

160
static/app/js/shopGoodsList.js Executable file
View File

@ -0,0 +1,160 @@
var msort = 1;
var page = 1;
var condition = 1;
var desc = 0;
var keyword;
var isjiazai = 1;
var count = 1;
var pagesize = 10;
var ct1;
var ct2;
function pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2) {
// setTimeout(function() {
// mui('#pullrefresh').pullRefresh().endPullupToRefresh();
var data_set = {
page: page,
pagesize: pagesize,
shopId: shopId,
mdesc: desc,
msort: msort
goodsName: goodsName
}
// console.log(order_class)
if(isjiazai == 0) {
return;
}else{
isjiazai = 0;
mui.ajax(hyhUrl('app/Shops/getShopGoods'), { 
data: data_set,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
data = data.data;
var html = '';
if(data.Rows == '') {
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
isjiazai = 0;
return;
}
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
if(page == "1") {
$('.cnxh_con').html(html);
} else {
$('.cnxh_con').append(html);
}
isjiazai = 1;
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
// }, 500);
}
mui.plusReady(function() {
var shopId = localStorage.getItem('shopId')
var costnum = 0;
var self = plus.webview.currentWebview();
keyword = self.data_keyword;
$('.commoditylistnav').on('tap', '.nav_block', function() {
page = 1;
isjiazai = 1;
$(this).addClass('on').siblings().removeClass('on');
msort = $(this).attr('data-condition');
if($('#cost_btn').hasClass('on')) {
costnum += 1;
if(costnum % 2 == 1) {
$('#cost_btn').html('价格 <img src="../img/cost3.png"/>');
desc = 1;
} else if(costnum % 2 == 0) {
$('#cost_btn').html('价格 <img src="../img/cost2.png"/>');
desc = 0;
}
} else {
$('#cost_btn').html('价格 <img src="../img/cost1.png"/>')
costnum = 0;
desc = 0
}
pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2)
})
$('.cnxh_con').on('tap', '.con_goods', function() {
var good_id = $(this).attr('data-id');
mui.openWindow({
url: 'details.html',
id: 'details.html'+good_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: good_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2);
}
}
})
})
// setInterval(function() {
// $('.cnxh_block img').height($('.cnxh_block img').width());
// $('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
// }, 100)

475
static/app/js/shoppingcart.js Executable file
View File

@ -0,0 +1,475 @@
mui.plusReady(function() {
// var scroll = mui('.mui-scroll-wrapper').scroll({
// deceleration: 0.002 //flick 减速系数系数越大滚动速度越慢滚动距离越小默认值0.0006
// });
window.addEventListener('refresh', function(e) {
location.reload();
})
function getCost() {
var cost = 0;
$('.check2').each(function() {
if($(this).children().hasClass('check_1')) {
cost += ((+$(this).siblings('.b_con_r1').children('.bz').children('.cost').children('o').html()) * (+$(this).siblings('.b_con_r1').children('.bz').children('.num').children('o').html()))
}
})
$('.js_r span j').html('¥' + cost.toFixed(2));
}
function isChecks() {
$('.check1').each(function() {
var isChecks = 1;
$(this).parent().siblings().children().find('.checks').each(function() {
if($(this).hasClass('check_0')) {
isChecks = 0;
}
})
if(isChecks == 0) {
$(this).children().removeClass('check_1').addClass('check_0');
} else {
$(this).children().removeClass('check_0').addClass('check_1');
}
})
}
mui.ajax(hyhUrl('app/carts/index'), { 
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
data = data.data;
var html = '';
$('header').html('购物车(' + data.all_carts_num + ')');
var allids = [];
$.each(data.carts, function() {
var ids = [];
$.each(this.list, function() {
ids.push(this.cartId);
allids.push(this.cartId);
});
var idsStr = ids.join(',');
html += '<div class="block"><div class="b_title clearfix"><div class="check1" data-idsStr="' + idsStr + '"><div class="checks check_0"></div></div><img src="../img/icon_shop.png" /><div class="b_link"><a href="#" data-shopId="' + this.shopId + '">' + this.shopName + '</a></div><img src="../img/icon_right.png" /><div class="btn_bj">编辑</div></div><div class="bcon">';
$.each(this.list, function() {
html += '<div class="b_con clearfix"><div class="check2" data-cartId="' + this.cartId + '" data-cartNum="' + this.cartNum + '" data-isCheck="' + this.isCheck + '"><div class="checks check_0"></div></div><img class="s_img" src="' + hyhImgUrl(this.goodsImg) + '" /><div class="b_con_r1" data-goodsId="' + this.goodsId + '" style="display: block;"><p class="p1">' + this.goodsName + '</p><p class="p2">';
$.each(this.specNames, function() {
html += this.catName + ':' + this.itemName + ';';
});
var price;
if(this.specPrice != null) {
price = this.specPrice;
} else {
price = this.shopPrice;
}
html += '</p><div class="bz clearfix"><span class="cost">¥<o>' + price + '</o>&nbsp;&nbsp;</span><del class="oldcost">¥'+ this.marketPrice +'</del><span class="num">×<o>' + this.cartNum + '</o></span></div></div><div class="b_con_r2 clearfix" style="display: none;"><div class="b_con_r2_l"><div class="changenum clearfix" data-cartId="' + this.cartId + '"><img class="jian" src="../img/jian.png" /><input type="number" name="" id="" value="' + this.cartNum + '" /><img class="jia" src="../img/jia.png" /></div></div><div class="b_con_r2_del" data-cartId="' + this.cartId + '">删除</div></div></div>';
});
html += '</div></div>';
});
var allIdsStr = allids.join(',');
$('.con').html(html)
$('.check').attr('data-allIdsStr', allIdsStr);
$('.checks').each(function() {
if($(this).parent().attr('data-isCheck') == '1') {
$(this).removeClass('check_0').addClass('check_1');
}
})
getCost();
isChecks();
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.con').on('tap', '.b_link', function() {
var shopId = $(this).children('a').attr('data-shopId');
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html' + shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.con').on('tap', '.b_con_r1', function() {
var data_id = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html' + data_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: data_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
$('.check').on('tap', function() {
var isCheck;
var ids = $(this).attr('data-allIdsStr');
if($('.check').children('.checks').hasClass('check_0')) {
$('.check').children('.checks').removeClass('check_0').addClass('check_1');
$('.check1').children('.checks').removeClass('check_0').addClass('check_1');
$('.check2').children('.checks').removeClass('check_0').addClass('check_1');
isCheck = 1;
} else {
$('.check').children('.checks').removeClass('check_1').addClass('check_0');
$('.check1').children('.checks').removeClass('check_1').addClass('check_0');
$('.check2').children('.checks').removeClass('check_1').addClass('check_0');
isCheck = 0;
}
getCost();
isChecks();
mui.ajax(hyhUrl('app/carts/batchChangeCartGoods'), { 
data: {
ids: ids,
isCheck: isCheck
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
});
});
$('.con').on('tap', '.check1', function(e) {
e.stopPropagation();
var that = $(this);
var isCheck;
var ids = $(this).attr('data-idsStr');
$('.check').children('.checks').removeClass('check_1').addClass('check_0');
if(that.children('.checks').hasClass('check_0')) {
isCheck = 1;
that.children('.checks').removeClass('check_0').addClass('check_1');
that.parent().siblings().children().find('.check2').children('.checks').removeClass('check_0').addClass('check_1');
} else {
isCheck = 0;
that.children('.checks').removeClass('check_1').addClass('check_0');
that.parent().siblings().children().find('.check2').children('.checks').removeClass('check_1').addClass('check_0');
}
getCost();
isChecks();
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/batchChangeCartGoods'), { 
data: {
ids: ids,
isCheck: isCheck
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data);
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
});
});
$('.con').on('tap', '.check2', function(e) {
//console.log()
e.stopPropagation();
var isCheck;
var cartId = $(this).attr('data-cartId');
var that = $(this);
var buyNum = $(this).attr('data-cartNum');
$('.check').children('.checks').removeClass('check_1').addClass('check_0');
if($(this).children().hasClass('check_0')) {
$(this).parent().parent().siblings().children('.check1').children('.checks').removeClass('check_1').addClass('check_0');
$(this).children('.checks').removeClass('check_0').addClass('check_1');
isCheck = 1;
} else {
$(this).children('.checks').removeClass('check_1').addClass('check_0');
isCheck = 0;
}
getCost();
isChecks()
$(this).attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/changeCartGoods'), { 
data: {
id: cartId,
isCheck: isCheck,
buyNum: buyNum
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data, 1);
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
});
$('.con').on('tap', '.btn_bj', function(e) {
e.stopPropagation()
if($(this).html() == '编辑') {
$(this).html('完成');
$(this).parent().siblings().children().find('.b_con_r1').css('display', 'none');
$(this).parent().siblings().children().find('.b_con_r2').css('display', 'block');
} else {
$(this).html('编辑');
$(this).parent().siblings().children().find('.b_con_r2').css('display', 'none');
$(this).parent().siblings().children().find('.b_con_r1').css('display', 'block');
var inputArr = $(this).parent().siblings().find('input')
$(this).parent().siblings().find('.num').each(function(num) {
$(this).html('×<o>' + inputArr.eq(num).val() + '</o>');
})
}
// console.log($(this).parent().siblings().find('.commodity_num'))
// console.log($(this).parent().siblings().find('input'));
if($(this).html() == '完成') {
return;
}
getCost()
})
$('.con').on('tap', '.jia', function() {
// console.log($(this).siblings('input').val())
var that = $(this);
var cartId = $(this).parent().attr('data-cartId')
var num = +$(this).siblings('input').val() + 1;
if(num <= 0) {
alert('购买数最小为1');
return;
}
$('.jia').attr('disabled', 'disabled');
$('.jian').attr('disabled', 'disabled');
$('input').attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/changeCartGoods'), { 
data: {
id: cartId,
buyNum: num
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data, 1);
that.siblings('input').val(num);
$('.jia').removeAttr('disabled');
$('.jian').removeAttr('disabled');
$('input').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
$('.con').on('tap', '.jian', function() {
var that = $(this);
var cartId = $(this).parent().attr('data-cartId')
var num = +$(this).siblings('input').val() - 1;
if(num <= 0) {
alert('购买数最小为1');
return;
}
$('.jia').attr('disabled', 'disabled');
$('.jian').attr('disabled', 'disabled');
$('input').attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/changeCartGoods'), { 
data: {
id: cartId,
buyNum: num
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data, 1);
that.siblings('input').val(num);
$('.jia').removeAttr('disabled');
$('.jian').removeAttr('disabled');
$('input').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
$('.con').on('blur', 'input', function() {
var that = $(this);
var cartId = $(this).parent().attr('data-cartId')
var num = +$(this).val();
if(num <= 0) {
alert('购买数最小为1');
return;
}
$('.jia').attr('disabled', 'disabled');
$('.jian').attr('disabled', 'disabled');
$('input').attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/carts/changeCartGoods'), { 
data: {
id: cartId,
buyNum: num
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data, 1);
that.siblings('input').val(num);
$('.jia').removeAttr('disabled');
$('.jian').removeAttr('disabled');
$('input').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
$('.con').on('tap', '.b_con_r2_del', function() {
var cartId = $(this).attr('data-cartId');
if(confirm('确定删除?')) {
mui.ajax(hyhUrl('app/carts/delCart'), { 
data: {
id: cartId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否;登录成功;  
var data = toJson(data, 1);
location.reload();
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
}
})
// $('.changeclass').on('tap', '.selectclass', function() {
// $('.mui-backdrop').show();
// })
//选择类型
// $('.cclass1').on('tap', '.block', function() {
// $(this).addClass('on').siblings().removeClass('on');
// $(this).parent().attr('data-class', $(this).html());
// })
// $('.closecclass').on('tap', function() {
// $('.mui-backdrop').css('display', 'none');
// })
// $('.ensure').on('tap', function() {
// $('.mui-backdrop').css('display', 'none');
// })
mui('.js').on('tap', '.btn_tj', function() {
var check_length = $('.check_1').length;
if(check_length == 0) {
alert('请选择商品结算!');
return;
}
mui.openWindow({
url: 'confirmOrder.html',
id: 'confirmOrder.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
// data_id: data_id
type: 0
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})

137
static/app/js/shopsList.js Executable file
View File

@ -0,0 +1,137 @@
var page = 1;
var pagesize = 10;
var condition = 1;
var isjiazai = 1;
var desc = 0;
function getData(page, pagesize, condition, keyword, desc) {
var data_set = {
page: page,
pagesize: pagesize,
condition: condition,
keyword: keyword,
desc: desc
}
mui.ajax(hyhUrl('app/shops/pageQuery'), { 
data: data_set,
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
data = data.data;
var html = '';
if(data.Rows == '') {
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多店铺</p>');
isjiazai = 0;
return;
}
$.each(data.Rows, function() {
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.shopCompany + '</p><div class="btn_gz">进店</div></div><div class="b_con clearfix">';
$.each(this.goods, function() {
html += '<div data-goodId="' + this.goodsId + '" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div>';
});
html += '</div></div>'
});
if(page == 1) {
$('.con').html(html);
} else {
$('.con').append(html);
}
isjiazai = 1;
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}
mui.plusReady(function() {
var self = plus.webview.currentWebview();
keyword = self.data_keyword;
getData(page, pagesize, 1, keyword, 0)
mui('.con').on('tap', '.b_title', function() {
var shopId = $(this).attr('data-shopId');
mui.openWindow({
url: 'storeout.html',
id: 'storeout.html' + shopId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
mui('.con').on('tap', '.bc_img', function() {
var goodId = $(this).attr('data-goodId');
mui.openWindow({
url: 'details.html',
id: 'details.html' + goodId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: goodId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
isjiazai = 0;
page++;
getData(page, pagesize, 1, keyword, 0)
}
}
})
})

68
static/app/js/store_activity.js Executable file
View File

@ -0,0 +1,68 @@
$('.con').html('');
var shopId = localStorage.getItem('shopId')
mui.plusReady(function() {
$('.con').on('tap', '.con_goods', function() {
var good_id = $(this).attr('data-id');
mui.openWindow({
url: 'details.html',
id: 'details.html'+good_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: good_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})
mui.ajax(hyhUrl('app/Shops/getReward'), { 
data: {
shopId: shopId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
var html = '';
if(data.reward) {
$.each(data.reward.Rows, function() {
html += '<div class="block"><div class="b_title"><img class="img" src="' + hyhImgUrl(this.goodsImg) + '" /><img class="clock" src="../img/icon_clock.png" alt="" /><p class="p1">' + this.startDate + '至' + this.endDate + '</p><p class="p2">' + this.rewardTitle + '</p></div><div class="b_con con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p3">' + this.goodsName + ' </p><p class="p4">¥' + this.shopPrice + '</p></div></div>';
});
}
$('.con').html(html);
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
});

0
static/app/js/store_class.js Executable file
View File

202
static/app/js/store_commodity.js Executable file
View File

@ -0,0 +1,202 @@
$('.cnxh_con').html('');
var msort = 1;
var shopId = localStorage.getItem('shopId')
var page = 1;
var condition = 1;
var desc = 0;
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
var count = 1;
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
// console.log(order_class)
mui.ajax(hyhUrl('app/Shops/getShopGoods'), { 
data: {
page: count,
shopId: shopId,
pageSize: 10,
msort: condition,
mdesc: desc
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').append(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}, 500);
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
mui.plusReady(function() {
var costnum = 0;
$('.commoditylistnav').on('tap', '.nav_block', function() {
page = 1;
count = 1;
$(this).addClass('on').siblings().removeClass('on');
condition = $(this).attr('data-condition');
if($('#cost_btn').hasClass('on')) {
costnum += 1;
if(costnum % 2 == 1) {
$('#cost_btn').html('价格 <img src="../img/cost3.png"/>');
desc = 0;
} else if(costnum % 2 == 0) {
$('#cost_btn').html('价格 <img src="../img/cost2.png"/>');
desc = 1;
}
} else {
$('#cost_btn').html('价格 <img src="../img/cost1.png"/>')
costnum = 0;
desc = 1
}
mui.ajax(hyhUrl('app/Shops/getShopGoods'), { 
data: {
shopId: shopId,
pageSize: 10,
page: 1,
msort: condition,
mdesc: desc
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').html(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
mui.ajax(hyhUrl('app/Shops/getShopGoods'), { 
data: {
shopId: shopId,
pageSize: 10,
page: 1,
msort: 1,
mdesc: 0
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').html(html);
$('.cnxh_block .img').height($('.cnxh_block .img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
$('.cnxh_con').on('tap', '.con_goods', function() {
var good_id = $(this).attr('data-id');
mui.openWindow({
url: 'details.html',
id: 'details.html'+good_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: good_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})
setInterval(function() {
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
}, 100)

75
static/app/js/store_home.js Executable file
View File

@ -0,0 +1,75 @@
mui.plusReady(function() {
var data = JSON.parse(localStorage.getItem('shop_data'));
if(data.shop.shopAds.length > 0) {
var html1 = '<div class="mui-slider-group mui-slider-loop"><div class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.shop.shopAds[data.shop.shopAds.length - 1].adImg) + '"></a></div>';
var html2 = '<div class="mui-slider-indicator">';
$.each(data.shop.shopAds, function() {
html1 += '<div class="mui-slider-item "><a href="#"><img src="' + hyhImgUrl(this.adImg) + '"></a></div>';
html2 += '<div class="mui-indicator"></div>';
});
html2 += '</div>';
html1 += '<div class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.shop.shopAds[0].adImg) + '"></a></div></div>'
html1 += html2;
$('#slider').html(html1);
mui("#slider").slider({
interval: 5000
});
} else {
$('#slider').remove()
}
var html3 = '';
$.each(data.shopcats, function() {
html3 += '<div data-catId="' + this.catId + '" class="l_block">' + this.catName + '</div>';
});
$('.label').html(html3);
$('.l_block').each(function(num) {
if((num + 1) % 4 == 0) {
$(this).addClass('lbrr');
}
})
var html = '';
$.each(data.rec, function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
});
$('.cnxh_con').html(html);
$('.cnxh_con').on('tap', '.con_goods', function() {
var good_id = $(this).attr('data-id');
mui.openWindow({
url: 'details.html',
id: 'details1.html'+good_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: good_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
localStorage.setItem('shop_data','');
})
setInterval(function() {
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
}, 200)

0
static/app/js/store_info.js Executable file
View File

183
static/app/js/store_new.js Executable file
View File

@ -0,0 +1,183 @@
$('.con').html('');
var shopId = localStorage.getItem('shopId');
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
style: 'circle', //必选下拉刷新样式目前支持原生5+ circle 样式
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
height: '50px', //可选,默认50px.下拉刷新控件的高度,
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
callback: pulldownRefresh //必选刷新函数根据具体业务来编写比如通过ajax从服务器获取新数据
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
var count = 1;
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
// console.log(order_class)
mui.ajax(hyhUrl('app/Shops/getShopGoods'), { 
data: {
page: count,
shopId: shopId,
pageSize: 10,
msort: 6,
mdesc: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
data = data.data;
var html = '';
var obj = {};
$.each(data.Rows, function() {
if(!obj[this.saleTime]) {
obj[this.saleTime] = [this]
} else {
obj[this.saleTime].push(this)
}
});
for(var i in obj) {
if(obj[i].length == 1) {
html += '<div class="con_two con_goods" data-id="' + obj[i][0].goodsId + '"><div class="co_title clearfix"><div class="hengxian"></div><p>本店' + obj[i][0].saleTime + '上新</p><div class="hengxian"></div></div><div class="ct_con"><img src="' + hyhImgUrl(obj[i][0].goodsImg) + '" /><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + obj[i][0].shopPrice + '<o>' + obj[i][0].saleNum + '人付款</o></p></div></div>'
} else {
html += '<div class="con_one"><div class="co_title clearfix"><div class="hengxian"></div><p>本店' + obj[i][0].saleTime + '上新</p><div class="hengxian"></div></div><div class="cnxh_con clearfix">'
$.each(obj[i], function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + this.shopPrice + '<o>' + this.saleNum + '人付款</o></p></div></div>'
});
html += '</div></div>'
}
}
$('.con').append(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
}, 500);
}
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function() {
window.location.reload();
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
mui.plusReady(function() {
$('.con').on('tap', '.con_goods', function() {
var good_id = $(this).attr('data-id');
mui.openWindow({
url: 'details.html',
id: 'details.html'+good_id,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_id: good_id
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})
mui.ajax(hyhUrl('app/Shops/getShopGoods'), { 
data: {
shopId: shopId,
pageSize: 10,
page: 1,
msort: 6,
mdesc: 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
data = data.data;
var html = '';
var obj = {};
$.each(data.Rows, function() {
if(!obj[this.saleTime]) {
obj[this.saleTime] = [this]
} else {
obj[this.saleTime].push(this)
}
});
for(var i in obj) {
if(obj[i].length == 1) {
html += '<div class="con_two con_goods" data-id="' + obj[i][0].goodsId + '"><div class="co_title clearfix"><div class="hengxian"></div><p>本店' + obj[i][0].saleTime + '上新</p><div class="hengxian"></div></div><div class="ct_con"><img src="' + hyhImgUrl(obj[i][0].goodsImg) + '" /><p class="s_name">' + obj[i][0].goodsName + '</p><p class="cost">¥' + obj[i][0].shopPrice + '<o>' + obj[i][0].saleNum + '人付款</o></p></div></div>'
} else {
html += '<div class="con_one"><div class="co_title clearfix"><div class="hengxian"></div><p>本店' + obj[i][0].saleTime + '上新</p><div class="hengxian"></div></div><div class="cnxh_con clearfix">'
$.each(obj[i], function() {
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + this.shopPrice + '<o>' + this.saleNum + '人付款</o></p></div></div>'
});
html += '</div></div>'
}
}
$('.con').html(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
setInterval(function() {
$('.cnxh_block img').height($('.cnxh_block img').width());
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
}, 200)

262
static/app/js/storeout.js Executable file
View File

@ -0,0 +1,262 @@
jumpPage();
mui.plusReady(function() {
var data = '';
var self = plus.webview.currentWebview();
var shopId = self.shopId;
localStorage.setItem('shopId', shopId);
mui.ajax(hyhUrl('app/Shops/getHome'), { 
data: {
shopId: shopId
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
data = toJson(data);
data = data.data;
localStorage.setItem('shop_data', JSON.stringify(data))
var html = '<div class="search clearfix"><a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a><div class="searchcon clearfix"><input type="search" name="" id="keyword" value="" placeholder="请输入商品名" /><button style="display: none;">搜索</button></div><img style="display:none;" class="classmenu" data-shopid="' + data.shop.shopId + '" src="../img/classmenu.png" /></div><div class="b_title" data-shopid="' + data.shop.shopId + '"><img class="b_img" src="' + hyhImgUrl(data.shop.shopImg) + '"/><p class="storename">' + data.shop.shopName + '</p><p class="time">' + data.shop.scores.totalScore + '分</p><div class="gz_btn">关注</div></div>';
$('.header').html(html);
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
// mui('.footer').on('tap','#dpxq',function(){
// var w = plus.webview.create('store_info.html');
// w.show()
// })
mui('.search').on('tap', '.classmenu', function() {
shopId = this.attributes["data-shopid"].nodeValue;
// console.log(this.attributes["data-id"].nodeValue);
mui.openWindow({
url: 'store_class.html',
id: 'store_class.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
shopId: shopId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
// mui('.footer').on('tap','#rmfl',function(){
// $('.rmfl').css('display','block')
// })
mui('.header').on('tap', '.gz_btn', function() {
var shopId = $(this).parent().attr('data-shopid');
var that = $(this);
mui.ajax(hyhUrl('app/Favorites/add'), { 
data: {
id: shopId,
type : 1
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data.data.goodsFavoritesNum)
// console.log(data.data.Rows)
var data = toJson(data);
if(data.status == 1) {
that.html('已关注');
that.addClass('gz_btn1').removeClass('gz_btn');
} else {
//console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);    
}  
}); 
})
$('.header').on('focus','#keyword', function() {
$(".searchcon button").css('display', 'block');
})
$('.header').on('blur','#keyword', function() {
$(".searchcon button").css('display', 'none');
})
//店铺搜索
$(".header").on('keypress','#keyword', function(e) {
var keycode = e.keyCode;
var searchName = $('#keyword').val();
if(keycode == '13') {
// e.preventDefault();
// console.log(searchName)
//请求搜索接口
mui.openWindow({
url: 'goodsList.html',
id: 'goodsList.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
}
});
$(".header").on('tap','.searchcon button', function(e) {
var searchName = $('#keyword').val();
// e.preventDefault();
// console.log(searchName)
//请求搜索接口
mui.openWindow({
url: 'goodsList.html',
id: 'goodsList.html',
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度默认为100%
height: '100%' //新页面高度默认为100%
},
extras: {
data_keyword: searchName
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示默认为true
// aniShow: animationType, //页面显示动画默认为”slide-in-right“
// duration: animationTime, //页面动画持续时间Android平台默认100毫秒iOS平台默认200毫秒
// event: 'titleUpdate', //页面显示时机默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
});
})
function jumpPage() {
//跳转页面
var subpages = ['store_home.html', 'store_commodity.html', 'store_new.html', 'store_activity.html'];
var subpage_style = {
top: '178px',
bottom: '0',
scrollIndicator: 'none'
};
var aniShow = {}; //动画显示
//当前激活选项
var activeTab = subpages[0];
//选项卡点击事件
mui('.nav').on('tap', 'a', function(e) {
var targetTab = this.getAttribute('href');
if(targetTab == activeTab) {
return;
}
//显示目标选项卡
//若为iOS平台或非首次显示则直接显示
if(mui.os.ios || aniShow[targetTab]) {
plus.webview.show(targetTab);
} else {
//否则使用fade-in动画且保存变量
var temp = {};
temp[targetTab] = "true";
mui.extend(aniShow, temp);
plus.webview.show(targetTab, "fade-in", 300);
}
//隐藏当前;
plus.webview.hide(activeTab);
//更改当前活跃的选项卡
activeTab = targetTab;
var html = $(this).html();
html = html.substring(0, html.indexOf('.png')) + '_on.png">';
$(this).html(html);
$(this).addClass('on').siblings().removeClass('on');
$(this).siblings().each(function() {
if($(this).html().indexOf('_on') == -1) {
return
}
html = $(this).html().substring(0, $(this).html().indexOf('_on'))
html = html + '.png">';
$(this).html(html)
})
});
//首次启动切滑效果
mui.plusReady(function() {
// launchScreen();
// plus.navigator.setStatusBarStyle('dark');
// console.log(plus.navigator.getStatusBarStyle())
var self = plus.webview.currentWebview();
shopId = self.shopId;
//console.log(shopId);
localStorage.setItem('shopId', shopId);
for(var i = 0; i < subpages.length; i++) {
var temp = {};
//http://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.create
var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
if(i > 0) {
sub.hide();
} else {
temp[subpages[i]] = "true";
mui.extend(aniShow, temp); //合并对象
}
self.append(sub);
}
});
}

19
static/app/js/swiper.min.js vendored Executable file

File diff suppressed because one or more lines are too long

0
static/app/js/time_limit.js Executable file
View File

129
static/app/js/upload.js Executable file
View File

@ -0,0 +1,129 @@
accessid = ''
accesskey = ''
host = ''
policyBase64 = ''
signature = ''
callbackbody = ''
filename = ''
key = ''
expire = 0
g_object_name = ''
g_object_name_type = ''
now = timestamp = Date.parse(new Date()) / 1000;
dir = 'images'
function send_request() {
var xmlhttp = null;
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if(xmlhttp != null) {
// console.log(dir)
serverUrl = hyhUrl('oss/get.php?dir='+dir);
xmlhttp.open("GET", serverUrl, false);
xmlhttp.send(null);
return xmlhttp.responseText
} else {
alert("Your browser does not support XMLHTTP.");
}
};
function check_object_radio() {
var tt = document.getElementsByName('myradio');
for(var i = 0; i < tt.length; i++) {
if(tt[i].checked) {
g_object_name_type = tt[i].value;
break;
}
}
}
function get_signature() {
//可以判断当前expire是否超过了当前时间,如果超过了当前时间,就重新取一下.3s 做为缓冲
now = timestamp = Date.parse(new Date()) / 1000;
if(expire < now + 3) {
body = send_request()
var obj = eval("(" + body + ")");
host = obj['host']
policyBase64 = obj['policy']
accessid = obj['accessid']
signature = obj['signature']
expire = parseInt(obj['expire'])
callbackbody = obj['callback']
key = obj['dir']
return true;
}
return false;
};
function random_string(len) {  
len = len || 32;  
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';  
var maxPos = chars.length;  
var pwd = '';  
for(i = 0; i < len; i++) {  
pwd += chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
function get_suffix(filename) {
pos = filename.lastIndexOf('.')
suffix = ''
if(pos != -1) {
suffix = filename.substring(pos)
}
return suffix;
}
function calculate_object_name(filename) {
if(g_object_name_type == 'local_name') {
g_object_name += "${filename}"
} else if(g_object_name_type == 'random_name') {
suffix = get_suffix(filename)
g_object_name = key + random_string(10) + suffix
}
return ''
}
function get_uploaded_object_name(filename) {
if(g_object_name_type == 'local_name') {
tmp_name = g_object_name
tmp_name = tmp_name.replace("${filename}", filename);
return tmp_name
} else if(g_object_name_type == 'random_name') {
return g_object_name
}
}
function set_upload_param(up, filename, ret,savedir) {
dir = savedir;
if(ret == false) {
ret = get_signature()
}
g_object_name = key;
if(filename != '') {
suffix = get_suffix(filename)
calculate_object_name(filename)
}
new_multipart_params = {
'key': g_object_name,
'policy': policyBase64,
'OSSAccessKeyId': accessid,
'success_action_status': '200', //让服务端返回200,不然默认会返回204
'callback': callbackbody,
'signature': signature,
};
up.setOption({
'url': host,
'multipart_params': new_multipart_params
});
up.start();
}

306
static/app/js/upload1.js Executable file
View File

@ -0,0 +1,306 @@
accessid = ''
accesskey = ''
host = ''
policyBase64 = ''
signature = ''
callbackbody = ''
filename = ''
key = ''
expire = 0
g_object_name = ''
g_object_name_type = ''
now = timestamp = Date.parse(new Date()) / 1000;
function send_request() {
var xmlhttp = null;
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if(xmlhttp != null) {
serverUrl = '../php/get.php'
xmlhttp.open("GET", serverUrl, false);
xmlhttp.send(null);
return xmlhttp.responseText
} else {
alert("Your browser does not support XMLHTTP.");
}
};
function check_object_radio() {
var tt = document.getElementsByName('myradio');
for(var i = 0; i < tt.length; i++) {
if(tt[i].checked) {
g_object_name_type = tt[i].value;
break;
}
}
}
function get_signature() {
//可以判断当前expire是否超过了当前时间,如果超过了当前时间,就重新取一下.3s 做为缓冲
now = timestamp = Date.parse(new Date()) / 1000;
if(expire < now + 3) {
body = send_request()
var obj = eval("(" + body + ")");
host = obj['host']
policyBase64 = obj['policy']
accessid = obj['accessid']
signature = obj['signature']
expire = parseInt(obj['expire'])
callbackbody = obj['callback']
key = obj['dir']
return true;
}
return false;
};
function random_string(len) {  
len = len || 32;  
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';  
var maxPos = chars.length;  
var pwd = '';  
for(i = 0; i < len; i++) {  
pwd += chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
function get_suffix(filename) {
pos = filename.lastIndexOf('.')
suffix = ''
if(pos != -1) {
suffix = filename.substring(pos)
}
return suffix;
}
function calculate_object_name(filename) {
if(g_object_name_type == 'local_name') {
g_object_name += "${filename}"
} else if(g_object_name_type == 'random_name') {
suffix = get_suffix(filename)
g_object_name = key + random_string(10) + suffix
}
return ''
}
function get_uploaded_object_name(filename) {
if(g_object_name_type == 'local_name') {
tmp_name = g_object_name
tmp_name = tmp_name.replace("${filename}", filename);
return tmp_name
} else if(g_object_name_type == 'random_name') {
return g_object_name
}
}
function set_upload_param(up, filename, ret) {
if(ret == false) {
ret = get_signature()
}
g_object_name = key;
if(filename != '') {
suffix = get_suffix(filename)
calculate_object_name(filename)
}
new_multipart_params = {
'key': g_object_name,
'policy': policyBase64,
'OSSAccessKeyId': accessid,
'success_action_status': '200', //让服务端返回200,不然默认会返回204
'callback': callbackbody,
'signature': signature,
};
up.setOption({
'url': host,
'multipart_params': new_multipart_params
});
up.start();
}
var html = '';
for(i = 0; i < 3; i++) {
html += '<div class="up_out"><div id="ossfile' + i + '" class="ossfile clearfix" data-num="' + i + '">你的浏览器不支持flash,Silverlight或者HTML5</div><div id="container' + i + '" class="container" data-num="' + i + '"><a id="selectfiles' + i + '" href="javascript:void(0);" class="btn selectfiles" data-num="' + i + '">选择文件</a></div></div>'
}
$('.con').html(html)
var btnArr = [];
$('.selectfiles').each(function(num) {
btnArr.push($(this).attr('id'));
})
$.each(btnArr, function(i, n) {
var self = this.toString();
var that = document.getElementById(this);
var uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight,html4',
browse_button: self,
//multi_selection: false,
// container: document.getElementById('container'),
flash_swf_url: '../lib/plupload-2.1.2/js/Moxie.swf',
silverlight_xap_url: '../lib/plupload-2.1.2/js/Moxie.xap',
url: 'http://oss.aliyuncs.com',
filters: {
mime_types: [ //只允许上传图片和zip,rar文件
{
title: "Image files",
extensions: "jpg,gif,png,bmp"
},
{
title: "Zip files",
extensions: "zip,rar"
}
],
max_file_size: '10mb', //最大只能上传10mb的文件
prevent_duplicates: true //不允许选取重复文件
},
init: {
PostInit: function() {
document.getElementsByClassName('ossfile')[i].innerHTML = '';
// document.getElementById('postfiles').onclick = function() {
// set_upload_param(uploader, '', false);
// return false;
// };
uploader.bind('FilesAdded', function() {
set_upload_param(uploader, '', false);
return false;
});
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementsByClassName('ossfile')[i].innerHTML += '<div class="files_out" id="' + file.id + '"><b></b>' +
'<div class="progress"><div class="progress-bar" style="width: 60px"></div></div>' +
'</div>';
});
},
BeforeUpload: function(up, file) {
check_object_radio();
set_upload_param(up, file.name, true);
},
UploadProgress: function(up, file) {
var d = document.getElementById(file.id);
d.getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
var prog = d.getElementsByTagName('div')[0];
var progBar = prog.getElementsByTagName('div')[0]
progBar.style.width = 2 * file.percent + 'px';
progBar.setAttribute('aria-valuenow', file.percent);
},
FileUploaded: function(up, file, info) {
if(info.status == 200) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<img data-src="' + get_uploaded_object_name(file.name) + '" src="http://heyuanhui.oss-cn-qingdao.aliyuncs.com/' + get_uploaded_object_name(file.name) + '" />';
} else {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = info.response;
}
},
Error: function(up, err) {
if(err.code == -600) {
alert("\n选择的文件太大了");
} else if(err.code == -601) {
alert("\n选择的文件后缀不对");
} else if(err.code == -602) {
alert("\n这个文件已经上传过一遍了");
} else {
alert("\nError xml:" + err.response);
}
}
}
});
uploader.init();
});
var uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight,html4',
browse_button: 'selectfiles',
//multi_selection: false,
// container: document.getElementById('container'),
flash_swf_url: '../lib/plupload-2.1.2/js/Moxie.swf',
silverlight_xap_url: '../lib/plupload-2.1.2/js/Moxie.xap',
url: 'http://oss.aliyuncs.com',
filters: {
mime_types: [ //只允许上传图片和zip,rar文件
{
title: "Image files",
extensions: "jpg,gif,png,bmp"
},
{
title: "Zip files",
extensions: "zip,rar"
}
],
max_file_size: '10mb', //最大只能上传10mb的文件
prevent_duplicates: true //不允许选取重复文件
},
init: {
PostInit: function() {
document.getElementById('ossfile').innerHTML = '';
// document.getElementById('postfiles').onclick = function() {
// set_upload_param(uploader, '', false);
// return false;
// };
uploader.bind('FilesAdded', function() {
set_upload_param(uploader, '', false);
return false;
});
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('ossfile').innerHTML += '<div class="files_out" id="' + file.id + '"><b></b>' +
'<div class="progress"><div class="progress-bar" style="width: 60px"></div></div>' +
'</div>';
});
},
BeforeUpload: function(up, file) {
check_object_radio();
set_upload_param(up, file.name, true);
},
UploadProgress: function(up, file) {
var d = document.getElementById(file.id);
d.getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
var prog = d.getElementsByTagName('div')[0];
var progBar = prog.getElementsByTagName('div')[0]
progBar.style.width = 2 * file.percent + 'px';
progBar.setAttribute('aria-valuenow', file.percent);
},
FileUploaded: function(up, file, info) {
if(info.status == 200) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<img src="http://heyuanhui.oss-cn-qingdao.aliyuncs.com/' + get_uploaded_object_name(file.name) + '" />';
} else {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = info.response;
}
},
Error: function(up, err) {
if(err.code == -600) {
alert("\n选择的文件太大了");
} else if(err.code == -601) {
alert("\n选择的文件后缀不对");
} else if(err.code == -602) {
alert("\n这个文件已经上传过一遍了");
} else {
alert("\nError xml:" + err.response);
}
}
}
});
uploader.init();