You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
4.9 KiB

<template>
<view class="page">
<u-navbar
title="处理结果上报"
back-icon-color="#FFFFFF"
title-color="#FFFFFF"
leftText="返回"
:autoBack="true"
:placeholder="true"
/>
<view class="view-forms">
<uni-forms
ref="valiForm"
:rules="rules"
:modelValue="valiFormData"
label-position="top"
>
<uni-forms-item label="处理前照片" required name="name">
<view class="img-box">
<img
@click="previewImage(index)"
v-for="(image, index) in imageList"
:key="index"
:src="image"
/>
</view>
</uni-forms-item>
<uni-forms-item label="处理后照片" required name="age">
<uni-file-picker
class="uni-file-picker"
ref="filePicker"
limit="9"
title=""
styleType="bottom"
></uni-file-picker>
</uni-forms-item>
<uni-forms-item label="处理说明" required name="introduction">
<uni-easyinput
type="textarea"
v-model="valiFormData.introduction"
placeholder="请输入内容"
/>
</uni-forms-item>
</uni-forms>
</view>
<view class="footer">
<button class="btn-add" @click="submit('valiForm')"></button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imageList: [
"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao-small.jpg",
"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao-small.jpg",
"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao-small.jpg",
],
// 校验表单数据
valiFormData: {
name: "",
age: "",
introduction: "",
},
// 校验规则
rules: {
name: {
rules: [
{
required: true,
errorMessage: "姓名不能为空",
},
],
},
age: {
rules: [
{
required: true,
errorMessage: "年龄不能为空",
},
{
format: "number",
errorMessage: "年龄只能输入数字",
},
],
},
},
};
},
computed: {},
onLoad() {},
onReady() {},
methods: {
previewImage(index) {
uni.previewImage({
urls: this.imageList,
current: index,
indicator: this.currentIndicator,
loop: this.isLoop,
});
},
changeSelect(e) {},
submit(ref) {
this.$refs[ref]
.validate()
.then((res) => {
console.log("success", res);
uni.showToast({
title: `校验通过`,
});
})
.catch((err) => {
console.log("err", err);
});
},
},
};
</script>
<style lang="scss" scoped>
.view-forms {
padding: 30rpx 20rpx 240rpx 20rpx;
.img-box {
width: 100%;
height: auto;
margin: 16rpx auto;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
background: #ffffff;
box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(57, 118, 241, 0.06);
padding: 30rpx;
}
.img-box > img {
width: 200rpx;
height: 200rpx;
object-fit: cover;
margin: 16rpx 0;
}
.img-box:after {
content: "";
display: block;
width: 200rpx;
}
/deep/ .uni-forms-item {
margin-bottom: 15rpx;
}
/deep/.uni-forms-item__label {
background-image: url("@/static/images/umale/icon_ind.png");
background-size: 100% 100%;
background-position: bottom;
background-repeat: no-repeat;
height: auto;
margin-top: 26rpx;
& > text {
line-height: 0;
}
& > text {
font-size: 30rpx;
font-family: PingFang SC-Bold, PingFang SC;
// font-weight: bold;
color: #2e2f31;
white-space: nowrap;
}
& > .is-required {
color: #dd524d;
font-weight: bold;
}
}
/deep/ .uni-easyinput {
margin-top: 19rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(57, 118, 241, 0.06);
border-radius: 16rpx;
}
/deep/ .uni-stat-box {
margin-top: 19rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(57, 118, 241, 0.06);
border-radius: 16rpx;
}
.uni-file-picker {
margin-top: 16rpx;
background-color: #ffffff;
padding: 29rpx;
box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(57, 118, 241, 0.06);
border-radius: 16rpx;
}
}
.footer {
position: fixed;
bottom: 0;
z-index: 1;
width: 100%;
background: #ffffff;
border: 1px solid #dce3ec;
padding: 18rpx 28rpx 60rpx 28rpx;
.btn-add {
font-size: 36rpx;
font-family: PingFang SC-Medium, PingFang SC;
height: 88rpx;
background: linear-gradient(90deg, #3976f1 0%, #3ca0f6 100%);
border-radius: 16rpx;
color: #ffffff;
}
}
</style>