zhaojs
2023-06-20 ee29b1ac78c203d25329e93a7f95f7080077283a
no message
已添加2个文件
已修改1个文件
1158 ■■■■■ 文件已修改
application/api/logic/taoke/device/Haodanku.php 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/html/dy_onebuy.html 566 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/html/signin.html 590 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
application/api/logic/taoke/device/Haodanku.php
@@ -162,7 +162,7 @@
        $goods = isset($result['data'][0]) ? $result['data'][0] : [];
        if(empty($goods['goods_id'])) return [];
        if(empty($goods['product_id'])) return [];
        
        $goods = self::initDyDetailGoods($goods);
        
public/html/dy_onebuy.html
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,566 @@
<!DOCTYPE html>
<html>
<head>
  <title>抖音一元限时秒</title>
  <meta charset="UTF-8" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
  <link rel="stylesheet" href="https://cdn.staticfile.org/minireset.css/0.0.2/minireset.css" />
  <link rel="stylesheet" href="https://at.alicdn.com/t/font_1534407_039yhnv7evxo.css" />
  <script src="https://cdn.staticfile.org/promise-polyfill/8.2.0/polyfill.min.js"></script>
  <script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/vue/3.0.11/vue.global.js"></script>
  <script src="https://cdn.staticfile.org/vant/3.2.4/vant.min.js"></script>
  <script src="https://img.bc.haodanku.com/cms/SpaUtils.min.js"></script>
  <script src="https://img.bc.haodanku.com/cdn/vant-touch-emulator.js"></script>
  <link href="https://cdn.staticfile.org/vant/3.2.4/index.min.css" rel="stylesheet" />
  <link rel="stylesheet" href="https://img.bc.haodanku.com/cdn/locss.css" />
  <script src="https://img.bc.haodanku.com/cdn/tsUtils.js"></script>
  <script type="text/javascript" src="https://img.ushopvip.com/js/uni-webview-js.js"></script>
  <meta name="referrer" content="no-referrer" />
  <script
    defer>document.write('<link rel="stylesheet" href="https://img.bc.haodanku.com/cms/dy_onebuy.css?t=' + (Date.now() - Date.now() % (60 * 1000 * 30)) + '"/>');</script>
</head>
<body>
  <template id="c-card">
    <div class="card row _ flex-c">
      <img class="cover" v-lazy="item.itempic" v-if="item.itempic" />
      <img class="cover" src="http://img.bc.fqapps.com/fudai13cae4ae6ef16739ed3b100a2ec39e97.gif" alt="" v-else />
      <div class="detail">
        <div class="title _ ellipsis-2">
          <img src="https://img.bc.haodanku.com/cms/1666250839"
            style="display: inline-block;width: 0.28rem;height: 0.28rem;margin-bottom: -0.04rem;">
          {{ item.itemshorttitle || item.itemtitle }}
        </div>
        <div class="shop-name _ flex-c">
          <img class="icon" src="https://img.bc.haodanku.com/cms/1655963255" :alt="item.shop_name" />
          <span class="value">{{ item.shop_name }}</span>
        </div>
        <div class="price">
          <div class="end-price">
            <div class="label">抢购价</div>
            <div class="value">
              ï¿¥<strong>{{ Number(item.itemendprice) }}</strong>
            </div>
          </div>
        </div>
        <div class="btn-block">
          <div class="_ btn btn-order" v-on:click.capture="buy">
            <span>立即抢购</span>
          </div>
        </div>
      </div>
    </div>
  </template>
  <template id="c-share">
    <div class="footer-share _ lr-c">
      <div id="share_href" v-on:click="handleShare">
        <div class="share-content _ flex-c">
          <i>
            <svg xmlns="http://www.w3.org/2000/svg" id="svg-icon" data-name="图层 1" viewBox="0 0 18 19.11">
              <title>分享</title>
              <path class="cls-1" d="M17.5,8A2.5,2.5,0,1,0,15,5.5,2.5,2.5,0,0,0,17.5,8Z" transform="translate(-3 -2)" />
              <path class="cls-1" d="M6.5,14.5A2.5,2.5,0,1,0,4,12,2.5,2.5,0,0,0,6.5,14.5Z"
                transform="translate(-3 -2)" />
              <path class="cls-2" d="M15,6.79,8.67,10.62" transform="translate(-3 -2)" />
              <path class="cls-2" d="M8.67,13.28,13.27,16" transform="translate(-3 -2)" />
              <path class="cls-1" d="M15.77,15.11a2.5,2.5,0,1,1-2.5,2.5A2.5,2.5,0,0,1,15.77,15.11Z"
                transform="translate(-3 -2)" />
            </svg>
          </i>
          <span>分享好友</span>
        </div>
      </div>
    </div>
  </template>
  <template id="category">
    <div class="c-category" v-on:click.stop>
      <div class="tab-wrapper _ flex-c">
        <div class="tabs _ flex-1">
          <van-tabs
            class="scroll-nav"
            v-model:active="activeValue"
            ref="tabsRef"
            @click-tab="onTabChange"
            background="none"
            :ellipsis="false"
          >
            <van-tab
              v-for="item in list"
              v-bind:key="item[valueKey]"
              v-bind:name="item[valueKey]"
              v-bind:title="item[labelKey]"
            ></van-tab>
          </van-tabs>
        </div>
        <div class="_ btn show-more" @click="toggleCateAllVisible">
          <i class="iconfont hdk-paixu2" :class="{open:allCateVisible}"></i>
        </div>
      </div>
      <div class="cate-all" toggle-status="hide" ref="cateAllRef">
        <ul>
          <li
            class="_ btn"
            v-for="(item,index) in list"
            v-bind:class="{active:activeValue === item[valueKey]}"
            v-on:click="onCateChange(item,index)"
          >
            <div class="ellipsis-single">{{item[labelKey]}}</div>
          </li>
        </ul>
      </div>
    </div>
  </template>
  <div id="single-page-app" v-cloak>
    <van-pull-refresh v-model="refreshing" @refresh="reGetListData">
      <van-list class="page-container" v-bind:loading="listData.loading" v-bind:finished="listData.finished"
        v-on:load="getListData">
        <!-- åº•部提示 -->
        <template v-slot:finished v-if="listData.list.length"><span class="list-item-loading">-优惠到底啦-</span></template>
        <template v-slot:loading><span class="list-item-loading">数据正在赶来的路上...</span></template>
        <div class="banner-wrapper" ref="bannerRef">
          <img class="free-banner" v-bind:src="banner" alt="" />
        </div>
        <van-sticky class="fixed-box">
          <van-search v-model="searchValue" show-action placeholder="请输入搜索关键词/链接" @search="onSearch"
                  @clear="onSearchClear">
            <template v-slot:action>
              <div class="_ flex-c-c" @click="onSearch">搜索</div>
            </template>
          </van-search>
          <category
            class="category"
            :list="category.list"
            :url-param-key="cateKey"
            v-model:value="category.value"
            @change="onCateChange"
            value-key="cat_id"
            label-key="cat_name"
          ></category>
        </van-sticky>
        <div class="page-content" ref="list" v-bind:class="{'empty-list':!listData.list.length}">
          <div class="lists" ref="listsRef" v-if="listData.list.length || listData.finished">
            <card v-for="(item, index) in listData.list" v-bind:item="item" v-bind:key="item.itemid"
              v-on:transfer="handleGoodsTransfer"></card>
          </div>
          <div class="empty" v-show="!listData.list.length &amp;&amp; !loading &amp;&amp; listData.finished">
            <div class="empty-box">
              <img src="http://img.bc.haodanku.com/cms/1627883509" />
              <div class="text">暂无数据~</div>
            </div>
          </div>
        </div>
      </van-list>
    </van-pull-refresh>
    <div class="back-top-wrap max-width" v-movable>
      <div class="_ btn back-top" v-on:click="backTop" v-bind:class="{hide: scrollTop &lt; 600}"></div>
    </div>
    <a class="back-link" v-if="fromLink" :href="fromLink"><i class="iconfont hdk-xiangyou"></i></a>
    <share v-on:share="handleShare" v-bind:class="{hide:isScrollToDown}"></share>
    <van-overlay v-bind:show="loading">
      <van-loading color="#0094ff"></van-loading>
    </van-overlay>
  </div>
  <script>
    function useBase() {
      const listDataStr = JSON.stringify({
        list: [],
        loading: false,
        finished: false,
        min_id: 1,
        pageTotal: 1,
        pageCurrent: 0,
      });
      const scrollTop = Vue.ref(0);
      const listData = Vue.reactive(JSON.parse(listDataStr));
      // æ ¹æ®å¾®ä¿¡æµè§ˆå™¨ç¼©æ”¾æ¯”例设置rem缩放
      if (SpaUtils.inWechat() && "ontouchstart" in window) {
        const scale = SpaUtils.getFontScale(true);
        document.documentElement.style.fontSize =
          "calc(13.33333vw * " + scale + ")";
      }
      return {
        listDataStr,
        data: {
          scrollTop,
          listData,
        },
        useScrollEndMounted(onScrollEnd, onNotScrollEnd) {
          Vue.onMounted(function () {
            window.addEventListener("scroll", function (ev) {
              scrollTop.value =
                document.documentElement.scrollTop || document.body.scrollTop;
              if (SpaUtils.isScrollEnd(this, "vertical", 40)) {
                onScrollEnd && onScrollEnd();
              } else {
                onNotScrollEnd && onNotScrollEnd();
              }
            });
          });
        },
        methods: {
          backTop() {
            $("html,body").animate({ scrollTop: 0 });
          },
          onScrollEnd() {
            this.getListData();
          },
          handleShare() {
            SpaUtils.copy(location.href, "复制成功,分享给身边好友吧~");
          },
          resetListData(isCleanList = true) {
            Object.assign(
              listData,
              JSON.parse(listDataStr),
              isCleanList ? undefined : { list: listData.list }
            );
          },
        },
      };
    }
    const Category = {
      template: "#category",
      props: {
        list: {
          type: Array,
          required: true,
        },
        value: {
          type: [String, Number],
          required: true,
        },
        valueKey: {
          type: String,
          default: "value",
        },
        labelKey: {
          type: String,
          default: "label",
        },
        urlParamKey: {
          type: String,
          default: "",
        },
      },
      emits: ["change", "update:value"],
      setup(props, ctx) {
        const propsRefs = Vue.toRefs(props);
        const data = {
          allCateVisible: Vue.ref(false),
          activeValue: Vue.ref(""),
          cateAllRef: Vue.ref(),
        };
        const methods = {
          onTabChange() {
            methods.closeAll();
            Vue.nextTick(() => {
              if (data.activeValue.value === props.value) return;
              methods.emit(data.activeValue.value);
            });
          },
          emit(value) {
            if (props.urlParamKey) {
              SpaUtils.historyReplaceState({
                [props.urlParamKey]: data.activeValue.value,
              });
            }
            ctx.emit("update:value", value);
            ctx.emit("change", value);
          },
          onCateChange(item) {
            methods.closeAll();
            const value = item[props.valueKey];
            data.activeValue.value = value;
            methods.emit(value);
          },
          isHideAll() {
            return (
              data.cateAllRef.value.getAttribute("toggle-status") === "hide"
            );
          },
          closeAll() {
            data.allCateVisible.value = false;
            !methods.isHideAll() && methods.toggleHeight();
          },
          showAll() {
            data.allCateVisible.value = true;
            methods.isHideAll() && methods.toggleHeight();
          },
          toggleHeight() {
            tsUtils.toggleWidthOrHeight(data.cateAllRef.value, "height", {
              duration: "300ms",
            });
          },
          toggleCateAllVisible() {
            data.allCateVisible.value = !data.allCateVisible.value;
            methods.toggleHeight();
          },
        };
        (function () {
          Vue.onMounted(() => {
            data.activeValue.value = props.value;
            window.addEventListener("click", function () {
              methods.closeAll();
            });
          });
          Vue.watch(
            propsRefs.value,
            (n) => {
              data.activeValue.value = n;
            },
            { immediate: true }
          );
        })();
        return { ...data, ...methods };
      },
    };
    function getComponents() {
      const Card = Vue.defineComponent({
        template: "#c-card",
        props: {
          item: Object,
        },
        emits: ["transfer"],
        setup(props, ctx) {
          return {
            buy(e, type = "buy") {
              ctx.emit("transfer", { e, item: props.item, type });
            },
            getMoneyStr: SpaUtils.numWan,
          };
        },
      });
      const Share = Vue.defineComponent({
        template: "#c-share",
        emits: ["show-directer"],
        setup(props, ctx) {
          return {
            handleShare() {
              ctx.emit("share");
            },
            showDirecter() {
              ctx.emit("show-directer");
            },
          };
        },
      });
      return { card: Card, share: Share, category: Category };
    }
  </script>
  <script>
    window.onload = function () {
      const stamp = Date.now() - (Date.now() % (60 * 1000 * 30));
      const app = Vue.createApp({
        name: "App",
        directives: {
          movable: SpaUtils.movable,
        },
        components: getComponents(),
        setup() {
          const cateKey = "ds_cate_id";
          const {
            data: baseData,
            methods: baseMethods,
            useScrollEndMounted,
          } = useBase();
          const customParams = useCustomParams();
          const data = {
            ...baseData,
            cateKey,
            banner: "https://img.bc.haodanku.com/cms/1666341435?t=" + stamp,
            top: 0,
            loading: Vue.ref(true),
            refreshing: Vue.ref(false),
            isScrollToDown: Vue.ref(false),
            searchValue: Vue.ref(""),
            category: Vue.reactive({
              list: [],
              value: SpaUtils.parseSearch()[cateKey] || "",
            }),
            fromLink: decodeURIComponent(SpaUtils.parseSearch().from || ""),
            ...customParams,
          };
          const methods = {
            ...baseMethods,
            backTop() {
              $("html,body").animate({ scrollTop: 0 });
            },
            backTopAndReGetListData() {
              methods.resetListData(false);
              methods.backTop();
              return methods.getListData(true);
            },
            reGetListData() {
              methods.resetListData(false);
              return methods.getListData(true);
            },
            onSearch() {
              // å°†é»˜è®¤é€‰æ‹©ç¬¬ä¸€ä¸ªåˆ†ç±»
              if (data.category.list.length > 0) {
                data.category.value = data.category.list[0].cat_id;
              }
              methods.backTopAndReGetListData();
            },
            onSearchClear() {
              data.searchValue.value = "";
              methods.backTopAndReGetListData();
            },
            onCateChange() {
              // æ¸…空搜索栏
              data.searchValue.value = ""
              SpaUtils.historyReplaceState({
                [cateKey]: data.category.value,
              });
              methods.backTopAndReGetListData();
            },
            async getCategory() {
              const url = "https://v2.api.haodanku.com/category_list";
              const res = await SpaUtils.Request.get(url, {
                type: 13,
                is_has: 1,
              }).promise;
              const cateIdKey = "cat_id";
              const cateList = res.data || [];
              if (!cateList.length) return;
              cateList.forEach((i) => (i[cateIdKey] = String(i[cateIdKey])));
              const firstId = cateList[0][cateIdKey];
              let cate = SpaUtils.parseSearch()[cateKey] || firstId;
              const find = cateList.find((i) => cate === i[cateIdKey]);
              if (!find) {
                cate = firstId;
                SpaUtils.historyReplaceState({ [cateKey]: cate });
              }
              data.loading.value = false;
              data.category.list = cateList;
              data.category.value = cate;
              methods.reGetListData();
            },
            async getListData(clean) {
              const loading = data.loading;
              const listData = data.listData;
              if (loading.value || listData.loading || listData.finished)
                return;
              listData.loading = true;
              if (clean) {
                loading.value = true;
              }
              try {
                const min_size = 10;
                const param = {
                  ...customParams.getListDataParams(),
                  keyword: data.searchValue.value,
                  cate_id: data.category.value,
                  min_id: data.listData.min_id,
                  back: min_size,
                };
                const url =
                  "https://v3.api.haodanku.com/dy_onebuy";
                const res = await SpaUtils.Request.get(url, param).promise;
                const list = res.data || [];
                setTimeout(() => {
                  listData.list = clean ? list : listData.list.concat(list);
                  listData.finished =
                    listData.min_id == res.min_id ||
                    !list.length ||
                    list.length < min_size;
                  listData.min_id = res.min_id || listData.min_id;
                }, 200);
                return res;
              } catch (e) {
                listData.list = [];
                listData.finished = true;
              } finally {
                setTimeout(() => {
                  listData.loading = false;
                  loading.value = false;
                  data.refreshing.value = false;
                }, 200);
              }
            },
            /**
             * å•†å“è½¬é“¾
             * @param e {MouseEvent}
             * @param item
             */
            async handleGoodsTransfer({ e, item }) {
              const param = {
                itemid: item.product_id,
                ...customParams.getTransferParams(),
              };
              try {
                const params = {
                  // sync: true,
                  platformType: "dy",
                  itemData: item,
                  url: "https://v2.api.haodanku.com/get_dyitem_link",
                  el: e.target,
                  data: param,
                  copySuccessMsg: "复制抖口令成功,请打开抖音APP下单",
                  getCopyTarget(res) {
                    return res.data.dy_password;
                  },
                };
                await SpaUtils.conversionLink(params);
              } catch (e) {
                SpaUtils.toast(e.msg || "转链失败");
              }
            },
          };
          function init() {
            methods.getCategory();
            useScrollEndMounted();
            Vue.watch(baseData.scrollTop, (n, o) => {
              data.isScrollToDown.value = n > o;
            });
          }
          init();
          return { ...data, ...methods };
        },
      });
      app.use(vant);
      app.use(vant.Lazyload, {
        lazyComponent: true,
        preLoad: 1.3,
        error: "http://img.bc.haodanku.com/haodanku/1595237918",
        loading:
          "http://img.bc.fqapps.com/fudai13cae4ae6ef16739ed3b100a2ec39e97.gif",
        attempt: 1,
      });
      app.mount("#single-page-app");
    };
  </script>
  <script>
    function useCustomParams() {
        const customParams = {
          apikey: "0F92EBA7AADA", //必填
          channel: "", //选填
        };
        return {
          customParams,
          // èŽ·å–åˆ—è¡¨æ•°æ®å‚æ•°
          getListDataParams() {
            return { apikey: customParams.apikey };
          },
          // è½¬é“¾å‚æ•°
          getTransferParams(item) {
            return { ...customParams };
          },
        };
      }
  </script>
</body>
</html>
public/html/signin.html
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,590 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
  <meta name="screen-orientation" content="portrait">
  <meta name="x5-orientation" content="portrait">
  <meta name="full-screen" content="yes">
  <meta name="x5-fullscreen" content="true">
  <meta name="browsermode" content="application">
  <meta name="x5-page-mode" content="app">
  <meta name="msapplication-tap-highlight" content="no">
  <meta content="telephone=no" name="format-detection">
  <title>红包特价专场</title>
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1534407_5zmyvxx3vxs.css">
  <script type="text/javascript" src="https://img.ushopvip.com/js/uni-webview-js.js"></script>
  <script>
  document.write("<link rel=\"stylesheet\" href=\"https://img.bc.haodanku.com/cms/signin.css?t=" + (Date.now() - Date.now() % (60 * 1000 * 30)) + "\"/>");
  </script>
</head>
<body>
<div id="app" v-cloak>
  <template v-if="isexplain && issource">
    <div class="main">
      <!--<div class="banenr" v-on:click="openDirect">
        <img src="http://img.bc.haodanku.com/cms/1627984833" alt="">
      </div>-->
      <div class="step">
        <img src="https://img.bc.haodanku.com/cms/1629341253" alt="">
        <div class="step-content">
          <div class="title">玩法概况</div>
          <ul>
            <li v-for="(item,index) in help_info">
              <span class="top-num">{{index + 1}}</span>
              <span class="text">{{item}}</span>
            </li>
          </ul>
          <div class="btn-block">
            <div class="btn to-sign-in" v-on:click="toSignIn"><span>前往签到</span> <i class="iconfont hdk-xiangyou"></i>
            </div>
            <div class="btn view-direct" v-on:click="openDirect"><span>查看图文教程</span> <i
              class="iconfont hdk-xiangyou"></i></div>
          </div>
        </div>
      </div>
    </div>
    <div class="list-wrapper">
      <!--<h6>签到红包抵扣专区</h6>-->
      <div class="newtop">
        <div class="search">
          <div class="search-box">
            <i class="search-icon"></i>
            <input type="text" v-model="keyword" v-on:blur="myblur" v-on:focus="myfocus"
                   v-on:keyup.enter="handleSearch"
                   placeholder="输入商品名称">
          </div>
          <span class="search-btn" v-on:click="handleSearch">搜索</span>
        </div>
        <div class="sort">
          <ul class="sort-list">
            <li v-for="item in fristOrderSort" v-bind:class="{'sort-active': item.number == sortNumber}"
                v-on:click="handleSort(item)">
              {{ item.name }}
              <span v-show="item.min !== item.max">
                    <i v-bind:class="{'arrow-active': item.min == sortId}"></i>
                    <i v-bind:class="{'arrow-active': item.max == sortId}"></i>
                  </span>
            </li>
          </ul>
        </div>
      </div>
      <ul class="shoplist" v-if="fristOrderItems.length>0">
        <li v-for="(item,index) in fristOrderItems">
          <img class="shop-img" v-lazy="item.itempic" v-if="item.itempic">
          <img class="shop-img" src="http://img.bc.haodanku.com/haodanku-activity/1596092443" v-else>
          <div class="shop-box" v-bind:class="!item.couponurl?'active':''">
            <p class="shop-title">{{item.itemshorttitle}}</p>
            <div class="shop-tips">
              <img src="http://img.bc.haodanku.com/haodanku/1613978202">
              <p>领取签到红包可再叠加抵扣!</p>
            </div>
            <div class="shop-tips row-2">
              <img src="http://img.bc.haodanku.com/cms/1627703910">
              <p>店铺:{{item.shopname}}</p>
            </div>
            <div class="ticket" v-if="item.couponurl"><span class="name">券</span><span
              class="value">ï¿¥{{item.couponmoney}}</span></div>
            <div class="shop-b">
              <div class="shop-b-l">
                <p class="shop-b-m"><i>券后价</i>ï¿¥{{parseFloat(item.itemendprice)}}</p>
                <p class="shop-b-label">ï¿¥{{parseFloat(item.itemprice)}}</p>
              </div>
            </div>
            <span class="shop-btn shop-coupon" v-on:click="getTaocode(item,true)" v-if="item.couponurl">立即领券</span>
            <span class="shop-btn" v-on:click="getTaocode(item)">搜索下单</span>
          </div>
        </li>
      </ul>
      <div class="combox">
        <p class="realpic-loading" v-if="loadshow"><i class="vmIconLoad"></i><em>数据加载中...</em></p>
        <p class="realpic-loading" v-else>数据已加载完了</p>
      </div>
    </div>
    <div class="free-share" v-bind:class="acFocus?'active':''">
      <img src="http://img.bc.haodanku.com/haodanku/1613981706" v-on:click="copyShare()" class="share-btn">
    </div>
    <div>
      <div class="back_top" v-if="scrollShow" v-on:click="arrowTop()"></div>
      <div class="tokenbox tokenbox1">
        <em class="shut" v-on:click="shutBtn"></em>
        <span>{{taoToken}}</span>
        <p>复制淘口令,打开手机淘宝领取</p>
        <span class="copybtn" v-on:click="copyBtn('.copybtn')">复制淘口令</span>
      </div>
    </div>
  </template>
  <div v-if="!isexplain">
    <img src="http://img.bc.haodanku.com/haodanku-activity/1596022875" class="goback"
         v-on:click="arrowBtn('isexplain')">
    <img src="http://img.bc.haodanku.com/haodanku_activity/1596768292">
  </div>
  <div v-if="!issource">
    <img src="http://img.bc.haodanku.com/haodanku-activity/1596022875" class="goback"
         v-on:click="arrowBtn('issource')">
    <img src="http://img.bc.haodanku.com/haodanku-activity/1596032111" alt="">
  </div>
  <div class="direct-img" v-show="showDirect" v-on:click="closeDirect">
    <div class="direct-box">
      <div class="box-header">
        ä½¿ç”¨æ•™ç¨‹
        <img
          v-on:click="closeDirect"
          class="btn-close"
          src="http://img-haodanku-com.cdn.fudaiapp.com/FsHmpTJUJxhdJ7X8YL36ix1GduZg"
          alt="">
      </div>
      <div class="box-content">
        <img src="http://img.bc.haodanku.com/cms/1627703471?t=1" alt="">
      </div>
    </div>
  </div>
  <transition name="fade">
    <div class="snapped-up" v-show="snappedUp.show">
      <div class="box">
        <div class="box-header">
          <img
            class="btn-close"
            v-on:click="closeSnappedUpDialog"
            src="http://img.bc.haodanku.com/haodanku/1596096751"
            alt="">
        </div>
        <div class="box-content">
          <div class="title">
            å¤åˆ¶ã€ä¸‹å•链接】打开手淘APP,<br>
            æœç´¢ç«‹å³ä¸‹å• ~
          </div>
          <img src="http://img.bc.haodanku.com/cms/1627701410" alt="">
          <button class="btn copy" v-on:click="copyBtn('.copy.btn')">点击复制</button>
        </div>
      </div>
    </div>
  </transition>
  <van-overlay :show="titleCopyTipsVisible" @click="titleCopyTipsVisible = false">
    <div
      class="wrapper"
      style="display:flex;align-items:center;justify-content:center;height: 100%;"
    >
      <img style="width: 6rem;" src="http://img-haodanku-com.cdn.fudaiapp.com/FhYQl6NqvQIycYZS1DM9DLBELA72" alt="">
    </div>
  </van-overlay>
</div>
<script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>
<script src="https://cdn.staticfile.org/vue-lazyload/1.3.3/vue-lazyload.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layer/2.3/layer.js"></script>
<script src="https://cdn.staticfile.org/clipboard.js/2.0.4/clipboard.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/ScrollToFixed/1.0.8/jquery-scrolltofixed-min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/device.js/0.2.7/device.min.js"></script>
<script src="https://img.bc.haodanku.com/cms/SpaUtils.min.js"></script>
<script src="https://cdn.staticfile.org/vant/2.12.5/vant.min.js"></script>
<link href="https://cdn.staticfile.org/vant/2.12.5/index.min.css" rel="stylesheet">
<script src="https://img.bc.haodanku.com/cdn/vant-touch-emulator.js"></script>
<script>
var vmUrlSearchs = null;
function vmRequest(name) {
  if(!vmUrlSearchs) {
    vmUrlSearchs = new vmUrlSearch();
  }
  return vmUrlSearchs[name];
}
function vmUrlSearch() {
  var name, value;
  var str = location.href;
  var num = str.indexOf("?");
  str = str.substr(num + 1);
  var arr = str.split("&");
  for(var i = 0; i < arr.length; i++) {
    if(num = arr[i].indexOf("=") != -1) {
      num = arr[i].indexOf("=");
    } else {
      num = arr[i].indexOf("/");
    }
    if(num > 0) {
      name = arr[i].substring(0, num);
      value = arr[i].substr(num + 1);
      this[name] = value;
    }
  }
}
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: "http://img.bc.haodanku.com/haodanku/1595237918",
  loading: "http://img.bc.haodanku.com/haodanku-activity/1596092443",
  attempt: 1
});
var app = new Vue({
  el: "#app",
  data: function() {
    return {
      showDirect: false,
      codeId: vmRequest("code"),
      fristOrderSort: [
        {
          name: "综合",
          bool: true,
          max: "",
          min: "",
          number: 3
        },
        {
          name: "ä»·æ ¼",
          bool: false,
          max: 3,
          min: 1,
          number: 0
        },
        {
          name: "销量",
          bool: false,
          max: 2,
          min: 2,
          number: 1
        },
        {
          name: "最新",
          bool: false,
          max: 5,
          min: 5,
          number: 2
        }
      ],
      sortId: "",
      sortBool: true,
      sortNumber: 3,
      fristOrderItems: [],
      topArr: [],
      page: 1,
      loadmsg: true,
      loadshow: true,
      scrollShow: false,
      taoToken: "",
      isexplain: true,
      issource: true,
      locationUrl: window.location.href,
      keyword: "",
      sigclick: false,
      playState: false,
      vmHttp: window.location.protocol.substring(0, window.location.protocol.length - 1) != "file" ? window.location.protocol.substring(0, window.location.protocol.length - 1) : "https",
      acFocus: false,
      outerHeight: "",
      // ç«‹å³æŠ¢è´­å¼¹çª—相关
      snappedUp: {
        show: false,
        code: ""
      },
      help_info: [],
      sign_info: {},
      titleCopyTipsVisible: false,
    };
  },
  created: function() {
    this.ajaxFristOrderItems(true);
  },
  mounted: function() {
    this.outerHeight = $(".banenr").outerHeight(true) + $(".secret-wrapper").outerHeight(true) + $(".list-wrapper>h6").outerHeight(true) + 2;
    this.taobaoscroll();
  },
  methods: {
    toSignIn: function() {
      if(!this.sign_info.tpwd) {
        return;
      }
      SpaUtils.copy(this.sign_info.tpwd, "复制口令成功,请打开淘宝浏览领取签到红包");
    },
    arrowBtn: function(val) {
      this[val] = !this[val];
      this.arrowTop();
    },
    taobaoscroll: function() {  //滚动加载
      var that = this;
      window.addEventListener("scroll", function() {
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
        var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
        if(!that.isexplain || !that.issource) return;
        that.scrollShow = scrollTop > 750;
        if(scrollHeight > clientHeight && scrollTop + clientHeight + 20 >= scrollHeight) {
          if(that.loadmsg && !that.sigclick) {
            that.loadmsg = false;
            that.sigclick = false;
            that.ajaxFristOrderItems();
          }
        }
      });
    },
    ajaxFristOrderItems: function(cb) {
      var that = this;
      if(that.sigclick) {
        if(this.fristOrderItems[0]) {
          this.fristOrderItems.forEach(function(item) {
            item.itempic = "";
          });
        }
        document.documentElement.scrollTop = that.outerHeight;
        document.body.scrollTop = that.outerHeight;
      }
      $.ajax({
        type: "Get",
        url: that.vmHttp + "://v2.api.haodanku.com/sign_red_pack_goods",
        data: {
          apikey: '', //必填
          min_size: 20,
          sort: that.sortId,
          min_id: that.page,
          keyword: that.keyword,
          pure_tpwd: vmRequest("pure_tpwd") ? 1 : undefined
        },
        dataType: "json",
        timeout: 5000,
        success: function(data) {
          if(data.code == "200") {
            that.help_info = data.help_info || [];
            that.sign_info = data.sign_info || {};
            if(that.sigclick) {
              that.fristOrderItems = data.data;
            } else {
              that.fristOrderItems = that.fristOrderItems.concat(data.data);
            }
            that.topArr = data.top_data;
            if(that.page != data.min_id) {
              that.loadmsg = true;
              that.loadshow = true;
              that.page = data.min_id;
            } else {
              that.loadmsg = false;
              that.loadshow = false;
            }
            that.$nextTick(function() {
              that.sigclick = false;
              if(cb) {
                $(".newtop").scrollToFixed();
              }
            });
          } else {
            that.loadmsg = false;
            that.loadshow = false;
            that.sigclick = false;
            layer.msg(data.msg, {
              time: 2000,
              shade: 0.1,
              shadeClose: true
            });
          }
        },
        error: function() {
          that.msgFun("网络错误,请检查网络重试");
        }
      });
    },
    handleSort: function(item) {
      if(this.sortNumber == item.number) {
        if(item.min === item.max) {
          return;
        }
        if(item.bool) {
          this.sortId = item.min;
          item.bool = false;
        } else {
          this.sortId = item.max;
          item.bool = true;
        }
      } else {
        item.bool = true;
        this.sortNumber = item.number;
        this.sortId = item.max;
      }
      this.page = 1;
      this.loadmsg = true;
      this.loadshow = true;
      this.sigclick = true;
      this.ajaxFristOrderItems();
    },
    popupFun: function(classname) {
      layer.open({
        type: 1,
        shift: 0,
        title: false,
        closeBtn: 0,
        shade: 0.4,
        shadeClose: true,
        content: $(classname)
      });
    },
    getTaocode: function(item, isCoupon) {
      // if(!isCoupon && vmRequest("pure_tpwd")) {
      //   // ç›´æŽ¥å¤åˆ¶
      //   copy(item.tpwd, "复制口令成功,请打开淘宝下单");
      if(!isCoupon) {
        // ç›´æŽ¥å¤åˆ¶
        SpaUtils.copy(item.itemtitle, false);
        this.titleCopyTipsVisible = true;
        return;
      }
      var that = this;
      var load = layer.load(1, {shade: 0.3});
      $.ajax({
        type: "Post",
        url: that.vmHttp + "://v2.api.haodanku.com/ratesurl",
        data: {
          apikey: '0F92EBA7AADA', //必填
          itemid: item.itemid,
          activityid: isCoupon ? item.activityid : undefined,
          title: item.itemshorttitle,
          itemtitle: item.itemtitle,
          pid: 'mm_4091757048_2861600076_114781900494', //必填
          tb_name: 'tb108547775155', //必填
          get_taoword: 1,
        },
        dataType: "json",
        timeout: 5000,
        success: function(data) {
          layer.close(load);
          if(data.code == "1") {
            that.taoToken = data.data.taoword;
            if(isCoupon) {
              that.popupFun(".tokenbox1");
            } else {
              that.openSnappedUpDialog();
            }
          } else {
            that.msgFun(data.msg);
          }
        },
        error: function() {
          layer.close(load);
          that.msgFun("网络错误,请检查网络重试");
        }
      });
    },
    msgFun: function(val) {
      layer.msg(val, {
        time: 2000,
        shade: 0.1,
        shadeClose: true
      });
    },
    arrowTop: function() {
      $("body,html").stop(true, true).animate({
        scrollTop: 0
      });
    },
    copyBtn: function(dom) { //复制公共方法
      var that = this;
      var clipboard = new ClipboardJS(dom, {
        text: function(target) {
          return that.taoToken;
        }
      });
      clipboard.on("success", function(e) {
        layer.closeAll();
        that.msgFun(that.snappedUp.show ? "下单链接复制成功,请打开手淘APP搜索下单" : "复制口令成功,请打开淘宝领取");
        e.clearSelection();
        clipboard.destroy();
      });
      clipboard.on("error", function(e) {
        layer.msg("复制口令失败,请手动复制", {
          shade: 0.4,
          time: 1000,
          shadeClose: false
        }, function() {
        });
      });
    },
    copyShare: function() { //复制公共方法
      var that = this;
      var txt = that.locationUrl;
      var clipboard = new ClipboardJS(".share-btn", {
        text: function(target) {
          return txt;
        }
      });
      clipboard.on("success", function(e) {
        that.msgFun("已复制分享链接");
        console.log(txt);
        e.clearSelection();
        clipboard.destroy();
      });
      clipboard.on("error", function(e) {
        layer.msg("复制分享链接失败!", {
          shade: 0.4,
          time: 1000,
          shadeClose: false
        }, function() {
        });
      });
    },
    handleSearch: function() {
      this.page = 1;
      this.loadmsg = true;
      this.loadshow = true;
      this.sigclick = true;
      this.ajaxFristOrderItems();
    },
    shutBtn: function() {
      layer.closeAll();
    },
    playBtn: function() {
      this.playState = true;
    },
    myfocus: function() {
      this.acFocus = true;
    },
    myblur: function() {
      this.acFocus = false;
    },
    openDirect: function() {
      this.showDirect = true;
    },
    closeDirect: function() {
      this.showDirect = false;
    },
    openSnappedUpDialog: function() {
      this.snappedUp.show = true;
    },
    closeSnappedUpDialog: function() {
      this.snappedUp.show = false;
    }
  },
  watch: {}
});
</script>
</body>
</html>