wx-starlock/pages/remoteDetail/remoteDetail.vue
2025-02-11 15:45:53 +08:00

128 lines
3.7 KiB
Vue

<template>
<view>
<view v-if="info">
<view class="item">
<view class="item-title">遥控号</view>
<view class="item-content">{{ info.remoteNumber }}</view>
</view>
<view class="item" style="margin-top: 2rpx">
<view class="item-title">姓名</view>
<view class="item-content">{{ info.remoteName }}</view>
</view>
<view class="item" style="margin-top: 2rpx">
<view class="item-title">有效期</view>
<view v-if="info.remoteType === 1">永久</view>
<view v-else-if="info.remoteType === 2">
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
</view>
<view v-else>
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
</view>
</view>
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4">
<view class="item-title">有效日</view>
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
</view>
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4">
<view class="item-title">有效时间</view>
<view class="item-content">
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
</view>
</view>
<view class="item" style="margin-top: 20rpx">
<view class="item-title">添加者</view>
<view class="item-content">{{ info.senderUsername }}</view>
</view>
<view class="item" style="margin-top: 2rpx">
<view class="item-title">添加时间</view>
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
</view>
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
<view class="item-title">操作记录</view>
<up-icon name="arrow-right"></up-icon>
</view>
<view class="button" @click="deletePassword">删除</view>
</view>
</view>
</template>
<script setup>
import { getCurrentInstance, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { timeFormat } from 'uview-plus'
import { useLockStore } from '@/stores/lock'
import { useBasicStore } from '@/stores/basic'
const instance = getCurrentInstance().proxy
const eventChannel = instance.getOpenerEventChannel()
const $lock = useLockStore()
const $basic = useBasicStore()
const info = ref(null)
onLoad(options => {
if (options.info) {
info.value = JSON.parse(options.info)
console.log(info.value)
}
})
const toRecordList = async () => {
$basic.routeJump({
name: 'typeRecordList',
params: {
name: info.value.remoteName,
key: 'remoteId',
id: info.value.remoteId
}
})
}
const deletePassword = async () => {
eventChannel.emit('delete', {})
}
</script>
<style lang="scss">
page {
background-color: $uni-bg-color-grey;
}
</style>
<style lang="scss" scoped>
.item-title {
width: 350rpx;
}
.item {
padding: 24rpx 32rpx;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 32rpx;
font-weight: 500;
}
.tips {
padding: 24rpx 32rpx;
font-size: 24rpx;
color: #999999;
}
.button {
margin: 32rpx;
width: 686rpx;
height: 88rpx;
background-color: #df282d;
color: white;
text-align: center;
line-height: 88rpx;
border-radius: 44rpx;
font-weight: bold;
}
</style>