优化用户体验当没有设备时,给出按钮跳转到设备租赁
This commit is contained in:
parent
5fc98a2007
commit
ba1f2d16b9
|
|
@ -1,7 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="equipment-section">
|
<view class="equipment-section">
|
||||||
<view class="section-title">{{ title }}</view>
|
<view class="section-title">{{ title }}</view>
|
||||||
<view class="equipment-list">
|
<view v-if="!equipmentList || equipmentList.length === 0" class="empty-state">
|
||||||
|
<text class="empty-text">目前暂无租赁设备</text>
|
||||||
|
<button @click="goToLease">去租赁设备</button>
|
||||||
|
</view>
|
||||||
|
<view v-else class="equipment-list">
|
||||||
<view
|
<view
|
||||||
v-for="equipment in equipmentList"
|
v-for="equipment in equipmentList"
|
||||||
:key="equipment.id"
|
:key="equipment.id"
|
||||||
|
|
@ -31,6 +35,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import lease from '../../pages/lease/lease.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EquipmentList',
|
name: 'EquipmentList',
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -64,11 +70,30 @@ export default {
|
||||||
onRenew(equipment) {
|
onRenew(equipment) {
|
||||||
this.$emit('renew', equipment)
|
this.$emit('renew', equipment)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
goToLease() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/lease/lease', // 注意路径需以/开头
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
color: #fff;
|
||||||
|
background: #f15a04;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.equipment-section {
|
.equipment-section {
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,29 +202,6 @@ export default {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取设备列表失败:', error)
|
console.error('获取设备列表失败:', error)
|
||||||
// 如果获取失败,使用默认设备数据
|
|
||||||
this.equipmentList = [
|
|
||||||
{
|
|
||||||
id: 'default1',
|
|
||||||
name: '商用节能灶',
|
|
||||||
status: 'rented',
|
|
||||||
startTime: '2025-07-25 13:23:59',
|
|
||||||
endTime: '2026-07-25 13:23:59',
|
|
||||||
image: commonEnum.TEMP2,
|
|
||||||
isOnline: true,
|
|
||||||
typeId: '1', // 添加默认类型ID
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'default2',
|
|
||||||
name: '节能燃烧器',
|
|
||||||
status: 'rented',
|
|
||||||
startTime: '2025-07-25 13:23:59',
|
|
||||||
endTime: '2026-07-25 13:23:59',
|
|
||||||
image: commonEnum.TEMP3,
|
|
||||||
isOnline: true,
|
|
||||||
typeId: '2', // 添加默认类型ID
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user