乡村相册 接口对接
This commit is contained in:
@@ -1,80 +1,43 @@
|
||||
<template>
|
||||
<div class="AttendanceFiexdTime">
|
||||
<div class="form-group">
|
||||
<div class="form-group__item">
|
||||
<div class="form-group__item" hover-class="bg-hover" v-for="(item, index) in config" :key="index">
|
||||
<div class="left">
|
||||
<switch color="#1088F9" checked />
|
||||
<div class="left-right">
|
||||
<h2>大标题</h2>
|
||||
<p>打卡</p>
|
||||
<switch color="#1088F9" :checked="item.status === '1'" :disabled="item.editEnable === '0'" @change="e => onChange(e, index)" />
|
||||
<div class="left-right" @click="toInput(item)">
|
||||
<h2>{{ mapFieldLable(item.type) }}</h2>
|
||||
<p>{{ item.defaultValue || '' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<u-icon name="arrow-right" color="#E1E2E3" size="#E1E2E3"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group__item">
|
||||
<div class="left">
|
||||
<switch color="#1088F9" disabled checked />
|
||||
<div class="left-right">
|
||||
<h2>时间</h2>
|
||||
<p>2022-01-03</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<u-icon name="arrow-right" color="#E1E2E3" size="#E1E2E3"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group__item">
|
||||
<div class="left">
|
||||
<switch color="#1088F9" checked />
|
||||
<div class="left-right">
|
||||
<h2>地点</h2>
|
||||
<p>绿地蓝海</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<u-icon name="arrow-right" color="#E1E2E3" size="#E1E2E3"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group__item">
|
||||
<div class="left">
|
||||
<switch color="#1088F9" checked />
|
||||
<div class="left-right">
|
||||
<h2>拍摄人</h2>
|
||||
<p>陶白白</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<u-icon name="arrow-right" color="#E1E2E3" size="#E1E2E3"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group__item">
|
||||
<div class="left">
|
||||
<switch color="#1088F9" checked />
|
||||
<div class="left-right">
|
||||
<h2>天气</h2>
|
||||
<p>雨夹雪 北风3℃</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="right" @click="toInput(item)">
|
||||
<u-icon name="arrow-right" color="#E1E2E3" size="#E1E2E3"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-btn" hover-class="text-hover">保存</div>
|
||||
<div class="form-btn" hover-class="text-hover" @click="save">保存</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapFieldLable } from './config'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
|
||||
config: [],
|
||||
mapFieldLable
|
||||
}
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
this.config = uni.getStorageSync('waterConfig')
|
||||
|
||||
uni.$on('change', e => {
|
||||
this.config.forEach((v, index) => {
|
||||
if (v.type === e.type) {
|
||||
this.$set(this.config[index], 'defaultValue', e.defaultValue)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -82,6 +45,32 @@
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
},
|
||||
|
||||
onChange (e, index) {
|
||||
this.$set(this.config[index], 'status', e.detail.value ? '1' : '0')
|
||||
},
|
||||
|
||||
toInput (e) {
|
||||
if (e.editEnable === '0') return
|
||||
|
||||
if (e.fieldType === '2') return
|
||||
|
||||
uni.setStorageSync('formConfig', e)
|
||||
this.linkTo('./Form')
|
||||
},
|
||||
|
||||
save () {
|
||||
for (let i = 0; i < this.config.length; i ++) {
|
||||
if ((this.config[i].fieldType === '0' || this.config[i].fieldType === '1') && !this.config[i].defaultValue && this.config[i].status === '1') {
|
||||
return this.$u.toast(`请输入${this.mapFieldLable(this.config[i].type)}`)
|
||||
}
|
||||
}
|
||||
|
||||
uni.$emit('change', this.config)
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +111,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 160px;
|
||||
padding: 32rpx 0;
|
||||
font-size: 32px;
|
||||
color: #333333;
|
||||
border-bottom: 1px solid #DDDDDD;
|
||||
@@ -134,8 +123,11 @@
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
margin-right: 10px;
|
||||
|
||||
.left-right {
|
||||
flex: 1;
|
||||
margin-left: 36px;
|
||||
|
||||
h2 {
|
||||
|
||||
Reference in New Issue
Block a user