<template>
  <view class="wrap">
    <u-toast ref="uToast" />

    <u-gap height="20" bg-color="#f5f5f5"></u-gap>
    <u-cell-group :border="false">
      <u-cell-item :title="$t('homePage.mine.general')" @click="navTo('/pages/sys/user/currency')" :arrow="true"></u-cell-item>
      <u-gap height="20" bg-color="#f5f5f5"></u-gap>
      <u-cell-item :title="$t('homePage.mine.version')" :arrow="false">{{ innerVer }}</u-cell-item>
      <!-- <u-cell-item title="版本更新" @click="navTo('')" :arrow="true"></u-cell-item> -->
      <u-cell-item :title="$t('homePage.mine.Privacy')" @click="navTo('')" :arrow="true"></u-cell-item>
      <u-cell-item :title="$t('homePage.mine.UserAgreement')" @click="navTo('')" :arrow="true"></u-cell-item>
    </u-cell-group>
    <u-gap height="20" bg-color="#f5f5f5"></u-gap>
    <view>
      <button class="sign-out" @click="logout" :hair-line="false">
        {{ this.$t('homePage.mine.logOut') }}
      </button>
    </view>
  </view>
</template>
<script>
import config from "../../../common/config";

export default {
  data() {
    return {
      config,
      innerVer: config.productVersion,
      versionCode: null,
    };
  },
  computed:{
	  language(){
	  	return this.vuex_language 
	  },
  },
  watch: {
  	language: {
  		immediate: true,
  		deep:true,
  		handler(val) {
  			uni.setNavigationBarTitle({
  				title: this.$t('homePage.mine.sysSetting')
  			});
  		}
  	},
  },
  onShow() {

  },
  methods: {
    navTo(url) {
      if (url === "") {
        this.$refs.uToast.show({
          title: this.$t('homePage.mine.notAva'),
          type: "warning",
        });
      }

      uni.navigateTo({
        url: url,
      });
    },
    openSettings() {
      // #ifdef APP-PLUS
      uni.getSystemInfo({
        success(res) {
          if (res.platform == "ios") {
            plus.runtime.openURL("app-settings://");
          } else if (res.platform == "android") {
            var main = plus.android.runtimeMainActivity();
            var Intent = plus.android.importClass("android.content.Intent");
            var mIntent = new Intent("android.settings.SOUND_SETTINGS");
            main.startActivity(mIntent);
          }
        },
      });
      // #endif
      // #ifndef APP-PLUS
      this.$u.toast(this.$t('homePage.mine.noUpdate'));
      // #endif
    },

    logout() {
      this.$u.api.logout().then((res) => {
        if (res.code == 200) {
          setTimeout(() => {
            uni.reLaunch({
              url: "/pages/login/index",
            });
          }, 500);
        }
      });
    },
  },
};
</script>
<style lang="scss">
page {
  background-color: #f5f5f5;
}

.sign-out {
  width: 750rpx;
  height: 100rpx;
  line-height: 100rpx;
  font-size: 30rpx;
  color: #ef2121;
}

/deep/ .u-cell-title {
  padding: 25rpx 30rpx;
  font-size: 24rpx;
}
</style>
