<template>
    <view class="opinion">
        <!-- 反馈 -->
        <view class="list">
            <button class="item" :open-type="item.id === 0 ? 'feedback' : '' " v-for="item in opinionList" :key="item.id" @click="clickOpinion(item)">
                <text>{{ item.label }}</text>
                <van-icon name="arrow" size="22rpx"/>
            </button>
        </view>
        <!-- 退出登录 -->
        <view class="login-out" @click="outLogin">
            退出登录
        </view>
    </view>
</template>

<script>
import Tip from '@/utils/tip'
const opinionList = Object.freeze([
    {
        id: 0,
        label: '意见反馈'
    }
])
export default {
  name: 'setting',
  onUnload () {
      clearTimeout(this.time)
  },
  data () {
      return {
          opinionList,
          time: ''
      }
  },
  methods: {

      clickOpinion(records) {
          console.log(records);
          switch (records.id) {
              case 0:
                  uni.
                  break;
          
              default:
                  break;
          }
      },

      outLogin () {
          Tip.confirm('确定要退出吗？').then(res => {
              if (res) {
                Tip.loading('正在退出')
                this.time = setTimeout( () => {
                    Tip.loaded()
                    uni.clearStorageSync()
                    uni.reLaunch({
                        url: '/pages/index/index'
                    })
                }, 1000)
              }
          }) 
      }
  },
}
</script>
<style scoped lang="less">
.opinion {
    width: 100vw;
    height: 100vh;
    background: #F9F7F7;
    overflow: hidden;
    font-size: 28rpx;
    font-weight: 600;
    color: #161616;
    .list {
        width: 686rpx;
        background: #FFFFFF;
        box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(235, 235, 235, 0.5);
        margin: 0 auto;
        border-radius: 20rpx;
        overflow: hidden;
        margin-top: 24rpx;
        .item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 100rpx;
            padding: 0rpx 24rpx 0rpx 32rpx;
            box-sizing: border-box;
            border: none;
            background-color: #fff;
            text {
                font-size: 32rpx;
                font-weight: 500;
                color: #333333;
            }
        }
        .item::after {
            border: none;
        }
    }
    .login-out {
      width: 534rpx;
      height: 92rpx;
      background: #1677FF;
      box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(235, 235, 235, 0.5);
      border-radius: 46rpx;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 28rpx;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #FFFFFF;
      margin: 0 auto;
      margin-top: 80rpx;
    }
}
</style>