<template>
  <view class="page-container">
    <view class="setup-nav card">
      <navigator url="/pages/user/info" class="nav-item">
        <text class="nav-title">账号安全</text>
        <uni-icons type="forward" color="#a2a2a2" size="14"></uni-icons>
      </navigator>
    </view>
    <view class="setup-nav card">
		<view class="nav-item" @click="checkVersion">
			<text class="nav-title">当前版本</text>
			<text class="nav-value">{{version}}</text>
			<uni-icons type="forward" color="#a2a2a2" size="14"></uni-icons>
		</view>
     
      <navigator url="/pages/user/agreement" class="nav-item">
        <text class="nav-title">用户协议</text>
        <uni-icons type="forward" color="#a2a2a2" size="14"></uni-icons>
      </navigator>
      <navigator url="/pages/user/privacy" class="nav-item">
        <text class="nav-title">隐私政策</text>
        <uni-icons type="forward" color="#a2a2a2" size="14"></uni-icons>
      </navigator>
      <navigator url="/pages/feedback/feedback" class="nav-item">
        <text class="nav-title">意见反馈</text>
        <uni-icons type="forward" color="#a2a2a2" size="14"></uni-icons>
      </navigator>
    </view>
  </view>
</template>

<script>
	// #ifdef APP-PLUS
	import APPUpdate, {
		getCurrentNo
	} from "@/plugins/APPUpdate";
	// #endif
	export default {
		data() {
			return {
				version: ''
			}
		},
		async onLoad() {
			// #ifdef APP-PLUS
			await getCurrentNo(res => {
				this.version = res.versionName;
			});
			// #endif	
			// #ifdef H5
			let httpData = uni.getStorageSync('platform') || {};
			this.version = httpData.versionCode
			// #endif
		},
  methods: {
    checkVersion() {
		// #ifdef APP-PLUS
		APPUpdate(true)
		// #endif
    }
  }
}
</script>

<style lang="scss">
.page-container {
  padding: 15px 0 0;
  background-color: $uni-bg-color;
  .setup-nav {
    margin: 0 0px 15px;
    .nav-item {
      width: 100%;
      padding: 14px 15px;
      display: flex;
      align-items: center;
      border-bottom: 1px solid #f5f5f5;
      &:last-child {
        border: none;
      }
      .nav-title {
        flex: 1 1 0%;
        margin-right: 10px;
        color: #1a1a2a;
        font-size: 15px;
      }
      .nav-value {
        margin-right: 10px;
        color: #8a8a8a;
        font-size: 15px;
      }
    }
  }
}
</style>