<script>
export default {
  onLaunch: function () {
    console.log("App Launch");
    uni.showLoading({
      title: "加载中...",
    });
    // #ifdef H5
     window.addEventListener("message", (arg) => {
        console.log(arg.data, "收到消息");
        if (arg.data.token) {
        uni.setStorageSync("wflow-token", arg.data.token);
        localStorage.setItem("wflow-token", arg.data.token);
        sessionStorage.setItem("wflow-token", arg.data.token);
        uni.setStorageSync("loginUser", JSON.stringify(arg.data.loginUser));
        sessionStorage.setItem("loginUser",  JSON.stringify(arg.data.loginUser));
        uni.setStorageSync("projectSn", arg.data.loginUser.sn);
        localStorage.setItem("projectSn", arg.data.loginUser.sn);
        sessionStorage.setItem("projectSn", arg.data.loginUser.sn);

        // console.log(JSON.stringify(arg), "登录用户");
        if (arg.data.page) {
          uni.reLaunch({
            url: arg.data.page + "?current=" + arg.data.current,
          });
        } else {
          uni.reLaunch({
            url: "/pages/submit/submit",
          });
        }
      }
      uni.hideLoading();
     }, false);
    // #endif
    window.msgFromUniapp = function (arg) {
      // console.log(arg.token);
      // console.log(JSON.stringify(arg),666777);
      if (arg.token) {
        uni.setStorageSync("wflow-token", arg.token);
        localStorage.setItem("wflow-token", arg.token);
        uni.setStorageSync("loginUser", JSON.stringify(arg.loginUser));
        uni.setStorageSync("projectSn", arg.loginUser.sn);
        localStorage.setItem("projectSn", arg.loginUser.sn);
        // console.log(JSON.stringify(arg), "登录用户");
        if (arg.page) {
          uni.reLaunch({
            url: arg.page + "?current=" + arg.current,
          });
        } else {
          uni.reLaunch({
            url: "/pages/submit/submit",
          });
        }
      }
      uni.hideLoading();
    };
    window.onload = function () {
       if(window.plus) {
          document.getElementById('app').classList.add('havetop');
       }
    }
  },
  onShow: function () {
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
  },
};
</script>

<style lang="scss">
:deep() {
  .uniui-personadd,
  .uniui-calendar,
  .uniui-map-pin-ellipse,
  .uniui-home,
  .uniui-search {
    font-size: 44rpx !important;
  }
  .uniui-redo {
    font-size: 40rpx !important;
  }
  .uni-radio-input {
    width: 44rpx !important;
    height: 44rpx !important;
  }
}
.havetop {
  uni-page-head {
    padding-top: 44rpx;
  }
}
.uni-scroll-view ::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}
/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
uni-page-head {
  background-color: rgb(68, 120, 247);
}
uni-page-wrapper {
  height: calc(100% - 88rpx - 44rpx - env(safe-area-inset-top)) !important;
}
.headerBox {
  height: 88rpx;
  align-items: center;
//   background-color: white;
  // color: rgba(42, 43, 91, 1);
  color: white;
  justify-content: center;
  position: relative;
  z-index: 2;
  // border-bottom: 1px solid rgba(194, 194, 194, 0.2);
  font-size: 32rpx;

  .backImg {
    width: 48rpx;
    height: 48rpx;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20rpx;
    // opacity: 0.8;
    z-index: 999;
  }

  .headerName {
    text-align: center;
    // font-size: 18px;
    line-height: 88rpx;
    z-index: 3;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    // font-weight: bold;
  }
}

page {
  background-color: #f4f5f7;
}

.w-button {
  border-radius: 48rpx;
  font-size: 32rpx !important;
  line-height: 64rpx;
  border: none;

  &::after {
    border: none;
  }
}

.w-click-hover {
  background-color: #f7f7f7;
}

//表单组件值只读样式
.w-form-input-rv {
  font-size: 32rpx;
  margin-left: 10rpx;
}

.over-tip {
  overflow: hidden;
  text-overflow: ellipsis;
  /* 设置文本溢出时显示省略号 */
  white-space: nowrap;
}
// :deep(.uni-picker-custom)  {
// 	height: 480rpx !important;
// }
:deep(.uni-picker-content) {
  height: 394rpx !important;
}
//覆盖默认组件样式
:deep(.w-form-input) {
  font-size: 32rpx;
  border: none;

  .is-input-border,
  .input-value-border {
    border: none !important;
  }

  .uni-input-placeholder,
  .uni-input-wrapper,
  .placeholder,
  .input-value,
  .uni-date__x-input,
  .uni-textarea-placeholder,
  .uni-textarea-wrapper {
    font-size: 32rpx !important;
  }

  .is-disabled {
    background-color: white !important;
  }
}

/* #ifdef MP */
.wflow-form .uni-forms-item {
  padding: 0 16rpx 32rpx 16rpx;
  background-color: white;
  margin-bottom: 16rpx;
  font-size: 32rpx !important;

  .uni-forms-item__error {
    padding-top: 0 !important;
  }

  .uni-easyinput__content-input {
    height: 30px;
    font-size: 32rpx;
  }

  .uni-easyinput__placeholder-class,
  .uni-date__x-input {
    font-size: 32rpx;
  }

  .w-form-title {
    display: flex;
    align-items: center;
    padding: 13rpx 0;
  }
}

/* #endif */
</style>
