<template>
	<view class="setMain">
		<view class="cu-card ">
			<view class="cu-item shadow padding-lr-sm" v-for="(item, index) in path_list" :key="index">
				<view class="flex padding-tb-sm justify-between">
					<view class="flex align-center">
						<view class="subscribe">{{item.label}}</view>
					</view>
					<view>
						<uv-icon name="arrow-right"></uv-icon>
					</view>
				</view>
			</view>
		</view>
		<view class="outLoginBtn">
			<u-button @click="logOut" shape='circle'>退出登录</u-button>
		</view>
		<uv-picker ref="changepicker" :columns="columns" @confirm="confirm_picker"></uv-picker>
	</view>
</template>

<script setup>
	import {
		reactive,
		ref,
	} from "vue";
	import {
		onLoad,
		onShow,
		onReachBottom
	} from "@dcloudio/uni-app";
	import config from '@/common/config/config.js';
	// import {
	// 	useCounterStore
	// } from '../../../stores/counter';
	// const outUser = useCounterStore()

	import {
		globalStore
	} from '../../../stores/globalData.js';
	// 
	const outLogin = globalStore()
	let subscribeValue = ref(false)
	const changepicker = ref(null)
	const path_list = reactive([{
			label: '关于我们',
			path: ''
		},
		{
			label: '操作指南',
			path: ''
		},
		{
			label: '用户协议',
			path: ''
		},
		{
			label: '充值协议',
			path: ''
		},
		{
			label: '隐私政策',
			path: ''
		},
		{
			label: '应用权限说明',
			path: ''
		},
		{
			label: '检查版本更新',
			path: ''
		},
	])
	const columns = reactive([
		[
			'个人版', '车队版'
		]
	])
	// 
	onShow(() => {
		// uni.$request({
		// 	url: config.baseUrl + 'service-openapi/message/subscribe/get',
		// }).then((res) => {
		// 	console.log(res.data.data.subscribe, 'res===========');
		// 	if (res.data.data.subscribe == 1) {
		// 		subscribeValue.value = true
		// 	} else {
		// 		subscribeValue.value = false
		// 	}
		// })
	})
	// 
	const logOut = () => {
		uni.removeStorageSync("userInfo");
		uni.removeStorageSync("token");
		uni.removeStorageSync("refreshToken");
		uni.removeStorageSync("teamId");
		uni.removeStorageSync("realNameAuthFlag");
		uni.removeStorageSync("version");
		outLogin.isLogin = false
		uni.navigateBack({
			delta: 2
		});
	}
	const subscribeChange = () => {
		// console.log('change', e);
		// uni.showLoading({
		// 	title: '加载中'
		// });
		changepicker.value.open()
	}
	const confirm_picker = (e) => {
		// console.log(e, 'e')
		uni.showLoading({
			title: '加载中'
		});
		if (e.value[0] == '个人版') {
			uni.setStorageSync('version', 1)
		} else if (e.value[0] == '车队版') {
			uni.setStorageSync('version', 2)
		}
		uni.hideLoading()
	}
</script>

<style lang="scss" scoped>
	.setMain {
		width: 100%;
		height: 100vh;
		background: #F7F8FA;
		position: relative;
	}

	.outLoginBtn {
		width: 80%;
		position: fixed;
		bottom: 50rpx;
		left: 10%;
	}

	.subscribe {
		font-size: 14px;
		font-weight: 400;
		color: #585858;

	}

	.cu-card>.cu-item {
		box-shadow: 4px 12px 20px 0px #B3CBEE29;
		box-shadow: 0px -2px 10px 0px #B5DBD51F;
	}
</style>