<template>
	<view class="main">
		<view class="one">
			<swiper class="swiper" circular :indicator-dots="true" indicator-color="#F5F5F5"
				indicator-active-color="#ffffff" :autoplay="false" :interval="3000" :duration="1000">
				<swiper-item class="list" v-for="(item,index) in advertList" :key="index">
					<image class="image" :src="item.image&&item.image.length>0?item.image[0].url:''" mode=""></image>
				</swiper-item>
			</swiper>
		</view>
		<view class="two">
			<uni-collapse>
				<uni-collapse-item title="群组" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
					<view class="content">
						<text class="text">群组</text>
					</view>
				</uni-collapse-item>
				<uni-collapse-item title="好友" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
					<view class="content">
						<text class="text">群组</text>
					</view>
				</uni-collapse-item>
			</uni-collapse>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {},
				// 广告
				advertList: []
			}
		},
		onLoad: async function(e) {
			const that = this;
			that.searchToken();
			await that.searchOther();
			await that.search();
		},
		methods: {
			// 用户信息
			searchToken() {
				const that = this;
				try {
					const res = uni.getStorageSync('token');
					if (res) that.$set(that, `user`, res);
				} catch (e) {
					uni.showToast({
						title: err.errmsg,
						icon: 'error',
						duration: 2000
					});
				}
			},
			// 查询
			async search() {
				const that = this;
				let res;
			},
			// 查询其他信息
			async searchOther() {
				const that = this;
				let res;
				// // 查询类型
				// res = await that.$api(`/dictData`, 'GET', {
				// 	type: 'home_tabs',
				// 	is_use: '0',
				// })
				// if (res.errcode == '0') that.$set(that, `typeList`, res.data);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		.one {
			padding: 0 0 2vw 0;

			.swiper {
				height: 60vw;

				.list {
					.image {
						width: 100%;
						height: 100%;
					}
				}
			}
		}
	}
</style>