刮刮前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

250 lines
5.7 KiB

<template>
<view class="">
<view class="invitePage" :style="userType=='agent'?'background-image: url(../../../static/user/haibao.png);':'background-image: url(../../../static/user/haibao_1.png);'">
<view class="" v-if="userType=='agent'">
<view class="invite_code">{{Invite_code}}</view>
<view class="invite_code" style="margin-top: 20px;font-size: 14px;" @click="copy">复制下载链接</view>
</view>
<view class="" v-if="userType=='user'">
<view class="invite_code" style="margin-top: 320px;font-size: 16px;" @click="copy">复制下载链接</view>
</view>
</view>
<view class="about" v-if="0">
<view class="box">
<image class="logoImg" :src="about.logo"></image>
<text class="tip appName">{{about.appName}}</text>
<text class="tip">{{about.slogan}}</text>
<view @click="download" id="download">
<image v-if="isIos" class="icon" src="@/static/h5/download-app/ios.png" mode="widthFix"></image>
<image v-else class="icon" src="@/static/h5/download-app/android.png" mode="widthFix"></image>
<text class="download-text">{{$t('invite.download')}}</text>
</view>
<text class="tip">version {{about.version}}</text>
</view>
<view class="copyright">
<text class="hint">{{about.company}}</text>
</view>
<view class="mask" v-if="showMask">
<image src="../../../static/h5/download-app/openImg.png" mode="widthFix"></image>
</view>
</view>
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
computed: {
uniStarterConfig() {
return getApp().globalData.config
}
},
data() {
return {
userType: 'background',//user|agent|background
about: {},
code: "",
Invite_code: '',
isIos: "",
showMask: false,
downloadUrl: {
"ios": "",
"android": ""
}
};
},
created() {
this.about = this.uniStarterConfig.about
this.downloadUrl = this.uniStarterConfig.download
this.year = (new Date).getFullYear()
//判断是否在微信中打开
var userAgent = navigator.userAgent;
var ua = userAgent.toLowerCase();
this.isWeixin = ua.indexOf('micromessenger') != -1;
//判断是否在ios或者安卓打开
this.isIos = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
this.userType = uni.getStorageSync('userType');
if(this.userType=='agent'){
this.getDatas();
}
},
onLoad({code}) {
// this.code = code
// document.getElementById("openApp").style.display = 'none'
// document.getElementsByTagName("body")[0].style = ""
},
methods: {
getDatas(){
API.request('/agentTeam/getAgentInviteCode', {}, res=>{
this.Invite_code = res.data.code;
})
},
download() {
if (this.code) {
uni.setClipboardData({
data: this.code,
complete: (e) => {
console.log(e);
uni.hideToast()
/* 以下临时解决setClipboardData h5端样式和键盘弹出端错误解决方案,后续会直接内置*/
document.getElementById("#clipboard").style.top = '-999px';
uni.hideKeyboard()
}
})
}
if (this.isIos) {
window.location.href = this.downloadUrl.ios
} else {
if (this.isWeixin) {
//显示浮层
this.showMask = true
} else {
window.location.href = this.downloadUrl.android
}
}
},
copy(){
API.request('/user/downloadApp', {}, res=>{
let url = res.data.app_url;
// #ifdef H5
let oInput = document.createElement('input')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // 选择对象
document.execCommand('Copy') // 执行浏览器复制命令
uni.showToast({
title: "复制成功!",
duration: 2000,
icon: "none",
});
oInput.remove()
// #endif
// uni.setClipboardData({
// data: url,
// complete: (e) => {
// console.log(e);
// // uni.hideToast()
// /* 以下临时解决setClipboardData h5端样式和键盘弹出端错误解决方案,后续会直接内置*/
// document.getElementById("#clipboard").style.top = '-999px';
// uni.hideKeyboard()
// }
// })
// 以上两个方法都是苹果真机浏览器端无效;安卓真机浏览器端、电脑H5端有效
})
}
}
}
</script>
<style lang="scss">
page{
background-color: #336EFF;
}
/* #ifndef APP-NVUE */
view {
display: flex;
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
.invitePage{
width: 750rpx;
height: 1200rpx;
background-size: contain;
.invite_code{
text-align: center;
color: #3658E7;
font-size: 36px;
margin-top: 310px;
}
}
.about {
width: 750rpx;
flex-direction: column;
}
.box {
margin-top: 100px;
flex-direction: column;
justify-content: center;
align-items: center;
}
.logoImg {
margin-bottom: 10upx;
width: 160upx;
height: 160upx;
border-radius: 15px;
}
.tip {
font-size: 24rpx;
margin-top: 10px;
}
.appName {
margin-top: 20px;
font-size: 42rpx;
font-weight: 500;
}
.copyright {
width: 750upx;
font-size: 32rpx;
flex-direction: column;
justify-content: center;
align-items: center;
bottom: 20px;
left: 0;
position: fixed;
}
.hint {
color: #999999;
font-size: 26rpx;
}
.icon {
width: 34rpx;
}
#download {
background-color: #2A9839;
color: #FFFFFF;
margin: 55rpx;
padding: 5px;
height: 30px;
width: 160rpx;
border-radius: 100px;
flex-direction: row;
align-items: center;
justify-content: center;
}
.download-text {
font-size: 32rpx;
}
.mask {
position: fixed;
top: 0;
left: 0;
width: 750rpx;
height: 100vh;
flex-direction: row;
justify-content: flex-end;
background-color: rgba(0, 0, 0, 0.6);
}
.mask image {
width: 600rpx;
}
</style>