intimacy.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="intimacy">
  3. <!-- 顶部时间筛选区域 -->
  4. <view class="search">
  5. <uni-datetime-picker v-model="datetimerangeValue" type="datetimerange" rangeSeparator="至" :clear-icon="false" @change="getData" />
  6. </view>
  7. <!-- 亲密度信息区域 -->
  8. <view
  9. class="box"
  10. v-for="(item, index) in dataList"
  11. :key="index"
  12. :class="{
  13. box1: index === 0,
  14. box2: index === 1,
  15. box3: index === 2,
  16. box4: index === 3,
  17. box5: index === 4,
  18. box6: index === 5,
  19. box7: index === 6,
  20. box8: index === 7,
  21. box9: index === 8,
  22. box10: index === 9
  23. }"
  24. >
  25. <img v-if="index === 0" class="box_rank" src="@/static/images/4.png" />
  26. <img v-if="index === 1" class="box_rank" src="@/static/images/5.png" />
  27. <img v-if="index === 2" class="box_rank" src="@/static/images/6.png" />
  28. <!-- 头像区域 -->
  29. <img v-if="item.headImage" class="box_img" mode="aspectFill" :src="item.headImage" @click="handleClickImg(item)" />
  30. <img v-else class="box_img" mode="aspectFill" src="https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/3.png" @click="handleClickImg(item)" />
  31. <!-- 学生信息区域 -->
  32. <view class="box_msg">
  33. <view class="msg_info">{{ item.relationName }} {{ item.className }}</view>
  34. <view class="msg_no">{{ item.cardNo }}</view>
  35. </view>
  36. <!-- 亲密度区域 -->
  37. <view class="box_intimacy">亲密度:{{ item.count }}</view>
  38. </view>
  39. <!-- 没有数据时展示的页面 -->
  40. <view v-if="!dataList.length" class="nodata">暂无数据</view>
  41. <!-- 底部本人信息区域 -->
  42. <view class="my">
  43. <img v-if="msg.headImage" class="mg_img" mode="aspectFill" :src="msg.headImage" />
  44. <img v-else class="mg_img" mode="aspectFill" src="https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/3.png" />
  45. {{ msg.name }}的关系树
  46. </view>
  47. </view>
  48. </template>
  49. <script setup>
  50. import { onLoad } from '@dcloudio/uni-app'
  51. import { ref } from 'vue'
  52. import dayjs from 'dayjs'
  53. import { myRequest } from '@/utils/api.js'
  54. import { decryptDes } from '@/utils/des.js'
  55. // 当前学生信息
  56. const msg = ref({})
  57. // 时间筛选框绑定数据
  58. const datetimerangeValue = ref()
  59. // 亲密度数据数组
  60. const dataList = ref([])
  61. onLoad((options) => {
  62. msg.value = JSON.parse(decodeURIComponent(options.msg))
  63. // 获取前一天的时间
  64. let temData = Date.now() - 1000 * 60 * 60 * 24
  65. // 默认获取昨天的时间
  66. datetimerangeValue.value = [dayjs(temData).format('YYYY-MM-DD') + ' 00:00:00', dayjs(temData).format('YYYY-MM-DD') + ' 23:59:59']
  67. // 获取亲密度数据数组
  68. getData()
  69. })
  70. // 获取亲密度数据数组
  71. const getData = async () => {
  72. const res = await myRequest({
  73. url: '/wanzai/api/smartRelation/getAppList',
  74. data: {
  75. currentPage: 1,
  76. pageCount: 10,
  77. userId: msg.value.id,
  78. startTime: datetimerangeValue.value[0],
  79. endTime: datetimerangeValue.value[1]
  80. }
  81. })
  82. // console.log(res)
  83. if (res.code == 200) {
  84. const result = JSON.parse(decryptDes(res.data))
  85. // console.log(result)
  86. dataList.value = result.list
  87. }
  88. }
  89. // 点击列表头像回调
  90. const handleClickImg = (item) => {
  91. // console.log(item)
  92. msg.value.id = item.relationId
  93. msg.value.name = item.relationName
  94. msg.value.headImage = item.headImage
  95. getData()
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .intimacy {
  100. position: relative;
  101. display: flex;
  102. flex-direction: column;
  103. height: 100vh;
  104. background-image: url(https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/3.png);
  105. background-size: 100% 100%;
  106. .search {
  107. display: flex;
  108. justify-content: space-evenly;
  109. padding: 0 30rpx;
  110. margin: 30rpx 0;
  111. height: 65rpx;
  112. }
  113. .box {
  114. position: absolute;
  115. display: flex;
  116. flex-direction: column;
  117. align-items: center;
  118. .box_rank {
  119. position: absolute;
  120. top: 0;
  121. left: 50%;
  122. width: 40rpx;
  123. height: 40rpx;
  124. transform: translate(-50%, -50%);
  125. }
  126. .box_img {
  127. width: 90rpx;
  128. height: 90rpx;
  129. border-radius: 50%;
  130. border: 2rpx solid #fff;
  131. }
  132. .box_msg {
  133. margin-top: -15rpx;
  134. padding: 0 20rpx;
  135. text-align: center;
  136. border-radius: 180rpx;
  137. background-color: #e3ffee;
  138. .msg_info {
  139. font-size: 20rpx;
  140. }
  141. .msg_no {
  142. margin: 5rpx 0;
  143. font-size: 14rpx;
  144. color: #000000;
  145. }
  146. }
  147. .box_intimacy {
  148. margin-top: 5rpx;
  149. padding: 5rpx 20rpx;
  150. font-size: 14rpx;
  151. border-radius: 130rpx;
  152. background-color: #bdbdbd;
  153. }
  154. }
  155. .box1 {
  156. top: 163rpx;
  157. left: 308rpx;
  158. }
  159. .box2 {
  160. top: 240rpx;
  161. left: 136rpx;
  162. }
  163. .box3 {
  164. top: 240rpx;
  165. left: 485rpx;
  166. }
  167. .box4 {
  168. top: 408rpx;
  169. left: 10rpx;
  170. }
  171. .box5 {
  172. top: 466rpx;
  173. left: 178rpx;
  174. }
  175. .box6 {
  176. top: 408rpx;
  177. left: 357rpx;
  178. }
  179. .box7 {
  180. top: 466rpx;
  181. left: 532rpx;
  182. }
  183. .box8 {
  184. top: 655rpx;
  185. left: 40rpx;
  186. }
  187. .box9 {
  188. top: 655rpx;
  189. left: 275rpx;
  190. }
  191. .box10 {
  192. top: 655rpx;
  193. left: 505rpx;
  194. }
  195. .nodata {
  196. position: absolute;
  197. top: 40%;
  198. left: 45%;
  199. color: #fff;
  200. }
  201. .my {
  202. position: absolute;
  203. bottom: 60rpx;
  204. left: 50%;
  205. transform: translateX(-50%);
  206. display: flex;
  207. flex-direction: column;
  208. justify-content: space-around;
  209. align-items: center;
  210. height: 180rpx;
  211. color: #fff;
  212. font-size: 28rpx;
  213. .mg_img {
  214. width: 105rpx;
  215. height: 105rpx;
  216. object-fit: cover;
  217. border-radius: 50%;
  218. border: 2rpx solid #fff;
  219. }
  220. }
  221. }
  222. </style>