<template>
	<!-- 设置 -->
	<view class="setting-view">
		<u-navbar back-icon-color="#333333" background="#FFFFFF" title="设置" titleColor="#333333"
			:border-bottom="false" title-bold></u-navbar>
		<view class="list-view">
			<u-cell-group :border="false">
				<view v-for="(item, index) in items" :key="index">
					<u-cell-item :value="item.value" :border-bottom="false" @click="handleClick(item.pathName)">
						<image slot="icon" :src="item.icon" :style="item.imageStyle"></image>
						<view slot="title" class="item-title">{{item.title}}</view>
						<view slot="value" class="item-value">{{value}}</view>
					</u-cell-item>
				</view>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			};
		},
		computed: {
			items() {
				return [
					{
						pathName: 'about',
						title: '当前版本',
						value: process.uniEnv.version_number,
						icon: process.uniEnv.qn_base_url + 'version.png',
						imageStyle: 'width:32rpx;height:32rpx'
					}
				]
			}
		},
		onLoad() {
			getApp().trackPage('设置')
		},
		methods: {
			handleClick(path) {
				if(this.vuex_token) {
					if (path === 'about') {
						 getApp().updateApp(1)
						return
					}
					this.$u.route({
						url: 'pages/mine/' + path + '/index'
					})
				} else {
					this.$u.route({url: "pages/login/index"})
				}
			},
		}
	};
</script>

<style lang="scss" scoped>
	.setting-view {
		padding-bottom: 44px;
		height: 100vh;
		display: flex;
		flex-direction: column;
		background-color: #F4F5F7;
		.list-view {
			height: 100%;
			margin-top: 30rpx;

				.item-title {
					font-size: 32rpx;
					color: #333333;
					margin-left: 16rpx;
					line-height: 32rpx;
				}
				
				.item-value {
					font-size: 26rpx;
					color: #999999;
				}
				
				.line-view {
					height: 2rpx;
					background-color: #F4F5F7;
					margin: 30rpx;
				}
			
		}
	}
</style>
