问星数据小程序

applet-mask.vue 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="mask" @click="$emit('closeMask')">
  3. <template v-if="isWeixin">
  4. <wx-open-launch-weapp id="launch-btn" username="gh_7b8ac119fda1" :path="wx_page+'?source=h5_wx'" class="open_button">
  5. <script type="text/wxtag-template">
  6. <style>
  7. .btn{display: block;margin:auto;font-size:16px;line-height:49px;text-align:center;background:transparent;border:none;color:#ffffff;}
  8. </style>
  9. <button class="btn">打开小程序</button>
  10. </script>
  11. </wx-open-launch-weapp>
  12. </template>
  13. <view class="content" v-else>
  14. <image src="../../static/img/close.png" mode="widthFix" class="close" @click="closeMask"></image>
  15. <view class="title">
  16. 微信搜索<text style="color:#FF5A14">问星数据</text>小程序
  17. </view>
  18. <view class="title">免费查看更多视频号数据</view>
  19. <image src="https://kx-bigdata.oss-cn-beijing.aliyuncs.com/phone/h5_mask.png" mode="widthFix" class="image"></image>
  20. <button type="default" class="copyButton" @click="copyCon(1)">第一步:点击复制【问星数据】</button>
  21. <button type="default" class="copyButton" @click="copyCon(2)" style="margin-top:20rpx">第二步:打开微信</button>
  22. <view class="hint">如无法跳转,请手动打开微信APP</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { setClipboardData } from 'uni-clipboard'
  28. export default {
  29. props:{
  30. url_scheme:{
  31. type:String,
  32. default:'weixin://dl/business/?t=o3aIVwrmPmt'
  33. },
  34. wx_page:{
  35. type:String,
  36. default:'/pages/index/index'
  37. }
  38. },
  39. data() {
  40. return {
  41. isWeixin:false
  42. }
  43. },
  44. created() {
  45. if(navigator.userAgent.toLowerCase().match(/micromessenger/i)){
  46. this.isWeixin = true
  47. }
  48. },
  49. mounted() {
  50. // #ifdef H5
  51. if(navigator.userAgent.toLowerCase().match(/micromessenger/i)){
  52. this.$nextTick(function(){
  53. var btn = document.getElementById('launch-btn');
  54. btn.addEventListener('launch', function (e) {
  55. burialPoint({project_name:'移动端h5',button_name:'微信端点击按钮',key_value:parseQueryString('key')?parseQueryString('key'):'',page_name:'推广落地页',url_value:window.location.href,browser:userAgent()})
  56. _hmt?_hmt.push(['_trackEvent','移动端h5', '微信端点击按钮', parseQueryString('key')?parseQueryString('key'):'','']):'';
  57. });
  58. })
  59. }
  60. // #endif
  61. },
  62. methods: {
  63. copyCon(type){
  64. if(type==1){
  65. setClipboardData('问星数据').then((res)=>{
  66. this.$burialPoint({project_name:'小程序版h5',button_name:'复制成功',key_value:uni.getStorageSync('key')?uni.getStorageSync('key'):'',page_name:'弹框',url_value:window.location.href})
  67. _hmt?_hmt.push(['_trackEvent','小程序版h5', '复制成功', uni.getStorageSync('key'),'']):'';
  68. uni.showToast({
  69. title: '复制成功'
  70. })
  71. })
  72. }
  73. if(type==2){
  74. this.$burialPoint({project_name:'小程序版h5',button_name:'点击弹框打开微信',key_value:uni.getStorageSync('key')?uni.getStorageSync('key'):'',page_name:'弹框',url_value:window.location.href})
  75. _hmt?_hmt.push(['_trackEvent','小程序版h5', '点击弹框打开微信', uni.getStorageSync('key'),'']):'';
  76. var sUserAgent = navigator.userAgent.toLowerCase();
  77. if(sUserAgent.indexOf("baidu") > 0 || sUserAgent.indexOf("ucbrowser") > 0 ) {
  78. this.appletMaskFlag = true;
  79. }else{
  80. if (!navigator.userAgent.toLowerCase().match(/micromessenger/i)) {
  81. location.href = this.url_scheme
  82. }
  83. }
  84. }
  85. },
  86. closeMask(){
  87. this.$emit('closeMask')
  88. },
  89. getWxInfo(){
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. .open_button{
  96. width: 560rpx;
  97. height: 100rpx;
  98. background: linear-gradient(270deg, #FF8B4F 0%, #FF5227 100%);
  99. border-radius: 10rpx;
  100. position: fixed;
  101. display: block;
  102. top: 65vh;
  103. left: 0;
  104. right: 0;
  105. margin: auto;
  106. border: none;
  107. color: #FFFFFF;
  108. font-size: 16rpx;
  109. z-index: 99;
  110. text-align: center;
  111. line-height: 50rpx;
  112. }
  113. .mask{
  114. width: 100%;
  115. height: 100vh;
  116. background: rgba(0,0,0,0.5);
  117. position: fixed;
  118. top: 0;
  119. left: 0;
  120. z-index: 99;
  121. }
  122. .content{
  123. width: 622rpx;
  124. height: 700rpx;
  125. background: #FFFFFF;
  126. border-radius: 12rpx;
  127. position: absolute;
  128. top: 0;
  129. left: 0;
  130. right: 0;
  131. bottom: 0;
  132. margin: auto;
  133. padding-top: 84rpx;
  134. }
  135. .close{
  136. width: 40rpx;
  137. height: 40rpx;
  138. position: absolute;
  139. top: 20rpx;
  140. right: 20rpx;
  141. }
  142. .title{
  143. color: #000000;
  144. font-size: 40rpx;
  145. line-height: 44rpx;
  146. text-align: center;
  147. font-weight: bold;
  148. }
  149. .image{
  150. width: 468rpx;
  151. height: 234rpx;
  152. display: block;
  153. margin: auto;
  154. margin-top: 40rpx;
  155. }
  156. .copyButton{
  157. width: 540rpx;
  158. height: 80rpx;
  159. background: #2762FF;
  160. border-radius: 8rpx;
  161. color: #FFFFFF;
  162. font-size: 32rpx;
  163. line-height: 80rpx;
  164. text-align: center;
  165. margin-top: 40rpx;
  166. }
  167. .hint{
  168. text-align: center;
  169. line-height: 60rpx;
  170. color: #999;
  171. font-size: 22rpx;
  172. }
  173. </style>