123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <html>
- <head>
- <meta charset="utf-8">
- <title>猎豆优选</title>
- <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
- <meta name="format-detection" content="telephone=no,address=no,email=no" />
- <meta name="mobileOptimized" content="width" />
- <meta name="handheldFriendly" content="true" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta name="description" content="" />
- <meta name="keywords" content=""/>
- <script>
- ;(function() {
- var docEl = document.documentElement,
- resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
- clientWidth = docEl.clientWidth;
- s();
- window.addEventListener(resizeEvt, s, false);
- function s() {
- docEl.style.fontSize = 50.0 * (clientWidth / 375) + 'px';
- }
- })();
- </script>
- <script>
- var _ua = navigator.userAgent;
- if (!!_ua.match(/.*OS\s([\d_]+)/) || !!_ua.match(/(Android)\s+([\d.]+)/)) {
- document.write('<style>body{min-width:320px;min-height:320px;}</style>');
- }
- </script>
- <style type="text/css" media="screen">
- html,
- body,
- div,
- h3, h4, h5, h6, p,
- span, em, i,
- ::before,
- ::after{
- padding: 0;
- margin: 0;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- -webkit-tap-highlight-color: transparent;
- }
- ol, ul{
- list-style: none;
- padding: 0;
- margin: 0;
- }
- body{
- font-size: 14px;
- color: #333;
- }
- em, i{
- font-style: normal;
- }
- a{
- text-decoration: none;
- }
- .clearfix::before,
- .clearfix::after{
- content: "";
- display: block;
- height: 0;
- line-height: 0;
- visibility: hidden;
- clear: both;
- }
- .elli{
- display: box;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .copy_1{
- outline: none;
- border: 0px;
- color: rgba(0,0,0,0.0);
- position: absolute;
- left:-200px;
- background-color: transparent;
- }
- .copy_2{
- position: absolute;
- left:-200px;
- color: rgba(0,0,0,0);
- background-color: transparent
- }
- .wrapper{}
- .wrapper .activity_list{
- }
- .wrapper .list-item{
- display: flex;
- display: -webkit-flex;
- flex-direction: column;
- justify-content: center;
- /*align-items: center;*/
- margin: 0 12px;
- padding-top: 20px;
- border-bottom: #D8D8D8 solid 1px;
- }
- .wrapper .list-item .title{
- font-size: 15px;
- line-height: 22px;
- color: #333333;
- font-weight: 500;
- }
- .wrapper .list-item .desc{
- font-size: 12px;
- color: #999999;
- line-height: 16px;
- margin: 8px 0 15px;
- }
- .wrapper .list-item .img-box{
- width: 7.02rem;
- height: 2.87rem;
- overflow: hidden;
- }
- .wrapper .list-item .img-box img{
- width: 100%;
- }
- .wrapper .list-item .bottom-content{
- display: flex;
- height: 28px;
- justify-content: space-between;
- align-items: center;
- margin: 12px 0;
- }
- .wrapper .list-item .bottom-content .rate{
- font-size: 20px;
- color: #262626;
- line-height: 28px;
- }
- .wrapper .list-item .bottom-content .right span{
- border: #FF6000 solid 1px;
- color: #FF6000;
- line-height: 20px;
- font-size: 12px;
- padding: 0 10px;
- border-radius: 10px;
- }
- .weui-mask_transparent {
- position: fixed;
- z-index: 1000;
- top: 0;
- right: 0;
- left: 0;
- bottom: 0;
- }
- .weui-toast {
- position: fixed;
- z-index: 5000;
- width: 7.6em;
- min-height: 7.6em;
- top: 180px;
- left: 50%;
- margin-left: -3.8em;
- background: rgba(17, 17, 17, 0.7);
- text-align: center;
- border-radius: 5px;
- color: #FFFFFF;
- }
- .hide{
- display: none;
- opacity: 0;
- }
- .show{
- display: block;
- opacity: 1;
- }
- .weui-icon-success-no-circle {
- display: inline-block;
- vertical-align: middle;
- margin: 22px 0 0;
- width: 39px;
- height: 30px;
- background: url(getIt.png) no-repeat 0 0;
- -webkit-background-size: 39px 30px;
- background-size: 39px 30px;
- }
- .weui-toast__content {
- margin: 6px 0 15px;
- }
- </style>
- </head>
- <body>
- <div class="wrapper">
- <ul class="activity_list">
- <li class="list-item">
- <!-- <h5 class="title">2018天猫618理想生活狂欢季,趁热预售开抢!</h5> <p class="desc">有效期:2018-05-23至2018-05-31</p> <div class="img-box"><img src="" alt=""></div> <div class="bottom-content"> <div class="left">预估收入比率 <span class="rate">20%</span></div> <div class="right"> <input class="copy_1" type="text" readOnly="true" value=""/> <div class="copy_2"></div> <span>复制淘口令,进入淘宝</span> </div> </div> -->
- </li>
- </ul>
- </div>
- <div id="toast" class="hide">
- <div class="weui-mask_transparent"></div>
- <div class="weui-toast">
- <i class="weui-icon-success-no-circle"></i>
- <p class="weui-toast__content">已完成</p>
- </div>
- </div>
- <script src="axios.min.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript" charset="utf-8">
- window.onload = function () {
- var copy_2 = document.querySelector("copy_2"),
- copy_1 = document.querySelector("copy_1"),
- toast = document.getElementById("toast"),
- btn = [],
- listWrapper = document.querySelector('.wrapper .activity_list');
- axios.get('/api/v2/adv/advActivityMini', {
- activity_id: 1
- })
- .then(function (response) {
- var res = response.data, data = null, html = '';
- if (res.errno == 0) {
- data = res.rst.data;
- if (data.length > 0) {
- for (var i = 0; i < data.length; i++) {
- html += '<li class="list-item"><h5 class="title">'+ data[i].title +'</h5><p class="desc">有效期:'+ data[i].start_time +'至'+ data[i].end_time +'</p><div class="img-box"><img src="'+ data[i].img +'" alt=""></div><div class="bottom-content"><div class="left">淘口令 '+ data[i].command +'</div> <div class="right"><input class="copy_1" type="text" readOnly="true" value="'+ data[i].command +'"/><div class="copy_2">'+ data[i].command +'</div><span class="btn-copy">复制淘口令,进入淘宝</span></div></div></li>';
- }
- }
- listWrapper.innerHTML = html;
- btn = document.querySelectorAll('.wrapper .list-item .btn-copy');
- for (var j = 0; j < btn.length; j++) {
- btn[j].addEventListener('click', function () {
- // console.log(this);
- var copy_1 = this.previousElementSibling,
- copy_2 = this.previousElementSibling.previousElementSibling;
- // console.log(copy_1, copy_2);
- toast.classList.add('show');
- // toCopy();
- if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
- //区分iPhone设备
- window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
- // var Url2=document.getElementById("copy_2");//要复制文字的节点
- var range = document.createRange();
- // 选中需要复制的节点
- range.selectNode(copy_2);
- // 执行选中元素
- window.getSelection().addRange(range);
- // 执行 copy 操作
- var successful = document.execCommand('copy');
- window.getSelection().removeAllRanges();
- }else{
- copy_1.select(); // 选择对象
- document.execCommand("Copy"); // 执行浏览器复制命令
- }
- setTimeout(function () {
- toast.classList.remove('show');
- toast.classList.add('hide')
- }, 2000)
- }, false)
- }
- // console.log(data);
- // console.log(btn);
- }
- })
- .catch(function (error) {
- console.log(error);
- });
- };
- function toCopy() {
- if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
- //区分iPhone设备
- window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
- var Url2=document.getElementById("copy_2");//要复制文字的节点
- var range = document.createRange();
- // 选中需要复制的节点
- range.selectNode(Url2);
- // 执行选中元素
- window.getSelection().addRange(range);
- // 执行 copy 操作
- var successful = document.execCommand('copy');
- // 移除选中的元素
- window.getSelection().removeAllRanges();
- }else{
- var Url2=document.getElementById("copy_1");//要复制文字的节点
- Url2.select(); // 选择对象
- document.execCommand("Copy"); // 执行浏览器复制命令
- }
- }
- </script>
- </body>
- </html>
|