123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- var href = window.location.href;
- if(href.indexOf('?')!=-1){
- href=window.location.href.split('?')[0];
- } else {
- if(href.indexOf('#')!=-1){
- href=window.location.href.split('#')[0];
- }
- }
- href = href + "?";
- var isAnswer=false;
- $(function() {
- var obj1 = dc("page1"),
- obj2 = dc("page2"),
- obj3 = dc("page3"),
- obj4 = dc("page4"),
- obj5 = dc("page5"),
- obj6 = dc("page6"),
- obj7 = dc("page7"),
- obj8 = dc("page8"),
- obj9 = dc("page9");
- $('.bg_1').append('<div class="top_title"><img src="http://h5.iamberry.com/iamberry/wechat/test/images/2-1.png"><div class="one_1"><img src="http://h5.iamberry.com/iamberry/wechat/test/images/1-1.png"></div></div><div id="action" style="position: relative;text-align: center;"></div></div>');
- document.addEventListener("touchmove", function(b) {
- b.preventDefault()
- }, false);
- $("#page1").on("swipeUp", function() {
- Mobilebone.transition(obj2, obj1, false)
- });
- $("#page2").on("swipeUp", function() {
- Mobilebone.transition(obj3, obj2, false)
- });
- $("#page3").on("swipeUp", function() {
- Mobilebone.transition(obj4, obj3, false)
- });
- $("#page4").on("swipeUp", function() {
- Mobilebone.transition(obj5, obj4, false)
- });
- $("#page5").on("swipeUp", function() {
- Mobilebone.transition(obj6, obj5, false)
- });
- $("#page6").on("swipeUp", function() {
- Mobilebone.transition(obj9, obj6, false)
- });
- $("#page8").off().on("swipeUp", function() {
- Mobilebone.transition(obj9, obj8, false)
- });
- $("#page9").on("swipeUp", function() {
- Mobilebone.transition(obj1, obj9, false)
- });
- $("#page1").on("swipeDown", function() {
- Mobilebone.transition(obj9, obj1, true)
- });
- $("#page2").on("swipeDown", function() {
- Mobilebone.transition(obj1, obj2, true)
- });
- $("#page3").on("swipeDown", function() {
- Mobilebone.transition(obj2, obj3, true)
- });
- $("#page4").on("swipeDown", function() {
- Mobilebone.transition(obj3, obj4, true)
- });
- $("#page5").on("swipeDown", function() {
- Mobilebone.transition(obj4, obj5, true)
- });
- $("#page6").on("swipeDown", function() {
- Mobilebone.transition(obj5, obj6, true)
- });
- $("#page8").on("swipeDown", function() {
- Mobilebone.transition(obj6, obj8, true)
- });
- $("#page9").on("swipeDown", function() {
- Mobilebone.transition(obj6, obj9, true)
- });
- });
- window.onload=function(){
- get2WM();
- // getConfig();
- setTimeout(function(){
- $('#action').append('<div class="left1"><img src="http://h5.iamberry.com/iamberry/wechat/test/images/1-2.png"></div><div class="right1"><img src="http://h5.iamberry.com/iamberry/wechat/test/images/1-3.png"></div><div class="left1-2"><img src="http://h5.iamberry.com/iamberry/wechat/test/images/1-4.png"></div><div class="right1-2"><img src="http://h5.iamberry.com/iamberry/wechat/test/images/1-5.png"></div>')
- $('.left1').addClass('smallbig1');
- $('.right1').addClass('smallbig2');
- $('.left1-2').addClass('smallbig3');
- $('.right1-2').addClass('smallbig4');
- $(".loading-bg").hide();
- },300);
- };
- function dc(objectid) {
- if(document.getElementById && document.getElementById(objectid)) {
- return document.getElementById(objectid);// w3c dom
- } else if (document.all && document.all(objectid)) {
- return document.all(objectid);// msie 4 dom
- } else if (document.layers && document.layers[objectid]) {
- return document.layers[objectid];// nn 4 dom.. note: this won't find nested layers
- } else {
- return false;
- }
- }
- $(".ul_qes>li").each(function(){
- $(this).click(function(){
- $(this).children().prop("checked",true);
- if(isAnswer){
- $(".btn_submit").off().css('background-color','#c9c9ca');
- }else{
- $(".btn_submit").css('background-color','#d90049');
- }
- });
- });
- getConfig();
- function getConfig(){
- $.ajax({
- type: 'get',
- url: '/iamberry/config/get',
- data: {appid: "", url: window.location.href},
- dataType: 'json',
- timeout: 10000,
- context: $('body'),
- success: function(data){
- setConfig(data);
- },
- error: function(xhr, type){
- console.log('Ajax error!' + xhr)
- }
- });
- }
- /**配置JS-SDK*/
- function setConfig(config){
- wx.config({
- debug: false,
- appId: config.appId,
- timestamp: config.timestamp,
- nonceStr: config.nonceStr,
- signature: config.signature,
- jsApiList: [
- 'checkJsApi',
- 'onMenuShareTimeline',
- 'onMenuShareAppMessage',
- 'hideMenuItems',
- 'showMenuItems'
- ]
- });
- wx.ready(function(){
- wxReadySuccess();
- });
- }
-
- function get2WM(){
- var shareUrl = '';
- var quaryStr = '';
- if(href.indexOf('?')!=-1){
- quaryStr = window.location.href.split('?')[1];
- }
- $.ajax({
- url:'/iamberry/wechat/member/shareDrpUrl?dates=' + new Date().getTime() + '&' + quaryStr,
- dataType: 'json',
- type: 'POST',
- data: {},
- timeout: 15000,
- success: function(dt) {
- console.log(dt);
- if(dt.status) {
- $("#share-2wm-image").attr("src", dt.data.qrcodeUrl);
- if(dt.data.shareUrl.indexOf('?')!=-1){
- shareUrl = href + dt.data.shareUrl.split('?')[1];
- }
- //console.log("----ture---22--" + shareUrl);
- } else {
- //console.log("----false-");
- var nowHref = window.location.href;
- if(nowHref.indexOf('?')!=-1){
- shareUrl = href + nowHref.split('?')[1];
- if(shareUrl.indexOf('#')!=-1){
- shareUrl = shareUrl.split('#')[0];
- }
- }
- $("#share-2wm-image").attr("src", dt.data.qrcodeUrl);
- }
- // 重新注册分享
- url = shareUrl;
- console.log("url:" + url);
- getConfig();
- },
- error: function(xhr, type, errorThrown) {
- // errorfn(xhr);
- }
- });
- }
- /** 分享时、分享后调用方法 */
- var url;
- function shareMessage() {
- url = url || href;
- console.log("configURL:" + url);
- alert(url);
- wx.onMenuShareTimeline({ //分享到朋友圈,只有标题、图标,没有内容简介
- title: "8秒冲好一瓶奶!", link: url, imgUrl: "http://h5.iamberry.com/iamberry/common/shop/images/logo_head.png",
- success: function () {
- },
- cancel: function () {
- }
- });
- wx.onMenuShareAppMessage({ // 分享给好友,有标题、内容简介、图标
- title: "8秒冲好一瓶奶!", desc: "精准配比、精准温度、精准奶量,只需轻轻一按!", link: url, imgUrl: "http://h5.iamberry.com/iamberry/common/shop/images/logo_head.png",
- success: function () {
- },
- cancel: function () {
- // alert("share app error:");
- }
- });
- }
- function wxReadySuccess() {
- // wx.getNetworkType({success: function (res) {}});
- wx.showMenuItems({
- menuList: [
- "menuItem:share:appMessage",
- "menuItem:share:timeline"
- ] // 要显示的菜单项,所有menu项见附录3
- });
- wx.hideMenuItems({
- menuList: [
- "menuItem:copyUrl",
- "menuItem:openWithSafari",
- "menuItem:originPage",
- "menuItem:share:email",
- "menuItem:dayMode",
- "menuItem:setFont",
- "menuItem:nightMode",
- "menuItem:share:qq",
- "menuItem:dayMode",
- "menuItem:exposeArticle",
- "menuItem:nightMode",
- "menuItem:openWithQQBrowser",
- "menuItem:share:QZone",
- "menuItem:favorite",
- "menuItem:share:facebook"
- ] // 要隐藏的菜单项,所有menu项见附录3
- });
- url = url || href;
- console.log("configURL:" + url);
- // alert(url);
- wx.onMenuShareTimeline({ //分享到朋友圈,只有标题、图标,没有内容简介
- title: "8秒冲好一瓶奶!", link: url, imgUrl: "http://h5.iamberry.com/iamberry/common/shop/images/logo_head.png",
- success: function () {
- },
- cancel: function () {
- }
- });
- wx.onMenuShareAppMessage({ // 分享给好友,有标题、内容简介、图标
- title: "8秒冲好一瓶奶!", desc: "精准配比、精准温度、精准奶量,只需轻轻一按!", link: url, imgUrl: "http://h5.iamberry.com/iamberry/common/shop/images/logo_head.png",
- success: function () {
- },
- cancel: function () {
- // alert("share app error:");
- }
- });
- // shareMessage();
- }
|