<template>
  <view class="page">
    <image src="../../assets/img/homeImg.jpg" mode="scaleToFill" />
    <view class="bottomBox">
      <view class="orangeBtn" @click="toChooseStyle">拍摄数码写真</view>
      <view class="IMEI" @click="Imei">i</view>
    </view>
  </view>
</template>

<script setup>
//#region 导入
import { ref } from "vue";
//#endregion ----------------------------------

function toChooseStyle() {
  uni.navigateTo({ url: "/pages/chooseStyle/index" });
}

//#region 初始化

//#endregion ----------------------------------

//#region getImei
function Imei() {
  try {
    const IMEI = window.webview.raiseEvent("getIMEI", "test_params");
    // window.webview.raiseEvent("getSerial", "test_params");
    // window.webview.raiseEvent("getTestStr", "test_params");
    // const IMEI = window.android.getIMEI();
    // const IMEI = window.android.getSerial();
    // const IMEI = window.android.getTestStr();
    uni.showToast({
      title: IMEI,
      icon: "success",
    });
  } catch (error) {
    uni.showToast({
      title: "Error",
      icon: "error",
    });
  }

  // cordova.exec(
  //   function (imei) {
  //     console.log("IMEI:", imei);
  //   },
  //   function (error) {
  //     console.error("Failed to get IMEI:", error);
  //   },
  //   "MyPlugin",
  //   "getIMEI",
  //   []
  // );
}

//#endregion ----------------------------------

//#region 登录

//#endregion ----------------------------------
</script>

<style lang="scss" scoped>
.page {
  padding: 0;
  position: relative;
  width: 100vw;
  height: 100vh;
  image {
    position: absolute;
    width: 100%;
    height: 100%;
  }
  .bottomBox {
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 100rpx 0;
    width: 100%;
    height: 300rpx;
    background-color: rgba($color: #000000, $alpha: 0.5);
    .IMEI {
      position: absolute;
      bottom: 20rpx;
      right: 20rpx;
      width: 40rpx;
      height: 40rpx;
      line-height: 40rpx;
      text-align: center;
    }
  }
}
</style>
