This commit is contained in:
yanran200730
2022-05-25 18:14:07 +08:00
parent 8963a7a28d
commit cb5e8ba833
4 changed files with 10 additions and 13 deletions

View File

@@ -55,7 +55,7 @@
}, },
save () { save () {
uni.$emit('change', this.config) uni.$emit('filedChange', this.config)
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })

View File

@@ -49,7 +49,7 @@
onLoad () { onLoad () {
this.config = uni.getStorageSync('waterConfig') this.config = uni.getStorageSync('waterConfig')
uni.$on('change', e => { uni.$on('filedChange', e => {
this.config.forEach((v, index) => { this.config.forEach((v, index) => {
if (v.type === e.type) { if (v.type === e.type) {
this.$set(this.config[index], 'defaultValue', e.defaultValue) this.$set(this.config[index], 'defaultValue', e.defaultValue)

View File

@@ -29,6 +29,7 @@
week: '', week: '',
title: '定格在这一刻', title: '定格在这一刻',
address: '', address: '',
configList: []
} }
}, },

View File

@@ -3,8 +3,8 @@
<div class="top"> <div class="top">
<h2>{{ title }}</h2> <h2>{{ title }}</h2>
<div class="right"> <div class="right">
<h2 v-if="isShowTime">{{ time }}</h2> <h2>{{ time }}</h2>
<p v-if="isShowDate">{{ date }}</p> <p>{{ date }}</p>
</div> </div>
</div> </div>
<div class="info"> <div class="info">
@@ -56,6 +56,7 @@
isServiceName: false, isServiceName: false,
text: '', text: '',
isShowText: '', isShowText: '',
configList: []
} }
}, },
@@ -90,20 +91,15 @@
handler: function (v) { handler: function (v) {
if (v.length) { if (v.length) {
const address = v.filter(v => v.type === '3')[0] const address = v.filter(v => v.type === '3')[0]
const date = v.filter(v => v.type === '1')[0]
const time = v.filter(v => v.type === '0')[0]
const gridUserName = v.filter(v => v.type === '9')[0] const gridUserName = v.filter(v => v.type === '9')[0]
const gridName = v.filter(v => v.type === '10')[0] const gridName = v.filter(v => v.type === '10')[0]
const title = v.filter(v => v.type === '8')[0] const title = v.filter(v => v.type === '8')[0]
const serviceName = v.filter(v => v.type === '11')[0] const serviceName = v.filter(v => v.type === '11')[0]
const text = v.filter(v => v.type === '12')[0] const text = v.filter(v => v.type === '12')[0]
this.isShowAddress = address.status === '1' this.isShowAddress = address.status === '1'
this.isShowDate = date.status === '1'
this.isShowGridName = gridName.status === '1' this.isShowGridName = gridName.status === '1'
this.isServiceName = serviceName.status === '1' this.isServiceName = serviceName.status === '1'
this.isShowText = text.status === '1' this.isShowText = text.status === '1'
this.isShowDate = date.status === '1'
this.isShowTime = time.status === '1'
this.title = title.defaultValue || '' this.title = title.defaultValue || ''
this.gridUserName = gridUserName.defaultValue || '' this.gridUserName = gridUserName.defaultValue || ''
this.gridName = gridName.defaultValue || '' this.gridName = gridName.defaultValue || ''
@@ -125,6 +121,9 @@
return v return v
}) })
uni.$on('change', e => {
this.configList = e
})
this.date = this.$dayjs(new Date).format('YYYY-MM-DD') this.date = this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm') this.time = this.$dayjs().format('HH:mm')
@@ -133,14 +132,11 @@
this.time = this.$dayjs().format('HH:mm') this.time = this.$dayjs().format('HH:mm')
this.week = new Date().getDay() this.week = new Date().getDay()
}, 1000) }, 1000)
uni.$on('change', e => {
this.configList = e
})
}, },
destroyed () { destroyed () {
clearInterval(this.timer) clearInterval(this.timer)
uni.$off('change')
}, },
methods: { methods: {