<template>
  <div>
    <van-sticky class="sticky">
      <div class="header">
        <div class="back">
          <backIcon/>
        </div>
        <!-- 设置 -->
        {{ $t('setting.btn3') }}
      </div>
    </van-sticky>
    <div class="ul">
      <div class="li flex" @click="$router.push('/statement/privacy')">
        <div>
          <!-- 隐私政策 -->
          {{ $t('about.l8') }}
        </div>
        <img class="arrow-right" src="/img/my/icon12.png" alt="极度证券">
      </div>
      <div class="li flex" @click="$router.push('/statement/user')">
        <div>
          <!-- 用户协议 -->
          {{ $t('auth.l28') }}
        </div>
        <img class="arrow-right" src="/img/my/icon12.png" alt="极度证券">
      </div>
      <div class="li flex" @click="confirmPopup = true">
        <div>
          <!-- 清除缓存 -->
          {{ $t('about.l9') }}
        </div>
        <img class="arrow-right" src="/img/my/icon12.png" alt="极度证券">
      </div>
      <div class="li flex" @click="$router.push('/about')">
        <div>
          <!-- 关于 -->
          {{ $t('about.l') }}
        </div>
        <img class="arrow-right" src="/img/my/icon12.png" alt="极度证券">
      </div>
      <div class="btn" v-if="isLogin" @click="logOutPop = true">
        <!-- 安全退出 -->
        {{ $t('home.l28') }}
      </div>
      <div class="btn" v-if="!isLogin" @click="$router.replace('/login')">
        <!-- 登录 -->
        {{ $t('login.l') }}
      </div>
    </div>
    <van-popup get-container="body" v-model="logOutPop" round position="bottom">
      <logout @cancel="logOutPop = false" @success="logout"/>
    </van-popup>
    <van-popup get-container="body" :close-on-click-overlay="false" v-model="confirmPopup" :style="{ width: '324px' }">
      <clearCache @cancel="confirmPopup = false" />
    </van-popup>
  </div>
</template>
<script>
import { logOut } from '@/api/login'
import logout from "./components/logout.vue";
import clearCache from "./components/clearCache.vue";
import bus from '@/utils/bus'
export default {
  components: {
    logout,
    clearCache
  },
  data () {
    return {
      logOutPop: false,
      confirmPopup: false,
    }
  },
  methods: {
    logout() {
      // logOut().then(() => {
      // }).catch(() => {}).finally(() => {
      // });
      this.$notify({
        // message: '退出成功',
        message: this.$t('home.l29'),
        type: 'success'
      });
      this.logOutPop = false
      this.$store.commit('SET_LOGIN', false)
      this.$store.commit('setAccountList', [])
      this.$store.commit('setCashInfo', {})
      this.$store.dispatch('getProductUserList')
      bus.$emit('socketInit')
    }
  }
}
</script>
<style lang="less" scoped>
.sticky {
  background-color: var(--bg-);
}
.header {
  position: relative;
  text-align: center;
  padding-top: 15px;
  padding-bottom: 17px;
  font-size: 18px;
  font-weight: 600;
  background-color: var(--bg-);
  .back {
    position: absolute;
    left: 9px;
    top: 11px;
  }
}
.ul {
  padding: 0 17px 20px;
  .li {
    cursor: pointer;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid #F1F1F1;
    height: 50px;
    justify-content: space-between;
    font-size: 16px;
    padding: 0 13px;
  }
  .arrow-right {
    width: 6px;
  }
}
.btn {
  cursor: pointer;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #F1F1F1;
  line-height: 42px;
  font-size: 16px;
  margin-top: 50px;
}
</style>