Commit f3214ad1 authored by zhengke's avatar zhengke

增加loading

parent 9f404379
...@@ -215,20 +215,27 @@ $.fn.dataStatistics = function(options) { ...@@ -215,20 +215,27 @@ $.fn.dataStatistics = function(options) {
$('.img_btn').click(function() { $('.img_btn').click(function() {
if ($('.img_btn p').css('color') == 'rgb(224, 50, 52)') { //判断按钮是否可以点击 if ($('.img_btn p').css('color') == 'rgb(224, 50, 52)') { //判断按钮是否可以点击
if (options.count != 0) { //判断是可以抢购 if (options.count != 0) { //判断是可以抢购
var loadingFlag;
if (options.platform == 'app') { if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'showHud', 'message': '抢购中...' })); window.postMessage(JSON.stringify({ 'action': 'showHud', 'message': '抢购中...' }));
} }
if (options.platform == 'H5') {
loadingFlag= layer.msg('加载中...', { icon: 16, shade: 0.01,shadeClose:false,time:60000 });
}
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: `${getApiUrl().urlJava}api/appActivity/PanicBuyingCoupon`, url: `${getApiUrl().urlJava}api/appActivity/PanicBuyingCoupon`,
contentType: "application/json", contentType: "application/json",
data: getJavaData({ redemptionPrice: options.price, couponId: options.couponId, productName: '印象之旅-200元无敌优惠券' }), data: getJavaData({ redemptionPrice: options.price, couponId: options.couponId, productName: '印象之旅-200元无敌优惠券' }),
async: false, async: false,
success: function(res) { success: function(res) {
if (options.platform == 'app') { if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'dismissHud' })); window.postMessage(JSON.stringify({ 'action': 'dismissHud' }));
}
if (options.platform == 'H5') {
layer.close(loadingFlag);
} }
if (res.resultCode === 1) { if (res.resultCode === 1) {
...@@ -300,8 +307,8 @@ $.fn.dataStatistics = function(options) { ...@@ -300,8 +307,8 @@ $.fn.dataStatistics = function(options) {
console.log(options.platform) console.log(options.platform)
if (options.platform == 'app') { if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'dismissHud' })); window.postMessage(JSON.stringify({ 'action': 'dismissHud' }));
} else { } else if(options.platform == 'H5'){
layer.close(loadingFlag);
} }
} }
}); });
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
let locationName = window.location.hostname; let locationName = window.location.hostname;
function getApiUrl() { function getApiUrl() {
let url = { let url = {
urlPost: locationName.indexOf('oytour') !== -1 ? "http://reborn.oytour.com/api/common/post" : "http://192.168.2.214:8082/api/common/post", urlPost: "http://reborn.oytour.com/api/common/post",
urlJava: locationName.indexOf('oytour') !== -1 ? "https://efficient.oytour.com/" : "http://192.168.2.215:9000/"
//urlPost: locationName.indexOf('oytour') !== -1 ? "http://reborn.oytour.com/api/common/post" : "http://192.168.2.214:8082/api/common/post",
//urlJava: locationName.indexOf('oytour') !== -1 ? "https://efficient.oytour.com/" : "http://192.168.2.215:9000/"
urlJava: "https://efficient.oytour.com/"
} }
return url return url
} }
...@@ -39,7 +42,7 @@ function getAjaxData(cmd, msg, tk) { ...@@ -39,7 +42,7 @@ function getAjaxData(cmd, msg, tk) {
let key = ""; let key = "";
if (getLocalStorage() != null) { if (getLocalStorage() != null) {
token = getLocalStorage().token; token = getLocalStorage().token;
key = getLocalStorage().SecretKey; key = getLocalStorage().secretKey;
} }
let encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase(); let encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
let md5Str = hex_md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`); let md5Str = hex_md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment