<script setup>
import { ref, onMounted } from "vue";
import Container from "../../components/Container/Container.vue";
import { request } from "@/utils/request";
const src = ref("");
const count = ref(3000);
onMounted(() => {
  request(
    "api/question_bank/question_reception/channel_active_code/random_detail"
  ).then((res) => {
    src.value = res.data.qr_code;
  });

  request(
    "api/question_bank/question_reception/user_share_forms/get_number_of_invitations"
  ).then((res) => {
    count.value += res.data;
  });
});
</script>

<template>
  <Container title="客服" headerColor="#fff">
    <template #bg>
      <view class="bg"></view>
    </template>
    <view class="Container">
      <view class="text-lg">添加专属助教老师为</view>
      <view class="text-lg">您答疑解惑</view>
      <view class="text-lg">限时领取《药品速记口诀》</view>
      <view class="qr-code">
        <div class="card">
          <img :src="src" show-menu-by-longpress class="img" alt="" />
          <span>可长按识别二维码</span>
        </div>
      </view>
      <div class="success">
        <span class="count">{{ count }}人</span>已免费领取成功啦~
      </div>
    </view>
  </Container>
</template>

<style lang="scss">
.bg {
  width: 750rpx;
  height: 100%;
  background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/wqynNcvdPgfxPd8sGeFkumFV8rTmCQqFsxUBAXm4.png);
  background-size: 100% 100%;
  box-sizing: border-box;
}

.qr-code {
  width: 100%;
  height: 100%;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: $success;
  gap: 12rpx;
  .card {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 60rpx;
    background-color: #fff;
    gap: 30rpx;
    border-radius: 40rpx;
    width: calc(100%);
    box-sizing: border-box;
    color: #333;

    .img {
      width: 448rpx;
      height: 448rpx;
    }
  }
}

.text-lg {
  font-size: 48rpx;
  font-weight: bold;
  color: #e85c00;
}

.success {
  background-color: #feffe7;
  padding: 12rpx;
  border-radius: 50rpx;
  font-weight: 500;
  font-size: 28rpx;
  .count {
    color: $error;
  }
}

.Container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70rpx 20rpx;
  gap: 20rpx;
}
</style>
