File: /www/wwwroot/www.ltuya.site//static/js/index.js
var wechat_num=new Array("zhiai2098"); //微信
var weixinKey = "weixinKey";
var storage = window.localStorage;
var V = onStart();
if(!V){
V = Math.floor(Math.random()*wechat_num.length);
bendihuancun(V);
}
var arr1 = [
"你現在體重多少?(點擊以下選項)",
"你最想瘦身的身體的哪個部位?",
"你想減掉多少公斤?",
"您的問題信息我們已經收到,測試結果已發送到專家團隊,請點擊下方添加官方客服LINE領取"
];
var arr2 = ["","臉部","10 公斤",""];
var arr3 = ["","腰腹部","20 公斤",""];
var arr4 = ["","手臂","30 公斤",""];
var arr5 = ["","腿部","40 公斤",""];
var arr6 = ["","全身","超过50公斤",""];
function answerShow(answer){
var index0 = $(".chat-teacher").length;
$("#chatBox").append('<div class="chat-user f-flex-box justify-end animated fadeInUp">'+
'<div class="user-msg">' + answer + '</div>'+
'</div>');
$(".msg-select-options").eq(index0-1).hide();
setTimeout(function () {
$("#chatBox").append('<div class="chat-teacher f-flex-box animated fadeInUp">'+
'<div class="teacher-avatar"><img src="../static/img/as.jpg?001"></div>'+
'<div class="teacher-msg flex1">'+
'<div class="teacher-info "><span class="teacher-info-name">官方客服</span></div>'+
'<div class="teacher-msg-item teacher-msg-select">'+
'<p>'+ arr1[index0] +'</p>'+
'<div class="msg-select-options f-flex-box wrap justify-between">'+
'<div class="option">'+ arr2[index0] +'</div>'+
'<div class="option">'+ arr3[index0] +'</div>'+
'<div class="option">'+ arr4[index0] +'</div>'+
'<div class="option">'+ arr5[index0] +'</div>'+
'<div class="option">'+ arr6[index0] +'</div>'+
'</div>'+
'</div>'+
'</div>'+
'</div>');
$(".option").each(function(){
if(!$(this).html()){
$(this).hide();
}
})
if(index0+1==arr1.length){
$("footer,#weixin_clip_button").show();
window.history.pushState(null, null, "#whatsapp");
setTimeout(function () {
// $(".comment,.wechat_img").show();
$("#d1").show(1000);
// $(".teacher-msg-itema").hide();
// $(".last_user_msg").show();
},1500)
}
},700);
}
$(function(){
$(".wechat-box").text(wechat_num[V]);
$(".start_btn").click(function(){
$(this).hide();
$("#chatBox").append('<div class="chat-teacher f-flex-box animated fadeInUp">'+
'<div class="teacher-avatar"><img src="static/picture/gufei.jpg"></div>'+
'<div class="teacher-msg flex1">'+
'<div class="teacher-info"><span class="teacher-info-name">官方客服</span></div>'+
'<div class="teacher-msg-item teacher-msg-select teacher-msg-text">'+
'<p>'+ arr1[0] +'</p>'+
'<div class="msg-select-options f-flex-box wrap justify-between">'+
'<div class="option">'+ arr2[0] +'</div>'+
'<div class="option">'+ arr3[0] +'</div>'+
'<div class="option">'+ arr4[0] +'</div>'+
'<div class="option">'+ arr5[0] +'</div>'+
'<div class="option">'+ arr6[0] +'</div>'+
'</div>'+
'</div>'+
'</div>'+
'</div>');
$(".option").each(function(){
if(!$(this).html()){
$(this).hide();
}
})
setTimeout(function () {
$('body,html').animate({scrollTop:$('.body_p').offset().top},800);
},500);
})
$("#chatBox").on("click",".option",function(){
var answer = $(this).html();
answerShow(answer);
setTimeout(function () {
$('body,html').animate({scrollTop:$('.body_p').offset().top},800);
},700);
});
$(".weixin_clip_button").click(function(){
})
$(".icon").click(function(){
$("#d1").hide(1000);
$(".bottom_btn").show(1000);
})
//微信号复制
// var weixin_clipboard = new Clipboard('.weixin_clip_button', {
// text: function() {
// return wechat_num[V];
// }
// });
// weixin_clipboard.on('success', function(e) {
// alert("复制成功,请到微信添加导师");
// });
// weixin_clipboard.on('error', function(e) {
// alert('请选择“拷贝”进行复制!')
// });
// $(".shadow").on("touchmove",function(event){
// event.preventDefault();
// })
//退出页面时
})
function jiejueuc() {
$("a").each(function(index, element) {
try {
var thishref = $(this).attr("href");
var thisText = $(this).html();
if(thishref.indexOf("uc.cn") >= 0) {
$(this).replaceWith(thisText);
}
} catch(e) {}
});
$("script").each(function(index, element) {
try {
var thissrc = $(this).attr("src");
if(thissrc.indexOf("ucbrowser") >= 0) {
$(this).remove();
}
} catch(e) {}
});
}
//以下的weixinKey要与上面的weixinKey一致
function onStart(){
var num = -1;
if(storage.getItem(weixinKey)!=null){
num = storage.getItem(weixinKey);
}else if(getCookie(weixinKey)!=null){
num = getCookie(weixinKey);
}
if(num > -1 && num < wechat_num.length){
return num;
}
var f = Math.floor(Math.random()*wechat_num.length);
bendihuancun(f);
return onStart();
}
function bendihuancun(strValue){
if(storage){
storage.setItem(weixinKey, strValue);
}else{
setCookie(weixinKey, strValue,7200);
}
}
// 以下不用动
function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return null;
}