Commit 60cd3a48 authored by zhoujun's avatar zhoujun

Merge branch 'test'

parents c879429c 83faac0e
...@@ -4,56 +4,56 @@ var ccwl = { ...@@ -4,56 +4,56 @@ var ccwl = {
reg: { reg: {
phone: /^1(3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9])\d{8}$/ phone: /^1(3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9])\d{8}$/
}, },
idFlag:true, idFlag: true,
ajaxFlag:true, ajaxFlag: true,
relationRole:{} relationRole: {}
}; };
ccwl.ajax = function (data, callback,fileCallback) { ccwl.ajax = function (data, callback, fileCallback) {
data.data['_token'] = $('meta[name="token"]').attr("value"); data.data['_token'] = $('meta[name="token"]').attr("value");
// if(ccwl.ajaxFlag){ // if(ccwl.ajaxFlag){
$.ajax({ $.ajax({
type: data.type ? data.type : 'GET', type: data.type ? data.type : 'GET',
url: ccwl.http + data.url, url: ccwl.http + data.url,
dataType: "json", dataType: "json",
data: data.data, data: data.data,
error: function (err) { error: function (err) {
ccwl.ajaxFlag = false; ccwl.ajaxFlag = false;
try{ try {
var error = err.responseText; var error = err.responseText;
ccwl.showToast({ ccwl.showToast({
msg:error.message, msg: error.message,
type:'error' type: 'error'
}) })
}catch (e) { } catch (e) {
ccwl.showToast({ ccwl.showToast({
msg:'系统开小差~~', msg: '系统开小差~~',
type:'error' type: 'error'
}) })
} }
}, },
success: function (res) { success: function (res) {
ccwl.ajaxFlag = false; ccwl.ajaxFlag = false;
if (res.error === 0) { if (res.error === 0) {
callback(res); callback(res);
}else{ } else {
try{ try {
if(data.url==='/ald_bind_info' || data.url==='/user/bind_realname'){ if (data.url === '/ald_bind_info' || data.url === '/user/bind_realname') {
fileCallback(res);
return false;
}
ccwl.showToast({
msg: res.message
});
fileCallback(res); fileCallback(res);
}catch(e){ return false;
} }
ccwl.showToast({
msg: res.message
});
fileCallback(res);
} catch (e) {
} }
} }
}); }
});
// setTimeout(function(){ // setTimeout(function(){
// ccwl.ajaxFlag = true; // ccwl.ajaxFlag = true;
// },1000) // },1000)
...@@ -85,15 +85,15 @@ ccwl.formatSearch = function (search) { ...@@ -85,15 +85,15 @@ ccwl.formatSearch = function (search) {
var timer = null; var timer = null;
ccwl.showToast = function (params) { ccwl.showToast = function (params) {
$.Toast("", params.msg, params.type ? params.type :'warn' , { $.Toast("", params.msg, params.type ? params.type : 'warn', {
stack: true, stack: true,
has_icon:false, has_icon: false,
has_close_btn:false, has_close_btn: false,
fullscreen:false, fullscreen: false,
timeout:2000, timeout: 2000,
sticky:false, sticky: false,
has_progress:false, has_progress: false,
rtl:false, rtl: false,
}); });
} }
...@@ -109,7 +109,7 @@ ccwl.handleRegister = function (params) { ...@@ -109,7 +109,7 @@ ccwl.handleRegister = function (params) {
} }
// 发送验证码 // 发送验证码
ccwl.handleSendCode = function (params,dom) { ccwl.handleSendCode = function (params, dom) {
this.ajax({ this.ajax({
url: '/service/get_authcode', url: '/service/get_authcode',
type: 'POST', type: 'POST',
...@@ -121,7 +121,7 @@ ccwl.handleSendCode = function (params,dom) { ...@@ -121,7 +121,7 @@ ccwl.handleSendCode = function (params,dom) {
// 倒计时 // 倒计时
ccwl.handleCutDown = function (dom) { ccwl.handleCutDown = function (dom) {
var count = 60; var count = 60;
var countDown = setInterval(function (){ var countDown = setInterval(function () {
if (count === 0) { if (count === 0) {
$(dom).text('重新发送').removeAttr('disabled'); $(dom).text('重新发送').removeAttr('disabled');
$(dom).css({ $(dom).css({
...@@ -140,35 +140,35 @@ ccwl.handleCutDown = function (dom) { ...@@ -140,35 +140,35 @@ ccwl.handleCutDown = function (dom) {
} }
// 登录 // 登录
ccwl.handleLogin = function (params,type){ ccwl.handleLogin = function (params, type) {
this.ajax({ this.ajax({
url:type==="10001"?'/ald_login':'/login', url: type === "10001" ? '/ald_login' : '/login',
type:'POST', type: 'POST',
data:params data: params
},function (res){ }, function (res) {
location.href = res.data.next_url; location.href = res.data.next_url;
}) })
} }
// 找回密码 // 找回密码
ccwl.handleFindPassword = function (params){ ccwl.handleFindPassword = function (params) {
this.ajax({ this.ajax({
url:'/password/getback', url: '/password/getback',
type:'POST', type: 'POST',
data:params data: params
},function (res){ }, function (res) {
$('.dialog-confirm').fadeIn(); $('.dialog-confirm').fadeIn();
}) })
} }
// 修改密码 // 修改密码
ccwl.handleChangePassword = function (params,type){ ccwl.handleChangePassword = function (params, type) {
this.ajax({ this.ajax({
url:'/password/change', url: '/password/change',
type:'POST', type: 'POST',
data:params data: params
},function (res){ }, function (res) {
if(type==1){ if (type == 1) {
// 账户安全里修改密码成功 // 账户安全里修改密码成功
$('.update-success').fadeIn(); $('.update-success').fadeIn();
$('.update-form').hide(); $('.update-form').hide();
...@@ -179,148 +179,148 @@ ccwl.handleChangePassword = function (params,type){ ...@@ -179,148 +179,148 @@ ccwl.handleChangePassword = function (params,type){
} }
// 实名认证 // 实名认证
ccwl.handleAuthRealName = function (params){ ccwl.handleAuthRealName = function (params) {
this.ajax({ this.ajax({
url:'/service/real_name_auth', url: '/service/real_name_auth',
type:'POST', type: 'POST',
data:{ data: {
real_name:params.real_name, real_name: params.real_name,
id_card: params.id_card id_card: params.id_card
} }
},function (res){ }, function (res) {
ccwl.idFlag = true; ccwl.idFlag = true;
},function(){ }, function () {
ccwl.idFlag = false; ccwl.idFlag = false;
}) })
} }
// 绑定识别码 // 绑定识别码
ccwl.handleBindOrangeCode = function(params,type){ ccwl.handleBindOrangeCode = function (params, type) {
this.ajax({ this.ajax({
url:'/user/bind_aldzn', url: '/user/bind_aldzn',
type:'POST', type: 'POST',
data:params data: params
},function (res){ }, function (res) {
if(type==="ald"){ if (type === "ald") {
$('.dialog-confirm .toast-msg').text(res.message); $('.dialog-confirm .toast-msg').text(res.message);
$('.dialog-confirm .btn').attr('href','/'); $('.dialog-confirm .btn').attr('href', '/');
$('.dialog-confirm').fadeIn(); $('.dialog-confirm').fadeIn();
return false; return false;
}else{ } else {
ccwl.showToast({ ccwl.showToast({
msg: res.message, msg: res.message,
}) })
} }
},function(res){ }, function (res) {
var leaveTimes = $('.leave-times span').text(); var leaveTimes = $('.leave-times span').text();
$('.leave-times span').text(leaveTimes-1<0 ? 0 :leaveTimes-1); $('.leave-times span').text(leaveTimes - 1 < 0 ? 0 : leaveTimes - 1);
if(leaveTimes-1 <= 0){ if (leaveTimes - 1 <= 0) {
$('.dialog-orange').fadeOut(); $('.dialog-orange').fadeOut();
$('.bind-orange').remove(); $('.bind-orange').remove();
$('.icon-orange').append('<span class="error-msg">今日错误次数达上限</span>'); $('.icon-orange').append('<span class="error-msg">今日错误次数达上限</span>');
if(type==="ald"){ if (type === "ald") {
location.href="/wx/index" location.href = "/wx/index"
return false; return false;
} }
} }
if(res.error === 1020){ if (res.error === 1020) {
$('.leave-times span').text(res.data.left_times); $('.leave-times span').text(res.data.left_times);
if(res.data.left_times === 0){ if (res.data.left_times === 0) {
$("input[name='orangeCode'],.btn-bind-orange").attr('disabled',true); $("input[name='orangeCode'],.btn-bind-orange").attr('disabled', true);
} }
} }
}) })
} }
// 获取服务器和用户id // 获取服务器和用户id
ccwl.handleGetServer = function (receive){ ccwl.handleGetServer = function (receive) {
this.ajax({ this.ajax({
url:'/ald_bind_info', url: '/ald_bind_info',
type:'get', type: 'get',
data:{} data: {}
},function (res){ }, function (res) {
if(receive === "0"){ if (receive === "0") {
$('.confirm-container').show(); $('.confirm-container').show();
$('.confirm-container .message-content p').text('您暂未获得活动资格,请关注后续活动资讯'); $('.confirm-container .message-content p').text('您暂未获得活动资格,请关注后续活动资讯');
$('.confirm-container .message-content a').text('确定').addClass('close-click').attr('onclick',''); $('.confirm-container .message-content a').text('确定').addClass('close-click').attr('onclick', '');
return false; return false;
} }
var params = { var params = {
serverId:res.data.serverId, serverId: res.data.serverId,
userId:res.data.userId userId: res.data.userId
} }
ccwl.handleGetRoleList(params); ccwl.handleGetRoleList(params);
},function (res){ }, function (res) {
$('.confirm-container p').text(res.message); $('.confirm-container p').text(res.message);
$('.confirm-container').show(); $('.confirm-container').show();
}) })
} }
// 获取角色列表 // 获取角色列表
ccwl.handleGetRoleList = function (params){ ccwl.handleGetRoleList = function (params) {
this.ajax({ this.ajax({
url:'/get_role_list', url: '/get_role_list',
type:'POST', type: 'POST',
data:params data: params
},function (res){ }, function (res) {
var data = res.data, var data = res.data,
html = '', html = '',
sArr = []; sArr = [];
ccwl.relationRole = data; ccwl.relationRole = data;
for(var key in data){ for (var key in data) {
sArr.push({id:key,name:data[key].name}); sArr.push({id: key, name: data[key].name});
} }
$(sArr).each(function (index,item){ $(sArr).each(function (index, item) {
html+='<li data-value="'+item.id+'">'+item.name+'</li>'; html += '<li data-value="' + item.id + '">' + item.name + '</li>';
}) })
$('.server-select').html(html); $('.server-select').html(html);
$('.dialog-received-gift').fadeIn(); $('.dialog-received-gift').fadeIn();
},function(res){ }, function (res) {
}) })
} }
// 角色领取礼包 // 角色领取礼包
ccwl.handleGetRoleGift = function (params){ ccwl.handleGetRoleGift = function (params) {
this.ajax({ this.ajax({
url:'/send_role_gift', url: '/send_role_gift',
type:'POST', type: 'POST',
data:params data: params
},function (res){ }, function (res) {
$('.btn-receive-package').hide(); $('.btn-receive-package').hide();
$('.package-info').append('<a href="/ald_gift_detail" class="btn btn-small gift-detail">查看礼包</a>'); $('.package-info').append('<a href="/ald_gift_detail" class="btn btn-small gift-detail">查看礼包</a>');
$('.dialog-received-gift').fadeOut(); $('.dialog-received-gift').fadeOut();
ccwl.showToast({ ccwl.showToast({
msg: res.message, msg: res.message,
}) })
},function(res){ }, function (res) {
}) })
} }
// 初始化服务器列表 // 初始化服务器列表
var initRoleList = function (serverId){ var initRoleList = function (serverId) {
var roleList = ccwl.relationRole[serverId].list; var roleList = ccwl.relationRole[serverId].list;
var sHtml = ''; var sHtml = '';
$(roleList).each(function (index,item){ $(roleList).each(function (index, item) {
sHtml+='<li data-value="'+item.roleId+'">'+item.roleName+'</li>' sHtml += '<li data-value="' + item.roleId + '">' + item.roleName + '</li>'
}); });
$('.role-select').html(sHtml) $('.role-select').html(sHtml)
$('.role').text('请选择角色'); $('.role').text('请选择角色');
} }
// 跳转用户信息页面 // 跳转用户信息页面
function goUserInfo(){ function goUserInfo() {
var type = $('.btn-receive-package').attr('data-type'); var type = $('.btn-receive-package').attr('data-type');
if(type>0){ if (type > 0) {
localStorage.setItem('showOrange',true); localStorage.setItem('showOrange', true);
window.location.href = '/user/dashboard' window.location.href = '/user/dashboard'
} }
} }
function isWeChat(){ function isWeChat() {
//window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型 //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型
var ua = window.navigator.userAgent.toLowerCase(); var ua = window.navigator.userAgent.toLowerCase();
//通过正则表达式匹配ua中是否含有MicroMessenger字符串 //通过正则表达式匹配ua中是否含有MicroMessenger字符串
if(ua.match(/MicroMessenger/i) == 'micromessenger'){ if (ua.match(/MicroMessenger/i) == 'micromessenger') {
return true; return true;
}else{ } else {
return false; return false;
} }
} }
...@@ -340,24 +340,24 @@ $(function () { ...@@ -340,24 +340,24 @@ $(function () {
e.stopPropagation(); e.stopPropagation();
}); });
// 用户协议 // 用户协议
$('.protocol .checkbox').click(function (){ $('.protocol .checkbox').click(function () {
$(this).toggleClass('current'); $(this).toggleClass('current');
}) })
// //
$('.user-protocol').click(function(){ $('.user-protocol').click(function () {
$('.dialog-protocol').fadeIn(); $('.dialog-protocol').fadeIn();
$('.protocol-title').text('橙橙网络用户服务协议'); $('.protocol-title').text('橙橙网络用户服务协议');
$('.protocol-p').show(); $('.protocol-p').show();
$('.protocol-v').hide(); $('.protocol-v').hide();
}) })
$('.user-privacy').click(function(){ $('.user-privacy').click(function () {
$('.dialog-protocol').fadeIn(); $('.dialog-protocol').fadeIn();
$('.protocol-title').text('橙橙网络隐私保护政策'); $('.protocol-title').text('橙橙网络隐私保护政策');
$('.protocol-v').show(); $('.protocol-v').show();
$('.protocol-p').hide(); $('.protocol-p').hide();
}) })
// 校验身份证 // 校验身份证
$("input[name='idCard']").on('blur',function () { $("input[name='idCard']").on('blur', function () {
var realName = $("input[name='realName']").val(); var realName = $("input[name='realName']").val();
var idCard = $("input[name='idCard']").val(); var idCard = $("input[name='idCard']").val();
if (idCard && (idCard.length != 15 && idCard.length != 18)) { if (idCard && (idCard.length != 15 && idCard.length != 18)) {
...@@ -370,11 +370,11 @@ $(function () { ...@@ -370,11 +370,11 @@ $(function () {
real_name: realName, real_name: realName,
id_card: idCard id_card: idCard
} }
if(idCard && realName){ if (idCard && realName) {
ccwl.handleAuthRealName(params); ccwl.handleAuthRealName(params);
} }
}); });
$("input[name='realName']").blur(function(){ $("input[name='realName']").blur(function () {
var realName = $.trim($("input[name='realName']").val()); var realName = $.trim($("input[name='realName']").val());
var idCard = $.trim($("input[name='idCard']").val()); var idCard = $.trim($("input[name='idCard']").val());
if (idCard && (idCard.length != 15 && idCard.length != 18)) { if (idCard && (idCard.length != 15 && idCard.length != 18)) {
...@@ -387,7 +387,7 @@ $(function () { ...@@ -387,7 +387,7 @@ $(function () {
real_name: realName, real_name: realName,
id_card: idCard id_card: idCard
} }
if(idCard && realName){ if (idCard && realName) {
ccwl.handleAuthRealName(params); ccwl.handleAuthRealName(params);
} }
}); });
...@@ -426,7 +426,7 @@ $(function () { ...@@ -426,7 +426,7 @@ $(function () {
msg: '请再次输入密码', msg: '请再次输入密码',
}) })
return false; return false;
} else if (confirmPassword !== password) { } else if (confirmPassword !== password) {
ccwl.showToast({ ccwl.showToast({
msg: '请保持两次密码一致', msg: '请保持两次密码一致',
}) })
...@@ -436,32 +436,32 @@ $(function () { ...@@ -436,32 +436,32 @@ $(function () {
msg: '密码不可与用户名相同', msg: '密码不可与用户名相同',
}) })
return false; return false;
}else if ((password && password.length<6) || (password && password.length>30) ) { } else if ((password && password.length < 6) || (password && password.length > 30)) {
ccwl.showToast({ ccwl.showToast({
msg: '由6-30位字母、数字或字符组成', msg: '由6-30位字母、数字或字符组成',
}) })
return false; return false;
// } else if (!realName) { // } else if (!realName) {
// ccwl.showToast({ // ccwl.showToast({
// msg: '请输入真实姓名', // msg: '请输入真实姓名',
// }) // })
// return false; // return false;
// } else if (!idCard) { // } else if (!idCard) {
// ccwl.showToast({ // ccwl.showToast({
// msg: '请输入身份证号码', // msg: '请输入身份证号码',
// }) // })
// return false; // return false;
// } else if (idCard && (idCard.length != 15 && idCard.length != 18)) { // } else if (idCard && (idCard.length != 15 && idCard.length != 18)) {
// ccwl.showToast({ // ccwl.showToast({
// msg: '请输入正确的身份证号码', // msg: '请输入正确的身份证号码',
// }) // })
// return false; // return false;
// } else if (!ccwl.idFlag) { // } else if (!ccwl.idFlag) {
// ccwl.showToast({ // ccwl.showToast({
// msg: '请检查身份证号和姓名是否输入正确', // msg: '请检查身份证号和姓名是否输入正确',
// }) // })
// return false; // return false;
}else if (!checked) { } else if (!checked) {
ccwl.showToast({ ccwl.showToast({
msg: '请勾选平台协议', msg: '请勾选平台协议',
}) })
...@@ -494,38 +494,38 @@ $(function () { ...@@ -494,38 +494,38 @@ $(function () {
var params = { var params = {
phone: phone phone: phone
} }
ccwl.handleSendCode(params,this); ccwl.handleSendCode(params, this);
}); });
// 点击登录 // 点击登录
$('.btn-login').click(function (){ $('.btn-login').click(function () {
var type = $(this).attr('data-type'); var type = $(this).attr('data-type');
var account = $("input[name='account']").val(); var account = $("input[name='account']").val();
var password = $.trim($("input[name='password']").val()); var password = $.trim($("input[name='password']").val());
var checked = $('.protocol .checkbox').hasClass('current'); var checked = $('.protocol .checkbox').hasClass('current');
if(!account){ if (!account) {
ccwl.showToast({ ccwl.showToast({
msg:'请输入账号' msg: '请输入账号'
}) })
return false; return false;
}else if(!password){ } else if (!password) {
ccwl.showToast({ ccwl.showToast({
msg:'请输入密码' msg: '请输入密码'
}); });
return false; return false;
}else if (!checked && type) { } else if (!checked && type) {
ccwl.showToast({ ccwl.showToast({
msg: '请勾选平台协议', msg: '请勾选平台协议',
}) })
return false; return false;
} }
var params = { var params = {
account:account, account: account,
password:password password: password
} }
ccwl.handleLogin(params,type); ccwl.handleLogin(params, type);
}); });
// 点击找回密码 // 点击找回密码
$('.btn-findPassword').click(function (){ $('.btn-findPassword').click(function () {
var phone = $.trim($("input[name='phone']").val()); var phone = $.trim($("input[name='phone']").val());
var code = $("input[name='code']").val(); var code = $("input[name='code']").val();
var password = $.trim($("input[name='password']").val()); var password = $.trim($("input[name='password']").val());
...@@ -561,12 +561,12 @@ $(function () { ...@@ -561,12 +561,12 @@ $(function () {
msg: '密码不可与用户名相同', msg: '密码不可与用户名相同',
}) })
return false; return false;
}else if (confirmPassword !== password) { } else if (confirmPassword !== password) {
ccwl.showToast({ ccwl.showToast({
msg: '请保持两次密码一致', msg: '请保持两次密码一致',
}) })
return false; return false;
} else if ((confirmPassword && confirmPassword.length<6) || (confirmPassword && confirmPassword.length>30) ) { } else if ((confirmPassword && confirmPassword.length < 6) || (confirmPassword && confirmPassword.length > 30)) {
ccwl.showToast({ ccwl.showToast({
msg: '由6-30位字母、数字或字符组成', msg: '由6-30位字母、数字或字符组成',
}) })
...@@ -574,27 +574,27 @@ $(function () { ...@@ -574,27 +574,27 @@ $(function () {
} }
var params = { var params = {
phone: phone, phone: phone,
new_password : password, new_password: password,
auth_code: code auth_code: code
} }
ccwl.handleFindPassword(params) ccwl.handleFindPassword(params)
}); });
$('.change-password a,.show-change-password').click(function (){ $('.change-password a,.show-change-password').click(function () {
$('.resize-password').fadeIn(); $('.resize-password').fadeIn();
$('.container-mb').addClass('fixed'); $('.container-mb').addClass('fixed');
}); });
$(document).on('click','.close,.close-click,.btn-close',function (){ $(document).on('click', '.close,.close-click,.btn-close', function () {
var type = $(this).attr('data-type'); var type = $(this).attr('data-type');
$('.toast-item-wrapper').remove(); $('.toast-item-wrapper').remove();
$(this).parents('.dialog').fadeOut(); $(this).parents('.dialog').fadeOut();
$('.container-mb').removeClass('fixed'); $('.container-mb').removeClass('fixed');
if(type !=1){ if (type != 1) {
$('.form-container input').val(''); $('.form-container input').val('');
} }
}); });
// 点击修改密码 // 点击修改密码
$('.btn-changePassword').click(function (){ $('.btn-changePassword').click(function () {
var type = $(this).attr('data-type'); var type = $(this).attr('data-type');
var nowPassword = $.trim($("input[name='nowPassword']").val()); var nowPassword = $.trim($("input[name='nowPassword']").val());
var newPassword = $.trim($("input[name='newPassword']").val()); var newPassword = $.trim($("input[name='newPassword']").val());
...@@ -619,26 +619,27 @@ $(function () { ...@@ -619,26 +619,27 @@ $(function () {
msg: '请保持两次新密码一致', msg: '请保持两次新密码一致',
}) })
return false; return false;
} else if ((confirmNewPassword && confirmNewPassword.length<6) || (confirmNewPassword && confirmNewPassword.length>30) ) { } else if ((confirmNewPassword && confirmNewPassword.length < 6) || (confirmNewPassword && confirmNewPassword.length > 30)) {
ccwl.showToast({ ccwl.showToast({
msg: '由6-30位字母、数字或字符组成', msg: '由6-30位字母、数字或字符组成',
}) })
return false; return false;
} }
var params = { var params = {
password : nowPassword, password: nowPassword,
new_password : newPassword, new_password: newPassword,
} }
ccwl.handleChangePassword(params,type); ccwl.handleChangePassword(params, type);
}); });
$('.back').click(function(){ $('.back').click(function () {
window.history.go(-1); window.history.go(-1);
}); });
$('.bind-orange').click(function(){ $('.bind-orange').click(function () {
$('.dialog-orange').fadeIn(); $('.dialog-orange').fadeIn();
}); });
// 点击绑定识别码 // 点击绑定识别码
$('.btn-bind-orange').click(function(){ var bindFlag = true;
$('.btn-bind-orange').click(function () {
var orangeCode = $("input[name='orangeCode']").val(); var orangeCode = $("input[name='orangeCode']").val();
var leftTimes = $('.leave-times span').text(); var leftTimes = $('.leave-times span').text();
var type = $(this).attr('data-type'); var type = $(this).attr('data-type');
...@@ -647,7 +648,7 @@ $(function () { ...@@ -647,7 +648,7 @@ $(function () {
msg: '请输入识别码', msg: '请输入识别码',
}) })
return false; return false;
}else if(leftTimes*1 <=0 ){ } else if (leftTimes * 1 <= 0) {
ccwl.showToast({ ccwl.showToast({
msg: '今日错误次数达上限', msg: '今日错误次数达上限',
}) })
...@@ -656,84 +657,91 @@ $(function () { ...@@ -656,84 +657,91 @@ $(function () {
var params = { var params = {
bind_code: orangeCode bind_code: orangeCode
} }
ccwl.handleBindOrangeCode(params,type); if (bindFlag) {
bindFlag = false;
ccwl.handleBindOrangeCode(params, type);
setTimeout(function () {
bindFlag = true
}, 3000)
}
}); });
$('.btn-confirm').click(function(){ $('.btn-confirm').click(function () {
$(this).parents('.dialog').fadeOut(); $(this).parents('.dialog').fadeOut();
location.href='/login'; location.href = '/login';
}); });
$('.expect').click(function(){ $('.expect').click(function () {
ccwl.showToast({ ccwl.showToast({
msg:'暂未开放,敬请期待' msg: '暂未开放,敬请期待'
}) })
}); });
$('.btn-receive-package').click(function (){ $('.btn-receive-package').click(function () {
var type = $(this).attr('data-type'); var type = $(this).attr('data-type');
var receive = $(this).attr('data-receive'); var receive = $(this).attr('data-receive');
if(type==="0"){ if (type === "0") {
$('.confirm-container').show(); $('.confirm-container').show();
$('.confirm-container .message-content p').text('今日Orange识别码输入错误次数已达上限'); $('.confirm-container .message-content p').text('今日Orange识别码输入错误次数已达上限');
$('.confirm-container .message-content a').text('确定').addClass('close-click').attr('onclick','localStorage.removeItem(\'showOrange\');'); $('.confirm-container .message-content a').text('确定').addClass('close-click').attr('onclick', 'localStorage.removeItem(\'showOrange\');');
return false; return false;
} }
ccwl.handleGetServer(receive); ccwl.handleGetServer(receive);
}); });
$('.btn-receive').click(function (){ $('.btn-receive').click(function () {
var serverId = $('.server-select li.current').attr('data-value'), var serverId = $('.server-select li.current').attr('data-value'),
roleId = $('.role-select li.current').attr('data-value'); roleId = $('.role-select li.current').attr('data-value');
if(!serverId || serverId == ''){ if (!serverId || serverId == '') {
ccwl.showToast({msg:'请选择服务器'}); ccwl.showToast({msg: '请选择服务器'});
return false; return false;
}else if(!roleId || roleId == ''){ } else if (!roleId || roleId == '') {
ccwl.showToast({msg:'请选择角色'}); ccwl.showToast({msg: '请选择角色'});
return false; return false;
} }
var params = { var params = {
serverId:serverId, serverId: serverId,
roleId:roleId roleId: roleId
} }
ccwl.handleGetRoleGift(params); ccwl.handleGetRoleGift(params);
}); });
$('.gift-span span').click(function (){ $('.gift-span span').click(function () {
$(this).addClass('current').siblings().removeClass('current'); $(this).addClass('current').siblings().removeClass('current');
var index = $(this).index(); var index = $(this).index();
$('.tab-content p').hide(); $('.tab-content p').hide();
$('.tab-content p').eq(index).show().siblings().hide(); $('.tab-content p').eq(index).show().siblings().hide();
}); });
$('.toggle-down').click(function (){ $('.toggle-down').click(function () {
$('.gift-explain-container').fadeIn(); $('.gift-explain-container').fadeIn();
}) })
$('.select span').click(function () { $('.select span').click(function () {
$('.select-option').hide(); $('.select-option').hide();
if($(this).hasClass('current')){ if ($(this).hasClass('current')) {
$('.select span').removeClass('current'); $('.select span').removeClass('current');
$(this).siblings('.select-option').stop().slideUp(100); $(this).siblings('.select-option').stop().slideUp(100);
}else{ } else {
$('.select span').removeClass('current'); $('.select span').removeClass('current');
$(this).addClass('current'); $(this).addClass('current');
$(this).siblings('.select-option').stop().slideDown(100); $(this).siblings('.select-option').stop().slideDown(100);
} }
}); });
$(document).on('click','.select-option li',function (){ $(document).on('click', '.select-option li', function () {
var text = $(this).text(); var text = $(this).text();
$(this).addClass('current').siblings().removeClass('current'); $(this).addClass('current').siblings().removeClass('current');
$(this).parents('.select').find('span').text(text); $(this).parents('.select').find('span').text(text);
$(this).parents('.select').find('span').removeClass('current'); $(this).parents('.select').find('span').removeClass('current');
$(this).parents('.select').find('.select-option').stop().slideUp(100); $(this).parents('.select').find('.select-option').stop().slideUp(100);
}); });
$(document).on('click','.server-select li',function (){ $(document).on('click', '.server-select li', function () {
var serverId = $(this).attr('data-value'); var serverId = $(this).attr('data-value');
initRoleList(serverId); initRoleList(serverId);
}); });
$("input[name='password']").keyup(function (e){ $("input[name='password']").keyup(function (e) {
var keyCode = e.keyCode; var keyCode = e.keyCode;
if(keyCode === 13){ if (keyCode === 13) {
$('.btn-login').trigger('click'); $('.btn-login').trigger('click');
} }
}); });
$("input[name='confirmNewPassword']").keyup(function (e){ $("input[name='confirmNewPassword']").keyup(function (e) {
var keyCode = e.keyCode; var keyCode = e.keyCode;
if(keyCode === 13){ if (keyCode === 13) {
$('.btn-changePassword').trigger('click'); $('.btn-changePassword').trigger('click');
} }
}); });
......
function goUserInfo(){$(".btn-receive-package").attr("data-type")>0&&(localStorage.setItem("showOrange",!0),window.location.href="/user/dashboard")}function isWeChat(){return"micromessenger"==window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)}var ccwl={http:location.origin,reg:{phone:/^1(3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9])\d{8}$/},idFlag:!0,ajaxFlag:!0,relationRole:{}};ccwl.ajax=function(t,e,a){t.data._token=$('meta[name="token"]').attr("value"),$.ajax({type:t.type?t.type:"GET",url:ccwl.http+t.url,dataType:"json",data:t.data,error:function(t){ccwl.ajaxFlag=!1;try{var e=t.responseText;ccwl.showToast({msg:e.message,type:"error"})}catch(t){ccwl.showToast({msg:"系统开小差~~",type:"error"})}},success:function(n){if(ccwl.ajaxFlag=!1,0===n.error)e(n);else try{if("/ald_bind_info"===t.url||"/user/bind_realname"===t.url)return a(n),!1;ccwl.showToast({msg:n.message}),a(n)}catch(t){}}})},ccwl.formatSearch=function(t){if(void 0!==(t=location.search)){var e=(t=t.substr(1)).split("&"),a={},n=[];return $.each(e,function(t,e){n=e.split("="),void 0===a[n[0]]&&(a[n[0]]=n[1])}),location.search?a:""}};var timer=null;ccwl.showToast=function(t){$.Toast("",t.msg,t.type?t.type:"warn",{stack:!0,has_icon:!1,has_close_btn:!1,fullscreen:!1,timeout:2e3,sticky:!1,has_progress:!1,rtl:!1})},ccwl.handleRegister=function(t){this.ajax({url:"/register",type:"POST",data:t},function(t){location.href=t.data.next_url})},ccwl.handleSendCode=function(t,e){this.ajax({url:"/service/get_authcode",type:"POST",data:t},function(t){ccwl.handleCutDown(e)})},ccwl.handleCutDown=function(t){var e=60,a=setInterval(function(){0===e?($(t).text("重新发送").removeAttr("disabled"),$(t).css({color:"#0099ff"}),clearInterval(a)):($(t).attr("disabled",!0),$(t).css({color:"#ababab"}),$(t).text(e+"S后重新获取")),e--},1e3)},ccwl.handleLogin=function(t,e){this.ajax({url:"10001"===e?"/ald_login":"/login",type:"POST",data:t},function(t){location.href=t.data.next_url})},ccwl.handleFindPassword=function(t){this.ajax({url:"/password/getback",type:"POST",data:t},function(t){$(".dialog-confirm").fadeIn()})},ccwl.handleChangePassword=function(t,e){this.ajax({url:"/password/change",type:"POST",data:t},function(t){1==e&&($(".update-success").fadeIn(),$(".update-form").hide()),$(".dialog.resize-password").fadeOut(),$(".dialog-confirm").fadeIn()})},ccwl.handleAuthRealName=function(t){this.ajax({url:"/service/real_name_auth",type:"POST",data:{real_name:t.real_name,id_card:t.id_card}},function(t){ccwl.idFlag=!0},function(){ccwl.idFlag=!1})},ccwl.handleBindOrangeCode=function(t,e){this.ajax({url:"/user/bind_aldzn",type:"POST",data:t},function(t){if("ald"===e)return $(".dialog-confirm .toast-msg").text(t.message),$(".dialog-confirm .btn").attr("href","/"),$(".dialog-confirm").fadeIn(),!1;ccwl.showToast({msg:t.message})},function(t){var a=$(".leave-times span").text();if($(".leave-times span").text(a-1<0?0:a-1),a-1<=0&&($(".dialog-orange").fadeOut(),$(".bind-orange").remove(),$(".icon-orange").append('<span class="error-msg">今日错误次数达上限</span>'),"ald"===e))return location.href="/wx/index",!1;1020===t.error&&($(".leave-times span").text(t.data.left_times),0===t.data.left_times&&$("input[name='orangeCode'],.btn-bind-orange").attr("disabled",!0))})},ccwl.handleGetServer=function(t){this.ajax({url:"/ald_bind_info",type:"get",data:{}},function(e){if("0"===t)return $(".confirm-container").show(),$(".confirm-container .message-content p").text("您暂未获得活动资格,请关注后续活动资讯"),$(".confirm-container .message-content a").text("确定").addClass("close-click").attr("onclick",""),!1;var a={serverId:e.data.serverId,userId:e.data.userId};ccwl.handleGetRoleList(a)},function(t){$(".confirm-container p").text(t.message),$(".confirm-container").show()})},ccwl.handleGetRoleList=function(t){this.ajax({url:"/get_role_list",type:"POST",data:t},function(t){var e=t.data,a="",n=[];ccwl.relationRole=e;for(var c in e)n.push({id:c,name:e[c].name});$(n).each(function(t,e){a+='<li data-value="'+e.id+'">'+e.name+"</li>"}),$(".server-select").html(a),$(".dialog-received-gift").fadeIn()},function(t){})},ccwl.handleGetRoleGift=function(t){this.ajax({url:"/send_role_gift",type:"POST",data:t},function(t){$(".btn-receive-package").hide(),$(".package-info").append('<a href="/ald_gift_detail" class="btn btn-small gift-detail">查看礼包</a>'),$(".dialog-received-gift").fadeOut(),ccwl.showToast({msg:t.message})},function(t){})};var initRoleList=function(t){var e=ccwl.relationRole[t].list,a="";$(e).each(function(t,e){a+='<li data-value="'+e.roleId+'">'+e.roleName+"</li>"}),$(".role-select").html(a),$(".role").text("请选择角色")};$(function(){$(".container-mb .menu").click(function(){$(".left-container").addClass("current"),$(".container").addClass("fixed")}),$(".container-mb .left-container").click(function(){$(this).removeClass("current"),$(".container").removeClass("fixed")}),$(".left-menu").click(function(t){(t=t||window.event).stopPropagation()}),$(".protocol .checkbox").click(function(){$(this).toggleClass("current")}),$(".user-protocol").click(function(){$(".dialog-protocol").fadeIn(),$(".protocol-title").text("橙橙网络用户服务协议"),$(".protocol-p").show(),$(".protocol-v").hide()}),$(".user-privacy").click(function(){$(".dialog-protocol").fadeIn(),$(".protocol-title").text("橙橙网络隐私保护政策"),$(".protocol-v").show(),$(".protocol-p").hide()}),$("input[name='idCard']").on("blur",function(){var t=$("input[name='realName']").val(),e=$("input[name='idCard']").val();if(e&&15!=e.length&&18!=e.length)return ccwl.showToast({msg:"请输入正确的身份证号码"}),!1;var a={real_name:t,id_card:e};e&&t&&ccwl.handleAuthRealName(a)}),$("input[name='realName']").blur(function(){var t=$.trim($("input[name='realName']").val()),e=$.trim($("input[name='idCard']").val());if(e&&15!=e.length&&18!=e.length)return ccwl.showToast({msg:"请输入正确的身份证号码"}),!1;var a={real_name:t,id_card:e};e&&t&&ccwl.handleAuthRealName(a)}),$(".btn-register").click(function(){var t=$.trim($("input[name='phone']").val()),e=$("input[name='code']").val(),a=$.trim($("input[name='password']").val()),n=$.trim($("input[name='confirmPassword']").val()),c=$(".protocol .checkbox").hasClass("current"),o=ccwl.reg.phone;if(!t)return ccwl.showToast({msg:"请输入手机号码"}),!1;if(t&&!o.test(t))return ccwl.showToast({msg:"请输入正确的手机号码"}),!1;if(!e)return ccwl.showToast({msg:"请输入验证码"}),!1;if(!a)return ccwl.showToast({msg:"请输入密码"}),!1;if(!n)return ccwl.showToast({msg:"请再次输入密码"}),!1;if(n!==a)return ccwl.showToast({msg:"请保持两次密码一致"}),!1;if(a&&t&&a===t)return ccwl.showToast({msg:"密码不可与用户名相同"}),!1;if(a&&a.length<6||a&&a.length>30)return ccwl.showToast({msg:"由6-30位字母、数字或字符组成"}),!1;if(!c)return ccwl.showToast({msg:"请勾选平台协议"}),!1;var r={phone:t,password:a,auth_code:e};ccwl.handleRegister(r)}),$(".send-code").click(function(){var t=$.trim($(this).parents(".form-container").find("input[name='phone']").val()),e=ccwl.reg.phone;if(!t)return ccwl.showToast({msg:"请输入手机号码"}),!1;if(t&&!e.test(t))return ccwl.showToast({msg:"请输入正确的手机号码"}),!1;var a={phone:t};ccwl.handleSendCode(a,this)}),$(".btn-login").click(function(){var t=$(this).attr("data-type"),e=$("input[name='account']").val(),a=$.trim($("input[name='password']").val()),n=$(".protocol .checkbox").hasClass("current");if(!e)return ccwl.showToast({msg:"请输入账号"}),!1;if(!a)return ccwl.showToast({msg:"请输入密码"}),!1;if(!n&&t)return ccwl.showToast({msg:"请勾选平台协议"}),!1;var c={account:e,password:a};ccwl.handleLogin(c,t)}),$(".btn-findPassword").click(function(){var t=$.trim($("input[name='phone']").val()),e=$("input[name='code']").val(),a=$.trim($("input[name='password']").val()),n=$.trim($("input[name='confirmPassword']").val()),c=ccwl.reg.phone;if(!t)return ccwl.showToast({msg:"请输入手机号码"}),!1;if(t&&!c.test(t))return ccwl.showToast({msg:"请输入正确的手机号码"}),!1;if(!e)return ccwl.showToast({msg:"请输入验证码"}),!1;if(!a)return ccwl.showToast({msg:"请输入密码"}),!1;if(!n)return ccwl.showToast({msg:"请再次输入密码"}),!1;if(a&&t&&a===t)return ccwl.showToast({msg:"密码不可与用户名相同"}),!1;if(n!==a)return ccwl.showToast({msg:"请保持两次密码一致"}),!1;if(n&&n.length<6||n&&n.length>30)return ccwl.showToast({msg:"由6-30位字母、数字或字符组成"}),!1;var o={phone:t,new_password:a,auth_code:e};ccwl.handleFindPassword(o)}),$(".change-password a,.show-change-password").click(function(){$(".resize-password").fadeIn(),$(".container-mb").addClass("fixed")}),$(document).on("click",".close,.close-click,.btn-close",function(){var t=$(this).attr("data-type");$(".toast-item-wrapper").remove(),$(this).parents(".dialog").fadeOut(),$(".container-mb").removeClass("fixed"),1!=t&&$(".form-container input").val("")}),$(".btn-changePassword").click(function(){var t=$(this).attr("data-type"),e=$.trim($("input[name='nowPassword']").val()),a=$.trim($("input[name='newPassword']").val()),n=$.trim($("input[name='confirmNewPassword']").val());if(!e)return ccwl.showToast({msg:"请输入当前密码"}),!1;if(!a)return ccwl.showToast({msg:"请输入新密码"}),!1;if(!n)return ccwl.showToast({msg:"请再次输入新密码"}),!1;if(a!==n)return ccwl.showToast({msg:"请保持两次新密码一致"}),!1;if(n&&n.length<6||n&&n.length>30)return ccwl.showToast({msg:"由6-30位字母、数字或字符组成"}),!1;var c={password:e,new_password:a};ccwl.handleChangePassword(c,t)}),$(".back").click(function(){window.history.go(-1)}),$(".bind-orange").click(function(){$(".dialog-orange").fadeIn()}),$(".btn-bind-orange").click(function(){var t=$("input[name='orangeCode']").val(),e=$(".leave-times span").text(),a=$(this).attr("data-type");if(!t)return ccwl.showToast({msg:"请输入识别码"}),!1;if(1*e<=0)return ccwl.showToast({msg:"今日错误次数达上限"}),!1;var n={bind_code:t};ccwl.handleBindOrangeCode(n,a)}),$(".btn-confirm").click(function(){$(this).parents(".dialog").fadeOut(),location.href="/login"}),$(".expect").click(function(){ccwl.showToast({msg:"暂未开放,敬请期待"})}),$(".btn-receive-package").click(function(){var t=$(this).attr("data-type"),e=$(this).attr("data-receive");if("0"===t)return $(".confirm-container").show(),$(".confirm-container .message-content p").text("今日Orange识别码输入错误次数已达上限"),$(".confirm-container .message-content a").text("确定").addClass("close-click").attr("onclick","localStorage.removeItem('showOrange');"),!1;ccwl.handleGetServer(e)}),$(".btn-receive").click(function(){var t=$(".server-select li.current").attr("data-value"),e=$(".role-select li.current").attr("data-value");if(!t||""==t)return ccwl.showToast({msg:"请选择服务器"}),!1;if(!e||""==e)return ccwl.showToast({msg:"请选择角色"}),!1;var a={serverId:t,roleId:e};ccwl.handleGetRoleGift(a)}),$(".gift-span span").click(function(){$(this).addClass("current").siblings().removeClass("current");var t=$(this).index();$(".tab-content p").hide(),$(".tab-content p").eq(t).show().siblings().hide()}),$(".toggle-down").click(function(){$(".gift-explain-container").fadeIn()}),$(".select span").click(function(){$(".select-option").hide(),$(this).hasClass("current")?($(".select span").removeClass("current"),$(this).siblings(".select-option").stop().slideUp(100)):($(".select span").removeClass("current"),$(this).addClass("current"),$(this).siblings(".select-option").stop().slideDown(100))}),$(document).on("click",".select-option li",function(){var t=$(this).text();$(this).addClass("current").siblings().removeClass("current"),$(this).parents(".select").find("span").text(t),$(this).parents(".select").find("span").removeClass("current"),$(this).parents(".select").find(".select-option").stop().slideUp(100)}),$(document).on("click",".server-select li",function(){var t=$(this).attr("data-value");initRoleList(t)}),$("input[name='password']").keyup(function(t){13===t.keyCode&&$(".btn-login").trigger("click")}),$("input[name='confirmNewPassword']").keyup(function(t){13===t.keyCode&&$(".btn-changePassword").trigger("click")})}); function goUserInfo(){$(".btn-receive-package").attr("data-type")>0&&(localStorage.setItem("showOrange",!0),window.location.href="/user/dashboard")}function isWeChat(){return"micromessenger"==window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)}var ccwl={http:location.origin,reg:{phone:/^1(3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9])\d{8}$/},idFlag:!0,ajaxFlag:!0,relationRole:{}};ccwl.ajax=function(t,e,a){t.data._token=$('meta[name="token"]').attr("value"),$.ajax({type:t.type?t.type:"GET",url:ccwl.http+t.url,dataType:"json",data:t.data,error:function(t){ccwl.ajaxFlag=!1;try{var e=t.responseText;ccwl.showToast({msg:e.message,type:"error"})}catch(t){ccwl.showToast({msg:"系统开小差~~",type:"error"})}},success:function(n){if(ccwl.ajaxFlag=!1,0===n.error)e(n);else try{if("/ald_bind_info"===t.url||"/user/bind_realname"===t.url)return a(n),!1;ccwl.showToast({msg:n.message}),a(n)}catch(t){}}})},ccwl.formatSearch=function(t){if(void 0!==(t=location.search)){var e=(t=t.substr(1)).split("&"),a={},n=[];return $.each(e,function(t,e){n=e.split("="),void 0===a[n[0]]&&(a[n[0]]=n[1])}),location.search?a:""}};var timer=null;ccwl.showToast=function(t){$.Toast("",t.msg,t.type?t.type:"warn",{stack:!0,has_icon:!1,has_close_btn:!1,fullscreen:!1,timeout:2e3,sticky:!1,has_progress:!1,rtl:!1})},ccwl.handleRegister=function(t){this.ajax({url:"/register",type:"POST",data:t},function(t){location.href=t.data.next_url})},ccwl.handleSendCode=function(t,e){this.ajax({url:"/service/get_authcode",type:"POST",data:t},function(t){ccwl.handleCutDown(e)})},ccwl.handleCutDown=function(t){var e=60,a=setInterval(function(){0===e?($(t).text("重新发送").removeAttr("disabled"),$(t).css({color:"#0099ff"}),clearInterval(a)):($(t).attr("disabled",!0),$(t).css({color:"#ababab"}),$(t).text(e+"S后重新获取")),e--},1e3)},ccwl.handleLogin=function(t,e){this.ajax({url:"10001"===e?"/ald_login":"/login",type:"POST",data:t},function(t){location.href=t.data.next_url})},ccwl.handleFindPassword=function(t){this.ajax({url:"/password/getback",type:"POST",data:t},function(t){$(".dialog-confirm").fadeIn()})},ccwl.handleChangePassword=function(t,e){this.ajax({url:"/password/change",type:"POST",data:t},function(t){1==e&&($(".update-success").fadeIn(),$(".update-form").hide()),$(".dialog.resize-password").fadeOut(),$(".dialog-confirm").fadeIn()})},ccwl.handleAuthRealName=function(t){this.ajax({url:"/service/real_name_auth",type:"POST",data:{real_name:t.real_name,id_card:t.id_card}},function(t){ccwl.idFlag=!0},function(){ccwl.idFlag=!1})},ccwl.handleBindOrangeCode=function(t,e){this.ajax({url:"/user/bind_aldzn",type:"POST",data:t},function(t){if("ald"===e)return $(".dialog-confirm .toast-msg").text(t.message),$(".dialog-confirm .btn").attr("href","/"),$(".dialog-confirm").fadeIn(),!1;ccwl.showToast({msg:t.message})},function(t){var a=$(".leave-times span").text();if($(".leave-times span").text(a-1<0?0:a-1),a-1<=0&&($(".dialog-orange").fadeOut(),$(".bind-orange").remove(),$(".icon-orange").append('<span class="error-msg">今日错误次数达上限</span>'),"ald"===e))return location.href="/wx/index",!1;1020===t.error&&($(".leave-times span").text(t.data.left_times),0===t.data.left_times&&$("input[name='orangeCode'],.btn-bind-orange").attr("disabled",!0))})},ccwl.handleGetServer=function(t){this.ajax({url:"/ald_bind_info",type:"get",data:{}},function(e){if("0"===t)return $(".confirm-container").show(),$(".confirm-container .message-content p").text("您暂未获得活动资格,请关注后续活动资讯"),$(".confirm-container .message-content a").text("确定").addClass("close-click").attr("onclick",""),!1;var a={serverId:e.data.serverId,userId:e.data.userId};ccwl.handleGetRoleList(a)},function(t){$(".confirm-container p").text(t.message),$(".confirm-container").show()})},ccwl.handleGetRoleList=function(t){this.ajax({url:"/get_role_list",type:"POST",data:t},function(t){var e=t.data,a="",n=[];ccwl.relationRole=e;for(var c in e)n.push({id:c,name:e[c].name});$(n).each(function(t,e){a+='<li data-value="'+e.id+'">'+e.name+"</li>"}),$(".server-select").html(a),$(".dialog-received-gift").fadeIn()},function(t){})},ccwl.handleGetRoleGift=function(t){this.ajax({url:"/send_role_gift",type:"POST",data:t},function(t){$(".btn-receive-package").hide(),$(".package-info").append('<a href="/ald_gift_detail" class="btn btn-small gift-detail">查看礼包</a>'),$(".dialog-received-gift").fadeOut(),ccwl.showToast({msg:t.message})},function(t){})};var initRoleList=function(t){var e=ccwl.relationRole[t].list,a="";$(e).each(function(t,e){a+='<li data-value="'+e.roleId+'">'+e.roleName+"</li>"}),$(".role-select").html(a),$(".role").text("请选择角色")};$(function(){$(".container-mb .menu").click(function(){$(".left-container").addClass("current"),$(".container").addClass("fixed")}),$(".container-mb .left-container").click(function(){$(this).removeClass("current"),$(".container").removeClass("fixed")}),$(".left-menu").click(function(t){(t=t||window.event).stopPropagation()}),$(".protocol .checkbox").click(function(){$(this).toggleClass("current")}),$(".user-protocol").click(function(){$(".dialog-protocol").fadeIn(),$(".protocol-title").text("橙橙网络用户服务协议"),$(".protocol-p").show(),$(".protocol-v").hide()}),$(".user-privacy").click(function(){$(".dialog-protocol").fadeIn(),$(".protocol-title").text("橙橙网络隐私保护政策"),$(".protocol-v").show(),$(".protocol-p").hide()}),$("input[name='idCard']").on("blur",function(){var t=$("input[name='realName']").val(),e=$("input[name='idCard']").val();if(e&&15!=e.length&&18!=e.length)return ccwl.showToast({msg:"请输入正确的身份证号码"}),!1;var a={real_name:t,id_card:e};e&&t&&ccwl.handleAuthRealName(a)}),$("input[name='realName']").blur(function(){var t=$.trim($("input[name='realName']").val()),e=$.trim($("input[name='idCard']").val());if(e&&15!=e.length&&18!=e.length)return ccwl.showToast({msg:"请输入正确的身份证号码"}),!1;var a={real_name:t,id_card:e};e&&t&&ccwl.handleAuthRealName(a)}),$(".btn-register").click(function(){var t=$.trim($("input[name='phone']").val()),e=$("input[name='code']").val(),a=$.trim($("input[name='password']").val()),n=$.trim($("input[name='confirmPassword']").val()),c=$(".protocol .checkbox").hasClass("current"),o=ccwl.reg.phone;if(!t)return ccwl.showToast({msg:"请输入手机号码"}),!1;if(t&&!o.test(t))return ccwl.showToast({msg:"请输入正确的手机号码"}),!1;if(!e)return ccwl.showToast({msg:"请输入验证码"}),!1;if(!a)return ccwl.showToast({msg:"请输入密码"}),!1;if(!n)return ccwl.showToast({msg:"请再次输入密码"}),!1;if(n!==a)return ccwl.showToast({msg:"请保持两次密码一致"}),!1;if(a&&t&&a===t)return ccwl.showToast({msg:"密码不可与用户名相同"}),!1;if(a&&a.length<6||a&&a.length>30)return ccwl.showToast({msg:"由6-30位字母、数字或字符组成"}),!1;if(!c)return ccwl.showToast({msg:"请勾选平台协议"}),!1;var r={phone:t,password:a,auth_code:e};ccwl.handleRegister(r)}),$(".send-code").click(function(){var t=$.trim($(this).parents(".form-container").find("input[name='phone']").val()),e=ccwl.reg.phone;if(!t)return ccwl.showToast({msg:"请输入手机号码"}),!1;if(t&&!e.test(t))return ccwl.showToast({msg:"请输入正确的手机号码"}),!1;var a={phone:t};ccwl.handleSendCode(a,this)}),$(".btn-login").click(function(){var t=$(this).attr("data-type"),e=$("input[name='account']").val(),a=$.trim($("input[name='password']").val()),n=$(".protocol .checkbox").hasClass("current");if(!e)return ccwl.showToast({msg:"请输入账号"}),!1;if(!a)return ccwl.showToast({msg:"请输入密码"}),!1;if(!n&&t)return ccwl.showToast({msg:"请勾选平台协议"}),!1;var c={account:e,password:a};ccwl.handleLogin(c,t)}),$(".btn-findPassword").click(function(){var t=$.trim($("input[name='phone']").val()),e=$("input[name='code']").val(),a=$.trim($("input[name='password']").val()),n=$.trim($("input[name='confirmPassword']").val()),c=ccwl.reg.phone;if(!t)return ccwl.showToast({msg:"请输入手机号码"}),!1;if(t&&!c.test(t))return ccwl.showToast({msg:"请输入正确的手机号码"}),!1;if(!e)return ccwl.showToast({msg:"请输入验证码"}),!1;if(!a)return ccwl.showToast({msg:"请输入密码"}),!1;if(!n)return ccwl.showToast({msg:"请再次输入密码"}),!1;if(a&&t&&a===t)return ccwl.showToast({msg:"密码不可与用户名相同"}),!1;if(n!==a)return ccwl.showToast({msg:"请保持两次密码一致"}),!1;if(n&&n.length<6||n&&n.length>30)return ccwl.showToast({msg:"由6-30位字母、数字或字符组成"}),!1;var o={phone:t,new_password:a,auth_code:e};ccwl.handleFindPassword(o)}),$(".change-password a,.show-change-password").click(function(){$(".resize-password").fadeIn(),$(".container-mb").addClass("fixed")}),$(document).on("click",".close,.close-click,.btn-close",function(){var t=$(this).attr("data-type");$(".toast-item-wrapper").remove(),$(this).parents(".dialog").fadeOut(),$(".container-mb").removeClass("fixed"),1!=t&&$(".form-container input").val("")}),$(".btn-changePassword").click(function(){var t=$(this).attr("data-type"),e=$.trim($("input[name='nowPassword']").val()),a=$.trim($("input[name='newPassword']").val()),n=$.trim($("input[name='confirmNewPassword']").val());if(!e)return ccwl.showToast({msg:"请输入当前密码"}),!1;if(!a)return ccwl.showToast({msg:"请输入新密码"}),!1;if(!n)return ccwl.showToast({msg:"请再次输入新密码"}),!1;if(a!==n)return ccwl.showToast({msg:"请保持两次新密码一致"}),!1;if(n&&n.length<6||n&&n.length>30)return ccwl.showToast({msg:"由6-30位字母、数字或字符组成"}),!1;var c={password:e,new_password:a};ccwl.handleChangePassword(c,t)}),$(".back").click(function(){window.history.go(-1)}),$(".bind-orange").click(function(){$(".dialog-orange").fadeIn()});var t=!0;$(".btn-bind-orange").click(function(){var e=$("input[name='orangeCode']").val(),a=$(".leave-times span").text(),n=$(this).attr("data-type");if(!e)return ccwl.showToast({msg:"请输入识别码"}),!1;if(1*a<=0)return ccwl.showToast({msg:"今日错误次数达上限"}),!1;var c={bind_code:e};t&&(t=!1,ccwl.handleBindOrangeCode(c,n),setTimeout(function(){t=!0},3e3))}),$(".btn-confirm").click(function(){$(this).parents(".dialog").fadeOut(),location.href="/login"}),$(".expect").click(function(){ccwl.showToast({msg:"暂未开放,敬请期待"})}),$(".btn-receive-package").click(function(){var t=$(this).attr("data-type"),e=$(this).attr("data-receive");if("0"===t)return $(".confirm-container").show(),$(".confirm-container .message-content p").text("今日Orange识别码输入错误次数已达上限"),$(".confirm-container .message-content a").text("确定").addClass("close-click").attr("onclick","localStorage.removeItem('showOrange');"),!1;ccwl.handleGetServer(e)}),$(".btn-receive").click(function(){var t=$(".server-select li.current").attr("data-value"),e=$(".role-select li.current").attr("data-value");if(!t||""==t)return ccwl.showToast({msg:"请选择服务器"}),!1;if(!e||""==e)return ccwl.showToast({msg:"请选择角色"}),!1;var a={serverId:t,roleId:e};ccwl.handleGetRoleGift(a)}),$(".gift-span span").click(function(){$(this).addClass("current").siblings().removeClass("current");var t=$(this).index();$(".tab-content p").hide(),$(".tab-content p").eq(t).show().siblings().hide()}),$(".toggle-down").click(function(){$(".gift-explain-container").fadeIn()}),$(".select span").click(function(){$(".select-option").hide(),$(this).hasClass("current")?($(".select span").removeClass("current"),$(this).siblings(".select-option").stop().slideUp(100)):($(".select span").removeClass("current"),$(this).addClass("current"),$(this).siblings(".select-option").stop().slideDown(100))}),$(document).on("click",".select-option li",function(){var t=$(this).text();$(this).addClass("current").siblings().removeClass("current"),$(this).parents(".select").find("span").text(t),$(this).parents(".select").find("span").removeClass("current"),$(this).parents(".select").find(".select-option").stop().slideUp(100)}),$(document).on("click",".server-select li",function(){var t=$(this).attr("data-value");initRoleList(t)}),$("input[name='password']").keyup(function(t){13===t.keyCode&&$(".btn-login").trigger("click")}),$("input[name='confirmNewPassword']").keyup(function(t){13===t.keyCode&&$(".btn-changePassword").trigger("click")})});
\ No newline at end of file \ No newline at end of file
...@@ -568,30 +568,44 @@ textarea { ...@@ -568,30 +568,44 @@ textarea {
font-size: 0.32rem; font-size: 0.32rem;
color: #5f1a11; color: #5f1a11;
} }
.dialog-img { .dialog-img,
.share-img {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: scroll; overflow: scroll;
background: rgba(0, 0, 0, 0.7) url("../images/save_img_bg.png") no-repeat center; background: rgba(0, 0, 0, 0.7);
background-size: 100% auto;
} }
.dialog-img .dialog-img-content { .dialog-img .dialog-img-content,
.share-img .dialog-img-content {
position: absolute; position: absolute;
width: 90%; width: 90%;
left: 5%; left: 50%;
top: 1rem; top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
padding-top: 2.5rem; padding-top: 2.5rem;
}
.dialog-img .dialog-img-content .img-scroll {
height: 13.5rem; height: 13.5rem;
background: url("../images/save_img_bg.png") no-repeat center;
background-size: 100% auto;
}
.dialog-img .dialog-img-content .img-scroll,
.share-img .dialog-img-content .img-scroll {
height: 12rem;
overflow: scroll; overflow: scroll;
width: 85%;
margin: 0 auto;
}
.dialog-img .dialog-img-content img,
.share-img .dialog-img-content img {
width: 100%; width: 100%;
} }
.dialog-img .dialog-img-content img { .share-img img {
width: 100%; width: 100%;
display: block;
margin: 0 auto;
} }
.fixed { .fixed {
position: fixed; position: fixed;
......
...@@ -526,31 +526,42 @@ ...@@ -526,31 +526,42 @@
} }
} }
} }
.dialog-img{ .dialog-img,.share-img{
.pf(); .pf();
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: scroll; overflow: scroll;
background: rgba(0,0,0,.7) url("../images/save_img_bg.png") no-repeat center; background: rgba(0,0,0,.7);
background-size: 100% auto;
.dialog-img-content{ .dialog-img-content{
.pa(); .pa();
width: 90%; width: 90%;
left: 5%; left: 50%;
top: 1rem; top: 50%;
transform: translate(-50%,-50%);
padding-top: 2.5rem; padding-top: 2.5rem;
height: 13.5rem;
background:url("../images/save_img_bg.png") no-repeat center;
background-size: 100% auto;
.img-scroll{ .img-scroll{
height: 13.5rem; height: 12rem;
overflow: scroll; overflow: scroll;
width: 100%; width: 85%;
margin:0 auto;
} }
img{ img{
width: 100%; width: 100%;
} }
} }
} }
.share-img{
img{
width: 100%;
display: block;
margin: 0 auto;
}
}
.fixed{ .fixed{
.pf(); .pf();
left: 0; left: 0;
......
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
window.onresize = function () { window.onresize = function () {
reSizeRem(); reSizeRem();
} }
window.onerror = function (e){ window.onerror = function (e) {
alert(e) alert(e)
} }
</script> </script>
<link rel="stylesheet" href="/static/postcard/css/style.css"> <link rel="stylesheet" href="{{ asset('postcard/css/style.css') }}">
<script src="/static/js/jquery.2.1.3.min.js"></script> <script src="{{ asset('js/jquery.2.1.3.min.js') }}"></script>
<script src="/static/postcard/js/html2canvas.js"></script> <script src="{{ asset('postcard/js/html2canvas.js') }}"></script>
</head> </head>
<body> <body>
<div class="container postcard-container" id="test"> <div class="container postcard-container" id="test">
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
<span class="icon-red"></span> <span class="icon-red"></span>
<div class="left"> <div class="left">
<div class="role-avatar"> <div class="role-avatar">
<img src="/static/postcard/images/img_border.png" class="img-border" alt=""> <img src="{{ asset('postcard/images/img_border.png') }}" class="img-border" alt="">
@if($jobImg == '') @if($jobImg == '')
<img src="/static/postcard/images/default_img.png" class="img-header" alt=""> <img src="{{ asset('postcard/images/default_img.png') }}" class="img-header" alt="">
@else @else
<img src="{{ $jobImg }}" class="img-header" alt=""> <img src="{{ $jobImg }}" class="img-header" alt="">
@endif @endif
...@@ -52,17 +52,17 @@ ...@@ -52,17 +52,17 @@
<li class="role4"><span>{{ $info->guild ?? '' }}</span></li> <li class="role4"><span>{{ $info->guild ?? '' }}</span></li>
<li class="role5"><span> <li class="role5"><span>
@if($info->online_time > 0) @if($info->online_time > 0)
{{ ceil($info->online_time / 3600) }} {{ ceil($info->online_time / 3600) }}
@else @else
0 0
@endif @endif
小时</span></li> 小时</span></li>
</ul> </ul>
</div> </div>
<div class="bottom"> <div class="bottom">
<img src="/static/postcard/images/img1.png" class="img1" alt=""> <img src="{{ asset('postcard/images/img1.png') }}" class="img1" alt="">
<div id="bNum" class="b-num"></div> <div id="bNum" class="b-num"></div>
<img src="/static/postcard/images/img2.png" class="img2" alt=""> <img src="{{ asset('postcard/images/img2.png') }}" class="img2" alt="">
</div> </div>
</div> </div>
<!--角色等级--> <!--角色等级-->
...@@ -111,10 +111,12 @@ ...@@ -111,10 +111,12 @@
<!--高光时刻--> <!--高光时刻-->
<div class="ggsk-container"> <div class="ggsk-container">
@if($userImgStatus == -1) <img src="/static/postcard/images/img_add.jpg" class="img img-add" alt=""> <input type="file" id="file"> @endif @if($userImgStatus == -1) <img src="{{ asset('postcard/images/img_add.jpg') }}" class="img img-add" alt="">
@if($userImgStatus == 0) <img src="/static/postcard/images/img_sh.jpg" class="img img-sh" alt=""> @endif <input type="file" id="file"> @endif
@if($userImgStatus == 0) <img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 1) <img src="{{ $userImg }}" class="img img-sh" alt=""> @endif @if($userImgStatus == 1) <img src="{{ $userImg }}" class="img img-sh" alt=""> @endif
@if($userImgStatus == 2) <img src="/static/postcard/images/sh_fail.jpg" class="img img-sh" alt=""> <input type="file" id="file"> @endif @if($userImgStatus == 2) <img src="{{ asset('postcard/images/sh_fail.jpg') }}" class="img img-sh" alt="">
<input type="file" id="file"> @endif
</div> </div>
<div class="bottom-container"> <div class="bottom-container">
<!--分享--> <!--分享-->
...@@ -138,44 +140,49 @@ ...@@ -138,44 +140,49 @@
<span></span> <span></span>
<span></span> <span></span>
</div> </div>
<div class="share-img hide">
<img src="{{ asset('postcard/images/share_img.png') }}" alt="">
</div>
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script> <script>
$(function(){ $(function () {
function renderHtml(dom,num){ function renderHtml(dom, num) {
var str = num.toString(); var str = num.toString();
var arr=str.split(""); var arr = str.split("");
var html = '' var html = ''
$(arr).each(function(index,item){ $(arr).each(function (index, item) {
html+= '<span>'+item+'</span>'; html += '<span>' + item + '</span>';
}) })
$(dom).html(html); $(dom).html(html);
} }
@if($info->online_time > 0) @if($info->online_time > 0)
renderHtml('#bNum',{{ ceil($info->online_time / 86400 ) }}); renderHtml('#bNum',{{ ceil($info->online_time / 86400 ) }});
@else @else
renderHtml('#bNum',0); renderHtml('#bNum', 0);
@endif @endif
renderHtml('#rangeNums','{{ (string)$roleScore }}'); renderHtml('#rangeNums', '{{ (string)$roleScore }}');
renderHtml('#wq1','{{ $armsStrong }}'); renderHtml('#wq1', '{{ $armsStrong }}');
renderHtml('#wq2','{{ $armsExciting }}'); renderHtml('#wq2', '{{ $armsExciting }}');
renderHtml('#wq3','{{ $armsScore }}'); renderHtml('#wq3', '{{ $armsScore }}');
// 上传图片 // 上传图片
$(document).on('change','#file',function(e){ $(document).on('change', '#file', function (e) {
var formData = new FormData(); var formData = new FormData();
var file = $("#file")[0].files[0]; var file = $("#file")[0].files[0];
var acceptFileTypes = /^image\/(gif|jpe?g|png)$/i; var acceptFileTypes = /^image\/(gif|jpe?g|png)$/i;
//文件类型判断 //文件类型判断
if(file.type.length && !acceptFileTypes.test(file.type)) { if (file.type.length && !acceptFileTypes.test(file.type)) {
alert('请上传gif、jpg、jpeg或png格式的文件'); alert('请上传gif、jpg、jpeg或png格式的文件');
return false; return false;
} }
//文件大小判断 //文件大小判断
if(file.size > (2*1024*1024)) { if (file.size > (2 * 1024 * 1024)) {
alert('请上传不超过2M的文件'); alert('请上传不超过2M的文件');
return false; return false;
} }
formData.append("imgFile", file); formData.append("imgFile", file);
formData.append("_token","{{ csrf_token() }}") formData.append("_token", "{{ csrf_token() }}")
$.ajax({ $.ajax({
url: "/upload/img", url: "/upload/img",
type: "post", type: "post",
...@@ -184,17 +191,18 @@ ...@@ -184,17 +191,18 @@
processData: false, processData: false,
contentType: false, contentType: false,
dataType: "json", dataType: "json",
success: function(data) { success: function (data) {
$('.img-add').hide(); $('.img-add').hide();
$('.ggsk-container').html('<img src="/static/postcard/images/img_sh.jpg" class="img img-sh" alt=""><input type="file" id="file">'); $('.ggsk-container').html('<img src="{{ asset('postcard/images/img_sh.jpg') }}" class="img img-sh" alt=""><input type="file" id="file">');
}, },
error: function(data) { error: function (data) {
} }
}); });
}); });
function baseImageUrl(){
setTimeout(function(){ function baseImageUrl() {
setTimeout(function () {
html2canvas(document.querySelector("#test"), { //关键在于new html2canvas(document.querySelector("#test"), { //关键在于new
useCORS: true, useCORS: true,
removeContainer: true, removeContainer: true,
...@@ -205,50 +213,70 @@ ...@@ -205,50 +213,70 @@
y: 0, y: 0,
}).then(canvas => { }).then(canvas => {
var image = canvas.toDataURL('image/jpeg', 1.0); var image = canvas.toDataURL('image/jpeg', 1.0);
var img = '<img src="'+image+'">'; var img = '<img src="' + image + '">';
$('.dialog-img-content .img-scroll').html(img); $('.dialog-img-content .img-scroll').html(img);
$('.dialog-img').show(); $('.dialog-img').show();
$('.loading').hide(); $('.loading').hide();
}); });
$('.postcard-container').addClass('fixed'); $('.postcard-container').addClass('fixed');
},2000) }, 2000)
} }
$('.btn-save').click(function(){
$('.btn-save').click(function () {
$('.loading').show(); $('.loading').show();
$('.btn-save,.btn-share').hide(); $('.btn-save,.btn-share').hide();
$('html,body').animate({ $('html,body').animate({
scrollTop:0 scrollTop: 0
},0); }, 0);
baseImageUrl(); baseImageUrl();
}); });
$('.dialog-img').click(function(){ $('.dialog-img,.share-img').click(function () {
$(this).fadeOut(); $(this).fadeOut();
$('.btn-save,.btn-share').show(); $('.btn-save,.btn-share').show();
$('.postcard-container').removeClass('fixed'); $('.postcard-container').removeClass('fixed');
}); });
function wxShare(){
var data = res.response.sign;
var appId = data.appId;
var timestamp = data.timestamp;
var nonceStr = data.nonceStr;
var signature = data.signature;
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: appId, // 必填,公众号的唯一标识
timestamp: timestamp, // 必填,生成签名的时间戳
nonceStr: nonceStr, // 必填,生成签名的随机串
signature: signature, // 必填,签名,见附录1
jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'hideMenuItems']// 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
wx.ready(function () {
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,
// config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,
// 则须把相关接口放在ready函数中调用来确保正确执行。
// 对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
});
}
$.ajax({
url: "/wx/config",
data: {
url: location.href.split('#')[0]
},
type: 'GET',
dataType: "json",
async: false,
timeout: 5000,
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (textStatus == "timeout") { // 请求超时
} else {
}
},
success: function (res) {
var data = res.data;
wx.config({
debug: true,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
url: location.href.split('#')[0],
jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline']
});
wx.ready(function () {
wx.onMenuShareAppMessage({
title: '阿拉德之怒', // 分享标题
desc: '阿拉德之怒', // 分享描述
link: 'http://uc-signin2.srccwl.com', // 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致
imgUrl: 'https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png',
});
});
}
});
$('.btn-share').click(function () {
$('.share-img').show();
});
}); });
</script> </script>
</body> </body>
......
...@@ -19,15 +19,15 @@ ...@@ -19,15 +19,15 @@
reSizeRem(); reSizeRem();
} }
</script> </script>
<link rel="stylesheet" href="/static/postcard/css/style.css"> <link rel="stylesheet" href="{{ asset('postcard/css/style.css') }}">
<script src="/static/js/jquery.2.1.3.min.js"></script> <script src="{{ asset('js/jquery.2.1.3.min.js') }}"></script>
<script src="/static/postcard/js/main.js"></script> <script src="{{ asset('postcard/js/main.js') }}"></script>
</head> </head>
<body> <body>
<div class="container home-container"> <div class="container home-container">
<div class="header-avatar"> <div class="header-avatar">
<span></span> <span></span>
<img src="/static/postcard/images/default_img.png" alt=""> <img src="{{ asset('postcard/images/default_img.png') }}" alt="">
</div> </div>
<a href="javascript:" class="btn-start"></a> <a href="javascript:" class="btn-start"></a>
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script> <script>
$(function(){ $(function(){
$('.close').click(function (){ $('.close').click(function (){
...@@ -56,6 +57,52 @@ ...@@ -56,6 +57,52 @@
$('.btn-start').click(function (){ $('.btn-start').click(function (){
card.handleGetServer(); card.handleGetServer();
}); });
$.ajax({
url : "/wx/config",
data : {
url:location.href.split('#')[0]
},
type:'GET',
dataType : "json",
async: false,
timeout : 5000,
error : function(XMLHttpRequest, textStatus, errorThrown) {
if (textStatus == "timeout") { // 请求超时
} else {
}
},
success : function(res) {
var data = res.data;
wx.config({
debug : true,
appId : data.appId,
timestamp : data.timestamp,
nonceStr : data.nonceStr,
signature : data.signature,
url:location.href.split('#')[0],
jsApiList : [ 'onMenuShareAppMessage', 'onMenuShareTimeline' ]
});
wx.ready(function () {
wx.onMenuShareAppMessage({
title: '阿拉德之怒', // 分享标题
desc: '阿拉德之怒', // 分享描述
link: 'http://uc-signin2.srccwl.com', // 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致
imgUrl: 'https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png',
});
});
}
});
$('.btn-share').click(function(){
wx.ready(function () {
wx.onMenuShareAppMessage({
title: '阿拉德之怒', // 分享标题
desc: '阿拉德之怒', // 分享描述
link: 'http://uc-signin2.srccwl.com', // 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致
imgUrl: 'https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png',
});
});
})
}) })
</script> </script>
</body> </body>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@else @else
<div class="container container-mb" style="padding-top: 1.2rem"> <div class="container container-mb" style="padding-top: 1.2rem">
<div class="mb-header"> <div class="mb-header">
<a href="/wx/index" class="back"></a> <a href="/" class="back"></a>
<span>橙橙网络</span> <span>橙橙网络</span>
</div> </div>
<div class="dialog-orange"> <div class="dialog-orange">
......
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