头像优化

This commit is contained in:
仲么了
2023-09-18 16:21:24 +08:00
parent 5f6a924233
commit 5c8b716ef1

View File

@@ -1,14 +1,25 @@
<template>
<Cn-page :loading='loading'>
<view slot='body' class='index'>
<Cn-page :loading="loading">
<view slot="body" class="index">
<uni-list>
<uni-list-item :title="renderData.masterUser.name" :note="renderData.masterUser.phone"
:thumb="renderData.masterUser.avatar" thumb-size="lg" rightText="主用户">
<uni-list-item
:title="renderData.masterUser.name"
:note="renderData.masterUser.phone"
:thumb="renderData.masterUser.avatar"
thumb-size="lg"
rightText="主用户"
>
</uni-list-item>
<uni-list-item :title="item.name" :note="item.phone" :thumb="item.avatar" thumb-size="lg"
v-for="item in renderData.subUsers" :key="item.id">
<uni-list-item
:title="item.name"
:note="item.phone"
:thumb="item.avatar"
thumb-size="lg"
v-for="item in renderData.subUsers"
:key="item.id"
>
<template v-slot:footer v-if="options.isPrimaryUser">
<view class="footer-btn mt20" style="background:#e47470" @click="del(item)">移除</view>
<view class="footer-btn mt20" style="background: #e47470" @click="del(item)">移除</view>
</template>
</uni-list-item>
</uni-list>
@@ -17,68 +28,70 @@
</Cn-page>
</template>
<script>
import {queryDeviceUser, cancelShare} from '@/common/api/device'
import { queryDeviceUser, cancelShare } from '@/common/api/device'
export default {
data() {
return {
loading: true,
renderData: {
masterUser:{},
subUsers:[]
masterUser: {},
subUsers: [],
},
options: {}
options: {},
}
},
methods: {
jump() {
uni.navigateTo({
url: '/pages/mine/userDetail'
url: '/pages/mine/userDetail',
})
},
del(e) {
console.log(e);
console.log(e)
uni.showModal({
title: '提示',
content: '确定要移除该成员吗?',
success: (res) => {
if (res.confirm) {
cancelShare({eid: this.renderData.devId, userId: e.id}).then(res => {
console.log(res);
cancelShare({ eid: this.renderData.devId, userId: e.id }).then((res) => {
console.log(res)
uni.showToast({
title: '移除成功',
icon: 'none'
icon: 'none',
})
this.init()
})
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
},
})
},
init() {
queryDeviceUser(this.options.id).then(res => {
console.log(res);
queryDeviceUser(this.options.id).then((res) => {
console.log(res)
this.renderData = res.data
this.renderData.masterUser.avatar = this.renderData.masterUser.headSculpture ? this.$config.staticUrl + this.renderData.masterUser.headSculpture : '/static/head.png'
this.renderData.subUsers.forEach(item => {
item.avatar = item.headSculpture ? this.$config.staticUrl + item.headSculpture : '/static/head.png'
this.renderData.masterUser.avatar = this.renderData.masterUser.headSculpture
? this.$config.static + this.renderData.masterUser.headSculpture
: '/static/head.png'
this.renderData.subUsers.forEach((item) => {
item.avatar = item.headSculpture ? this.$config.static + item.headSculpture : '/static/head.png'
})
console.log(this.renderData)
this.loading = false
})
}
},
},
onLoad(options) {
this.options = options
console.log(this.loading)
this.init()
}
},
}
</script>
<style lang='scss'>
<style lang="scss">
.index {
padding: 20rpx;
@@ -93,4 +106,4 @@ export default {
border-radius: 10rpx;
}
}
</style>
</style>