Files
dvcp_v2_wxcp_app/src/saas/AppCountryAlbum/ReportConfig.vue
yanran200730 5a8402f781 乡村相册
2022-05-17 18:34:17 +08:00

142 lines
3.2 KiB
Vue

<template>
<div class="report-config">
<div class="form-group">
<div class="form-item" v-for="(item, index) in list" :key="index" :class="[item.type === 'textarea' ? 'textarea' : '']">
<span>{{ item.label }}</span>
<div class="form-item__right" v-if="item.type === 'text'">
<input :placeholder="'请输入' + item.label" v-model="item.value">
<span></span>
</div>
<div class="form-item__right" v-if="item.type === 'date'" @click="currIndex = index, isShowDate = true">
<span :style="{color: item.value ? '#333' : '#999'}">{{ item.value || '请选择' + item.label }}</span>
<u-icon name="arrow-right" color="#E1E2E3" size="#E1E2E3"></u-icon>
</div>
<div class="form-item__right" v-if="item.type === 'textarea'">
<textarea :placeholder="'请输入' + item.label" v-model="item.value" :maxlength="-1"></textarea>
</div>
</div>
</div>
<div class="form-btn" hover-class="text-hover" @click="save">保存</div>
<u-picker mode="time" v-model="isShowDate" :params="params" @confirm="onChange"></u-picker>
</div>
</template>
<script>
export default {
data () {
return {
list: [],
isShowDate: false,
params: {
year: true,
month: true,
day: true
},
currIndex: 0
}
},
onLoad (query) {
this.list = JSON.parse(query.params)
},
methods: {
onChange (e) {
this.$set(this.list[this.currIndex], 'value', `${e.year}-${e.month}-${e.day}`)
},
save () {
uni.$emit('change', this.list)
uni.navigateBack({
delta: 1
})
}
}
}
</script>
<style lang="scss" scoped>
.report-config {
padding-bottom: 130px;
* {
line-height: 1;
box-sizing: border-box;
}
.form-btn {
position: fixed;
bottom: 0;
left: 0;
z-index: 1;
width: 100%;
height: 112px;
line-height: 112px;
text-align: center;
color: #fff;
font-size: 32px;
background: #1365DD;
&:active {
opacity: 0.8;
}
}
.form-group {
margin-bottom: 16px;
padding: 0 32px;
background: #fff;
.form-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 120px;
font-size: 32px;
color: #333333;
border-bottom: 1px solid #DDDDDD;
&:last-child {
border: none;
}
& > span {
margin-right: 20px;
}
&.textarea {
display: block;
height: auto;
padding: 32px 0;
textarea {
width: 100%;
margin-top: 20px;
text-align: left;
}
}
.form-item__right {
display: flex;
align-items: center;
justify-content: flex-end;
text-align: right;
height: 100%;
flex: 1;
span {
font-size: 30px;
color: #333;
}
input {
width: 100%;
height: 100%;
text-align: right;
font-size: 30px;
color: #333;
}
}
}
}
}
</style>