用户分享列表
This commit is contained in:
@@ -1,32 +1,80 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading'>
|
||||
<view slot='body'>
|
||||
<view class='index'>
|
||||
<uni-list>
|
||||
<uni-list-item title="张三" note="2023-02-10 14:55" thumb="/static/head.png" thumb-size="lg">
|
||||
<template v-slot:footer>
|
||||
<view class="footer-btn mt20" style="background:#e47470">移除</view>
|
||||
</template>
|
||||
</uni-list-item>
|
||||
<uni-list-item title="李四" note="2023-02-10 14:55" thumb="/static/head.png" thumb-size="lg">
|
||||
<template v-slot:footer>
|
||||
<view class="footer-btn mt20" style="background:#e47470">移除</view>
|
||||
</template>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
<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>
|
||||
<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>
|
||||
</template>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import {queryDeviceUser, cancelShare} from '@/common/api/device'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false
|
||||
loading: true,
|
||||
renderData: {
|
||||
masterUser:{},
|
||||
subUsers:[]
|
||||
},
|
||||
options: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
jump() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/userDetail'
|
||||
})
|
||||
},
|
||||
del(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);
|
||||
uni.showToast({
|
||||
title: '移除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
this.init()
|
||||
|
||||
})
|
||||
console.log('用户点击确定')
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
init() {
|
||||
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.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.options = options
|
||||
console.log(this.loading)
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user