| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <view class="intimacy">
- <!-- 顶部时间筛选区域 -->
- <view class="search">
- <uni-datetime-picker v-model="datetimerangeValue" type="datetimerange" rangeSeparator="至" :clear-icon="false" @change="getData" />
- </view>
- <!-- 亲密度信息区域 -->
- <view
- class="box"
- v-for="(item, index) in dataList"
- :key="index"
- :class="{
- box1: index === 0,
- box2: index === 1,
- box3: index === 2,
- box4: index === 3,
- box5: index === 4,
- box6: index === 5,
- box7: index === 6,
- box8: index === 7,
- box9: index === 8,
- box10: index === 9
- }"
- >
- <img v-if="index === 0" class="box_rank" src="@/static/images/4.png" />
- <img v-if="index === 1" class="box_rank" src="@/static/images/5.png" />
- <img v-if="index === 2" class="box_rank" src="@/static/images/6.png" />
- <!-- 头像区域 -->
- <img v-if="item.headImage" class="box_img" mode="aspectFill" :src="item.headImage" @click="handleClickImg(item)" />
- <img v-else class="box_img" mode="aspectFill" src="https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/3.png" @click="handleClickImg(item)" />
- <!-- 学生信息区域 -->
- <view class="box_msg">
- <view class="msg_info">{{ item.relationName }} {{ item.className }}</view>
- <view class="msg_no">{{ item.cardNo }}</view>
- </view>
- <!-- 亲密度区域 -->
- <view class="box_intimacy">亲密度:{{ item.count }}</view>
- </view>
- <!-- 没有数据时展示的页面 -->
- <view v-if="!dataList.length" class="nodata">暂无数据</view>
- <!-- 底部本人信息区域 -->
- <view class="my">
- <img v-if="msg.headImage" class="mg_img" mode="aspectFill" :src="msg.headImage" />
- <img v-else class="mg_img" mode="aspectFill" src="https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/3.png" />
- {{ msg.name }}的关系树
- </view>
- </view>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { ref } from 'vue'
- import dayjs from 'dayjs'
- import { myRequest } from '@/utils/api.js'
- import { decryptDes } from '@/utils/des.js'
- // 当前学生信息
- const msg = ref({})
- // 时间筛选框绑定数据
- const datetimerangeValue = ref()
- // 亲密度数据数组
- const dataList = ref([])
- onLoad((options) => {
- msg.value = JSON.parse(options.msg)
- // 获取前一天的时间
- let temData = Date.now() - 1000 * 60 * 60 * 24
- // 默认获取昨天的时间
- datetimerangeValue.value = [dayjs(temData).format('YYYY-MM-DD') + ' 00:00:00', dayjs(temData).format('YYYY-MM-DD') + ' 23:59:59']
- // 获取亲密度数据数组
- getData()
- })
- // 获取亲密度数据数组
- const getData = async () => {
- const res = await myRequest({
- url: '/wanzai/api/smartRelation/getAppList',
- data: {
- currentPage: 1,
- pageCount: 10,
- userId: msg.value.id,
- startTime: datetimerangeValue.value[0],
- endTime: datetimerangeValue.value[1]
- }
- })
- // console.log(res)
- if (res.code == 200) {
- const result = JSON.parse(decryptDes(res.data))
- // console.log(result)
- dataList.value = result.list
- }
- }
- // 点击列表头像回调
- const handleClickImg = (item) => {
- // console.log(item)
- msg.value.id = item.relationId
- msg.value.name = item.relationName
- msg.value.headImage = item.headImage
- getData()
- }
- </script>
- <style lang="scss" scoped>
- .intimacy {
- position: relative;
- display: flex;
- flex-direction: column;
- height: 100vh;
- background-image: url(https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/3.png);
- background-size: 100% 100%;
- .search {
- display: flex;
- justify-content: space-evenly;
- padding: 0 30rpx;
- margin: 30rpx 0;
- height: 65rpx;
- }
- .box {
- position: absolute;
- display: flex;
- flex-direction: column;
- align-items: center;
- .box_rank {
- position: absolute;
- top: 0;
- left: 50%;
- width: 40rpx;
- height: 40rpx;
- transform: translate(-50%, -50%);
- }
- .box_img {
- width: 90rpx;
- height: 90rpx;
- border-radius: 50%;
- border: 2rpx solid #fff;
- }
- .box_msg {
- margin-top: -15rpx;
- padding: 0 20rpx;
- text-align: center;
- border-radius: 180rpx;
- background-color: #e3ffee;
- .msg_info {
- font-size: 20rpx;
- }
- .msg_no {
- margin: 5rpx 0;
- font-size: 14rpx;
- color: #000000;
- }
- }
- .box_intimacy {
- margin-top: 5rpx;
- padding: 5rpx 20rpx;
- font-size: 14rpx;
- border-radius: 130rpx;
- background-color: #bdbdbd;
- }
- }
- .box1 {
- top: 163rpx;
- left: 308rpx;
- }
- .box2 {
- top: 240rpx;
- left: 136rpx;
- }
- .box3 {
- top: 240rpx;
- left: 485rpx;
- }
- .box4 {
- top: 408rpx;
- left: 10rpx;
- }
- .box5 {
- top: 466rpx;
- left: 178rpx;
- }
- .box6 {
- top: 408rpx;
- left: 357rpx;
- }
- .box7 {
- top: 466rpx;
- left: 532rpx;
- }
- .box8 {
- top: 655rpx;
- left: 40rpx;
- }
- .box9 {
- top: 655rpx;
- left: 275rpx;
- }
- .box10 {
- top: 655rpx;
- left: 505rpx;
- }
- .nodata {
- position: absolute;
- top: 40%;
- left: 45%;
- color: #fff;
- }
- .my {
- position: absolute;
- bottom: 60rpx;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- align-items: center;
- height: 180rpx;
- color: #fff;
- font-size: 28rpx;
- .mg_img {
- width: 105rpx;
- height: 105rpx;
- object-fit: cover;
- border-radius: 50%;
- border: 2rpx solid #fff;
- }
- }
- }
- </style>
|