2023-02-10 16:32:41 +08:00
|
|
|
<template>
|
2023-09-18 16:21:24 +08:00
|
|
|
<Cn-page :loading="loading">
|
|
|
|
|
<view slot="body" class="index">
|
2023-09-01 15:05:21 +08:00
|
|
|
<uni-list>
|
2023-09-18 16:21:24 +08:00
|
|
|
<uni-list-item
|
|
|
|
|
:title="renderData.masterUser.name"
|
|
|
|
|
:note="renderData.masterUser.phone"
|
|
|
|
|
:thumb="renderData.masterUser.avatar"
|
|
|
|
|
thumb-size="lg"
|
|
|
|
|
rightText="主用户"
|
|
|
|
|
>
|
2023-09-01 15:05:21 +08:00
|
|
|
</uni-list-item>
|
2023-09-18 16:21:24 +08:00
|
|
|
<uni-list-item
|
|
|
|
|
:title="item.name"
|
|
|
|
|
:note="item.phone"
|
|
|
|
|
:thumb="item.avatar"
|
|
|
|
|
thumb-size="lg"
|
|
|
|
|
v-for="item in renderData.subUsers"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
>
|
2023-09-01 15:05:21 +08:00
|
|
|
<template v-slot:footer v-if="options.isPrimaryUser">
|
2023-09-18 16:21:24 +08:00
|
|
|
<view class="footer-btn mt20" style="background: #e47470" @click="del(item)">移除</view>
|
2023-09-01 15:05:21 +08:00
|
|
|
</template>
|
|
|
|
|
</uni-list-item>
|
|
|
|
|
</uni-list>
|
|
|
|
|
<uni-load-more status="nomore"></uni-load-more>
|
2023-02-10 16:32:41 +08:00
|
|
|
</view>
|
|
|
|
|
</Cn-page>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2023-09-18 16:21:24 +08:00
|
|
|
import { queryDeviceUser, cancelShare } from '@/common/api/device'
|
2023-09-01 15:05:21 +08:00
|
|
|
|
2023-02-10 16:32:41 +08:00
|
|
|
export default {
|
2023-09-01 15:05:21 +08:00
|
|
|
data() {
|
2023-02-10 16:32:41 +08:00
|
|
|
return {
|
2023-09-01 15:05:21 +08:00
|
|
|
loading: true,
|
|
|
|
|
renderData: {
|
2023-09-18 16:21:24 +08:00
|
|
|
masterUser: {},
|
|
|
|
|
subUsers: [],
|
2023-09-01 15:05:21 +08:00
|
|
|
},
|
2023-09-18 16:21:24 +08:00
|
|
|
options: {},
|
2023-02-10 16:32:41 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-09-01 15:05:21 +08:00
|
|
|
jump() {
|
|
|
|
|
uni.navigateTo({
|
2023-09-18 16:21:24 +08:00
|
|
|
url: '/pages/mine/userDetail',
|
2023-09-01 15:05:21 +08:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
del(e) {
|
2023-09-18 16:21:24 +08:00
|
|
|
console.log(e)
|
2023-09-01 15:05:21 +08:00
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '确定要移除该成员吗?',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
2023-09-18 16:21:24 +08:00
|
|
|
cancelShare({ eid: this.renderData.devId, userId: e.id }).then((res) => {
|
|
|
|
|
console.log(res)
|
2023-09-01 15:05:21 +08:00
|
|
|
uni.showToast({
|
|
|
|
|
title: '移除成功',
|
2023-09-18 16:21:24 +08:00
|
|
|
icon: 'none',
|
2023-09-01 15:05:21 +08:00
|
|
|
})
|
|
|
|
|
this.init()
|
|
|
|
|
})
|
|
|
|
|
console.log('用户点击确定')
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
console.log('用户点击取消')
|
|
|
|
|
}
|
2023-09-18 16:21:24 +08:00
|
|
|
},
|
2023-09-01 15:05:21 +08:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
init() {
|
2023-09-18 16:21:24 +08:00
|
|
|
queryDeviceUser(this.options.id).then((res) => {
|
|
|
|
|
console.log(res)
|
2023-09-01 15:05:21 +08:00
|
|
|
this.renderData = res.data
|
2023-09-18 16:21:24 +08:00
|
|
|
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'
|
2023-09-01 15:05:21 +08:00
|
|
|
})
|
2023-09-18 16:21:24 +08:00
|
|
|
console.log(this.renderData)
|
2023-09-01 15:05:21 +08:00
|
|
|
this.loading = false
|
|
|
|
|
})
|
2023-09-18 16:21:24 +08:00
|
|
|
},
|
2023-09-01 15:05:21 +08:00
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.options = options
|
|
|
|
|
console.log(this.loading)
|
|
|
|
|
this.init()
|
2023-09-18 16:21:24 +08:00
|
|
|
},
|
2023-02-10 16:32:41 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
2023-09-18 16:21:24 +08:00
|
|
|
<style lang="scss">
|
2023-02-10 16:32:41 +08:00
|
|
|
.index {
|
2023-02-20 14:19:28 +08:00
|
|
|
padding: 20rpx;
|
2023-02-10 16:32:41 +08:00
|
|
|
|
|
|
|
|
.footer-btn {
|
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
height: 50rpx;
|
|
|
|
|
background-color: #007aff;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 50rpx;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-18 16:21:24 +08:00
|
|
|
</style>
|