<template>
	<view class="uni-popup-share">
		<view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view>
		<view class="uni-share-content">
			<view class="uni-share-content-box">
				<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)">
					<view class="" style="background: #FFFFFF; border-radius: 50%;width: 60rpx;height: 60rpx;">
						<view style="font-size: 50rpx;text-align: center;margin-top: 5rpx;" :class="item.icon">
						</view>
					</view>
						
					<view class="">
						<text class="uni-share-text">{{item.text}}</text>
					</view>
				</view>

			</view>
		</view>
		<!-- <image src="" mode=""></image> -->
	<!-- 	<view class="uni-share-button-box">
			<button class="uni-share-button" @click="close">{{cancelText}}</button>
		</view> -->
	</view>
</template>

<script>
	import popup from '../uni-popup/popup.js'
	import {
	initVueI18n
	} from '@dcloudio/uni-i18n'
	import messages from '../uni-popup/i18n/index.js'
	const {	t	} = initVueI18n(messages)
	export default {
		name: 'UniPopupShare',
		mixins:[popup],
		emits:['select'],
		props: {
			title: {
				type: String,
				default: ''
			},
			beforeClose: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				bottomData: [{
						text: '首页',
						icon: 'iconfont icon-shouye',
						name: 'home',
						link:'/pages/index/index'
					},
					{
						text: '搜索',
						icon: 'iconfont icon-sousuo',
						name: 'searh',
						link:'/pages/courselist/courselist'
					},
					{
						text: '我的',
						icon: 'iconfont icon-wode',
						name: 'user',
						link:'/pages/personalCenter/personalCenter'
					},
					{
						text: '消息',
						icon: 'iconfont icon-xiaoxi',
						name: 'news',
						link:'/pages/systemMsg/system_msg'
					},
					// {
					// 	text: '百度',
					// 	icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
					// 	name: 'copy'
					// },
					// {
					// 	text: '其他',
					// 	icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
					// 	name: 'more'
					// }
				]
			}
		},
		created() {},
		computed: {
			cancelText() {
				return t("uni-popup.cancel")
			},
		shareTitleText() {
				return this.title || '快捷入口'
			}
		},
		methods: {
			/**
			 * 选择内容
			 */
			select(item, index) {
				this.$emit('select', {
					item,
					index
				})
				this.close()

			},
			/**
			 * 关闭窗口
			 */
			close() {
				if(this.beforeClose) return
				this.$emit('close', false)
				this.popup.close()
			}
		}
	}
</script>
<style lang="scss" >
	.uni-popup-share {
		background-color: #F4F2F3;
		// background-color: #fff;
		border-top-left-radius: 11rpx;
		border-top-right-radius: 11rpx;
	}
	.uni-share-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		height: 40rpx;
	}
	.uni-share-title-text {
		font-size: 30rpx;
		color: #666;
	}
	.uni-share-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding-top: 10rpx;
	}

	.uni-share-content-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
		// width: 360rpx;
	}

	.uni-share-content-item {
		width: 90rpx;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		padding: 10rpx 40rpx;
		align-items: center;
	}

	.uni-share-content-item:active {
		background-color: #f5f5f5;
	}

	.uni-share-image {
		width: 60rpx;
		height: 60rpx;
	}

	.uni-share-text {
		margin-top: 10rpx;
		font-size: 30rpx;
		color: #3B4144;
	}

	.uni-share-button-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		padding: 10rpx 15rpx;
	}

	.uni-share-button {
		flex: 1;
		border-radius: 50rpx;
		color: #666;
		font-size: 16rpx;
	}

	.uni-share-button::after {
		border-radius: 50rpx;
	}
</style>
