123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
- <title>咨询详细活动</title>
- <link rel="stylesheet" href="../common/reset.css">
- <script type="text/javascript" src="../common/jquery-2.1.0.js"></script>
- <script type="text/javascript">
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- window.onresize = function () {
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- }
- </script>
- <style type="text/css">
- body{background: #fff;width:100%;min-height:100vh}
- .title{
- font-size: #000;font-size: 0.34rem;line-height: 0.35rem;text-align: center;padding-top: 0.5rem;
- font-weight: bold;
- }
- .title02{
- width: 1.63rem;height: 0.385rem;background: url(./img/serviceFour.jpg?v=1) no-repeat;background-size:100%;
- margin: 0.125rem auto 0;
- font-size: 0.18rem;
- text-align: center;
- line-height: 0.385rem;
- font-weight: bold;
- letter-spacing: 0.2em;
- }
- #evmImg{
- width: 1.41rem;height: 1.41rem;margin: 0.465rem auto 0;display: block;
- }
- #preservationEvm{
- width: 1.68rem;height: 0.425rem;border-radius: 0.425rem;border: 0.01rem solid #F8E504;color: #000000;
- font-size: 0.18rem;line-height: 0.425rem;display: block;margin: 0.03rem auto 0;background: transparent;
- }
- .copyDiv{
- width: 2.305rem;height: 0.38rem;background: #F5F5F5;border-radius: 0.05rem;display: flex;align-items: center;justify-content: space-between;overflow: hidden;margin: 0.46rem auto 0;
- }
- .copyDiv .copyText{
- color: #000000;font-size: 0.15rem;line-height: 0.235rem;padding-left: 0.11rem;
- }
- .copyDiv .copyButton{
- width: 0.62rem;background: #FED900;color: #000000;font-size: 0.15rem;text-align: center;line-height: 0.38rem;
- }
- .hint{
- text-align: center;font-size: 0.14rem;padding-top: 0.1rem;
- }
- #copy_1,#copy_2{
- position: absolute;
- left: -1000rem;
- }
- .alert-info {
- position: fixed;
- top: 1.74rem;
- right: 0;
- left: 0;
- bottom: 0;
- text-align: center;
- }
-
- .alert-info p {
- display: inline-block;
- height: 0.38rem;
- color: #fff;
- font-size: 0.14rem;
- line-height: 0.38rem;
- padding: 0 0.10rem;
- background-color: rgba(0, 0, 0, 0.7);
- border-radius: 5px;
- }
- .content{
- width: 100%;
- }
- .content img{
- width: 100%;
- }
- </style>
- </head>
- <body>
- <h3 class="title">咨询详细活动</h3>
- <div class="title02">添加微信</div>
- <img src="./img/serviceEvm02.png" id="evmImg" />
- <div class="hint">长按二维码保存到本地</div>
- <!-- <button id="preservationEvm" onclick="downloadIamge('#evmImg')">保存二维码</button> -->
- <div class="copyDiv">
- <div class="copyText">微信:<span id="wechatNumber">kuxuan1108</span></div>
- <div class="copyButton" onclick="copyEvent()">复制</div>
- </div>
-
- <input id="copy_1" type="text" readOnly="true" value=""/>
- <div id="copy_2"></div>
-
- <div class="alert-info" style="display: none;">
- <!-- tip提示,3s后消失 -->
- <p></p>
- </div>
- </body>
- </html>
- <script type="text/javascript">
- var qs = parseQueryString(window.location.href);
- $().ready(function () {
- // 调用方式
- // 参数一: 选择器,代表img标签
- // 参数二: 图片名称,可选
- // downloadIamge('canvas', '图片名称')
- if(isWeiXin()){
- $(".hint").html('长按识别二维码')
- }
- if(qs.wechart){
- $('#wechatNumber').html(qs.wechart)
- if(qs.wechart == 'M13910555321'){
- $("#evmImg").attr('src','./img/serviceEvm03.png')
- }
- if(qs.wechart == 'zhuaduoduo001'){
- $("#evmImg").attr('src','./img/serviceEvm04.png')
- }
- }
- })
- function copyEvent () {
- var data=$("#wechatNumber").html();
- copy_2.innerHTML = data;
- copy_1.value = data;
- 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"); // 执行浏览器复制命令
- }
- showMsg('复制成功')
- }
- // function downloadIamge(selector, name) {
- // var image = new Image()
- // // 解决跨域 Canvas 污染问题
- // image.setAttribute('crossOrigin', 'anonymous')
- // image.onload = function () {
- // var canvas = document.createElement('canvas')
- // canvas.width = image.width
- // canvas.height = image.height
- // var context = canvas.getContext('2d')
- // context.drawImage(image, 0, 0, image.width, image.height)
- // var url = canvas.toDataURL('image/png')
- // // 生成一个a元素
- // var a = document.createElement('a')
- // // 创建一个单击事件
- // var event = new MouseEvent('click')
- // // 将a的download属性设置为我们想要下载的图片名称,若name不存在则使用‘下载图片名称’作为默认名称
- // a.download = name || '下载图片名称'
- // // 将生成的URL设置为a.href属性
- // a.href = url
- // // 触发a的单击事件
- // a.dispatchEvent(event)
- // }
- // image.src = document.querySelector(selector).src
- // }
- //提示弹框
- function showMsg(msg) {
- var msgBox = document.getElementsByClassName('alert-info')[0];
- msgBox.children[0].innerText = msg;
- msgBox.style.display="block";
- setTimeout(function() {
- msgBox.style.display="none";
- }, 1500);
- }
- function isWeiXin(){
- var ua = window.navigator.userAgent.toLowerCase();
- if(ua.match(/MicroMessenger/i) == 'micromessenger'){
- return true;
- }else{
- return false;
- }
- }
- //H5页面埋点
- function writeLogH5 (data) {
- $.ajax({
- type:'post',
- url:'/api/v2/channel/writeLogH5',
- dataType:'json',
- data:data,
- success:function (res) {
- }
- })
- }
- function parseQueryString(url) {
- var urlObj = {};
- var reg = /([^?=&]+)=([^?=&]+)/g;
- url.replace(reg, function($0, $1, $2) {
- urlObj[$1] = decodeURIComponent($2);
- })
- return urlObj;
- }
- </script>
|