invited.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <script setup>
  2. import Container from "../../components/Container/Container.vue";
  3. import { ref, onMounted } from "vue";
  4. import { request } from "../../utils/request";
  5. import utils from "../../utils/common";
  6. import Empty from "../../components/Empty/Empty.vue";
  7. const list = ref([]);
  8. const titleList = ref([
  9. {
  10. label: "已邀请",
  11. value: 0,
  12. key: "number_of_invitations",
  13. },
  14. // {
  15. // label: "可免费解锁科目",
  16. // value: 0,
  17. // key: "unlockable_subjects",
  18. // },
  19. // {
  20. // label: "已免费解锁科目",
  21. // value: 0,
  22. // key: "unlocked_subject",
  23. // },
  24. ]);
  25. onMounted(() => {
  26. request("api/question_bank/question_reception/invite_user_form/list").then(
  27. (res) => {
  28. if (!res.data) return;
  29. list.value = res.data.data;
  30. }
  31. );
  32. request("api/question_bank/question_reception/user_share_forms/detail").then(
  33. (res) => {
  34. if (!res.data) return;
  35. titleList.value.forEach((item) => {
  36. item.value = res.data[item.key] || 0;
  37. });
  38. }
  39. );
  40. });
  41. </script>
  42. <template>
  43. <Container title="邀请记录" headerColor="#fff" bgColor="#f8f8f8">
  44. <view class="contariner">
  45. <view class="title">
  46. <view v-for="item in titleList" class="item" :key="item.label">
  47. <view class="label">{{ item.label }}</view>
  48. <view class="value">{{ item.value }}</view>
  49. </view>
  50. </view>
  51. <view class="list" v-if="list.length">
  52. <scroll-view scroll-y class="card" v-for="item in list" :key="item.id">
  53. <view class="left">
  54. <image
  55. class="avatar"
  56. :src="item.invited_user_info?.userpic"
  57. mode="scaleToFill"
  58. />
  59. <div class="info">
  60. <div class="name">{{ item.invited_user_info?.username }}</div>
  61. <div class="num">答题数: {{ item.number_of_answers }}题</div>
  62. </div>
  63. </view>
  64. <div class="right">
  65. {{ utils.timestampToString(item.insert_time) }}
  66. </div>
  67. </scroll-view>
  68. </view>
  69. <Empty text="暂无数据" v-else />
  70. </view>
  71. </Container>
  72. </template>
  73. <style scoped lang="scss">
  74. @import "@/uni.scss";
  75. .contariner {
  76. display: flex;
  77. flex-direction: column;
  78. gap: 24rpx;
  79. .title {
  80. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/mSSwWMeK16KulBkYTchvlCXuJ2DaFceeuhS6MLz6.png")
  81. no-repeat center center;
  82. background-size: cover;
  83. height: 181rpx;
  84. // display: grid;
  85. // grid-template-columns: repeat(3, 1fr);
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. .item {
  90. display: flex;
  91. flex-direction: column;
  92. align-items: center;
  93. justify-content: center;
  94. gap: 16rpx;
  95. font-family: PingFang SC, PingFang SC;
  96. font-weight: 400;
  97. font-size: 24rpx;
  98. color: #666666;
  99. .value {
  100. font-size: 48rpx;
  101. color: #000000;
  102. }
  103. }
  104. }
  105. .list {
  106. display: flex;
  107. flex-direction: column;
  108. gap: 16rpx;
  109. height: 100%;
  110. .card {
  111. background-color: #fff;
  112. padding: 24rpx 16rpx;
  113. display: flex;
  114. justify-content: space-between;
  115. border-radius: 16rpx;
  116. flex: 1;
  117. .left {
  118. display: flex;
  119. gap: 24rpx;
  120. flex: 1;
  121. font-family: PingFang SC, PingFang SC;
  122. font-weight: 500;
  123. font-size: 24rpx;
  124. color: #000000;
  125. .avatar {
  126. width: 56rpx;
  127. height: 56rpx;
  128. border-radius: 50%;
  129. }
  130. .info {
  131. display: flex;
  132. flex-direction: column;
  133. gap: 24rpx;
  134. justify-content: center;
  135. margin-bottom: 7rpx;
  136. .name {
  137. font-weight: bold;
  138. }
  139. .num {
  140. font-size: 20rpx;
  141. }
  142. }
  143. }
  144. .right {
  145. font-family: PingFang SC, PingFang SC;
  146. font-weight: 500;
  147. font-size: 24rpx;
  148. color: #999999;
  149. }
  150. }
  151. }
  152. }
  153. </style>