123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <view>
- <view class="list">
- <view class="item" v-for="(item,index) in list" :key="index">
- <view class="left">
- <view class="icon">
- <image v-if="item.avatar" :src="item.avatar" mode="aspectFill"></image>
- <view class="avatar" v-if="!item.avatar" :style="{backgroundColor:bgColor[index]}">
- {{item.name.split('').pop()}}
- </view>
- </view>
- <view class="info">
- <view class="name">{{item.name}}({{item.section}})</view>
- <view class="time">{{item.time}}</view>
- </view>
- </view>
- <view class="right">
- {{item.size}} 次
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [],
- // 头像随机色
- bgColor: [],
- };
- },
- onLoad(option) {
- // 设置头像
- for (let i = 0; i < 100; i++) {
- // 获取随机色
- let r = parseInt(Math.random() * 256)
- let g = parseInt(Math.random() * 256)
- let b = parseInt(Math.random() * 256)
- // ES6 字符串拼接
- // this.bgColor = `rgba(${r},${g},${b},0.3)`
- let color = "rgba(" + r + "," + g + "," + b + "," + 0.3 + ")"
- // console.log(color)
- this.bgColor.push(color)
- }
- this.get_list(option.id)
- },
- methods: {
- get_list(id) {
- uni.showLoading({
- mask:true
- })
- this.$api.trouble_grid_check_detailed({
- type: 1,
-
- check_id: id
- }).then((res)=>{
- uni.hideLoading()
- console.log(res.data.data)
-
- this.list = res.data.data
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .list {
- box-sizing: border-box;
- padding: 25rpx;
- .item {
- padding: 10rpx 0;
- border-bottom: 1rpx solid #F0F0F0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 115rpx;
- .left {
- display: flex;
- align-items: center;
- .icon {
- width: 110rpx;
- height: 110rpx;
- border-radius: 50%;
- overflow: hidden;
- image {
- width: 110rpx;
- height: 110rpx;
- }
- .avatar {
- width: 110rpx;
- line-height: 110rpx;
- text-align: center;
- font-size: 44rpx;
- color: #FFFFFF;
- }
- }
- .info {
- margin-left: 20rpx;
- .name {
- line-height: 50rpx;
- font-weight: 500;
- color: #2C3E50;
- }
- .time {
- font-size: 30rpx;
- color: #9C9FA5;
- }
- }
- }
- .right {
- font-size: 30rpx;
- }
- }
- }
- </style>
|