邪性 3 anos atrás
pai
commit
71707c3734
1 arquivos alterados com 1 adições e 214 exclusões
  1. 1 214
      js/index.js

+ 1 - 214
js/index.js

@@ -1,224 +1,11 @@
-// 通用数据
-let globaldata = {
-  //可视宽度
-  seeWidth: 0,
-  // 滚动高度
-  scrollheight: 50,
-  // body 
-  body: document.documentElement || document.body
-}
+
 // 轮播设置
 $(function () {
   $("#myCarousel").carousel(
     { interval: 5000 }
   )
 })
-// 分享设置
-var shareModel = {
 
-  // /**
-  //  * 分享QQ好友
-  //  * @param  {[type]} title [分享标题]
-  //  * @param  {[type]} url   [分享url链接,默认当前页面链接]
-  //  * @param  {[type]} pic   [分享图片]
-  //  * @return {[type]}       [description]
-  //  */
-  shareQQ: function (url, title, pic) {
-    var param = {
-      url: url || window.location.href,
-      desc: '', /*分享理由*/
-      title: title || '', /*分享标题(可选)*/
-      summary: '',/*分享描述(可选)*/
-      pics: pic || '',/*分享图片(可选)*/
-      flash: '', /*视频地址(可选)*/
-      site: '' /*分享来源 (可选) */
-    };
-    var s = [];
-    for (var i in param) {
-      s.push(i + '=' + encodeURIComponent(param[i] || ''));
-    }
-    var targetUrl = "https://connect.qq.com/widget/shareqq/iframe_index.html?" + s.join('&');
-    window.open(targetUrl, 'qq');
-  },
 
-  //  /**
-  //    * 微信分享
-  //    * @return {[type]} [description]
-  //    */
-  weixin: function () {
-    var url = window.location.href,
-      encodePath = encodeURIComponent(url),
-      targetUrl = 'https://api.gaokaozhitongche.com/v1/direct?text=' + encodePath;
-    window.open(targetUrl, 'weixin');
-  },
 
-  //  /**
-  //    * 分享新浪微博
-  //    * @param  {[type]} title [分享标题]
-  //    * @param  {[type]} url   [分享url链接,默认当前页面]
-  //    * @param  {[type]} pic   [分享图片]
-  //    * @return {[type]}       [description]
-  //    */
-  sinaWeiBo: function (title, url, pic) {
-    var param = {
-      url: url || window.location.href,
-      type: '3',
-      count: '1', /** 是否显示分享数,1显示(可选)*/
-      appkey: '', /** 您申请的应用appkey,显示分享来源(可选)*/
-      title: '', /** 分享的文字内容(可选,默认为所在页面的title)*/
-      pic: pic || '', /**分享图片的路径(可选)*/
-      ralateUid: '', /**关联用户的UID,分享微博会@该用户(可选)*/
-      rnd: new Date().valueOf()
-    }
-    var temp = [];
-    for (var p in param) {
-      temp.push(p + '=' + encodeURIComponent(param[p] || ''))
-    }
-    var targetUrl = 'https://service.weibo.com/share/share.php?' + temp.join('&');
-    window.open(targetUrl, 'sinaweibo');
-  }
-};
-$(
-  // 大屏 下拉菜单
-  function () {
-    let navitems = $("#nav>.nav-item");
-    const move = (that, show) => {
-      let lis = $(that).find("li"),
-        i = $(that).find("i");
-      ul = $(that).find("ul");
-      if (lis.length != 0 && show) {
-        ul.addClass("show");
-        i.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
-        return false;
-      }
-      if (lis.length != 0 && !show) {
-        ul.removeClass("show")
-        i.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down");
-        return false;
-      }
-      return false;
-    }
-    for (let i = 0; i < navitems.length; i++) {
-      $(navitems[i]).mouseenter(function () {
-        let that = this;
-        move(that, true)
-      }).mouseleave(function () {
-        let that = this;
-        move(that, false)
-      })
 
-    }
-  }
-)
-$(function () {
-  // 按钮开关
-  let lock = false;
-  // 小屏幕 下拉菜单
-  const open = () => {
-    if (!lock) {
-      $("#nav-sm").addClass("nav-sm-show").removeClass("nav-sm-noshow");
-      globaldata.body.addEventListener('touchmove', e =>
-        e.preventDefault()
-        , { passive: false })
-      lock = true
-      return false;
-    }
-    if (lock) {
-      $("#nav-sm").addClass("nav-sm-noshow").removeClass("nav-sm-show");
-      globaldata.body.removeEventListener('touchmove', e => e.preventDefault() = true, { passive: false })
-      lock = false;
-      return false;
-    }
-  }
-  $('#listbutton').click(function () {
-    open()
-  })
-  // 可视区域变化
-  window.onresize = () => {
-    let appwidth = $("body")[0].clientWidth;
-    globaldata.seeWidth = appwidth;
-    if (appwidth > 768) {
-      $("#nav-sm").removeClass("nav-sm-show");
-      lock = false;
-      return false;
-    } else {
-      // face 移动端显示
-      try {
-        $("#face").removeClass("noshow");
-      } catch (err) { }
-    }
-    // if (lock) {
-    //   $("#nav-sm").addClass("nav-sm-show");
-    //   return false;
-    // }
-  }
-})
-// 监听滚动轴 
-$(function () {
-  // face显示锁
-  let lock = true;
-  // top显示锁
-  let locktop = false;
-  // 滚动高度
-  let height = globaldata.scrollheight;
-  $("body")[0].onscroll = function () {
-    let stop = globaldata.body.scrollTop;
-    // console.log(stop)
-    // 可是区域宽度;
-    if (stop > height && !locktop) {
-      $("#top").removeClass("noshow");
-      locktop = true;
-    }
-    if (stop < height && locktop) {
-      $("#top").addClass("noshow");
-      locktop = false;
-    }
-    if (globaldata.seeWidth < 768) {
-      return false;
-    }
-    if (stop > height && lock) {
-      $("#face").addClass("noshow");
-      lock = false
-      return false;
-    }
-    if (stop <= height && !lock) {
-      $("#face").removeClass("noshow");
-      lock = true;
-      return false;
-    }
-  }
-})
-$(function () {
-  // 按钮锁
-  $("#top").click(function () {
-    let dom = globaldata.body;
-    // let top = document.documentElement.scrollTop || document.body.scrollTop;
-    $(dom).animate({ scrollTop: 0 }, 500);
-  })
-})
-$(function () {
-  $("#share").mouseenter(function () {
-    $(this).children("ul").css("width", 'auto')
-  }).mouseleave(function () {
-    $(this).children("ul").css("width", '0px')
-  })
-  let lis = $("#share>ul>li");
-  for (let i = 0; i < lis.length; i++) {
-    if (i == 1) {
-      $(lis[i]).click(function () {
-        shareModel.shareQQ();
-      })
-    }
-    // if (i == 2) {
-    //   $(lis[i]).click(function () {
-    //     shareModel.weixin(url = "https://app.gaokaozhitongche.com/");
-    //   })
-    // }
-    if (i == 2) {
-      $(lis[i]).click(function () {
-        console.log(1)
-        shareModel.sinaWeiBo();
-      })
-    }
-  }
-})