<script>
// #ifdef APP-PLUS
import APPUpdate, { getCurrentNo } from "@/config/appUpdate";
// #endif
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {
      version: "",
    };
  },
  onLaunch: function () {
    uni.setStorageSync("isImSound", true);
    // #ifdef APP-PLUS
    getCurrentNo((res) => {
      this.version = res.version;
    });

    const hasAgreed = uni.getStorageSync("isNeedAgreementDialog");
    if (hasAgreed) {
      this.onAPPUpdate();
    }

    // #endif
  },
  computed: {
    ...mapState("user", ["uid", "userInfo", "socket"]),
  },
  onShow: function () {
    setTimeout(() => {
      if (this.userInfo && Object.keys(this.userInfo).length > 0) {
        this.connectSocket(this.userInfo);
      }
    });
  },
  onHide: function () {},
  onBackPress: function () {},
  methods: {
    ...mapActions("user", ["connectSocket"]),
    onAPPUpdate() {
      APPUpdate(this.version);
    },
  },
};
</script>

<style lang="scss">
// @import "./uni_modules/uview-ui/index.scss";
// @import "./uni_modules/uview-ui/theme.scss";
/*每个页面公共css */
@import "@/static/reset.css";
@import "@/styles/myui.scss";

@import "@/static/font/iconfont.css";

/deep/.uni-tabbar-bottom {
  display: none;
}

/deep/.uni-navbar {
  min-height: 110rpx;
}
</style>
