Browse Source

完善了修改图像信息页面的数据

master
xiaohei 1 year ago
parent
commit
a97023535f
3 changed files with 73 additions and 48 deletions
  1. +44
    -25
      pagesA/faceinfo/faceinfo.js
  2. +13
    -22
      pagesA/faceinfo/faceinfo.wxml
  3. +16
    -1
      pagesA/facepeople/facepeople.js

+ 44
- 25
pagesA/faceinfo/faceinfo.js View File

@ -10,18 +10,26 @@ Page({
enddate: moment().format('YYYY-MM-DD HH:mm:ss'),
minDate: new Date().getTime(),
currentDate: new Date().getTime(),
imgList:["https://img.yzcdn.cn/vant/cat.jpeg"],
selectDateStatus:false,
selectDateStatus1:false,
dateIndex:1,
currentDate1:new Date().getTime()
currentDate1:new Date().getTime(),
facemessage: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var facemessage = wx.getStorageSync('facemessage')
if(facemessage){
let info = JSON.parse(facemessage.content)
this.setData({
facemessage,
startdate: moment(info.passwordStartTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
enddate: moment(info.passwordEndTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
})
}
},
// 时间选择
selectTimeMethods(event){
@ -38,29 +46,8 @@ Page({
})
}
},
// 查看图片大图
preview(event) {
console.log(event.currentTarget.dataset.src)
let currentUrl = event.currentTarget.dataset.src
wx.previewImage({
current: currentUrl, // 当前显示图片的http链接
urls: this.data.imgList // 需要预览的图片http链接列表
})
},
// 选择凭证有效期
confirmMethods(event){
this.setData({
selectDateStatus: false,
selectDateStatus1:false
});
},
cancelMethods(event){
this.setData({
selectDateStatus: false,
selectDateStatus1:false
});
},
// 选择图像有效期
onInput(event) {
let time = moment(event.detail).format("YYYY-MM-DD HH:mm:ss")
if(this.data.dateIndex == 1){
this.setData({
@ -74,6 +61,38 @@ Page({
currentDate1: event.detail,
})
}
this.setData({
selectDateStatus: false,
selectDateStatus1:false
});
},
cancelMethods(event){
this.setData({
selectDateStatus: false,
selectDateStatus1:false
});
},
// 确定修改人脸时间
sendface() {
console.log(this.data.facemessage)
var face = this.data.facemessage
var content = JSON.parse(face.content)
var passwordStartTime = moment(this.data.startdate).format('YYYYMMDDHHmmss')
var passwordEndTime = moment(this.data.enddate).format('YYYYMMDDHHmmss')
content.pzname = this.data.facemessage.pzname
content.passwordStartTime = passwordStartTime
content.passwordEndTime = passwordEndTime
var updatedata = {
id: this.data.facemessage.id,
content: JSON.stringify(content),
startTime: moment(this.data.startdate).format('x') / 1000,
endTime: moment(this.data.enddate).format('x') / 1000
}
},
onChange(e) {
this.data.facemessage.pzname = e.detail
},
/**
* 生命周期函数--监听页面初次渲染完成


+ 13
- 22
pagesA/faceinfo/faceinfo.wxml View File

@ -2,49 +2,40 @@
<view class="faceinfo">
<view class="lock-message">
<view class="lock-message-item">
<view class="item-title">锁名称</view>
<view class="item-value">1</view>
<view class="item-title">锁</view>
<view class="item-value">{{facemessage.deviceNum}}</view>
</view>
<view class="lock-message-item">
<view class="item-title">图像信息</view>
<van-image width="100rpx" height="100rpx" bindtap="preview" data-src="https://img.yzcdn.cn/vant/cat.jpeg" src="https://img.yzcdn.cn/vant/cat.jpeg" class="item-value"/>
<van-image width="100rpx" height="100rpx" data-src="{{facemessage.facepic}}" src="{{facemessage.facepic}}" class="item-value" />
</view>
</view>
<view class="start-end-date">
<view class="date-item" bindtap="selectTimeMethods" data-index='1'>
<view class="date-item-left">
<view class="item-left-title">生效时间</view>
<view class="item-left-date" >{{ startdate }}</view>
<view class="item-left-date">{{ startdate }}</view>
</view>
<van-icon name="arrow" class="arrow"/>
<van-icon name="arrow" class="arrow" />
</view>
<view class="date-item" bindtap="selectTimeMethods" data-index='2'>
<view class="date-item-left">
<view class="item-left-title">失效时间</view>
<view class="item-left-date">{{ enddate }}</view>
</view>
<van-icon name="arrow" class="arrow"/>
<van-icon name="arrow" class="arrow" />
</view>
</view>
<view class="picmessage">
<view class="picmessage-title">图像信息</view>
<view class="picmessage-value">哇,贞德是梨啊</view>
<!-- <view class="picmessage-title">图像名称</view>
<view class="picmessage-value">{{facemessage.pzname}}</view> -->
<van-field value="{{ facemessage.pzname }}" placeholder="请输入凭证名称" label="图像名称" border="{{ false }}" bind:change="onChange" input-align="right" />
</view>
<view class="btn">确定</view>
<view class="btn" bindtap="sendface">确定</view>
</view>
<view class="d-position-fixed bottom-fixed-0 left-fixed-0" wx:if="{{ selectDateStatus }}">
<van-datetime-picker
type="datetime"
value="{{ currentDate }}"
bind:input="onInput" bind:confirm="confirmMethods" bind:cancel="cancelMethods"
/>
<van-datetime-picker type="datetime" value="{{ currentDate }}" bind:confirm="confirmMethods" bind:cancel="cancelMethods" />
</view>
<view class="d-position-fixed bottom-fixed-0 left-fixed-0" wx:if="{{ selectDateStatus1 }}">
<van-datetime-picker
type="datetime"
value="{{ currentDate1 }}"
min-date="{{ currentDate }}"
bind:input="onInput" bind:confirm="confirmMethods" bind:cancel="cancelMethods"
/>
</view>
<van-datetime-picker type="datetime" value="{{ currentDate1 }}" min-date="{{ currentDate }}" bind:confirm="confirmMethods" bind:cancel="cancelMethods" />
</view>

+ 16
- 1
pagesA/facepeople/facepeople.js View File

@ -254,6 +254,7 @@ Page({
},
// 跳转详情页
gotoinfo() {
wx.setStorageSync('facemessage', this.data.facemessage)
wx.navigateTo({
url: '/pagesA/faceinfo/faceinfo',
})
@ -379,14 +380,28 @@ Page({
},
// 删除人脸
delFace() {
console.log(this.data.facemessage);
var facemessage = this.data.facemessage
var content = JSON.parse(facemessage.content)
wx.showModal({
title: '提示',
content: "此操作将删除该人脸信息,确定删除吗?",
success(res) {
if(res.confirm){
let dataface = {
code: "lwj/faceOperate",
data: {
action: 2,
endTime: content.passwordEndTime,
faceData: content.faceData,
lockerId: facemessage.deviceNum,
lockerUserId: content.userPassword,
startTime: content.passwordStartTime
}
}
WXAPI.sendCommand(dataface).then(res => {
console.log(res);
})
}else if(res.cancel) {
wx.showToast({
title: '取消删除该图像信息',


Loading…
Cancel
Save