<template>
	<view :style="vuex_skin">
		<u-cell-group>
			<u-cell-item v-for="(item,index) in menuList" :key="index" @click="jump(item)" :icon="item.icon"
				:title="item.title"></u-cell-item>
		</u-cell-group>

		<view v-if="vuex_userId" class="center" style="margin-top: 200rpx;">
			<button @click="logout" class="cu-btn  flex  text-lg bg-base radius" style="padding: 42rpx 0;width: 90%;">
				退出登录
			</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuList: [{
						icon: 'question-circle',
						title: '积分兑换规则', //显示的title
						name: '积分规则', //对应后端获取数据的title
						path: '/pages/introduce/notice'
					},
					{
						icon: 'bookmark',
						title: '用户隐私协议',
						name: '用户隐私协议',
						path: '/pages/introduce/notice'
					}
				]
			}
		},
		onLoad() {
			// #ifdef MP-WEIXIN
			let obj = {
				icon: 'account',
				title: '用户授权设置',
				path: ''
			}
			this.menuList.push(obj)
			// #endif
		},
		methods: {
			jump(item) {
				if (item.title == '用户授权设置') {
					uni.openSetting({
						success(res) {
							console.log(res.authSetting)
						}
					});
					return
				}
				let params = {
					title: item.name,
					isGobal: true
				}
				uni.navigateTo({
					url: item.path + this.$u.queryParams(params)
				})
			},
			logout() {
				this.$cache.clear()
				this.$u.vuex('vuex_userId', null)
				this.$u.vuex('vuex_phone', null)
				uni.reLaunch({
					url: "/pages/mine/mine"
				})
			},
		}
	}
</script>

<style>

</style>
