<template>
  <oa-scroll
    customClass="doorSetting-container scroll-height"
    :customStyle="{
      //#ifdef APP-PLUS || MP-WEIXIN
      height: `calc(100vh - (0px))`,
      //#endif
      //#ifdef H5
      height: `calc(100vh - (0px))`,
      //#endif
    }"
    :refresherLoad="false"
    :refresherEnabled="false"
    :refresherDefaultStyle="'none'"
    :refresherBackground="'#f5f6f7'"
    :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  >
    <template #default>
      <text class="iconfont oaIcon-exit" @click="handleExit()"></text>

      <view class="Grid">
        <view class="Grid-item" @click="handle('serve')">
          <image class="Grid-item-image" src="@/static/face/img/serveSetting.png"></image>
          <view class="Grid-item-lable">服务器配置</view>
        </view>
        <view class="Grid-item" @click="handle('other')">
          <image class="Grid-item-image" src="@/static/face/img/otherSetting.png"></image>
          <view class="Grid-item-lable">门禁配置</view>
        </view>
        <view class="Grid-item" @click="handle('sysetm')">
          <image class="Grid-item-image" src="@/static/face/img/sysetmSetting.png"></image>
          <view class="Grid-item-lable">更多配置</view>
        </view>
        <view class="Grid-item" @click="handle('public')">
          <image class="Grid-item-image" src="@/static/face/img/sysetmSetting.png"></image>
          <view class="Grid-item-lable">公共设置</view>
        </view>
        <view class="Grid-item" @click="startActivity()">
          <image class="Grid-item-image" src="@/static/face/img/sysetmSetting.png"></image>
          <view class="Grid-item-lable">测试</view>
        </view>
      </view>
    </template>
  </oa-scroll>
</template>
<script setup>
/*----------------------------------依赖引入-----------------------------------*/
import config from "@/config";
import { onLoad, onShow, onReady, onHide, onLaunch, onUnload, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
import { ref, reactive, computed, getCurrentInstance, toRefs, inject, nextTick, watch } from "vue";
/*----------------------------------接口引入-----------------------------------*/
/*----------------------------------组件引入-----------------------------------*/
/*----------------------------------store引入-----------------------------------*/
import { controlStores, commonStores } from "@/store/modules/index";
/*----------------------------------公共方法引入-----------------------------------*/
const { proxy } = getCurrentInstance();
const controlStore = controlStores();
const commonStore = commonStores();
/*----------------------------------公共变量-----------------------------------*/
const state = reactive({});
const {} = toRefs(state);

function handle(type) {
  if (type == "serve") {
    proxy.$tab.navigateTo("/pages/door/setting/serve/index");
  } else if (type == "other") {
    if (!controlStore.form.linkUrl) {
      proxy.$modal.msg("请先配置服务器信息!");
      return;
    }
    proxy.$tab.navigateTo("/pages/door/setting/other/index");
  } else if (type == "public") {
    proxy.$tab.navigateTo("/pages/door/setting/public/index");
  } else if (type == "sysetm") {
    proxy.$tab.navigateTo("/pages/door/setting/system/index");
  }
}

function handleExit() {
  proxy.$tab.navigateBack(1);
}

function startActivity() {
  proxy.$sys.getEthernetIpAddress();

  //#ifdef APP-PLUS
  const phPlugin = uni.requireNativePlugin("phPlugin");
  phPlugin.startActivity();
  //#endif
}

onLoad((options) => {
  controlStore.initData(); //初始化数据
});
</script>
<style lang="scss">
@import "./index.scss";
</style>
