<template>
  <view class="custom-footer"
   :class="{ 'custom-footer--elder': $uiStyle === 'elder' }"
  >
    <view class="line">本服务由浙江政务服务网、奉化区民政局提供</view>
    <view class="line"
      >服务咨询热线：<text @click="callPhone('0574-89286080')" class="phone-number"
        >0574-89286080</text
      ></view
    >
  </view>
</template>
<script>
export default {
  name:'CustomFooter',
  created(){
    console.log('CustomFooter created')
  },
  methods: {
    callPhone(phoneNumber) {
      var that = this;
      uni.getSystemInfo({
        success: function (res) {
          if (res.platform == "ios") {
            uni.makePhoneCall({
              phoneNumber: phoneNumber,
              success: function () {
                that.telephone = phoneNumber;
              },
              fail: function () {},
            });
          } else if (res.platform == "android" || res.platform == "devtools") {
            uni.showModal({
              title: "提示",
              content: `确定拨打${phoneNumber}电话吗？`,
              success(res) {
                if (res.confirm) {
                  uni.makePhoneCall({
                    phoneNumber: phoneNumber,
                    success: function () {
                      that.telephone = phoneNumber;
                    },
                    fail: function () {},
                  });
                } else if (res.cancel) {
                  console.log("用户点击取消");
                }
              },
            });
          }
        },
        fail: function () {
          uni.showToast({ title: "拨打电话失败", icon: "fail" });
        },
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.custom-footer {
  height: 80px;
  text-align: center;
  font-size: 13px;
  font-weight: 400;
  color: #999;
  .line {
    line-height: 23px;
    .phone-number {
      color: #3a78f5;
    }
  }
}
.custom-footer--elder{
  font-size:calc(12px * $zlb-elder-font-scale);
}
</style>
