<template>
<u-mask :show="show">
	<view class="container">
		<image @click="onClickCallback()" class="close" src="/static/imgs/close.png" mode="widthFix"></image>
		<image src="/static/imgs/loginReindIcon.png" class="loginReindIcon" mode="widthFix"></image>
		<view class="title">登录提醒</view>
		<view class="hint">登录小程序购买还可赚取商品佣金</view>
		<view class="button loginButton" @click="goLogin">立即登录</view>
		<!-- <navigator class="button" target="miniProgram" v-if="weChatShortLink" :short-link="weChatShortLink">直接购买</navigator> -->
		<view class="button" @click="onClickCallback('ZJGM')">直接购买</view>
		<view class="neverNotify" @click="checkboxChange">
			<view :class="['itemCheckbox', checkValue ? 'itemCheckboxActive' : '']"></view>
			<text>不再提醒</text>
		</view>
	</view>
</u-mask>
</template>

<script>
	export default {
		props:{
			show:{
				type: Boolean,
				default: false
			},
			weChatShortLink:{
				type: String,
				default: ''
			},
      MiniProId:{
        type: String,
        default: ''
      },
      MiniProPath:{
        type: String,
        default: ''
      },
      wordCommand:{
        type: String,
        default: ''
      }

		},
		name:"loginRemind",
		data() {
			return {
				neverNotify: false,
				checkValue: false
			};
		},
		mounted(){
		},
		methods:{
			checkboxChange(){
				this.checkValue = !this.checkValue;
				if (this.checkValue) {
					uni.setStorageSync('loginRemindMask', true)
				} else {
					uni.setStorageSync('loginRemindMask', false)
				}
			},
			onClickCallback(val){
        this.$emit('callback',val)
				if (val == 'ZJGM' && this.weChatShortLink) {
					wx.navigateToMiniProgram({
						'shortLink': this.weChatShortLink
					})
				}else if(val == 'ZJGM' && this.wordCommand){ //抖音
          this.$copyEvent({ text: this.wordCommand })
        }else if(val == 'ZJGM'){ // 拼多多
          if(!this.MiniProId){
            uni.showToast({ title: '跳转小程序id错误', icon: 'none' })
          }else if(!this.MiniProPath){
            uni.showToast({ title: '跳转小程序路径错误', icon: 'none' })
          }else{
            wx.navigateToMiniProgram({
              appId: this.MiniProId,
              path: this.MiniProPath
            })
          }
        }else{
          uni.showToast({ title: '暂无口令', icon: 'none' })
        }
			},
			goLogin(){
				this.$emit('callback')
				uni.navigateTo({
				  url: '/pages/subPackages/login/loginPhone'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.container{
	width: 650rpx;
	height: 720rpx;
	background: url('~@/static/imgs/loginReindBg.png') #fff no-repeat;
	// background-image: url("/static/imgs/loginReindBg.png");
	background-size: 100%;
	border-radius: 82rpx 82rpx 36rpx 36rpx;
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	margin: auto;
}
.loginReindIcon{
	width: 300rpx;
	position: absolute;
	top: -80rpx;
	left: 0;
	right: 0;
	margin: auto;
}
.title{
	color: #333333;
	font-size: 44rpx;
	line-height: 60rpx;
	font-weight: bold;
	text-align: center;
	margin-top: 152rpx;
}
.hint{
	color: #333333;
	font-size: 32rpx;
	line-height: 44rpx;
	margin-top: 58rpx;
	margin-bottom: 50rpx;
	text-align: center;
}
.button{
	width: 492rpx;
	height: 108rpx;
	border-radius: 54rpx;
	border: 2rpx solid #C1C1C1;
	color: #9E9E9E;
	font-size: 36rpx;
	line-height: 108rpx;
	text-align: center;
	margin:auto;
}
.loginButton{
	background: linear-gradient(90deg, #FF9048 0%, #FB3F3C 100%);
	color: #fff;
	border: none;
	margin-bottom: 28rpx;
}
.neverNotify{
	text-align: center;
	font-size: 28rpx;
	margin-top: 30rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	text{
		color: #636262;
		font-size: 28rpx;
	}
}
.itemCheckbox{
	width: 30rpx;
	height: 30rpx;
	border: 2rpx solid #d3d4d6;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	margin-right: 10rpx;
}
.itemCheckboxActive{
	border-color: #FB3F3C;
	background-color: #FB3F3C;
	position: relative;
	border-radius: 50%;
	margin-right: 10rpx;
	&::after{
	  box-sizing: content-box;
	  content: "";
	  border: 2rpx solid #fff;
	  border-left: 0;
	  border-top: 0;
	  position: absolute;
	  top: 1rpx;
	  width: 4rpx;
	  transform: rotate(45deg) scaleY(1);
	  height: 16rpx;
	  left: 10rpx;
	}
}
.close {
	position: absolute;
	bottom: -100rpx;
	left: 0;
	right: 0;
	margin: auto;
	width: 60rpx;
	height: 60rpx;
}
</style>
