用户分享列表

This commit is contained in:
仲么了
2023-09-01 15:05:21 +08:00
parent fb5de4370b
commit 47f5beccab
7 changed files with 114 additions and 24 deletions

View File

@@ -156,3 +156,23 @@ export const updateDevice = (params) => {
data: params,
})
}
// 设备用户列表
export const queryDeviceUser = (devId) => {
return request({
url: '/cs-device-boot/deviceUser/queryUserById',
method: 'POST',
data: {
devId
},
})
}
// 取消分享
export const cancelShare = (params) => {
return request({
url: '/cs-device-boot/deviceUser/cancelShare',
method: 'POST',
data: params,
})
}

View File

@@ -0,0 +1,15 @@
<template>
<view class='index'>
</view>
</template>
<script>
export default {
data() {
return {}
},
methods: {}
}
</script>
<style lang='scss'>
</style>

View File

@@ -2,8 +2,8 @@
"name" : "灿能物联",
"appid" : "__UNI__88BC25B",
"description" : "",
"versionName" : "1.2.6",
"versionCode" : 126,
"versionName" : "1.2.7",
"versionCode" : 127,
"transformPx" : false,
/* 5+App */
"app-plus" : {

View File

@@ -285,7 +285,7 @@
}
},
{
"path": "pages/mine/user",
"path": "pages/device/user",
"style": {
"navigationBarTitleText": "子用户"
}

View File

@@ -32,7 +32,7 @@
<template v-for="(item,index) in IOData">
<view class="item">{{ item.clDid }}</view>
<view class="item">
<view style="width: 30rpx"> {{ item.value || '-'}}</view>
<view style="width: 30rpx"> {{ item.value || '-' }}</view>
<view v-if="item.value"> °C</view>
</view>
</template>
@@ -225,7 +225,7 @@ export default {
} else if (e.item.text === '反馈') {
uni.navigateTo({url: '/pages/device/feedback'})
} else if (e.item.text === '用户') {
uni.navigateTo({url: '/pages/device/user'})
uni.navigateTo({url: '/pages/device/user?id=' + this.devId + '&isPrimaryUser=' + this.isPrimaryUser})
} else if (e.item.text === '报表') {
this.$util.toast('效果是直接打开报表')
} else if (e.item.text === '版本') {
@@ -426,6 +426,13 @@ export default {
text: '分享',
})
}
}
if (this.userInfo.authorities !== 'tourist') {
this.content.splice(0, 0, {
iconPath: '/static/subordinate.png',
text: '用户',
})
}
this.init()
},

View File

@@ -4,7 +4,7 @@
<view class='detail'>
<view class="detail-header">
<view class="header">
<image src="http://ruuf2hujc.bkt.clouddn.com/%E7%94%B5%E8%B7%AF%E5%9B%BE.svg" mode="widthFix" style="width: 100%;" />
<image src="http://localhost:8088/api/system-boot/image/toStream?bgImage=topology/1aca98ceb22a1fc33b81d9101275ef1.png" mode="widthFix" style="width: 100%;" />
</view>
<!-- <view class="des">
<text>设备基础信息</text>

View File

@@ -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>