<template>
	<view class="body">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<block v-for="(item,index) in list" :key="index">
			<my-list-item :item="item" :index="index" @weixinMsg="weixinMsg" :someData="status"></my-list-item>
		</block>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex"
	import myListItem from "@/components/modules/my/my-list-item.vue";
	export default {
		components: {
			myListItem
		},
		data() {
			return {
				list: [{
						icon: "",
						name: "修改密码",
						clicktype: "navigateTo",
						url: "/pages/set/password",
						text: "去设置",
						auth: true
					},
					{
						icon: "",
						name: "修改手机号",
						clicktype: "navigateTo",
						url: "/pages/set/mobile",
						text: '',
						auth: true
					},
					{
						icon: "",
						name: "微信",
						clicktype: "weixin",
						url: "",
						text: '未绑定',
					},
				],
				status: false,
			}
		},
		async onLoad() {
			this.list[1].text = this.userInfo.sysUser.mobile;
			let res = await this.$http.get("/user/isBindWechat")
			if (res.code == '200') {
				this.list[2].text = "已绑定"
				this.status = true;
				this.list[2].text
			} else {
				this.status = false;
			}
		},
		computed: {
			...mapState(["userInfo"])
		},
		methods: {
			weixinMsg(mag) {
				uni.showToast({
					title: mag.msg,
					icon: "none"
				});

			},
		}
	}
</script>

<style>
</style>