<template>
	<view>
		<view class="createDetail" @click="open">
			<uv-icon size="40rpx" color="#fff" name="plus"></uv-icon>
		</view>

		<uv-popup ref="createDetailPopup" :round="30">
			<view class="createDetailPopup">
				<view class="" :key="index" @click="clickItem(item)" v-for="(item, index) in createDetail">
					<image :src="item.image" style="width: 90rpx;height: 90rpx;" mode="aspectFill"></image>

					<view class="info">
						<view class="title">
							{{ item.name }}
						</view>
						<view class="desc">
							{{ item.context }}
						</view>
					</view>
					<view class="icon">
						<uv-icon size="30rpx" name="arrow-right"></uv-icon>
					</view>
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				createDetail: [],
			}
		},
		created() {
			this.getData()
		},
		methods: {
			open(){
				if(!uni.getStorageSync('token')){
					uni.navigateTo({
						url: '/pages_order/auth/wxLogin'
					})
					return
				}
				this.$refs.createDetailPopup.open('bottom')
			},
			getData() {
				this.$api('getPublishList', res => {
					if (res.code == 200) {
						this.createDetail = res.result
					}
				})
			},
			clickItem(item) {
				this.$utils.navigateTo(item.url)
				this.$refs.createDetailPopup.close()
			},
		}
	}
</script>

<style scoped lang="scss">
	.createDetail {
		position: fixed;
		top: 70vh;
		right: 50rpx;
		width: 100rpx;
		height: 100rpx;
		background-color: $uni-color;
		border-radius: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		box-shadow: 0 0 10rpx 10rpx rgba(#000, 0.1);
		z-index: 99;
	}

	.createDetailPopup {
		padding: 20rpx;
		background-color: #ffffff;

		&>view {
			display: flex;
			align-items: center;
			padding: 24rpx;
			background-color: #f7f7f7;
			margin: 20rpx;
			border-radius: 20rpx;

			image {
				width: 100rpx;
				height: 100rpx;
				margin-right: 20rpx;
			}

			.info {
				.title {
					font-size: 30rpx;
				}

				.desc {
					font-size: 24rpx;
				}
			}

			.icon {
				margin-left: auto;
			}
		}
	}
</style>